feat(app): extract ICamera interface from OrbitCamera
Introduce ICamera (View, Projection, Aspect) and make OrbitCamera implement it. TerrainRenderer.Draw and StaticMeshRenderer.Draw now accept ICamera, widening the call-site contract while leaving all runtime behavior unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
560100e5b6
commit
5640c153f3
4 changed files with 13 additions and 3 deletions
10
src/AcDream.App/Rendering/ICamera.cs
Normal file
10
src/AcDream.App/Rendering/ICamera.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using System.Numerics;
|
||||
|
||||
namespace AcDream.App.Rendering;
|
||||
|
||||
public interface ICamera
|
||||
{
|
||||
Matrix4x4 View { get; }
|
||||
Matrix4x4 Projection { get; }
|
||||
float Aspect { get; set; }
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ using System.Numerics;
|
|||
|
||||
namespace AcDream.App.Rendering;
|
||||
|
||||
public sealed class OrbitCamera
|
||||
public sealed class OrbitCamera : ICamera
|
||||
{
|
||||
public Vector3 Target { get; set; } = new(96, 96, 0); // center of a 192x192 landblock
|
||||
public float Distance { get; set; } = 300f;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public sealed unsafe class StaticMeshRenderer : IDisposable
|
|||
};
|
||||
}
|
||||
|
||||
public void Draw(OrbitCamera camera, IEnumerable<WorldEntity> entities)
|
||||
public void Draw(ICamera camera, IEnumerable<WorldEntity> entities)
|
||||
{
|
||||
_shader.Use();
|
||||
_shader.SetMatrix4("uView", camera.View);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public sealed unsafe class TerrainRenderer : IDisposable
|
|||
_landblocks.Add(gpu);
|
||||
}
|
||||
|
||||
public void Draw(OrbitCamera camera) // ICamera in Task 5
|
||||
public void Draw(ICamera camera)
|
||||
{
|
||||
_shader.Use();
|
||||
_shader.SetMatrix4("uView", camera.View);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue