mElite 07: Let's switch on the light

Download the new version of eliteutils.h and eliteutils.c. Here is the new version of drawEliteObject (called drawEliteObject2) used to draw coriolis using lighting with the Non-Photorealistic Rendering (NPR).

Our new version of mElite has to use lighting. New features to add (emphasised in the the proposed solution code with the word "NEW" in the comments) are:

  • set general light properties
  • draw a sun in the galaxy and add a light source in it
  • modify in a proper way the planet drawing using material properties
  • use two controlled light sources for the NPR of the satelitte. Lights settings (you can find a possible setup in the initgfx() procedure of the proposed solution) are suggested in the following paper:
    "Non-Photorealistic Lighting Model For Automatic Technical Illustration"
    A. Gooch, B. Gooch, P. Shirley, and E. Cohen, SIGGRAPH 1998.
  • use polygon offset in order to draw the opening in the satellite (check in the new drawEliteObject2 for details)
  • disable lighting, depth buffering, culling during the control pannel drawing
>>Here<< is a possible solution. You can compile it with the Makefile used for melite6b.c. Obviously, as for the previous version, for compiling you need camera.cpp, camera.h, coriolis.h, eliteutils.h, and eliteutils.c in the same directory.