SoLOD(3)
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 childrenSoLOD (int numchildren)β constructor that already knows how many children it's about to have, organised queenvirtual void doAction (SoAction *action)β the big one, runs the actionvirtual void callback (SoCallbackAction *action)β callback action timevirtual void GLRender (SoGLRenderAction *action)β render it, slayvirtual 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" mechanicvirtual void getBoundingBox (SoGetBoundingBoxAction *action)β bounding box, get invirtual void getPrimitiveCount (SoGetPrimitiveCountAction *action)β counting primitives like it's inventory dayvirtual 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 constructorSoGroup (int nchildren)β group constructor that already knows the child countvirtual void addChild (SoNode *node)β adopt a node, bestievirtual void insertChild (SoNode *child, int newchildindex)β slot it in at an exact index, precisevirtual SoNode * getChild (int index) constβ grab a child by indexvirtual int findChild (const SoNode *node) constβ where's that child hidingvirtual int getNumChildren (void) constβ headcountvirtual void removeChild (int childindex)β bye by indexvirtual void removeChild (SoNode *child)β bye by pointervirtual void removeAllChildren (void)β full clear-out, the unfollow-everyone moment πvirtual void replaceChild (int index, SoNode *newchild)β swap by indexvirtual void replaceChild (SoNode *oldchild, SoNode *newchild)β swap by pointervirtual void getMatrix (SoGetMatrixAction *action)β matrix momentvirtual void handleEvent (SoHandleEventAction *action)β handle the event, no capvirtual void pick (SoPickAction *action)β picking, but the non-ray kindvirtual void search (SoSearchAction *action)β the search partyvirtual void write (SoWriteAction *action)β write it outvirtual SoChildList * getChildren (void) constβ hand over the whole child list
π Public Member Functions inherited from SoNode π
void setOverride (const SbBool state)β set that override flagSbBool isOverride (void) constβ are we overriding or notvoid setNodeType (const NodeType type)β assign the node typeNodeType getNodeType (void) constβ read the node type backvirtual SoNode * copy (SbBool copyconnections=0) constβ copy the node, connections optionalvirtual SbBool affectsState (void) constβ does this thing touch statevirtual void grabEventsSetup (void)β set up event grabbingvirtual void grabEventsCleanup (void)β tear down event grabbingvirtual void startNotify (void)β kick off the notification chainuint32_t getNodeId (void) constβ the node's unique lil id numbervirtual void writeInstance (SoOutput *out)β write this instancevirtual SoNode * addToCopyDict (void) constβ toss it into the copy dictionaryvirtual SoFieldContainer * copyThroughConnection (void) constβ copy straight through the connection
π Public Member Functions inherited from SoFieldContainer π
void setToDefaults (void)β factory reset the fieldsSbBool hasDefaultValues (void) constβ is everything still defaultSbBool fieldsAreEqual (const SoFieldContainer *container) constβ field comparison arcvoid copyFieldValues (const SoFieldContainer *container, SbBool copyconnections=0)β copy fields over, connections optionalSbBool set (const char *const fielddata)β set from field data stringvoid get (SbString &fielddata)β get into a stringvirtual int getFields (SoFieldList &l) constβ collect the fieldsvirtual int getAllFields (SoFieldList &l) constβ collect all the fields, overachievervirtual SoField * getField (const SbName &name) constβ field by namevirtual SoField * getEventIn (const SbName &name) constβ event-in by namevirtual SoField * getEventOut (const SbName &name) constβ event-out by nameSbBool getFieldName (const SoField *const field, SbName &name) constβ reverse lookup, name for a fieldSbBool enableNotify (const SbBool flag)β toggle notificationsSbBool isNotifyEnabled (void) constβ are notifications onSbBool set (const char *fielddata, SoInput *in)β set from field data with anSoInputvoid get (SbString &fielddata, SoOutput *out)β get with anSoOutputvirtual SbBool validateNewFieldValue (SoField *field, void *newval)β validate a new value before it commitsvirtual void addWriteReference (SoOutput *out, SbBool isfromfield=0)β register a write referenceSbBool getIsBuiltIn (void) constβ built-in or notvoid setUserData (void *userdata) constβ stash your own user datavoid * getUserData (void) constβ get your own user data back
π Public Member Functions inherited from SoBase π
void ref (void) constβ refcount upvoid unref (void) constβ refcount downvoid unrefNoDelete (void) constβ unref but no delete, spicyint32_t getRefCount (void) constβ read the refcountvoid touch (void)β touch it, make it announce itselfSbBool isOfType (SoType type) constβ type checkvirtual SbName getName (void) constβ what's her namevirtual void setName (const SbName &newname)β rebrandvoid addAuditor (void *const auditor, const SoNotRec::Type type)β add an auditorvoid removeAuditor (void *const auditor, const SoNotRec::Type type)β remove an auditorconst SoAuditorList & getAuditors (void) constβ get the whole auditor listSbBool shouldWrite (void)β should this be writtenvoid assertAlive (void) constβ the "bestie are you still there" check
β Static Public Member Functions β
static SoType getClassTypeId (void)β class type idstatic 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 nglSoSFVec3f centerβ the center field, a lilSbVec3fmoment
π₯ Protected Member Functions π₯
virtual const SoFieldData * getFieldData (void) constβ hand over the field datavirtual ~SoLOD ()β destructor, protected, she leaves quietlyvirtual 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) constSbBool writeHeader (SoOutput *out, SbBool isgroup, SbBool isengine) constvoid writeFooter (SoOutput *out) constvirtual 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 = 0static 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
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms