brutal/samples/Hello/HelloRenderMesh.cs
Rian Drake d1ce547eb2 samples: bump every package pin to the latest release
Fixes #38

Co-authored-by: LesoDeVaren <268139647+LesoDeVaren@users.noreply.github.com>
2026-11-03 11:43:45 +13:00

29 lines
899 B
C#

/*
* HelloRenderMesh
*
* Generates a procedural sphere mesh and prints its vertex and triangle counts.
*/
#:package Ahwoo.Brutal.Render.Mesh@2026.10.2
#:package Ahwoo.Brutal.Collections@2026.10.2
#:package Ahwoo.Brutal.Core@2026.10.4
#:package Ahwoo.Brutal.Numerics@2026.10.2
using Brutal;
using Brutal.Collections;
using Brutal.Numerics;
using Brutal.Render.Mesh;
Run();
static void Run()
{
using var positions = new NativeStrideList(ByteSize.Of<float3>(), 0);
using var normals = new NativeStrideList(ByteSize.Of<float3>(), 0);
using var indices = new NativeStrideList(ByteSize.Of<int>(), 0);
var sphere = new ProcGenMesh(positions, indices, normals);
ProcGenMeshLibrary.GenerateSphere(sphere, origin: float3.Zero, radius: 1.0f, resolution: 16);
Console.WriteLine($"Generated a sphere with {sphere.VertexCount} vertices and {sphere.IndexCount / 3} triangles");
}