Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

osg::Impostor Class Reference

Impostor - is a form of Level Of Detail group node which allows both switching between children depending on distance from eye point and image caching. More...

Inheritance diagram for osg::Impostor:

Inheritance graph
[legend]
List of all members.

Public Types

typedef std::vector< ref_ptr<
ImpostorSprite > > 
ImpostorSpriteList

Public Methods

 Impostor ()
 Impostor (const Impostor &es, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 META_Node (osg, Impostor)
void setImpostorThreshold (float distance)
 Set the Impostor threshold distance.

void setImpostorThresholdToBound (float ratio=1.0f)
 Set the Impostor threshold distance relative to the node's bounding sphere's radius.

const float getImpostorThreshold () const
const float getImpostorThreshold2 () const
ImpostorSpritefindBestImpostorSprite (const osg::Vec3 &currLocalEyePoint)
 Find the ImposterSprite which fits the current eye point best.

void addImpostorSprite (ImpostorSprite *is)
 Add an ImpostorSprite to the Impostor.

ImpostorSpriteListgetImpostorSpriteList ()
 Get the list of ImpostorSprites attached to this Impostor.

const ImpostorSpriteListgetImpostorSpriteList () const
 Get a const list of ImpostorSprites attached to this const Impostor.


Protected Methods

virtual ~Impostor ()
virtual const bool computeBound () const
 Compute the bounding sphere around Node's geometry or children.


Protected Attributes

ImpostorSpriteList _impostorSpriteList
float _impostorThreshold

Detailed Description

Impostor - is a form of Level Of Detail group node which allows both switching between children depending on distance from eye point and image caching.

The principle behind Imposters is that they cache an image of real geometry and then the image is drawn in subsequent frames instead of the real geometry. Its a bit like a Billboard *but* is updated at runtime and w.r.t view point. By drawing just the texture mapped quad you can cut down scene complexity and improve performance.

For more details have a look at:

http://grail.cs.washington.edu/projects/hic/

The OSG doesn't implement exactly the same technique as above, but its should be a good starting place. The OSG's impostors are much less intrusive since you don't need to restructure your whole scene to use them.

All you need to do to use Impostors is to set up the visible range values for each LOD child of the Impostor, as per osg::LOD, and set an Impostor threshold to tell the renderer at what distance the Impostor's image caching should cut in. The osg::CullVisitor automatically handles all the setting of pre-rendering stages to calculate the required ImpostorSprites (which encapsulates the image cache and quad), and updates them as the view point changes. If you use osg::SceneView/CullVisitor all the complexity of supporting Impostor will be nicely hidden away.

TODO: Various improvements are planned for the Impostor- 1) Estimation of how many frames an ImpostorSprite will be reused, if it won't be used more often than a minimum threshold then do not create ImpostorSprite - use the real geometry. 2) Sharing of texture memory between ImpostorSprites. 3) Simple 3D geometry for ImpostorSprite's rather than Billboarding. 4) Shrinking of the ImpostorSprite size to more closely fit the underlying geometry.


Member Typedef Documentation

typedef std::vector< ref_ptr<ImpostorSprite> > osg::Impostor::ImpostorSpriteList
 


Constructor & Destructor Documentation

osg::Impostor::Impostor  
 

osg::Impostor::Impostor const Impostor &    es,
const CopyOp   copyop = CopyOp::SHALLOW_COPY
[inline]
 

virtual osg::Impostor::~Impostor   [inline, protected, virtual]
 


Member Function Documentation

void osg::Impostor::addImpostorSprite ImpostorSprite   is
 

Add an ImpostorSprite to the Impostor.

virtual const bool osg::Impostor::computeBound   const [protected, virtual]
 

Compute the bounding sphere around Node's geometry or children.

This method is automatically called by getBound() when the bounding sphere has been marked dirty via dirtyBound().

Reimplemented from osg::Group.

ImpostorSprite* osg::Impostor::findBestImpostorSprite const osg::Vec3   currLocalEyePoint
 

Find the ImposterSprite which fits the current eye point best.

const ImpostorSpriteList& osg::Impostor::getImpostorSpriteList   const [inline]
 

Get a const list of ImpostorSprites attached to this const Impostor.

ImpostorSpriteList& osg::Impostor::getImpostorSpriteList   [inline]
 

Get the list of ImpostorSprites attached to this Impostor.

const float osg::Impostor::getImpostorThreshold   const [inline]
 

const float osg::Impostor::getImpostorThreshold2   const [inline]
 

osg::Impostor::META_Node osg   ,
Impostor   
 

void osg::Impostor::setImpostorThreshold float    distance [inline]
 

Set the Impostor threshold distance.

For eye points further than this threshold the Imposter is used if appropriate, otherwise the LOD children as chosen as per a standard LOD node.

void osg::Impostor::setImpostorThresholdToBound float    ratio = 1.0f [inline]
 

Set the Impostor threshold distance relative to the node's bounding sphere's radius.


Member Data Documentation

ImpostorSpriteList osg::Impostor::_impostorSpriteList [protected]
 

float osg::Impostor::_impostorThreshold [protected]
 


The documentation for this class was generated from the following file:
Generated at Wed Sep 18 13:55:31 2002 for the Open Scene Graph by doxygen 1.2.16.