OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RenderInfo.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 OSG_RENDERINFO
15 #define OSG_RENDERINFO 1
16 
17 #include <osg/State>
18 #include <osg/View>
19 
20 namespace osgUtil {
21 // forward declare RenderBin so we can refer to it in RenderInfo
22 class RenderBin;
23 }
24 
25 namespace osg {
26 
28 {
29 public:
30 
32  _view(0) {}
33 
34  RenderInfo(const RenderInfo& rhs):
35  _state(rhs._state),
36  _view(rhs._view),
39  _userData(rhs._userData) {}
40 
41  RenderInfo(State* state, View* view):
42  _state(state),
43  _view(view) {}
44 
46  {
47  _state = rhs._state;
48  _view = rhs._view;
51  _userData = rhs._userData;
52  return *this;
53  }
54 
55  unsigned int getContextID() const { return _state.valid() ? _state->getContextID() : 0; }
56 
57  void setState(State* state) { _state = state; }
58  State* getState() { return _state.get(); }
59  const State* getState() const { return _state.get(); }
60 
61  void setView(View* view) { _view = view; }
62  View* getView() { return _view; }
63  const View* getView() const { return _view; }
64 
65  void pushCamera(Camera* camera) { _cameraStack.push_back(camera); }
66  void popCamera() { if (!_cameraStack.empty()) _cameraStack.pop_back(); }
67 
68  typedef std::vector<Camera*> CameraStack;
69  CameraStack& getCameraStack() { return _cameraStack; }
70 
71  Camera* getCurrentCamera() { return _cameraStack.empty() ? 0 : _cameraStack.back(); }
72 
73  void pushRenderBin(osgUtil::RenderBin* bin) { _renderBinStack.push_back(bin); }
74  void popRenderBin() { _renderBinStack.pop_back(); }
75 
76  typedef std::vector<osgUtil::RenderBin*> RenderBinStack;
77  RenderBinStack& getRenderBinStack() { return _renderBinStack; }
78 
79  void setUserData(Referenced* userData) { _userData = userData; }
80  Referenced* getUserData() { return _userData.get(); }
81  const Referenced* getUserData() const { return _userData.get(); }
82 
83 protected:
84 
85 
88  CameraStack _cameraStack;
89  RenderBinStack _renderBinStack;
91 };
92 
93 }
94 
95 #endif
std::vector< Camera * > CameraStack
Definition: RenderInfo.h:68
void pushCamera(Camera *camera)
Definition: RenderInfo.h:65
CameraStack & getCameraStack()
Definition: RenderInfo.h:69
void setUserData(Referenced *userData)
Definition: RenderInfo.h:79
View * getView()
Definition: RenderInfo.h:62
Camera * getCurrentCamera()
Definition: RenderInfo.h:71
ref_ptr< State > _state
Definition: RenderInfo.h:86
void setView(View *view)
Definition: RenderInfo.h:61
std::vector< osgUtil::RenderBin * > RenderBinStack
Definition: RenderInfo.h:76
void popRenderBin()
Definition: RenderInfo.h:74
const View * getView() const
Definition: RenderInfo.h:63
const Referenced * getUserData() const
Definition: RenderInfo.h:81
RenderInfo(State *state, View *view)
Definition: RenderInfo.h:41
void setState(State *state)
Definition: RenderInfo.h:57
RenderInfo & operator=(const RenderInfo &rhs)
Definition: RenderInfo.h:45
const State * getState() const
Definition: RenderInfo.h:59
RenderBinStack & getRenderBinStack()
Definition: RenderInfo.h:77
CameraStack _cameraStack
Definition: RenderInfo.h:88
Referenced * getUserData()
Definition: RenderInfo.h:80
State * getState()
Definition: RenderInfo.h:58
void pushRenderBin(osgUtil::RenderBin *bin)
Definition: RenderInfo.h:73
Definition: AlphaFunc.h:19
ref_ptr< Referenced > _userData
Definition: RenderInfo.h:90
unsigned int getContextID() const
Definition: RenderInfo.h:55
RenderInfo(const RenderInfo &rhs)
Definition: RenderInfo.h:34
Definition: View.h:29
RenderBinStack _renderBinStack
Definition: RenderInfo.h:89
void popCamera()
Definition: RenderInfo.h:66
Shader generator framework.
Definition: RenderInfo.h:20