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

SYNOPSIS


#include <Inventor/nodes/SoLOD.h>

Inherits SoGroup.

Public Member Functions


virtual SoType getTypeId (void) const

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

Destructor.

Member Function Documentation

SoType SoLOD::getClassTypeId (void) [static]

This static method returns the SoType object associated with objects of this class.

Reimplemented from SoGroup.

SoType SoLOD::getTypeId (void) const [virtual]

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 SoFieldData ** SoLOD::getFieldDataPtr (void) [static], [protected]

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.

Reimplemented from SoGroup.

const SoFieldData * SoLOD::getFieldData (void) const [protected], [virtual]

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::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.

void SoLOD::audioRender (SoAudioRenderAction *action) [virtual]

Action method for SoAudioRenderAction.

Does common processing for SoAudioRenderAction action instances.

Reimplemented from SoGroup.

void SoLOD::notify (SoNotList *l) [virtual]

Notifies all auditors for this instance when changes are made.

Reimplemented from SoNode.

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.

Author

Generated automatically by Doxygen for Coin from the source code.