Class Mesh
Represents a mesh for the rendering pipeline
public class Mesh : IGraphicsResource, IIdentifier, ISerialization
- Inheritance
-
Mesh
- Implements
- Inherited Members
Constructors
Mesh()
Initializes a new instance of the Mesh class with default values for vertices, indices, transformation, and render data.
public Mesh()
Remarks
The new Mesh instance starts with empty vertex and index collections, identity transformation (no translation or rotation, unit scale), and a default RenderData object. Use the properties to configure the mesh as needed before rendering or processing.
Properties
Bounds
Gets the axis-aligned bounding box that defines the spatial boundaries of the object.
public AABB Bounds { get; }
Property Value
ID
The unique identifier of the mesh.
public Guid ID { get; }
Property Value
Indices
The indices of the mesh.
public List<int> Indices { get; set; }
Property Value
IsInitialized
Gets a value indicating whether the object has been initialized.
public bool IsInitialized { get; }
Property Value
LocalRotation
the local rotation of the mesh.
public Quaternion LocalRotation { get; set; }
Property Value
LocalScale
The local scale of the mesh.
public Vector3 LocalScale { get; set; }
Property Value
LocalTranslation
The local translation of the mesh.
public Vector3 LocalTranslation { get; set; }
Property Value
Material
Material used by the mesh.
public IMaterial Material { get; set; }
Property Value
Name
The name of the mesh.
public string Name { get; set; }
Property Value
Positions
Gets or sets the collection of 3D positions associated with this instance.
public List<Vector3> Positions { get; set; }
Property Value
RenderData
The render data associated with the mesh.
public RenderData RenderData { get; set; }
Property Value
Vertices
The vertices of the mesh.
public List<Vertex> Vertices { get; set; }
Property Value
Methods
Deserialize(JObject, SerializationContext, Func<JObject, bool>)
Populates the current object with values from the specified JSON object.
public void Deserialize(JObject obj, SerializationContext serializationContext, Func<JObject, bool> callback = null)
Parameters
objJObjectserializationContextSerializationContextcallbackFunc<JObject, bool>
Dispose(IRenderDevice)
Releases the resources associated with this mesh using the specified render device.
public void Dispose(IRenderDevice renderer)
Parameters
rendererIRenderDeviceThe render device used to dispose of the mesh resources. Cannot be null.
Remarks
After calling this method, the mesh is no longer initialized and should not be used in rendering operations.
FreeCPUResources()
Free any CPU resources that are currently allocated by the mesh.
public void FreeCPUResources()
GetTransform()
Calculates the local transformation matrix by combining the current scale, rotation, and translation values.
public Matrix4 GetTransform()
Returns
- Matrix4
A Matrix4 representing the local transformation composed of scale, rotation, and translation, applied in that order.
Remarks
The resulting matrix applies scaling first, then rotation, and finally translation. This order affects how objects are transformed in local space. The method does not account for any parent transformations; it only reflects the local transform.
Init(IRenderDevice)
Initializes the mesh by loading it into the specified render device.
public void Init(IRenderDevice renderer)
Parameters
rendererIRenderDeviceThe render device used to load and initialize the mesh. Cannot be null.
Serialize(JsonWriter, SerializationContext, Action<JsonWriter>)
Serializes the current object to a new JSON object representation.
public void Serialize(JsonWriter writer, SerializationContext serializationContext, Action<JsonWriter> callback = null)
Parameters
writerJsonWriterserializationContextSerializationContextcallbackAction<JsonWriter>