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

VSG extension Node to record vertex attributes from shaders into buffer objects. More...

#include <Inventor/nodes/SoVertexAttribFeedback.h>

+ Inheritance diagram for SoVertexAttribFeedback:

Public Types

enum  BufferMode {
  INTERLEAVED ,
  SEPARATE
}
 This enum is used by the field buffersMode to describe the data packing format in the buffer objects. More...
 
enum  PrimitiveType {
  LINES ,
  POINTS ,
  TRIANGLES
}
 This enum is used to setup the expected recorded primitive type from the shaders. More...
 
- Public Types inherited from SoSeparator
enum  CacheEnabled {
  OFF ,
  ON ,
  AUTO
}
 Possible values for caching. More...
 
enum  FastEditing {
  DISABLE = 0x01 ,
  KEEP_ZBUFFER = 0x02 ,
  CLEAR_ZBUFFER = 0x03
}
 Fast editing policy enumeration values. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoVertexAttribFeedback ()
 Default constructor.
 
void registerFeedback (const SbString &varyingName, SoBufferObject *bufferObject, int primitiveSize=-1)
 This function allows to attach a buffer object to a specific varying of the shader pushed on the state.
 
void unregisterFeedback (const SbString &varyingName)
 This function is used to unregister a varying registered with the registerFeedback function.
 
int getGeneratedPrimitivesCount () const
 This function returns the number of generated primitives during the traversal of the sub scene graph.
 
- Public Member Functions inherited from SoSeparator
 SoSeparator ()
 Creates a separator node with default settings.
 
 SoSeparator (int nChildren)
 Constructor that takes approximate number of children.
 
- Public Member Functions inherited from SoGroup
 SoGroup ()
 Creates an empty group node.
 
 SoGroup (int nChildren)
 Constructor that takes approximate number of children.
 
virtual void addChild (SoNode *child)
 Adds a child as last one in group.
 
virtual void insertChild (SoNode *child, int newChildIndex)
 Adds a child so that it becomes the one with the given index.
 
virtual SoNodegetChild (int index) const
 Returns pointer the child node with the given index.
 
virtual int findChild (const SoNode *child) const
 Finds index of given child within group.
 
virtual int getNumChildren () const
 Returns number of children.
 
virtual void removeChild (int index)
 Removes child with given index from group.
 
virtual void removeChild (SoNode *child)
 Removes first instance of given child from group.
 
virtual void removeAllChildren ()
 Removes all children from group.
 
virtual void replaceChild (int index, SoNode *newChild)
 Replaces child with given index with new child.
 
virtual void replaceChild (SoNode *oldChild, SoNode *newChild)
 Replaces first instance of given child with new child.
 
- Public Member Functions inherited from SoNode
virtual void setOverride (const SbBool state)
 Turns the override flag on or off.
 
virtual SbBool isOverride () const
 Returns the state of the override flag.
 
virtual SoNodecopy (SbBool copyConnections=FALSE) const
 Creates and returns an exact copy of the node.
 
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 SbBool isSupported (SoState *state)
 This function indicates if the vertex attributes feedback feature is available on this system.
 
- Static Public Member Functions inherited from SoSeparator
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoGroup
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

SoSFBool disableFragmentProcessing
 Turn off the fragment rasterizer.
 
SoSFBool autoResizeBuffers
 Set this field to TRUE when the size of the recorded varyings is not known.
 
SoSFBool queryGeneratedPrimitivesCount
 Read back the number of recorded primitives.
 
SoSFEnum buffersMode
 The buffer mode used to record the primitives.
 
SoSFEnum primitiveType
 The type of primitive recorded during traversal.
 
- Public Attributes inherited from SoSeparator
SoSFEnum boundingBoxCaching
 Whether to cache during bounding box traversal.
 
SoSFEnum renderCulling
 Whether to cull during rendering traversal.
 
SoSFEnum pickCulling
 Whether to cull during picking traversal.
 
SoSFEnum fastEditing
 Specifies the fast edit mode of the separator node.
 
SoSFInt32 renderUnitId
 Used during the ScaleViz depth compositing process, this field specifies which render unit (OIRU) will render the sub scene graph below this separator.
 
SoDEPRECATED SoSFEnum renderCaching
 Whether to cache during rendering traversal.
 
- Public Attributes inherited from SoGroup
SoSFBool boundingBoxIgnoring
 Whether to ignore this node during bounding box traversal.
 

Additional Inherited Members

Detailed Description

VSG extension Node to record vertex attributes from shaders into buffer objects.

This node is used to record selected vertex attributes for each primitive processed by the OpenGL system. The recorded vertex attributes may be stored in separate SoGpuBufferObjects or interleaved into a single buffer object.

This node can only be used when an GLSL shader is enabled on the Open Inventor state. If the active shader contains a geometry shader the attributes are recorded from the varyings declared in it, otherwise it records the attributes from the vertex shader.

The function registerFeedback is used to specify the buffer object, which will receive the data, attached to a specified varying.

The scene graph which will be rendered during the traversal (can be any shape used as input of the geometry or vertex shader) is specified using the regular addChild function from the class SoSeparator.

This node provides a mechanism for the following features:

  • Rasterizer can be disabled to prevent rendering the generated primitives. This is useful when the main behavior is to record computed primitives from the geometry or vertex shader.
  • The SoGpuBufferObject can be automatically resized to be able to record all the data.
  • The number of generated primitives can be retrieved after the traversal.

Limitations

  • The automatic resize of the buffer objects requires two traversal of the children, one to compute the number of primitives which will be generated and the actual traversal.
  • Most of the regular actions (except Render and Write) don't traverse the children.

FILE FORMAT/DEFAULT

    VertexAttribFeedback {
    disableFragmentProcessing TRUE
    autoResizeBuffers FALSE
    queryGeneratedPrimitivesCount FALSE
    buffersMode SEPARATE
    primitiveType TRIANGLES
    }

ACTION BEHAVIOR

SEE ALSO

SoBufferObject, SoShaderProgram, SoBufferedShape

Definition at line 91 of file SoVertexAttribFeedback.h.

Member Enumeration Documentation

◆ BufferMode

This enum is used by the field buffersMode to describe the data packing format in the buffer objects.

Enumerator
INTERLEAVED 

All varyings are recorded, interleaved, in a single buffer object.

SEPARATE 

Each varying is recorded in a separate buffer object.

Definition at line 104 of file SoVertexAttribFeedback.h.

◆ PrimitiveType

This enum is used to setup the expected recorded primitive type from the shaders.

Enumerator
LINES 

The shader is supposed to generate LINES.

POINTS 

The shader is supposed to generate POINTS.

TRIANGLES 

The shader is supposed to generate TRIANGLES.

Definition at line 118 of file SoVertexAttribFeedback.h.

Constructor & Destructor Documentation

◆ SoVertexAttribFeedback()

SoVertexAttribFeedback::SoVertexAttribFeedback ( )

Default constructor.

Member Function Documentation

◆ getClassTypeId()

static SoType SoVertexAttribFeedback::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getGeneratedPrimitivesCount()

int SoVertexAttribFeedback::getGeneratedPrimitivesCount ( ) const

This function returns the number of generated primitives during the traversal of the sub scene graph.

NOTE: The returned value is undefined if the field queryGeneratedPrimitivesCount is not set to TRUE.

Returns
The number of generated primitives.

◆ getTypeId()

virtual SoType SoVertexAttribFeedback::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoSeparator.

◆ isSupported()

static SbBool SoVertexAttribFeedback::isSupported ( SoState state)
static

This function indicates if the vertex attributes feedback feature is available on this system.

When using a debug build of Open Inventor, some "no context available" warning messages may be generated. You can ignore them or see SoGLExtension for an example of using SoGLContext to avoid them.

Returns
TRUE if vertex attributes feedback is supported.

◆ registerFeedback()

void SoVertexAttribFeedback::registerFeedback ( const SbString varyingName,
SoBufferObject bufferObject,
int  primitiveSize = -1 
)

This function allows to attach a buffer object to a specific varying of the shader pushed on the state.

When the buffersMode field is set to INTERLEAVED only the first specified bufferObject is used.

The primitiveSize parameter is used to compute the actual size of buffer objects when autoResizeBuffers is set to TRUE, it is ignored otherwise; It must be the size of each primitive, in bytes. When the buffer mode is set to INTERLEAVED the value must be the accumulated size in bytes for all the varyings. The actual buffer size is computed by multiplying the primitiveSize by the number of primitives and by the size of the data type (float). When the value is -1 (the default value) Open Inventor uses 3 * sizeof(float) * numVerticesPerPrimtive, which is the size of a basic triangle with 3 vertices of 3 float-components, for a triangle the computed value is 3 * sizeof(float) * 3.

NOTE: When the buffer mode is set to INTERLEAVED only the first specified buffer object is used the following ones are ignored.

Parameters
varyingNameThe name of the varying which must will be added to the list of recorded varyings.
bufferObjectThe buffer object which will receive the recorded values from the varying.
primitiveSizeThe size, in bytes, of one primitive, used when the autoResizeBuffers field is set to TRUE.

◆ unregisterFeedback()

void SoVertexAttribFeedback::unregisterFeedback ( const SbString varyingName)

This function is used to unregister a varying registered with the registerFeedback function.

Parameters
varyingNameThe name of the varying to unregister, previously registered using the registerFeeback function.

Member Data Documentation

◆ autoResizeBuffers

SoSFBool SoVertexAttribFeedback::autoResizeBuffers

Set this field to TRUE when the size of the recorded varyings is not known.

It provides a mechanism to automatically resize the buffer objects.

This is implemented by performing a first traversal of the children with OpenGL queries enabled to record the number of generated primitives during this traversal. Then the value of the query is used to compute the size in bytes of the buffer object and a second traversal is performed for the actual primitives recording.

Default value is FALSE.

Definition at line 150 of file SoVertexAttribFeedback.h.

◆ buffersMode

SoSFEnum SoVertexAttribFeedback::buffersMode

The buffer mode used to record the primitives.

Use enum BufferMode. Default is SEPARATE.

Definition at line 165 of file SoVertexAttribFeedback.h.

◆ disableFragmentProcessing

SoSFBool SoVertexAttribFeedback::disableFragmentProcessing

Turn off the fragment rasterizer.

It means that the result of the shader is not rendered.

Most of the time the main goal of this node is to record the result of varyings from the geometry shaders and the recorded primitives are not supposed to be rendered.

Default value is TRUE.

Definition at line 137 of file SoVertexAttribFeedback.h.

◆ primitiveType

SoSFEnum SoVertexAttribFeedback::primitiveType

The type of primitive recorded during traversal.

Use enum PrimitiveType. Default is TRIANGLES.

Definition at line 171 of file SoVertexAttribFeedback.h.

◆ queryGeneratedPrimitivesCount

SoSFBool SoVertexAttribFeedback::queryGeneratedPrimitivesCount

Read back the number of recorded primitives.

The read back is performed only when this field is set to TRUE and the method getGeneratedPrimitivesCount returns the value.

Default value is FALSE.

Definition at line 159 of file SoVertexAttribFeedback.h.


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