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
|
||||
@@ -35,38 +35,38 @@ using namespace osgShadow;
|
||||
#define DEFAULT_DEBUG_HUD_ORIGIN_X 8
|
||||
#define DEFAULT_DEBUG_HUD_ORIGIN_Y 8
|
||||
|
||||
DebugShadowMap::DebugShadowMap():
|
||||
DebugShadowMap::DebugShadowMap():
|
||||
BaseClass(),
|
||||
_hudSize( 2, 2 ),
|
||||
_hudOrigin( -1, -1 ),
|
||||
_viewportSize( DEFAULT_DEBUG_HUD_SIZE_X, DEFAULT_DEBUG_HUD_SIZE_Y ),
|
||||
_viewportOrigin( DEFAULT_DEBUG_HUD_ORIGIN_X, DEFAULT_DEBUG_HUD_ORIGIN_Y ),
|
||||
_viewportOrigin( DEFAULT_DEBUG_HUD_ORIGIN_X, DEFAULT_DEBUG_HUD_ORIGIN_Y ),
|
||||
_orthoSize( 2, 2 ),
|
||||
_orthoOrigin( -1, -1 ),
|
||||
_doDebugDraw( false )
|
||||
{
|
||||
|
||||
|
||||
// Why this fancy 24 bit depth to 24 bit rainbow colors shader ?
|
||||
//
|
||||
// Depth values cannot be easily cast on color component because they are:
|
||||
// a) 24 or 32 bit and we loose lots of precision when cast on 8 bit
|
||||
// Depth values cannot be easily cast on color component because they are:
|
||||
// a) 24 or 32 bit and we loose lots of precision when cast on 8 bit
|
||||
// b) depth value distribution is non linear due to projection division
|
||||
// when cast on componenent color there is usually very minor shade variety
|
||||
// and its often difficult to notice that there is anything in the buffer
|
||||
//
|
||||
// Shader looks complex but it is used only for debug head-up rectangle
|
||||
// so performance impact is not significant.
|
||||
|
||||
//
|
||||
// Shader looks complex but it is used only for debug head-up rectangle
|
||||
// so performance impact is not significant.
|
||||
|
||||
_depthColorFragmentShader = new osg::Shader( osg::Shader::FRAGMENT,
|
||||
#if 0
|
||||
#if 0
|
||||
"uniform sampler2D texture; \n"
|
||||
" \n"
|
||||
"void main(void) \n"
|
||||
"{ \n"
|
||||
" float f = texture2D( texture, vec3( gl_TexCoord[0].xy, 1.0).xy ).r; \n"
|
||||
" gl_FragColor = vec4( 0.0, 1.0 - f, 0.5 - f, 0.5 ); \n"
|
||||
"} \n"
|
||||
#else
|
||||
"} \n"
|
||||
#else
|
||||
"uniform sampler2D texture; \n"
|
||||
" \n"
|
||||
"void main(void) \n"
|
||||
@@ -74,10 +74,10 @@ DebugShadowMap::DebugShadowMap():
|
||||
" float f = texture2D( texture, vec3( gl_TexCoord[0].xy, 1.0).xy ).r; \n"
|
||||
" \n"
|
||||
" f = 256.0 * f; \n"
|
||||
" float fC = floor( f ) / 256.0; \n"
|
||||
" float fC = floor( f ) / 256.0; \n"
|
||||
" \n"
|
||||
" f = 256.0 * fract( f ); \n"
|
||||
" float fS = floor( f ) / 256.0; \n"
|
||||
" float fS = floor( f ) / 256.0; \n"
|
||||
" \n"
|
||||
" f = 256.0 * fract( f ); \n"
|
||||
" float fH = floor( f ) / 256.0; \n"
|
||||
@@ -88,18 +88,18 @@ DebugShadowMap::DebugShadowMap():
|
||||
" vec3 rgb = vec3( ( fC > 0.5 ? ( 1.0 - fC ) : fC ), \n"
|
||||
" abs( fC - 0.333333 ), \n"
|
||||
" abs( fC - 0.666667 ) ); \n"
|
||||
" \n"
|
||||
" \n"
|
||||
" rgb = min( vec3( 1.0, 1.0, 1.0 ), 3.0 * rgb ); \n"
|
||||
" \n"
|
||||
" float fMax = max( max( rgb.r, rgb.g ), rgb.b ); \n"
|
||||
" fMax = 1.0 / fMax; \n"
|
||||
" fMax = 1.0 / fMax; \n"
|
||||
" \n"
|
||||
" vec3 color = fMax * rgb; \n"
|
||||
" \n"
|
||||
" gl_FragColor = vec4( fS + fH * color, 1 ) * gl_Color; \n"
|
||||
"} \n"
|
||||
"} \n"
|
||||
#endif
|
||||
); // end _depthColorFragmentShader
|
||||
); // end _depthColorFragmentShader
|
||||
}
|
||||
|
||||
DebugShadowMap::DebugShadowMap
|
||||
@@ -108,7 +108,7 @@ DebugShadowMap::DebugShadowMap
|
||||
_hudSize( copy._hudSize ),
|
||||
_hudOrigin( copy._hudOrigin ),
|
||||
_viewportSize( copy._viewportSize ),
|
||||
_viewportOrigin( copy._viewportOrigin ),
|
||||
_viewportOrigin( copy._viewportOrigin ),
|
||||
_orthoSize( copy._viewportOrigin ),
|
||||
_orthoOrigin( copy._viewportOrigin ),
|
||||
_doDebugDraw( copy._doDebugDraw )
|
||||
@@ -119,7 +119,7 @@ DebugShadowMap::DebugShadowMap
|
||||
( copy._depthColorFragmentShader->clone(copyop) );
|
||||
}
|
||||
|
||||
DebugShadowMap::~DebugShadowMap()
|
||||
DebugShadowMap::~DebugShadowMap()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -144,9 +144,9 @@ bool DebugShadowMap::ViewData::DebugBoundingBox
|
||||
|
||||
result = bb.center() != bb_prev.center() || bb.radius() != bb_prev.radius();
|
||||
if( result )
|
||||
std::cout << "Box<" << name << "> ("
|
||||
std::cout << "Box<" << name << "> ("
|
||||
<< ( bb._max._v[0] + bb._min._v[0] ) * 0.5 << " "
|
||||
<< ( bb._max._v[1] + bb._min._v[1] ) * 0.5 << " "
|
||||
<< ( bb._max._v[1] + bb._min._v[1] ) * 0.5 << " "
|
||||
<< ( bb._max._v[2] + bb._min._v[2] ) * 0.5 << ") ["
|
||||
<< ( bb._max._v[0] - bb._min._v[0] ) << " "
|
||||
<< ( bb._max._v[1] - bb._min._v[1] ) << " "
|
||||
@@ -170,7 +170,7 @@ bool DebugShadowMap::ViewData::DebugPolytope
|
||||
result = ( p.getPlaneList() != p_prev.getPlaneList() );
|
||||
|
||||
if( result ) {
|
||||
std::cout << "Polytope<" << name
|
||||
std::cout << "Polytope<" << name
|
||||
<< "> size(" << p.getPlaneList().size() << ")"
|
||||
<< std::endl;
|
||||
|
||||
@@ -179,13 +179,13 @@ bool DebugShadowMap::ViewData::DebugPolytope
|
||||
{
|
||||
if( p.getPlaneList()[i] != p_prev.getPlaneList()[i] )
|
||||
{
|
||||
std::cout << "Plane<" << i
|
||||
<< "> ("
|
||||
std::cout << "Plane<" << i
|
||||
<< "> ("
|
||||
<< p.getPlaneList()[i].asVec4()[0] << ", "
|
||||
<< p.getPlaneList()[i].asVec4()[1] << ", "
|
||||
<< p.getPlaneList()[i].asVec4()[2] << ", "
|
||||
<< p.getPlaneList()[i].asVec4()[3] << ")"
|
||||
<< std::endl;
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,7 @@ bool DebugShadowMap::ViewData::DebugMatrix
|
||||
result = ( m != m_prev );
|
||||
|
||||
if( result )
|
||||
std::cout << "Matrix<" << name << "> " << std::endl
|
||||
std::cout << "Matrix<" << name << "> " << std::endl
|
||||
<<"[ " << m(0,0) << " " << m(0,1) << " " << m(0,2) << " " << m(0,3) << " ] " << std::endl
|
||||
<<"[ " << m(1,0) << " " << m(1,1) << " " << m(1,2) << " " << m(1,3) << " ] " << std::endl
|
||||
<<"[ " << m(2,0) << " " << m(2,1) << " " << m(2,2) << " " << m(2,3) << " ] " << std::endl
|
||||
@@ -220,12 +220,12 @@ bool DebugShadowMap::ViewData::DebugMatrix
|
||||
}
|
||||
|
||||
void DebugShadowMap::ViewData::setDebugPolytope
|
||||
( const char * name, const ConvexPolyhedron & polytope,
|
||||
( const char * name, const ConvexPolyhedron & polytope,
|
||||
osg::Vec4 colorOutline, osg::Vec4 colorInside )
|
||||
{
|
||||
if( !getDebugDraw() ) return;
|
||||
|
||||
if( &polytope == NULL ) { // delete
|
||||
if( &polytope == NULL ) { // delete
|
||||
PolytopeGeometry & pg = _polytopeGeometryMap[ std::string( name ) ];
|
||||
for( unsigned int i = 0; i < VECTOR_LENGTH( pg._geometry ) ; i++ )
|
||||
{
|
||||
@@ -256,14 +256,14 @@ void DebugShadowMap::ViewData::setDebugPolytope
|
||||
pg._geometry[i]->setSupportsDisplayList( false );
|
||||
}
|
||||
|
||||
if( _geode[i].valid() &&
|
||||
if( _geode[i].valid() &&
|
||||
!_geode[i]->containsDrawable( pg._geometry[i].get() ) ) {
|
||||
osg::Geode::DrawableList & dl =
|
||||
osg::Geode::DrawableList & dl =
|
||||
const_cast< osg::Geode::DrawableList &>
|
||||
( _geode[i]->getDrawableList() );
|
||||
dl.insert( dl.begin(), pg._geometry[i].get() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,14 +274,14 @@ void DebugShadowMap::ViewData::updateDebugGeometry
|
||||
if( _polytopeGeometryMap.empty() ) return;
|
||||
|
||||
const int num = 2; // = VECTOR_LENGTH( PolytopeGeometry::_geometry );
|
||||
|
||||
osg::Matrix
|
||||
transform[ num ] =
|
||||
{ viewCam->getViewMatrix() *
|
||||
|
||||
osg::Matrix
|
||||
transform[ num ] =
|
||||
{ viewCam->getViewMatrix() *
|
||||
// use near far clamped projection ( precomputed in cullDebugGeometry )
|
||||
( _viewCamera==viewCam ? _viewProjection : viewCam->getProjectionMatrix() ),
|
||||
shadowCam->getViewMatrix() * shadowCam->getProjectionMatrix() },
|
||||
inverse[ num ] =
|
||||
shadowCam->getViewMatrix() * shadowCam->getProjectionMatrix() },
|
||||
inverse[ num ] =
|
||||
{ osg::Matrix::inverse( transform[0] ),
|
||||
osg::Matrix::inverse( transform[1] ) };
|
||||
|
||||
@@ -292,13 +292,13 @@ void DebugShadowMap::ViewData::updateDebugGeometry
|
||||
#if 1
|
||||
frustum[i].transform( inverse[i], transform[i] );
|
||||
#else
|
||||
frustum[i].transform
|
||||
frustum[i].transform
|
||||
( osg::Matrix::inverse( camera[i]->getProjectionMatrix() ),
|
||||
camera[i]->getProjectionMatrix() );
|
||||
frustum[i].transform
|
||||
frustum[i].transform
|
||||
( osg::Matrix::inverse( camera[i]->getViewMatrix() ),
|
||||
camera[i]->getViewMatrix() );
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
#else
|
||||
osg::Polytope frustum[ num ];
|
||||
@@ -320,7 +320,7 @@ void DebugShadowMap::ViewData::updateDebugGeometry
|
||||
for( int i = 0; i < num ; i++ )
|
||||
{
|
||||
|
||||
ConvexPolyhedron cp( pg._polytope );
|
||||
ConvexPolyhedron cp( pg._polytope );
|
||||
cp.cut( frustum[i] );
|
||||
cp.transform( transform[i], inverse[i] );
|
||||
|
||||
@@ -331,13 +331,13 @@ void DebugShadowMap::ViewData::updateDebugGeometry
|
||||
}
|
||||
|
||||
void DebugShadowMap::ViewData::cullDebugGeometry( )
|
||||
{
|
||||
{
|
||||
if( !getDebugDraw() ) return;
|
||||
if( !_camera.valid() ) return;
|
||||
|
||||
// View camera may use clamping projection matrix after traversal.
|
||||
// View camera may use clamping projection matrix after traversal.
|
||||
// Since we need to know exact matrix for drawing the frusta,
|
||||
// we have to compute it here in exactly the same way as cull visitor
|
||||
// we have to compute it here in exactly the same way as cull visitor
|
||||
// will after cull traversal completes view camera subgraph.
|
||||
{
|
||||
_viewProjection = *_cv->getProjectionMatrix();
|
||||
@@ -346,15 +346,15 @@ void DebugShadowMap::ViewData::cullDebugGeometry( )
|
||||
if( _cv->getComputeNearFarMode() ) {
|
||||
|
||||
// Redo steps from CullVisitor::popProjectionMatrix()
|
||||
// which clamps projection matrix when Camera & Projection
|
||||
// which clamps projection matrix when Camera & Projection
|
||||
// completes traversal of their children
|
||||
|
||||
// We have to do this now manually
|
||||
// because we did not complete camera traversal yet but
|
||||
// We have to do this now manually
|
||||
// because we did not complete camera traversal yet but
|
||||
// we need to know how this clamped projection matrix will be
|
||||
|
||||
_cv->computeNearPlane();
|
||||
|
||||
|
||||
osgUtil::CullVisitor::value_type n = _cv->getCalculatedNearPlane();
|
||||
osgUtil::CullVisitor::value_type f = _cv->getCalculatedFarPlane();
|
||||
|
||||
@@ -362,10 +362,10 @@ void DebugShadowMap::ViewData::cullDebugGeometry( )
|
||||
_cv->clampProjectionMatrix( _viewProjection, n, f );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
updateDebugGeometry( _viewCamera.get(), _camera.get() );
|
||||
|
||||
#if 1 // Add geometries of polytopes to main cam Render Stage
|
||||
|
||||
#if 1 // Add geometries of polytopes to main cam Render Stage
|
||||
_transform[0]->accept( *_cv );
|
||||
#else
|
||||
for( PolytopeGeometryMap::iterator itr = _polytopeGeometryMap.begin();
|
||||
@@ -400,7 +400,7 @@ void DebugShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv )
|
||||
if( vp )
|
||||
{
|
||||
// view can be a slave that covers only a fraction of the screen
|
||||
// so adjust debug hud location to proper viewport location
|
||||
// so adjust debug hud location to proper viewport location
|
||||
_viewportOrigin[0] += vp->x();
|
||||
_viewportOrigin[1] += vp->y();
|
||||
|
||||
@@ -413,28 +413,28 @@ void DebugShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv )
|
||||
|
||||
_orthoSize = st->_orthoSize;
|
||||
_orthoOrigin = st->_orthoOrigin;
|
||||
|
||||
|
||||
_depthColorFragmentShader = st->_depthColorFragmentShader;
|
||||
|
||||
// create placeholder geodeds for polytope geometries
|
||||
// rest of their initialization will be performed during camera hud init
|
||||
_geode[0] = new osg::Geode;
|
||||
_geode[1] = new osg::Geode;
|
||||
|
||||
|
||||
_cameraDebugHUD = NULL;//Force debug HUD rebuild ( if needed )
|
||||
}
|
||||
|
||||
|
||||
// Callback used by debugging hud to display Shadow Map to color buffer
|
||||
// Had to do it this way because OSG does not allow to use
|
||||
// the same GL Texture Id with different glTexParams.
|
||||
// Callback simply turns compare mode off via GL while rendering hud and
|
||||
// restores it before rendering the scene with shadows.
|
||||
class DebugShadowMap::DrawableDrawWithDepthShadowComparisonOffCallback:
|
||||
// Had to do it this way because OSG does not allow to use
|
||||
// the same GL Texture Id with different glTexParams.
|
||||
// Callback simply turns compare mode off via GL while rendering hud and
|
||||
// restores it before rendering the scene with shadows.
|
||||
class DebugShadowMap::DrawableDrawWithDepthShadowComparisonOffCallback:
|
||||
public osg::Drawable::DrawCallback
|
||||
{
|
||||
public:
|
||||
DrawableDrawWithDepthShadowComparisonOffCallback( osg::Texture *pTex )
|
||||
DrawableDrawWithDepthShadowComparisonOffCallback( osg::Texture *pTex )
|
||||
: _pTexture( pTex )
|
||||
{
|
||||
}
|
||||
@@ -450,8 +450,8 @@ public:
|
||||
drawable->drawImplementation(ri);
|
||||
|
||||
// Turn it back on
|
||||
glTexParameteri( _pTexture->getTextureTarget(), GL_TEXTURE_COMPARE_MODE_ARB,
|
||||
GL_COMPARE_R_TO_TEXTURE_ARB );
|
||||
glTexParameteri( _pTexture->getTextureTarget(), GL_TEXTURE_COMPARE_MODE_ARB,
|
||||
GL_COMPARE_R_TO_TEXTURE_ARB );
|
||||
}
|
||||
|
||||
osg::ref_ptr< osg::Texture > _pTexture;
|
||||
@@ -459,7 +459,7 @@ public:
|
||||
|
||||
void DebugShadowMap::ViewData::dump( const std::string & filename )
|
||||
{
|
||||
osg::ref_ptr< osg::Group > root = new osg::Group;
|
||||
osg::ref_ptr< osg::Group > root = new osg::Group;
|
||||
osgUtil::CullVisitor * cv = _cv.get();
|
||||
|
||||
#if 1
|
||||
@@ -486,7 +486,7 @@ void DebugShadowMap::ViewData::dump( const std::string & filename )
|
||||
int i = 0;
|
||||
{
|
||||
|
||||
ConvexPolyhedron cp( pg._polytope );
|
||||
ConvexPolyhedron cp( pg._polytope );
|
||||
|
||||
pg._geometry[i] = cp.buildGeometry
|
||||
( pg._colorOutline, pg._colorInside, pg._geometry[i].get() );
|
||||
@@ -504,7 +504,7 @@ void DebugShadowMap::ViewData::dump( const std::string & filename )
|
||||
}
|
||||
|
||||
void DebugShadowMap::ViewData::createDebugHUD( )
|
||||
{
|
||||
{
|
||||
_cameraDebugHUD = new osg::Camera;
|
||||
|
||||
{ // Make sure default HUD layout makes sense
|
||||
@@ -518,7 +518,7 @@ void DebugShadowMap::ViewData::createDebugHUD( )
|
||||
if( _orthoSize[1] <= 0 ) _orthoSize[1] = _viewportSize[1];
|
||||
}
|
||||
|
||||
{ // Initialize hud camera
|
||||
{ // Initialize hud camera
|
||||
osg::Camera * camera = _cameraDebugHUD.get();
|
||||
camera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR);
|
||||
camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF);
|
||||
@@ -526,10 +526,10 @@ void DebugShadowMap::ViewData::createDebugHUD( )
|
||||
camera->setViewport( _viewportOrigin[0], _viewportOrigin[1],
|
||||
_viewportSize[0], _viewportSize[1] );
|
||||
|
||||
camera->setProjectionMatrixAsOrtho(
|
||||
_orthoOrigin[0], _orthoOrigin[0] + _orthoSize[0],
|
||||
camera->setProjectionMatrixAsOrtho(
|
||||
_orthoOrigin[0], _orthoOrigin[0] + _orthoSize[0],
|
||||
_orthoOrigin[1], _orthoOrigin[1] + _orthoSize[1],
|
||||
-10, 10 );
|
||||
-10, 10 );
|
||||
|
||||
camera->setClearMask(GL_DEPTH_BUFFER_BIT);
|
||||
camera->setRenderOrder(osg::Camera::POST_RENDER);
|
||||
@@ -540,12 +540,12 @@ void DebugShadowMap::ViewData::createDebugHUD( )
|
||||
osg::Geode* geode = new osg::Geode;
|
||||
_cameraDebugHUD->addChild(geode);
|
||||
|
||||
// finally create and attach hud geometry
|
||||
// finally create and attach hud geometry
|
||||
osg::Geometry* geometry = osg::createTexturedQuadGeometry
|
||||
( osg::Vec3(_hudOrigin[0],_hudOrigin[1],0),
|
||||
osg::Vec3(_hudSize[0],0,0),
|
||||
osg::Vec3(_hudSize[0],0,0),
|
||||
osg::Vec3(0,_hudSize[1],0) );
|
||||
|
||||
|
||||
osg::StateSet* stateset = _cameraDebugHUD->getOrCreateStateSet();
|
||||
stateset->setTextureAttribute(0,_texture.get(),osg::StateAttribute::ON );
|
||||
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||
@@ -553,7 +553,7 @@ void DebugShadowMap::ViewData::createDebugHUD( )
|
||||
stateset->setAttributeAndModes
|
||||
( new osg::Depth( osg::Depth::ALWAYS, 0, 1, false ) );
|
||||
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
|
||||
|
||||
|
||||
osg::Program* program = new osg::Program;
|
||||
program->addShader( _depthColorFragmentShader.get() );
|
||||
stateset->setAttribute( program );
|
||||
@@ -572,7 +572,7 @@ void DebugShadowMap::ViewData::createDebugHUD( )
|
||||
stateset->setTextureMode(1, GL_TEXTURE_2D, osg::StateAttribute::OFF);
|
||||
stateset->setMode(GL_BLEND, osg::StateAttribute::ON);
|
||||
stateset->setMode(GL_CULL_FACE, osg::StateAttribute::OFF);
|
||||
stateset->setAttribute( new osg::Program() );
|
||||
stateset->setAttribute( new osg::Program() );
|
||||
stateset->setAttributeAndModes
|
||||
( new osg::Depth( osg::Depth::LEQUAL, 0, 1, false ) );
|
||||
|
||||
@@ -585,9 +585,9 @@ void DebugShadowMap::ViewData::createDebugHUD( )
|
||||
}
|
||||
|
||||
_transform[1]->setMatrix
|
||||
( osg::Matrix::translate( 1, 1, 0 ) *
|
||||
( osg::Matrix::translate( 1, 1, 0 ) *
|
||||
osg::Matrix::scale( 0.5, 0.5, 1 ) *
|
||||
osg::Matrix::scale( _hudSize[0], _hudSize[1], 1 ) *
|
||||
osg::Matrix::scale( _hudSize[0], _hudSize[1], 1 ) *
|
||||
osg::Matrix::translate( _hudOrigin[0], _hudOrigin[1], 0 ) );
|
||||
|
||||
_cameraDebugHUD->addChild( _transform[1].get() );
|
||||
@@ -597,7 +597,7 @@ void DebugShadowMap::ViewData::createDebugHUD( )
|
||||
osg::Vec3d DebugShadowMap::ViewData::computeShadowTexelToPixelError
|
||||
( const osg::Matrix & mvpwView,
|
||||
const osg::Matrix & mvpwShadow,
|
||||
const osg::Vec3d & vWorld,
|
||||
const osg::Vec3d & vWorld,
|
||||
const osg::Vec3d & vDelta )
|
||||
{
|
||||
osg::Vec3d vS0 = mvpwShadow * vWorld;
|
||||
@@ -608,13 +608,13 @@ osg::Vec3d DebugShadowMap::ViewData::computeShadowTexelToPixelError
|
||||
|
||||
osg::Vec3d dV = vV1 - vV0;
|
||||
osg::Vec3d dS = vS1 - vS0;
|
||||
|
||||
|
||||
return osg::Vec3( dS[0] / dV[0], dS[1] / dV[1], dS[2] / dV[2] );
|
||||
}
|
||||
|
||||
void DebugShadowMap::ViewData::displayShadowTexelToPixelErrors
|
||||
( const osg::Camera* viewCamera,
|
||||
const osg::Camera* shadowCamera,
|
||||
( const osg::Camera* viewCamera,
|
||||
const osg::Camera* shadowCamera,
|
||||
const ConvexPolyhedron* hull )
|
||||
{
|
||||
osg::Matrix mvpwMain =
|
||||
@@ -627,7 +627,7 @@ void DebugShadowMap::ViewData::displayShadowTexelToPixelErrors
|
||||
shadowCamera->getProjectionMatrix() *
|
||||
shadowCamera->getViewport()->computeWindowMatrix();
|
||||
|
||||
osg::BoundingBox bb =
|
||||
osg::BoundingBox bb =
|
||||
hull->computeBoundingBox( viewCamera->getViewMatrix() );
|
||||
|
||||
osg::Matrix m = viewCamera->getInverseViewMatrix();
|
||||
@@ -643,7 +643,7 @@ void DebugShadowMap::ViewData::displayShadowTexelToPixelErrors
|
||||
std::cout << std::setprecision( 3 ) << " "
|
||||
<< "ne=(" << vne[0] << "," << vne[1] << "," << vne[2] << ") "
|
||||
<< "fe=(" << vfe[0] << "," << vfe[1] << "," << vfe[2] << ") "
|
||||
<< "me=(" << vme[0] << "," << vme[1] << "," << vme[2] << ") "
|
||||
<< "me=(" << vme[0] << "," << vme[1] << "," << vme[2] << ") "
|
||||
<< "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
|
||||
<< "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
|
||||
<< "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
|
||||
|
||||
Reference in New Issue
Block a user