class SG_EXPORT osg::Impostor

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.

Inheritance:


Public Methods

[more] Impostor()
[more] Impostor(const Impostor& es, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
[more] META_Node(osg, Impostor)
[more]inline void setImpostorThreshold(float distance)
Set the Impostor threshold distance.
[more]inline void setImpostorThresholdToBound(float ratio=1.0f)
Set the Impostor threshold distance relative to the node's bounding sphere's radius
[more]inline float getImpostorThreshold() const
[more]inline float getImpostorThreshold2() const
[more]ImpostorSprite* findBestImpostorSprite(unsigned int contextID, const osg::Vec3& currLocalEyePoint) const
Find the ImposterSprite which fits the current eye point best
[more]void addImpostorSprite(unsigned int contextID, ImpostorSprite* is)
Add an ImpostorSprite to the Impostor
[more]inline ImpostorSpriteList& getImpostorSpriteList(unsigned int contexID)
Get the list of ImpostorSprites attached to this Impostor
[more]inline const ImpostorSpriteList& getImpostorSpriteList(unsigned int contexID) const
Get a const list of ImpostorSprites attached to this const Impostor

Public Members

[more]typedef std::vector< ref_ptr<ImpostorSprite> > ImpostorSpriteList

Protected Fields

[more]mutable buffered_object<ImpostorSpriteList> _impostorSpriteListBuffer
[more]float _impostorThreshold

Protected Methods

[more]virtual ~Impostor()
[more]virtual bool computeBound() const


Inherited from LOD:

Public Methods

ovirtual void traverse(NodeVisitor& nv)
ovirtual bool addChild(Node* child)
ovirtual bool addChild(Node* child, float min, float max)
ovirtual bool removeChild(Node* child)
ovoid setCenterMode(CenterMode mode)
oCenterMode getCenterMode() const
oinline void setCenter(const Vec3& center)
oinline const Vec3& getCenter() const
ovoid setRange(unsigned int childNo, float min, float max)
oinline float getMinRange(unsigned int childNo) const
oinline float getMaxRange(unsigned int childNo) const
oinline unsigned int getNumRanges() const
oinline RangeList& getRangeList()
oinline const RangeList& getRangeList() const

Public Members

otypedef std::pair<float,float> MinMaxPair
otypedef std::vector<MinMaxPair> RangeList
oenum CenterMode

Protected Fields

oCenterMode _centerMode
oVec3 _userDefinedCenter
oRangeList _rangeList


Inherited from Group:

Public Methods

ovirtual Group* asGroup()
ovirtual const Group* asGroup() const
ovirtual bool insertChild( unsigned int index, Node* child )
ovirtual bool replaceChild( Node* origChild, Node* newChild )
oinline unsigned int getNumChildren() const
ovirtual bool setChild( unsigned int i, Node* node )
oinline Node* getChild( unsigned int i )
oinline const Node* getChild( unsigned int i ) const
oinline bool containsNode( const Node* node ) const
oinline unsigned int getChildIndex( const Node* node ) const

Protected Fields

oNodeList _children


Inherited from Node:

Public Methods

ovirtual Object* cloneType() const
ovirtual Object* clone(const CopyOp& copyop) const
ovirtual bool isSameKindAs(const Object* obj) const
ovirtual const char* libraryName() const
ovirtual const char* className() const
ovirtual Transform* asTransform()
ovirtual const Transform* asTransform() const
ovirtual void accept(NodeVisitor& nv)
ovirtual void ascend(NodeVisitor& nv)
oinline void setName( const std::string& name )
oinline void setName( const char* name )
oinline const std::string& getName() const
oinline const ParentList& getParents() const
oinline ParentList getParents()
oinline Group* getParent(unsigned int i)
oinline const Group* getParent(unsigned int i) const
oinline unsigned int getNumParents() const
ovoid setUpdateCallback(NodeCallback* nc)
oinline NodeCallback* getUpdateCallback()
oinline const NodeCallback* getUpdateCallback() const
oinline unsigned int getNumChildrenRequiringUpdateTraversal() const
ovoid setCullCallback(NodeCallback* nc)
oinline NodeCallback* getCullCallback()
oinline const NodeCallback* getCullCallback() const
ovoid setCullingActive(bool active)
oinline bool getCullingActive() const
oinline unsigned int getNumChildrenWithCullingDisabled() const
oinline bool isCullingActive() const
oinline unsigned int getNumChildrenWithOccluderNodes() const
obool containsOccluderNodes() const
oinline void setNodeMask(NodeMask nm)
oinline NodeMask getNodeMask() const
oinline const DescriptionList& getDescriptions() const
oinline DescriptionList& getDescriptions()
oinline const std::string& getDescription(unsigned int i) const
oinline std::string& getDescription(unsigned int i)
oinline unsigned int getNumDescriptions() const
ovoid addDescription(const std::string& desc)
oinline void setStateSet(osg::StateSet* dstate)
oosg::StateSet* getOrCreateStateSet()
oinline osg::StateSet* getStateSet()
oinline const osg::StateSet* getStateSet() const
oinline const BoundingSphere& getBound() const
ovoid dirtyBound()

Public Members

otypedef std::vector<Group*> ParentList
otypedef unsigned int NodeMask
otypedef std::vector<std::string> DescriptionList

Protected Fields

omutable BoundingSphere _bsphere
omutable bool _bsphere_computed
ostd::string _name
oParentList _parents
oref_ptr<NodeCallback> _updateCallback
ounsigned int _numChildrenRequiringUpdateTraversal
oref_ptr<NodeCallback> _cullCallback
obool _cullingActive
ounsigned int _numChildrenWithCullingDisabled
ounsigned int _numChildrenWithOccluderNodes
oNodeMask _nodeMask
oDescriptionList _descriptions
oref_ptr<StateSet> _stateset

Protected Methods

ovoid addParent(osg::Group* node)
ovoid removeParent(osg::Group* node)
ovoid setNumChildrenRequiringUpdateTraversal(unsigned int num)
ovoid setNumChildrenWithCullingDisabled(unsigned int num)
ovoid setNumChildrenWithOccluderNodes(unsigned int num)


Inherited from Object:

Public Methods

oinline void setDataVariance(DataVariance dv)
oinline DataVariance getDataVariance() const
oinline void setUserData(Referenced* obj)
oinline Referenced* getUserData()
oinline const Referenced* getUserData() const

Public Members

oenum DataVariance

Protected Fields

oDataVariance _dataVariance
oref_ptr<Referenced> _userData


Inherited from Referenced:

Public Methods

oinline Referenced& operator = (Referenced&)
ostatic void setDeleteHandler(DeleteHandler* handler)
ostatic DeleteHandler* getDeleteHandler()
oinline void ref() const
oinline void unref_nodelete() const
oinline int referenceCount() const
oinline void unref() const

Protected Fields

omutable int _refCount


Documentation

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.

o Impostor()

o Impostor(const Impostor& es, const CopyOp& copyop=CopyOp::SHALLOW_COPY)

o META_Node(osg, Impostor)

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

oinline void setImpostorThreshold(float distance)
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.

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

oinline float getImpostorThreshold() const

oinline float getImpostorThreshold2() const

oImpostorSprite* findBestImpostorSprite(unsigned int contextID, const osg::Vec3& currLocalEyePoint) const
Find the ImposterSprite which fits the current eye point best

ovoid addImpostorSprite(unsigned int contextID, ImpostorSprite* is)
Add an ImpostorSprite to the Impostor

oinline ImpostorSpriteList& getImpostorSpriteList(unsigned int contexID)
Get the list of ImpostorSprites attached to this Impostor

oinline const ImpostorSpriteList& getImpostorSpriteList(unsigned int contexID) const
Get a const list of ImpostorSprites attached to this const Impostor

ovirtual ~Impostor()

ovirtual bool computeBound() const

omutable buffered_object<ImpostorSpriteList> _impostorSpriteListBuffer

ofloat _impostorThreshold


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.