cdeevfrr / Photon

A video game
GNU General Public License v3.0
0 stars 0 forks source link

Camera #1

Closed cdeevfrr closed 2 years ago

cdeevfrr commented 3 years ago

We need a camera that can look at the world, which is a graph of nodes & edges (NOT a 3D linear space).

Most concepts copied from https://learnopengl.com/Getting-started/Camera

Lines are repeating lists of directions, like [up, left] or [forward, left] (forward is [0,0,-1], left is [-1, 0, 0], up is [0,1,0]). So a single line might be represented by [ [1, 0, 0], [0, 1, 0], [1, 0, 0] ] and that would mean "right, up, right; repeating".

Character will have a position & an orientation matrix (by saving a forward direction & an up direction, and right can be computed as normalize(forward.cross(up))), see the link in order to get +- signs / ordering correct. The forward & up vectors will be computed from a saved pitch & yaw number, and mouse movement will directly affect the pitch & yaw. Keypresses will change position.