/************************************************************************* FILE: Sun.cc The Sun class handling the creation, movement, and display of the class, plus all the configurable settings. Author: Dana Vrajitoru, IUSB Class: C481 B581 Computer Graphics **************************************************************************/ //#include #include "glheader.h" #include "Sun.h" #include "Earth.h" #include using namespace std; // Constructor : initialize the default values and initialize the // display list for the Sun. Sun::Sun() : Celestial(0.5) { // redefine the color thisR = 1.0; thisG = 1.0; thisB = 0.2; // add one child nrChildren = 1; children = new CelestialPtr[nrChildren]; // the earth children[0] = new Earth(); initDisplayList(); } // initialize the content of the display list, as a sphere for the sun // and a reference disc so that we can see the what's happening void Sun::initDisplayList() { GLUquadricObj *obj; obj = gluNewQuadric(); gluQuadricDrawStyle(obj, GLU_LINE); gluQuadricNormals(obj, GLU_FLAT); // Create the display list. glNewList(thisId, GL_COMPILE); glColor3f(thisR, thisG, thisB); // The sun itself. glutSolidSphere(radius, 10, 10); // A reference disk so we can see what's going on. glPushMatrix(); glColor3f(0.4, 0.3, 0.6); glRotatef(90, 1.0, 0, 0); gluDisk(obj, 0, 40.0, 20, 20); glPopMatrix(); glEndList(); }