Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Ogre::MovableObject Class Reference

Abstract class definining a movable object in a scene. More...

#include <OgreMovableObject.h>

Inheritance diagram for Ogre::MovableObject:

Ogre::ShadowCaster Ogre::BillboardSet Ogre::Entity Ogre::Frustum Ogre::Light Ogre::MovablePlane Ogre::ParticleSystem Ogre::SimpleRenderable Ogre::StaticGeometry::Region Ogre::TerrainRenderable List of all members.

Public Types

typedef std::vector< ShadowRenderable * > ShadowRenderableList
typedef VectorIterator< ShadowRenderableListShadowRenderableListIterator

Public Member Functions

 MovableObject ()
 Constructor.

virtual ~MovableObject ()
 Virtual destructor - read Scott Meyers if you don't know why this is needed.

virtual const StringgetName (void) const=0
 Returns the name of this object.

virtual const StringgetMovableType (void) const=0
 Returns the type name of this object.

virtual NodegetParentNode (void) const
 Returns the node to which this object is attached.

virtual SceneNodegetParentSceneNode (void) const
 Returns the scene node to which this object is attached.

virtual void _notifyAttached (Node *parent, bool isTagPoint=false)
 Internal method called to notify the object that it has been attached to a node.

virtual bool isAttached (void) const
 Returns true if this object is attached to a SceneNode or TagPoint.

virtual bool isInScene (void) const
 Returns true if this object is attached to a SceneNode or TagPoint, and this SceneNode / TagPoint is currently in an active part of the scene graph.

virtual void _notifyCurrentCamera (Camera *cam)=0
 Internal method to notify the object of the camera to be used for the next rendering operation.

virtual const AxisAlignedBoxgetBoundingBox (void) const=0
 Retrieves the local axis-aligned bounding box for this object.

virtual Real getBoundingRadius (void) const=0
 Retrieves the radius of the origin-centered bounding sphere for this object.

virtual const AxisAlignedBoxgetWorldBoundingBox (bool derive=false) const
 Retrieves the axis-aligned bounding box for this object in world coordinates.

virtual const SpheregetWorldBoundingSphere (bool derive=false) const
 Retrieves the worldspace bounding sphere for this object.

virtual void _updateRenderQueue (RenderQueue *queue)=0
 Internal method by which the movable object must add Renderable subclass instances to the rendering queue.

virtual void setVisible (bool visible)
 Tells this object whether to be visible or not, if it has a renderable component.

virtual bool isVisible (void) const
 Returns whether or not this object is supposed to be visible or not.

virtual void setUserObject (UserDefinedObject *obj)
 Call this to associate your own custom user object instance with this MovableObject.

virtual UserDefinedObjectgetUserObject (void)
 Retrieves a pointer to a custom application object associated with this movable by an earlier call to setUserObject.

virtual void setRenderQueueGroup (RenderQueueGroupID queueID)
 Sets the render queue group this entity will be rendered through.

virtual RenderQueueGroupID getRenderQueueGroup (void) const
 Gets the queue group for this entity, see setRenderQueueGroup for full details.

virtual Matrix4 _getParentNodeFullTransform (void) const
 return the full transformation of the parent sceneNode or the attachingPoint node

virtual void setQueryFlags (unsigned long flags)
 Sets the query flags for this object.

virtual void addQueryFlags (unsigned long flags)
 As setQueryFlags, except the flags passed as parameters are appended to the existing flags on this object.

virtual void removeQueryFlags (unsigned long flags)
 As setQueryFlags, except the flags passed as parameters are removed from the existing flags on this object.

virtual unsigned long getQueryFlags (void) const
 Returns the query flags relevant for this object.

EdgeDatagetEdgeList (void)
 Define a default implementation of method from ShadowCaster which implements no shadows.

ShadowRenderableListIterator getShadowVolumeRenderableIterator (ShadowTechnique shadowTechnique, const Light *light, HardwareIndexBufferSharedPtr *indexBuffer, bool extrudeVertices, Real extrusionDist, unsigned long flags=0)
 Define a default implementation of method from ShadowCaster which implements no shadows.

const AxisAlignedBoxgetLightCapBounds (void) const
 Overridden member from ShadowCaster.

const AxisAlignedBoxgetDarkCapBounds (const Light &light, Real dirLightExtrusionDist) const
 Overridden member from ShadowCaster.

void setCastShadows (bool enabled)
 Sets whether or not this object will cast shadows.

bool getCastShadows (void) const
 Returns whether shadow casting is enabled for this object.

Real getPointExtrusionDistance (const Light *l) const
 Get the distance to extrude for a point/spot light.


Static Public Member Functions

void extrudeVertices (HardwareVertexBufferSharedPtr vertexBuffer, size_t originalVertexCount, const Vector4 &lightPos, Real extrudeDist)
 Utility method for extruding vertices based on a light.


Protected Member Functions

Real getExtrusionDistance (const Vector3 &objectPos, const Light *light) const
 Helper moethod for calculating extrusion distance.

virtual void updateEdgeListLightFacing (EdgeData *edgeData, const Vector4 &lightPos)
 Tells the caster to perform the tasks necessary to update the edge data's light listing.

virtual void generateShadowVolume (EdgeData *edgeData, HardwareIndexBufferSharedPtr indexBuffer, const Light *light, ShadowRenderableList &shadowRenderables, unsigned long flags)
 Generates the indexes required to render a shadow volume into the index buffer which is passed in, and updates shadow renderables to use it.

virtual void extrudeBounds (AxisAlignedBox &box, const Vector4 &lightPos, Real extrudeDist) const
 Utility method for extruding a bounding box.


Protected Attributes

NodemParentNode
 node to which this object is attached

bool mParentIsTagPoint
bool mVisible
 Is this object visible?

UserDefinedObjectmUserObject
 User defined object which is linked to this object.

RenderQueueGroupID mRenderQueueID
 The render queue to use when rendering this object.

bool mRenderQueueIDSet
 Flags whether the RenderQueue's default should be used.

unsigned long mQueryFlags
 Flags determining whether this object is included / excluded from scene queries.

AxisAlignedBox mWorldAABB
 Cached world AABB of this object.

Sphere mWorldBoundingSphere
AxisAlignedBox mWorldDarkCapBounds
 World space AABB of this object's dark cap.

bool mCastShadows
 Does this object cast shadows?


Detailed Description

Abstract class definining a movable object in a scene.

Remarks:
Instances of this class are discrete, relatively small, movable objects which are attached to SceneNode objects to define their position.

Definition at line 44 of file OgreMovableObject.h.


Member Typedef Documentation

typedef std::vector<ShadowRenderable*> Ogre::ShadowCaster::ShadowRenderableList [inherited]
 

Definition at line 121 of file OgreShadowCaster.h.

typedef VectorIterator<ShadowRenderableList> Ogre::ShadowCaster::ShadowRenderableListIterator [inherited]
 

Definition at line 122 of file OgreShadowCaster.h.


Constructor & Destructor Documentation

Ogre::MovableObject::MovableObject  ) 
 

Constructor.

virtual Ogre::MovableObject::~MovableObject  )  [virtual]
 

Virtual destructor - read Scott Meyers if you don't know why this is needed.


Member Function Documentation

virtual Matrix4 Ogre::MovableObject::_getParentNodeFullTransform void   )  const [virtual]
 

return the full transformation of the parent sceneNode or the attachingPoint node

virtual void Ogre::MovableObject::_notifyAttached Node parent,
bool  isTagPoint = false
[virtual]
 

Internal method called to notify the object that it has been attached to a node.

Reimplemented in Ogre::Entity, and Ogre::ParticleSystem.

virtual void Ogre::MovableObject::_notifyCurrentCamera Camera cam  )  [pure virtual]
 

Internal method to notify the object of the camera to be used for the next rendering operation.

Remarks:
Certain objects may want to do specific processing based on the camera position. This method notifies them incase they wish to do this.

Implemented in Ogre::BillboardSet, Ogre::Entity, Ogre::Frustum, Ogre::Light, Ogre::MovablePlane, Ogre::ParticleSystem, Ogre::SimpleRenderable, Ogre::StaticGeometry::Region, and Ogre::TerrainRenderable.

virtual void Ogre::MovableObject::_updateRenderQueue RenderQueue queue  )  [pure virtual]
 

Internal method by which the movable object must add Renderable subclass instances to the rendering queue.

Remarks:
The engine will call this method when this object is to be rendered. The object must then create one or more Renderable subclass instances which it places on the passed in Queue for rendering.

Implemented in Ogre::BillboardSet, Ogre::Entity, Ogre::Frustum, Ogre::Light, Ogre::MovablePlane, Ogre::ParticleSystem, Ogre::SimpleRenderable, Ogre::StaticGeometry::Region, and Ogre::TerrainRenderable.

virtual void Ogre::MovableObject::addQueryFlags unsigned long  flags  )  [virtual]
 

As setQueryFlags, except the flags passed as parameters are appended to the existing flags on this object.

Definition at line 203 of file OgreMovableObject.h.

virtual void Ogre::ShadowCaster::extrudeBounds AxisAlignedBox box,
const Vector4 lightPos,
Real  extrudeDist
const [protected, virtual, inherited]
 

Utility method for extruding a bounding box.

Parameters:
box Original bounding box, will be updated in-place
lightPos 4D light position in object space, when w=0.0f this represents a directional light
extrudeDist The distance to extrude

void Ogre::ShadowCaster::extrudeVertices HardwareVertexBufferSharedPtr  vertexBuffer,
size_t  originalVertexCount,
const Vector4 lightPos,
Real  extrudeDist
[static, inherited]
 

Utility method for extruding vertices based on a light.

Remarks:
Unfortunately, because D3D cannot handle homogenous (4D) position coordinates in the fixed-function pipeline (GL can, but we have to be cross-API), when we extrude in software we cannot extrude to infinity the way we do in the vertex program (by setting w to 0.0f). Therefore we extrude by a fixed distance, which may cause some problems with larger scenes. Luckily better hardware (ie vertex programs) can fix this.
Parameters:
vertexBuffer The vertex buffer containing ONLY xyz position values, which must be originalVertexCount * 2 * 3 floats long.
originalVertexCount The count of the original number of vertices, ie the number in the mesh, not counting the doubling which has already been done (by VertexData::prepareForShadowVolume) to provide the extruded area of the buffer.
lightPos 4D light position in object space, when w=0.0f this represents a directional light
extrudeDist The distance to extrude

virtual void Ogre::ShadowCaster::generateShadowVolume EdgeData edgeData,
HardwareIndexBufferSharedPtr  indexBuffer,
const Light light,
ShadowRenderableList shadowRenderables,
unsigned long  flags
[protected, virtual, inherited]
 

Generates the indexes required to render a shadow volume into the index buffer which is passed in, and updates shadow renderables to use it.

Parameters:
edgeData The edge information to use
indexBuffer The buffer into which to write data into; current contents are assumed to be discardable.
light The light, mainly for type info as silhouette calculations should already have been done in updateEdgeListLightFacing
shadowRenderables A list of shadow renderables which has already been constructed but will need populating with details of the index ranges to be used.
flags Additional controller flags, see ShadowRenderableFlags

virtual const AxisAlignedBox& Ogre::MovableObject::getBoundingBox void   )  const [pure virtual]
 

Retrieves the local axis-aligned bounding box for this object.

Remarks:
This bounding box is in local coordinates.

Implemented in Ogre::BillboardSet, Ogre::Entity, Ogre::Frustum, Ogre::Light, Ogre::MovablePlane, Ogre::ParticleSystem, Ogre::SimpleRenderable, Ogre::StaticGeometry::Region, and Ogre::TerrainRenderable.

virtual Real Ogre::MovableObject::getBoundingRadius void   )  const [pure virtual]
 

Retrieves the radius of the origin-centered bounding sphere for this object.

Implemented in Ogre::BillboardSet, Ogre::Camera, Ogre::Entity, Ogre::Frustum, Ogre::Light, Ogre::MovablePlane, Ogre::ParticleSystem, Ogre::Rectangle2D, Ogre::StaticGeometry::Region, Ogre::WireBoundingBox, and Ogre::TerrainRenderable.

bool Ogre::MovableObject::getCastShadows void   )  const [virtual]
 

Returns whether shadow casting is enabled for this object.

Implements Ogre::ShadowCaster.

Definition at line 238 of file OgreMovableObject.h.

const AxisAlignedBox& Ogre::MovableObject::getDarkCapBounds const Light light,
Real  dirLightExtrusionDist
const [virtual]
 

Overridden member from ShadowCaster.

Implements Ogre::ShadowCaster.

EdgeData* Ogre::MovableObject::getEdgeList void   )  [virtual]
 

Define a default implementation of method from ShadowCaster which implements no shadows.

Implements Ogre::ShadowCaster.

Reimplemented in Ogre::Entity, and Ogre::StaticGeometry::Region.

Definition at line 213 of file OgreMovableObject.h.

Real Ogre::ShadowCaster::getExtrusionDistance const Vector3 objectPos,
const Light light
const [protected, inherited]
 

Helper moethod for calculating extrusion distance.

const AxisAlignedBox& Ogre::MovableObject::getLightCapBounds void   )  const [virtual]
 

Overridden member from ShadowCaster.

Implements Ogre::ShadowCaster.

virtual const String& Ogre::MovableObject::getMovableType void   )  const [pure virtual]
 

Returns the type name of this object.

Implemented in Ogre::BillboardSet, Ogre::Camera, Ogre::Entity, Ogre::Frustum, Ogre::Light, Ogre::MovablePlane, Ogre::ParticleSystem, Ogre::SimpleRenderable, Ogre::StaticGeometry::Region, and Ogre::TerrainRenderable.

virtual const String& Ogre::MovableObject::getName void   )  const [pure virtual]
 

Returns the name of this object.

Implemented in Ogre::BillboardSet, Ogre::Camera, Ogre::Entity, Ogre::Frustum, Ogre::Light, Ogre::MovablePlane, Ogre::ParticleSystem, Ogre::SimpleRenderable, Ogre::StaticGeometry::Region, and Ogre::TerrainRenderable.

virtual Node* Ogre::MovableObject::getParentNode void   )  const [virtual]
 

Returns the node to which this object is attached.

Remarks:
A MovableObject may be attached to either a SceneNode or to a TagPoint, the latter case if it's attached to a bone on an animated entity. Both are Node subclasses so this method will return either.

virtual SceneNode* Ogre::MovableObject::getParentSceneNode void   )  const [virtual]
 

Returns the scene node to which this object is attached.

Remarks:
A MovableObject may be attached to either a SceneNode or to a TagPoint, the latter case if it's attached to a bone on an animated entity. This method will return the scene node of the parent entity if the latter is true.

Real Ogre::MovableObject::getPointExtrusionDistance const Light l  )  const [virtual]
 

Get the distance to extrude for a point/spot light.

Implements Ogre::ShadowCaster.

virtual unsigned long Ogre::MovableObject::getQueryFlags void   )  const [virtual]
 

Returns the query flags relevant for this object.

Definition at line 210 of file OgreMovableObject.h.

virtual RenderQueueGroupID Ogre::MovableObject::getRenderQueueGroup void   )  const [virtual]
 

Gets the queue group for this entity, see setRenderQueueGroup for full details.

ShadowRenderableListIterator Ogre::MovableObject::getShadowVolumeRenderableIterator ShadowTechnique  shadowTechnique,
const Light light,
HardwareIndexBufferSharedPtr indexBuffer,
bool  extrudeVertices,
Real  extrusionDist,
unsigned long  flags = 0
[virtual]
 

Define a default implementation of method from ShadowCaster which implements no shadows.

Implements Ogre::ShadowCaster.

Reimplemented in Ogre::Entity, and Ogre::StaticGeometry::Region.

virtual UserDefinedObject* Ogre::MovableObject::getUserObject void   )  [virtual]
 

Retrieves a pointer to a custom application object associated with this movable by an earlier call to setUserObject.

Definition at line 171 of file OgreMovableObject.h.

virtual const AxisAlignedBox& Ogre::MovableObject::getWorldBoundingBox bool  derive = false  )  const [virtual]
 

Retrieves the axis-aligned bounding box for this object in world coordinates.

Implements Ogre::ShadowCaster.

Reimplemented in Ogre::Entity.

virtual const Sphere& Ogre::MovableObject::getWorldBoundingSphere bool  derive = false  )  const [virtual]
 

Retrieves the worldspace bounding sphere for this object.

Reimplemented in Ogre::Entity.

virtual bool Ogre::MovableObject::isAttached void   )  const [virtual]
 

Returns true if this object is attached to a SceneNode or TagPoint.

virtual bool Ogre::MovableObject::isInScene void   )  const [virtual]
 

Returns true if this object is attached to a SceneNode or TagPoint, and this SceneNode / TagPoint is currently in an active part of the scene graph.

virtual bool Ogre::MovableObject::isVisible void   )  const [virtual]
 

Returns whether or not this object is supposed to be visible or not.

Reimplemented in Ogre::StaticGeometry::Region.

virtual void Ogre::MovableObject::removeQueryFlags unsigned long  flags  )  [virtual]
 

As setQueryFlags, except the flags passed as parameters are removed from the existing flags on this object.

Definition at line 207 of file OgreMovableObject.h.

void Ogre::MovableObject::setCastShadows bool  enabled  ) 
 

Sets whether or not this object will cast shadows.

Remarks:
This setting simply allows you to turn on/off shadows for a given object. An object will not cast shadows unless the scene supports it in any case (see SceneManager::setShadowTechnique), and also the material which is in use must also have shadow casting enabled. By default all entities cast shadows. If, however, for some reason you wish to disable this for a single object then you can do so using this method.
Note:
This method normally refers to objects which block the light, but since Light is also a subclass of MovableObject, in that context it means whether the light causes shadows itself.

Definition at line 236 of file OgreMovableObject.h.

virtual void Ogre::MovableObject::setQueryFlags unsigned long  flags  )  [virtual]
 

Sets the query flags for this object.

Remarks:
When performing a scene query, this object will be included or excluded according to flags on the object and flags on the query. This is a bitwise value, so only when a bit on these flags is set, will it be included in a query asking for that flag. The meaning of the bits is application-specific.

Definition at line 199 of file OgreMovableObject.h.

virtual void Ogre::MovableObject::setRenderQueueGroup RenderQueueGroupID  queueID  )  [virtual]
 

Sets the render queue group this entity will be rendered through.

Remarks:
Render queues are grouped to allow you to more tightly control the ordering of rendered objects. If you do not call this method, all Entity objects default to the default queue (RenderQueue::getDefaultQueueGroup), which is fine for most objects. You may want to alter this if you want this entity to always appear in front of other objects, e.g. for a 3D menu system or such.
See RenderQueue for more details.
Parameters:
queueID Enumerated value of the queue group to use.

Reimplemented in Ogre::Entity, and Ogre::ParticleSystem.

virtual void Ogre::MovableObject::setUserObject UserDefinedObject obj  )  [virtual]
 

Call this to associate your own custom user object instance with this MovableObject.

Remarks:
By simply making your game / application object a subclass of UserDefinedObject, you can establish a link between an OGRE instance of MovableObject and your own application classes. Call this method to establish the link.

Definition at line 167 of file OgreMovableObject.h.

virtual void Ogre::MovableObject::setVisible bool  visible  )  [virtual]
 

Tells this object whether to be visible or not, if it has a renderable component.

Note:
An alternative approach of making an object invisible is to detach it from it's SceneNode, or to remove the SceneNode entirely. Detaching a node means that structurally the scene graph changes. Once this change has taken place, the objects / nodes that have been removed have less overhead to the visbility detection pass than simply making the object invisible, so if you do this and leave the objects out of the tree for a long time, it's faster. However, the act of detaching / reattaching nodes is in itself more expensive than setting an object visibility flag, since in the latter case structural changes are not made. Therefore, small or frequent visbility changes are best done using this method; large or more longer term changes are best done by detaching.

Reimplemented in Ogre::Light.

virtual void Ogre::ShadowCaster::updateEdgeListLightFacing EdgeData edgeData,
const Vector4 lightPos
[protected, virtual, inherited]
 

Tells the caster to perform the tasks necessary to update the edge data's light listing.

Can be overridden if the subclass needs to do additional things.

Parameters:
edgeData The edge information to update
lightPos 4D vector representing the light, a directional light has w=0.0


Member Data Documentation

bool Ogre::MovableObject::mCastShadows [protected]
 

Does this object cast shadows?

Definition at line 67 of file OgreMovableObject.h.

bool Ogre::MovableObject::mParentIsTagPoint [protected]
 

Definition at line 49 of file OgreMovableObject.h.

Node* Ogre::MovableObject::mParentNode [protected]
 

node to which this object is attached

Definition at line 48 of file OgreMovableObject.h.

unsigned long Ogre::MovableObject::mQueryFlags [protected]
 

Flags determining whether this object is included / excluded from scene queries.

Definition at line 59 of file OgreMovableObject.h.

RenderQueueGroupID Ogre::MovableObject::mRenderQueueID [protected]
 

The render queue to use when rendering this object.

Definition at line 55 of file OgreMovableObject.h.

bool Ogre::MovableObject::mRenderQueueIDSet [protected]
 

Flags whether the RenderQueue's default should be used.

Definition at line 57 of file OgreMovableObject.h.

UserDefinedObject* Ogre::MovableObject::mUserObject [protected]
 

User defined object which is linked to this object.

Definition at line 53 of file OgreMovableObject.h.

bool Ogre::MovableObject::mVisible [protected]
 

Is this object visible?

Definition at line 51 of file OgreMovableObject.h.

AxisAlignedBox Ogre::MovableObject::mWorldAABB [mutable, protected]
 

Cached world AABB of this object.

Reimplemented in Ogre::ParticleSystem.

Definition at line 61 of file OgreMovableObject.h.

Sphere Ogre::MovableObject::mWorldBoundingSphere [mutable, protected]
 

Definition at line 63 of file OgreMovableObject.h.

AxisAlignedBox Ogre::MovableObject::mWorldDarkCapBounds [mutable, protected]
 

World space AABB of this object's dark cap.

Definition at line 65 of file OgreMovableObject.h.


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

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 13:01:22 2006