Render Graph concept started!
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user