SoLOD(3)

πŸ“¦ version 2.5.0, in fedora 43, fedora 44

SoLOD(3) πŸ’…βœ¨ the Library Functions Manual glow-up

okay so bestie, we are reading SoLOD(3) from the Library Functions Manual today, and honestly? it's a whole mood. buckle up, hydrate, and let's get into it πŸ’–


🌸 NAME 🌸

SoLOD β€” the SoLOD class is used to choose a child based distance between viewer and object.

not me reading "choose a child based distance between viewer and object" and immediately thinking it's picking a favourite sibling based on how far away you're standing 😭 like yes queen, proximity-based nepotism, we love to see it

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <Inventor/nodes/SoLOD.h>

Inherits SoGroup.

so it's a group, but a picky group. it's giving "I have children but I'm only showing you the one that matches the vibe check at this exact distance" ✨


πŸ‘‘ Public Member Functions πŸ‘‘

  • virtual SoType getTypeId (void) const β€” the classic "who even am I" check πŸ’…
  • SoLOD (void) β€” default constructor, no thoughts, head empty, zero children
  • SoLOD (int numchildren) β€” constructor that already knows how many children it's about to have, organised queen
  • virtual void doAction (SoAction *action) β€” the big one, runs the action
  • virtual void callback (SoCallbackAction *action) β€” callback action time
  • virtual void GLRender (SoGLRenderAction *action) β€” render it, slay
  • virtual void GLRenderBelowPath (SoGLRenderAction *action) β€” render below path πŸ”₯
  • virtual void GLRenderInPath (SoGLRenderAction *action) β€” render in path πŸ”₯
  • virtual void GLRenderOffPath (SoGLRenderAction *action) β€” render off path πŸ”₯
  • virtual void rayPick (SoRayPickAction *action) β€” ray picking, the "what did I just touch" mechanic
  • virtual void getBoundingBox (SoGetBoundingBoxAction *action) β€” bounding box, get in
  • virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action) β€” counting primitives like it's inventory day
  • virtual void audioRender (SoAudioRenderAction *action) β€” audio render, she's got range πŸŽ€
  • virtual void notify (SoNotList *nl) β€” notification central, the group chat ping

🧚 Public Member Functions inherited from SoGroup 🧚

  • SoGroup (void) β€” default group constructor
  • SoGroup (int nchildren) β€” group constructor that already knows the child count
  • virtual void addChild (SoNode *node) β€” adopt a node, bestie
  • virtual void insertChild (SoNode *child, int newchildindex) β€” slot it in at an exact index, precise
  • virtual SoNode * getChild (int index) const β€” grab a child by index
  • virtual int findChild (const SoNode *node) const β€” where's that child hiding
  • virtual int getNumChildren (void) const β€” headcount
  • virtual void removeChild (int childindex) β€” bye by index
  • virtual void removeChild (SoNode *child) β€” bye by pointer
  • virtual void removeAllChildren (void) β€” full clear-out, the unfollow-everyone moment 😌
  • virtual void replaceChild (int index, SoNode *newchild) β€” swap by index
  • virtual void replaceChild (SoNode *oldchild, SoNode *newchild) β€” swap by pointer
  • virtual void getMatrix (SoGetMatrixAction *action) β€” matrix moment
  • virtual void handleEvent (SoHandleEventAction *action) β€” handle the event, no cap
  • virtual void pick (SoPickAction *action) β€” picking, but the non-ray kind
  • virtual void search (SoSearchAction *action) β€” the search party
  • virtual void write (SoWriteAction *action) β€” write it out
  • virtual SoChildList * getChildren (void) const β€” hand over the whole child list

πŸ’œ Public Member Functions inherited from SoNode πŸ’œ

  • void setOverride (const SbBool state) β€” set that override flag
  • SbBool isOverride (void) const β€” are we overriding or not
  • void setNodeType (const NodeType type) β€” assign the node type
  • NodeType getNodeType (void) const β€” read the node type back
  • virtual SoNode * copy (SbBool copyconnections=0) const β€” copy the node, connections optional
  • virtual SbBool affectsState (void) const β€” does this thing touch state
  • virtual void grabEventsSetup (void) β€” set up event grabbing
  • virtual void grabEventsCleanup (void) β€” tear down event grabbing
  • virtual void startNotify (void) β€” kick off the notification chain
  • uint32_t getNodeId (void) const β€” the node's unique lil id number
  • virtual void writeInstance (SoOutput *out) β€” write this instance
  • virtual SoNode * addToCopyDict (void) const β€” toss it into the copy dictionary
  • virtual SoFieldContainer * copyThroughConnection (void) const β€” copy straight through the connection

πŸ“ Public Member Functions inherited from SoFieldContainer πŸ“

  • void setToDefaults (void) β€” factory reset the fields
  • SbBool hasDefaultValues (void) const β€” is everything still default
  • SbBool fieldsAreEqual (const SoFieldContainer *container) const β€” field comparison arc
  • void copyFieldValues (const SoFieldContainer *container, SbBool copyconnections=0) β€” copy fields over, connections optional
  • SbBool set (const char *const fielddata) β€” set from field data string
  • void get (SbString &fielddata) β€” get into a string
  • virtual int getFields (SoFieldList &l) const β€” collect the fields
  • virtual int getAllFields (SoFieldList &l) const β€” collect all the fields, overachiever
  • virtual SoField * getField (const SbName &name) const β€” field by name
  • virtual SoField * getEventIn (const SbName &name) const β€” event-in by name
  • virtual SoField * getEventOut (const SbName &name) const β€” event-out by name
  • SbBool getFieldName (const SoField *const field, SbName &name) const β€” reverse lookup, name for a field
  • SbBool enableNotify (const SbBool flag) β€” toggle notifications
  • SbBool isNotifyEnabled (void) const β€” are notifications on
  • SbBool set (const char *fielddata, SoInput *in) β€” set from field data with an SoInput
  • void get (SbString &fielddata, SoOutput *out) β€” get with an SoOutput
  • virtual SbBool validateNewFieldValue (SoField *field, void *newval) β€” validate a new value before it commits
  • virtual void addWriteReference (SoOutput *out, SbBool isfromfield=0) β€” register a write reference
  • SbBool getIsBuiltIn (void) const β€” built-in or not
  • void setUserData (void *userdata) const β€” stash your own user data
  • void * getUserData (void) const β€” get your own user data back

πŸŽ€ Public Member Functions inherited from SoBase πŸŽ€

  • void ref (void) const β€” refcount up
  • void unref (void) const β€” refcount down
  • void unrefNoDelete (void) const β€” unref but no delete, spicy
  • int32_t getRefCount (void) const β€” read the refcount
  • void touch (void) β€” touch it, make it announce itself
  • SbBool isOfType (SoType type) const β€” type check
  • virtual SbName getName (void) const β€” what's her name
  • virtual void setName (const SbName &newname) β€” rebrand
  • void addAuditor (void *const auditor, const SoNotRec::Type type) β€” add an auditor
  • void removeAuditor (void *const auditor, const SoNotRec::Type type) β€” remove an auditor
  • const SoAuditorList & getAuditors (void) const β€” get the whole auditor list
  • SbBool shouldWrite (void) β€” should this be written
  • void assertAlive (void) const β€” the "bestie are you still there" check

⭐ Static Public Member Functions ⭐

  • static SoType getClassTypeId (void) β€” class type id
  • static void initClass (void) β€” init the class

⭐ Static Public Member Functions inherited from SoGroup ⭐

  • static SoType getClassTypeId (void)
  • static void initClass (void)

⭐ Static Public Member Functions inherited from SoNode ⭐

  • static uint32_t getCompatibilityTypes (const SoType &nodetype)
  • static SoType getClassTypeId (void)
  • static SoNode * getByName (const SbName &name)
  • static int getByName (const SbName &name, SoNodeList &l)
  • static void initClass (void)
  • static void initClasses (void)
  • static uint32_t getNextNodeId (void)
  • static int getActionMethodIndex (const SoType type)
  • static void getBoundingBoxS (SoAction *action, SoNode *node)
  • static void GLRenderS (SoAction *action, SoNode *node)
  • static void callbackS (SoAction *action, SoNode *node)
  • static void getMatrixS (SoAction *action, SoNode *node)
  • static void handleEventS (SoAction *action, SoNode *node)
  • static void pickS (SoAction *action, SoNode *node)
  • static void rayPickS (SoAction *action, SoNode *node)
  • static void searchS (SoAction *action, SoNode *node)
  • static void writeS (SoAction *action, SoNode *node)
  • static void audioRenderS (SoAction *action, SoNode *node)
  • static void getPrimitiveCountS (SoAction *action, SoNode *node)

⭐ Static Public Member Functions inherited from SoFieldContainer ⭐

  • static void initClass (void)
  • static SoType getClassTypeId (void)
  • static void initCopyDict (void)
  • static void addCopy (const SoFieldContainer *orig, const SoFieldContainer *copy)
  • static SoFieldContainer * checkCopy (const SoFieldContainer *orig)
  • static SoFieldContainer * findCopy (const SoFieldContainer *orig, const SbBool copyconnections)
  • static void copyDone (void)

⭐ Static Public Member Functions inherited from SoBase ⭐

  • static void initClass (void)
  • static SoType getClassTypeId (void)
  • static void addName (SoBase *const base, const char *const name)
  • static void removeName (SoBase *const base, const char *const name)
  • static void incrementCurrentWriteCounter (void)
  • static void decrementCurrentWriteCounter (void)
  • static SoBase * getNamedBase (const SbName &name, SoType type)
  • static int getNamedBases (const SbName &name, SoBaseList &baselist, SoType type)
  • static SbBool read (SoInput *in, SoBase *&base, SoType expectedtype)
  • static void setInstancePrefix (const SbString &c)
  • static void setTraceRefs (SbBool trace)
  • static SbBool getTraceRefs (void)
  • static SbBool connectRoute (SoInput *in, const SbName &fromnodename, const SbName &fromfieldname, const SbName &tonodename, const SbName &tofieldname)
  • static SbBool readRoute (SoInput *in)

🌈 Public Attributes 🌈

  • SoMFFloat range β€” the range field, this is the main character of the whole node ngl
  • SoSFVec3f center β€” the center field, a lil SbVec3f moment

πŸ”₯ Protected Member Functions πŸ”₯

  • virtual const SoFieldData * getFieldData (void) const β€” hand over the field data
  • virtual ~SoLOD () β€” destructor, protected, she leaves quietly
  • virtual int whichToTraverse (SoAction *) β€” the actual decision-maker, figures out which child gets traversed πŸ‘‘

πŸ”₯ Protected Member Functions inherited from SoGroup πŸ”₯

  • virtual ~SoGroup ()
  • virtual SbBool readInstance (SoInput *in, unsigned short flags)
  • virtual SbBool readChildren (SoInput *in)
  • virtual void copyContents (const SoFieldContainer *from, SbBool copyconnections)

πŸ”₯ Protected Member Functions inherited from SoNode πŸ”₯

  • SoNode (void)
  • virtual ~SoNode ()

πŸ”₯ Protected Member Functions inherited from SoFieldContainer πŸ”₯

  • SoFieldContainer (void)
  • ~SoFieldContainer ()

πŸ”₯ Protected Member Functions inherited from SoBase πŸ”₯

  • SoBase (void)
  • virtual ~SoBase ()
  • virtual void destroy (void)
  • SbBool hasMultipleWriteRefs (void) const
  • SbBool writeHeader (SoOutput *out, SbBool isgroup, SbBool isengine) const
  • void writeFooter (SoOutput *out) const
  • virtual const char * getFileFormatName (void) const

πŸ’« Static Protected Member Functions πŸ’«

  • static const SoFieldData ** getFieldDataPtr (void)

πŸ’« Static Protected Member Functions inherited from SoGroup πŸ’«

  • static const SoFieldData ** getFieldDataPtr (void)

πŸ’« Static Protected Member Functions inherited from SoNode πŸ’«

  • static const SoFieldData ** getFieldDataPtr (void)
  • static void setNextActionMethodIndex (int index)
  • static int getNextActionMethodIndex (void)
  • static void incNextActionMethodIndex (void)
  • static void setCompatibilityTypes (const SoType &nodetype, const uint32_t bitmask)

πŸ’« Static Protected Member Functions inherited from SoBase πŸ’«

  • static uint32_t getCurrentWriteCounter (void)
  • static void staticDataLock (void)
  • static void staticDataUnlock (void)

🫢 Friends 🫢

  • class SoLODP

(yes, one friend, and it's SoLODP. ride or die. that's the whole friend list. iconic behaviour honestly πŸ₯Ή)


🧚 Additional Inherited Members 🧚

🌟 Public Types inherited from SoNode 🌟

enum NodeType { INVENTOR = 0x0000, VRML1 = 0x0001, VRML2 = 0x0002,
    INVENTOR_1 = 0x0004, INVENTOR_2_0 = 0x0008, INVENTOR_2_1 = 0x0010,
    INVENTOR_2_5 = 0x0020, INVENTOR_2_6 = 0x0040, COIN_1_0 = 0x0080,
    COIN_2_0 = 0x0100, EXTENSION = 0x0200, COIN_2_2 = 0x0400, COIN_2_3 =
    0x0800, COIN_2_4 = 0x1000, INVENTOR_5_0 = 0x2000, COIN_2_5 = 0x4000
    }

look at all those hex values bestie, it's giving hexadecimal runway 🌈


🌟 Protected Types inherited from SoBase 🌟

enum BaseFlags { IS_ENGINE = 0x01, IS_GROUP = 0x02 }

🌟 Protected Attributes inherited from SoGroup 🌟

  • SoChildList * children

🌟 Protected Attributes inherited from SoNode 🌟

  • uint32_t uniqueId

🌟 Protected Attributes inherited from SoFieldContainer 🌟

  • SbBool isBuiltIn

🌟 Static Protected Attributes inherited from SoNode 🌟

  • static uint32_t nextUniqueId = 0
  • static int nextActionMethodIndex = 0

and that's literally only part 1 bestie, the lore continues πŸ’…βœ¨

✨ Detailed Description ✨

Okay bestie, so the SoLOD class? It's literally the queen of choosing which child to show based on the distance between the viewer and the object. πŸ‘‘

The class docs for the SoLOD node class would be similar enough to that of SoLevelOfDetail that we're just gonna send you over there first. It explains the whole level-of-detail mechanism, why it's a thing, and how to use it. No cap.

(The main character difference between SoLOD and SoLevelOfDetail is that SoLOD uses the speedier "distance-to-viewer" technique for 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.

Referenced by getFieldData().

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 ✨

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
  }
  else if (node->getTypeId().isOfType(SoGroup::getClassTypeId())) {
    SoGroup * group = (SoGroup *)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::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.

References SoLOD().

void SoLOD::doAction (SoAction * action) [virtual]

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

Reimplemented from SoGroup.

References SoGroup::children, SoGroup::getChildren(), SoGroup::getNumChildren(), SoAction::getPathCode(), and whichToTraverse().

Referenced by audioRender(), callback(), getPrimitiveCount(), and rayPick().

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.

References doAction().

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.

References SoAction::getCurPathCode(), GLRenderBelowPath(), GLRenderInPath(), and GLRenderOffPath().

void SoLOD::GLRenderBelowPath (SoGLRenderAction * action) [virtual]

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

Reimplemented from SoNode.

References SoGLRenderAction::abortNow(), SoGroup::children, SoAction::getState(), SoNode::GLRenderBelowPath(), SoAction::popCurPath(), SoAction::pushCurPath(), SoNode::SoNode(), and whichToTraverse().

Referenced by GLRender(), and GLRenderInPath().

void SoLOD::GLRenderInPath (SoGLRenderAction * action) [virtual]

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

Reimplemented from SoNode.

References SoGLRenderAction::abortNow(), SoGroup::getChild(), SoAction::getPathCode(), GLRenderBelowPath(), SoNode::GLRenderInPath(), SoAction::hasTerminated(), SoAction::popCurPath(), SoAction::pushCurPath(), and SoNode::SoNode().

Referenced by GLRender().

void SoLOD::GLRenderOffPath (SoGLRenderAction * action) [virtual]

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

Reimplemented from SoNode.

References SoGLRenderAction::abortNow(), SoNode::affectsState(), SoGroup::getChild(), SoNode::GLRenderOffPath(), SoAction::popCurPath(), SoAction::pushCurPath(), SoNode::SoNode(), and whichToTraverse().

Referenced by GLRender().

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.

References doAction().

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.

References SoGroup::getBoundingBox().

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.

References doAction().

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

Action method for SoAudioRenderAction.

Does common processing for SoAudioRenderAction action instances.

Reimplemented from SoGroup.

References doAction().

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

Notifies all auditors for this instance when changes are made.

Reimplemented from SoNode.

References SoFieldContainer::notify().

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.

References center, SoGroup::getNumChildren(), SbViewVolume::getProjectionPoint(), SoAction::getState(), SbMatrix::multVecMatrix(), and range.

Referenced by doAction(), GLRenderBelowPath(), and GLRenderOffPath().


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

Referenced by whichToTraverse().

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.

Referenced by whichToTraverse().


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for Coin from the source code.


That's the whole vibe! This page came from Coin Version 2.5.0, and it's the SoLOD(3) manual. Go slay. πŸ’…βœ¨

πŸ“¦ where this page comes from