OpenSceneGraph/doc/doc++/osg/Impostor.html

287 lines
14 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>class SG_EXPORT osg::Impostor</TITLE>
<META NAME="GENERATOR" CONTENT="DOC++ 3.4.8">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H2>class SG_EXPORT <A HREF="#DOC.DOCU">osg::Impostor</A></H2></H2><BLOCKQUOTE>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.</BLOCKQUOTE>
<HR>
<H2>Inheritance:</H2>
<APPLET CODE="ClassGraph.class" WIDTH=600 HEIGHT=125>
<param name=classes value="MNode,M,CGroup,MGroup.html,CLOD,MLOD.html,CImpostor,MImpostor.html">
<param name=before value="M,M,M,M">
<param name=after value="Md_SPSP,Md_SP,Md_,M">
<param name=indent value="0,1,2,3">
<param name=arrowdir value="down">
</APPLET>
<HR>
<DL>
<P><DL>
<DT><H3>Public Methods</H3><DD><DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.2.78.1">Impostor</A></B>()
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.2.78.2">Impostor</A></B>(const <!1><A HREF="Impostor.html#DOC.2.78.2">Impostor</A>&amp; es, const <!1><A HREF="CopyOp.html">CopyOp</A>&amp; copyop=CopyOp::SHALLOW_COPY)
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.2.78.3">META_Node</A></B>(<!1><A HREF="osg.html">osg</A>, <!1><A HREF="Impostor.html">Impostor</A>)
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline void <B><A HREF="#DOC.2.78.5">setImpostorThreshold</A></B>(float <!1><A HREF="Plane.html#DOC.2.108.23">distance</A>)
<DD><I>Set the Impostor threshold distance.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline void <B><A HREF="#DOC.2.78.6">setImpostorThresholdToBound</A></B>(float ratio=1.0f)
<DD><I>Set the Impostor threshold distance relative to the node's bounding sphere's radius</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline float <B><A HREF="#DOC.2.78.7">getImpostorThreshold</A></B>() const
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline float <B><A HREF="#DOC.2.78.8">getImpostorThreshold2</A></B>() const
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif><!1><A HREF="ImpostorSprite.html">ImpostorSprite</A>* <B><A HREF="#DOC.2.78.9">findBestImpostorSprite</A></B>(const <!1><A HREF="Vec3.html">osg::Vec3</A>&amp; currLocalEyePoint)
<DD><I>Find the ImposterSprite which fits the current eye point best</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.2.78.10">addImpostorSprite</A></B>(<!1><A HREF="ImpostorSprite.html">ImpostorSprite</A>* is)
<DD><I>Add an ImpostorSprite to the Impostor</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline <!1><A HREF="Impostor.html#DOC.2.78.4">ImpostorSpriteList</A>&amp; <B><A HREF="#DOC.2.78.11">getImpostorSpriteList</A></B>()
<DD><I>Get the list of ImpostorSprites attached to this Impostor</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline const <!1><A HREF="Impostor.html#DOC.2.78.4">ImpostorSpriteList</A>&amp; <B><A HREF="#DOC.2.78.12">getImpostorSpriteList</A></B>() const
<DD><I>Get a const list of ImpostorSprites attached to this const Impostor</I>
</DL></P>
<P><DL>
<DT><H3>Public Members</H3><DD><DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>typedef std::vector&lt; <!1><A HREF="ref_ptr.html">ref_ptr</A>&lt;<!1><A HREF="ImpostorSprite.html">ImpostorSprite</A>&gt; &gt; <B><A HREF="#DOC.2.78.4">ImpostorSpriteList</A></B>
</DL></P>
<P><DL>
<DT><H3>Protected Fields</H3><DD><DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif><!1><A HREF="Impostor.html#DOC.2.78.4">ImpostorSpriteList</A> <B><A HREF="#DOC.2.78.15">_impostorSpriteList</A></B>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>float <B><A HREF="#DOC.2.78.16">_impostorThreshold</A></B>
</DL></P>
<P><DL>
<DT><H3>Protected Methods</H3><DD><DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>virtual <B><A HREF="#DOC.2.78.13">~Impostor</A></B>()
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>virtual bool <B><A HREF="#DOC.2.78.14">computeBound</A></B>() const
</DL></P>
</DL>
<HR><H3>Inherited from <A HREF="LOD.html">LOD</A>:</H3>
<DL>
<P><DL>
<DT><H3>Public Methods</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif>virtual void <B>traverse</B>(<!1><A HREF="NodeVisitor.html">NodeVisitor</A>&amp; nv)
<DT>
<IMG ALT="o" SRC=icon2.gif>virtual bool <B>addChild</B>(Node* child)
<DT>
<IMG ALT="o" SRC=icon2.gif>virtual bool <B>addChild</B>(Node* child, float min, float max)
<DT>
<IMG ALT="o" SRC=icon2.gif>virtual bool <B>removeChild</B>(Node* child)
<DT>
<IMG ALT="o" SRC=icon2.gif>void <B>setCenterMode</B>(<!1><A HREF="LOD.html#DOC.2.87.10">CenterMode</A> mode)
<DT>
<IMG ALT="o" SRC=icon2.gif><!1><A HREF="LOD.html#DOC.2.87.10">CenterMode</A> <B>getCenterMode</B>() const
<DT>
<IMG ALT="o" SRC=icon2.gif>inline void <B>setCenter</B>(const <!1><A HREF="Vec3.html">Vec3</A>&amp; <!1><A HREF="BoundingSphere.html#DOC.2.25.8">center</A>)
<DT>
<IMG ALT="o" SRC=icon2.gif>inline const <!1><A HREF="Vec3.html">Vec3</A>&amp; <B>getCenter</B>() const
<DT>
<IMG ALT="o" SRC=icon2.gif>void <B>setRange</B>(unsigned int childNo, float min, float max)
<DT>
<IMG ALT="o" SRC=icon2.gif>inline float <B>getMinRange</B>(unsigned int childNo) const
<DT>
<IMG ALT="o" SRC=icon2.gif>inline float <B>getMaxRange</B>(unsigned int childNo) const
<DT>
<IMG ALT="o" SRC=icon2.gif>inline unsigned int <B>getNumRanges</B>() const
<DT>
<IMG ALT="o" SRC=icon2.gif>inline <!1><A HREF="LOD.html#DOC.2.87.9">RangeList</A>&amp; <B>getRangeList</B>()
<DT>
<IMG ALT="o" SRC=icon2.gif>inline const <!1><A HREF="LOD.html#DOC.2.87.9">RangeList</A>&amp; <B>getRangeList</B>() const
</DL></P>
<P><DL>
<DT><H3>Public Members</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif>typedef std::pair&lt;float,float&gt; <B>MinMaxPair</B>
<DT>
<IMG ALT="o" SRC=icon2.gif>typedef std::vector&lt;<!1><A HREF="LOD.html#DOC.2.87.8">MinMaxPair</A>&gt; <B>RangeList</B>
<DT>
<IMG ALT="o" SRC=icon2.gif>enum <B>CenterMode</B>
</DL></P>
<P><DL>
<DT><H3>Protected Fields</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif><!1><A HREF="LOD.html#DOC.2.87.10">CenterMode</A> <B>_centerMode</B>
<DT>
<IMG ALT="o" SRC=icon2.gif><!1><A HREF="Vec3.html">Vec3</A> <B>_userDefinedCenter</B>
<DT>
<IMG ALT="o" SRC=icon2.gif><!1><A HREF="LOD.html#DOC.2.87.9">RangeList</A> <B>_rangeList</B>
</DL></P>
</DL>
<HR><H3>Inherited from <A HREF="Group.html">Group</A>:</H3>
<DL>
<P><DL>
<DT><H3>Public Methods</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif>virtual <!1><A HREF="Group.html">Group</A>* <B>asGroup</B>()
<DT>
<IMG ALT="o" SRC=icon2.gif>virtual const <!1><A HREF="Group.html">Group</A>* <B>asGroup</B>() const
<DT>
<IMG ALT="o" SRC=icon2.gif>virtual bool <B>replaceChild</B>( Node* origChild, Node* newChild )
<DT>
<IMG ALT="o" SRC=icon2.gif>inline unsigned int <B>getNumChildren</B>() const
<DT>
<IMG ALT="o" SRC=icon2.gif>inline Node* <B>getChild</B>( unsigned int i )
<DT>
<IMG ALT="o" SRC=icon2.gif>inline const Node* <B>getChild</B>( unsigned int i ) const
<DT>
<IMG ALT="o" SRC=icon2.gif>inline bool <B>containsNode</B>( const Node* node ) const
<DT>
<IMG ALT="o" SRC=icon2.gif>inline ChildList::iterator <B>findNode</B>( const Node* node )
<DT>
<IMG ALT="o" SRC=icon2.gif>inline ChildList::const_iterator <B>findNode</B>( const Node* node ) const
<DT>
<IMG ALT="o" SRC=icon2.gif>inline unsigned int <B>findChildNo</B>( const Node* node ) const
</DL></P>
<P><DL>
<DT><H3>Public Members</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif>typedef std::vector&lt;<!1><A HREF="ref_ptr.html">ref_ptr</A>&lt;Node&gt; &gt; <B>ChildList</B>
</DL></P>
<P><DL>
<DT><H3>Protected Fields</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif><!1><A HREF="Group.html#DOC.2.74.1">ChildList</A> <B>_children</B>
</DL></P>
</DL>
<A NAME="DOC.DOCU"></A>
<HR>
<H2>Documentation</H2>
<BLOCKQUOTE>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.
<P>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.
<P>For more details have a look at:
<P>http://grail.cs.washington.edu/projects/hic/
<P>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.
<P>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.
<P>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.</BLOCKQUOTE>
<DL>
<A NAME="Impostor"></A>
<A NAME="DOC.2.78.1"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> Impostor()</B></TT>
<DL><DT><DD></DL><P>
<A NAME="Impostor"></A>
<A NAME="DOC.2.78.2"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> Impostor(const <!1><A HREF="Impostor.html#DOC.2.78.2">Impostor</A>&amp; es, const <!1><A HREF="CopyOp.html">CopyOp</A>&amp; copyop=CopyOp::SHALLOW_COPY)</B></TT>
<DL><DT><DD></DL><P>
<A NAME="META_Node"></A>
<A NAME="DOC.2.78.3"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> META_Node(<!1><A HREF="osg.html">osg</A>, <!1><A HREF="Impostor.html">Impostor</A>)</B></TT>
<DL><DT><DD></DL><P>
<A NAME="ImpostorSpriteList"></A>
<A NAME="DOC.2.78.4"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>typedef std::vector&lt; <!1><A HREF="ref_ptr.html">ref_ptr</A>&lt;<!1><A HREF="ImpostorSprite.html">ImpostorSprite</A>&gt; &gt; ImpostorSpriteList</B></TT>
<DL><DT><DD></DL><P>
<A NAME="setImpostorThreshold"></A>
<A NAME="DOC.2.78.5"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>inline void setImpostorThreshold(float <!1><A HREF="Plane.html#DOC.2.108.23">distance</A>)</B></TT>
<DD>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.
<DL><DT><DD></DL><P>
<A NAME="setImpostorThresholdToBound"></A>
<A NAME="DOC.2.78.6"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>inline void setImpostorThresholdToBound(float ratio=1.0f)</B></TT>
<DD>Set the Impostor threshold distance relative to the node's bounding
sphere's radius
<DL><DT><DD></DL><P>
<A NAME="getImpostorThreshold"></A>
<A NAME="DOC.2.78.7"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>inline float getImpostorThreshold() const </B></TT>
<DL><DT><DD></DL><P>
<A NAME="getImpostorThreshold2"></A>
<A NAME="DOC.2.78.8"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>inline float getImpostorThreshold2() const </B></TT>
<DL><DT><DD></DL><P>
<A NAME="findBestImpostorSprite"></A>
<A NAME="DOC.2.78.9"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B><!1><A HREF="ImpostorSprite.html">ImpostorSprite</A>* findBestImpostorSprite(const <!1><A HREF="Vec3.html">osg::Vec3</A>&amp; currLocalEyePoint)</B></TT>
<DD>Find the ImposterSprite which fits the current eye point best
<DL><DT><DD></DL><P>
<A NAME="addImpostorSprite"></A>
<A NAME="DOC.2.78.10"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void addImpostorSprite(<!1><A HREF="ImpostorSprite.html">ImpostorSprite</A>* is)</B></TT>
<DD>Add an ImpostorSprite to the Impostor
<DL><DT><DD></DL><P>
<A NAME="getImpostorSpriteList"></A>
<A NAME="DOC.2.78.11"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>inline <!1><A HREF="Impostor.html#DOC.2.78.4">ImpostorSpriteList</A>&amp; getImpostorSpriteList()</B></TT>
<DD>Get the list of ImpostorSprites attached to this Impostor
<DL><DT><DD></DL><P>
<A NAME="getImpostorSpriteList"></A>
<A NAME="DOC.2.78.12"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>inline const <!1><A HREF="Impostor.html#DOC.2.78.4">ImpostorSpriteList</A>&amp; getImpostorSpriteList() const </B></TT>
<DD>Get a const list of ImpostorSprites attached to this const Impostor
<DL><DT><DD></DL><P>
<A NAME="~Impostor"></A>
<A NAME="DOC.2.78.13"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>virtual ~Impostor()</B></TT>
<DL><DT><DD></DL><P>
<A NAME="computeBound"></A>
<A NAME="DOC.2.78.14"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>virtual bool computeBound() const </B></TT>
<DL><DT><DD></DL><P>
<A NAME="_impostorSpriteList"></A>
<A NAME="DOC.2.78.15"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B><!1><A HREF="Impostor.html#DOC.2.78.4">ImpostorSpriteList</A> _impostorSpriteList</B></TT>
<DL><DT><DD></DL><P>
<A NAME="_impostorThreshold"></A>
<A NAME="DOC.2.78.16"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>float _impostorThreshold</B></TT>
<DL><DT><DD></DL><P></DL>
<HR><DL><DT><B>This class has no child classes.</B></DL>
<DL><DT><DD></DL><P><P><I><A HREF="index.html">Alphabetic index</A></I> <I><A HREF="HIER.html">HTML hierarchy of classes</A> or <A HREF="HIERjava.html">Java</A></I></P><HR>
<BR>
This page was generated with the help of <A HREF="http://docpp.sourceforge.net">DOC++</A>.
</BODY>
</HTML>