Om
1.0.0
A universal framework for multimedia simulation
|
A class that provides a simple means to draw an infinite 3D cartesian grid. More...
#include <omGraphicsGridShape.h>
Public Member Functions | |
GridShape () | |
Create an infinite grid shape for the given graphics context. More... | |
GridShape (const AABB3 &newBounds) | |
Create a grid shape for the given graphics context which covers the specified 3D region in local space. More... | |
const AABB3 & | getBounds () const |
Return the 3D region of this grid in its local coordinate frame. More... | |
void | setBounds (const AABB3 &newBounds) |
Set the 3D region of this grid in its local coordinate frame. More... | |
void | setBoundsInfinite () |
Set the 3D region of this grid to be infinitely large, e.g. covering the entire world space. More... | |
Real | getMajorSpacing () const |
Return the spacing between major grid lines in the shape's local coordinate system. More... | |
void | setMajorSpacing (Real newMajorSpacing) |
Set the spacing between major grid lines in the shape's local coordinate system. More... | |
Real | getMinorSpacing () const |
Return the spacing between minor grid lines in the shape's local coordinate system. More... | |
void | setMinorSpacing (Real newMinorSpacing) |
Set the spacing between major grid lines in the shape's local coordinate system. More... | |
const Color4f & | getMajorColor () const |
Return the color to use when drawing major grid lines. More... | |
void | setMajorColor (const Color4f &newMajorColor) |
Set the color to use when drawing major grid lines. More... | |
const Color4f & | getMinorColor () const |
Return the color to use when drawing minor grid lines. More... | |
void | setMinorColor (const Color4f &newMinorColor) |
Set the color to use when drawing minor grid lines. More... | |
Real | getMajorWidth () const |
Return the width in pixels to use when drawing major grid lines. More... | |
void | setMajorWidth (Real newMajorWidth) |
Set the width in pixels to use when drawing major grid lines. More... | |
Real | getMinorWidth () const |
Return the width in pixels to use when drawing minor grid lines. More... | |
void | setMinorWidth (Real newMinorWidth) |
Set the width in pixels to use when drawing minor grid lines. More... | |
virtual void | setContext (devices::GraphicsContext *newContext) |
Change the graphics context that is used to create this grid shape. More... | |
virtual void | upload (UploadRequest &request) |
Upload this sphere shape's current CPU representation to the GPU device. More... | |
virtual void | download (DownloadRequest &request) |
Download the sphere shape's GPU representation to CPU memory. More... | |
virtual void | updateBoundingBox () |
Update the box's axis-aligned bounding box. 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::shapes::GraphicsShape | |
ShapeTypeID | getShapeTypeID () const |
Return an integer identifying the sub type of this shape. More... | |
const ShapeType & | getShapeType () 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 AABB3 & | getBoundingBox () const |
Return an axis-aligned bounding box that encompases this entire transformable in its parent coordinate space. 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... | |
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 ShapeType | TYPE |
A shape type object that represents the type to use for a grid 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 | |
GraphicsContext * | context |
A pointer to the graphics context this object is using. More... | |
A class that provides a simple means to draw an infinite 3D cartesian grid.
The grid is by default infinite (to the edge of the view), but can also be limited to a 3D rectangular region.
This class handles all vertex and index buffer generation automatically, simplifying the visualization of grids. The grid is automatically resized so that it encompasses the entire view volume, but not much further.
om::graphics::shapes::GridShape::GridShape | ( | ) |
Create an infinite grid shape for the given graphics context.
om::graphics::shapes::GridShape::GridShape | ( | const AABB3 & | newBounds | ) |
Create a grid shape for the given graphics context which covers the specified 3D region in local space.
|
inline |
Return the 3D region of this grid in its local coordinate frame.
|
inline |
Set the 3D region of this grid in its local coordinate frame.
|
inline |
Set the 3D region of this grid to be infinitely large, e.g. covering the entire world space.
|
inline |
Return the spacing between major grid lines in the shape's local coordinate system.
|
inline |
Set the spacing between major grid lines in the shape's local coordinate system.
The new grid line spacing is clamped to be greater than or equal to 0.
|
inline |
Return the spacing between minor grid lines in the shape's local coordinate system.
|
inline |
Set the spacing between major grid lines in the shape's local coordinate system.
The new grid line spacing is clamped to be greater than or equal to 0.
|
inline |
Return the color to use when drawing major grid lines.
void om::graphics::shapes::GridShape::setMajorColor | ( | const Color4f & | newMajorColor | ) |
Set the color to use when drawing major grid lines.
|
inline |
Return the color to use when drawing minor grid lines.
void om::graphics::shapes::GridShape::setMinorColor | ( | const Color4f & | newMinorColor | ) |
Set the color to use when drawing minor grid lines.
|
inline |
Return the width in pixels to use when drawing major grid lines.
void om::graphics::shapes::GridShape::setMajorWidth | ( | Real | newMajorWidth | ) |
Set the width in pixels to use when drawing major grid lines.
The new line width is clamped to be at least 1 pixel.
|
inline |
Return the width in pixels to use when drawing minor grid lines.
void om::graphics::shapes::GridShape::setMinorWidth | ( | Real | newMinorWidth | ) |
Set the width in pixels to use when drawing minor grid lines.
The new line width is clamped to be at least 1 pixel.
|
virtual |
Change the graphics context that is used to create this grid shape.
Calling this method causes the previously generated grid geometry to be discarded and regenerated using the new context.
Reimplemented from om::graphics::devices::GraphicsContextObject.
|
virtual |
Upload this sphere shape's current CPU representation to the GPU device.
Reimplemented from om::graphics::devices::GraphicsContextObject.
|
virtual |
Download the sphere shape's GPU representation to CPU memory.
Reimplemented from om::graphics::devices::GraphicsContextObject.
|
virtual |
Update the box's axis-aligned bounding box.
Reimplemented from om::graphics::shapes::GraphicsShape.
|
virtual |
Process the renderable and add all child renderable objects to the output render queue.
Implements om::graphics::base::Renderable.
|
static |
A shape type object that represents the type to use for a grid shape.