samples: add Hello/Demo samples for most BRUTAL packages (#19)

Add samples/, a collection of single-file .NET 10 apps run with
`dotnet run <file>.cs`. Hello/ has one minimal sample per package
that has a public API, many of them headless; Demo/ has fuller
programs that combine packages into a more interesting application.

samples/README.md indexes every sample and covers the layout, error
handling and per-OS requirements.
This commit is contained in:
Rian Drake 2026-10-27 09:10:25 +13:00 • committed by GitHub
commit 7a3b72d843
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,29 @@
/*
* HelloRenderMesh
*
* Generates a procedural sphere mesh and prints its vertex and triangle counts.
*/
#:package Ahwoo.Brutal.Render.Mesh@2026.10.1
#:package Ahwoo.Brutal.Collections@2026.10.1
#:package Ahwoo.Brutal.Core@2026.10.1
#:package Ahwoo.Brutal.Numerics@2026.10.1
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");
}