OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RenderLeaf.h
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 
24 namespace osgUtil {
25 
26 #define OSGUTIL_RENDERBACKEND_USE_REF_PTR
27 
28 // Forward declare StateGraph
29 class 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 traversalNumber=0):
39  osg::Referenced(false),
40  _parent(0),
41  _drawable(drawable),
42  _projection(projection),
43  _modelview(modelview),
44  _depth(depth),
45  _traversalNumber(traversalNumber)
46  {
47  _dynamic = (drawable->getDataVariance()==osg::Object::DYNAMIC);
48  }
49 
50 
51  inline void set(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* modelview, float depth=0.0f, unsigned int traversalNumber=0)
52  {
53  _parent = 0;
54  _drawable = drawable;
55  _projection = projection,
56  _modelview = modelview,
57  _depth = depth;
58  _dynamic = (drawable->getDataVariance()==osg::Object::DYNAMIC);
59  _traversalNumber = traversalNumber;
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;
70  _traversalNumber = 0;
71  }
72 
73  virtual void render(osg::RenderInfo& renderInfo,RenderLeaf* previous);
74 
76  friend class osgUtil::StateGraph;
77 
78  public:
79 
80 
81 
83 
84 #ifdef OSGUTIL_RENDERBACKEND_USE_REF_PTR
86  const osg::Drawable* getDrawable() const { return _drawable.get(); }
87 #else
88  osg::Drawable* _drawable;
89  const osg::Drawable* getDrawable() const { return _drawable; }
90 #endif
93  float _depth;
94  bool _dynamic;
95  unsigned int _traversalNumber;
96 
97  private:
98 
100  RenderLeaf():
101  osg::Referenced(false),
102  _parent(0),
103  _drawable(0),
104  _projection(0),
105  _modelview(0),
106  _depth(0.0f),
107  _traversalNumber(0) {}
108 
110  RenderLeaf(const RenderLeaf&):osg::Referenced(false) {}
112  RenderLeaf& operator = (const RenderLeaf&) { return *this; }
113 
114 };
115 
116 }
117 
118 #endif
void set(osg::Drawable *drawable, osg::RefMatrix *projection, osg::RefMatrix *modelview, float depth=0.0f, unsigned int traversalNumber=0)
Definition: RenderLeaf.h:51
StateGraph * _parent
Definition: RenderLeaf.h:82
RenderLeaf(osg::Drawable *drawable, osg::RefMatrix *projection, osg::RefMatrix *modelview, float depth=0.0f, unsigned int traversalNumber=0)
Definition: RenderLeaf.h:38
GLint GLenum GLsizei GLsizei GLsizei depth
Definition: GLU.h:71
DataVariance getDataVariance() const
Definition: Object.h:162
osg::ref_ptr< osg::RefMatrix > _modelview
Definition: RenderLeaf.h:92
T * get() const
Definition: ref_ptr.h:92
osg::ref_ptr< osg::RefMatrix > _projection
Definition: RenderLeaf.h:91
Definition: AlphaFunc.h:19
#define OSGUTIL_EXPORT
Definition: Export.h:40
unsigned int _traversalNumber
Definition: RenderLeaf.h:95
osg::ref_ptr< osg::Drawable > _drawable
Definition: RenderLeaf.h:85
const osg::Drawable * getDrawable() const
Definition: RenderLeaf.h:86
Shader generator framework.
Definition: RenderInfo.h:20