public class SoMultipleInstance extends SoMultipleInstanceBase
This node issues a single multi-instance OpenGL draw call that automatically applies per-instance parameters (SoInstanceParameter
objects) set in the parameters
field. Some predefined parameter names can be used for common instance parameters like position, rotation, scale factor, or color. 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. Custom shaders can also be used to set per-instance colors and so on.
The predefined instance parameters are typically set by the application to position the instances in space. The application does not need to set predefined instance parameter values if the default values are OK. For example, you may not need to set per-instance rotations. In that case you can just set the desired parameters for translating and/or scaling instances. If the application does not set any instance parameters, all the instances will be drawn at the same 3D position without any rotation or scaling factor applied.
Some methods are provided by SoInstanceParameter
to create these per-instance parameters: see the SoInstanceParameter
and SoMFInstanceParameter
documentation.
The predefined names for the SoInstanceParameter
name field are the following. However we recommend using the SoInstanceParameter
static method getPredefinedParameterName() to ensure future compatibility.
SbVec3f
translation values (3 floats) to apply to the instances.
SbVec3f
scale factor values (3 floats) to apply to the instances.
SbRotation
values (4 floats representing a quaternion) to apply to the instances.
SbColor
values (3 floats) to apply to the instances.
The OivShapeInstanceTranslation, OivShapeInstanceScale and OivShapeInstanceRotation parameters (if present) are combined together to create an equivalent matrix. This matrix is available to application shader programs using the GLSL function
If no instance parameters were set, the identity matrix is returnedmat4 OivInstanceMatrix()
The OivShapeInstanceColor and OivShapeInstanceTransparency parameters 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.
Notes:
SoVertexShaderParameter
must be greater than or equal to numInstances*SoVertexShaderParameter.instanceDivisor. If not, the attributes will be ignored with warning messages in debug mode.
SoSwitch
).
SoMultipleInstance
is derived from SoGroup
, it
behaves like an SoSeparator
(traversal state is pushed and popped).
Limitations:
SoMultipleInstance
, SoMultipleCopy
and SoArray
nodes may not be children.
File format/default:
MultipleInstance {
numInstances | 1 |
numBatches | 1 |
parameters |
See also:
SoInstanceParameter
, SoVertexShaderParameter
, SoBufferedShape
, SoAlgebraicShape
, SoShaderProgram
, SoMultipleCopy
, SoArray
, SoSwitch
SoNode.RenderModes
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
SoSFUInt32 |
numBatches
When this field is set to 1 (default), all the instances are rendered in one batch.
|
SoSFUInt32 |
numInstances
Number of shape instances to render.
|
SoMFInstanceParameter |
parameters
List of per-instance attributes of type SoVertexShaderParameters.
|
boundingBoxIgnoring
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoMultipleInstance()
Creates a multiple instance node with default settings.
|
addChild, findChild, getChild, getNumChildren, insertChild, removeAllChildren, removeChild, removeChild, replaceChild, replaceChild
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
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
getNativeResourceHandle
public final SoSFUInt32 numInstances
public final SoSFUInt32 numBatches
Limitation: When numBatches
is greater than 1, only instance parameters with a divisor equal to 1 are supported.
Default is 1.
public final SoMFInstanceParameter parameters
SoInstanceParameter.getPredefinedParameterName()
.
The number of elements in each SoVertexShaderParameter
must be greater than or equal to numInstances * SoInstanceParameter.divisor
, if not, the attributes will be ignored with warning messages in debug mode.
Some predefined SoVertexShaderParameter.name
are automaticly managed/interpreted:
OivShapeInstanceTranslation, OivShapeInstanceScale, 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.mat4 OivInstanceMatrix()
OivShapeInstanceColor affects the diffuse color of each instance.
Generated on July 31, 2019, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com