OpenSceneGraph/doc/doc++/osg/Impostor.html
2002-04-21 21:53:03 +00:00

269 lines
12 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.46.1">Impostor</A></B>()
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.2.46.2">Impostor</A></B>(const <!1><A HREF="Impostor.html#DOC.2.46.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.46.3">META_Node</A></B>(<!1><A HREF="Impostor.html">Impostor</A>)
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline void <B><A HREF="#DOC.2.46.4">setImpostorThreshold</A></B>(float <!1><A HREF="Plane.html#DOC.2.76.20">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.46.5">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 const float <B><A HREF="#DOC.2.46.6">getImpostorThreshold</A></B>() const
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline const float <B><A HREF="#DOC.2.46.7">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.46.8">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.46.9">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 ImpostorSpriteList&amp; <B><A HREF="#DOC.2.46.10">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 ImpostorSpriteList&amp; <B><A HREF="#DOC.2.46.11">getImpostorSpriteList</A></B>() const
<DD><I>Get a const list of ImpostorSprites attached to this const Impostor</I>
</DL></P>
<P><DL>
<DT><H3>Protected Fields</H3><DD><DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>ImpostorSpriteList <B><A HREF="#DOC.2.46.14">_impostorSpriteList</A></B>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>float <B><A HREF="#DOC.2.46.15">_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.46.12">~Impostor</A></B>()
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>virtual const bool <B><A HREF="#DOC.2.46.13">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>void <B>setRange</B>(const unsigned int index, const float range)
<DT>
<IMG ALT="o" SRC=icon2.gif>inline const float <B>getRange</B>(const unsigned int index) const
<DT>
<IMG ALT="o" SRC=icon2.gif>inline const int <B>getNumRanges</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.5.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>setEvaluateLODCallback</B>(<!1><A HREF="LOD.html#DOC.2.55.10">EvaluateLODCallback</A>* cbc)
<DT>
<IMG ALT="o" SRC=icon2.gif><!1><A HREF="LOD.html#DOC.2.55.10">EvaluateLODCallback</A>* <B>getEvaluateLODCallback</B>()
<DT>
<IMG ALT="o" SRC=icon2.gif>const <!1><A HREF="LOD.html#DOC.2.55.10">EvaluateLODCallback</A>* <B>getEvaluateLODCallback</B>() const
<DT>
<IMG ALT="o" SRC=icon2.gif>inline const int <B>evaluate</B>(const <!1><A HREF="Vec3.html">Vec3</A>&amp; eye_local, const float bias=1.0f) const
</DL></P>
<P><DL>
<DT><H3>Public Members</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif>struct <B>EvaluateLODCallback</B>: public <!1><A HREF="Referenced.html">osg::Referenced</A>
</DL></P>
<P><DL>
<DT><H3>Protected Fields</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif>RangeList <B>_rangeList2</B>
<DT>
<IMG ALT="o" SRC=icon2.gif><!1><A HREF="ref_ptr.html">ref_ptr</A>&lt;<!1><A HREF="LOD.html#DOC.2.55.10">EvaluateLODCallback</A>&gt; <B>_evaluateLODCallback</B>
<DT>
<IMG ALT="o" SRC=icon2.gif><!1><A HREF="Vec3.html">Vec3</A> <B>_center</B>
</DL></P>
<P><DL>
<DT><H3>Protected Methods</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif>virtual const int <B>evaluateLODChild</B>(const <!1><A HREF="Vec3.html">Vec3</A>&amp; eye_local, const float bias) const
</DL></P>
<P><DL>
<DT><H3>Protected Members</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif>typedef std::vector&lt;float&gt; RangeList RangeList <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 bool <B>addChild</B>( Node* child )
<DT>
<IMG ALT="o" SRC=icon2.gif>virtual bool <B>removeChild</B>( Node* child )
<DT>
<IMG ALT="o" SRC=icon2.gif>virtual bool <B>replaceChild</B>( Node* origChild, Node* newChild )
<DT>
<IMG ALT="o" SRC=icon2.gif>inline const int <B>getNumChildren</B>() const
<DT>
<IMG ALT="o" SRC=icon2.gif>inline Node* <B>getChild</B>( const int i )
<DT>
<IMG ALT="o" SRC=icon2.gif>inline const Node* <B>getChild</B>( const 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
</DL></P>
<P><DL>
<DT><H3>Protected Fields</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif>ChildList <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.46.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.46.2"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> Impostor(const <!1><A HREF="Impostor.html#DOC.2.46.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.46.3"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> META_Node(<!1><A HREF="Impostor.html">Impostor</A>)</B></TT>
<DL><DT><DD></DL><P>
<A NAME="setImpostorThreshold"></A>
<A NAME="DOC.2.46.4"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>inline void setImpostorThreshold(float <!1><A HREF="Plane.html#DOC.2.76.20">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.46.5"></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.46.6"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>inline const float getImpostorThreshold() const </B></TT>
<DL><DT><DD></DL><P>
<A NAME="getImpostorThreshold2"></A>
<A NAME="DOC.2.46.7"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>inline const float getImpostorThreshold2() const </B></TT>
<DL><DT><DD></DL><P>
<A NAME="findBestImpostorSprite"></A>
<A NAME="DOC.2.46.8"></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.46.9"></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.46.10"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>inline ImpostorSpriteList&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.46.11"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>inline const ImpostorSpriteList&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.46.12"></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.46.13"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>virtual const bool computeBound() const </B></TT>
<DL><DT><DD></DL><P>
<A NAME="_impostorSpriteList"></A>
<A NAME="DOC.2.46.14"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>ImpostorSpriteList _impostorSpriteList</B></TT>
<DL><DT><DD></DL><P>
<A NAME="_impostorThreshold"></A>
<A NAME="DOC.2.46.15"></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>