14 #ifndef OSGUTIL_SCENEVIEW
15 #define OSGUTIL_SCENEVIEW 1
18 #include <osg/StateSet>
20 #include <osg/FrameStamp>
21 #include <osg/DisplaySettings>
22 #include <osg/CollectOccludersVisitor>
23 #include <osg/CullSettings>
26 #include <osgUtil/CullVisitor>
49 NO_SCENEVIEW_LIGHT = 0x0,
52 COMPILE_GLOBJECTS_AT_INIT = 0x4,
53 APPLY_GLOBAL_DEFAULTS = 0x8,
54 CLEAR_GLOBAL_STATESET = 0x10,
55 STANDARD_SETTINGS = HEADLIGHT |
56 COMPILE_GLOBJECTS_AT_INIT |
57 APPLY_GLOBAL_DEFAULTS |
68 virtual void setDefaults(
unsigned int options);
71 void setCamera(
osg::Camera* camera,
bool assumeOwnershipOfCamera =
true);
87 osg::Node*
getSceneData(
unsigned int childNo=0) {
return (_camera->getNumChildren()>childNo) ? _camera->getChild(childNo) : 0; }
92 const osg::Node*
getSceneData(
unsigned int childNo=0)
const {
return (_camera->getNumChildren()>childNo) ? _camera->getChild(childNo) : 0; }
149 FRAME_NUMBER_UNIFORM = 1,
150 FRAME_TIME_UNIFORM = 2,
151 DELTA_FRAME_TIME_UNIFORM = 4,
152 SIMULATION_TIME_UNIFORM = 8,
153 DELTA_SIMULATION_TIME_UNIFORM = 16,
154 VIEW_MATRIX_UNIFORM = 32,
155 VIEW_MATRIX_INVERSE_UNIFORM = 64,
156 DEFAULT_UNIFORMS = FRAME_NUMBER_UNIFORM |
158 DELTA_FRAME_TIME_UNIFORM |
159 SIMULATION_TIME_UNIFORM |
160 DELTA_SIMULATION_TIME_UNIFORM |
161 VIEW_MATRIX_UNIFORM |
162 VIEW_MATRIX_INVERSE_UNIFORM,
163 ALL_UNIFORMS = 0x7FFFFFFF
172 void updateUniforms();
177 void setLightingMode(LightingMode mode);
205 void setProjectionMatrixAsOrtho(
double left,
double right,
206 double bottom,
double top,
207 double zNear,
double zFar);
210 void setProjectionMatrixAsOrtho2D(
double left,
double right,
211 double bottom,
double top);
214 void setProjectionMatrixAsFrustum(
double left,
double right,
215 double bottom,
double top,
216 double zNear,
double zFar);
220 void setProjectionMatrixAsPerspective(
double fovy,
double aspectRatio,
221 double zNear,
double zFar);
231 bool getProjectionMatrixAsOrtho(
double& left,
double& right,
232 double& bottom,
double& top,
233 double& zNear,
double& zFar)
const;
237 bool getProjectionMatrixAsFrustum(
double& left,
double& right,
238 double& bottom,
double& top,
239 double& zNear,
double& zFar)
const;
246 bool getProjectionMatrixAsPerspective(
double& fovy,
double& aspectRatio,
247 double& zNear,
double& zFar)
const;
324 void collateReferencesToDependentCameras();
327 void clearReferencesToDependentCameras();
343 PROPORTIONAL_TO_SCREEN_DISTANCE
349 _fusionDistanceMode = mode;
350 _fusionDistanceValue = value;
394 bool projectWindowXYIntoObject(
int x,
int y,
osg::Vec3& near_point,
osg::Vec3& far_point)
const;
416 if (_computeStereoMatricesCallback.valid())
return _computeStereoMatricesCallback->computeLeftEyeProjection(projection);
417 else return computeLeftEyeProjectionImplementation(projection);
422 if (_computeStereoMatricesCallback.valid())
return _computeStereoMatricesCallback->computeLeftEyeView(view);
423 else return computeLeftEyeViewImplementation(view);
428 if (_computeStereoMatricesCallback.valid())
return _computeStereoMatricesCallback->computeRightEyeProjection(projection);
429 else return computeRightEyeProjectionImplementation(projection);
434 if (_computeStereoMatricesCallback.valid())
return _computeStereoMatricesCallback->computeRightEyeView(view);
435 else return computeRightEyeViewImplementation(view);
455 virtual void inheritCullSettings(
const osg::CullSettings& settings,
unsigned int inheritanceMask);
468 virtual void update();
482 virtual void releaseAllGLObjects();
osgUtil::StateGraph * getStateGraphLeft()
const osg::Matrixd & getProjectionMatrix() const
const osg::CollectOccludersVisitor * getCollectOccludersVisitor() const
osg::ref_ptr< osg::Light > _light
ComputeStereoMatricesCallback * getComputeStereoMatricesCallback()
osg::ref_ptr< osg::NodeVisitor > _updateVisitor
void setStateGraph(osgUtil::StateGraph *rg)
virtual void inheritCullSettings(const osg::CullSettings &settings)
GLenum getDrawBufferValue() const
osg::ref_ptr< osgUtil::RenderStage > _renderStageLeft
osg::ref_ptr< osg::DisplaySettings > _displaySettings
osg::ref_ptr< osg::NodeVisitor > _initVisitor
void setActiveUniforms(int activeUniforms)
const osgUtil::CullVisitor * getCullVisitorLeft() const
osg::observer_ptr< osg::Camera > _camera
void setViewport(osg::Viewport *viewport)
void setCullVisitorRight(osgUtil::CullVisitor *cv)
osg::ref_ptr< osgUtil::CullVisitor > _cullVisitor
FusionDistanceMode getFusionDistanceMode() const
osg::RenderInfo & getRenderInfo()
void setInitVisitor(osg::NodeVisitor *av)
float _fusionDistanceValue
osg::ref_ptr< osgUtil::RenderStage > _renderStageRight
void setSecondaryStateSet(osg::StateSet *state)
const osg::Matrixd & getViewMatrix() const
const osg::FrameStamp * getFrameStamp() const
void setCollectOccludersVisitor(osg::CollectOccludersVisitor *cov)
osg::NodeVisitor * getUpdateVisitor()
const osg::NodeVisitor * getUpdateVisitor() const
osg::NodeVisitor * getInitVisitor()
void setState(osg::State *state)
const osg::Vec4 & getClearColor() const
osg::ref_ptr< osg::StateSet > _globalStateSet
osgUtil::StateGraph * getStateGraphRight()
void setPrioritizeTextures(bool pt)
const osg::Camera * getCamera() const
unsigned int _dynamicObjectCount
bool _redrawInterlacedStereoStencilMask
void setFusionDistance(FusionDistanceMode mode, float value=1.0f)
osgUtil::RenderStage * getRenderStage()
OSG_EXPORT void flushDeletedGLObjects(unsigned int contextID, double currentTime, double &availableTime)
void setCullVisitorLeft(osgUtil::CullVisitor *cv)
void setDrawBufferValue(GLenum drawBufferValue)
const osgUtil::CullVisitor * getCullVisitor() const
osg::Matrixd & getProjectionMatrix()
const osgUtil::RenderStage * getRenderStageRight() const
osg::Matrixd computeLeftEyeView(const osg::Matrixd &view) const
osg::ref_ptr< osgUtil::CullVisitor > _cullVisitorLeft
osgUtil::CullVisitor * getCullVisitor()
void setLight(osg::Light *light)
const osg::DisplaySettings * getDisplaySettings() const
osg::Node * getSceneData(unsigned int childNo=0)
int _interlacedStereoStencilWidth
osgUtil::RenderStage * getRenderStageLeft()
void setStateGraphLeft(osgUtil::StateGraph *rg)
void setCullVisitor(osgUtil::CullVisitor *cv)
OSG_EXPORT void flushAllDeletedGLObjects(unsigned int contextID)
void setProjectionMatrix(const osg::Matrixd &matrix)
void setLocalStateSet(osg::StateSet *state)
void setProjectionMatrix(const osg::Matrixf &matrix)
unsigned int getNumSceneData() const
osg::ref_ptr< osgUtil::StateGraph > _stateGraph
osg::ref_ptr< osg::Viewport > _viewportLeft
#define META_Object(library, name)
bool getAutomaticFlush() const
osgUtil::CullVisitor * getCullVisitorLeft()
osg::Matrixd & getViewMatrix()
GLint GLenum GLsizei width
void setDisplaySettings(osg::DisplaySettings *vs)
void setViewMatrix(const osg::Matrixf &matrix)
const osg::Light * getLight() const
const osg::StateSet * getLocalStateSet() const
const osgUtil::CullVisitor * getCullVisitorRight() const
bool getRedrawInterlacedStereoStencilMask() const
double _previousSimulationTime
osg::ref_ptr< osg::Viewport > _viewportRight
bool getResetColorMaskToAllOn() const
osg::StateSet * getLocalStateSet()
FusionDistanceMode _fusionDistanceMode
void setViewMatrix(const osg::Matrixd &matrix)
const osgUtil::RenderStage * getRenderStageLeft() const
const osg::Viewport * getViewport() const
void setRenderStageLeft(osgUtil::RenderStage *rs)
osg::StateSet * getGlobalStateSet()
void setStateGraphRight(osgUtil::StateGraph *rg)
int _interlacedStereoStencilHeight
void setClearColor(const osg::Vec4 &color)
bool _resetColorMaskToAllEnabled
osg::DisplaySettings * getDisplaySettings()
osg::Viewport * getViewport()
osg::StateSet * getSecondaryStateSet()
GLint GLenum GLsizei GLsizei height
void setRedrawInterlacedStereoStencilMask(bool flag)
unsigned int getDynamicObjectCount() const
void setViewport(int x, int y, int width, int height)
osg::Camera * getCamera()
int getActiveUniforms() const
double _previousFrameTime
float getFusionDistanceValue() const
const osg::Node * getSceneData(unsigned int childNo=0) const
osgUtil::CullVisitor * getCullVisitorRight()
osg::ref_ptr< osg::Camera > _cameraWithOwnership
osg::ref_ptr< osg::FrameStamp > _frameStamp
bool getPrioritizeTextures() const
void setUpdateVisitor(osg::NodeVisitor *av)
const osg::NodeVisitor * getInitVisitor() const
osg::ref_ptr< osgUtil::StateGraph > _stateGraphRight
osg::RenderInfo _renderInfo
osg::ref_ptr< ComputeStereoMatricesCallback > _computeStereoMatricesCallback
void setRenderStage(osgUtil::RenderStage *rs)
osg::ref_ptr< osgUtil::StateGraph > _stateGraphLeft
LightingMode getLightingMode() const
const osg::StateSet * getSecondaryStateSet() const
const osgUtil::RenderStage * getRenderStage() const
osg::Matrixd computeRightEyeProjection(const osg::Matrixd &projection) const
const osg::View * getView() const
LightingMode _lightingMode
osgUtil::StateGraph * getStateGraph()
osg::ref_ptr< osgUtil::RenderStage > _renderStage
const osgUtil::StateGraph * getStateGraphLeft() const
void setAutomaticFlush(bool automaticFlush)
osg::ref_ptr< osg::StateSet > _localStateSet
void setRenderInfo(osg::RenderInfo &renderInfo)
osg::ref_ptr< osgUtil::CullVisitor > _cullVisitorRight
virtual void setDefaults()
osg::ref_ptr< osg::CollectOccludersVisitor > _collectOccludersVisitor
void setView(osg::View *view)
osg::ref_ptr< osg::StateSet > _secondaryStateSet
const osg::StateSet * getGlobalStateSet() const
osgUtil::RenderStage * getRenderStageRight()
void setFrameStamp(osg::FrameStamp *fs)
osg::Matrixd computeRightEyeView(const osg::Matrixd &view) const
void setGlobalStateSet(osg::StateSet *state)
void setComputeStereoMatricesCallback(ComputeStereoMatricesCallback *callback)
const osgUtil::StateGraph * getStateGraphRight() const
const osgUtil::StateGraph * getStateGraph() const
void setResetColorMaskToAllOn(bool enable)
osg::CollectOccludersVisitor * getCollectOccludersVisitor()
const osg::RenderInfo & getRenderInfo() const
Shader generator framework.
const osg::State * getState() const
const ComputeStereoMatricesCallback * getComputeStereoMatricesCallback() const
void setRenderStageRight(osgUtil::RenderStage *rs)
osg::Matrixd computeLeftEyeProjection(const osg::Matrixd &projection) const