Back to index

extremetuxracer  0.5beta
model_hndl.h
Go to the documentation of this file.
00001 /* 
00002  * Extreme Tux Racer
00003  * Copyleft 2007-2008 The ETR Team <http://www.extremetuxracer.com/>
00004  * 
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 #ifndef _MODEL_HNDL_H_
00021 #define _MODEL_HNDL_H_
00022 
00023 #include "etracer.h"
00024 #include "ppgltk/ppgltk.h"
00025 #include "translation.h"
00026 #include <list>
00027 #include <string>
00028 
00029 typedef struct {
00030        int id;
00031        std::string name;
00032        std::string filename;
00033 } model_t;
00034 
00035 class model_hndl {
00036 //Class for handling models
00037        
00038 public:
00039        model_hndl();
00040        std::list<model_t> l_models;
00041        int num_models;
00042        int cur_model;
00043        
00044        static bool            tuxLoaded;
00045        static char*     tuxRootNode;
00046        static char*     tuxLeftShoulderJoint;
00047        static char*     tuxRightShoulderJoint;
00048        static char*     tuxLeftHipJoint;
00049        static char*     tuxRightHipJoint;
00050        static char*     tuxLeftKneeJoint;
00051        static char*     tuxRightKneeJoint;
00052        static char*     tuxLeftAnkleJoint;
00053        static char*     tuxRightAnkleJoint;
00054        static char*     tuxTailJoint;
00055        static char*     tuxNeck;
00056        static char*     tuxHead;
00057        
00058        void adjust_tux_joints( double turnFact, bool isBraking, 
00059                             double paddling_factor, double speed,
00060                             pp::Vec3d net_force, double jump_factor );
00061                             
00062                      
00063        void load_model(int model);
00064        void load_model();
00065        void init_models();
00066        void draw_tux();
00067        char* get_tux_root_node() { return tuxRootNode; } 
00068        char* get_tux_left_shoulder_joint() { return tuxLeftShoulderJoint; } 
00069        char* get_tux_right_shoulder_joint() { return tuxRightShoulderJoint; } 
00070        char* get_tux_left_hip_joint() { return tuxLeftHipJoint; } 
00071        char* get_tux_right_hip_joint() { return tuxRightHipJoint; } 
00072        char* get_tux_left_knee_joint() { return tuxLeftKneeJoint; } 
00073        char* get_tux_right_knee_joint() { return tuxRightKneeJoint; } 
00074        char* get_tux_left_ankle_joint() { return tuxLeftAnkleJoint; } 
00075        char* get_tux_right_ankle_joint() { return tuxRightAnkleJoint; } 
00076        char* get_tux_tail_joint() { return tuxTailJoint; } 
00077        char* get_tux_neck() { return tuxNeck; } 
00078        char* get_tux_head() { return tuxHead; } 
00079 
00080 };
00081 
00082 static void register_tux_callbacks( Tcl_Interp *ip );
00083 
00084 extern model_hndl* ModelHndl;
00085 
00086 #endif /* _MODEL_HNDL_H_ */