Distance-based level-of-detail switching group node. More...
#include <Inventor/VRMLnodes/SoVRMLLOD.h>
Public Member Functions | |
virtual SoType | getTypeId () const |
SoVRMLLOD () | |
SoVRMLLOD (int nLevels) | |
virtual SbBool | affectsState () const |
void | addLevel (SoNode *level1) |
void | insertLevel (SoNode *level1, int newLevelIndex) |
SoNode * | getLevel (int index) const |
int | findLevel (const SoNode *level1) const |
int | getNumLevels () const |
void | removeLevel (int index) |
void | removeLevel (SoNode *level1) |
void | removeAllLevels () |
void | replaceLevel (int index, SoNode *newLevel) |
void | replaceLevel (SoNode *oldLevel, SoNode *newLevel) |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Public Attributes | |
SoMFFloat | range |
SoSFVec3f | center |
SoMFNode | level |
The SoVRMLLOD node allows applications to switch between various levels of detail or complexity for a given object, based on the distance from the user.
NOTE: This class does not exist in Open Inventor 10.0 and later. NOTE: This node contains three fields inherited from SoVRMLParent that are new in Open Inventor 5.0. These fields are children (replaces the level field for X3D), bboxCenter, and bboxSize. If you specify a non-default value for this field, when this node is written to an Inventor file, the file will contain this new field. Older versions of Open Inventor will not be able to read this file and will generate an Inventor read error (unknown field).
NOTE 2: This field is not compatible with VRML97. If you specify a non-default value for this field, when this node is written to a VRML file, the file will contain this incompatible field and standard VRML97 file readers will not be able to read it.
The level field contains a list of nodes that represent the same object or objects at varying levels of detail, from highest to the lowest level of detail, and the range field specifies the ideal distances at which to switch between the levels.
The center field is a translation offset in the local coordinate system that specifies the center of the SoVRMLLOD object for distance calculations. In order to calculate which level to display, first the distance is calculated from the viewpoint, transformed into the local coordinate space of the SoVRMLLOD node, (including any scaling transformations), to the center point of the SoVRMLLOD. If the distance is less than the first value in the range field, then the first level of the SoVRMLLOD is drawn. If between the first and second values in the range field, the second level is drawn, and so on.
If there are N values in the range field, the SoVRMLLOD must have N+1 nodes in its level field. Specifying too few levels will result in the last level being used repeatedly for the lowest levels of detail; if more levels than ranges are specified, the extra levels will be ignored. The exception to this rule is to leave the range field empty, which is a hint to the browser that it should choose a level automatically to maintain a constant display rate. Each value in the range field should be greater than the previous value; otherwise results are undefined.
Note that the selection of which child to render depends on the current camera settings, so generally this node should not be render cached. SoVRMLLOD nodes prohibit auto-caching, so that no SoSeparator (or other render caching node) above an SoVRMLLOD in the scene graph will automatically create a render cache. This can significantly affect performance and applications should try to keep nodes that can be render cached (especially geometry nodes) under a different SoSeparator.
This section may reference portions of the VRML97 specification that are not present in this help file. The complete VRML97 spec is available at http://www.web3d.org .
The SoVRMLLOD node specifies various levels of detail or complexity for a given object, and provides hints for browsers to automatically choose the appropriate version of the object based on the distance from the user. The level field contains a list of nodes that represent the same object or objects at varying levels of detail, from highest to the lowest level of detail, and the range field specifies the ideal distances at which to switch between the levels. See the "Concepts - Grouping and Children Nodes" section for a details on the types of nodes that are legal values for level.
The center field is a translation offset in the local coordinate system that specifies the center of the SoVRMLLOD object for distance calculations. In order to calculate which level to display, first the distance is calculated from the viewpoint, transformed into the local coordinate space of the SoVRMLLOD node, (including any scaling transformations), to the center point of the SoVRMLLOD. If the distance is less than the first value in the range field, then the first level of the SoVRMLLOD is drawn. If between the first and second values in the range field, the second level is drawn, and so on.
If there are N values in the range field, the SoVRMLLOD must have N+1 nodes in its level field. Specifying too few levels will result in the last level being used repeatedly for the lowest levels of detail; if more levels than ranges are specified, the extra levels will be ignored. The exception to this rule is to leave the range field empty, which is a hint to the browser that it should choose a level automatically to maintain a constant display rate. Each value in the range field should be greater than the previous value; otherwise results are undefined.
Authors should set SoVRMLLOD ranges so that the transitions from one level of detail to the next are smooth. Browsers may adjust which level of detail is displayed to maintain interactive frame rates, to display an already-fetched level of detail while a higher level of detail (contained in an Inline node) is fetched, or might disregard the author-specified ranges for any other implementation-dependent reason. For best results, specify ranges only where necessary, and nest SoVRMLLOD nodes with and without ranges. Browsers should try to honor the hints given by authors, and authors should try to give browsers as much freedom as they can to choose levels of detail based on performance.
SoVRMLLOD nodes are evaluated top-down in the scene graph. Only the descendants of the currently selected level are rendered and evaluated. Note that all nodes under an SoVRMLLOD node continue to receive and send events regardless of which SoVRMLLOD level is active.
level | [] // VRML97 only |
children | [] // X3D only |
center | 0 0 0 |
range | [] |
bboxCenter | 0 0 0 |
bboxSize | -1 -1 -1 |
metadata | NULL |
SoMFNode | set_level // VRML97 only |
SoMFNode | set_children // X3D only |
SoSFNode | set_metadata |
SoMFNode | level_changed // VRML97 only |
SoMFNode | children_changed // X3D only |
SoSFNode | metadata_changed |
SoVRMLLOD::SoVRMLLOD | ( | ) |
Constructor.
SoVRMLLOD::SoVRMLLOD | ( | int | nLevels | ) |
Constructor that takes approximate number of levels/children.
void SoVRMLLOD::addLevel | ( | SoNode * | level1 | ) |
Adds a level/child as last one in group.
virtual SbBool SoVRMLLOD::affectsState | ( | ) | const [virtual] |
Overrides default method on SoNode.
Reimplemented from SoVRMLParent.
int SoVRMLLOD::findLevel | ( | const SoNode * | level1 | ) | const |
Finds index of given level/child within group.
static SoType SoVRMLLOD::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoVRMLParent.
SoNode* SoVRMLLOD::getLevel | ( | int | index | ) | const |
Returns the nth level/child node.
int SoVRMLLOD::getNumLevels | ( | ) | const |
Returns number of levels/children.
virtual SoType SoVRMLLOD::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Reimplemented from SoVRMLParent.
void SoVRMLLOD::insertLevel | ( | SoNode * | level1, | |
int | newLevelIndex | |||
) |
Adds a level/child so that it becomes the one with the given index.
void SoVRMLLOD::removeAllLevels | ( | ) |
Removes all levels/children from group.
void SoVRMLLOD::removeLevel | ( | SoNode * | level1 | ) | [inline] |
Removes first instance of given level/child from group.
void SoVRMLLOD::removeLevel | ( | int | index | ) |
Removes level/child with given index from group.
Replaces first instance of given level/child with new level/child.
void SoVRMLLOD::replaceLevel | ( | int | index, | |
SoNode * | newLevel | |||
) |
Replaces level with given index with new level/child.
Translation offset in the local coordinate system that specifies the center of the SoVRMLLOD objects.
List of nodes that request the same object or objects at varying levels of detail from highest to lowest (VRML97).
In X3D, the list of nodes is specified using the children field (inherited from SoVRMLParent).
NOTE: The children field is a new field in SoVRMLLOD added in Open Inventor 5.0. If you specify a non-default value for this field, when this node is written to an Inventor file, the file will contain this new field. Older versions of Open Inventor will not be able to read this file and will generate an Inventor read error (unknown field).
NOTE 2: This field is not compatible with VRML97. If you specify a non-default value for this field, when this node is written to a VRML file, the file will contain this incompatible field and standard VRML97 file readers will not be able to read it.
Specifies the ideal distances at which to switch between the levels.