Render Graph concept started!

This commit is contained in:
2026-09-21 01:03:16 -07:00
parent 2569eff130
commit 8fbabda095
4 changed files with 380 additions and 30 deletions
+32
View File
@@ -34,4 +34,36 @@ struct MeshComponent {
MeshHandle handle;
};
struct CameraComponent {
struct Orthographic {
float height = 10.f;
float nearPlane = -1.f;
float farPlane = 1.f;
};
struct Perspective {
float fov = glm::radians(60.f);
float nearPlane = 0.1f;
float farPlane = 100.f;
};
enum class Projection { Orthographic, Perspective };
Projection projection = Projection::Orthographic;
Orthographic ortho;
Perspective perspective;
glm::mat4 getProjection(float aspect) const {
if (projection == Projection::Perspective) {
return glm::perspective(perspective.fov, aspect, perspective.nearPlane,
perspective.farPlane);
}
float halfHeight = ortho.height / 2.f;
float halfWidth = halfHeight * aspect;
return glm::ortho(-halfWidth, halfWidth, -halfHeight, halfHeight,
ortho.nearPlane, ortho.farPlane);
}
};
} // namespace sophia