osgSim::ImpostorSprite Class Reference

An ImposterSprite is a textured quad which is rendered in place of 3D geometry. More...

Inheritance diagram for osgSim::ImpostorSprite:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 ImpostorSprite ()
virtual osg::ObjectcloneType () const
 Clone an object of the same type as an ImpostorSprite.
virtual osg::Objectclone (const osg::CopyOp &) const
 Clone on ImpostorSprite just returns a clone of type, since it is not appropriate to share data of an ImpostorSprite.
virtual bool isSameKindAs (const osg::Object *obj) const
virtual const char * libraryName () const
 return the name of the object's library.
virtual const char * className () const
 return the name of the object's class type.
void setParent (Impostor *parent)
 Set the parent, which must be an Impostor.
ImpostorgetParent ()
 Get the parent, which is an Impostor.
const ImpostorgetParent () const
 Get the const parent, which is an Impostor.
void setStoredLocalEyePoint (const osg::Vec3 &v)
 Set the eye point for when the ImpostorSprite was snapped.
const osg::Vec3getStoredLocalEyePoint () const
 Get the eye point for when the ImpostorSprite was snapped.
void setLastFrameUsed (int frameNumber)
 Set the frame number for when the ImpostorSprite was last used in rendering.
int getLastFrameUsed () const
 Get the frame number for when the ImpostorSprite was last used in rendering.
osg::Vec3getCoords ()
 Get the coordinates of the corners of the quad.
const osg::Vec3getCoords () const
 Get the const coordinates of the corners of the quad.
osg::Vec2getTexCoords ()
 Get the texture coordinates of the corners of the quad.
const osg::Vec2getTexCoords () const
 Get the const texture coordinates of the corners of the quad.
osg::Vec3getControlCoords ()
 Get the control coordinates of the corners of the quad.
const osg::Vec3getControlCoords () const
 Get the const control coordinates of the corners of the quad.
float calcPixelError (const osg::Matrix &MVPW) const
 Calculate the pixel error value for passing in the ModelViewProjectionWindow transform, which transform local coords into screen space.
void setTexture (osg::Texture2D *tex, int s, int t)
osg::Texture2DgetTexture ()
const osg::Texture2DgetTexture () const
int s () const
int t () const
virtual void drawImplementation (osg::RenderInfo &renderInfo) const
 Draw ImpostorSprite directly.
virtual bool supports (const Drawable::AttributeFunctor &) const
 Return true, osg::ImpostorSprite does support accept(Drawable::AttributeFunctor&).
virtual void accept (Drawable::AttributeFunctor &af)
 Accept an Drawable::AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.
virtual bool supports (const Drawable::ConstAttributeFunctor &) const
 Return true, osg::ImpostorSprite does support accept(Drawable::ConstAttributeFunctor&).
virtual void accept (Drawable::ConstAttributeFunctor &af) const
 Accept a Drawable::ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.
virtual bool supports (const osg::PrimitiveFunctor &) const
 Return true, osg::ImpostorSprite does support accept(PrimitiveFunctor&).
virtual void accept (osg::PrimitiveFunctor &pf) const
 Accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.
virtual osg::BoundingBox computeBound () const
 Compute the bounding box around Drawables's geometry.
void setCamera (osg::Camera *camera)
 Set the camera node to use for pre rendering the impostor sprite's texture.
osg::CameragetCamera ()
 Get the camera node to use for pre rendering the impostor sprite's texture.
const osg::CameragetCamera () const
 Get the const camera node to use for pre rendering the impostor sprite's texture.

Public Attributes

osg::Vec4 _color

Protected Member Functions

 ImpostorSprite (const ImpostorSprite &)
ImpostorSpriteoperator= (const ImpostorSprite &)
virtual ~ImpostorSprite ()

Protected Attributes

Impostor_parent
osg::ref_ptr
< osg::Camera
_camera
ImpostorSpriteManager_ism
ImpostorSprite_previous
ImpostorSprite_next
int _lastFrameUsed
osg::Vec3 _storedLocalEyePoint
osg::Vec3 _coords [4]
osg::Vec2 _texcoords [4]
osg::Vec3 _controlcoords [4]
osg::Texture2D_texture
int _s
int _t

Friends

class osgSim::ImpostorSpriteManager


Detailed Description

An ImposterSprite is a textured quad which is rendered in place of 3D geometry.

The ImposterSprite is generated by rendering the original 3D geometry to a texture as an image cache. The ImpostorSprite is automatically generated by the osgUtil::CullVisitor so it not necessary to deal with it directly.


Constructor & Destructor Documentation

osgSim::ImpostorSprite::ImpostorSprite (  ) 

osgSim::ImpostorSprite::ImpostorSprite ( const ImpostorSprite  )  [protected]

virtual osgSim::ImpostorSprite::~ImpostorSprite (  )  [protected, virtual]


Member Function Documentation

virtual osg::Object* osgSim::ImpostorSprite::cloneType (  )  const [inline, virtual]

Clone an object of the same type as an ImpostorSprite.

Implements osg::Object.

virtual osg::Object* osgSim::ImpostorSprite::clone ( const osg::CopyOp  )  const [inline, virtual]

Clone on ImpostorSprite just returns a clone of type, since it is not appropriate to share data of an ImpostorSprite.

Implements osg::Object.

virtual bool osgSim::ImpostorSprite::isSameKindAs ( const osg::Object obj  )  const [inline, virtual]

Reimplemented from osg::Drawable.

virtual const char* osgSim::ImpostorSprite::libraryName (  )  const [inline, virtual]

return the name of the object's library.

Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name.

Reimplemented from osg::Drawable.

virtual const char* osgSim::ImpostorSprite::className (  )  const [inline, virtual]

return the name of the object's class type.

Must be defined by derived classes.

Reimplemented from osg::Drawable.

void osgSim::ImpostorSprite::setParent ( Impostor parent  )  [inline]

Set the parent, which must be an Impostor.

Unlike conventional Drawables, ImpostorSprites can only ever have one parent.

Impostor* osgSim::ImpostorSprite::getParent (  )  [inline]

Get the parent, which is an Impostor.

const Impostor* osgSim::ImpostorSprite::getParent (  )  const [inline]

Get the const parent, which is an Impostor.

void osgSim::ImpostorSprite::setStoredLocalEyePoint ( const osg::Vec3 v  )  [inline]

Set the eye point for when the ImpostorSprite was snapped.

const osg::Vec3& osgSim::ImpostorSprite::getStoredLocalEyePoint (  )  const [inline]

Get the eye point for when the ImpostorSprite was snapped.

void osgSim::ImpostorSprite::setLastFrameUsed ( int  frameNumber  )  [inline]

Set the frame number for when the ImpostorSprite was last used in rendering.

int osgSim::ImpostorSprite::getLastFrameUsed (  )  const [inline]

Get the frame number for when the ImpostorSprite was last used in rendering.

osg::Vec3* osgSim::ImpostorSprite::getCoords (  )  [inline]

Get the coordinates of the corners of the quad.

Stored in the order, [0] - top_left, [1] - bottom_left, [2] - bottom_right, [3] - top_left.

const osg::Vec3* osgSim::ImpostorSprite::getCoords (  )  const [inline]

Get the const coordinates of the corners of the quad.

osg::Vec2* osgSim::ImpostorSprite::getTexCoords (  )  [inline]

Get the texture coordinates of the corners of the quad.

Stored in the order, [0] - top_left, [1] - bottom_left, [2] - bottom_right, [3] - top_left.

const osg::Vec2* osgSim::ImpostorSprite::getTexCoords (  )  const [inline]

Get the const texture coordinates of the corners of the quad.

osg::Vec3* osgSim::ImpostorSprite::getControlCoords (  )  [inline]

Get the control coordinates of the corners of the quad.

The control coordinates are the corners of the quad projected out onto the front face of bounding box which enclosed the impostor geometry when it was pre-rendered into the impostor sprite's texture. At the point of creation/or update of the impostor sprite the control coords will lie on top of the corners of the quad in screen space - with a pixel error of zero. Once the camera moves relative to the impostor sprite the control coords will no longer lie on top of the corners of the quad in screen space - a pixel error will have accumulated. This pixel error can then be used to determine whether the impostor needs to be updated. Stored in the order, [0] - top_left, [1] - bottom_left, [2] - bottom_right, [3] - top_left.

const osg::Vec3* osgSim::ImpostorSprite::getControlCoords (  )  const [inline]

Get the const control coordinates of the corners of the quad.

float osgSim::ImpostorSprite::calcPixelError ( const osg::Matrix MVPW  )  const

Calculate the pixel error value for passing in the ModelViewProjectionWindow transform, which transform local coords into screen space.

void osgSim::ImpostorSprite::setTexture ( osg::Texture2D tex,
int  s,
int  t 
)

osg::Texture2D* osgSim::ImpostorSprite::getTexture (  )  [inline]

const osg::Texture2D* osgSim::ImpostorSprite::getTexture (  )  const [inline]

int osgSim::ImpostorSprite::s (  )  const [inline]

int osgSim::ImpostorSprite::t (  )  const [inline]

virtual void osgSim::ImpostorSprite::drawImplementation ( osg::RenderInfo renderInfo  )  const [virtual]

Draw ImpostorSprite directly.

Implements osg::Drawable.

virtual bool osgSim::ImpostorSprite::supports ( const Drawable::AttributeFunctor  )  const [inline, virtual]

Return true, osg::ImpostorSprite does support accept(Drawable::AttributeFunctor&).

Reimplemented from osg::Drawable.

virtual void osgSim::ImpostorSprite::accept ( Drawable::AttributeFunctor af  )  [virtual]

Accept an Drawable::AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.

Reimplemented from osg::Drawable.

virtual bool osgSim::ImpostorSprite::supports ( const Drawable::ConstAttributeFunctor  )  const [inline, virtual]

Return true, osg::ImpostorSprite does support accept(Drawable::ConstAttributeFunctor&).

Reimplemented from osg::Drawable.

virtual void osgSim::ImpostorSprite::accept ( Drawable::ConstAttributeFunctor af  )  const [virtual]

Accept a Drawable::ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.

Reimplemented from osg::Drawable.

virtual bool osgSim::ImpostorSprite::supports ( const osg::PrimitiveFunctor  )  const [inline, virtual]

Return true, osg::ImpostorSprite does support accept(PrimitiveFunctor&).

Reimplemented from osg::Drawable.

virtual void osgSim::ImpostorSprite::accept ( osg::PrimitiveFunctor pf  )  const [virtual]

Accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.

Reimplemented from osg::Drawable.

virtual osg::BoundingBox osgSim::ImpostorSprite::computeBound (  )  const [virtual]

Compute the bounding box around Drawables's geometry.

Reimplemented from osg::Drawable.

void osgSim::ImpostorSprite::setCamera ( osg::Camera camera  )  [inline]

Set the camera node to use for pre rendering the impostor sprite's texture.

osg::Camera* osgSim::ImpostorSprite::getCamera (  )  [inline]

Get the camera node to use for pre rendering the impostor sprite's texture.

const osg::Camera* osgSim::ImpostorSprite::getCamera (  )  const [inline]

Get the const camera node to use for pre rendering the impostor sprite's texture.

ImpostorSprite& osgSim::ImpostorSprite::operator= ( const ImpostorSprite  )  [inline, protected]


Friends And Related Function Documentation

friend class osgSim::ImpostorSpriteManager [friend]


Member Data Documentation

osg::Vec4 osgSim::ImpostorSprite::_color

Impostor* osgSim::ImpostorSprite::_parent [protected]

osg::ref_ptr<osg::Camera> osgSim::ImpostorSprite::_camera [protected]

ImpostorSpriteManager* osgSim::ImpostorSprite::_ism [protected]

ImpostorSprite* osgSim::ImpostorSprite::_previous [protected]

ImpostorSprite* osgSim::ImpostorSprite::_next [protected]

int osgSim::ImpostorSprite::_lastFrameUsed [protected]

osg::Vec3 osgSim::ImpostorSprite::_storedLocalEyePoint [protected]

osg::Vec3 osgSim::ImpostorSprite::_coords[4] [protected]

osg::Vec2 osgSim::ImpostorSprite::_texcoords[4] [protected]

osg::Vec3 osgSim::ImpostorSprite::_controlcoords[4] [protected]

osg::Texture2D* osgSim::ImpostorSprite::_texture [protected]

int osgSim::ImpostorSprite::_s [protected]

int osgSim::ImpostorSprite::_t [protected]


The documentation for this class was generated from the following file:
Generated at Sun Oct 14 02:12:46 2007 for the OpenSceneGraph by doxygen 1.5.3.