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

A class that represents a renderable mesh. More...

#include <omGraphicsMeshShape.h>

Inheritance diagram for om::graphics::shapes::MeshShape:
om::graphics::shapes::GraphicsShape om::graphics::base::Renderable om::graphics::devices::GraphicsContextObject

Public Member Functions

 MeshShape ()
 Create a new mesh shape with no mesh groups or geometry. More...
 
 MeshShape (MeshGroup *newGroup)
 Create a new mesh shape with the specified mesh group. More...
 
 MeshShape (const MeshShape &other)
 Create a copy of the specified mesh shape with the same groups as the original. More...
 
 ~MeshShape ()
 Destroy a mesh shape and release its internal resources. More...
 
MeshShapeoperator= (const MeshShape &other)
 Assign the state of another mesh shape to this one. More...
 
Size getGroupCount () const
 Return the total number of mesh groups that are a part of this mesh shape. More...
 
MeshGroupgetGroup (Index groupIndex) const
 Return a pointer to the mesh group for this mesh shape at the specified index. More...
 
Bool setGroup (Index groupIndex, MeshGroup *group)
 Set a pointer to the mesh group for this mesh shape at the specified index. More...
 
Bool addGroup (MeshGroup *newGroup)
 Add a new mesh group to this mesh shape. More...
 
void removeGroup (Index groupIndex)
 Remove the mesh group from this mesh at the specified index. More...
 
void clearGroups ()
 Remove all mesh groups and geometry from this mesh shape. More...
 
SkeletongetSkeleton () const
 Return a pointer to the skeleton for this mesh shape, or NULL if it doesn't have one. More...
 
void setSkeleton (Skeleton *newSkeleton)
 Set the skeleton that is used to pose this mesh shape. More...
 
virtual void setContext (devices::GraphicsContext *newContext)
 Set the graphics context that is used to render this mesh shape. More...
 
virtual void upload (UploadRequest &request)
 Upload this mesh shape's current CPU representation to the GPU device. More...
 
virtual void download (DownloadRequest &request)
 Download the mesh shape's GPU representation to CPU memory. More...
 
virtual void updateBoundingBox ()
 Update the local-space bounding sphere for this mesh shape. More...
 
virtual void getRenderables (const shapes::RenderRequest &request, const Transform3 &worldTransform, shapes::RenderQueue &outputQueue) const
 Process the renderable and add all child renderable objects to the output render queue. More...
 
virtual void intersectRay (GraphicsRay &ray) const
 Trace a ray against this shape and compute the closest intersection. More...
 
virtual void testRay (GraphicsRay &ray) const
 Trace a ray against this shape and determine if any intersection exist along the ray. More...
 
Bool getVertices (ArrayList< Vector3 > &vertices) const
 Get the vertex positions in this mesh shape and add them to the end of the specified list. More...
 
Bool getTriangles (ArrayList< Triangle3 > &triangles) const
 Get the triangles in this mesh shape and add them to the end of the specified list. More...
 
- Public Member Functions inherited from om::graphics::shapes::GraphicsShape
ShapeTypeID getShapeTypeID () const
 Return an integer identifying the sub type of this shape. More...
 
const ShapeTypegetShapeType () const
 Return a reference to an object representing the type of this Shape. More...
 
Sphere3 getBoundingSphere () const
 Return a bounding sphere for this transformable in its parent coordinate space. More...
 
const AABB3getBoundingBox () const
 Return an axis-aligned bounding box that encompases this entire transformable in its parent 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 ShapeType TYPE
 A shape type object that represents the type to use for a mesh shape. More...
 
- Static Public Attributes inherited from om::graphics::shapes::GraphicsShape
static const ResourceType RESOURCE_TYPE
 The resource type for a graphics shape. More...
 

Additional Inherited Members

- Protected Member Functions inherited from om::graphics::shapes::GraphicsShape
 GraphicsShape (const ShapeType *newType)
 Create a new shape with the specified type. More...
 
void setBoundingBox (const AABB3 &newBoundingBox)
 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::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 represents a renderable mesh.

Constructor & Destructor Documentation

om::graphics::shapes::MeshShape::MeshShape ( )

Create a new mesh shape with no mesh groups or geometry.

om::graphics::shapes::MeshShape::MeshShape ( MeshGroup newGroup)

Create a new mesh shape with the specified mesh group.

om::graphics::shapes::MeshShape::MeshShape ( const MeshShape other)

Create a copy of the specified mesh shape with the same groups as the original.

om::graphics::shapes::MeshShape::~MeshShape ( )

Destroy a mesh shape and release its internal resources.

Member Function Documentation

MeshShape& om::graphics::shapes::MeshShape::operator= ( const MeshShape other)

Assign the state of another mesh shape to this one.

Size om::graphics::shapes::MeshShape::getGroupCount ( ) const
inline

Return the total number of mesh groups that are a part of this mesh shape.

MeshGroup* om::graphics::shapes::MeshShape::getGroup ( Index  groupIndex) const
inline

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

Bool om::graphics::shapes::MeshShape::setGroup ( Index  groupIndex,
MeshGroup group 
)
inline

Set a pointer to the mesh group for this mesh shape at the specified index.

Bool om::graphics::shapes::MeshShape::addGroup ( MeshGroup newGroup)

Add a new mesh group to this mesh shape.

The method returns whether or not the group was successfully added.

void om::graphics::shapes::MeshShape::removeGroup ( Index  groupIndex)

Remove the mesh group from this mesh at the specified index.

If an out-of-bounds index is given, the method call is ignored.

Calling this method causes the shape's bounding sphere to be updated.

void om::graphics::shapes::MeshShape::clearGroups ( )

Remove all mesh groups and geometry from this mesh shape.

Calling this method causes the shape's bounding sphere to be updated.

Skeleton* om::graphics::shapes::MeshShape::getSkeleton ( ) const
inline

Return a pointer to the skeleton for this mesh shape, or NULL if it doesn't have one.

void om::graphics::shapes::MeshShape::setSkeleton ( Skeleton newSkeleton)
inline

Set the skeleton that is used to pose this mesh shape.

virtual void om::graphics::shapes::MeshShape::setContext ( devices::GraphicsContext newContext)
virtual

Set the graphics context that is used to render this mesh shape.

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

virtual void om::graphics::shapes::MeshShape::upload ( UploadRequest request)
virtual

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

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

virtual void om::graphics::shapes::MeshShape::download ( DownloadRequest request)
virtual

Download the mesh shape's GPU representation to CPU memory.

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

virtual void om::graphics::shapes::MeshShape::updateBoundingBox ( )
virtual

Update the local-space bounding sphere for this mesh shape.

This method is automatically called whenever a mesh shape is first created and anytime the mesh groups of the shape are changed. It is declared publicly so that a user can make sure that the bounding box matches the geometry (which might be shared and could changed without notice).

Reimplemented from om::graphics::shapes::GraphicsShape.

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

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

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

virtual void om::graphics::shapes::MeshShape::intersectRay ( GraphicsRay ray) const
virtual

Trace a ray against this shape and compute the closest intersection.

Reimplemented from om::graphics::shapes::GraphicsShape.

virtual void om::graphics::shapes::MeshShape::testRay ( GraphicsRay ray) const
virtual

Trace a ray against this shape and determine if any intersection exist along the ray.

Reimplemented from om::graphics::shapes::GraphicsShape.

Bool om::graphics::shapes::MeshShape::getVertices ( ArrayList< Vector3 > &  vertices) const

Get the vertex positions in this mesh shape and add them to the end of the specified list.

The method returns whether or not the vertices were able to be accessed successfully. If there are no vertex positions that are part of this shape, the size of the list does not change.

This method is provided so that a mesh's data can be easily accessed for use in external applications that need the raw mesh data.

Bool om::graphics::shapes::MeshShape::getTriangles ( ArrayList< Triangle3 > &  triangles) const

Get the triangles in this mesh shape and add them to the end of the specified list.

The method returns whether or not the triangles were able to be accessed successfully. If there are no triangles or quads that are part of this shape, the size of the list does not change.

Quads are converted to triangles by this method. This method is provided so that a mesh can be easily converted to triangles for use in external applications that need the raw mesh data.

Member Data Documentation

const ShapeType om::graphics::shapes::MeshShape::TYPE
static

A shape type object that represents the type to use for a mesh shape.


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