#include <LOD.h>
Inheritance diagram for nvsg::LOD:
Public Member Functions | |
virtual NVSG_API const LOD * | clone (void) const |
Get a clone of this LOD object. | |
NVSG_API void | setRanges (const float *ranges, size_t count) |
Set all range values. | |
NVSG_API const float * | getRanges (void) const |
Get all ranges. | |
NVSG_API size_t | getNumberOfRanges (void) const |
Get the number of ranges. | |
NVSG_API void | setCenter (const nvmath::Vec3f ¢er) |
Set the center. | |
NVSG_API const nvmath::Vec3f & | getCenter (void) const |
Determine the LOD to use. | |
NVSG_API size_t | getLODToUse (const nvmath::Mat44f &modelViewMatrix) const |
Static Public Member Functions | |
static NVSG_API const LOD * | create (void) |
Create a LOD. | |
static NVSG_API const LOD * | createFromBase (const Group &rhs) |
Create a LOD by copying from a Group. | |
Protected Member Functions | |
NVSG_API | LOD (void) |
Default Constructor. | |
NVSG_API | LOD (const Group &rhs) |
Partial Constructor. | |
NVSG_API | LOD (const LOD &rhs) |
Copy Constructor. | |
virtual NVSG_API | ~LOD (void) |
Prohibit explicit creation on stack by making the destructor protected. |
This class is a special kind of a group containing different representations of the same object as well as some range information. The representations include different levels of detail, meaning that the first child is the best and most precise representation of the object, the second child is of lower resolution, and so on. The current implementation determines the distance between the camera and the given center point of the object (dist). The distance is compared against the ranges and the corresponding range defines the LOD representation to use.
It works like this:
IF (dist < ranges[0]) THEN activeChild = 0 ELSE IF (ranges[i-1] < dist < ranges[i]) THEN activeChild = i ELSE IF (dist > ranges[LASTRANGE]) THEN activeChild = LASTRANGE+1
In some cases you do not want to draw something on the last (infinite) level. In this case simply add an empty Group node at the lowest resolution level. Same for the highest resolution level if you want geometry to disappear if it is too near to the camera.
|
Default Constructor.
|
|
Partial Constructor.
|
|
Copy Constructor.
|
|
Prohibit explicit creation on stack by making the destructor protected.
|
|
Create a LOD.
Reimplemented from nvsg::Group. |
|
Create a LOD by copying from a Group.
|
|
Get a clone of this
Reimplemented from nvsg::Group. |
|
Set all range values.
|
|
Get all ranges.
|
|
Get the number of ranges.
|
|
Set the center. The center is the point used for finding the exact level of detail by calculating its distance to the camera.
|
|
Determine the LOD to use.
|
|
This method is called by the ModelViewTraverser. It calculates the distance between the center point and the camera.
|