Changeset 13041 for OpenSceneGraph/trunk/include/osgSim/Impostor
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osgSim/Impostor (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgSim/Impostor
r5328 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 */ … … 24 24 namespace osgSim { 25 25 26 /** Impostor - is a form of Level Of Detail group node which allows both switching 26 /** Impostor - is a form of Level Of Detail group node which allows both switching 27 27 * between children depending on distance from eye point and image caching. 28 * 29 * The principle behind Imposters is that they cache an image of real geometry and then the image is drawn 28 * 29 * The principle behind Imposters is that they cache an image of real geometry and then the image is drawn 30 30 * in subsequent frames instead of the real geometry. It's a bit like a 31 31 * Billboard *but* is updated at runtime and w.r.t view point. By drawing 32 32 * just the texture mapped quad you can cut down scene complexity and 33 33 * improve performance. 34 * 34 * 35 35 * For more details have a look at: 36 * 36 * 37 37 * http://grail.cs.washington.edu/projects/hic/ 38 * 38 * 39 39 * The OSG doesn't implement exactly the same technique as above, but its 40 40 * should be a good starting place. The OSG's impostors are much less … … 48 48 * automatically handles all the setting of pre-rendering stages to 49 49 * calculate the required ImpostorSprites (which encapsulates the image 50 * cache and quad), and updates them as the view point changes. If you 51 * use osg::SceneView/CullVisitor all the complexity of supporting 50 * cache and quad), and updates them as the view point changes. If you 51 * use osg::SceneView/CullVisitor all the complexity of supporting 52 52 * Impostor will be nicely hidden away. 53 53 * … … 70 70 osg::LOD(es,copyop), 71 71 _impostorThreshold(es._impostorThreshold) {} 72 72 73 73 META_Node(osgSim, Impostor); 74 74 75 75 virtual void traverse(osg::NodeVisitor& nv); 76 76 … … 82 82 */ 83 83 inline void setImpostorThreshold(float distance) { _impostorThreshold = distance; } 84 84 85 85 /* Get the Impostor threshold distance. */ 86 86 inline float getImpostorThreshold() const { return _impostorThreshold; } … … 93 93 /** Find the ImposterSprite which fits the current eye point best. */ 94 94 ImpostorSprite* findBestImpostorSprite(unsigned int contextID, const osg::Vec3& currLocalEyePoint) const; 95 95 96 96 /** Add an ImpostorSprite to the Impostor. */ 97 97 void addImpostorSprite(unsigned int contextID, ImpostorSprite* is); … … 104 104 105 105 virtual osg::BoundingSphere computeBound() const; 106 106 107 107 protected : 108 108 … … 110 110 111 111 mutable osg::buffered_object<ImpostorSpriteList> _impostorSpriteListBuffer; 112 112 113 113 ImpostorSprite* createImpostorSprite(osgUtil::CullVisitor* cv); 114 114
