Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Static Public Attributes | List of all members
om::graphics::scenes::GraphicsObject Class Reference

A class that describes a hierarchy of shapes and their transformations. More...

#include <omGraphicsObject.h>

Inheritance diagram for om::graphics::scenes::GraphicsObject:
om::graphics::base::Transformable om::graphics::base::Renderable om::graphics::devices::GraphicsContextObject

Public Member Functions

 GraphicsObject ()
 Create a default object with no shape centered at the origin. More...
 
 GraphicsObject (const Transform3 &newTransform)
 Create an object with no shape and the specified transformation. More...
 
 GraphicsObject (GraphicsShape *newShape)
 Create an object centered at the origin with the specified shape. More...
 
 GraphicsObject (GraphicsShape *newShape, const Transform3 &newTransform)
 Create an object with the specified shape and transformation. More...
 
virtual ~GraphicsObject ()
 Destroy a graphics object. More...
 
Size getShapeCount () const
 Return the number of shapes that this object has. More...
 
GraphicsShapegetShape (Index shapeIndex) const
 Return a pointer to the shape for this object at the specified index. More...
 
Bool addShape (GraphicsShape *newShape)
 Set the shape for this object at the specified index. More...
 
Bool setShape (Index shapeIndex, GraphicsShape *newShape)
 Set the shape for this object at the specified index. More...
 
Bool removeShape (Index shapeIndex)
 Remove the shape from this object at the specified index. More...
 
Bool removeShape (const GraphicsShape *shape)
 Remove the specified shape from this object. More...
 
void clearShapes ()
 Remove all shapes from this object. More...
 
Size getChildCount () const
 Return the number of child objects that this object has. More...
 
GraphicsObjectgetChild (Index childIndex) const
 Return a pointer to the child object at the specified index. More...
 
void setChild (Index childIndex, GraphicsObject *newChild)
 Set a pointer to the child object at the specified index. More...
 
Bool addChild (GraphicsObject *child)
 Add a child object to this graphics object. More...
 
Bool removeChild (Index childIndex)
 Remove the child object from this object at the specified index. More...
 
Bool removeChild (const GraphicsObject *child)
 Remove the specified child object from this object. More...
 
void clearChildren ()
 Remove all children from this graphics object. More...
 
void setContext (devices::GraphicsContext *context)
 Prepare this object and its children for rendering with the specified context. More...
 
virtual void upload (UploadRequest &request)
 Upload this object's current CPU representation to the GPU device. More...
 
virtual void download (DownloadRequest &request)
 Download the object's GPU representation to CPU memory. More...
 
virtual void updateBoundingBox ()
 Update this object's bounding box. More...
 
virtual void intersectRay (GraphicsRay &ray) const
 Trace a ray through this object and compute the closest intersection. More...
 
virtual void testRay (GraphicsRay &ray) const
 Trace a ray through this object and determine if any intersection exist along the ray. More...
 
virtual void getRenderables (const RenderRequest &request, const Transform3 &worldTransform, RenderQueue &outputQueue) const
 Process the renderable and add all child renderable objects to the output render queue. More...
 
- Public Member Functions inherited from om::graphics::base::Transformable
 Transformable ()
 Create a new transformable with the identity transformation. More...
 
 Transformable (const Transform3 &newTransform)
 Create a new transformable with the specified transformation. More...
 
virtual ~Transformable ()
 Destroy this transformable, releasing all associated resources. More...
 
const Vector3getPosition () const
 Return the position of this transformable. More...
 
void setPosition (const Vector3 &newPosition)
 Set the position of this transformable. More...
 
const Matrix3getOrientation () const
 Return the orientation of this transformable. More...
 
void setOrientation (const Matrix3 &newOrientation)
 Set the orientation of this transformable. More...
 
const Vector3getScale () const
 Get the scale of the transformable. More...
 
void setScale (Real newScale)
 Set the scale of the transformable uniformly for all dimensions. More...
 
void setScale (const Vector3 &newScale)
 Set the scale of the transformable. More...
 
const Transform3getTransform () const
 Return the transformation for this transformable between its local and parent coordinate frame. More...
 
void setTransform (const Transform3 &newTransform)
 Set the transformation for this transformable between its local and parent coordinate frame. More...
 
Matrix4 getTransformMatrix () const
 Return a 4x4 matrix representing the transformation from object to world space. More...
 
Matrix4 getTransformMatrixInverse () const
 Return a 4x4 matrix which transforms points from world space to object space. More...
 
Sphere3 getBoundingSphere () const
 Return a bounding sphere for this transformable in its parent coordinate space. More...
 
Sphere3 getLocalBoundingSphere () const
 Return a bounding sphere for this transformable in its local coordinate space. More...
 
const AABB3getBoundingBox () const
 Return an axis-aligned bounding box that encompases this entire transformable in its parent coordinate space. More...
 
const AABB3getLocalBoundingBox () const
 Return an axis-aligned bounding box that encompases this entire transformable in its local coordinate space. More...
 
- Public Member Functions inherited from om::graphics::base::Renderable
 Renderable ()
 Create a new renderable object with the default renderable flags. More...
 
 Renderable (const RenderableFlags &newFlags)
 Create a new renderable object with the specified renderable flags. More...
 
RenderableFlagsgetFlags ()
 Return a reference to an object that contains boolean parameters of the renderable. More...
 
const RenderableFlagsgetFlags () const
 Return an object that contains boolean parameters of the renderable. More...
 
void setFlags (const RenderableFlags &newFlags)
 Set an object that contains boolean parameters of the renderable. More...
 
Bool flagIsSet (RenderableFlags::Flag flag) const
 Return whether or not the specified boolan flag is set for this renderable. More...
 
Bool flagsAreSet (const RenderableFlags &otherFlags) const
 Return whether or not all of the specified boolan flags are set for this renderable. More...
 
void setFlag (RenderableFlags::Flag flag, Bool newIsSet=true)
 Set whether or not the specified boolan flag is set for this renderable. More...
 
Bool getIsVisible () const
 Get whether or not the renderable and its children are visible in the scene. More...
 
void setIsVisible (Bool newIsVisible)
 Set whether or not the renderable and its children are visible in the scene. More...
 
Bool getShadowsEnabled () const
 Return whether or not this renderable can cast shadows. More...
 
void setShadowsEnabled (Bool newCanCastShadows)
 Set whether or not this renderable can cast shadows. More...
 
- Public Member Functions inherited from om::graphics::devices::GraphicsContextObject
virtual ~GraphicsContextObject ()
 Destory this graphics context object. More...
 
GraphicsContextgetContext () const
 Return a pointer to the graphics context this context object is using to do rendering. More...
 
void clearContext ()
 Clear the previous context from this object. More...
 
void upload ()
 Upload this resource's CPU representation to the GPU device. More...
 
void download ()
 Upload this resource's CPU representation to the GPU device. More...
 
virtual Bool isUploaded () const
 Return whether or not this graphics resource has been successfully created and uploaded to the device. More...
 
virtual Bool isDownloaded () const
 Return whether or not this graphics resource has a copy of its data stored in CPU-side memory. More...
 
virtual Bool isValid () const
 Return whether or not the state of this graphics resource is valid (either on CPU or GPU) and able to be used for rendering. More...
 

Static Public Attributes

static const ResourceType RESOURCE_TYPE
 The resource type for a graphics object. More...
 

Additional Inherited Members

- Protected Member Functions inherited from om::graphics::base::Transformable
void setLocalBoundingBox (const AABB3 &newLocalBoundingBox)
 Set the local axis-aligned bounding box for this shape. More...
 
- Protected Member Functions inherited from om::graphics::devices::GraphicsContextObject
 GraphicsContextObject ()
 Create a new graphics context object that doesn't have an associated graphics context. More...
 
 GraphicsContextObject (GraphicsContext *newContext)
 Create a new graphics context object that uses the specified context for rendering. More...
 
- Protected Attributes inherited from om::graphics::base::Transformable
Transform3 transform
 The transformation for this transformable between its local and parent coordinate frame. More...
 
- Protected Attributes inherited from om::graphics::base::Renderable
RenderableFlags flags
 An object containing boolean configuration flags for this renderable. More...
 
- Protected Attributes inherited from om::graphics::devices::GraphicsContextObject
GraphicsContextcontext
 A pointer to the graphics context this object is using. More...
 

Detailed Description

A class that describes a hierarchy of shapes and their transformations.

Constructor & Destructor Documentation

om::graphics::scenes::GraphicsObject::GraphicsObject ( )

Create a default object with no shape centered at the origin.

om::graphics::scenes::GraphicsObject::GraphicsObject ( const Transform3 newTransform)

Create an object with no shape and the specified transformation.

om::graphics::scenes::GraphicsObject::GraphicsObject ( GraphicsShape newShape)

Create an object centered at the origin with the specified shape.

om::graphics::scenes::GraphicsObject::GraphicsObject ( GraphicsShape newShape,
const Transform3 newTransform 
)

Create an object with the specified shape and transformation.

virtual om::graphics::scenes::GraphicsObject::~GraphicsObject ( )
virtual

Destroy a graphics object.

Member Function Documentation

Size om::graphics::scenes::GraphicsObject::getShapeCount ( ) const
inline

Return the number of shapes that this object has.

GraphicsShape* om::graphics::scenes::GraphicsObject::getShape ( Index  shapeIndex) const
inline

Return a pointer to the shape for this object at the specified index.

Bool om::graphics::scenes::GraphicsObject::addShape ( GraphicsShape newShape)

Set the shape for this object at the specified index.

The method returns whether or not the operation was successful. The method fails if the new shape pointer is NULL.

Bool om::graphics::scenes::GraphicsObject::setShape ( Index  shapeIndex,
GraphicsShape newShape 
)
inline

Set the shape for this object at the specified index.

The method returns whether or not the operation was successful. The method fails if the new shape pointer is NULL.

Bool om::graphics::scenes::GraphicsObject::removeShape ( Index  shapeIndex)

Remove the shape from this object at the specified index.

The method returns whether or not the operation was successful. The method fails if the specified index is out of bounds.

Bool om::graphics::scenes::GraphicsObject::removeShape ( const GraphicsShape shape)

Remove the specified shape from this object.

Returns
whether or not the shape was successfully found and removed.
void om::graphics::scenes::GraphicsObject::clearShapes ( )

Remove all shapes from this object.

Size om::graphics::scenes::GraphicsObject::getChildCount ( ) const
inline

Return the number of child objects that this object has.

GraphicsObject* om::graphics::scenes::GraphicsObject::getChild ( Index  childIndex) const
inline

Return a pointer to the child object at the specified index.

void om::graphics::scenes::GraphicsObject::setChild ( Index  childIndex,
GraphicsObject newChild 
)
inline

Set a pointer to the child object at the specified index.

Bool om::graphics::scenes::GraphicsObject::addChild ( GraphicsObject child)

Add a child object to this graphics object.

The method returns whether or not the add operation was successful. The method fails if the specified new child pointer is NULL.

Bool om::graphics::scenes::GraphicsObject::removeChild ( Index  childIndex)

Remove the child object from this object at the specified index.

The method returns whether or not the operation was successful. The method fails if the specified index is out of bounds.

Bool om::graphics::scenes::GraphicsObject::removeChild ( const GraphicsObject child)

Remove the specified child object from this object.

Returns
whether or not the child object was successfully found and removed.
void om::graphics::scenes::GraphicsObject::clearChildren ( )

Remove all children from this graphics object.

void om::graphics::scenes::GraphicsObject::setContext ( devices::GraphicsContext context)
virtual

Prepare this object and its children for rendering with the specified context.

The method propagates the context to the object's children and shapes and regenerates any context-specific data for the new context if the upload flag is TRUE. The method returns whether or not the context can be successfully used for rendering this object.

Reimplemented from om::graphics::devices::GraphicsContextObject.

virtual void om::graphics::scenes::GraphicsObject::upload ( UploadRequest request)
virtual

Upload this object's current CPU representation to the GPU device.

Reimplemented from om::graphics::devices::GraphicsContextObject.

virtual void om::graphics::scenes::GraphicsObject::download ( DownloadRequest request)
virtual

Download the object's GPU representation to CPU memory.

Reimplemented from om::graphics::devices::GraphicsContextObject.

virtual void om::graphics::scenes::GraphicsObject::updateBoundingBox ( )
virtual

Update this object's bounding box.

This method uses the current bounding boxes for all child objects and shapes to compute a new bounding box for this object in its parent coordinate frame. This method does not update the bounding boxes for each shape that is part of this object, but it does recursively call updateBoundingBox() on all child objects so that the entire object hierarchy is updated with one method call.

Reimplemented from om::graphics::base::Transformable.

virtual void om::graphics::scenes::GraphicsObject::intersectRay ( GraphicsRay ray) const
virtual

Trace a ray through this object and compute the closest intersection.

virtual void om::graphics::scenes::GraphicsObject::testRay ( GraphicsRay ray) const
virtual

Trace a ray through this object and determine if any intersection exist along the ray.

virtual void om::graphics::scenes::GraphicsObject::getRenderables ( const RenderRequest request,
const Transform3 worldTransform,
RenderQueue outputQueue 
) const
virtual

Process the renderable and add all child renderable objects to the output render queue.

Implements om::graphics::base::Renderable.

Member Data Documentation

const ResourceType om::graphics::scenes::GraphicsObject::RESOURCE_TYPE
static

The resource type for a graphics object.


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