1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Move the declaration of ComputeLightSpaceBounds to the header so that it can be accessed from other compilation units.

(cherry picked from commit 8ac4fb208897a18da4934dd6f2fe84560b44ba9d)
This commit is contained in:
AnyOldName3 2018-02-04 23:27:45 +00:00
parent 6251e0519e
commit cb6767b4fc
2 changed files with 140 additions and 120 deletions

View File

@ -227,10 +227,7 @@ namespace SceneUtil
}
}
class ComputeLightSpaceBounds : public osg::NodeVisitor, public osg::CullStack
{
public:
ComputeLightSpaceBounds(osg::Viewport* viewport, const osg::Matrixd& projectionMatrix, osg::Matrixd& viewMatrix) :
MWShadow::ComputeLightSpaceBounds::ComputeLightSpaceBounds(osg::Viewport* viewport, const osg::Matrixd& projectionMatrix, osg::Matrixd& viewMatrix) :
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN)
{
setCullingMode(osg::CullSettings::VIEW_FRUSTUM_CULLING);
@ -240,7 +237,7 @@ namespace SceneUtil
pushModelViewMatrix(new osg::RefMatrix(viewMatrix), osg::Transform::ABSOLUTE_RF);
}
void apply(osg::Node& node)
void MWShadow::ComputeLightSpaceBounds::apply(osg::Node& node)
{
if (isCulled(node)) return;
@ -253,7 +250,7 @@ namespace SceneUtil
popCurrentMask();
}
void apply(osg::Geode& node)
void MWShadow::ComputeLightSpaceBounds::apply(osg::Geode& node)
{
if (isCulled(node)) return;
@ -272,7 +269,7 @@ namespace SceneUtil
popCurrentMask();
}
void apply(osg::Drawable& drawable)
void MWShadow::ComputeLightSpaceBounds::apply(osg::Drawable& drawable)
{
if (isCulled(drawable)) return;
@ -285,19 +282,19 @@ namespace SceneUtil
popCurrentMask();
}
void apply(osg::Billboard&)
void MWShadow::ComputeLightSpaceBounds::apply(osg::Billboard&)
{
OSG_INFO << "Warning Billboards not yet supported" << std::endl;
return;
}
void apply(osg::Projection&)
void MWShadow::ComputeLightSpaceBounds::apply(osg::Projection&)
{
// projection nodes won't affect a shadow map so their subgraphs should be ignored
return;
}
void apply(osg::Transform& transform)
void MWShadow::ComputeLightSpaceBounds::apply(osg::Transform& transform)
{
if (isCulled(transform)) return;
@ -321,13 +318,13 @@ namespace SceneUtil
}
void apply(osg::Camera&)
void MWShadow::ComputeLightSpaceBounds::apply(osg::Camera&)
{
// camera nodes won't affect a shadow map so their subgraphs should be ignored
return;
}
void updateBound(const osg::BoundingBox& bb)
void MWShadow::ComputeLightSpaceBounds::updateBound(const osg::BoundingBox& bb)
{
if (!bb.valid()) return;
@ -343,7 +340,7 @@ namespace SceneUtil
update(bb.corner(7) * matrix);
}
void update(const osg::Vec3& v)
void MWShadow::ComputeLightSpaceBounds::update(const osg::Vec3& v)
{
if (v.z()<-1.0f)
{
@ -359,9 +356,6 @@ namespace SceneUtil
_bb.expandBy(osg::Vec3(x, y, v.z()));
}
osg::BoundingBox _bb;
};
void MWShadow::cull(osgUtil::CullVisitor& cv)
{
if (!enableShadows)

View File

@ -22,6 +22,32 @@ namespace SceneUtil
virtual Shader::ShaderManager::DefineMap getShadowDefines();
virtual Shader::ShaderManager::DefineMap getShadowsDisabledDefines();
class ComputeLightSpaceBounds : public osg::NodeVisitor, public osg::CullStack
{
public:
ComputeLightSpaceBounds(osg::Viewport* viewport, const osg::Matrixd& projectionMatrix, osg::Matrixd& viewMatrix);
void apply(osg::Node& node);
void apply(osg::Geode& node);
void apply(osg::Drawable& drawable);
void apply(osg::Billboard&);
void apply(osg::Projection&);
void apply(osg::Transform& transform);
void apply(osg::Camera&);
void updateBound(const osg::BoundingBox& bb);
void update(const osg::Vec3& v);
osg::BoundingBox _bb;
};
protected:
const int debugTextureUnit;