Changeset 13041 for OpenSceneGraph/trunk/include/osgSim/OverlayNode
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osgSim/OverlayNode (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgSim/OverlayNode
r9458 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 */ … … 43 43 44 44 OverlayNode(const OverlayNode& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); 45 45 46 46 META_Node(osgSim, OverlayNode); 47 47 48 48 virtual void traverse(osg::NodeVisitor& nv); 49 49 … … 57 57 /** Set the overlay subgraph which will be rendered to texture.*/ 58 58 void setOverlaySubgraph(osg::Node* node); 59 59 60 60 /** Get the overlay subgraph which will be rendered to texture.*/ 61 61 osg::Node* getOverlaySubgraph() { return _overlaySubgraph.get(); } … … 63 63 /** Get the const overlay subgraph which will be render to texture.*/ 64 64 const osg::Node* getOverlaySubgraph() const { return _overlaySubgraph.get(); } 65 65 66 66 67 67 /** Inform the OverlayNode that the overlay texture needs to be updated.*/ 68 68 void dirtyOverlayTexture(); 69 69 70 70 /** Set whether the OverlayNode should update the overlay texture on every frame.*/ 71 71 void setContinuousUpdate(bool update) { _continuousUpdate = update; } … … 92 92 /** Set the TexEnv mode used to combine the overlay texture with the base color/texture of the OverlayNode's decorate subgraph.*/ 93 93 void setTexEnvMode(GLenum mode); 94 94 95 95 /** Get the TexEnv mode used to combine the overlay texture with the base color/texture of the OverlayNode's decorate subgraph.*/ 96 96 GLenum getTexEnvMode() const { return _texEnvMode; } … … 101 101 /** Get the texture unit that the texture should be assigned to.*/ 102 102 unsigned int getOverlayTextureUnit() const { return _textureUnit; } 103 103 104 104 /** Set the texture size hint. The size hint is used to request a texture of specified size.*/ 105 105 void setOverlayTextureSizeHint(unsigned int size); … … 107 107 /** Get the texture size hint.*/ 108 108 unsigned int getOverlayTextureSizeHint() const { return _textureSizeHint; } 109 110 109 110 111 111 /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/ 112 112 virtual void setThreadSafeRefUnref(bool threadSafe); … … 123 123 124 124 virtual ~OverlayNode() {} 125 125 126 126 void init(); 127 127 void init_OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(); 128 128 void init_VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(); 129 129 void init_VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY(); 130 130 131 131 void traverse_OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeVisitor& nv); 132 132 void traverse_VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeVisitor& nv); … … 137 137 138 138 typedef osg::buffered_value< int > TextureObjectValidList; 139 139 140 140 mutable TextureObjectValidList _textureObjectValidList; 141 141 … … 148 148 osg::ref_ptr<osg::StateSet> _overlayStateSet; 149 149 osg::ref_ptr<osg::StateSet> _mainStateSet; 150 150 151 151 // texture to render to, and to read from. 152 152 GLenum _texEnvMode; … … 158 158 double _overlayBaseHeight; 159 159 bool _updateCamera; 160 160 161 161 osg::Camera::RenderTargetImplementation _renderTargetImpl; 162 162 … … 177 177 178 178 osg::ref_ptr<osg::Program> _mainSubgraphProgram; 179 179 180 180 osg::ref_ptr<osg::Uniform> _y0; 181 181 osg::ref_ptr<osg::Uniform> _lightingEnabled; 182 182 }; 183 183 184 184 typedef std::map<osgUtil::CullVisitor*, osg::ref_ptr<OverlayData> > OverlayDataMap; 185 185 186 186 OpenThreads::Mutex _overlayDataMapMutex; 187 187 OverlayDataMap _overlayDataMap; 188 188 189 189 OverlayNode::OverlayData* getOverlayData(osgUtil::CullVisitor* cv); 190 190 191 191 }; 192 192
