enviro.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2002-2003  Etienne Lachance
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2 of the License, or
00007 (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 
00019 Report problems and direct all questions to:
00020 
00021 email: etienne.lachance@polymtl.ca or richard.gourdeau@polymtl.ca
00022 */
00023 
00024 
00025 #ifndef ENVIRO_H
00026 #define ENVIRO_H
00027 
00033 
00034 static const char header_enviro_rcsid[] = "$Id: enviro.h,v 1.7 2005/09/16 19:22:34 gourdeau Exp $";
00035 
00036 #include "wx/glcanvas.h"
00037 #if defined(__APPLE__) && defined(__MACH__)
00038 #include <OpenGL/glu.h> /* Header File For The GLU Library */
00039 #else
00040 #include <GL/glu.h>
00041 #endif
00042 
00043 # ifdef _MSC_VER
00044 #  pragma warning (disable:4244)  // Disable bogus VC++ 4.2 conversion warnings. 
00045 #  pragma warning (disable:4305)  // VC++ 5.0 version of above warning. 
00046 #  pragma warning (disable:4786)  // Disable decorated name truncation warnings 
00047 #  pragma warning (disable:4663)  // Disable some warnings 
00048 # endif
00049 #include <cstdlib>
00050 #include <cmath>
00051 #include <iostream>
00052 #include <string>
00053 #include <vector>
00054 #include "robot.h"
00055 #include "utils.h"
00056 
00057 
00058 // Color definitions
00059 const GLfloat 
00060  rgb_red[]         = { 1.00, 0.00, 0.00 }
00061 ,rgb_green[]       = { 0.00, 1.00, 0.00} 
00062 ,rgb_blue[]        = { 0.00, 0.00, 1.00 }
00063 ,rgb_white[]       = { 1.00, 1.00, 1.00 }
00064 ,rgb_black[]       = { 0.00, 0.00, 0.00 }
00065 ,rgb_corn[]        = { 0.77, 0.73, 0.38 }
00066 ,rgb_light_brown[] = { 0.73, 0.32, 0.08 }
00067 ,rgb_blue_gray[]   = { 0.39, 0.44, 0.74 }
00068 ,rgb_light_gray[]  = { 0.58, 0.61, 0.66 }
00069 ,rgb_dark_gray[]   = { 0.30, 0.30, 0.30 }
00070 ,rgb_yellow[]      = { 1.00, 1.00, 0.00 }
00071 ,rgb_purple[]      = { 1.00, 0.00, 1.00 }
00072 ,rgb_cyan[]        = { 0.00, 1.00, 1.00 }
00073 ;
00074 
00075 // Light definitions
00076 const GLfloat ambient[]        = { 0.0, 0.0, 0.0, 1.0 }
00077 ,diffuse[]        = { 1.0, 1.0, 1.0, 1.0 }
00078 ,specular[]       = { 1.0, 1.0, 1.0, 1.0 }
00079 ,light_position[] = { 100.0, 100.0, 200.0, 0.0 }
00080 ,lmodel_ambient[] = { 0.4, 0.4, 0.4, 1.0 }
00081 ,local_view[]     = { 0.0 }
00082 ;
00083 
00084 const GLfloat no_mat[]            = { 0.0, 0.0, 0.0, 1.0 }
00085 ,mat_ambient[]       = { 0.7, 0.7, 0.7, 1.0 }
00086 ,mat_ambient_color[] = { 0.8, 0.8, 0.2, 1.0 }
00087 ,mat_diffuse[]       = { 0.1, 0.5, 0.8, 1.0 }
00088 ,mat_specular[]      = { 1.0, 1.0, 1.0, 1.0 }
00089 ,no_shininess[]      = { 0.0 }
00090 ,low_shininess[]     = { 5.0 }
00091 ,high_shininess[]    = { 100.0 }
00092 ,mat_emission[]      = {0.3, 0.2, 0.2, 0.0}
00093 ;
00094 
00095 // a enlever.
00096 const GLfloat mat_red_spec[] = {1.0, 0.0, 0.0};
00097 const GLfloat mat_grr_spec[] = {0.0, 1.0, 0.0};
00098 const GLfloat mat_blu_spec[] = {0.0, 0.0, 1.0};
00099 const GLfloat mat_shininess[] = {50.0};
00100 const GLfloat ambient_light[] = {0.3, 0.3, 0.3, 1.0};
00101 const GLfloat diffuse_light[] = {0.5, 0.5, 0.5, 1.0};
00102 const GLfloat position_of_light[] = {00.0, 200.0, 00.0, 0.0};
00103 
00104 // -------------------------------------------------------------------------
00105 
00106 //const float PI = 3.14159265358979;
00107 
00108 inline short sign(const double val){ return (val >= 0 ? 1 : -1); }
00109 
00110 // -------------------------------------------------------------------------
00111 
00119 class Basic_object
00120 {
00121 public:
00122    Basic_object();
00123    Basic_object(const ColumnVector & position);
00124    Basic_object(const Basic_object & x);
00125    Basic_object & operator=(const Basic_object & x);
00126    void draw();
00127    void error(const std::string & message);
00128 
00129    ColumnVector position; 
00130    string message_object; 
00131    GLuint listName;       
00132 };
00133 
00141 class Room : public Basic_object
00142 {
00143 public:
00144    Room();
00145    Room(float square_Size, int squares_NbPerSide);
00146    Room(const Room & x);
00147    ~Room();
00148    static Room* Instance();
00149    Room & operator=(const Room & x);
00150    void create_list();
00151 
00152    float get_room_width(){ return room_width; } 
00153    void draw();
00154 private:
00155 
00156    int squaresNbPerSide;  
00157    float squareSize;      
00158    float room_width;      
00159    static Room *instance; 
00160 };
00161 
00162 
00169 class Axis
00170 {
00171 public:
00172     Axis(const double size);
00173     ~Axis();
00174     void draw();
00175 
00176 private:
00177     double size;            
00178     GLUquadricObj *quadric;  
00179 };
00180 
00187 class Cylinder
00188 {
00189 public:
00190     Cylinder();
00191     ~Cylinder();
00192     void draw(const double radius, const double lenght);
00193 
00194 private:
00195     GLUquadricObj *quadric1; 
00196 };
00197 
00198 #endif

Generated on Fri Feb 9 08:52:20 2007 for GLroboop An OpenGL Robotics Object Oriented Package in C++ by  doxygen 1.5.1