feat: PBR point light — Unity-style attenuation, warm glow
- UBO expanded from 64 to 128 bytes: vp(64) + lightPos(16) + lightColor(16) - Vertex shader: passes point light UBO data through - Fragment shader: refactored calcLight() function, shared by directional + point - Point light: Unity-style attenuation pow(1 - dist/range, 2) - Directional light reduced intensity (0.4) to balance with point light - Point light: position (0,8,0), warm color (1,0.9,0.7), intensity 15, range 25 - Renderer: reads Light component from ECS, packs into UBO with Marshal.StructureToPtr - Scene: MainLight entity with Light.Point at (0,8,0) - 0 C# struct changes — pure UBO layout + shader upgrade
This commit is contained in:
@@ -264,6 +264,10 @@ class Program
|
||||
.Set(new Transform(Vector3.Zero, Quaternion.Identity, Vector3.One))
|
||||
.Set(grid);
|
||||
|
||||
world.Entity("MainLight")
|
||||
.Set(new Transform(new Vector3(0, 8, 0), Quaternion.Identity, Vector3.One))
|
||||
.Set(Light.Point(new Vector3(0, 8, 0), new Vector3(1.0f, 0.9f, 0.7f), intensity: 15.0f, range: 25.0f));
|
||||
|
||||
var entityCount = 0;
|
||||
world.Each((Entity e, ref Transform _) => entityCount++);
|
||||
Console.WriteLine($"[Scene] {entityCount} entities: torus knot + 4 dynamic cubes + 3 dynamic spheres + static floor + grid");
|
||||
|
||||
Reference in New Issue
Block a user