Page principale | Liste des namespaces | Hiérarchie des classes | Liste par ordre alphabétique | Liste des composants | Liste des fichiers | Membres des namespaces | Composants | Déclarations

ExCModeLoader.h

Aller à la documentation de ce fichier.
00001 /************************************************************************/
00002 /* Ex Nihlo Engine by Hermanns Christophe                                                               */
00003 /************************************************************************/
00004 /* This program is free software; you can redistribute it and/or                */
00005 /* modify it under the terms of the GNU General Public License                  */
00006 /* as published by the Free Software Foundation; either version 2               */
00007 /* of the License, or (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.                                 */
00012 /*                                                                                                                                              */
00013 /* See the 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,                                               */
00018 /* Boston, MA  02111-1307, USA.                                                                                 */
00019 /*                                                                                                                                              */
00020 /* If you use a important part of this code please send me a mail               */
00021 /* I just want to see where my code go thks :)                                                  */
00022 /************************************************************************/
00023 
00024 /************************************************************************/
00025 /* Contact                                                              */  
00026 /************************************************************************/
00027 /* ExNihilo Website :www.ploksoftware.org                               */
00028 /*                                                                      */
00029 /* Hermanns Christophe ExNihilo creator and main programmer             */
00030 /*                                                                      */
00031 /* Mail             : Data@ploksoftware.org                                                             */
00032 /* ICQ              : 8030901                                                                                   */
00033 /* MSN Messenger    : Data_7@hotmail.com                                                                */
00034 /*                                                                      */
00035 /* Benjamin Michotte Linux port, webmaster                              */
00036 /*                                                                      */
00037 /* Mail             :binny@ploksoftware.org                             */
00038 /*                                                                      */
00039 /************************************************************************/
00040 
00041 /************************************************************************/
00042 /* File Description                                                                                             */
00043 /************************************************************************/
00044 /* File Name   :ExCModelLoader.h                                                                                */
00045 /*                                                                                                                                              */
00046 /* Star Date   :26/02/2003                                                                                              */
00047 /*                                                                                                                                              */
00048 /* Last Update :26/02/2003                                              */
00049 /*                                                                      */
00050 /* Description :This class will be used to convert model from different */
00051 /*              format into EXM model                                   */
00052 /************************************************************************/
00053 #ifndef __EXCMODELLOADER__
00054 #define __EXCMODELLOADER__
00055 //--------------------------------
00056 // File to include
00057 //--------------------------------
00058 #include "ExDefine.h"
00059 #include "Math/ExMath.h"
00060 #include "ExNihiloExecption.h"
00061 #include "Object/Object3D/Model/ExCModelEXM.h"
00062 //-------------------------------
00063 class ExCModelLoader
00064 {
00065 private:
00066 //--------------------------------
00067 // Variable
00068 //--------------------------------
00069         void LoadMD2(std::string strFileName);
00070         void LoadMD3(std::string strFileName);
00071         void LoadASC(std::string strFileName);
00072         void Load3DS(std::string strFileName);
00073         void LoadOBJ(std::string strFileName);
00074         void LoadASE(std::string strFileName);
00075         void LoadEXM(std::string strFileName);
00076 public:
00077 //--------------------------------
00078 // Constructor // Destructor
00079 //--------------------------------
00080         ExCModelLoader(void);
00081         ExCModelLoader(std::string FileName);
00082         ~ExCModelLoader(void);
00083 //--------------------------------
00084 // Methode
00085 //--------------------------------
00086         std::vector<ExCModelEXM>        m_VecExcModel;
00087         int LoadModel(std::string FileName);
00088 };
00089 //---------------------------------------------------
00090 //#define for md2 model
00091 //---------------------------------------------------
00092 //--------------------------------
00093 // These are the needed defines for the max values when loading .MD2 files
00094 #define MD2_MAX_TRIANGLES               4096
00095 #define MD2_MAX_VERTICES                2048
00096 #define MD2_MAX_TEXCOORDS               2048
00097 #define MD2_MAX_FRAMES                  512
00098 #define MD2_MAX_SKINS                   32
00099 #define MD2_MAX_FRAMESIZE               (MD2_MAX_VERTICES * 4 + 128)
00100 
00101 // This holds the header information that is read in at the beginning of the file
00102 typedef struct
00103 {
00104    int ident;            // identifies as MD2 file "IDP2"
00105    int version;  // mine is 8
00106    int skinwidth;    // width of texture
00107    int skinheight;   // height of texture
00108    int framesize;    // number of bytes per frame
00109    int numSkins;     // number of textures
00110    int numXYZ;       // number of points
00111    int numST;        // number of texture
00112    int numTris;      // number of triangles
00113    int numGLcmds;
00114    int numFrames;    // total number of frames
00115    int offsetSkins;  // offset to skin names (64 bytes each)
00116    int offsetST;     // offset of texture s-t values
00117    int offsetTris;   // offset of triangle mesh
00118    int offsetFrames; // offset of frame data (points)
00119    int offsetGLcmds; // type of OpenGL commands to use
00120    int offsetEnd;    // end of file
00121 } MD2_modelHeader_t;
00122 // This stores the frames vertices after they have been transformed
00123 // info for a single frame point
00124 typedef struct
00125 {
00126    short s;
00127    short t;
00128 } MD2_stIndex_t;
00129 
00130 typedef struct
00131 {
00132    unsigned char v[3];
00133    unsigned char normalIndex;   // not used
00134 } MD2_framePoint_t;
00135 
00136 // information for a single frame
00137 typedef struct
00138 {
00139    float scale[3];
00140    float translate[3];
00141    char name[16];
00142    MD2_framePoint_t fp[1];
00143 } MD2_frame_t;
00144 // data for a single triangle
00145 typedef struct
00146 {
00147    unsigned short meshIndex[3];         // vertex indices
00148    unsigned short stIndex[3];           // texture coordinate indices
00149 } MD2_mesh_t;
00150 //---------------------------------------------------------
00151 
00152 
00153 #endif //__EXCMODELLOADER__
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 

Généré le Tue Oct 28 12:43:32 2003 pour ExNihilo par doxygen 1.3.4