Per-instance parameter node storing a buffer object. More...
#include <Inventor/nodes/SoInstanceParameter.h>
Public Types | |
enum | PredefinedParameters { TRANSLATION = 0 , ROTATION , SCALE , VISIBILITY , COLOR , TRANSPARENCY , NUM_PREDEFINED_PARAMETERS } |
List of predefined per-instance attribute names. More... | |
Public Member Functions | |
virtual SoType | getTypeId () const |
Returns the type identifier for this specific instance. | |
SoInstanceParameter () | |
Constructor. | |
void | setPredefinedParameterName (SoInstanceParameter::PredefinedParameters paramKey) |
Sets the name field to the string corresponding to the given paramKey. | |
Public Member Functions inherited from SoVertexShaderParameterBufferObject | |
SoVertexShaderParameterBufferObject () | |
Constructor. | |
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 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 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 SoInstanceParameter * | createPredefinedParameter (SoInstanceParameter::PredefinedParameters paramKey, const SoBufferObject *values, uint32_t divisor=1) |
Creates an instance parameter object for one of the predefined attribute names. | |
static SbString | getPredefinedParameterName (SoInstanceParameter::PredefinedParameters paramKey) |
Returns the predefined instance parameter name for the specified paramKey. | |
Static Public Member Functions inherited from SoVertexShaderParameterBufferObject | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
Static Public Member Functions inherited from SoVertexShaderParameter | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
Static Public Member Functions inherited from SoShaderParameter | |
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 | |
SoSFUInt32 | divisor |
This field modifies the rate at which values advance during multiple instance rendering. | |
Public Attributes inherited from SoVertexShaderParameterBufferObject | |
SoSFBufferObject | value |
Specifies the parameter's values. | |
SoSFInt32 | components |
Specifies the number of components per generic vertex parameter. | |
SoSFEnum | type |
Specifies the data type from the class SbDataType of each generic vertex parameter component. | |
SoSFInt32 | offset |
Offset in bytes to the first parameter within the buffer. | |
SoSFInt32 | stride |
Specifies the byte offset between consecutive generic vertex parameter. | |
SoSFBool | shouldBeNormalized |
Specifies if the fixed-point data in the buffer object should be normalized when they are accessed. | |
Public Attributes inherited from SoShaderParameter | |
SoSFString | name |
Specifies the parameter's string name which is declared and used within high-level shading programs. | |
SoSFInt32 | identifier |
Specifies the parameter's integer name which is declared and used within low-level shading programs. | |
Per-instance parameter node storing a buffer object.
This node allows the application to provide a per-instance parameter of any type, using an SoBufferObject. It is used with the SoMultipleInstance node.
Some predefined parameter names can be used for common instance parameters like position, rotation and scale factor. Parameter objects with these names are automatically managed and are recognized and used by the default shaders. Applications can define additional parameter objects to be used by custom shaders.
See the base classes SoShaderParameter, SoVertexShaderParameter and SoVertexShaderParameterBufferObject for more details.
Note: Unlike SoVertexShaderParameter, instances of this node must be added to the parameters field of an SoMultipleInstance node, not directly in the scene graph.
name | "" |
identifier | 0 |
value | NULL |
components | 4 |
type | SbDataType::FLOAT |
stride | 0 |
shouldBeNormalized | FALSE |
divisor | 1 |
SoVertexShaderParameter, SoVertexShaderParameterBufferObject, SoMultipleInstance
NOTE: node available since Open Inventor 9.5
Definition at line 80 of file SoInstanceParameter.h.
List of predefined per-instance attribute names.
The names corresponding to the following enum symbols can be queried by mean of the getPredefinedParameterName() method. They correspond to a set of predefined parameter names that are automatically managed/interpreted:
OivShapeInstanceTranslation, OivShapeInstanceScale and OivShapeInstanceRotation are combined together to create an equivalent matrix available in GLSL shaders with the function
If no parameters are present then an identity matrix is returned.
OivShapeInstanceColor and OivShapeInstanceTransparency affect, respectively, the diffuse color and the transparency of each instance. Note that when one of these parameters is defined, it overrides the diffuse color or the transparency value of a SoMaterial node.
OivShapeInstanceVisibility affects the visibility of each instance (i.e. 0 means hidden and a value greater than zero means visible). This attribute is available in GLSL shaders with the function
.
Enumerator | |
---|---|
TRANSLATION | |
ROTATION | |
SCALE | |
VISIBILITY | |
COLOR | |
TRANSPARENCY | |
NUM_PREDEFINED_PARAMETERS |
Definition at line 136 of file SoInstanceParameter.h.
SoInstanceParameter::SoInstanceParameter | ( | ) |
Constructor.
|
static |
Creates an instance parameter object for one of the predefined attribute names.
paramKey = TRANSLATION:
Sets the translation per instance parameter values using the specified SoBufferObject. The SoBufferObject is expected to contain translations encoded as 3 float values, e.g. array of SbVec3f. The buffer size must be at least (numInstances/divisor) * 3 * sizeof(float). The divisor parameter indicates by how many instances a translation value is shared.
Example :
paramKey = ROTATION:
Sets the rotation per instance parameter values using the specified SoBufferObject. The SoBufferObject is expected to contain rotations encoded as 4 float values, e.g. array of SbRotation. The buffer size must be at least (numInstances/divisor) * 4 * sizeof(float). The divisor parameter indicates by how many instances a rotation value is shared.
paramKey = SCALE:
Sets the scaling per instance parameter values using the specified SoBufferObject. The SoBufferObject is expected to contain scaling factor encoded as 3 float values, e.g. array of SbVec3f. The buffer size must be at least (numInstances/divisor) * 3 * sizeof(float). The divisor parameter indicates by how many instances a scale value is shared.
paramKey = COLOR:
Sets the color per instance parameter values using the specified SoBufferObject. The SoBufferObject is expected to contain colors encoded as 3 float values, e.g. array of SbColor. The buffer size must be at least (numInstances/divisor) * 3 * sizeof(float). The divisor parameter indicates by how many instances a color value is shared.
paramKey = TRANSPARENCY:
Sets the transparency per instance parameter values using the specified SoBufferObject. The SoBufferObject is expected to contain colors encoded as 1 float value, e.g. array of float. The buffer size must be at least (numInstances/divisor) * sizeof(float). The divisor parameter indicates by how many instances a transparency value is shared.
paramKey = VISIBILITY:
Sets the visibility per instance parameter values using the specified SoBufferObject. The SoBufferObject is expected to contain visibility value encoded as an int32_t value. The buffer size must be at least (numInstances/divisor) * sizeof(int32_t). The divisor parameter indicates by how many instances a visibility value is shared.
|
static |
Returns the type identifier for this class.
|
static |
Returns the predefined instance parameter name for the specified paramKey.
|
virtual |
Returns the type identifier for this specific instance.
Reimplemented from SoVertexShaderParameterBufferObject.
void SoInstanceParameter::setPredefinedParameterName | ( | SoInstanceParameter::PredefinedParameters | paramKey | ) |
Sets the name field to the string corresponding to the given paramKey.
SoSFUInt32 SoInstanceParameter::divisor |
This field modifies the rate at which values advance during multiple instance rendering.
Divisor must be non-zero and the attribute advances once per divisor instances of the set(s) of vertices being rendered. Default is 1 (1 parameter per instance).
Definition at line 96 of file SoInstanceParameter.h.