From Wojciech Lewandowski, build fixes for handling Matrix::value_type == float

This commit is contained in:
Robert Osfield
2008-10-06 14:18:27 +00:00
parent df12c7bc68
commit 7e43decf4c
6 changed files with 18 additions and 18 deletions

View File

@@ -99,7 +99,7 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique
*/ */
osg::ref_ptr< osg::Camera > _camera; osg::ref_ptr< osg::Camera > _camera;
osg::Matrix _viewProjection; osg::Matrixd _viewProjection;
osg::Camera * _viewCamera; osg::Camera * _viewCamera;
// Debug hud variables // Debug hud variables

View File

@@ -103,10 +103,10 @@ class OSGSHADOW_EXPORT MinimalShadowMap : public StandardShadowMap
float *_maxFarPlanePtr; float *_maxFarPlanePtr;
float *_minLightMarginPtr; float *_minLightMarginPtr;
ConvexPolyhedron _sceneReceivingShadowPolytope; ConvexPolyhedron _sceneReceivingShadowPolytope;
std::vector< osg::Vec3d > _sceneReceivingShadowPolytopePoints; std::vector< osg::Vec3d > _sceneReceivingShadowPolytopePoints;
osg::Matrix _clampedProjection; osg::Matrixd _clampedProjection;
virtual void init( ThisClass * st, osgUtil::CullVisitor * cv ); virtual void init( ThisClass * st, osgUtil::CullVisitor * cv );
@@ -137,15 +137,15 @@ class OSGSHADOW_EXPORT MinimalShadowMap : public StandardShadowMap
// is remapped to whole clip space (-1..1,-1..1,-1..1). // is remapped to whole clip space (-1..1,-1..1,-1..1).
// Bit mask can be used to limit remaping to selected bounds only. // Bit mask can be used to limit remaping to selected bounds only.
static void trimProjection static void trimProjection
( osg::Matrix & projection, osg::BoundingBox subrange, ( osg::Matrixd & projection, osg::BoundingBox subrange,
unsigned int trimMask = (1|2|4|8|16|32) unsigned int trimMask = (1|2|4|8|16|32)
/*1=left|2=right|4=bottom|8=top|16=near|32=far*/); /*1=left|2=right|4=bottom|8=top|16=near|32=far*/);
static void clampProjection static void clampProjection
( osg::Matrix & projection, float n = 0, float f = FLT_MAX ); ( osg::Matrixd & projection, float n = 0, float f = FLT_MAX );
static void extendProjection static void extendProjection
( osg::Matrix & projection, osg::Viewport * viewport, const osg::Vec2& margin ); ( osg::Matrixd & projection, osg::Viewport * viewport, const osg::Vec2& margin );
}; };
META_ViewDependentShadowTechniqueData( ThisClass, ThisClass::ViewData ) META_ViewDependentShadowTechniqueData( ThisClass, ThisClass::ViewData )

View File

@@ -356,11 +356,11 @@ void DebugShadowMap::ViewData::cullDebugGeometry( )
_cv->computeNearPlane(); _cv->computeNearPlane();
double n = _cv->getCalculatedNearPlane(); osgUtil::CullVisitor::value_type n = _cv->getCalculatedNearPlane();
double f = _cv->getCalculatedFarPlane(); osgUtil::CullVisitor::value_type f = _cv->getCalculatedFarPlane();
if( n < f ) if( n < f )
_cv->clampProjectionMatrix(_viewProjection, n, f ); _cv->clampProjectionMatrix( _viewProjection, n, f );
} }
} }

View File

@@ -58,7 +58,7 @@ void MinimalDrawBoundsShadowMap::ViewData::cullBoundAnalysisScene( )
_boundAnalysisCamera->setViewMatrix( *_cv->getModelViewMatrix() ); _boundAnalysisCamera->setViewMatrix( *_cv->getModelViewMatrix() );
_boundAnalysisCamera->setProjectionMatrix( _clampedProjection ); _boundAnalysisCamera->setProjectionMatrix( _clampedProjection );
osg::Matrix::value_type l,r,b,t,n,f; osg::Matrixd::value_type l,r,b,t,n,f;
_boundAnalysisCamera->getProjectionMatrixAsFrustum( l,r,b,t,n,f ); _boundAnalysisCamera->getProjectionMatrixAsFrustum( l,r,b,t,n,f );
_mainCamera = _cv->getRenderStage()->getCamera(); _mainCamera = _cv->getRenderStage()->getCamera();

View File

@@ -248,11 +248,11 @@ void MinimalShadowMap::ViewData::cullShadowReceivingScene( )
_cv->computeNearPlane(); _cv->computeNearPlane();
double n = _cv->getCalculatedNearPlane(); osgUtil::CullVisitor::value_type n = _cv->getCalculatedNearPlane();
double f = _cv->getCalculatedFarPlane(); osgUtil::CullVisitor::value_type f = _cv->getCalculatedFarPlane();
if( n < f ) if( n < f )
_cv->clampProjectionMatrix(_clampedProjection, n, f ); _cv->clampProjectionMatrix( _clampedProjection, n, f );
} }
// Aditionally clamp far plane if shadows are don't need to be cast as // Aditionally clamp far plane if shadows are don't need to be cast as
@@ -328,7 +328,7 @@ osg::BoundingBox
// Utility methods for adjusting projection matrices // Utility methods for adjusting projection matrices
void MinimalShadowMap::ViewData::trimProjection void MinimalShadowMap::ViewData::trimProjection
( osg::Matrix & projectionMatrix, osg::BoundingBox bb, unsigned int trimMask ) ( osg::Matrixd & projectionMatrix, osg::BoundingBox bb, unsigned int trimMask )
{ {
#if 1 #if 1
if( !bb.valid() || !( trimMask & (1|2|4|8|16|32) ) ) return; if( !bb.valid() || !( trimMask & (1|2|4|8|16|32) ) ) return;
@@ -415,7 +415,7 @@ void MinimalShadowMap::ViewData::trimProjection
} }
void MinimalShadowMap::ViewData::clampProjection void MinimalShadowMap::ViewData::clampProjection
( osg::Matrix & projection, float new_near, float new_far ) ( osg::Matrixd & projection, float new_near, float new_far )
{ {
double r, l, t, b, n, f; double r, l, t, b, n, f;
bool perspective = projection.getFrustum( l, r, b, t, n, f ); bool perspective = projection.getFrustum( l, r, b, t, n, f );
@@ -457,7 +457,7 @@ void MinimalShadowMap::ViewData::clampProjection
// Method computes such new projection which maintains perpective/world ratio // Method computes such new projection which maintains perpective/world ratio
void MinimalShadowMap::ViewData::extendProjection void MinimalShadowMap::ViewData::extendProjection
( osg::Matrix & projection, osg::Viewport * viewport, const osg::Vec2& margin ) ( osg::Matrixd & projection, osg::Viewport * viewport, const osg::Vec2& margin )
{ {
double l,r,b,t,n,f; double l,r,b,t,n,f;

View File

@@ -663,8 +663,8 @@ void StandardShadowMap::ViewData::aimShadowCastingCamera(
const osg::Vec3 &lightUpVector const osg::Vec3 &lightUpVector
/* by default = osg::Vec3( 0, 1 0 )*/ ) /* by default = osg::Vec3( 0, 1 0 )*/ )
{ {
osg::Matrix & view = _camera->getViewMatrix(); osg::Matrixd & view = _camera->getViewMatrix();
osg::Matrix & projection = _camera->getProjectionMatrix(); osg::Matrixd & projection = _camera->getProjectionMatrix();
osg::Vec3 up = lightUpVector; osg::Vec3 up = lightUpVector;
if( up.length2() <= 0 ) up.set( 0,1,0 ); if( up.length2() <= 0 ) up.set( 0,1,0 );