Ran script to remove trailing spaces and tabs
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*
|
||||
* ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski
|
||||
@@ -33,7 +33,7 @@ MinimalCullBoundsShadowMap::MinimalCullBoundsShadowMap
|
||||
{
|
||||
}
|
||||
|
||||
MinimalCullBoundsShadowMap::~MinimalCullBoundsShadowMap()
|
||||
MinimalCullBoundsShadowMap::~MinimalCullBoundsShadowMap()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ void MinimalCullBoundsShadowMap::ViewData::init
|
||||
void MinimalCullBoundsShadowMap::ViewData::aimShadowCastingCamera
|
||||
( const osg::Light *light,
|
||||
const osg::Vec4 &lightPos,
|
||||
const osg::Vec3 &lightDir,
|
||||
const osg::Vec3 &lightDir,
|
||||
const osg::Vec3 &lightUp )
|
||||
{
|
||||
MinimalShadowMap::ViewData::aimShadowCastingCamera
|
||||
@@ -60,7 +60,7 @@ void MinimalCullBoundsShadowMap::ViewData::aimShadowCastingCamera
|
||||
void MinimalCullBoundsShadowMap::ViewData::cullShadowReceivingScene( )
|
||||
{
|
||||
RenderLeafList rllOld, rllNew;
|
||||
|
||||
|
||||
GetRenderLeaves( _cv->getRenderStage(), rllOld );
|
||||
|
||||
MinimalShadowMap::ViewData::cullShadowReceivingScene( );
|
||||
@@ -70,28 +70,28 @@ void MinimalCullBoundsShadowMap::ViewData::cullShadowReceivingScene( )
|
||||
RemoveOldRenderLeaves( rllNew, rllOld );
|
||||
RemoveIgnoredRenderLeaves( rllNew );
|
||||
|
||||
osg::Matrix projectionToModelSpace =
|
||||
osg::Matrix::inverse( *_modellingSpaceToWorldPtr *
|
||||
osg::Matrix projectionToModelSpace =
|
||||
osg::Matrix::inverse( *_modellingSpaceToWorldPtr *
|
||||
*_cv->getModelViewMatrix() * *_cv->getProjectionMatrix() );
|
||||
|
||||
osg::BoundingBox bb;
|
||||
if( *_cv->getProjectionMatrix() != _clampedProjection ) {
|
||||
|
||||
osg::Polytope polytope;
|
||||
#if 1
|
||||
#if 1
|
||||
polytope.setToUnitFrustum();
|
||||
#else
|
||||
polytope.add( osg::Plane( 0.0,0.0,-1.0,1.0 ) ); // only far plane
|
||||
#endif
|
||||
polytope.transformProvidingInverse( *_modellingSpaceToWorldPtr *
|
||||
*_cv->getModelViewMatrix() * _clampedProjection );
|
||||
|
||||
|
||||
bb = ComputeRenderLeavesBounds( rllNew, projectionToModelSpace, polytope );
|
||||
} else {
|
||||
bb = ComputeRenderLeavesBounds( rllNew, projectionToModelSpace );
|
||||
}
|
||||
|
||||
cutScenePolytope( *_modellingSpaceToWorldPtr,
|
||||
|
||||
cutScenePolytope( *_modellingSpaceToWorldPtr,
|
||||
osg::Matrix::inverse( *_modellingSpaceToWorldPtr ), bb );
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ void MinimalCullBoundsShadowMap::ViewData::GetRenderLeaves
|
||||
osgUtil::RenderBin::RenderBinList& bins = rb->getRenderBinList();
|
||||
osgUtil::RenderBin::RenderBinList::const_iterator rbitr;
|
||||
|
||||
// scan pre render bins
|
||||
// scan pre render bins
|
||||
for(rbitr = bins.begin(); rbitr!=bins.end() && rbitr->first<0; ++rbitr )
|
||||
GetRenderLeaves( rbitr->second.get(), rll );
|
||||
|
||||
@@ -110,15 +110,15 @@ void MinimalCullBoundsShadowMap::ViewData::GetRenderLeaves
|
||||
osgUtil::RenderBin::RenderLeafList::const_iterator rlitr;
|
||||
for( rlitr= renderLeafList.begin(); rlitr!= renderLeafList.end(); ++rlitr )
|
||||
{
|
||||
rll.push_back( *rlitr );
|
||||
rll.push_back( *rlitr );
|
||||
}
|
||||
|
||||
// scan coarse grained ordering.
|
||||
osgUtil::RenderBin::StateGraphList& stateGraphList = rb->getStateGraphList();
|
||||
osgUtil::RenderBin::StateGraphList::const_iterator oitr;
|
||||
osgUtil::RenderBin::StateGraphList::const_iterator oitr;
|
||||
for( oitr= stateGraphList.begin(); oitr!= stateGraphList.end(); ++oitr )
|
||||
{
|
||||
for( osgUtil::StateGraph::LeafList::const_iterator dw_itr =
|
||||
for( osgUtil::StateGraph::LeafList::const_iterator dw_itr =
|
||||
(*oitr)->_leaves.begin(); dw_itr != (*oitr)->_leaves.end(); ++dw_itr)
|
||||
{
|
||||
rll.push_back( dw_itr->get() );
|
||||
@@ -126,7 +126,7 @@ void MinimalCullBoundsShadowMap::ViewData::GetRenderLeaves
|
||||
}
|
||||
|
||||
// scan post render bins
|
||||
for(; rbitr!=bins.end(); ++rbitr )
|
||||
for(; rbitr!=bins.end(); ++rbitr )
|
||||
GetRenderLeaves( rbitr->second.get(), rll );
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
{
|
||||
if ( !a ) return false; // NULL render leaf goes last
|
||||
return !b ||
|
||||
a->_projection < b->_projection ||
|
||||
a->_projection < b->_projection ||
|
||||
(a->_projection == b->_projection && a->_modelview < b->_modelview);
|
||||
}
|
||||
};
|
||||
@@ -170,7 +170,7 @@ inline bool CheckAndMultiplyBoxIfWithinPolytope
|
||||
#if 1
|
||||
for( int i = 0; i < 3; i ++ )
|
||||
for( int j = 0; j < 3; j ++ )
|
||||
if( s[i][j] < 0 ) bb._min[j] += s[i][j]; else bb._max[j] += s[i][j];
|
||||
if( s[i][j] < 0 ) bb._min[j] += s[i][j]; else bb._max[j] += s[i][j];
|
||||
#else
|
||||
b.expandBy( o + s[0] );
|
||||
b.expandBy( o + s[1] );
|
||||
@@ -215,7 +215,7 @@ unsigned MinimalCullBoundsShadowMap::ViewData::RemoveIgnoredRenderLeaves
|
||||
{
|
||||
unsigned count = 0;
|
||||
|
||||
for( RenderLeafList::iterator it = rll.begin(); it != rll.end(); ++it )
|
||||
for( RenderLeafList::iterator it = rll.begin(); it != rll.end(); ++it )
|
||||
{
|
||||
if( !*it ) continue;
|
||||
|
||||
@@ -225,10 +225,10 @@ unsigned MinimalCullBoundsShadowMap::ViewData::RemoveIgnoredRenderLeaves
|
||||
if( !name || name[0] != 'L' ) continue;
|
||||
|
||||
if( !strcmp( name, "LightPointDrawable" ) ||
|
||||
!strcmp( name, "LightPointSpriteDrawable" ) )
|
||||
!strcmp( name, "LightPointSpriteDrawable" ) )
|
||||
{
|
||||
*it = NULL; //ignored = invalidate this in new render leaves list
|
||||
count++;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ unsigned MinimalCullBoundsShadowMap::ViewData::RemoveIgnoredRenderLeaves
|
||||
|
||||
osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds
|
||||
( RenderLeafList &rll, osg::Matrix & projectionToWorld )
|
||||
{
|
||||
{
|
||||
osg::BoundingBox bbResult;
|
||||
|
||||
if( rll.size() == 0 ) return bbResult;
|
||||
@@ -258,8 +258,8 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds
|
||||
|
||||
// Don't trust already computed bounds for cull generated drawables
|
||||
// LightPointDrawable & LightPointSpriteDrawable are such examples
|
||||
// they store wrong recorded bounds from very first pass
|
||||
if( rl && rl->_modelview == NULL )
|
||||
// they store wrong recorded bounds from very first pass
|
||||
if( rl && rl->_modelview == NULL )
|
||||
rl->_drawable->dirtyBound();
|
||||
|
||||
// Stay as long as possible in model space to minimize matrix ops
|
||||
@@ -267,10 +267,10 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds
|
||||
bb.expandBy( rl->_drawable->getBound() );
|
||||
} else {
|
||||
if( bb.valid() ) {
|
||||
// Conditions to avoid matrix multiplications
|
||||
if( projection.valid() )
|
||||
// Conditions to avoid matrix multiplications
|
||||
if( projection.valid() )
|
||||
{
|
||||
if( projection.get() != ptrProjection )
|
||||
if( projection.get() != ptrProjection )
|
||||
{
|
||||
ptrProjection = projection.get();
|
||||
viewToWorld = *ptrProjection * projectionToWorld;
|
||||
@@ -280,7 +280,7 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds
|
||||
ptrViewToWorld = &projectionToWorld;
|
||||
}
|
||||
|
||||
if( modelview.valid() )
|
||||
if( modelview.valid() )
|
||||
{
|
||||
modelToWorld = *modelview.get() * *ptrViewToWorld;
|
||||
ptrModelToWorld = &modelToWorld;
|
||||
@@ -291,7 +291,7 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds
|
||||
for( int i = 0; i < 8; i++ )
|
||||
bbResult.expandBy( bb.corner( i ) * *ptrModelToWorld );
|
||||
}
|
||||
if( !rl ) break;
|
||||
if( !rl ) break;
|
||||
bb = rl->_drawable->getBound();
|
||||
modelview = rl->_modelview;
|
||||
projection = rl->_projection;
|
||||
@@ -305,7 +305,7 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds
|
||||
|
||||
osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds
|
||||
( RenderLeafList &rll, osg::Matrix & projectionToWorld, osg::Polytope & p )
|
||||
{
|
||||
{
|
||||
osg::BoundingBox bbResult, bb;
|
||||
|
||||
if( rll.size() == 0 ) return bbResult;
|
||||
@@ -316,7 +316,7 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds
|
||||
osg::ref_ptr< osg::RefMatrix > projection;
|
||||
osg::Matrix viewToWorld, modelToWorld,
|
||||
*ptrProjection = NULL,
|
||||
*ptrViewToWorld = &projectionToWorld,
|
||||
*ptrViewToWorld = &projectionToWorld,
|
||||
*ptrModelToWorld = NULL;
|
||||
|
||||
// compute bounding boxes but skip old ones (placed at the end as NULLs)
|
||||
@@ -327,20 +327,20 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds
|
||||
|
||||
// Don't trust already computed bounds for cull generated drawables
|
||||
// LightPointDrawable & LightPointSpriteDrawable are such examples
|
||||
// they store wrong recorded bounds from very first pass
|
||||
// they store wrong recorded bounds from very first pass
|
||||
if(rl->_modelview == NULL )
|
||||
rl->_drawable->dirtyBound();
|
||||
|
||||
bb = rl->_drawable->getBound();
|
||||
if( !bb.valid() ) continue;
|
||||
|
||||
|
||||
// Stay as long as possible in model space to minimize matrix ops
|
||||
if( rl->_modelview != modelview || rl->_projection != projection ) {
|
||||
|
||||
projection = rl->_projection;
|
||||
if( projection.valid() )
|
||||
if( projection.valid() )
|
||||
{
|
||||
if( projection.get() != ptrProjection )
|
||||
if( projection.get() != ptrProjection )
|
||||
{
|
||||
ptrProjection = projection.get();
|
||||
viewToWorld = *ptrProjection * projectionToWorld;
|
||||
@@ -351,7 +351,7 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds
|
||||
}
|
||||
|
||||
modelview = rl->_modelview;
|
||||
if( modelview.valid() )
|
||||
if( modelview.valid() )
|
||||
{
|
||||
modelToWorld = *modelview.get() * *ptrViewToWorld;
|
||||
ptrModelToWorld = &modelToWorld;
|
||||
|
||||
Reference in New Issue
Block a user