When calling the Renderer, we transmit this CameraMatrix to be used for rendering
This way, an Element can be a Camera, use input events and messaging to move it, etc.
Furthermore, we can have different Cameras. They just need to figure out who is active.
This would also, technically at least, allow for different kinds of Cameras.
If I am not mistaken, it shouldn't matter if it's a Perspective or OrthogonalCamera, the resulting Matrix will be in the same format and will be used the same by the Shader.
Note: Fact check the above! No idea if actually true.
There might be some access issues as the CameraMatrix actually is a Buffer(?) we have to share with the Renderer.
There might be some caching we can do though, like keep a Matrix inside e.g. World and only update the Buffer when there is a change.
Or, let the Renderer take care of the Buffer and inform it when there is a change in the Matrix.
The idea would be the following:
World
(?) have aCamera
MatrixWorldChange
(?)Renderer
, we transmit thisCamera
Matrix to be used for renderingThis way, an
Element
can be aCamera
, use input events and messaging to move it, etc.Furthermore, we can have different
Cameras
. They just need to figure out who is active.This would also, technically at least, allow for different kinds of
Cameras
. If I am not mistaken, it shouldn't matter if it's a Perspective or OrthogonalCamera
, the resulting Matrix will be in the same format and will be used the same by theShader
.There might be some access issues as the
Camera
Matrix actually is aBuffer
(?) we have to share with theRenderer
. There might be some caching we can do though, like keep a Matrix inside e.g.World
and only update theBuffer
when there is a change. Or, let theRenderer
take care of theBuffer
and inform it when there is a change in the Matrix.Whatever makes more sense and works best.