//   A derived class implementing minigl using cs4731GL
//   Copyright (C) 1999,2000  Mark R. Stevens
//
//   This program is free software; you can redistribute it and/or modify
//   it under the terms of the GNU General Public License as published by
//   the Free Software Foundation; either version 2 of the License, or
//   (at your option) any later version.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program; if not, write to the Free Software
//   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
//
//   Modifications by:
//      Jesse Carney Johnson <penguin@WPI.EDU>

//   CS4731: The goal is to derive a class from this base class and
//   implement different components throughout the course.

#ifndef CS4731GL
#define CS4731GL

// The base class
#include "minigl.h" 

// MiniGL class definition
class cs4731GL : public minigl {                    

public:
  
  // Constructor
  cs4731GL();
  
  // Destructor
  virtual ~cs4731GL();

  // Specifies a symbolic value representing a shading technique.
  // Accepted values are MGL_FLAT and MGL_SMOOTH.  The initial value
  // is MGL_SMOOTH.
  virtual void mglShadeModel(MGLenum type);

  // Specifies the primitive or primitives that will be created from
  // vertices presented between glBegin and the subsequent glEnd.  Ten
  // symbolic constants are accepted: MGL_TRIANGLES, MGL_TRIANGLE_STRIP,
  // MGL_TRIANGLE_FAN, MGL_QUADS, MGL_QUAD_STRIP, and MGL_POLYGON.
  virtual void mglBegin(MGLenum type);
  virtual void mglEnd  ();

  // Bitwise OR of masks that indicate the buffers to be cleared.  The
  // masks are MGL_COLOR_BUFFER_BIT, MGL_DEPTH_BUFFER_BIT.
  virtual void mglClearColor(float r, float g, float b, float a);
  virtual void mglClear(unsigned int type);
 
  // Specify the x, y, and z coordinates of the new current normal.
  // The initial value of the current normal is the unit vector, (0,
  // 0, 1).
  virtual void mglNormal3f(float nx, float ny, float nz);

  // Specify x, y, z, and w coordinates of a vertex.  Not all
  // parameters are present in all forms of the command.
  virtual void mglVertex3f(float x, float y, float z);

  // There is a stack of matrices for each of the matrix modes.  In
  // MGL_MODELVIEW mode, the stack depth is at least 32.  In the other
  // two modes, MGL_PROJECTION, the depth is at least 2.  The current
  // matrix in any mode is the matrix on the top of the stack for that
  // mode.  glPushMatrix pushes the current matrix stack down by one,
  // duplicating the current matrix.  That is, after a glPushMatrix
  // call, the matrix on top of the stack is identical to the one
  // below it.
  virtual void mglPushMatrix();  
  virtual void mglPopMatrix ();  

  // Specifies the angle of rotation, in degrees.  Specify the x, y,
  // and z coordinates of a vector, respectively.
  virtual void mglRotatef(float angle, float x, float y, float z);

  // Specify the x, y, and z coordinates of a translation vector.
  virtual void mglTranslatef(float x, float y, float z);

  // Specify the x, y, and z factors of a scale vector.
  virtual void mglScalef(float x, float y, float z);

  // Specifies which face being updated.  Must be one of MGL_FRONT,
  // MGL_BACK, or MGL_FRONT_AND_BACK.  pname Specifies the single-valued
  // material parameter of the face or faces that is being updated.
  // Must be MGL_SHININESS.  param Specifies the value that parameter
  // MGL_SHININESS will be set to.
  virtual void mglMaterialf(MGLenum type, 
			    MGLenum pname, 
			    float red, 
			    float green, 
			    float blue, 
			    float alpha);

  // specify the color of the surface. This is to be done when we are
  // dealing with scenes without lighting.
  virtual void mglColor3f(float r, float g, float b);

  // Set the viewport. x, y Specify the lower left corner of the
  // viewport rectangle, in pixels. The initial value is (0,0).
  // width, height Specify the width and height of the viewport.  When
  // a GL context is first attached to a window, width and height are
  // set to the dimensions of that window.
  virtual void mglViewport(int x, int y, int width, int height);

  // Specifies which matrix stack is the target for subsequent matrix
  // operations.  Two values are accepted: GL_MODELVIEW and
  // GL_PROJECTION.  The initial value is GL_MODELVIEW.
  virtual void mglMatrixMode(MGLenum type);

  // glLoadIdentity replaces the current matrix with the identity
  // matrix.
  virtual void mglLoadIdentity();

  // Multiply the current matrix by a perspective matrix.  left, right
  // Specify the coordinates for the left and right vertical clipping
  // planes.  bottom, top Specify the coordinates for the bottom and
  // top horizontal clipping planes.  zNear, zFar Specify the
  // distances to the near and far depth clipping planes.  Both
  // distances must be positive.
  virtual void mglFrustum(float left, 
			  float right, 
			  float bottom, 
			  float top, 
			  float zNear, 
			  float zFar);  
  virtual void mglOrtho  (float left,
			  float right,
			  float bottom,
			  float top, 
			  float zNear, 
			  float zFar);

  // Enable or disable server-side GL capabilities.  cap Specifies a
  // symbolic constant indicating a GL capability.
  virtual void mglEnable (MGLenum cap);
  virtual void mglDisable(MGLenum cap);

  // Set light source parameters.  light Specifies a light.  The
  // number of lights depends on the implementation, but at least
  // eight lights are supported.  They are identified by symbolic
  // names of the form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS.  pname
  // Specifies a single-valued light source parameter for light.
  // GL_SPOT_EXPONENT, GL_SPOT_CUTOFF, GL_CONSTANT_ATTENUATION,
  // GL_LINEAR_ATTENUATION, and GL_QUADRATIC_ATTENUATION are accepted.
  // param Specifies the value that parameter pname of light source
  // light will be set to.
  virtual void mglLightf(MGLenum num, 
			 MGLenum pname, 
			 float x, 
			 float y, 
			 float z, 
			 float w);


  // Turn on backface culling
  virtual void mglCullFace  (MGLenum type);

  // finish rendering
  virtual void mglFinish();

  // Turn on backface culling
  virtual void mglPointSize  (float type);
  virtual void mglOrtho2D  (float w, float x, float y, float z);
  virtual void mglVertex2i(int x, int y);
  virtual void mglVertex3d(double x, double y, double z);
  virtual void mglTranslated(double x, double y, double z);
  
  // wireframe model calls
  virtual void mglutWireCone(double x, double y, double z, double w);
  virtual void mglutWireCube(double side);
  virtual void mglutWireSphere(double x, double y, double z);
  virtual void mglutWireTeapot(double size);
  virtual void mglutWireTorus(double x, double y, double z, double w);
  virtual void mglutWireDodecahedron();
  
  // solid model calls
  virtual void mglutSolidCone(double x, double y, double z, double w);
  virtual void mglutSolidCube(double side);
  virtual void mglutSolidSphere(double x, double y, double z);
  virtual void mglutSolidTeapot(double size);
  virtual void mglutSolidTorus(double x, double y, double z, double w);
  virtual void mglutSolidDodecahedron();
  
  virtual void mgluLookAt(double ex, double ey, double ez, double lx, double ly, double lz, double ux, double uy, double uz);
  virtual void mglColor3d(double r, double g, double b);
  virtual void mglRotated(double angle, double x, double y, double z);
  virtual void mglScaled(double x, double y, double z);

  virtual void mglLightfv(MGLenum num, MGLenum pname, float components[]);
  virtual void mglMaterialfv(MGLenum type, MGLenum pname, float components[]);

};

#endif






