/* 
   Project: coevolutionary GP moto driving
   Dana Vrajitoru
   driver_geometry.h
   
   The geometry of the driver.
  
*/
   
#ifndef DRIVER_GEOMETRY_H
#define DRIVER_GEOMETRY_H

#include <GL/glut.h>
#include "gl_draw.h"

class Driver_geometry {
 protected:
  GLuint hand_id, forearm_id, arm_id, hips_id, shoulders_id,
    head_id, thigh_id, leg_id, foot_id;

  int precision;

  GLfloat r, g, b;

  float height,  head_length, head_width, head_pos, neck_radius,
    legs_size, thigh_length, calf_length, hips_width, throat_hollow,
    knee_radius, foot_hight, foot_length, forearms_size, arms_size, 
    hand_length, hand_width, shoulders_width, body_size, neck_size, waist;

 public:
  // Default constructor. Since it initializes the id for the display
  // lists with calls to gl functions, it should not be invoked before
  // gl is initialized because it would generate a segmentation fault.
  Driver_geometry(float size=5);

  // Destructor. It should delete all of the display lists.
  ~Driver_geometry();

  // Set the ids of the display lists in case we have more than one
  // driver. Get them from gl so that we know for sure that each
  // display list has a different available id.
  void set_ids();

  // Set the dimensions of the human body considering that the head is
  // 1/7 of the whole body length and other proportions follow from
  // that.
  void set_dimensions();

  // Set the precision.
  void set_precision(int value=2);

  // Set the color of the driver.
  void set_color(float rv=1.0, float gv=0.5, float bv=0.5);

  // Calls the OpenGL commands to draw the head. Not intended for use by
  // itself.
  void head();
  // The middle part of the body.
  void shoulders();
  void hips();
  void forearm();
  void arm();
  void hand();
  void thigh();
  void calf();
  void foot();

  // Builds the display lists.
  virtual void draw();

  // Calls the display lists.
  virtual void display();
};

#endif
