Changeset 13041 for OpenSceneGraph/trunk/include/osgUtil/SceneView
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osgUtil/SceneView (modified) (25 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgUtil/SceneView
r12794 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 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 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 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 52 52 COMPILE_GLOBJECTS_AT_INIT = 0x4, 53 53 STANDARD_SETTINGS = HEADLIGHT | 54 COMPILE_GLOBJECTS_AT_INIT 54 COMPILE_GLOBJECTS_AT_INIT 55 55 }; 56 56 … … 76 76 */ 77 77 void setSceneData(osg::Node* node); 78 78 79 79 /** Get the scene data to view. The data will typically be 80 80 * an osg::Scene but can be any osg::Node type. … … 86 86 */ 87 87 const osg::Node* getSceneData(unsigned int childNo=0) const { return (_camera->getNumChildren()>childNo) ? _camera->getChild(childNo) : 0; } 88 88 89 89 /** Get the number of scene data subgraphs added to the SceneView's camera.*/ 90 90 unsigned int getNumSceneData() const { return _camera->getNumChildren(); } … … 102 102 /** Get the const viewport. */ 103 103 const osg::Viewport* getViewport() const { return (_camera->getViewport()!=0) ? _camera->getViewport() : 0; } 104 104 105 105 /** Set the DisplaySettings. */ 106 106 inline void setDisplaySettings(osg::DisplaySettings* vs) { _displaySettings = vs; } 107 107 108 108 /** Get the const DisplaySettings */ 109 109 inline const osg::DisplaySettings* getDisplaySettings() const { return _displaySettings.get(); } … … 119 119 /** Get the color used in glClearColor.*/ 120 120 const osg::Vec4& getClearColor() const { return _camera->getClearColor(); } 121 122 123 /** Manually set the redraw interlaced stereo stencil mask request flag to control whether to redraw the stencil buffer on the next frame.*/ 121 122 123 /** Manually set the redraw interlaced stereo stencil mask request flag to control whether to redraw the stencil buffer on the next frame.*/ 124 124 void setRedrawInterlacedStereoStencilMask(bool flag) { _redrawInterlacedStereoStencilMask = flag; } 125 125 126 /** Get the redraw interlaced stereo stencil mask request flag.*/ 126 /** Get the redraw interlaced stereo stencil mask request flag.*/ 127 127 bool getRedrawInterlacedStereoStencilMask() const { return _redrawInterlacedStereoStencilMask; } 128 128 … … 139 139 osg::StateSet* getLocalStateSet() { return _localStateSet.get(); } 140 140 const osg::StateSet* getLocalStateSet() const { return _localStateSet.get(); } 141 141 142 142 enum ActiveUniforms 143 143 { … … 159 159 }; 160 160 161 /** Set the uniforms that SceneView should set set up on each frame.*/ 161 /** Set the uniforms that SceneView should set set up on each frame.*/ 162 162 void setActiveUniforms(int activeUniforms) { _activeUniforms = activeUniforms; } 163 163 … … 166 166 167 167 void updateUniforms(); 168 168 169 169 170 170 typedef Options LightingMode; … … 176 176 osg::Light* getLight() { return _light.get(); } 177 177 const osg::Light* getLight() const { return _light.get(); } 178 178 179 179 void setState(osg::State* state) { _renderInfo.setState(state); } 180 180 osg::State* getState() { return _renderInfo.getState(); } 181 181 const osg::State* getState() const { return _renderInfo.getState(); } 182 182 183 183 void setView(osg::View* view) { _camera->setView(view); } 184 184 osg::View* getView() { return _camera->getView(); } … … 188 188 osg::RenderInfo& getRenderInfo() { return _renderInfo; } 189 189 const osg::RenderInfo& getRenderInfo() const { return _renderInfo; } 190 190 191 191 192 192 … … 222 222 const osg::Matrixd& getProjectionMatrix() const { return _camera->getProjectionMatrix(); } 223 223 224 /** Get the orthographic settings of the orthographic projection matrix. 224 /** Get the orthographic settings of the orthographic projection matrix. 225 225 * Returns false if matrix is not an orthographic matrix, where parameter values are undefined.*/ 226 226 bool getProjectionMatrixAsOrtho(double& left, double& right, … … 235 235 236 236 /** Get the frustum setting of a symmetric perspective projection matrix. 237 * Returns false if matrix is not a perspective matrix, where parameter values are undefined. 237 * Returns false if matrix is not a perspective matrix, where parameter values are undefined. 238 238 * Note, if matrix is not a symmetric perspective matrix then the shear will be lost. 239 239 * Asymmetric matrices occur when stereo, power walls, caves and reality center display are used. … … 245 245 /** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */ 246 246 inline void setViewMatrix(const osg::Matrixf& matrix) { _camera->setViewMatrix(matrix); } 247 247 248 248 /** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */ 249 249 inline void setViewMatrix(const osg::Matrixd& matrix) { _camera->setViewMatrix(matrix); } … … 263 263 264 264 265 265 266 266 void setInitVisitor(osg::NodeVisitor* av) { _initVisitor = av; } 267 267 osg::NodeVisitor* getInitVisitor() { return _initVisitor.get(); } … … 285 285 osgUtil::CullVisitor* getCullVisitorRight() { return _cullVisitorRight.get(); } 286 286 const osgUtil::CullVisitor* getCullVisitorRight() const { return _cullVisitorRight.get(); } 287 287 288 288 void setCollectOccludersVisitor(osg::CollectOccludersVisitor* cov) { _collectOccludersVisitor = cov; } 289 289 osg::CollectOccludersVisitor* getCollectOccludersVisitor() { return _collectOccludersVisitor.get(); } … … 355 355 /** Set whether the draw method should call renderer->prioritizeTexture.*/ 356 356 void setPrioritizeTextures(bool pt) { _prioritizeTextures = pt; } 357 357 358 358 /** Get whether the draw method should call renderer->prioritizeTexture.*/ 359 359 bool getPrioritizeTextures() const { return _prioritizeTextures; } … … 368 368 virtual osg::Matrixd computeRightEyeView(const osg::Matrixd& view) const = 0; 369 369 }; 370 370 371 371 void setComputeStereoMatricesCallback(ComputeStereoMatricesCallback* callback) { _computeStereoMatricesCallback=callback; } 372 372 ComputeStereoMatricesCallback* getComputeStereoMatricesCallback() { return _computeStereoMatricesCallback.get(); } … … 420 420 else return computeLeftEyeViewImplementation(view); 421 421 } 422 422 423 423 inline osg::Matrixd computeRightEyeProjection(const osg::Matrixd& projection) const 424 424 { … … 463 463 /** Do draw traversal of draw bins generated by cull traversal.*/ 464 464 virtual void draw(); 465 465 466 466 /** Compute the number of dynamic objects that will be held in the rendering backend */ 467 467 unsigned int getDynamicObjectCount() const { return _dynamicObjectCount; } 468 468 469 469 /** Release all OpenGL objects from the scene graph, such as texture objects, display lists, etc. 470 470 * These released scene graphs are placed in the respective delete GLObjects cache, and … … 477 477 /** Flush deleted OpenGL objects, such as texture objects, display lists, etc., within the specified available time.*/ 478 478 virtual void flushDeletedGLObjects(double& availableTime); 479 479 480 480 /** Extract stats for current draw list. */ 481 481 bool getStats(Statistics& primStats); … … 491 491 /** Do cull traversal of attached scene graph using Cull NodeVisitor. Return true if computeNearFar has been done during the cull traversal.*/ 492 492 virtual bool cullStage(const osg::Matrixd& projection,const osg::Matrixd& modelview,osgUtil::CullVisitor* cullVisitor, osgUtil::StateGraph* rendergraph, osgUtil::RenderStage* renderStage, osg::Viewport *viewport); 493 493 494 494 void computeLeftEyeViewport(const osg::Viewport *viewport); 495 495 void computeRightEyeViewport(const osg::Viewport *viewport); … … 501 501 osg::ref_ptr<osg::StateSet> _localStateSet; 502 502 osg::RenderInfo _renderInfo; 503 503 504 504 bool _initCalled; 505 505 osg::ref_ptr<osg::NodeVisitor> _initVisitor; … … 522 522 523 523 osg::ref_ptr<osg::CollectOccludersVisitor> _collectOccludersVisitor; 524 524 525 525 osg::ref_ptr<osg::FrameStamp> _frameStamp; 526 526 527 527 osg::observer_ptr<osg::Camera> _camera; 528 528 osg::ref_ptr<osg::Camera> _cameraWithOwnership; 529 529 530 530 osg::ref_ptr<osg::StateSet> _globalStateSet; 531 531 osg::ref_ptr<osg::Light> _light; 532 532 osg::ref_ptr<osg::DisplaySettings> _displaySettings; 533 533 534 534 osg::ref_ptr<osg::StateSet> _secondaryStateSet; 535 535 … … 538 538 539 539 LightingMode _lightingMode; 540 540 541 541 bool _prioritizeTextures; 542 542 543 543 bool _automaticFlush; 544 544 bool _requiresFlush; 545 546 int _activeUniforms; 545 546 int _activeUniforms; 547 547 double _previousFrameTime; 548 548 double _previousSimulationTime; 549 549 550 550 bool _redrawInterlacedStereoStencilMask; 551 551 int _interlacedStereoStencilWidth; 552 552 int _interlacedStereoStencilHeight; 553 553 554 unsigned int _dynamicObjectCount; 554 unsigned int _dynamicObjectCount; 555 555 }; 556 556
