/// <summary> /// Creates a new mesh with enough space to hold the a number of primitives using the specified layout. All indices /// will be part of a single sub-mesh. /// </summary> /// <param name="numVertices">Number of vertices in the mesh.</param> /// <param name="numIndices">Number of indices in the mesh. </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> /// <param name="vertex">Controls how are vertices organized in the vertex buffer and what data they contain.</param> /// <param name="index">Size of indices, use smaller size for better performance, however be careful not to go over /// the number of vertices limited by the size.</param> public Mesh(int numVertices, int numIndices, MeshTopology topology = MeshTopology.TriangleList, MeshUsage usage = MeshUsage.Default, VertexType vertex = VertexType.Position, IndexType index = IndexType.Index32) { SubMesh[] subMeshes = { new SubMesh(0, numIndices, topology) }; Internal_CreateInstance(this, numVertices, numIndices, subMeshes, usage, vertex, 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 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_create2(Mesh managedInstance, MeshData data, SubMesh[] subMeshes, MeshUsage usage);
private static extern void Internal_create1(Mesh managedInstance, MeshData data, MeshTopology topology, MeshUsage usage);
private static extern void Internal_create0(Mesh managedInstance, int numVertices, int numIndices, SubMesh[] subMeshes, MeshUsage usage, VertexLayout vertex, IndexType index);
private static extern void Internal_create(Mesh managedInstance, int numVertices, int numIndices, MeshTopology topology, MeshUsage usage, VertexLayout vertex, IndexType index);
/// <summary> /// Creates a new mesh with enough space to hold the a number of primitives using the specified layout. Indices can /// be references by multiple sub-meshes. /// </summary> /// <param name="numVertices">Number of vertices in the mesh.</param> /// <param name="numIndices">Number of indices in the mesh. </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> /// <param name="vertex">Controls how are vertices organized in the vertex buffer and what data they contain.</param> /// <param name="index">Size of indices, use smaller size for better performance, however be careful not to go over /// the number of vertices limited by the size.</param> public Mesh(int numVertices, int numIndices, SubMesh[] subMeshes, MeshUsage usage = MeshUsage.Default, VertexType vertex = VertexType.Position, IndexType index = IndexType.Index32) { Internal_CreateInstance(this, numVertices, numIndices, subMeshes, usage, vertex, 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.Static) { Internal_create1(this, data, topology, usage); }
private static extern void Internal_CreateInstanceMeshData(Mesh instance, IntPtr data, SubMesh[] subMeshes, MeshUsage usage);
private static extern void Internal_CreateInstance(Mesh instance, int numVertices, int numIndices, SubMesh[] subMeshes, MeshUsage usage, 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 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); }
/// <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. All indices will /// be part of a single sub-mesh. /// </summary> /// <param name="numVertices">Number of vertices in the mesh.</param> /// <param name="numIndices"> /// Number of indices in the mesh. Must be a multiple of primitive size as specified by provided topology. /// </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> /// <param name="vertex">Controls how are vertices organized in the vertex buffer and what data they contain.</param> /// <param name="index"> /// Size of indices, use smaller size for better performance, however be careful not to go over the number of vertices /// limited by the data type size. /// </param> public Mesh(int numVertices, int numIndices, MeshTopology topology = MeshTopology.TriangleList, MeshUsage usage = MeshUsage.Static, VertexLayout vertex = VertexLayout.Position, IndexType index = IndexType.Index32) { Internal_create(this, numVertices, numIndices, topology, usage, vertex, index); }
/// <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="numVertices">Number of vertices in the mesh.</param> /// <param name="numIndices"> /// Number of indices in the mesh. Must be a multiple of primitive size as specified by provided topology. /// </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> /// <param name="vertex">Controls how are vertices organized in the vertex buffer and what data they contain.</param> /// <param name="index"> /// Size of indices, use smaller size for better performance, however be careful not to go over the number of vertices /// limited by the data type size. /// </param> public Mesh(int numVertices, int numIndices, SubMesh[] subMeshes, MeshUsage usage = MeshUsage.Static, VertexLayout vertex = VertexLayout.Position, IndexType index = IndexType.Index32) { Internal_create0(this, numVertices, numIndices, subMeshes, usage, vertex, index); }
/// <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 with enough space to hold the a number of primitives using the specified layout. All indices /// will be part of a single sub-mesh. /// </summary> /// <param name="numVertices">Number of vertices in the mesh.</param> /// <param name="numIndices">Number of indices in the mesh. </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> /// <param name="vertex">Controls how are vertices organized in the vertex buffer and what data they contain.</param> /// <param name="index">Size of indices, use smaller size for better performance, however be careful not to go over /// the number of vertices limited by the size.</param> public Mesh(int numVertices, int numIndices, MeshTopology topology = MeshTopology.TriangleList, MeshUsage usage = MeshUsage.Default, VertexType vertex = VertexType.Position, IndexType index = IndexType.Index32) { SubMesh[] subMeshes = {new SubMesh(0, numIndices, topology)}; Internal_CreateInstance(this, numVertices, numIndices, subMeshes, usage, vertex, index); }