Om
1.0.0
A universal framework for multimedia simulation
|
A shape type that allows the user to render an object with a varying level of detail. More...
#include <omGraphicsLODShape.h>
Public Member Functions | |
LODShape () | |
Create an LOD shape with no levels of detail and an LOD bias of 1. More... | |
LODShape (GraphicsShape *newShape, Real newPixelRadius) | |
Create an LOD shape with the specified shape level of detail and an LOD bias of 1. More... | |
Size | getLevelCount () const |
Return the number of levels of detail that this shape has. More... | |
Bool | addLevel (GraphicsShape *newShape, Real newPixelRadius) |
Add a new level of detail shape that is used for the specified maximum on-screen pixel radius. More... | |
void | removeLevel (Index i) |
Remove the level of detail at the specified index in this LOD shape. More... | |
void | clearLevels () |
Clear all levels of detail from this shape. More... | |
GraphicsShape * | getLevelShape (Index i) const |
Return a pointer to the shape for the level of detail at the specified index. More... | |
Bool | setLevelShape (Index i, GraphicsShape *newShape) |
Set the shape for the level of detail at the specified index. More... | |
Real | getLevelPixelRadius (Index i) const |
Return the maximum pixel radius for the level of detail at the specified index. More... | |
void | setLevelPixelRadius (Index i, Real newMaximumPixelRadius) |
Get the maximum pixel radius for the level of detail at the specified index. More... | |
GraphicsShape * | getLevelForPixelRadius (Real pixelRadius) const |
Get the level of detail which should be used when the shape has the specified screen-space radius. More... | |
Real | getLODBias () const |
Return a value that is used to multiplicatively bias the size of a pixel radius query. More... | |
void | setLODBias (Real newLODBias) |
Set a value that is used to multiplicatively bias the size of a pixel radius query. More... | |
virtual void | setContext (devices::GraphicsContext *newContext) |
Set the graphics context that is used to render this LOD shape. More... | |
virtual void | upload (UploadRequest &request) |
Upload this LOD shape's current CPU representation to the GPU device. More... | |
virtual void | download (DownloadRequest &request) |
Download the LOD shape's GPU representation to CPU memory. More... | |
virtual void | updateBoundingBox () |
Update the level-of-detail shape'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... | |
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::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... | |
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 LOD 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 shape type that allows the user to render an object with a varying level of detail.
A level-of-detail shape specifies a sorted list of shapes that should be used to render an object at different effective screen-space sizes. This allows simplified representations to be used for distant objects and detailed representations for nearby objects. The projected screen-space radius (in pixels) of the shape's bounding sphere for a given camera is used to determine the level of detail to use.
The LODShape allows the user to bias the level-of-detail determination by a multiplying factor. This factor scales the screen-space radius used when determining the optimal level of detail. For instance, a factor of 2.0 will result in the shape being rendered with a level of detail suitable for double the actual screen space radius. This can be used to control the overall quality of rendering on a per-shape basis. For less powerful hardware, a factor less than 1 can be used to lower the rendering workload at the expense of some loss in visual quality.
om::graphics::shapes::LODShape::LODShape | ( | ) |
Create an LOD shape with no levels of detail and an LOD bias of 1.
om::graphics::shapes::LODShape::LODShape | ( | GraphicsShape * | newShape, |
Real | newPixelRadius | ||
) |
Create an LOD shape with the specified shape level of detail and an LOD bias of 1.
|
inline |
Return the number of levels of detail that this shape has.
Bool om::graphics::shapes::LODShape::addLevel | ( | GraphicsShape * | newShape, |
Real | newPixelRadius | ||
) |
Add a new level of detail shape that is used for the specified maximum on-screen pixel radius.
If the required on-screen pixel radius of the shape's bounding sphere is smaller than the specified value but larger than the next smallest level of detail, the given shape is used to render this LOD shape.
void om::graphics::shapes::LODShape::removeLevel | ( | Index | i | ) |
Remove the level of detail at the specified index in this LOD shape.
Levels are stored in reverse sorted order, with the largest level of detail first, index 0 corresponds to the largest level of detail.
void om::graphics::shapes::LODShape::clearLevels | ( | ) |
Clear all levels of detail from this shape.
|
inline |
Return a pointer to the shape for the level of detail at the specified index.
Levels are stored in reverse sorted order, with the largest level of detail first, index 0 corresponds to the largest level of detail.
|
inline |
Set the shape for the level of detail at the specified index.
Levels are stored in reverse sorted order, with the largest level of detail first, index 0 corresponds to the largest level of detail.
Return the maximum pixel radius for the level of detail at the specified index.
Levels are stored in reverse sorted order, with the largest level of detail first, index 0 corresponds to the largest level of detail.
Get the maximum pixel radius for the level of detail at the specified index.
Calling this method potentially reorders the level of details. Previously valid indices will not necessarily be valid after calling this method.
Levels are stored in reverse sorted order, with the largest level of detail first, index 0 corresponds to the largest level of detail.
GraphicsShape* om::graphics::shapes::LODShape::getLevelForPixelRadius | ( | Real | pixelRadius | ) | const |
Get the level of detail which should be used when the shape has the specified screen-space radius.
|
inline |
Return a value that is used to multiplicatively bias the size of a pixel radius query.
The default value is 1, indicating that no bias is applied. For instance, a bias of 0.5 means that any LOD query will be interpreted to have half the requested on-screen pixel radius.
|
inline |
Set a value that is used to multiplicatively bias the size of a pixel radius query.
The default value is 1, indicating that no bias is applied. For instance, a bias of 0.5 means that any LOD query will be interpreted to have half the requested on-screen pixel radius.
|
virtual |
Set the graphics context that is used to render this LOD shape.
Reimplemented from om::graphics::devices::GraphicsContextObject.
|
virtual |
Upload this LOD shape's current CPU representation to the GPU device.
Reimplemented from om::graphics::devices::GraphicsContextObject.
|
virtual |
Download the LOD shape's GPU representation to CPU memory.
Reimplemented from om::graphics::devices::GraphicsContextObject.
|
virtual |
Update the level-of-detail shape'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.
|
virtual |
Trace a ray against this shape and compute the closest intersection.
Reimplemented from om::graphics::shapes::GraphicsShape.
|
virtual |
Trace a ray against this shape and determine if any intersection exist along the ray.
Reimplemented from om::graphics::shapes::GraphicsShape.
|
static |
A shape type object that represents the type to use for a LOD shape.