MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / UpdateMesh

Method UpdateMesh

Source/Engine/Graphics/Models/SkinnedMesh.cs:108–131  ·  view source on GitHub ↗

Updates the skinned model mesh vertex and index buffer data. Can be used only for virtual assets (see and ). Mesh data will be cached and uploaded to the GPU with a delay. The mesh vertices positions. Cannot be null. The mesh index buffer (clockwise t

(Float3[] vertices, int[] triangles, Int4[] blendIndices, Float4[] blendWeights, Float3[] normals = null, Float3[] tangents = null, Float2[] uv = null, Color32[] colors = null)

Source from the content-addressed store, hash-verified

106 /// <param name="uv">The texture coordinates (per vertex).</param>
107 /// <param name="colors">The vertex colors (per vertex).</param>
108 public void UpdateMesh(Float3[] vertices, int[] triangles, Int4[] blendIndices, Float4[] blendWeights, Float3[] normals = null, Float3[] tangents = null, Float2[] uv = null, Color32[] colors = null)
109 {
110 if (!ParentSkinnedModel.IsVirtual)
111 throw new InvalidOperationException("Only virtual skinned models can be updated at runtime.");
112 if (vertices == null)
113 throw new ArgumentNullException(nameof(vertices));
114 if (triangles == null)
115 throw new ArgumentNullException(nameof(triangles));
116 if (triangles.Length == 0 || triangles.Length % 3 != 0)
117 throw new ArgumentOutOfRangeException(nameof(triangles));
118 if (normals != null && normals.Length != vertices.Length)
119 throw new ArgumentOutOfRangeException(nameof(normals));
120 if (tangents != null && tangents.Length != vertices.Length)
121 throw new ArgumentOutOfRangeException(nameof(tangents));
122 if (tangents != null && normals == null)
123 throw new ArgumentException("If you specify tangents then you need to also provide normals for the mesh.");
124 if (uv != null && uv.Length != vertices.Length)
125 throw new ArgumentOutOfRangeException(nameof(uv));
126 if (colors != null && colors.Length != vertices.Length)
127 throw new ArgumentOutOfRangeException(nameof(colors));
128
129 if (Internal_UpdateMeshUInt(__unmanagedPtr, vertices.Length, triangles.Length / 3, vertices, triangles, blendIndices, blendWeights, normals, tangents, uv, colors))
130 throw new Exception("Failed to update mesh data.");
131 }
132
133 /// <summary>
134 /// Updates the skinned model mesh vertex and index buffer data.

Callers

nothing calls this directly

Calls 2

ConvertCollectionMethod · 0.80
UpdateMeshFunction · 0.70

Tested by

no test coverage detected