OpenSceneGraph 3.6.5
RenderLeaf
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_RENDERLEAF
15#define OSGUTIL_RENDERLEAF 1
16
17#include <osg/ref_ptr>
18#include <osg/Matrix>
19#include <osg/Drawable>
20#include <osg/State>
21
22#include <osgUtil/Export>
23
24namespace osgUtil {
25
26#define OSGUTIL_RENDERBACKEND_USE_REF_PTR
27
28// Forward declare StateGraph
29class StateGraph;
30
34{
35 public:
36
37
38 inline RenderLeaf(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* modelview, float depth=0.0f, unsigned int traversalOrderNumber=0):
39 osg::Referenced(false),
40 _parent(0),
41 _drawable(drawable),
42 _projection(projection),
43 _modelview(modelview),
44 _depth(depth),
45 _traversalOrderNumber(traversalOrderNumber)
46 {
48 }
49
50
51 inline void set(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* modelview, float depth=0.0f, unsigned int traversalOrderNumber=0)
52 {
53 _parent = 0;
54 _drawable = drawable;
55 _projection = projection;
56 _modelview = modelview;
57 _depth = depth;
59 _traversalOrderNumber = traversalOrderNumber;
60 }
61
62 inline void reset()
63 {
64 _parent = 0;
65 _drawable = 0;
66 _projection = 0;
67 _modelview = 0;
68 _depth = 0.0f;
69 _dynamic = false;
71 }
72
73 virtual void render(osg::RenderInfo& renderInfo,RenderLeaf* previous);
74
75 virtual void resizeGLObjectBuffers(unsigned int maxSize)
76 {
77 if (_drawable) _drawable->resizeGLObjectBuffers(maxSize);
78 }
79
80 virtual void releaseGLObjects(osg::State* state=0) const
81 {
82 if (_drawable) _drawable->releaseGLObjects(state);
83 }
84
86 friend class osgUtil::StateGraph;
87
88 public:
89
90
91
93
94#ifdef OSGUTIL_RENDERBACKEND_USE_REF_PTR
96 const osg::Drawable* getDrawable() const { return _drawable.get(); }
97#else
98 osg::Drawable* _drawable;
99 const osg::Drawable* getDrawable() const { return _drawable; }
100#endif
103 float _depth;
106
107 private:
108
110 RenderLeaf():
111 osg::Referenced(false),
112 _parent(0),
113 _drawable(0),
114 _projection(0),
115 _modelview(0),
116 _depth(0.0f),
118
120 RenderLeaf(const RenderLeaf&):osg::Referenced(false) {}
122 RenderLeaf& operator = (const RenderLeaf&) { return *this; }
123
124};
125
126}
127
128#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
RefMatrixd RefMatrix
Definition Matrix:28
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
@ DYNAMIC
Definition Object:218
DataVariance getDataVariance() const
Get the data variance of this object.
Definition Object:231
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Base class for providing reference counted objects.
Definition Referenced:44
Definition RenderInfo:28
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
Container class for all data required for rendering of drawables.
Definition RenderLeaf:34
virtual void releaseGLObjects(osg::State *state=0) const
Definition RenderLeaf:80
void reset()
Definition RenderLeaf:62
StateGraph * _parent
Definition RenderLeaf:92
osg::ref_ptr< osg::Drawable > _drawable
Definition RenderLeaf:95
osg::ref_ptr< osg::RefMatrix > _projection
Definition RenderLeaf:101
unsigned int _traversalOrderNumber
Definition RenderLeaf:105
friend class osgUtil::StateGraph
Allow StateGraph to change the RenderLeaf's _parent.
Definition RenderLeaf:86
RenderLeaf(osg::Drawable *drawable, osg::RefMatrix *projection, osg::RefMatrix *modelview, float depth=0.0f, unsigned int traversalOrderNumber=0)
Definition RenderLeaf:38
virtual void render(osg::RenderInfo &renderInfo, RenderLeaf *previous)
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Definition RenderLeaf:75
void set(osg::Drawable *drawable, osg::RefMatrix *projection, osg::RefMatrix *modelview, float depth=0.0f, unsigned int traversalOrderNumber=0)
Definition RenderLeaf:51
float _depth
Definition RenderLeaf:103
osg::ref_ptr< osg::RefMatrix > _modelview
Definition RenderLeaf:102
bool _dynamic
Definition RenderLeaf:104
const osg::Drawable * getDrawable() const
Definition RenderLeaf:96
StateGraph - contained in a renderBin, defines the scene to be drawn.
Definition StateGraph:42
#define OSGUTIL_EXPORT
Definition Export:40

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