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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SimulationTree.Meshes" Version="0.3.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SimulationTree.Meshes" Version="0.3.9" />
                    
Directory.Packages.props
<PackageReference Include="SimulationTree.Meshes" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SimulationTree.Meshes --version 0.3.9
                    
#r "nuget: SimulationTree.Meshes, 0.3.9"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SimulationTree.Meshes@0.3.9
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SimulationTree.Meshes&version=0.3.9
                    
Install as a Cake Addin
#tool nuget:?package=SimulationTree.Meshes&version=0.3.9
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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