SOSHAPEHINTS(3iv)

πŸ’– NAME πŸ’–

SoShapeHints β€” the node that provides hints about shapes

Ok so real talk, this is the SoShapeHints(3IV) page, and it's genuinely one of my faves because it's just... telling Inventor the tea about your geometry so it can go faster. Bestie. Let's get into it. 🫢


πŸ¦‹ INHERITS FROM πŸ¦‹

SoBase > SoFieldContainer > SoNode > SoShapeHints


✨ SYNOPSIS ✨

#include <Inventor/nodes/SoShapeHints.h>
enum VertexOrdering {
     SoShapeHints::UNKNOWN_ORDERING
                              Ordering of vertices is unknown
     SoShapeHints::CLOCKWISE  Face vertices are ordered clockwise (from
                                   the outside)
     SoShapeHints::COUNTERCLOCKWISE
                              Face vertices are ordered counterclockwise
                                   (from the outside)
}

enum ShapeType {
     SoShapeHints::UNKNOWN_SHAPE_TYPE
                          Nothing is known about the shape
     SoShapeHints::SOLID  The shape encloses a volume
}

enum FaceType {
     SoShapeHints::UNKNOWN_FACE_TYPE
                            Nothing is known about faces
     SoShapeHints::CONVEX  All faces are convex
}

πŸ’… Fields from class SoShapeHints:

SoSFEnum            vertexOrdering
SoSFEnum            shapeType
SoSFEnum            faceType
SoSFFloat           creaseAngle

🌸 Methods from class SoShapeHints:

                     SoShapeHints()
static SoType       getClassTypeId()

πŸŽ€ Methods from class SoNode:

void                setOverride(SbBool state)
SbBool              isOverride() const
SoNode *            copy(SbBool copyConnections = FALSE) const
virtual SbBool      affectsState() const
static SoNode *     getByName(const SbName &name)
static int          getByName(const SbName &name, SoNodeList &list)

🌈 Methods from class SoFieldContainer:

void                setToDefaults()
SbBool              hasDefaultValues() const
SbBool              fieldsAreEqual(const SoFieldContainer *fc) const
void                copyFieldValues(const SoFieldContainer *fc, SbBool
                         copyConnections = FALSE)
SbBool              set(const char *fieldDataString)
void                get(SbString &fieldDataString)
virtual int         getFields(SoFieldList &resultList) const
virtual SoField *   getField(const SbName &fieldName) const
SbBool              getFieldName(const SoField *field, SbName &fieldName)
                         const
SbBool              isNotifyEnabled() const
SbBool              enableNotify(SbBool flag)

🧚 Methods from class SoBase:

void                ref()
void                unref() const
void                unrefNoDelete() const
void                touch()
virtual SoType      getTypeId() const
SbBool              isOfType(SoType type) const
virtual void        setName(const SbName &name)
virtual SbName      getName() const

🌟 DESCRIPTION 🌟

So by default, Inventor assumes very little about the shapes it renders. Like, it's not gonna guess, it's not gonna assume, it's just gonna do the safe thing. That's where SoShapeHints comes in β€” you use it to tell Inventor that vertex-based shapes (aka the ones derived from SoVertexShape) are solid, have ordered vertices, or have convex faces. And if you want the fastest rendering possible? Specify SOLID, COUNTERCLOCKWISE, CONVEX shapes. Periodt. πŸ”₯

These hints let Inventor optimize certain rendering features. The optimizations it may perform include enabling back-face culling and disabling two-sided lighting. For example:

  • if an object is solid and has ordered vertices, Inventor turns on backface culling and turns off two-sided lighting
  • if the object is not solid but has ordered vertices, it turns off backface culling and turns on two-sided lighting
  • in all other cases, both backface culling and two-sided lighting are off

The SoShapeHints node also affects how default normals are generated. When a node derived from SoVertexShape has to generate default normals, it uses the creaseAngle field to figure out which edges should be smooth-shaded and which ones should have a sharp crease. The crease angle is the angle between surface normals on adjacent polygons. So like, for example, a crease angle of .5 radians means an edge between two adjacent polygonal faces will be smooth shaded if the normals to the two faces form an angle that is less than .5 radians (about 30 degrees). Otherwise, it'll be faceted. ✨

And ngl, normal generation is fastest when the creaseAngle is 0 (that's the default), which produces one normal per facet. A creaseAngle of pi produces one averaged normal per vertex. πŸ’«


πŸŽ€ FIELDS πŸŽ€

  • SoSFEnum vertexOrdering β€” tells you how the vertices of faces are ordered. CLOCKWISE ordering means the vertices of each face form a clockwise loop around the face, when viewed from the outside (aka the side toward which the normal points). πŸ‘‘
  • SoSFEnum shapeType β€” says whether the shape is known to enclose a volume (SOLID) or not. Important bit: if the inside (the side away from the surface normal) of any part of the shape is visible, then the shape is not solid. 🫣
  • SoSFEnum faceType β€” says whether each face is convex. And bestie, the reason the default assumes convex is that the penalty for non-convex faces is very steep (faces must be triangulated expensively 😭). So heads up: shapes with concave faces may not be displayed correctly unless this hint is set to UNKNOWN_FACE_TYPE. Don't say I didn't warn you.
  • SoSFFloat creaseAngle β€” the minimum angle (in radians) between two adjacent face normals required to form a sharp crease at the edge when default normals are computed and used. πŸ“

πŸ’… METHODS πŸ’…

  • SoShapeHints() β€” creates a shape hints node with default settings. A little baby node, fresh out the box. 🎁
  • static SoType getClassTypeId() β€” returns the type identifier for this class. iykyk. πŸͺͺ

πŸ”₯ ACTION BEHAVIOR πŸ”₯

SoGLRenderAction, SoCallbackAction, SoRayPickAction, SoGetBoundingBoxAction

Sets the state to contain the hints; sets up optimizations based on the hints. That's it, that's the whole vibe check. βœ…


🌸 FILE FORMAT/DEFAULTS 🌸

ShapeHints {
    vertexOrdering  UNKNOWN_ORDERING
    shapeType       UNKNOWN_SHAPE_TYPE
    faceType        CONVEX
    creaseAngle     0
}

πŸ¦‹ SEE ALSO πŸ¦‹

SoVertexShape


ok that's the whole page, bestie, you ate that πŸ’…βœ¨ this was SoShapeHints(3IV)() from the 3IV manual β€” and yeah the date slot is just empty parens, so consider it timeless 🌈 no cap πŸ«ΆπŸ’–