Class SkinnedMesh
Represents part of the skinned model that is made of vertices and can be rendered using custom material, transformation and skeleton bones hierarchy.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public class SkinnedMesh : MeshBase
Constructors
SkinnedMesh()
Properties
ParentSkinnedModel
Gets the parent model asset.
Declaration
public SkinnedModel ParentSkinnedModel { get; }
Property Value
|
SkinnedModel
|
Methods
DownloadVertexBuffer(Boolean)
Downloads the raw vertex buffer that contains mesh vertices data. To download data from GPU set forceGpu to true and call this method from the thread other than main thread (see IsInMainThread).
[Deprecated in v1.10]
Declaration
public SkinnedMesh.Vertex[] DownloadVertexBuffer(bool forceGpu = false)
Parameters
|
System.Boolean
forceGpu
If set to |
Returns
|
SkinnedMesh.Vertex[]
The gathered data. |
DownloadVertexBuffer0(Boolean)
Downloads the first vertex buffer that contains mesh vertices data. To download data from GPU set forceGpu to true and call this method from the thread other than main thread (see IsInMainThread).
[Deprecated in v1.10]
Declaration
public SkinnedMesh.Vertex0[] DownloadVertexBuffer0(bool forceGpu = false)
Parameters
|
System.Boolean
forceGpu
If set to |
Returns
|
SkinnedMesh.Vertex0[]
The gathered data. |
Draw(ref RenderContext, SkinnedMeshBones, MaterialBase, ref Matrix, StaticFlags, Boolean, DrawPass, Single, SByte, Byte)
Draws the mesh.
Declaration
[Unmanaged]
public void Draw(ref RenderContext renderContext, SkinnedMeshBones pose, MaterialBase material, ref Matrix world, StaticFlags flags, bool receiveDecals = true, DrawPass drawModes, float perInstanceRandom = 0F, sbyte sortOrder = 0, byte stencilValue = 0)
Parameters
|
RenderContext
renderContext
The rendering context. |
|
SkinnedMeshBones
pose
The skeleton bones pose to use for rendering skinned mesh. |
|
MaterialBase
material
The material to use for rendering. |
|
Matrix
world
The world transformation of the model. |
|
StaticFlags
flags
The object static flags. |
|
System.Boolean
receiveDecals
True if rendered geometry can receive decals, otherwise false. |
|
DrawPass
drawModes
The draw passes to use for rendering this object. |
|
System.Single
perInstanceRandom
The random per-instance value (normalized to range 0-1). |
|
System.SByte
sortOrder
Object sorting key. |
|
System.Byte
stencilValue
Object stencil value. |
UpdateMesh(Float3[], Int32[], Int4[], Float4[], Float3[], Float3[], Float2[], Color32[])
Updates the skinned model mesh vertex and index buffer data. Can be used only for virtual assets (see IsVirtual and CreateVirtualAsset<T>()). Mesh data will be cached and uploaded to the GPU with a delay.
Declaration
public void UpdateMesh(Float3[] vertices, int[] triangles, Int4[] blendIndices, Float4[] blendWeights, Float3[] normals = null, Float3[] tangents = null, Float2[] uv = null, Color32[] colors = null)
Parameters
|
Float3[]
vertices
The mesh vertices positions. Cannot be null. |
|
System.Int32[]
triangles
The mesh index buffer (clockwise triangles). Uses 32-bit stride buffer. Cannot be null. |
|
Int4[]
blendIndices
The skinned mesh blend indices buffer. Contains indices of the skeleton bones (up to 4 bones per vertex) to use for vertex position blending. Cannot be null. |
|
Float4[]
blendWeights
The skinned mesh blend weights buffer (normalized). Contains weights per blend bone (up to 4 bones per vertex) of the skeleton bones to mix for vertex position blending. Cannot be null. |
|
Float3[]
normals
The normal vectors (per vertex). |
|
Float3[]
tangents
The tangent vectors (per vertex). |
|
Float2[]
uv
The texture coordinates (per vertex). |
|
Color32[]
colors
The vertex colors (per vertex). |
UpdateMesh(Float3[], UInt16[], Int4[], Float4[], Float3[], Float3[], Float2[], Color32[])
Updates the skinned model mesh vertex and index buffer data. Can be used only for virtual assets (see IsVirtual and CreateVirtualAsset<T>()). Mesh data will be cached and uploaded to the GPU with a delay.
Declaration
public void UpdateMesh(Float3[] vertices, ushort[] triangles, Int4[] blendIndices, Float4[] blendWeights, Float3[] normals = null, Float3[] tangents = null, Float2[] uv = null, Color32[] colors = null)
Parameters
|
Float3[]
vertices
The mesh vertices positions. Cannot be null. |
|
System.UInt16[]
triangles
The mesh index buffer (clockwise triangles). Uses 16-bit stride buffer. Cannot be null. |
|
Int4[]
blendIndices
The skinned mesh blend indices buffer. Contains indices of the skeleton bones (up to 4 bones per vertex) to use for vertex position blending. Cannot be null. |
|
Float4[]
blendWeights
The skinned mesh blend weights buffer (normalized). Contains weights per blend bone (up to 4 bones per vertex) of the skeleton bones to mix for vertex position blending. Cannot be null. |
|
Float3[]
normals
The normal vectors (per vertex). |
|
Float3[]
tangents
The tangent vectors (per vertex). |
|
Float2[]
uv
The texture coordinates (per vertex). |
|
Color32[]
colors
The vertex colors (per vertex). |
UpdateMesh(Float3[], UInt32[], Int4[], Float4[], Float3[], Float3[], Float2[], Color32[])
Updates the skinned model mesh vertex and index buffer data. Can be used only for virtual assets (see IsVirtual and CreateVirtualAsset<T>()). Mesh data will be cached and uploaded to the GPU with a delay.
Declaration
public void UpdateMesh(Float3[] vertices, uint[] triangles, Int4[] blendIndices, Float4[] blendWeights, Float3[] normals = null, Float3[] tangents = null, Float2[] uv = null, Color32[] colors = null)
Parameters
|
Float3[]
vertices
The mesh vertices positions. Cannot be null. |
|
System.UInt32[]
triangles
The mesh index buffer (clockwise triangles). Uses 32-bit stride buffer. Cannot be null. |
|
Int4[]
blendIndices
The skinned mesh blend indices buffer. Contains indices of the skeleton bones (up to 4 bones per vertex) to use for vertex position blending. Cannot be null. |
|
Float4[]
blendWeights
The skinned mesh blend weights buffer (normalized). Contains weights per blend bone (up to 4 bones per vertex) of the skeleton bones to mix for vertex position blending. Cannot be null. |
|
Float3[]
normals
The normal vectors (per vertex). |
|
Float3[]
tangents
The tangent vectors (per vertex). |
|
Float2[]
uv
The texture coordinates (per vertex). |
|
Color32[]
colors
The vertex colors (per vertex). |
UpdateMesh(Vector3[], Int32[], Int4[], Vector4[], Vector3[], Vector3[], Vector2[])
Updates the skinned model mesh vertex and index buffer data. Can be used only for virtual assets (see IsVirtual and CreateVirtualAsset<T>()). Mesh data will be cached and uploaded to the GPU with a delay. [Deprecated on 26.05.2022, expires on 26.05.2024]
Declaration
public void UpdateMesh(Vector3[] vertices, int[] triangles, Int4[] blendIndices, Vector4[] blendWeights, Vector3[] normals = null, Vector3[] tangents = null, Vector2[] uv = null)
Parameters
|
Vector3[]
vertices
The mesh vertices positions. Cannot be null. |
|
System.Int32[]
triangles
The mesh index buffer (clockwise triangles). Uses 32-bit stride buffer. Cannot be null. |
|
Int4[]
blendIndices
The skinned mesh blend indices buffer. Contains indices of the skeleton bones (up to 4 bones per vertex) to use for vertex position blending. Cannot be null. |
|
Vector4[]
blendWeights
The skinned mesh blend weights buffer (normalized). Contains weights per blend bone (up to 4 bones per vertex) of the skeleton bones to mix for vertex position blending. Cannot be null. |
|
Vector3[]
normals
The normal vectors (per vertex). |
|
Vector3[]
tangents
The tangent vectors (per vertex). |
|
Vector2[]
uv
The texture coordinates (per vertex). |
UpdateMesh(Vector3[], UInt16[], Int4[], Vector4[], Vector3[], Vector3[], Vector2[])
Updates the skinned model mesh vertex and index buffer data. Can be used only for virtual assets (see IsVirtual and CreateVirtualAsset<T>()). Mesh data will be cached and uploaded to the GPU with a delay. [Deprecated on 26.05.2022, expires on 26.05.2024]
Declaration
public void UpdateMesh(Vector3[] vertices, ushort[] triangles, Int4[] blendIndices, Vector4[] blendWeights, Vector3[] normals = null, Vector3[] tangents = null, Vector2[] uv = null)
Parameters
|
Vector3[]
vertices
The mesh vertices positions. Cannot be null. |
|
System.UInt16[]
triangles
The mesh index buffer (clockwise triangles). Uses 16-bit stride buffer. Cannot be null. |
|
Int4[]
blendIndices
The skinned mesh blend indices buffer. Contains indices of the skeleton bones (up to 4 bones per vertex) to use for vertex position blending. Cannot be null. |
|
Vector4[]
blendWeights
The skinned mesh blend weights buffer (normalized). Contains weights per blend bone (up to 4 bones per vertex) of the skeleton bones to mix for vertex position blending. Cannot be null. |
|
Vector3[]
normals
The normal vectors (per vertex). |
|
Vector3[]
tangents
The tangent vectors (per vertex). |
|
Vector2[]
uv
The texture coordinates (per vertex). |
UpdateMesh(Vector3[], UInt32[], Int4[], Vector4[], Vector3[], Vector3[], Vector2[])
Updates the skinned model mesh vertex and index buffer data. Can be used only for virtual assets (see IsVirtual and CreateVirtualAsset<T>()). Mesh data will be cached and uploaded to the GPU with a delay. [Deprecated on 26.05.2022, expires on 26.05.2024]
Declaration
public void UpdateMesh(Vector3[] vertices, uint[] triangles, Int4[] blendIndices, Vector4[] blendWeights, Vector3[] normals = null, Vector3[] tangents = null, Vector2[] uv = null)
Parameters
|
Vector3[]
vertices
The mesh vertices positions. Cannot be null. |
|
System.UInt32[]
triangles
The mesh index buffer (clockwise triangles). Uses 32-bit stride buffer. Cannot be null. |
|
Int4[]
blendIndices
The skinned mesh blend indices buffer. Contains indices of the skeleton bones (up to 4 bones per vertex) to use for vertex position blending. Cannot be null. |
|
Vector4[]
blendWeights
The skinned mesh blend weights buffer (normalized). Contains weights per blend bone (up to 4 bones per vertex) of the skeleton bones to mix for vertex position blending. Cannot be null. |
|
Vector3[]
normals
The normal vectors (per vertex). |
|
Vector3[]
tangents
The tangent vectors (per vertex). |
|
Vector2[]
uv
The texture coordinates (per vertex). |