Node to record vertex attributes from shaders into buffer objects. More...
#include <Inventor/nodes/SoVertexAttribFeedback.h>
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 SoNode * | getChild (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 SoNode * | copy (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 SoField * | getField (const SbName &fieldName) const |
Returns a the field of this object whose name is fieldName. | |
virtual SoField * | getEventIn (const SbName &fieldName) const |
Returns a the eventIn with the given name. | |
virtual SoField * | getEventOut (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 SoNode * | getByName (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 | |
Related Symbols inherited from SoSeparator | |
#define | SO_RENDERUNITID_NONE (-1) |
Don't traverse any children. | |
#define | SO_RENDERUNITID_INHERIT (-2) |
Inherit value from state. | |
#define | SO_RENDERUNITID_ALL (-3) |
Traverse all children. | |
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:
Limitations
Most of the regular actions (except Render and Write) don't traverse the children.
disableFragmentProcessing | TRUE |
autoResizeBuffers | FALSE |
queryGeneratedPrimitivesCount | FALSE |
buffersMode | SEPARATE |
primitiveType | TRIANGLES |
SoBufferObject, SoShaderProgram, SoBufferedShape
Definition at line 91 of file SoVertexAttribFeedback.h.
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.
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.
SoVertexAttribFeedback::SoVertexAttribFeedback | ( | ) |
Default constructor.
|
static |
Returns the type identifier for this class.
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.
|
virtual |
Returns the type identifier for this specific instance.
Reimplemented from SoSeparator.
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.
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.
varyingName | The name of the varying which must will be added to the list of recorded varyings. |
bufferObject | The buffer object which will receive the recorded values from the varying. |
primitiveSize | The size, in bytes, of one primitive, used when the autoResizeBuffers field is set to TRUE. |
void SoVertexAttribFeedback::unregisterFeedback | ( | const SbString & | varyingName | ) |
This function is used to unregister a varying registered with the registerFeedback function.
varyingName | The name of the varying to unregister, previously registered using the registerFeeback function. |
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.
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.
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.
SoSFEnum SoVertexAttribFeedback::primitiveType |
The type of primitive recorded during traversal.
Use enum PrimitiveType. Default is TRIANGLES.
Definition at line 171 of file SoVertexAttribFeedback.h.
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.