Currently, we only have the PerspectiveCamera component which holds parameters such as the field of view.
This means that all code which depends on camera projection matrices needs to recalculate the camera's projection matrix, which leads to a lot of code duplication.
Eventually we'll also want to provide an OrtographicCamera, and thus this coupling would really be a problem.
Solution
We should have a Camera component, which holds only the projection matrix of a camera.
Then, when a PerspectiveCamera is added to an entity, a Camera component is automatically inserted.
Then, every frame, a system updates the Camera's projection matrix to reflect the current fields in the PerspectiveCamera.
We should search for all places accessing the PerspectiveCamera component and switch them for the generic Camera component where possible.
Problem
Currently, we only have the
PerspectiveCamera
component which holds parameters such as the field of view. This means that all code which depends on camera projection matrices needs to recalculate the camera's projection matrix, which leads to a lot of code duplication. Eventually we'll also want to provide anOrtographicCamera
, and thus this coupling would really be a problem.Solution
We should have a
Camera
component, which holds only the projection matrix of a camera. Then, when aPerspectiveCamera
is added to an entity, aCamera
component is automatically inserted. Then, every frame, a system updates theCamera
's projection matrix to reflect the current fields in thePerspectiveCamera
.We should search for all places accessing the
PerspectiveCamera
component and switch them for the genericCamera
component where possible.