Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
camera.hpp File Reference

The camera, as three angles and a distance. More...

Go to the source code of this file.

Classes

class  orrery::viz::OrbitCamera
 A camera that orbits a point. More...

Detailed Description

The camera, as three angles and a distance.

An orbit camera rather than a free one. It holds a point it is looking at, a distance from that point, and two angles about it, and every control moves one of those four numbers. A free camera, with an arbitrary position and orientation, is more general and is the wrong tool here: what someone looking at a galaxy collision wants is to go round it and look closer, and a camera that can also roll and fly off into empty space mostly offers new ways to lose the thing being examined.

It is also what makes the offline export reproducible. Four numbers, three of which are angles, can be written on a command line and produce the same frame on any machine. A position and a quaternion cannot be typed by anyone.

Why this holds no OpenGL

Nothing in this file or its implementation calls a graphics function, so the camera builds and is tested in a build with no renderer at all. That matters for more than tidiness: the projection is where an off-by-one in a sign convention hides, and a bug there shows up as a black window rather than as a message, which is the worst kind of thing to debug through a device driver. Here it is a function from four numbers to sixteen, and the tests treat it as one.