Om
1.0.0
A universal framework for multimedia simulation
|
A class that describes a hierarchy of shapes and their transformations. More...
#include <omGraphicsObject.h>
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... | |
GraphicsShape * | getShape (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... | |
GraphicsObject * | getChild (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 Vector3 & | getPosition () const |
Return the position of this transformable. More... | |
void | setPosition (const Vector3 &newPosition) |
Set the position of this transformable. More... | |
const Matrix3 & | getOrientation () const |
Return the orientation of this transformable. More... | |
void | setOrientation (const Matrix3 &newOrientation) |
Set the orientation of this transformable. More... | |
const Vector3 & | getScale () 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 Transform3 & | getTransform () 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 AABB3 & | getBoundingBox () const |
Return an axis-aligned bounding box that encompases this entire transformable in its parent coordinate space. More... | |
const AABB3 & | getLocalBoundingBox () 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... | |
RenderableFlags & | getFlags () |
Return a reference to an object that contains boolean parameters of the renderable. More... | |
const RenderableFlags & | getFlags () 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... | |
GraphicsContext * | getContext () 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 | |
GraphicsContext * | context |
A pointer to the graphics context this object is using. More... | |
A class that describes a hierarchy of shapes and their transformations.
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 |
Destroy a graphics object.
|
inline |
Return the number of shapes that this object has.
|
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.
|
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.
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.
void om::graphics::scenes::GraphicsObject::clearShapes | ( | ) |
Remove all shapes from this object.
|
inline |
Return the number of child objects that this object has.
|
inline |
Return a pointer to the child object at the specified index.
|
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.
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.
void om::graphics::scenes::GraphicsObject::clearChildren | ( | ) |
Remove all children from this graphics object.
|
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 |
Upload this object's current CPU representation to the GPU device.
Reimplemented from om::graphics::devices::GraphicsContextObject.
|
virtual |
Download the object's GPU representation to CPU memory.
Reimplemented from om::graphics::devices::GraphicsContextObject.
|
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 |
Trace a ray through this object and compute the closest intersection.
|
virtual |
Trace a ray through this object and determine if any intersection exist along the ray.
|
virtual |
Process the renderable and add all child renderable objects to the output render queue.
Implements om::graphics::base::Renderable.
|
static |
The resource type for a graphics object.