SimulationTree.Meshes
0.3.9
Prefix Reserved
dotnet add package SimulationTree.Meshes --version 0.3.9
NuGet\Install-Package SimulationTree.Meshes -Version 0.3.9
<PackageReference Include="SimulationTree.Meshes" Version="0.3.9" />
<PackageVersion Include="SimulationTree.Meshes" Version="0.3.9" />
<PackageReference Include="SimulationTree.Meshes" />
paket add SimulationTree.Meshes --version 0.3.9
#r "nuget: SimulationTree.Meshes, 0.3.9"
#:package SimulationTree.Meshes@0.3.9
#addin nuget:?package=SimulationTree.Meshes&version=0.3.9
#tool nuget:?package=SimulationTree.Meshes&version=0.3.9
Meshes
Data type for storing 3D shapes/geometry.
Usage
Below is an example of building a quad mesh from scratch:
Mesh mesh = new(world);
USpan<Vector3> positions = mesh.CreatePositions(4);
USpan<Vector2> uvs = mesh.CreateUVs(4);
USpan<Vector3> normals = mesh.CreateNormals(4);
positions[0] = new(0, 0, 0);
positions[1] = new(1, 0, 0);
positions[2] = new(1, 1, 0);
positions[3] = new(0, 1, 0);
uvs[0] = new(0, 0);
uvs[1] = new(1, 0);
uvs[2] = new(1, 1);
uvs[3] = new(0, 1);
normals[0] = new(0, 0, 1);
normals[1] = new(0, 0, 1);
normals[2] = new(0, 0, 1);
normals[3] = new(0, 0, 1);
mesh.AddTriangle(0, 1, 2);
mesh.AddTriangle(2, 3, 0);
USpan<uint> indices = quadMesh.GetIndices();
Updating after creation
Whenever arrays of a mesh are modified in length, the version of the mesh increments.
This gives feedback for systems to update when necessary. But for the cases where the
array lengths remain the same and only contents change, the IncrementVersion function
should be used:
USpan<Vector3> positions = mesh.GetPositions();
positions[0] *= 2;
positions[1] *= 2;
positions[2] *= 2;
positions[3] *= 2;
mesh.IncrementVersion();
positions = mesh.ResizePositions(8);
positions[4] = new(0, 0, 0);
positions[5] = new(1, 0, 0);
positions[6] = new(1, 1, 0);
positions[7] = new(0, 1, 0);
//incrementing version is already done
Assembling
Often mesh data is wanted in a specific formats . The Assemble function can be used to
retrieve a flat list of float values containing vertex data in the specified order:
USpan<Mesh.Channel> channels = [Mesh.Channel.Position, Mesh.Channel.UV];
USpan<float> vertexData = stackalloc float[(int)channels.GetVertexSize() * 4];
quadMesh.Assemble(vertexData, channels);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- SimulationTree.Unmanaged.Core (>= 0.3.9)
- SimulationTree.Worlds.Core (>= 0.3.9)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on SimulationTree.Meshes:
| Package | Downloads |
|---|---|
|
SimulationTree.Rendering
Package Description |
|
|
SimulationTree.Meshes.NineSliced
Package Description |
|
|
SimulationTree.Rendering.Systems
Package Description |
|
|
SimulationTree.Models
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.3.9 | 423 | 9/24/2025 |