Class Mesh
Immutable indexed triangle geometry. Counterclockwise vertices face outward; both sides render by default.
Inherited Members
Namespace: Simple3D.Core
Assembly: Simple3D.Core.dll
Syntax
public sealed class Mesh
Constructors
| Edit this page View SourceMesh(IEnumerable<Vector3>, IEnumerable<int>)
Copies and validates finite vertices, index ranges and nondegenerate triangles. Empty meshes are allowed. Triangles whose single-precision area overflows or underflows are rejected.
Declaration
public Mesh(IEnumerable<Vector3> vertices, IEnumerable<int> indices)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Vector3> | vertices | |
| IEnumerable<int> | indices |
Mesh(IEnumerable<Vector3>, IEnumerable<int>, IEnumerable<Vector2>?, IEnumerable<Vector3>?, IEnumerable<uint>?)
Copies geometry and optional per-vertex attributes. Supplied attribute counts must match the vertex count.
Declaration
public Mesh(IEnumerable<Vector3> vertices, IEnumerable<int> indices, IEnumerable<Vector2>? textureCoordinates = null, IEnumerable<Vector3>? normals = null, IEnumerable<uint>? colors = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Vector3> | vertices | |
| IEnumerable<int> | indices | |
| IEnumerable<Vector2> | textureCoordinates | |
| IEnumerable<Vector3> | normals | |
| IEnumerable<uint> | colors |
Fields
| Edit this page View SourceMaximumElements
Maximum number of vertices or triangles accepted in one mesh.
Declaration
public const int MaximumElements = 1000000
Field Value
| Type | Description |
|---|---|
| int |
Properties
| Edit this page View SourceColors
Optional opaque ARGB vertex colors, multiplied by material color and texture.
Declaration
public IReadOnlyList<uint>? Colors { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<uint> |
Indices
Copied vertex indices, three per triangle.
Declaration
public IReadOnlyList<int> Indices { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<int> |
Normals
Optional normalized local-space normals, one per vertex. Presence enables Gouraud smooth lighting.
Declaration
public IReadOnlyList<Vector3>? Normals { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<Vector3> |
TextureCoordinates
Optional UV coordinates, one per vertex; origin is bottom-left.
Declaration
public IReadOnlyList<Vector2>? TextureCoordinates { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<Vector2> |
TriangleCount
Number of triangles.
Declaration
public int TriangleCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Vertices
Copied vertices in local coordinates.
Declaration
public IReadOnlyList<Vector3> Vertices { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<Vector3> |
Methods
| Edit this page View SourceWithCalculatedNormals()
Returns a copy with area-weighted normals averaged at shared indices. Split vertices retain hard edges. Unused or cancelling vertices use +Z.
Declaration
public Mesh WithCalculatedNormals()
Returns
| Type | Description |
|---|---|
| Mesh |