SYNOPSIS

#include <Inventor/nodes/SoLOD.h>

Inherits SoGroup.

Public Member Functions

virtual SoType getTypeId (void) const

Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and 'downward' casting. 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)

virtual void audioRender (SoAudioRenderAction *action)

virtual void notify (SoNotList *nl)

Static Public Member Functions

static SoType getClassTypeId (void)

static void initClass (void)

Public Attributes

SoMFFloat range

SoSFVec3f center

Protected Member Functions

virtual const SoFieldData * getFieldData (void) const

virtual ~SoLOD ()

virtual int whichToTraverse (SoAction *)

Static Protected Member Functions

static const SoFieldData ** getFieldDataPtr (void)

Additional Inherited Members

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 viewpoint 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).

Note that when using an SoOrthographicCamera in the examiner viewers of the SoQt, SoWin and SoXt libraries, it will seem like the SoLOD node is not working when using the 'Zoom' functionality. What happens is that an SoOrthographicCamera is not actually moved, the 'zoom' effect is accomplished simply by changing its height-of-view setting (i.e. the value of the SoOrthographicCamera::height field), but its position remains constant. So the distance to the camera will not change, which means SoLOD will pick the same child, no matter how much one 'zooms'.

(The SoLevelOfDetail node uses the screen space area of the object to decide when to switch children, so that node will still work with SoOrthographicCamera.)

FILE FORMAT/DEFAULTS:

LOD {
    center 0 0 0
    range [  ]
}

Since:

Inventor 2.1

See also:

SoLevelOfDetail

Constructor & Destructor Documentation

SoLOD::SoLOD (void)

Default constructor.

SoLOD::SoLOD (intnumchildren)

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 ()\fC [protected]\fP, \fC [virtual]\fP

Destructor.

Member Function Documentation

\fBSoType\fP SoLOD::getTypeId (void) const\fC [virtual]\fP

Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and 'downward' casting. Usage example:

void foo(SoNode * node)
{
  if (node->getTypeId() == SoFile::getClassTypeId()) {
    SoFile * filenode = (SoFile *)node;  // safe downward cast, knows the type
  }
}

For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance Inventor/nodes/SoSubNode.h (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine.h (for engine classes) and so on.

For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups.

Reimplemented from SoGroup.

const \fBSoFieldData\fP * SoLOD::getFieldData (void) const\fC [protected]\fP, \fC [virtual]\fP

Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL.

Reimplemented from SoGroup.

void SoLOD::doAction (\fBSoAction\fP *action)\fC [virtual]\fP

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

Reimplemented from SoGroup.

void SoLOD::callback (\fBSoCallbackAction\fP *action)\fC [virtual]\fP

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 (\fBSoGLRenderAction\fP *action)\fC [virtual]\fP

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 (\fBSoGLRenderAction\fP *action)\fC [virtual]\fP

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

Reimplemented from SoNode.

void SoLOD::GLRenderInPath (\fBSoGLRenderAction\fP *action)\fC [virtual]\fP

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

Reimplemented from SoNode.

void SoLOD::GLRenderOffPath (\fBSoGLRenderAction\fP *action)\fC [virtual]\fP

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

Reimplemented from SoNode.

void SoLOD::rayPick (\fBSoRayPickAction\fP *action)\fC [virtual]\fP

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 (\fBSoGetBoundingBoxAction\fP *action)\fC [virtual]\fP

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 (\fBSoGetPrimitiveCountAction\fP *action)\fC [virtual]\fP

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.

void SoLOD::audioRender (\fBSoAudioRenderAction\fP *action)\fC [virtual]\fP

Action method for SoAudioRenderAction.

Does common processing for SoAudioRenderAction action instances.

Reimplemented from SoGroup.

void SoLOD::notify (\fBSoNotList\fP *l)\fC [virtual]\fP

Notifies all auditors for this instance when changes are made.

Reimplemented from SoNode.

int SoLOD::whichToTraverse (\fBSoAction\fP *action)\fC [protected]\fP, \fC [virtual]\fP

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

\fBSoMFFloat\fP 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.

\fBSoSFVec3f\fP 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.

Author

Generated automatically by Doxygen for Coin from the source code.