Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoComplexity Class Reference

Shape complexity node. More...

#include <Inventor/nodes/SoComplexity.h>

+ Inheritance diagram for SoComplexity:

Public Types

enum  Type {
  OBJECT_SPACE = SoComplexityTypeElement::OBJECT_SPACE ,
  SCREEN_SPACE = SoComplexityTypeElement::SCREEN_SPACE ,
  BOUNDING_BOX = SoComplexityTypeElement::BOUNDING_BOX
}
 Type. More...
 
enum  BboxType {
  BBOX_AABB = SoBBoxTypeElement::BBOX_AABB ,
  BBOX_OOB = SoBBoxTypeElement::BBOX_OOB
}
 Bounding box type. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoComplexity ()
 Creates a complexity node with default settings.
 
virtual void setOverride (const SbBool state)
 Set the state of the override field.
 
virtual SbBool isOverride () const
 Returns the state of the override field.
 
- Public Member Functions inherited from SoNode
virtual SoNodecopy (SbBool copyConnections=FALSE) const
 Creates and returns an exact copy of the node.
 
virtual SbBool affectsState () const
 Returns TRUE if a node has an effect on the state during traversal.
 
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
- Public Member Functions inherited from SoFieldContainer
void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoNode
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SoNodegetByName (const SbName &name)
 A node's name can be set using SoBase::setName().
 
static int getByName (const SbName &name, SoNodeList &list)
 A node's name can be set using SoBase::setName().
 
- Static Public Member Functions inherited from SoFieldContainer
static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Public Attributes

SoSFEnum type
 How shape complexity is interpreted.
 
SoSFFloat value
 Complexity value.
 
SoSFFloat textureQuality
 Hint about texture quality.
 
SoSFEnum bboxType
 Bounding box type to use.
 

Detailed Description

Shape complexity node.

This node sets the current shape complexity value. This is a heuristic value which provides a hint at what geometric complexity to render shape nodes. Values range from 0 to 1, where 0 means minimum complexity and 1 means maximum complexity. Each shape node interprets complexity in its own way.

Shape complexity (value field)

Shape complexity always affects rendering and primitive generation for the SoCallbackAction. For some shapes, it also affects picking.

There are three ways to interpret shape complexity, depending on the type field.

  • BOUNDING_BOX complexity ignores the value field and renders all shapes as bounding boxes. Each bounding box shape is drawn as if it were an SoCube and is subject to all of the drawing attributes of an SoCube (current material, drawing style, etc.) except that texturing is not applied. The other two types use the value field to determine the tessellation of shapes into polygons.
  • OBJECT_SPACE complexity (the default) uses value directly to determine the tessellation.
  • SCREEN_SPACE complexity depends on value and the projected size of the shape on the screen; a value of 0 produces the minimum tessellation for a shape, and a value of 1 produces a tessellation that is fine enough that each edge of a polygon is about 1 or two pixels in length. Since the projected size depends on the camera position, objects may be tessellated differently every frame if the camera is moving; note that this may have adverse effects on render caching in SoSeparator nodes.

The following is a sampling of the effects of shape complexity.

  • Simple shapes (SoCone, SoCube, etc): controls number of faces generated.
  • Markers/Points (SoMarkerSet, SoPointSet, etc): controls the number of markers/points actually drawn.
  • Text (SoText3, etc): controls tesselation of glyph edges in renderStyle POLYGON.
    (Quality in renderStyle TEXTURE is controlled by textureQuality.)
  • NURBS (SoNurbsCurve, SoNurbsSurface, etc): controls tesselation of the curve/surface.
  • SoCircularExtrusion: controls decimation of the extruded geometry.
  • Volume rendering (SoVolumeRender): controls the number of times the volume is sampled along each ray when the numSlicesControl field is set to AUTOMATIC.
  • Height field rendering (SoHeightFieldRender): controls tesselation of the height field (how many triangles are generated for rendering).

Texture quality

The SoComplexity node also controls the quality of textures applied to shapes, based on the value of the textureQuality field.

For texture nodes (SoTexture2, SoTextureCubeMap, etc), textureQuality controls the OpenGL minFilter, magFilter and mipmap settings that the hardware will use when applying the texture image to the geometry. With the default value (0.5) textures are not interpolated. We recommend using a higher value, e.g. 0.75, on modern graphics hardware.

For text nodes (SoText2, SoText3, etc), when the SoFont renderStyle field is set to TEXTURE, the OpenGL settings controlled by textureQuality strongly affect the quality of the text rendering. With the default value (0.5) textures are not interpolated, so text may appear to not be anti-aliased. We recommend using a higher value, e.g. 0.75, on modern graphics hardware.

In a few cases, e.g. SoImageBackground, setting textureQuality to zero disables rendering complexity.

FILE FORMAT/DEFAULT

    Complexity {
    type OBJECT_SPACE
    value 0.5
    textureQuality 0.5
    bboxType BBOX_AABB
    }

ACTION BEHAVIOR

SEE ALSO

SoShape, SoShapeHints, SoTexture2, SoInteractiveComplexity

Definition at line 170 of file SoComplexity.h.

Member Enumeration Documentation

◆ BboxType

Bounding box type.

Enumerator
BBOX_AABB 

Axis Aligned Bounding Box (default).

BBOX_OOB 

Object Oriented Bounding box.

Definition at line 192 of file SoComplexity.h.

◆ Type

Type.

Enumerator
OBJECT_SPACE 

Set complexity independent of screen size (default)

SCREEN_SPACE 

Set complexity based on screen size.

BOUNDING_BOX 

Draw all shapes as bounding boxes.

Definition at line 176 of file SoComplexity.h.

Constructor & Destructor Documentation

◆ SoComplexity()

SoComplexity::SoComplexity ( )

Creates a complexity node with default settings.

Member Function Documentation

◆ getClassTypeId()

static SoType SoComplexity::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getTypeId()

virtual SoType SoComplexity::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoNode.

◆ isOverride()

virtual SbBool SoComplexity::isOverride ( ) const
inlinevirtual

Returns the state of the override field.

Reimplemented from SoNode.

Definition at line 296 of file SoComplexity.h.

◆ setOverride()

virtual void SoComplexity::setOverride ( const SbBool  state)
inlinevirtual

Set the state of the override field.

see SoNode::setOverride doc.

Reimplemented from SoNode.

Definition at line 290 of file SoComplexity.h.

Member Data Documentation

◆ bboxType

SoSFEnum SoComplexity::bboxType

Bounding box type to use.

Use enum BboxType. Default is BBOX_AABB. By default an Axis Aligned Bounding Box (AABB) is used. It is simpler and faster to compute but may not be a good approximation of the shape's actual volume. Using an Object Oriented Bounding box is more compute intensive, but can provide a tighter volume box allowing better performance for actions such as culling, picking and selection. NOTE: field available since Open Inventor 8.1

Definition at line 279 of file SoComplexity.h.

◆ textureQuality

SoSFFloat SoComplexity::textureQuality

Hint about texture quality.

Default is 0.5. A value of 0 indicates that the fastest texturing should be used, while a value of 1 indicates that the best quality texturing should be used. The default value can also be set using the environment variable OIV_TEXTURE_QUALITY (0.0 to 1.0).

For backward compatibility, the default value is 0.5. This value was chosen when texturing was an expensive (low performance) feature of graphics hardware. It produces relatively low quality texture rendering because no interpolation is done. On modern graphics hardware we recommend setting this to a higher value, e.g. 0.75.

If the filter options are set explicitly in the SoTexture::minFilter and/or SoTexture::magFilter fields, this field has no effect.

The table below shows the correspondence between Open Inventor texture quality and OpenGL texture filtering options.

textureQuality
* minFilter value
** magFilter value
*** Need Mipmaps
Format
<= 0.5 GL_NEAREST GL_NEAREST FALSE ExtendedFormats or CompressedFormats
<= 0.6 GL_LINEAR GL_NEAREST FALSE ExtendedFormats or CompressedFormats
<= 0.7 GL_NEAREST_MIPMAP_NEAREST GL_NEAREST TRUE ExtendedFormats or CompressedFormats
<= 0.8 GL_NEAREST_MIPMAP_LINEAR GL_LINEAR TRUE InternalFormats or CompressedFormats
<= 0.9 GL_LINEAR_MIPMAP_NEAREST GL_LINEAR TRUE InternalFormats or CompressedFormats
<= 1.0 GL_LINEAR_MIPMAP_LINEAR GL_LINEAR TRUE InternalFormats or CompressedFormats

** If quality < 0.75, magFilter = GL_NEAREST, otherwise magFilter = GL_LINEAR.
The magFilter value can be set explicitly using the SoTexture::magFilter field of classes derived from SoTexture.

*** Means that Open Inventor automatically generates mipmap textures. See the OpenGL Programming Guide for information on mipmap textures.

Definition at line 267 of file SoComplexity.h.

◆ type

SoSFEnum SoComplexity::type

How shape complexity is interpreted.

Use enum Type. Default is OBJECT_SPACE. The default value can also be set using the environment variable OIV_COMPLEXITY_TYPE.

Definition at line 209 of file SoComplexity.h.

◆ value

SoSFFloat SoComplexity::value

Complexity value.

Default is 0.5. The default value can also be set using the environment variable OIV_COMPLEXITY (0.0 to 1.0).

Definition at line 216 of file SoComplexity.h.


The documentation for this class was generated from the following file: