Class SoInstanceParameter
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- com.openinventor.inventor.nodes.SoNode
-
- com.openinventor.inventor.nodes.SoShaderParameter
-
- com.openinventor.inventor.nodes.SoVertexShaderParameter
-
- com.openinventor.inventor.nodes.SoVertexShaderParameterBufferObject
-
- com.openinventor.inventor.nodes.SoInstanceParameter
-
- All Implemented Interfaces:
SafeDisposable
public class SoInstanceParameter extends SoVertexShaderParameterBufferObject
Per-instance parameter node storing a buffer object. This node allows the application to provide a per-instance parameter of any type, using anSoBufferObject
. It is used with theSoMultipleInstance
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
andSoVertexShaderParameterBufferObject
for more details.Note: Unlike
SoVertexShaderParameter
, instances of this node must be added to the parameters field of anSoMultipleInstance
node, not directly in the scene graph.File format/default:
InstanceParameter {
name "" identifier 0 value NULL components 4 type SbDataType.FLOAT
stride 0 shouldBeNormalized false divisor 1 - Since:
- Open Inventor 9.5
- See Also:
SoVertexShaderParameter
,SoVertexShaderParameterBufferObject
,SoMultipleInstance
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoInstanceParameter.PredefinedParameters
List of predefined per-instance attribute names.-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
Fields Modifier and Type Field Description SoSFUInt32
divisor
This field modifies the rate at which values advance during multiple instance rendering.-
Fields inherited from class com.openinventor.inventor.nodes.SoVertexShaderParameterBufferObject
components, offset, shouldBeNormalized, stride, type, value
-
Fields inherited from class com.openinventor.inventor.nodes.SoShaderParameter
identifier, name
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoInstanceParameter()
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SoInstanceParameter
createPredefinedParameter(SoInstanceParameter.PredefinedParameters paramKey, SoBufferObject values)
Calls createPredefinedParameter(paramKey, values, (int)1).static SoInstanceParameter
createPredefinedParameter(SoInstanceParameter.PredefinedParameters paramKey, SoBufferObject values, int divisor)
Creates an instance parameter object for one of the predefined attribute names.static java.lang.String
getPredefinedParameterName(SoInstanceParameter.PredefinedParameters paramKey)
Returns the predefined instance parameter name for the specified paramKey.void
setPredefinedParameterName(SoInstanceParameter.PredefinedParameters paramKey)
Sets thename
field to the string corresponding to the given paramKey.-
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Field Detail
-
divisor
public final SoSFUInt32 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).
-
-
Method Detail
-
createPredefinedParameter
public static SoInstanceParameter createPredefinedParameter(SoInstanceParameter.PredefinedParameters paramKey, SoBufferObject values)
Calls createPredefinedParameter(paramKey, values, (int)1).
-
setPredefinedParameterName
public void setPredefinedParameterName(SoInstanceParameter.PredefinedParameters paramKey)
Sets thename
field to the string corresponding to the given paramKey.
-
getPredefinedParameterName
public static java.lang.String getPredefinedParameterName(SoInstanceParameter.PredefinedParameters paramKey)
Returns the predefined instance parameter name for the specified paramKey.
-
createPredefinedParameter
public static SoInstanceParameter createPredefinedParameter(SoInstanceParameter.PredefinedParameters paramKey, SoBufferObject values, int divisor)
Creates an instance parameter object for one of the predefined attribute names. paramKey = TRANSLATION:
Sets the translation per instance parameter values using the specifiedSoBufferObject
. TheSoBufferObject
is expected to contain translations encoded as 3 float values, e.g. array ofSbVec3f
. 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 specifiedSoBufferObject
. TheSoBufferObject
is expected to contain rotations encoded as 4 float values, e.g. array ofSbRotation
. 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 specifiedSoBufferObject
. TheSoBufferObject
is expected to contain scaling factor encoded as 3 float values, e.g. array ofSbVec3f
. 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 specifiedSoBufferObject
. TheSoBufferObject
is expected to contain colors encoded as 3 float values, e.g. array ofSbColor
. 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 specifiedSoBufferObject
. TheSoBufferObject
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 specifiedSoBufferObject
. TheSoBufferObject
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.
-
-