OpenSceneGraph 3.6.5
GLObjectsVisitor
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 OSGUTIL_GLOBJECTSVISITOR
15#define OSGUTIL_GLOBJECTSVISITOR 1
16
17#include <OpenThreads/Mutex>
18#include <osg/NodeVisitor>
19#include <osg/Geode>
20#include <osg/State>
21
22#include <osgUtil/Export>
23
24namespace osgUtil {
25
31{
32 public:
33
47
48 typedef unsigned int Mode;
49
56
58
59 virtual void reset()
60 {
62 _stateSetAppliedSet.clear();
63 }
64
65
67 void setMode(Mode mode) { _mode = mode; }
68
70 Mode getMode() const { return _mode; }
71
72
74 void setState(osg::State* state)
75 {
76 _renderInfo.setState(state);
77 }
78
80 {
81 return _renderInfo.getState();
82 }
83
85 {
86 _renderInfo = renderInfo;
87 }
88
90 {
91 return _renderInfo;
92 }
93
96
99
101 virtual void apply(osg::Node& node);
102
103 void apply(osg::Drawable& drawable);
104 void apply(osg::StateSet& stateset);
105
107 void compile(osg::Node& node);
108
109 protected:
110
111 typedef std::set<osg::Drawable*> DrawableAppliedSet;
112 typedef std::set<osg::StateSet*> StatesSetAppliedSet;
113
117
121
122};
123
139
140}
141
142#endif
143
The osgUtil library provides general purpose utility classes such as update, cull and draw traverses,...
Definition NodeVisitor:25
Pure virtual base class for drawable geometry.
Definition Drawable:89
Base class for providing Windowing API agnostic access to creating and managing graphics context.
Definition GraphicsContext:30
Definition GraphicsThread:36
Base class for all internal nodes in the scene graph.
Definition Node:72
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
virtual void reset()
Method to call to reset visitor.
Definition NodeVisitor:167
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Definition RenderInfo:28
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
CheckForGLErrors
Definition State:905
Stores a set of modes and attributes which represent a set of OpenGL state.
Definition StateSet:46
void setState(osg::State *state)
Set the State to use during traversal.
Definition GLObjectsVisitor:74
Mode getMode() const
Get the operational mode.
Definition GLObjectsVisitor:70
osg::RenderInfo _renderInfo
Definition GLObjectsVisitor:115
osg::RenderInfo & getRenderInfo()
Definition GLObjectsVisitor:89
void setCheckForGLErrors(osg::State::CheckForGLErrors check)
Set whether and how often OpenGL errors should be checked for, defaults to osg::State::ONCE_PER_ATTRI...
Definition GLObjectsVisitor:95
void apply(osg::StateSet &stateset)
osg::ref_ptr< osg::Program > _lastCompiledProgram
Definition GLObjectsVisitor:120
ModeValues
Operation modes of the.
Definition GLObjectsVisitor:36
@ SWITCH_OFF_DISPLAY_LISTS
Definition GLObjectsVisitor:38
@ SWITCH_ON_VERTEX_BUFFER_OBJECTS
Definition GLObjectsVisitor:43
@ SWITCH_ON_DISPLAY_LISTS
Definition GLObjectsVisitor:37
@ CHECK_BLACK_LISTED_MODES
Definition GLObjectsVisitor:45
@ SWITCH_OFF_VERTEX_BUFFER_OBJECTS
Definition GLObjectsVisitor:44
@ RELEASE_DISPLAY_LISTS
Definition GLObjectsVisitor:41
@ RELEASE_STATE_ATTRIBUTES
Definition GLObjectsVisitor:42
@ COMPILE_STATE_ATTRIBUTES
Definition GLObjectsVisitor:40
@ COMPILE_DISPLAY_LISTS
Definition GLObjectsVisitor:39
osg::State::CheckForGLErrors getCheckForGLErrors() const
Get whether and how often OpenGL errors should be checked for.
Definition GLObjectsVisitor:98
StatesSetAppliedSet _stateSetAppliedSet
Definition GLObjectsVisitor:119
virtual void apply(osg::Node &node)
Simply traverse using standard NodeVisitor traverse method.
void compile(osg::Node &node)
Do a compile traversal and then reset any state,.
void setMode(Mode mode)
Set the operational mode of what operations to do on the scene graph.
Definition GLObjectsVisitor:67
osg::State * getState()
Definition GLObjectsVisitor:79
Mode _mode
Definition GLObjectsVisitor:114
void apply(osg::Drawable &drawable)
unsigned int Mode
Definition GLObjectsVisitor:48
std::set< osg::StateSet * > StatesSetAppliedSet
Definition GLObjectsVisitor:112
META_NodeVisitor(osgUtil, GLObjectsVisitor) virtual void reset()
Definition GLObjectsVisitor:57
void setRenderInfo(osg::RenderInfo &renderInfo)
Definition GLObjectsVisitor:84
DrawableAppliedSet _drawablesAppliedSet
Definition GLObjectsVisitor:118
osg::State::CheckForGLErrors _checkGLErrors
Definition GLObjectsVisitor:116
GLObjectsVisitor(Mode mode=COMPILE_DISPLAY_LISTS|COMPILE_STATE_ATTRIBUTES|CHECK_BLACK_LISTED_MODES)
Construct a GLObjectsVisitor to traverse all children, operating on node according to specified mode,...
std::set< osg::Drawable * > DrawableAppliedSet
Definition GLObjectsVisitor:111
GLObjectsOperation(GLObjectsVisitor::Mode mode=GLObjectsVisitor::COMPILE_DISPLAY_LISTS|GLObjectsVisitor::COMPILE_STATE_ATTRIBUTES|GLObjectsVisitor::CHECK_BLACK_LISTED_MODES)
GLObjectsOperation(osg::Node *subgraph, GLObjectsVisitor::Mode mode=GLObjectsVisitor::COMPILE_DISPLAY_LISTS|GLObjectsVisitor::COMPILE_STATE_ATTRIBUTES|GLObjectsVisitor::CHECK_BLACK_LISTED_MODES)
GLObjectsVisitor::Mode _mode
Definition GLObjectsVisitor:137
osg::ref_ptr< osg::Node > _subgraph
Definition GLObjectsVisitor:136
#define OSGUTIL_EXPORT
Definition Export:40

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.