15 #define OSG_CULLSTACK 1
17 #include <osg/CullingSet>
18 #include <osg/CullSettings>
19 #include <osg/Viewport>
20 #include <osg/fast_back_stack>
21 #include <osg/Transform>
42 void pushCullingSet();
53 void popProjectionMatrix();
56 void popModelViewMatrix();
58 inline float getFrustumVolume() {
if (_frustumVolume<0.0f) computeFrustumVolume();
return _frustumVolume; }
64 return getCurrentCullingSet().pixelSize(v,radius);
76 return getCurrentCullingSet().clampedPixelSize(v,radius);
87 getCurrentCullingSet().disableAndPushOccludersCurrentMask(nodePath);
92 getCurrentCullingSet().popOccludersCurrentMask(nodePath);
95 inline bool isCulled(
const std::vector<Vec3>& vertices)
97 return getCurrentCullingSet().isCulled(vertices);
102 return bb.
valid() && getCurrentCullingSet().isCulled(bb);
107 return getCurrentCullingSet().isCulled(bs);
114 return getCurrentCullingSet().isCulled(node.
getBound());
118 getCurrentCullingSet().resetCullingMask();
125 getCurrentCullingSet().pushCurrentMask();
130 getCurrentCullingSet().popCurrentMask();
161 const osg::Matrix& matrix = *_modelviewStack.back();
162 return osg::Vec3(matrix(0,1),matrix(1,1),matrix(2,1));
167 const osg::Matrix& matrix = *_modelviewStack.back();
168 return osg::Vec3(-matrix(0,2),-matrix(1,2),-matrix(2,2));
199 void computeFrustumVolume();
207 typedef std::vector< osg::ref_ptr<osg::RefMatrix> >
MatrixList;
CullingStack & getProjectionCullingStack()
bool isCulled(const BoundingSphere &bs)
std::vector< ShadowVolumeOccluder > ShadowVolumeOccluderList
std::vector< CullingSet > CullingStack
const osg::Vec3 & getEyeLocal() const
unsigned int _bbCornerFar
CullingStack & getClipSpaceCullingStack()
const osg::Matrix computeWindowMatrix() const
void popReferenceViewPoint()
void disableAndPushOccludersCurrentMask(NodePath &nodePath)
float clampedPixelSize(const Vec3 &v, float radius) const
CullingStack _clipspaceCullingStack
const BoundingSphere & getBound() const
EyePointStack _eyePointStack
fast_back_stack< ref_ptr< RefMatrix > > MatrixStack
CullingSet & getCurrentCullingSet()
float clampedPixelSize(const BoundingSphere &bs) const
const osg::Vec3 & getViewPointLocal() const
const osg::RefMatrix * getMVPW()
fast_back_stack< ref_ptr< Viewport > > ViewportStack
void setOccluderList(const ShadowVolumeOccluderList &svol)
CullingStack & getModelViewCullingStack()
MatrixStack _projectionStack
ref_ptr< osg::RefMatrix > _identity
const ShadowVolumeOccluderList & getOccluderList() const
CullingStack _projectionCullingStack
osg::Matrix getWindowMatrix()
bool isCulled(const std::vector< Vec3 > &vertices)
unsigned int _index_modelviewCullingStack
unsigned int _bbCornerNear
bool isCulled(const BoundingBox &bb)
EyePointStack _viewPointStack
float pixelSize(const Vec3 &v, float radius) const
fast_back_stack< Vec3 > EyePointStack
std::vector< ShadowVolumeOccluder > OccluderList
const osg::Vec3 getUpLocal() const
void pushReferenceViewPoint(const osg::Vec3 &viewPoint)
ShadowVolumeOccluderList _occluderList
const CullingSet & getCurrentCullingSet() const
bool isCulled(const osg::Node &node)
bool isCullingActive() const
CullingStack _modelviewCullingStack
MatrixList _reuseMatrixList
unsigned int _currentReuseMatrixIndex
void set(const Matrixd &rhs)
ViewportStack _viewportStack
EyePointStack _referenceViewPoints
osg::Viewport * getViewport()
osg::RefMatrix * getProjectionMatrix()
CullingSet * _back_modelviewCullingStack
const osg::Vec3 & getReferenceViewPoint() const
void popOccludersCurrentMask(NodePath &nodePath)
MatrixStack _modelviewStack
const osg::Vec3 getLookVectorLocal() const
osg::RefMatrix * createOrReuseMatrix(const osg::Matrix &value)
float pixelSize(const BoundingSphere &bs) const
std::vector< osg::ref_ptr< osg::RefMatrix > > MatrixList
osg::RefMatrix * getModelViewMatrix()
std::vector< Node * > NodePath
ShadowVolumeOccluderList & getOccluderList()