- Replace hardcoded SDL3 windowing with IWindow/IInputState/Key abstractions - Each render backend owns its window (Raylib GLFW, SDL3 for Vulkan) - Raylib backend: DrawModelEx, custom GLSL shader with Fresnel, ACES tonemapping, gamma correction, hemisphere ambient - Fix backface culling, mesh memory (NativeMemory.Alloc), texture loading - Camera controllers use backend-agnostic Key enum (inverted yaw/strafe) - Demo scene: 8 cubes, 7 spheres, torus knot OBJ with checker texture - Extract ProceduralMesh + MeshMath from Program.cs to Engine.Graphics - Vulkan backend deferred (compiles, untested, IWindow-compatible) - 60 unit tests: ObjLoader, camera controllers, AiCommandProcessor, RenderBackendFactory, Timing, ProceduralMesh, MeshMath, Transform - AGENTS.md for opencode integration
41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using System.Numerics;
|
|
using Engine.Core;
|
|
using Engine.Core.Components;
|
|
|
|
namespace Engine.Tests;
|
|
|
|
public class MeshAndLightTests
|
|
{
|
|
[Fact]
|
|
public void Mesh_Stores_Vertices_And_Indices()
|
|
{
|
|
var vertices = new[]
|
|
{
|
|
new Vertex(new Vector3(0, 0, 0), Vector3.One, Vector3.UnitY),
|
|
new Vertex(new Vector3(1, 0, 0), Vector3.One, Vector3.UnitY),
|
|
new Vertex(new Vector3(1, 1, 0), Vector3.One, Vector3.UnitY),
|
|
};
|
|
var indices = new uint[] { 0, 1, 2 };
|
|
var mesh = new Mesh(vertices, indices);
|
|
|
|
Assert.Equal(3, mesh.Vertices.Length);
|
|
Assert.Equal(3, mesh.Indices.Length);
|
|
}
|
|
|
|
[Fact]
|
|
public void Light_Direction_Is_Normalized()
|
|
{
|
|
var light = new Light(new Vector3(0, 2, 0), Vector3.One, 1.0f);
|
|
|
|
Assert.Equal(1f, light.Direction.Length(), 0.001f);
|
|
}
|
|
|
|
[Fact]
|
|
public void Light_With_Zero_Direction_Defaults_To_UnitY()
|
|
{
|
|
var light = new Light(Vector3.Zero, Vector3.One, 1.0f);
|
|
|
|
Assert.Equal(Vector3.UnitY, light.Direction);
|
|
}
|
|
}
|