## 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

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

### Public Members

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

### Protected Fields

mutable buffered_object<ImpostorSpriteList> _impostorSpriteListBuffer
float _impostorThreshold

### Protected Methods

virtual ~Impostor()
virtual bool computeBound() const

### Inherited from LOD:

### Public Methods

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

### Public Members

typedef std::pair<float,float> MinMaxPair
typedef std::vector<MinMaxPair> RangeList
enum CenterMode

### Protected Fields

CenterMode _centerMode
Vec3 _userDefinedCenter
RangeList _rangeList

### Inherited from Group:

### Public Methods

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

### Protected Fields

NodeList _children

### Inherited from Node:

### Public Methods

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

### Public Members

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

### Protected Fields

mutable BoundingSphere _bsphere
mutable bool _bsphere_computed
std::string _name
ParentList _parents
ref_ptr<NodeCallback> _updateCallback
unsigned int _numChildrenRequiringUpdateTraversal
ref_ptr<NodeCallback> _cullCallback
bool _cullingActive
unsigned int _numChildrenWithCullingDisabled
unsigned int _numChildrenWithOccluderNodes
NodeMask _nodeMask
DescriptionList _descriptions
ref_ptr<StateSet> _stateset

### Protected Methods

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

### Inherited from Object:

### Public Methods

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

### Public Members

enum DataVariance

### Protected Fields

DataVariance _dataVariance
ref_ptr<Referenced> _userData

### Inherited from Referenced:

### Public Methods

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

### Protected Fields

mutable 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.

`Impostor()`

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

`META_Node(osg, Impostor)`

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

`inline 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.

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

`inline float getImpostorThreshold() const`

`inline float getImpostorThreshold2() const`

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

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

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

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

`virtual ~Impostor()`

`virtual bool computeBound() const`

`mutable buffered_object<ImpostorSpriteList> _impostorSpriteListBuffer`

`float _impostorThreshold`

This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java

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