mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Componentified Camera
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using GlitchyEngine.Math;
|
||||
using GlitchyEngine.World;
|
||||
|
||||
namespace GlitchyEngine.Renderer
|
||||
{
|
||||
@@ -36,6 +37,18 @@ namespace GlitchyEngine.Renderer
|
||||
RenderCommand.Init();
|
||||
}
|
||||
|
||||
public static void BeginScene(EcsWorld world, Entity cameraEntity)
|
||||
{
|
||||
var camera = world.GetComponent<CameraComponent>(cameraEntity);
|
||||
var transform = world.GetComponent<TransformComponent>(cameraEntity);
|
||||
|
||||
var trans = transform.Transform;
|
||||
var view = trans.Invert();
|
||||
var proj = camera.Projection;
|
||||
|
||||
_sceneConstants.ViewProjection = proj * view;
|
||||
}
|
||||
|
||||
public static void BeginScene(Camera camera)
|
||||
{
|
||||
_sceneConstants.ViewProjection = camera.ViewProjection;
|
||||
|
||||
Reference in New Issue
Block a user