Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SoLOD Class Reference

The SoLOD class is used to choose a child based distance between viewer and object. More...

#include <Inventor/nodes/SoLOD.h>

Inheritance diagram for SoLOD::

SoGroup SoNode SoFieldContainer SoBase List of all members.

Public Methods

 SoLOD (void)
 SoLOD (int numchildren)
virtual void doAction (SoAction *action)
virtual void callback (SoCallbackAction *action)
virtual void GLRender (SoGLRenderAction *action)
virtual void GLRenderBelowPath (SoGLRenderAction *action)
virtual void GLRenderInPath (SoGLRenderAction *action)
virtual void GLRenderOffPath (SoGLRenderAction *action)
virtual void rayPick (SoRayPickAction *action)
virtual void getBoundingBox (SoGetBoundingBoxAction *action)
virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action)

Static Public Methods

void initClass (void)

Public Attributes

SoMFFloat range
SoSFVec3f center

Protected Methods

virtual ~SoLOD ()
virtual int whichToTraverse (SoAction *)

Detailed Description

The SoLOD class is used to choose a child based distance between viewer and object.

The class documentation for the SoLOD node class would be similar enough to that of SoLevelOfDetail that we will refer you to look at that one first. It will explain the general principles of what a level-of-detail mechanism is, and why and how to use it.

(The main difference between SoLOD and SoLevelOfDetail is that SoLOD uses the speedier "distance-to-viewer" technique for implementing level-of-detail functionality, versus the more correct (but potentially slower) "projected-bbox-area" technique used by SoLevelOfDetail.)

Here's a mockup example (in Inventor file format style, but easily converted to code) that shows how to use this node:

LOD {
   range [ 10, 20, 30, 40 ]

   Sphere { }
   Cylinder { }
   Cone { }
   Cube { }
   Info { }
}

For the sub-scenegraph above, when the LOD-object is less than 10 units away from the viewer / camera, an SoSphere will be shown. For distances 10 - 20 units away, this will be changed to the SoCylinder, and so on. For distances of more than 40 units from the camera, an SoInfo node will be traversed / rendered -- ie, nothing will be shown. (This is a common "trick" used to optimize rendering when models get far enough away from the camera that we want to remove them completely).

See also:
SoLevelOfDetail


Constructor & Destructor Documentation

SoLOD::SoLOD void
 

Default constructor.

SoLOD::SoLOD int numchildren
 

Constructor.

The argument should be the approximate number of children which is expected to be inserted below this node. The number need not be exact, as it is only used as a hint for better memory resource allocation.

SoLOD::~SoLOD [protected, virtual]
 

Destructor.


Member Function Documentation

void SoLOD::initClass void [static]
 

Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.

Reimplemented from SoGroup.

void SoLOD::doAction SoAction * action [virtual]
 

This function performs the typical operation of a node for any action.

Reimplemented from SoGroup.

void SoLOD::callback SoCallbackAction * action [virtual]
 

Action method for SoCallbackAction.

Simply updates the state according to how the node behaves for the render action, so the application programmer can use the SoCallbackAction for extracting information about the scene graph.

Reimplemented from SoGroup.

void SoLOD::GLRender SoGLRenderAction * action [virtual]
 

Action method for the SoGLRenderAction.

This is called during rendering traversals. Nodes influencing the rendering state in any way or who wants to throw geometry primitives at OpenGL overrides this method.

Reimplemented from SoGroup.

void SoLOD::GLRenderBelowPath SoGLRenderAction * action [virtual]
 

Implements the SoAction::BELOW_PATH traversal method for the rendering action.

Reimplemented from SoNode.

void SoLOD::GLRenderInPath SoGLRenderAction * action [virtual]
 

Implements the SoAction::IN_PATH traversal method for the rendering action.

Reimplemented from SoNode.

void SoLOD::GLRenderOffPath SoGLRenderAction * action [virtual]
 

Implements the SoAction::OFF_PATH traversal method for the rendering action.

Reimplemented from SoNode.

void SoLOD::rayPick SoRayPickAction * action [virtual]
 

Action method for SoRayPickAction.

Checks the ray specification of the action and tests for intersection with the data of the node.

Nodes influencing relevant state variables for how picking is done also overrides this method.

Reimplemented from SoNode.

void SoLOD::getBoundingBox SoGetBoundingBoxAction * action [virtual]
 

Action method for the SoGetBoundingBoxAction.

Calculates bounding box and center coordinates for node and modifies the values of the action to encompass the bounding box for this node and to shift the center point for the scene more towards the one for this node.

Nodes influencing how geometry nodes calculates their bounding box also overrides this method to change the relevant state variables.

Reimplemented from SoGroup.

void SoLOD::getPrimitiveCount SoGetPrimitiveCountAction * action [virtual]
 

Action method for the SoGetPrimitiveCountAction.

Calculates the number of triangle, line segment and point primitives for the node and adds these to the counters of the action.

Nodes influencing how geometry nodes calculates their primitive count also overrides this method to change the relevant state variables.

Reimplemented from SoGroup.

int SoLOD::whichToTraverse SoAction * action [protected, virtual]
 

Returns the child to traverse based on the ranges in SoLOD::range. Will clamp to index to the number of children. This method will return -1 if no child should be traversed. This will only happen if the node has no children though.


Member Data Documentation

SoMFFloat SoLOD::range
 

The distance ranges which decides when to use each child for traversal / rendering. See usage example in main class documentation of SoLOD for an explanation of how this vector should be set up correctly.

By default this vector just contains a single value 0.0f.

SoSFVec3f SoLOD::center
 

This vector represents an offset within the object from the geometric center point to the center point the application programmer would actually like the distance between the viewer and the object to be calculated from.

Default value is [0, 0, 0]. It is usually not necessary to change this field.


The documentation for this class was generated from the following files:
Generated at Tue Mar 5 03:31:26 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001