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

266 lines
12 KiB
HTML
Raw Normal View History

2001-09-20 05:19:47 +08:00
<!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">
2001-09-20 05:19:47 +08:00
<param name=arrowdir value="down">
</APPLET>
<HR>
<DL>
<P><DL>
<DT><H3>Public Methods</H3><DD><DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.2.59.1">Impostor</A></B>()
2001-09-20 05:19:47 +08:00
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.2.59.2">Impostor</A></B>(const <!1><A HREF="Impostor.html#DOC.2.59.2">Impostor</A>&amp; es, const <!1><A HREF="CopyOp.html">CopyOp</A>&amp; copyop=CopyOp::SHALLOW_COPY)
2001-09-20 05:19:47 +08:00
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.2.59.3">META_Node</A></B>(<!1><A HREF="osg.html">osg</A>, <!1><A HREF="Impostor.html">Impostor</A>)
2002-02-09 18:54:18 +08:00
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline void <B><A HREF="#DOC.2.59.4">setImpostorThreshold</A></B>(float <!1><A HREF="Plane.html#DOC.2.89.22">distance</A>)
2001-09-20 05:19:47 +08:00
<DD><I>Set the Impostor threshold distance.</I>
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline void <B><A HREF="#DOC.2.59.5">setImpostorThresholdToBound</A></B>(float ratio=1.0f)
2001-09-20 05:19:47 +08:00
<DD><I>Set the Impostor threshold distance relative to the node's bounding sphere's radius</I>
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline const float <B><A HREF="#DOC.2.59.6">getImpostorThreshold</A></B>() const
2001-09-20 05:19:47 +08:00
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline const float <B><A HREF="#DOC.2.59.7">getImpostorThreshold2</A></B>() const
2001-09-20 05:19:47 +08:00
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif><!1><A HREF="ImpostorSprite.html">ImpostorSprite</A>* <B><A HREF="#DOC.2.59.8">findBestImpostorSprite</A></B>(const <!1><A HREF="Vec3.html">osg::Vec3</A>&amp; currLocalEyePoint)
2001-09-20 05:19:47 +08:00
<DD><I>Find the ImposterSprite which fits the current eye point best</I>
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.2.59.9">addImpostorSprite</A></B>(<!1><A HREF="ImpostorSprite.html">ImpostorSprite</A>* is)
2001-09-20 05:19:47 +08:00
<DD><I>Add an ImpostorSprite to the Impostor</I>
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline ImpostorSpriteList&amp; <B><A HREF="#DOC.2.59.10">getImpostorSpriteList</A></B>()
2001-09-20 05:19:47 +08:00
<DD><I>Get the list of ImpostorSprites attached to this Impostor</I>
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline const ImpostorSpriteList&amp; <B><A HREF="#DOC.2.59.11">getImpostorSpriteList</A></B>() const
2001-09-20 05:19:47 +08:00
<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>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>ImpostorSpriteList <B><A HREF="#DOC.2.59.14">_impostorSpriteList</A></B>
2001-09-20 05:19:47 +08:00
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>float <B><A HREF="#DOC.2.59.15">_impostorThreshold</A></B>
2001-09-20 05:19:47 +08:00
</DL></P>
<P><DL>
<DT><H3>Protected Methods</H3><DD><DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>virtual <B><A HREF="#DOC.2.59.12">~Impostor</A></B>()
2001-09-20 05:19:47 +08:00
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>virtual const bool <B><A HREF="#DOC.2.59.13">computeBound</A></B>() const
2001-09-20 05:19:47 +08:00
</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 unsigned int <B>getNumRanges</B>() const
2001-09-20 05:19:47 +08:00
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="o" SRC=icon2.gif>inline void <B>setCenter</B>(const <!1><A HREF="Vec3.html">Vec3</A> &amp;<!1><A HREF="ConvexPlanerPolygon.html#DOC.2.32.3">center</A>)
2001-09-20 05:19:47 +08:00
<DT>
<IMG ALT="o" SRC=icon2.gif>inline const <!1><A HREF="Vec3.html">Vec3</A>&amp; <B>getCenter</B>() const
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="o" SRC=icon2.gif>void <B>setEvaluateLODCallback</B>(<!1><A HREF="LOD.html#DOC.2.68.10">EvaluateLODCallback</A>* cbc)
2002-02-09 18:54:18 +08:00
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="o" SRC=icon2.gif><!1><A HREF="LOD.html#DOC.2.68.10">EvaluateLODCallback</A>* <B>getEvaluateLODCallback</B>()
2002-02-09 18:54:18 +08:00
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="o" SRC=icon2.gif>const <!1><A HREF="LOD.html#DOC.2.68.10">EvaluateLODCallback</A>* <B>getEvaluateLODCallback</B>() const
2002-02-09 18:54:18 +08:00
<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
2002-06-05 20:35:59 +08:00
<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
2002-02-09 18:54:18 +08:00
</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>
2001-09-20 05:19:47 +08:00
</DL></P>
<P><DL>
<DT><H3>Protected Fields</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif>RangeList <B>_rangeList2</B>
<DT>
2002-07-17 04:07:32 +08:00
<IMG ALT="o" SRC=icon2.gif><!1><A HREF="ref_ptr.html">ref_ptr</A>&lt;<!1><A HREF="LOD.html#DOC.2.68.10">EvaluateLODCallback</A>&gt; <B>_evaluateLODCallback</B>
2002-02-09 18:54:18 +08:00
<DT>
2001-09-20 05:19:47 +08:00
<IMG ALT="o" SRC=icon2.gif><!1><A HREF="Vec3.html">Vec3</A> <B>_center</B>
</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 )
2001-09-20 05:19:47 +08:00
<DT>
<IMG ALT="o" SRC=icon2.gif>virtual bool <B>removeChild</B>( Node* child )
2001-09-20 05:19:47 +08:00
<DT>
<IMG ALT="o" SRC=icon2.gif>virtual bool <B>replaceChild</B>( Node* origChild, Node* newChild )
2001-09-20 05:19:47 +08:00
<DT>
<IMG ALT="o" SRC=icon2.gif>inline const unsigned int <B>getNumChildren</B>() const
2001-09-20 05:19:47 +08:00
<DT>
<IMG ALT="o" SRC=icon2.gif>inline Node* <B>getChild</B>( const unsigned int i )
2001-09-20 05:19:47 +08:00
<DT>
<IMG ALT="o" SRC=icon2.gif>inline const Node* <B>getChild</B>( const unsigned int i ) const
2001-09-20 05:19:47 +08:00
<DT>
<IMG ALT="o" SRC=icon2.gif>inline bool <B>containsNode</B>( const Node* node ) const
2001-09-20 05:19:47 +08:00
<DT>
<IMG ALT="o" SRC=icon2.gif>inline ChildList::iterator <B>findNode</B>( const Node* node )
2001-09-20 05:19:47 +08:00
<DT>
<IMG ALT="o" SRC=icon2.gif>inline ChildList::const_iterator <B>findNode</B>( const Node* node ) const
2001-09-20 05:19:47 +08:00
</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
2001-12-25 05:56:22 +08:00
the Impostor's image caching should cut in. The osg::CullVisitor
2001-09-20 05:19:47 +08:00
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>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.1"></A>
2001-09-20 05:19:47 +08:00
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> Impostor()</B></TT>
<DL><DT><DD></DL><P>
2002-02-09 18:54:18 +08:00
<A NAME="Impostor"></A>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.2"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> Impostor(const <!1><A HREF="Impostor.html#DOC.2.59.2">Impostor</A>&amp; es, const <!1><A HREF="CopyOp.html">CopyOp</A>&amp; copyop=CopyOp::SHALLOW_COPY)</B></TT>
2002-02-09 18:54:18 +08:00
<DL><DT><DD></DL><P>
2001-09-22 10:42:08 +08:00
<A NAME="META_Node"></A>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.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>
2001-09-20 05:19:47 +08:00
<DL><DT><DD></DL><P>
<A NAME="setImpostorThreshold"></A>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.4"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>inline void setImpostorThreshold(float <!1><A HREF="Plane.html#DOC.2.89.22">distance</A>)</B></TT>
2001-09-20 05:19:47 +08:00
<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>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.5"></A>
2001-09-20 05:19:47 +08:00
<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>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.6"></A>
2001-09-20 05:19:47 +08:00
<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>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.7"></A>
2001-09-20 05:19:47 +08:00
<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>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.8"></A>
2001-09-20 05:19:47 +08:00
<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>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.9"></A>
2001-09-20 05:19:47 +08:00
<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>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.10"></A>
2001-09-20 05:19:47 +08:00
<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>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.11"></A>
2001-09-20 05:19:47 +08:00
<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>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.12"></A>
2001-09-20 05:19:47 +08:00
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>virtual ~Impostor()</B></TT>
<DL><DT><DD></DL><P>
<A NAME="computeBound"></A>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.13"></A>
2001-09-20 05:19:47 +08:00
<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>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.14"></A>
2001-09-20 05:19:47 +08:00
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>ImpostorSpriteList _impostorSpriteList</B></TT>
<DL><DT><DD></DL><P>
<A NAME="_impostorThreshold"></A>
2002-07-17 04:07:32 +08:00
<A NAME="DOC.2.59.15"></A>
2001-09-20 05:19:47 +08:00
<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>