00001 // Funclib Model v1.0.0 00002 // 00003 // This module contains functions for loading/rendering models. 00004 // Use it in 3d games and 2d games where complex shapes are used. 00005 // This module requires GRAPHICS and TEXTURE. 00006 // This module works better when used in conjunction with MATH. 00007 // 00008 // Contributor(s): Flatmush 00009 00010 00011 00012 #ifndef FLMODEL_H 00013 #define FLMODEL_H 00014 00015 #include "flGlobal.h" 00016 #include "flTexture.h" 00017 00018 #if FL_MODEL != 0 00019 00020 #ifdef __cplusplus 00021 extern "C" { 00022 #endif 00023 00024 #define MODEL_ANIM_TYPE_NONE 0 00025 #define MODEL_ANIM_TYPE_MD2 1 00026 #define MODEL_ANIM_TYPE_MD3 2 00027 00028 typedef struct { 00029 u8 mdlfVertCount; 00030 vect3f** mdlfVerts; 00031 Texture* mdlfTexture; 00032 vect2f** mdlfTexVerts; 00033 vect3f** mdlfNormals; 00034 } Model3dStaticFace; 00035 typedef Model3dStaticFace Mdl3dStatFace; 00036 00037 typedef struct { 00038 u32 mdlVertCount; 00039 u8 mdlTextureCount; 00040 u32 mdlTexVertCount; 00041 u32 mdlNormalCount; 00042 u32 mdlFaceCount; 00043 vect3f* mdlVerts; 00044 vect2f* mdlTexVerts; 00045 vect3f* mdlNormals; 00046 Texture** mdlTextures; 00047 Model3dStaticFace* mdlFaces; 00048 bool mdlOptimized; 00049 } Model3dStatic; 00050 typedef Model3dStatic Mdl3dStat; 00051 00052 typedef struct { 00053 u8 mdlType; 00054 void* mdlData; 00055 } Model3dAnimated; 00056 typedef Model3dAnimated Mdl3dAnim; 00057 00058 extern void mdlInit(); 00059 00060 extern Model3dStatic* mdl3dStatLoad(char* inPath); 00061 extern bool mdl3dStatSave(char* inPath, Model3dStatic* inModel); 00062 extern void mdl3dStatDraw(Model3dStatic* inModel); 00063 extern void mdl3dStatOptimize(Model3dStatic* inModel); 00064 extern void mdl3dStatFree(Model3dStatic* inModel); 00065 00066 extern Model3dAnimated* mdl3dAnimLoad(char* inPath); 00067 extern bool mdl3dAnimSave(char* inPath, Model3dAnimated* inModel); 00068 extern void mdl3dAnimDraw(Model3dAnimated* inModel); 00069 extern void mdl3dAnimFree(Model3dAnimated* inModel); 00070 00071 #ifdef __cplusplus 00072 } 00073 #endif 00074 00075 #endif 00076 00077 #endif