Made a default template for cameras. Added delta to mouse state so we can check delta for debug Camera.
39 lines
969 B
C++
39 lines
969 B
C++
#pragma once
|
|
|
|
#include <Core/Math/Matrix.h>
|
|
#include <Juliet.h>
|
|
|
|
namespace Juliet
|
|
{
|
|
struct Camera
|
|
{
|
|
index_t Index;
|
|
Vector3 Position;
|
|
Vector3 Target;
|
|
Vector3 Up;
|
|
float FOV; // In radians
|
|
float AspectRatio;
|
|
float NearPlane;
|
|
float FarPlane;
|
|
};
|
|
|
|
inline Matrix Camera_GetViewMatrix(const Camera& cam)
|
|
{
|
|
return LookAt(cam.Position, cam.Target, cam.Up);
|
|
}
|
|
|
|
inline Matrix Camera_GetProjectionMatrix(const Camera& cam)
|
|
{
|
|
return PerspectiveFov(cam.FOV, cam.AspectRatio, cam.NearPlane, cam.FarPlane);
|
|
}
|
|
|
|
inline Matrix Camera_GetViewProjectionMatrix(const Camera& cam)
|
|
{
|
|
return Camera_GetProjectionMatrix(cam) * Camera_GetViewMatrix(cam);
|
|
}
|
|
|
|
JULIET_API extern void ReserveCamera(size_t amount);
|
|
JULIET_API extern Camera* GetCurrentCamera();
|
|
JULIET_API extern void SetCurrentCamera(index_t index);
|
|
} // namespace Juliet
|