Click or drag to resize
AB4D logo

InstancedModelGroupVisual3D Class

InstancedModelGroupVisual3D is a WPF Visual3D object that can be used to define a Model3DGroup that will be rendered multiple times as instances where each instace can have its own world matrix (defines scale, rotation and translation). When rendered with DirectX, InstancedModelGroupVisual3D provides the fastest way to render many Model3DGroup instances.
Inheritance Hierarchy
SystemObject
  System.Windows.ThreadingDispatcherObject
    System.WindowsDependencyObject
      System.Windows.Media.Media3DVisual3D
        System.Windows.Media.Media3DModelVisual3D
          Ab3d.VisualsBaseDXVisual3D
            Ab3d.VisualsInstancedModelGroupVisual3D

Namespace: Ab3d.Visuals
Assembly: Ab3d.DXEngine.Wpf (in Ab3d.DXEngine.Wpf.dll) Version: 7.1.9105.2048
Syntax
C#
public class InstancedModelGroupVisual3D : BaseDXVisual3D

The InstancedModelGroupVisual3D type exposes the following members.

Constructors
 NameDescription
Public methodInstancedModelGroupVisual3D Constructor
Top
Properties
 NameDescription
Public propertyInstancesData Gets or sets an array of InstanceData structs that define the world transformations (positions, scales, rotations) and colors or instanced geometry objects. After each change of InstancesData user must call Update method.
Public propertyIsWpf3DVisible Gets a Boolean that specifies if this BaseDXVisual3D can show its content when rendered with WPF 3D objects.
(Overrides BaseDXVisual3DIsWpf3DVisible)
Public propertyIsWpfHitTestVisible Gets or sets a Boolean that specifies if WPF hit testing can be done on the instanced 3D objects when rendered with DirectX hardware acceleration. When IsWpfHitTestVisible is true then InstancedModelGroupVisual3D always creates WPF's Model3D objects that are used by WPF's hit testing. This can increase initialization time. Default value is false. When showing instanced objects, it is recommended to use DXEngine hit testing that support fast hit testing on instanced objects and leave this property on false.
Public propertyModel3DGroup Gets Model3DGroup that is used by this InstancedModelGroupVisual3D
Public propertyUseDynamicInstanceBuffer Gets or sets a Boolean that specifies if dynamic instance buffer is created instead of immutable instance buffer. Dynamic instance buffer has better performance when instance data is changed often. On the other side the immutable buffer is better when the instance data is not changed or changed only a few times. Default value is false - use immutable buffer.
Top
Methods
 NameDescription
Public methodUpdate Update method updates the data for all instances. It must be called after InstancesData are changed. When only some of the instances were changed, it is highly recommended to call Update(Int32, Int32, Boolean) and pass startIndex and count as parameters.
Public methodUpdate(Int32, Int32, Boolean) Update method updates instance data specified with startIndex, count parameters and updateBounds. This method can be called after some instance transformations or colors were changed.
Public methodUpdateMaterial UpdateMaterial updates the used specular material. It must be called after the SpecularMaterial is changed.
Top
Extension Methods
 NameDescription
Public Extension MethodClearDXAttribute Clears the value from DXAttributeType so that IsDXAttributeSet(Visual3D, DXAttributeType) method returns false for that DXAttributeType.
(Defined by Extensions)
Public Extension MethodGetDXAttribute Gets the value of the specified DXAttributeType from the specified Visual3D. If the attributeType does not exists then an exception is thrown. Use GetDXAttributeOrDefaultT(Visual3D, DXAttributeType) or GetDXAttributeOrDefaultT(Visual3D, DXAttributeType, T) to prevent throwing exception when the value is not set.
(Defined by Extensions)
Public Extension MethodGetDXAttributeCollection Gets a DXAttributeCollection will a collection of all DXEngine's attributes set to the specified WPF's object. Returns null when no DXAttributeCollection was attached to the WPF object.
(Defined by Extensions)
Public Extension MethodGetDXAttributeOrDefaultT Gets the value of the specified DXAttributeType from the specified Visual3D. If the attributeType does not exists then a default value for the type T is returned.
(Defined by Extensions)
Public Extension MethodGetDXAttributeOrDefaultT Gets the value of the specified DXAttributeType from the specified Visual3D. If the attributeType does not exists then the specified defaultValue is returned.
(Defined by Extensions)
Public Extension MethodIsDXAttributeSet Returns true if the specified attributeType was set (result is true even if the value is null).
(Defined by Extensions)
Public Extension MethodSetDXAttribute Annotates the specified wpfObject with adding or updating a DXEngine's attribute to it. The attribute is specified with attributeType and its value. This can be used to annotate WPF's objects with DXEngine's attributes.
(Defined by Extensions)
Top
Remarks

InstancedModelGroupVisual3D is a WPF Visual3D object that can be used to define a Model3DGroup that will be rendered multiple times as instances where each instace can have its own world matrix (defines scale, rotation and translation).

When rendered with DirectX, InstancedModelGroupVisual3D provides the fastest way to render many Model3DGroup instances.

InstancedModelGroupVisual3D renders the Model3DGroup with rendering each Child GeometryModel3D as instanced MeshGeometry3D where each instance has the same color - the one defined in the GeometryModel3D's Material or BackMaterial.

Because InstancedModelGroupVisual3D uses MeshGeometry3D instancing, it can render only SolidColorBrush DiffuseMaterials.

For more information about instanced rendering see remarks for InstancedMeshGeometryVisual3D.

If you want to render many instances of GeometryModel3D or MeshGeometry3D, then you can also use the InstancedMeshGeometryVisual3D.

See Also