openscenegraph
RenderInfo
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
20namespace osgUtil {
21// forward declare RenderBin so we can refer to it in RenderInfo
22class RenderBin;
23}
24
25namespace osg {
26
28{
29public:
30
32 _view(0) {}
33
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;
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;
78
79 void setUserData(Referenced* userData) { _userData = userData; }
80 Referenced* getUserData() { return _userData.get(); }
81 const Referenced* getUserData() const { return _userData.get(); }
82
83protected:
84
85
91};
92
93}
94
95#endif
Definition RenderBin:34
Definition Camera:45
Definition Referenced:44
Definition RenderInfo:28
const State * getState() const
Definition RenderInfo:59
const View * getView() const
Definition RenderInfo:63
RenderInfo(const RenderInfo &rhs)
Definition RenderInfo:34
CameraStack & getCameraStack()
Definition RenderInfo:69
void popRenderBin()
Definition RenderInfo:74
RenderInfo & operator=(const RenderInfo &rhs)
Definition RenderInfo:45
const Referenced * getUserData() const
Definition RenderInfo:81
RenderInfo()
Definition RenderInfo:31
RenderBinStack & getRenderBinStack()
Definition RenderInfo:77
Referenced * getUserData()
Definition RenderInfo:80
RenderInfo(State *state, View *view)
Definition RenderInfo:41
CameraStack _cameraStack
Definition RenderInfo:88
void pushRenderBin(osgUtil::RenderBin *bin)
Definition RenderInfo:73
void setUserData(Referenced *userData)
Definition RenderInfo:79
ref_ptr< State > _state
Definition RenderInfo:86
State * getState()
Definition RenderInfo:58
std::vector< Camera * > CameraStack
Definition RenderInfo:68
RenderBinStack _renderBinStack
Definition RenderInfo:89
void setState(State *state)
Definition RenderInfo:57
Camera * getCurrentCamera()
Definition RenderInfo:71
unsigned int getContextID() const
Definition RenderInfo:55
std::vector< osgUtil::RenderBin * > RenderBinStack
Definition RenderInfo:76
ref_ptr< Referenced > _userData
Definition RenderInfo:90
void setView(View *view)
Definition RenderInfo:61
View * getView()
Definition RenderInfo:62
void pushCamera(Camera *camera)
Definition RenderInfo:65
void popCamera()
Definition RenderInfo:66
View * _view
Definition RenderInfo:87
Definition State:80
T * get()
Definition State:124
Definition osg/View:30
Definition ref_ptr:32
Shader generator framework.
Definition NodeVisitor:25
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19