SoInstanceParameter Class Reference
[Shaders]

VSG extension Per-instance parameter node storing a buffer object. More...

#include <Inventor/nodes/SoInstanceParameter.h>

Inheritance diagram for SoInstanceParameter:
SoVertexShaderParameterBufferObject SoVertexShaderParameter SoShaderParameter SoNode SoFieldContainer SoBase SoRefCounter SoTypedObject

List of all members.

Public Types

enum  PredefinedParameters {
  TRANSLATION = 0,
  ROTATION,
  SCALE,
  VISIBILITY,
  COLOR,
  TRANSPARENCY,
  NUM_PREDEFINED_PARAMETERS
}

Public Member Functions

virtual SoType getTypeId () const
 SoInstanceParameter ()
void setPredefinedParameterName (SoInstanceParameter::PredefinedParameters paramKey)

Static Public Member Functions

static SoType getClassTypeId ()
static SoInstanceParametercreatePredefinedParameter (SoInstanceParameter::PredefinedParameters paramKey, const SoBufferObject *values, uint32_t divisor=1)
static SbString getPredefinedParameterName (SoInstanceParameter::PredefinedParameters paramKey)

Public Attributes

SoSFUInt32 divisor

Detailed Description

VSG extension 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.

FILE FORMAT/DEFAULT

SEE ALSO

SoVertexShaderParameter, SoVertexShaderParameterBufferObject, SoMultipleInstance

NOTE: node available since Open Inventor 9.5

See related examples:

MultiInstancingAlgebraicShape, MultiInstancingBufferedShape


Member Enumeration Documentation

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: Handles an array of vec3f translation to apply to vertices of each instance.
  • OivShapeInstanceScale: Handles an array of vec3f scale factor applied to vertices of each instance.
  • OivShapeInstanceRotation: Handles an array of vec4f quaternion applied to vertices of each instance.
  • OivShapeInstanceColor: Handles an array of vec3f color applied to vertices of each instance.
  • OivShapeInstanceTransparency: Handles an array of float transparency applied to vertices of each instance.
  • OivShapeInstanceVisibility: Handles an array of int32 visibility flag to apply to each instance.

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

 int OivInstanceVisibility() 

.

Enumerator:
TRANSLATION 
ROTATION 
SCALE 
VISIBILITY 
COLOR 
TRANSPARENCY 
NUM_PREDEFINED_PARAMETERS 

Constructor & Destructor Documentation

SoInstanceParameter::SoInstanceParameter (  ) 

Constructor.


Member Function Documentation

static SoInstanceParameter* SoInstanceParameter::createPredefinedParameter ( SoInstanceParameter::PredefinedParameters  paramKey,
const SoBufferObject values,
uint32_t  divisor = 1 
) [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 :

  • numInstance = 4
  • translationValues = {(1, 0, 0), (0, 1, 0)}
  • divisor = 2 => The first 2 instances will be translated by using (1, 0, 0) and the next two using (0, 1, 0).

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 SoType SoInstanceParameter::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoVertexShaderParameterBufferObject.

static SbString SoInstanceParameter::getPredefinedParameterName ( SoInstanceParameter::PredefinedParameters  paramKey  )  [static]

Returns the predefined instance parameter name for the specified paramKey.

virtual SoType SoInstanceParameter::getTypeId (  )  const [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.


Member Data Documentation

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).


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

Open Inventor Toolkit reference manual, generated on 4 Sep 2023
Copyright © Thermo Fisher Scientific All rights reserved.
https://www.openinventor.com/