feat: modular HAL, Raylib backend, PBR shading, textures, 60 unit tests

- 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
This commit is contained in:
emil28092005
2026-06-17 13:49:12 +03:00
parent 61f8c7065e
commit fb6e26a268
62 changed files with 22259 additions and 395 deletions
@@ -0,0 +1,48 @@
#version 450
layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec3 inColor;
layout(location = 2) in vec3 inNormal;
layout(location = 0) out vec3 fragColor;
layout(location = 1) out vec3 fragNormal;
layout(location = 2) out vec3 fragWorldPos;
layout(location = 3) out vec2 fragUv;
struct Light
{
vec3 direction;
float intensity;
vec3 color;
float _pad;
};
layout(set = 0, binding = 0) uniform FrameConstants
{
vec3 cameraPosition;
uint lightCount;
vec3 ambientColor;
float _pad;
Light lights[4];
} frame;
layout(push_constant) uniform PushConstants
{
mat4 mvp;
vec3 materialAlbedo;
float materialRoughness;
float materialMetallic;
uint useTexture;
uint textureIndex;
uint _pad0;
uint _pad1;
} push;
void main()
{
gl_Position = push.mvp * vec4(inPosition, 1.0);
fragColor = inColor;
fragNormal = inNormal;
fragWorldPos = inPosition;
fragUv = inPosition.xz * 0.5 + 0.5;
}