Instanced |
public class InstancedMeshGeometry3DNode : BaseWpfObjectNode, IRayHitTestedObject, IShadowCastingNode, IMeshNode
The InstancedMeshGeometry3DNode type exposes the following members.
Name | Description | |
---|---|---|
InstancedMeshGeometry3DNode(InstancedMeshGeometryVisual3D, String) | Constructor | |
InstancedMeshGeometry3DNode(MeshGeometry3D, SpecularMaterial, String) | Constructor |
Name | Description | |
---|---|---|
DXMesh | Gets a DXMeshGeometry3D that is created from the WPF's MeshGeometry3D. | |
InstancesCount | Gets or sets number of rendered instances. This value is automatically set from the SetInstanceData method to the length of the InstancesData array. But user can change the value to render just part of the instances. When the value is changed it is recommended to set the MeshIndexBufferDataChanged and BoundsChanged flags with calling NotifySceneNodeChange(SceneNodeSceneNodeDirtyFlags) method. | |
IsBackFaceMaterial | Gets or sets a Boolean that specifies if front faces (true) or back faces (false) are rendered. | |
IsCastingShadow | Gets or sets a Boolean that specifies if this SceneNode is casing shadow. This means that if IsCastingShadow is true, then 3D objects rendered with this SceneNode will create shadow; if false shadow will not be created. This works for VarianceShadowRenderingProvider and PlanarShadowRenderingProvider but not for ScreenSpaceAmbientOcclusionRenderingProvider. | |
IsPreMultipliedAlphaColor | When IsPreMultipliedAlphaColor is true (false by default) and Alpha is less then 1, then the instance colors components are already multiplied with alpha value to produce pre-multiplied colors. When false, then non-pre-multiplied color is converted in pre-multiplied color when this is required by the shader. | |
IsSolidColorMaterial | Gets or sets a Boolean that specifies if instanced objects are rendered with a solid color (without any shading based on lighting calculations). Default value is false. | |
IsUpdatingBounds | Gets or sets a Boolean that specifies if this SceneNode3D is automatically updating its Bounds value. Default value is true. | |
MeshGeometry3D | Gets a MeshGeometry3D that represents the mesh definition of each instance. | |
OverrideEffect | Gets or sets a DXEngine's Effect that is used to render this object. When OverrideEffect is null, the InstancedObjectsEffect is used. | |
SpecularMaterial | Gets a SpecularMaterial that is used by all instances. After changing this property the UpdateMaterial must be called. | |
StartInstanceIndex | StartInstanceIndex can be set to an index that will render only instances from the specified start index on. When the value is changed it is recommended to set the MeshIndexBufferDataChanged and BoundsChanged flags with calling NotifySceneNodeChange(SceneNodeSceneNodeDirtyFlags) method. | |
TextureAlphaClipThreshold | TextureAlphaClipThreshold can be set when TextureShaderResourceView is set. When its value is above 0 then pixels in texture with alpha color values below this value will be clipped (not rendered and their depth will not be written to depth buffer). Expected values are between 0 and 1. When 0 (by default) then alpha clipping is disabled - this means that also pixels with alpha value 0 are fully processed (they are not visible but its depth value is still written so objects that are rendered afterwards and are behind the pixel will not be visible). | |
TextureBlendState | Gets or sets a BlendState that is used to render the texture. If null then Opaque or PremultipliedAlphaBlend (for transparent materials) will be used. | |
TextureShaderResourceView | When TextureShaderResourceView is set to a ShaderResourceView, then this texture is used for all instances of the mesh. | |
UseAlphaBlend | Gets or sets a Boolean that specifies if alpha blending is used when rendering model instances. This can be used to render semi-transparent objects. Default value is false. This property is used only when instance color is used (not when UseSingleObjectColor(Color4) is called). | |
UseDynamicInstanceBuffer | 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. | |
UseInstanceIdColor | When true (false by default) then the color of each instance is defined by the id (index) of each instance. The lowest 8 bits of the instance id number are written to the blue color, then to the green color, then to the red color and the highest byte (when more the 16M instances) is written to the alpha color (for example, instanceId = 1: RGB: 0x000001; instanceId 257: RGB: 0x000102). | |
UseScreenSpaceScaling | When true (false by default) then each instance is scaled in the shader so that the value specified in matrix's M11 defines the size of the rendered object on screen (when the size of the mesh is 1). |
Name | Description | |
---|---|---|
CollectRenderableObjects |
The task of the CollectRenderableObjects method is to create objects derived from RenderablePrimitiveBase
and add them to the appropriate RenderingQueue.
This method is called at the beginning of RenderScene method call
but only when the scene was significantly changed (number of SceneNodes is changed, material is significantly changed, etc.)
(Overrides ObjectNodeCollectRenderableObjects) | |
GetClosestHitResult | GetClosestHitResult method returns a DXRayHitTestResult with the closest triangle hit by the specified ray. When no triangle is hit, null is returned. | |
GetDetailsText |
Returns string that tells details about this SceneNode
(Overrides BaseWpfObjectNodeGetDetailsText(Boolean, Boolean, Boolean, Boolean, Boolean)) | |
GetInstanceBuffer | Returns a SharpDX.Direct3D11.Buffer that is used by this InstancedMeshGeometry3DNode. | |
GetInstanceData | Returns an array of InstanceData that represents instances data used by this InstancedMeshGeometry3DNode. | |
GetMesh | Returns the mesh that is used by this SceneNode. | |
GetNextHitResult | GetNextHitResult method continues hit testing from the previously returned hit test and returns a DXRayHitTestResult with the next hit triangle (not necessary the next closest triangle) or null if no other triangle is hit. This method can be used to get all hit results. | |
SetInstanceBuffer | SetInstanceBuffer sets the specified instanceBuffer to be used to render the instances in this InstancedMeshGeometry3DNode. | |
SetInstanceData | Updates the InstanceData and InstancesCount. This method must be called after the instance data is changed. If data size is changed the method also sets the StartInstanceIndex to 0. | |
Update |
Update method is called on each update phase (before render phase)
(Overrides SceneNodeUpdate) | |
UpdateBounds |
Updates the bounds of this SceneNode if the dirty flags indicates that the bounds could be changed of if the forceUpdate parameter is set to true
(Overrides SceneNodeUpdateBounds(Boolean)) | |
UpdateInstanceBuffer | UpdateInstanceBuffer updates the used DirectX instance buffer and fills it with instances data set in the SetInstanceData(InstanceData, Boolean) method. | |
UpdateMaterial | UpdateMaterial updates the DXEngine's material properties. | |
UseInstanceObjectColor | UseInstanceObjectColor method can be called after calling the UseSingleObjectColor(Color4). This method resets using diffuse color from instances data. | |
UseSingleObjectColor | When UseSingleObjectColor is called, the specified objectColor is used as diffuse color for all instances. This overrides the color defined in the instances data. When color's alpha value is less than 1, then alpha blending is used. To use instance color after calling UseSingleObjectColor, call the UseInstanceObjectColor method. |
Name | Description | |
---|---|---|
InstanceBufferChangedCallback | InstanceBufferChangedCallback action is called when the instance buffer was changed. The new instance buffer is passed as first parameter. |
Name | Description | |
---|---|---|
GetGeometryModel3D |
Returns a WPF's GeometryModel3D that was used to create the specified sceneNode.
If the sceneNode does not define a GeometryModel3D object, then null is returned.
(Defined by Extensions) | |
GetModel3D |
Returns a WPF's Model3D that was used to create the specified sceneNode.
If the sceneNode does not define a Model3D object, then null is returned.
(Defined by Extensions) | |
GetModelVisual3D |
Returns a WPF's ModelVisual3D that was used to create the specified sceneNode or any parent SceneNode (in case searchParentSceneNodes is true).
If a SceneNode that defines a ModelVisual3D is not found, then null is returned.
(Defined by Extensions) | |
GetVisual3D |
Returns a WPF's Visual3D that was used to create the specified sceneNode or any parent SceneNode (in case searchParentSceneNodes is true).
If a SceneNode that defines a Visual3D is not found, then null is returned.
(Defined by Extensions) |