Back to index

extremetuxracer  0.5beta
pp_types.h
Go to the documentation of this file.
00001 /* 
00002  * PPRacer 
00003  * Copyright (C) 2004-2005 Volker Stroebel <volker@planetpenguin.de>
00004  *
00005  * Copyright (C) 1999-2001 Jasmin F. Patry
00006  * 
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  * 
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020  */
00021 
00022 #ifndef _PP_TYPES_H_
00023 #define _PP_TYPES_H_
00024 
00025 #include "etracer.h"
00026 
00027 #include "ppgltk/alg/color.h"
00028 #include "ppgltk/alg/vec2d.h"
00029 #include "ppgltk/alg/vec3d.h"
00030 #include "ppgltk/alg/matrix.h"
00031 
00032 typedef struct {
00033     pp::Vec3d p[3];
00034     pp::Vec2d t[3];
00035 } triangle_t;
00036 
00038 typedef struct { 
00039     pp::Vec3d pt;
00040     pp::Vec3d vec;
00041 } ray_t;
00042 
00044 typedef struct {
00045     pp::Color diffuse;
00046     pp::Color specular;
00047     float specular_exp;
00048 } material_t;
00049 
00051 
00052 typedef struct {
00053     bool is_on;
00054     GLfloat ambient[4];
00055     GLfloat diffuse[4];
00056     GLfloat specular[4];
00057     GLfloat position[4];
00058     GLfloat spot_direction[3];
00059     GLfloat spot_exponent;
00060     GLfloat spot_cutoff;
00061     GLfloat constant_attenuation;
00062     GLfloat linear_attenuation;
00063     GLfloat quadratic_attenuation;
00064 } light_t;
00065 
00067 typedef struct {
00068     float time;
00069     pp::Vec3d pos;
00070        
00072     float yaw;
00073        
00075     float pitch;
00076     float l_shldr;
00077     float r_shldr;
00078     float l_hip;
00079     float r_hip;
00080 } key_frame_t; 
00081 
00083 typedef enum { 
00084     Empty, Sphere
00085 } geometry_t;
00086 
00088 typedef struct {
00089     float radius;
00090        
00092     int divisions;          
00093 } sphere_t;
00094 
00096 typedef enum {
00097     TuxLeftEye = 0, 
00098     TuxRightEye = 1
00099 } tux_eye_t;
00100   
00102 typedef struct scene_node_struct {
00103     struct scene_node_struct* parent;
00104     struct scene_node_struct* next;
00105     struct scene_node_struct* child;
00106 
00108     geometry_t geom;
00109 
00110     union {
00111         sphere_t sphere;   
00112     } param;
00113       
00114     material_t* mat;
00115 
00116 
00118     bool render_shadow;
00119 
00121     bool eye;
00122 
00124     tux_eye_t which_eye;
00125 
00127     pp::Matrix trans;
00128     pp::Matrix invtrans;   
00129 
00131     char *name;
00132 } scene_node_t;
00133 
00134 
00135 #define NUM_TERRAIN_TYPES 64
00136 
00138 typedef enum {
00139     DIFFICULTY_LEVEL_EASY,
00140     DIFFICULTY_LEVEL_NORMAL,
00141     DIFFICULTY_LEVEL_HARD,
00142     DIFFICULTY_LEVEL_INSANE,
00143     DIFFICULTY_NUM_LEVELS
00144 } difficulty_level_t;
00145 
00147 typedef enum {
00148     RACE_CONDITIONS_SUNNY,
00149     RACE_CONDITIONS_CLOUDY,
00150     RACE_CONDITIONS_NIGHT,
00151        RACE_CONDITIONS_EVENING,
00152     RACE_CONDITIONS_NUM_CONDITIONS
00153 } race_conditions_t;
00154 
00156 typedef enum {
00157     BEHIND,
00158     FOLLOW,
00159     ABOVE,
00160     NUM_VIEW_MODES
00161 } view_mode_t;
00162 
00164 typedef struct {
00166        view_mode_t mode;                  
00167     
00169        pp::Vec3d pos;                     
00170     
00172        pp::Vec3d plyr_pos;                
00173     
00175        pp::Vec3d dir;                     
00176     
00178        pp::Vec3d up;                      
00179     
00181        pp::Matrix inv_view_mat;           
00182     
00184        bool initialized;                  
00185 } view_t;
00186 
00188 typedef enum {
00189     KEYBOARD = 0,
00190     MOUSE = 1,
00191     JOYSTICK = 2
00192 } control_mode_t;
00193 
00195 typedef struct {
00197        control_mode_t mode; 
00198        
00200        float turn_fact;
00201        
00203        float turn_animation;
00204        
00206        bool is_braking;
00207        
00209        bool is_paddling;
00210        
00211     float paddle_time;
00212     bool begin_jump;
00213     bool jumping;
00214     bool jump_charging;
00215     float jump_amt;
00216     float jump_start_time;
00217     bool barrel_roll_left;
00218     bool barrel_roll_right;
00219     float barrel_roll_factor;
00220     bool front_flip;
00221     bool back_flip;
00222     float flip_factor;
00223 } control_t;
00224 
00225 #endif // _PP_TYPES_H_