OpenSceneGraph 3.6.5
CollectOccludersVisitor
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_COLLECTOCCLUDERSVISITOR
15#define OSG_COLLECTOCCLUDERSVISITOR 1
16
17#include <osg/NodeVisitor>
18#include <osg/CullStack>
19
20#include <set>
21
22namespace osg {
23
25{
26 public:
27
28
29 typedef std::set<ShadowVolumeOccluder> ShadowVolumeOccluderSet;
30
33
37
38 virtual void reset();
39
40 virtual float getDistanceToEyePoint(const Vec3& pos, bool withLODScale) const;
41 virtual float getDistanceToViewPoint(const Vec3& pos, bool withLODScale) const;
42
43 virtual float getDistanceFromEyePoint(const Vec3& pos, bool withLODScale) const;
44
45 virtual void apply(osg::Node&);
46 virtual void apply(osg::Transform& node);
47 virtual void apply(osg::Projection& node);
48
49 virtual void apply(osg::Switch& node);
50 virtual void apply(osg::LOD& node);
51 virtual void apply(osg::OccluderNode& node);
52
58
63
66
70
75
76
77 protected:
78
80 //CollectOccludersVisitor(const CollectOccludersVisitor&):osg::NodeVisitor(),osg::CullStack() {}
81
83 CollectOccludersVisitor& operator = (const CollectOccludersVisitor&) { return *this; }
84
86 {
87 /*osg::NodeCallback* callback = node.getCullCallback();
88 if (callback) (*callback)(&node,this);
89 else*/ if (node.getNumChildrenWithOccluderNodes()>0) traverse(node);
90 }
91
93 {
94 /*osg::NodeCallback* callback = node.getCullCallback();
95 if (callback) (*callback)(&node,this);
96 else*/ if (node.getNumChildrenWithOccluderNodes()>0) acceptNode->accept(*this);
97 }
98
103
104};
105
106}
107
108#endif
109
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Vec3f Vec3
Definition Vec3:21
float getMinimumShadowOccluderVolume() const
Definition CollectOccludersVisitor:57
void handle_cull_callbacks_and_traverse(osg::Node &node)
Definition CollectOccludersVisitor:85
void setCollectedOccluderSet(const ShadowVolumeOccluderSet &svol)
Definition CollectOccludersVisitor:67
virtual float getDistanceFromEyePoint(const Vec3 &pos, bool withLODScale) const
Get the distance of a point from the eye point, distance value in the eye coordinate system.
virtual void apply(osg::OccluderNode &node)
const ShadowVolumeOccluderSet & getCollectedOccluderSet() const
Definition CollectOccludersVisitor:69
virtual void apply(osg::Transform &node)
virtual void apply(osg::Projection &node)
ShadowVolumeOccluderSet & getCollectedOccluderSet()
Definition CollectOccludersVisitor:68
void setCreateDrawablesOnOccludeNodes(bool flag)
Definition CollectOccludersVisitor:64
virtual void apply(osg::LOD &node)
unsigned int getMaximumNumberOfActiveOccluders() const
Definition CollectOccludersVisitor:62
META_NodeVisitor(osg, CollectOccludersVisitor) virtual Object *cloneType() const
Definition CollectOccludersVisitor:34
float _minimumShadowOccluderVolume
Definition CollectOccludersVisitor:99
ShadowVolumeOccluderSet _occluderSet
Definition CollectOccludersVisitor:102
void setMinimumShadowOccluderVolume(float vol)
Sets the minimum shadow occluder volume that an active occluder must have.
Definition CollectOccludersVisitor:56
void removeOccludedOccluders()
Removes occluded occluders for the collected occluders list, then discards all but MaximumNumberOfAct...
virtual void apply(osg::Switch &node)
void setMaximumNumberOfActiveOccluders(unsigned int num)
Sets the maximum number of occluders to have active for culling purposes.
Definition CollectOccludersVisitor:61
std::set< ShadowVolumeOccluder > ShadowVolumeOccluderSet
Definition CollectOccludersVisitor:29
virtual void reset()
Method to call to reset visitor.
virtual float getDistanceToViewPoint(const Vec3 &pos, bool withLODScale) const
Get the distance from a point to the view point, distance value in local coordinate system.
void handle_cull_callbacks_and_accept(osg::Node &node, osg::Node *acceptNode)
Definition CollectOccludersVisitor:92
unsigned _maximumNumberOfActiveOccluders
Definition CollectOccludersVisitor:100
bool _createDrawables
Definition CollectOccludersVisitor:101
bool getCreateDrawablesOnOccludeNodes() const
Definition CollectOccludersVisitor:65
virtual void apply(osg::Node &)
virtual float getDistanceToEyePoint(const Vec3 &pos, bool withLODScale) const
Get the distance from a point to the eye point, distance value in local coordinate system.
A CullStack class which accumulates the current project, modelview matrices and the CullingSet.
Definition CullStack:28
LOD - Level Of Detail group node which allows switching between children depending on distance from e...
Definition LOD:36
Base class for all internal nodes in the scene graph.
Definition Node:72
unsigned int getNumChildrenWithOccluderNodes() const
Get the number of Children of this node which are or have OccluderNode's.
Definition Node:340
virtual void accept(NodeVisitor &nv)
Visitor Pattern : calls the apply method of a NodeVisitor with this node's type.
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
void traverse(Node &node)
Method for handling traversal of a nodes.
Definition NodeVisitor:274
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
virtual Object * cloneType() const =0
Clone the type of an object, with Object* return type.
OccluderNode is a Group node which provides hooks for adding ConvexPlanarOccluders to the scene.
Definition OccluderNode:27
Projection nodes set up the frustum/orthographic projection used when rendering the scene.
Definition Projection:25
Switch is a Group node that allows switching between children.
Definition Switch:27
A Transform is a group node for which all children are transformed by a 4x4 matrix.
Definition Transform:75
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.