H3D API  2.4.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
H3D::LOD Class Reference

The LOD node specifies various levels of detail or complexity for a given object, and provides hints allowing browsers to automatically choose the appropriate version of the object based on the distance from the user. More...

#include <H3D/LOD.h>

Inheritance diagram for H3D::LOD:
Inheritance graph

Public Member Functions

 LOD (Inst< AddChildren > _addChildren=0, Inst< RemoveChildren > _removeChildren=0, Inst< MFChild > _children=0, Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< SFInt32 > _level_changed=0, Inst< SFVec3f > _bboxCenter=0, Inst< SFVec3f > _bboxSize=0, Inst< SFVec3f > _center=0, Inst< SFBool > _forceTransitions=0, Inst< MFFloat > _range=0)
 Constructor.
 
virtual void render ()
 Render the children.
 
virtual void traverseSG (TraverseInfo &ti)
 Traverse the scenegraph. More...
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and a Node. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on Node to p. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the Node. More...
 
- Public Member Functions inherited from H3D::MatrixTransform
 MatrixTransform (Inst< AddChildren > _addChildren=0, Inst< RemoveChildren > _removeChildren=0, Inst< MFChild > _children=0, Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< SFVec3f > _bboxCenter=0, Inst< SFVec3f > _bboxSize=0, Inst< SFTransformedBound > _transformedBound=0, Inst< SFMatrix4f > _matrix=0, Inst< SFMatrix4f > _accumulatedForward=0, Inst< SFMatrix4f > _accumulatedInverse=0)
 Constructor.
 
void multiplyGLMatrix ()
 Multiply the currently active OpenGL matrix with the matrix of this node.
 
- Public Member Functions inherited from H3D::X3DGroupingNode
 X3DGroupingNode (Inst< AddChildren > _addChildren=0, Inst< RemoveChildren > _removeChildren=0, Inst< MFChild > _children=0, Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< SFVec3f > _bboxCenter=0, Inst< SFVec3f > _bboxSize=0)
 Constructor.
 
virtual ~X3DGroupingNode ()
 Destructor.
 
virtual void initialize ()
 Sets up the bound field using the bboxCenter and bboxSize fields. More...
 
- Public Member Functions inherited from H3D::X3DChildNode
 X3DChildNode (Inst< SFNode > _metadata=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DNode
 X3DNode (Inst< SFNode > _metadata=0)
 Constructor.
 
X3DMetadataObjectgetMetadataByName (const string &_name)
 Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL)
 Returns a new instance of this node type with the same state as this one. More...
 
virtual ~Node ()
 Destructor.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More...
 
void setProtoInstanceParent (X3DPrototypeInstance *p)
 Set the X3DPrototypeInstance this node is the the root node if applicaple.
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
virtual FieldgetField (const string &_name) const
 return a pointer to the field specified by name within this instance
 
int addDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
int removeDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
- Public Member Functions inherited from H3D::H3DBoundedObject
 H3DBoundedObject (Inst< SFBound > _bound=0)
 Constructor.
 
- Public Member Functions inherited from H3D::H3DDisplayListObject
 H3DDisplayListObject (Inst< DisplayList > _displayList=0)
 Constructor.
 

Public Attributes

H3DUniquePtr< SFInt32level_changed
 The LOD node generates a level_changed event with value i where the value of i identifies which level was activated for display. More...
 
H3DUniquePtr< SFInt32display_index
 This field is only accessible in C++.
 
H3DUniquePtr< SFVec3fcenter
 The center field is a translation offset in the local coordinate system that specifies the centre of the LOD node for distance calculations. More...
 
H3DUniquePtr< SFBoolforceTransitions
 The forceTransitions field specifies whether browsers are allowed to disregard level distances in order to provide better performance. More...
 
H3DUniquePtr< MFFloatrange
 The range field specifies the ideal distances at which to switch between the levels. More...
 
- Public Attributes inherited from H3D::MatrixTransform
H3DUniquePtr< SFMatrix4fmatrix
 The transformation matrix. More...
 
H3DUniquePtr< SFMatrix4faccumulatedForward
 The accumulated forward transform matrix, i.e. More...
 
H3DUniquePtr< SFMatrix4faccumulatedInverse
 The accumulated inverse transform matrix, i.e. More...
 
H3DUniquePtr< SFTransformedBoundtransformedBound
 This is the same as the bound field, but with the transformation applied to the bound. More...
 
- Public Attributes inherited from H3D::X3DGroupingNode
bool use_union_bound
 if true a route will be set up between the bound field of the nodes in children and the bound field of the grouping node. More...
 
H3DUniquePtr< AddChildrenaddChildren
 The addChildren event appends nodes to the children field of a grouping node. More...
 
H3DUniquePtr< RemoveChildrenremoveChildren
 The removeChildren event removes nodes from the children field of the grouping node . More...
 
H3DUniquePtr< MFChildchildren
 The nodes that are grouped together by this node. More...
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about the node. More...
 
- Public Attributes inherited from H3D::X3DBoundedObject
H3DUniquePtr< SFVec3fbboxCenter
 Specifies a the center of an axis-aligned bounding box enclosing the node. More...
 
H3DUniquePtr< SFVec3fbboxSize
 Specifies a the size of an axis-aligned bounding box enclosing the node. More...
 
- Public Attributes inherited from H3D::H3DBoundedObject
H3DUniquePtr< SFBoundbound
 The field containing the bound object. More...
 
- Public Attributes inherited from H3D::H3DDisplayListObject
H3DUniquePtr< DisplayListdisplayList
 The DisplayList instance handling the OpenGL caching of this object.
 

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::MatrixTransform
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DGroupingNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 

Additional Inherited Members

- Public Types inherited from H3D::Node
typedef std::map< Node *, Node * > DeepCopyMap
 A map type used during a deep copy clone() to map from original nodes to cloned nodes.
 
- Static Public Member Functions inherited from H3D::Node
static unsigned int nrNodesAlive ()
 Returns the nr of nodes currently alive, i.e. nodes created but not destructed.
 
static int nrNodesCreated ()
 Returns the number of nodes created in total since the start of the program.
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 
- Protected Attributes inherited from H3D::X3DGroupingNode
bool children_multi_pass_transparency
 Will be set in traverseSG to indicate if any of the children enables multi-pass transparency. More...
 
vector< H3DRenderStateObject * > render_states
 A vector of all the H3DRenderStatesObject within this X3DGroupingNode.
 
vector< ClipPlane * > clip_planes
 A vector of only ClipPlane children of this X3DGroupingNode.
 

Detailed Description

The LOD node specifies various levels of detail or complexity for a given object, and provides hints allowing browsers to automatically choose the appropriate version of the object based on the distance from the user.

The children field contains a list of nodes that represent the same object or objects at varying levels of detail, ordered from highest level of detail to the lowest level of detail.

The range field specifies the ideal distances at which to switch between the levels. The forceTransitions field specifies whether browsers are allowed to disregard level distances in order to provide better performance. A forceTransitions value of TRUE specifies that every transition should be performed regardless of any internal optimizations that might be available. A forceTransitions value of FALSE specifies that browsers are allowed to disregard level distances in order to provide better performance.

The center field is a translation offset in the local coordinate system that specifies the centre of the LOD node for distance calculations.

The number of nodes in the children field shall exceed the number of values in the range field by one (i.e., N+1 children nodes for N range values). The range field contains monotonic increasing values that shall be greater than zero. In order to calculate which level to display, first the distance is calculated from the viewer's location, transformed into the local coordinate system of the LOD node (including any scaling transformations), to the center point of the LOD node. Then, the LOD node evaluates the step function L(d) to choose a level for a given value of d (where d is the distance from the viewer position to the centre of the LOD node).

Examples:

Member Function Documentation

◆ closestPoint()

void LOD::closestPoint ( const Vec3f &  p,
NodeIntersectResult result 
)
virtual

Find closest point on Node to p.

Calls closestPoint for the same child as the one that should be rendered.

Parameters
pThe point to find the closest point to.
resultA struct containing various results of closest points such as which geometries the closest points where detected on.

Reimplemented from H3D::MatrixTransform.

References H3D::X3DGroupingNode::children, H3D::Node::closestPoint(), and display_index.

◆ lineIntersect()

bool LOD::lineIntersect ( const Vec3f &  from,
const Vec3f &  to,
LineIntersectResult result 
)
virtual

Detect intersection between a line segment and a Node.

Calls lineIntersect for the same child as the one that should be rendered.

Parameters
fromThe start of the line segment.
toThe end of the line segment.
resultContains info about the closest intersection for every object that intersects the line.
Returns
true if intersected, false otherwise.

Reimplemented from H3D::MatrixTransform.

References H3D::X3DGroupingNode::children, display_index, and H3D::Node::lineIntersect().

◆ movingSphereIntersect()

bool LOD::movingSphereIntersect ( H3DFloat  radius,
const Vec3f &  from,
const Vec3f &  to,
NodeIntersectResult result 
)
virtual

Detect collision between a moving sphere and the Node.

Calls movingSphereIntersect for the same child as the one that should be rendered.

Parameters
radiusThe radius of the sphere
fromThe start position of the sphere
toThe end position of the sphere.
resultA struct containing various results of intersections such as which geometries intersected the moving sphere.
Returns
true if intersected, false otherwise.

Reimplemented from H3D::MatrixTransform.

References H3D::X3DGroupingNode::children, display_index, and H3D::Node::movingSphereIntersect().

◆ traverseSG()

void LOD::traverseSG ( TraverseInfo ti)
virtual

Traverse the scenegraph.

Calculates distance to viewer and decides which level in the LOD should be used for rendering.

Parameters
tiThe TraverseInfo object containing information about the traversal.

Reimplemented from H3D::MatrixTransform.

References H3D::X3DViewpointNode::accForwardMatrix, center, H3D::X3DGroupingNode::children, display_index, forceTransitions, H3D::TraverseInfo::getAccInverseMatrix(), H3D::X3DViewpointNode::getActive(), length(), range, and H3D::X3DViewpointNode::totalPosition.

Member Data Documentation

◆ center

H3DUniquePtr< SFVec3f > H3D::LOD::center

The center field is a translation offset in the local coordinate system that specifies the centre of the LOD node for distance calculations.

Default value: 0 0 0
Access type: inputOutput

Referenced by traverseSG().

◆ forceTransitions

H3DUniquePtr< SFBool > H3D::LOD::forceTransitions

The forceTransitions field specifies whether browsers are allowed to disregard level distances in order to provide better performance.

Default value: false
Access type: inputOutput

Referenced by LOD(), and traverseSG().

◆ level_changed

H3DUniquePtr< SFInt32 > H3D::LOD::level_changed

The LOD node generates a level_changed event with value i where the value of i identifies which level was activated for display.

Access type: outputOnly
Default value: SFInt32 = 0

◆ range

H3DUniquePtr< MFFloat > H3D::LOD::range

The range field specifies the ideal distances at which to switch between the levels.

Each value in the range field shall be greater than the previous value.

Access type: inputOutput

Referenced by traverseSG().


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