/// <summary> /// Creates a new mesh from an existing mesh data. Created mesh will match the vertex and index buffers described /// by the mesh data exactly. Mesh will have specified the sub-meshes. /// </summary> /// <param name="data">Vertex and index data to initialize the mesh with.</param> /// <param name="subMeshes">Defines how are indices separated into sub-meshes, and how are those sub-meshes rendered. /// Sub-meshes may be rendered independently.</param> /// <param name="usage">Optimizes performance depending on planned usage of the mesh.</param> public Mesh(MeshData data, SubMesh[] subMeshes, MeshUsage usage = MeshUsage.Default) { IntPtr dataPtr = IntPtr.Zero; if (data != null) dataPtr = data.GetCachedPtr(); Internal_CreateInstanceMeshData(this, dataPtr, subMeshes, usage); }
private static extern void Internal_CreateInstance(MeshData instance, int numVertices, int numIndices, VertexType vertex, IndexType index);
/// <summary> /// Creates a new mesh from an existing mesh data. Created mesh will match the vertex and index buffers described /// by the mesh data exactly. Mesh will have no sub-meshes. /// </summary> /// <param name="data">Vertex and index data to initialize the mesh with.</param> /// <param name="topology">Determines how should the provided indices be interpreted by the pipeline. Default option /// is a triangle list, where three indices represent a single triangle.</param> /// <param name="usage">Optimizes performance depending on planned usage of the mesh.</param> public Mesh(MeshData data, MeshTopology topology = MeshTopology.TriangleList, MeshUsage usage = MeshUsage.Default) { int numIndices = 0; IntPtr dataPtr = IntPtr.Zero; if (data != null) { numIndices = data.IndexCount; dataPtr = data.GetCachedPtr(); } SubMesh[] subMeshes = { new SubMesh(0, numIndices, topology) }; Internal_CreateInstanceMeshData(this, dataPtr, subMeshes, usage); }
/// <summary> /// Creates a new mesh with enough space to hold the a number of primitives using the specified layout. Indices can be /// referenced by multiple sub-meshes. /// </summary> /// <param name="data">Vertex and index data to initialize the mesh with.</param> /// <param name="subMeshes"> /// Defines how are indices separated into sub-meshes, and how are those sub-meshes rendered. Sub-meshes may be rendered /// independently, each with a different material. /// </param> /// <param name="usage">Optimizes performance depending on planned usage of the mesh.</param> public Mesh(MeshData data, SubMesh[] subMeshes, MeshUsage usage = MeshUsage.Static) { Internal_create2(this, data, subMeshes, usage); }
/// <summary> /// Creates a new mesh from an existing mesh data. Created mesh will match the vertex and index buffers described by the /// mesh data exactly. Mesh will have no sub-meshes. /// </summary> /// <param name="data">Vertex and index data to initialize the mesh with.</param> /// <param name="topology"> /// Determines how should the provided indices be interpreted by the pipeline. Default option is a triangle list, where /// three indices represent a single triangle. /// </param> /// <param name="usage">Optimizes performance depending on planned usage of the mesh.</param> public Mesh(MeshData data, MeshTopology topology = MeshTopology.TriangleList, MeshUsage usage = MeshUsage.Static) { Internal_create1(this, data, topology, usage); }
private static extern void Internal_setMeshData(IntPtr thisPtr, MeshData value);
private static extern void Internal_create2(Mesh managedInstance, MeshData data, SubMesh[] subMeshes, MeshUsage usage);
private static extern void Internal_create1(Mesh managedInstance, MeshData data, MeshTopology topology, MeshUsage usage);