Changeset 13041 for OpenSceneGraph/trunk/include/osgUtil/RenderStage
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osgUtil/RenderStage (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgUtil/RenderStage
r12298 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 */ … … 38 38 { 39 39 public: 40 40 41 41 42 42 RenderStage(); 43 43 RenderStage(SortMode mode); 44 44 45 45 RenderStage(const RenderStage& rhs,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); 46 46 47 47 virtual osg::Object* cloneType() const { return new RenderStage(); } 48 48 virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new RenderStage(*this,copyop); } // note only implements a clone of type. … … 51 51 52 52 virtual void reset(); 53 54 53 54 55 55 /** Set the draw buffer used at the start of each frame draw. */ 56 56 void setDrawBuffer(GLenum buffer, bool applyMask = true ) { _drawBuffer = buffer; setDrawBufferApplyMask( applyMask ); } … … 88 88 /** Get the viewport. */ 89 89 osg::Viewport* getViewport() { return _viewport.get(); } 90 90 91 91 /** Set the initial view matrix.*/ 92 92 void setInitialViewMatrix(const osg::RefMatrix* matrix) { _initialViewMatrix = matrix; } 93 93 94 94 /** Get the initial view matrix.*/ 95 95 const osg::RefMatrix* getInitialViewMatrix() { return _initialViewMatrix.get(); } … … 108 108 109 109 110 /** Set the clear color used in glClearColor(..). 110 /** Set the clear color used in glClearColor(..). 111 111 * glClearColor is only called if mask & GL_COLOR_BUFFER_BIT is true*/ 112 112 void setClearColor(const osg::Vec4& color) { _clearColor=color; } 113 113 114 114 /** Get the clear color.*/ 115 115 const osg::Vec4& getClearColor() const { return _clearColor; } 116 117 /** Set the clear accum used in glClearAccum(..). 116 117 /** Set the clear accum used in glClearAccum(..). 118 118 * glClearAcumm is only called if mask & GL_ACCUM_BUFFER_BIT is true. */ 119 119 void setClearAccum(const osg::Vec4& color) { _clearAccum=color; } 120 120 121 121 /** Get the clear accum.*/ 122 122 const osg::Vec4& getClearAccum() const { return _clearAccum; } 123 123 124 124 /** Set the clear depth used in glClearDepth(..). Defaults to 1.0 125 125 * glClearDepth is only called if mask & GL_DEPTH_BUFFER_BIT is true. */ 126 126 void setClearDepth(double depth) { _clearDepth=depth; } 127 127 128 128 /** Get the clear depth.*/ 129 129 double getClearDepth() const { return _clearDepth; } … … 132 132 * glClearStencil is only called if mask & GL_STENCIL_BUFFER_BIT is true*/ 133 133 void setClearStencil(int stencil) { _clearStencil=stencil; } 134 134 135 135 /** Get the clear color.*/ 136 136 int getClearStencil() const { return _clearStencil; } 137 137 138 138 139 139 void setCamera(osg::Camera* camera) { if (_camera!=camera) { _camera = camera; _cameraRequiresSetUp = true; } } … … 143 143 void setCameraRequiresSetUp(bool flag) { _cameraRequiresSetUp = flag; } 144 144 bool getCameraRequiresSetUp() const { return _cameraRequiresSetUp; } 145 145 146 146 /** Attempt the set the RenderStage from the Camera settings.*/ 147 147 void runCameraSetUp(osg::RenderInfo& renderInfo); 148 148 149 149 void setTexture(osg::Texture* texture, unsigned int level = 0, unsigned int face=0) { _texture = texture; _level = level; _face = face; } 150 150 osg::Texture* getTexture() { return _texture.get(); } 151 151 152 152 void setImage(osg::Image* image) { _image = image; } 153 153 osg::Image* getImage() { return _image.get(); } 154 154 155 155 void setImageReadPixelFormat(GLenum format) { _imageReadPixelFormat = format; } 156 156 GLenum getImageReadPixelFormat() const { return _imageReadPixelFormat; } … … 206 206 getPositionalStateContainer()->addPositionedAttribute(matrix,attr); 207 207 } 208 208 209 209 virtual void addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix* matrix,const osg::StateAttribute* attr) 210 210 { … … 215 215 216 216 virtual void sort(); 217 217 218 218 virtual void drawPreRenderStages(osg::RenderInfo& renderInfo,RenderLeaf*& previous); 219 219 … … 221 221 222 222 virtual void drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, bool& doCopyTexture); 223 223 224 224 virtual void drawPostRenderStages(osg::RenderInfo& renderInfo,RenderLeaf*& previous); 225 225 … … 230 230 231 231 void addPreRenderStage(RenderStage* rs, int order = 0); 232 232 233 233 void addPostRenderStage(RenderStage* rs, int order = 0); 234 234 235 235 /** Extract stats for current draw list. */ 236 bool getStats(Statistics& stats) const; 237 236 bool getStats(Statistics& stats) const; 237 238 238 /** Compute the number of dynamic RenderLeaves.*/ 239 239 virtual unsigned int computeNumberOfDynamicRenderLeaves() const; … … 276 276 osg::ref_ptr<osg::Viewport> _viewport; 277 277 osg::ref_ptr<const osg::RefMatrix> _initialViewMatrix; 278 278 279 279 GLenum _drawBuffer; 280 280 bool _drawBufferApplyMask; … … 290 290 bool _cameraRequiresSetUp; 291 291 osg::Camera* _camera; 292 292 293 293 osg::ref_ptr<osg::Texture> _texture; 294 294 unsigned int _level; … … 298 298 GLenum _imageReadPixelFormat; 299 299 GLenum _imageReadPixelDataType; 300 300 301 301 std::map< osg::Camera::BufferComponent, Attachment> _bufferAttachmentMap; 302 302 303 303 osg::ref_ptr<osg::FrameBufferObject> _fbo; 304 304 osg::ref_ptr<osg::FrameBufferObject> _resolveFbo;
