mElite 06: How to become a pilot

Download the class camera.cpp and the relative header file camera.h. Using this class you can move the perspective camera as a hypothetical pilot drive a spaceship.
>>Here<< is a possible solution that uses this class. You can compile it with the following Makefile2 (you have to substitute the old Makefile renaming Makefile2 in Makefile). For compiling you need camera.cpp, camera.h, coriolis.h, eliteutils.h, and eliteutils.c in the same directory.

In this version there are new details:

  • culling of back faces has been enabled (speed bar adjustment, i.e. QUADS)
  • z buffering has been enabled
  • using arrow keys you can change pitch and roll angles.
  • changing speed cause your spaceship moves (in the animate function there is the camera advancing proportional to the elapsed time from the last rendering)
  • the usage of "q" and "w" keys permit a controlled movement
  • a sight is added using orthographic projection and the function drawSight defined in the new eliteutils.c and eliteutils.h
  • the mapping between radar and 3D world is changed because camera moves in a different way, the movement is rotational and not translational any more. So, we can rotate our spaceship so much that the planet can be behind us: if the planet is in front of us in the radar it will be a green point otherwise it will be red.