openscenegraph
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
osgSim::ImpostorSprite Class Reference
Inheritance diagram for osgSim::ImpostorSprite:
osg::Drawable osg::Object osg::Referenced

Public Member Functions

 ImpostorSprite ()
 
virtual osg::ObjectcloneType () const
 
virtual osg::Objectclone (const osg::CopyOp &) const
 
virtual bool isSameKindAs (const osg::Object *obj) const
 
virtual const char * libraryName () const
 
virtual const char * className () const
 
void setParent (Impostor *parent)
 
ImpostorgetParent ()
 
const ImpostorgetParent () const
 
void setStoredLocalEyePoint (const osg::Vec3 &v)
 
const osg::Vec3getStoredLocalEyePoint () const
 
void setLastFrameUsed (unsigned int frameNumber)
 
unsigned int getLastFrameUsed () const
 
osg::Vec3getCoords ()
 
const osg::Vec3getCoords () const
 
osg::Vec2getTexCoords ()
 
const osg::Vec2getTexCoords () const
 
osg::Vec3getControlCoords ()
 
const osg::Vec3getControlCoords () const
 
float calcPixelError (const osg::Matrix &MVPW) const
 
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
 
virtual bool supports (const Drawable::AttributeFunctor &) const
 
virtual void accept (Drawable::AttributeFunctor &af)
 
virtual bool supports (const Drawable::ConstAttributeFunctor &) const
 
virtual void accept (Drawable::ConstAttributeFunctor &af) const
 
virtual bool supports (const osg::PrimitiveFunctor &) const
 
virtual void accept (osg::PrimitiveFunctor &pf) const
 
virtual osg::BoundingBox computeBound () const
 
void setCamera (osg::Camera *camera)
 
osg::CameragetCamera ()
 
const osg::CameragetCamera () const
 
- Public Member Functions inherited from osg::Drawable
 Drawable ()
 
 Drawable (const Drawable &drawable, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 
virtual GeometryasGeometry ()
 
virtual const GeometryasGeometry () const
 
virtual void computeDataVariance ()
 
const ParentListgetParents () const
 
ParentList getParents ()
 
NodegetParent (unsigned int i)
 
const NodegetParent (unsigned int i) const
 
unsigned int getNumParents () const
 
MatrixList getWorldMatrices (const osg::Node *haltTraversalAtNode=0) const
 
void setStateSet (StateSet *stateset)
 
StateSetgetStateSet ()
 
const StateSetgetStateSet () const
 
StateSetgetOrCreateStateSet ()
 
void setInitialBound (const osg::BoundingBox &bbox)
 
const BoundingBoxgetInitialBound () const
 
void dirtyBound ()
 
const BoundingBoxgetBound () const
 
void setComputeBoundingBoxCallback (ComputeBoundingBoxCallback *callback)
 
ComputeBoundingBoxCallbackgetComputeBoundingBoxCallback ()
 
const ComputeBoundingBoxCallbackgetComputeBoundingBoxCallback () const
 
void setShape (Shape *shape)
 
ShapegetShape ()
 
const ShapegetShape () const
 
void setSupportsDisplayList (bool flag)
 
bool getSupportsDisplayList () const
 
void setUseDisplayList (bool flag)
 
bool getUseDisplayList () const
 
GLuint & getDisplayList (unsigned int contextID) const
 
virtual void setUseVertexBufferObjects (bool flag)
 
bool getUseVertexBufferObjects () const
 
virtual void dirtyDisplayList ()
 
virtual unsigned int getGLObjectSizeHint () const
 
void draw (RenderInfo &renderInfo) const
 
virtual void compileGLObjects (RenderInfo &renderInfo) const
 
virtual void setThreadSafeRefUnref (bool threadSafe)
 
virtual void resizeGLObjectBuffers (unsigned int maxSize)
 
virtual void releaseGLObjects (State *state=0) const
 
virtual void setUpdateCallback (UpdateCallback *ac)
 
UpdateCallbackgetUpdateCallback ()
 
const UpdateCallbackgetUpdateCallback () const
 
bool requiresUpdateTraversal () const
 
virtual void setEventCallback (EventCallback *ac)
 
EventCallbackgetEventCallback ()
 
const EventCallbackgetEventCallback () const
 
bool requiresEventTraversal () const
 
virtual void setCullCallback (CullCallback *cc)
 
CullCallbackgetCullCallback ()
 
const CullCallbackgetCullCallback () const
 
virtual void setDrawCallback (DrawCallback *dc)
 
DrawCallbackgetDrawCallback ()
 
const DrawCallbackgetDrawCallback () const
 
virtual bool supports (const AttributeFunctor &) const
 
virtual void accept (AttributeFunctor &)
 
virtual bool supports (const ConstAttributeFunctor &) const
 
virtual void accept (ConstAttributeFunctor &) const
 
virtual bool supports (const PrimitiveIndexFunctor &) const
 
virtual void accept (PrimitiveIndexFunctor &) const
 
- Public Member Functions inherited from osg::Object
 Object ()
 
 Object (bool threadSafeRefUnref)
 
 Object (const Object &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 
virtual void setName (const std::string &name)
 
void setName (const char *name)
 
const std::string & getName () const
 
void setDataVariance (DataVariance dv)
 
DataVariance getDataVariance () const
 
void setUserDataContainer (osg::UserDataContainer *udc)
 
osg::UserDataContainergetUserDataContainer ()
 
const osg::UserDataContainergetUserDataContainer () const
 
osg::UserDataContainergetOrCreateUserDataContainer ()
 
virtual void setUserData (Referenced *obj)
 
virtual ReferencedgetUserData ()
 
virtual const ReferencedgetUserData () const
 
template<typename T >
bool getUserValue (const std::string &name, T &value) const
 
template<typename T >
void setUserValue (const std::string &name, const T &value)
 
template<typename T >
BoolValueObject UCharValueObject UShortValueObject UIntValueObject DoubleValueObject Vec3fValueObject Vec2dValueObject Vec4dValueObject PlaneValueObject MatrixdValueObject bool getUserValue (const std::string &name, T &value) const
 
- Public Member Functions inherited from osg::Referenced
 Referenced ()
 
 Referenced (bool threadSafeRefUnref)
 
 Referenced (const Referenced &)
 
Referencedoperator= (const Referenced &)
 
bool getThreadSafeRefUnref () const
 
OpenThreads::MutexgetRefMutex () const
 
int ref () const
 
int unref () const
 
int unref_nodelete () const
 
int referenceCount () const
 
ObserverSetgetObserverSet () const
 
ObserverSetgetOrCreateObserverSet () const
 
void addObserver (Observer *observer) const
 
void removeObserver (Observer *observer) const
 

Public Attributes

osg::Vec4 _color
 

Protected Member Functions

 ImpostorSprite (const ImpostorSprite &)
 
ImpostorSpriteoperator= (const ImpostorSprite &)
 
virtual ~ImpostorSprite ()
 
- Protected Member Functions inherited from osg::Drawable
Drawableoperator= (const Drawable &)
 
virtual ~Drawable ()
 
void setBound (const BoundingBox &bb) const
 
void addParent (osg::Node *node)
 
void removeParent (osg::Node *node)
 
void setNumChildrenRequiringUpdateTraversal (unsigned int num)
 
unsigned int getNumChildrenRequiringUpdateTraversal () const
 
void setNumChildrenRequiringEventTraversal (unsigned int num)
 
unsigned int getNumChildrenRequiringEventTraversal () const
 
- Protected Member Functions inherited from osg::Object
virtual ~Object ()
 
- Protected Member Functions inherited from osg::Referenced
virtual ~Referenced ()
 
void signalObserversAndDelete (bool signalDelete, bool doDelete) const
 
void deleteUsingDeleteHandler () const
 

Protected Attributes

Impostor_parent
 
osg::ref_ptr< osg::Camera_camera
 
ImpostorSpriteManager_ism
 
ImpostorSprite_previous
 
ImpostorSprite_next
 
unsigned int _lastFrameUsed
 
osg::Vec3 _storedLocalEyePoint
 
osg::Vec3 _coords [4]
 
osg::Vec2 _texcoords [4]
 
osg::Vec3 _controlcoords [4]
 
osg::Texture2D_texture
 
int _s
 
int _t
 
- Protected Attributes inherited from osg::Drawable
ParentList _parents
 
ref_ptr< StateSet_stateset
 
BoundingBox _initialBound
 
ref_ptr< ComputeBoundingBoxCallback_computeBoundCallback
 
BoundingBox _boundingBox
 
bool _boundingBoxComputed
 
ref_ptr< Shape_shape
 
bool _supportsDisplayList
 
bool _useDisplayList
 
bool _supportsVertexBufferObjects
 
bool _useVertexBufferObjects
 
GLObjectList _globjList
 
ref_ptr< UpdateCallback_updateCallback
 
unsigned int _numChildrenRequiringUpdateTraversal
 
ref_ptr< EventCallback_eventCallback
 
unsigned int _numChildrenRequiringEventTraversal
 
ref_ptr< CullCallback_cullCallback
 
ref_ptr< DrawCallback_drawCallback
 
- Protected Attributes inherited from osg::Object
std::string _name
 
DataVariance _dataVariance
 
osg::UserDataContainer_userDataContainer
 
- Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr _observerSet
 
OpenThreads::Atomic _refCount
 

Friends

class osgSim::ImpostorSpriteManager
 

Additional Inherited Members

- Public Types inherited from osg::Drawable
enum  AttributeTypes {
  VERTICES = 0, WEIGHTS = 1, NORMALS = 2, COLORS = 3,
  SECONDARY_COLORS = 4, FOG_COORDS = 5, ATTRIBUTE_6 = 6, ATTRIBUTE_7 = 7,
  TEXTURE_COORDS = 8, TEXTURE_COORDS_0 = TEXTURE_COORDS, TEXTURE_COORDS_1 = TEXTURE_COORDS_0+1, TEXTURE_COORDS_2 = TEXTURE_COORDS_0+2,
  TEXTURE_COORDS_3 = TEXTURE_COORDS_0+3, TEXTURE_COORDS_4 = TEXTURE_COORDS_0+4, TEXTURE_COORDS_5 = TEXTURE_COORDS_0+5, TEXTURE_COORDS_6 = TEXTURE_COORDS_0+6,
  TEXTURE_COORDS_7 = TEXTURE_COORDS_0+7
}
 
typedef std::vector< Node * > ParentList
 
typedef unsigned int AttributeType
 
- Public Types inherited from osg::Object
enum  DataVariance { DYNAMIC, STATIC, UNSPECIFIED }
 
- Static Public Member Functions inherited from osg::Drawable
static GLuint generateDisplayList (unsigned int contextID, unsigned int sizeHint=0)
 
static void setMinimumNumberOfDisplayListsToRetainInCache (unsigned int minimum)
 
static unsigned int getMinimumNumberOfDisplayListsToRetainInCache ()
 
static void deleteDisplayList (unsigned int contextID, GLuint globj, unsigned int sizeHint=0)
 
static void flushAllDeletedDisplayLists (unsigned int contextID)
 
static void discardAllDeletedDisplayLists (unsigned int contextID)
 
static void flushDeletedDisplayLists (unsigned int contextID, double &availableTime)
 
static ExtensionsgetExtensions (unsigned int contextID, bool createIfNotInitalized)
 
static void setExtensions (unsigned int contextID, Extensions *extensions)
 
- Static Public Member Functions inherited from osg::Referenced
static OpenThreads::MutexgetGlobalReferencedMutex ()
 
static void setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting)
 
static bool getThreadSafeReferenceCounting ()
 
static void setDeleteHandler (DeleteHandler *handler)
 
static DeleteHandlergetDeleteHandler ()
 
- Static Public Attributes inherited from osg::Drawable
static unsigned int s_numberDrawablesReusedLastInLastFrame
 
static unsigned int s_numberNewDrawablesInLastFrame
 
static unsigned int s_numberDeletedDrawablesInLastFrame
 
- Protected Types inherited from osg::Drawable
typedef osg::buffered_value< GLuint > GLObjectList
 

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 ( )
protectedvirtual

Member Function Documentation

virtual void osgSim::ImpostorSprite::accept ( Drawable::AttributeFunctor &  af)
virtual

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

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

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

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

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

Reimplemented from osg::Drawable.

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.

virtual const char* osgSim::ImpostorSprite::className ( ) const
inlinevirtual

return the name of the object's class type. Must be defined by derived classes.

Reimplemented from osg::Drawable.

virtual osg::Object* osgSim::ImpostorSprite::clone ( const osg::CopyOp ) const
inlinevirtual

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

Implements osg::Object.

virtual osg::Object* osgSim::ImpostorSprite::cloneType ( ) const
inlinevirtual

Clone an object of the same type as an ImpostorSprite.

Implements osg::Object.

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

Compute the bounding box around Drawables's geometry.

Reimplemented from osg::Drawable.

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

Draw ImpostorSprite directly.

Implements osg::Drawable.

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.

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.

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.

unsigned int osgSim::ImpostorSprite::getLastFrameUsed ( ) const
inline

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

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.

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

Get the eye point for when the ImpostorSprite was snapped.

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::Texture2D* osgSim::ImpostorSprite::getTexture ( )
inline
const osg::Texture2D* osgSim::ImpostorSprite::getTexture ( ) const
inline
virtual bool osgSim::ImpostorSprite::isSameKindAs ( const osg::Object obj) const
inlinevirtual

Reimplemented from osg::Drawable.

virtual const char* osgSim::ImpostorSprite::libraryName ( ) const
inlinevirtual

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.

ImpostorSprite& osgSim::ImpostorSprite::operator= ( const ImpostorSprite )
inlineprotected
int osgSim::ImpostorSprite::s ( ) const
inline
void osgSim::ImpostorSprite::setCamera ( osg::Camera camera)
inline

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

void osgSim::ImpostorSprite::setLastFrameUsed ( unsigned int  frameNumber)
inline

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

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.

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

Set the eye point for when the ImpostorSprite was snapped.

void osgSim::ImpostorSprite::setTexture ( osg::Texture2D tex,
int  s,
int  t 
)
virtual bool osgSim::ImpostorSprite::supports ( const Drawable::AttributeFunctor &  ) const
inlinevirtual

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

virtual bool osgSim::ImpostorSprite::supports ( const Drawable::ConstAttributeFunctor &  ) const
inlinevirtual

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

virtual bool osgSim::ImpostorSprite::supports ( const osg::PrimitiveFunctor ) const
inlinevirtual

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

Reimplemented from osg::Drawable.

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

Friends And Related Function Documentation

friend class osgSim::ImpostorSpriteManager
friend

Member Data Documentation

osg::ref_ptr<osg::Camera> osgSim::ImpostorSprite::_camera
protected
osg::Vec4 osgSim::ImpostorSprite::_color
osg::Vec3 osgSim::ImpostorSprite::_controlcoords[4]
protected
osg::Vec3 osgSim::ImpostorSprite::_coords[4]
protected
ImpostorSpriteManager* osgSim::ImpostorSprite::_ism
protected
unsigned int osgSim::ImpostorSprite::_lastFrameUsed
protected
ImpostorSprite* osgSim::ImpostorSprite::_next
protected
Impostor* osgSim::ImpostorSprite::_parent
protected
ImpostorSprite* osgSim::ImpostorSprite::_previous
protected
int osgSim::ImpostorSprite::_s
protected
osg::Vec3 osgSim::ImpostorSprite::_storedLocalEyePoint
protected
int osgSim::ImpostorSprite::_t
protected
osg::Vec2 osgSim::ImpostorSprite::_texcoords[4]
protected
osg::Texture2D* osgSim::ImpostorSprite::_texture
protected

The documentation for this class was generated from the following file: