Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

body.h

Go to the documentation of this file.
00001 /****************************************************************************************/
00002 /*  BODY.H                                                                              */
00003 /*                                                                                      */
00004 /*  Author: Mike Sandige                                                                    */
00005 /*  Description: Actor body interface.                                                      */
00006 /*                                                                                      */
00007 /*  The contents of this file are subject to the Genesis3D Public License               */
00008 /*  Version 1.01 (the "License"); you may not use this file except in                   */
00009 /*  compliance with the License. You may obtain a copy of the License at                */
00010 /*  http://www.genesis3d.com                                                            */
00011 /*                                                                                      */
00012 /*  Software distributed under the License is distributed on an "AS IS"                 */
00013 /*  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See                */
00014 /*  the License for the specific language governing rights and limitations              */
00015 /*  under the License.                                                                  */
00016 /*                                                                                      */
00017 /*  The Original Code is Genesis3D, released March 25, 1999.                            */
00018 /*  Genesis3D Version 1.1 released November 15, 1999                                 */
00019 /*  Copyright (C) 1999 WildTangent, Inc. All Rights Reserved           */
00020 /*                                                                                      */
00021 /****************************************************************************************/
00022 #ifndef GE_BODY_H
00023 #define GE_BODY_H 
00024 
00025 /* This object is for managing the data associated with a skeletal-based mesh, 
00026    a 'body'.
00027    This object holds the geometry for the body and the list of materials needed.
00028 */
00029 
00030 #include "basetype.h"
00031 #include "xform3d.h"
00032 #include "vfile.h"
00033 #include "bitmap.h"
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 #define GE_BODY_NUMBER_OF_LOD                   (4)             // 0 is highest detail
00040 #define GE_BODY_NO_PARENT_BONE         (-1)   
00041 #define GE_BODY_HIGHEST_LOD            (0)
00042 
00043 #define GE_BODY_ROOT                                    (-1)    // for specifying 'root' bounding box.
00044 
00045 typedef struct geBody geBody;
00046 
00047 
00048 
00049 geBody *GENESISCC geBody_Create(void);
00050 
00051 void GENESISCC geBody_Destroy(geBody **B);
00052 
00053 geBoolean GENESISCC geBody_IsValid(const geBody *B);
00054 
00055 
00056 geBoolean GENESISCC geBody_GetGeometryStats(const geBody *B, int lod, int *Vertices, int *Faces, int *Normals);
00057 
00058 geBoolean GENESISCC geBody_AddFace(     geBody *B,
00059                                                                 const geVec3d *Vertex1, const geVec3d *Normal1, 
00060                                                                 geFloat U1, geFloat V1, int BoneIndex1,
00061                                                                 const geVec3d *Vertex2, const geVec3d *Normal2, 
00062                                                                         geFloat U2, geFloat V2, int BoneIndex2,
00063                                                                 const geVec3d *Vertex3, const geVec3d *Normal3, 
00064                                                                         geFloat U3, geFloat V3, int BoneIndex3,
00065                                                                 int MaterialIndex);
00066 
00067                         // Bitmap is added to body.  It's reference count is increased.  Caller still owns a pointer
00068                         // to the bitmap, and is responsible for destroying it.
00069 geBoolean GENESISCC geBody_AddMaterial( geBody *B, 
00070                                                                         const char *MaterialName, 
00071                                                                         geBitmap *Bitmap,
00072                                                                         geFloat Red, 
00073                                                                         geFloat Green, 
00074                                                                         geFloat Blue,
00075                                                                         int *MaterialIndex);
00076 
00077                         // returned bitmap is a pointer to the bitmap in the body's list.  It may not be destroyed.
00078                         // if caller would like to 'own' a copy of that bitmap pointer, it should call geBitmap_CreateRef()
00079 geBoolean GENESISCC geBody_GetMaterial(const geBody *Body, int MaterialIndex,
00080                                                                                 const char **MaterialName,
00081                                                                                 geBitmap **Bitmap, geFloat *Red, geFloat *Green, geFloat *Blue);
00082 
00083                         // Bitmap is set into the body.  It's reference count is increased.  Caller still owns a pointer
00084                         // to the bitmap, and is responsible for destroying it.
00085 geBoolean GENESISCC geBody_SetMaterial(geBody *Body, int MaterialIndex,
00086                                                                                 geBitmap *Bitmap,  geFloat Red,  geFloat Green,  geFloat Blue);
00087 
00088 int GENESISCC geBody_GetMaterialCount(const geBody *B);
00089 
00090 geBoolean GENESISCC geBody_AddBone( geBody *B, 
00091                                                         int ParentBoneIndex,
00092                                                         const char *BoneName, 
00093                                                         const geXForm3d *AttachmentMatrix,
00094                                                         int *BoneIndex);
00095 
00096 geBoolean GENESISCC geBody_ComputeLevelsOfDetail( geBody *B ,int Levels);
00097 
00098 int GENESISCC geBody_GetBoneCount(const geBody *B);
00099 
00100 void GENESISCC geBody_GetBone(  const geBody *B, 
00101                                                 int BoneIndex, 
00102                                                 const char **BoneName,
00103                                                 geXForm3d *Attachment, 
00104                                                 int *ParentBoneIndex);
00105 
00106 int32 GENESISCC geBody_GetBoneNameChecksum(const geBody *B);
00107 
00108 void GENESISCC geBody_SetBoundingBox( geBody *B,
00109                                                         int BoneIndex,          // GE_BODY_ROOT for specifing 'root' bounding box.
00110                                                         const geVec3d *MinimumBoxCorner,
00111                                                         const geVec3d *MaximumBoxCorner);
00112  
00113 
00114 geBoolean GENESISCC geBody_GetBoundingBox( const geBody *B, 
00115                                                         int BoneIndex,          // GE_BODY_ROOT for specifing 'root' bounding box.
00116                                                         geVec3d *MinimumBoxCorner,
00117                                                         geVec3d *MaximumBoxCorner);
00118 
00119 geBoolean GENESISCC geBody_GetBoneByName(const geBody* B,
00120         const char* BoneName,
00121         int* pBoneIndex,
00122         geXForm3d* Attachment,
00123         int* pParentBoneIndex);
00124 
00125 geBoolean GENESISCC geBody_WriteToFile(const geBody *B, geVFile *pFile);
00126 geBody  *GENESISCC  geBody_CreateFromFile(geVFile *pFile);
00127 
00128 
00129 
00130 
00131 #ifdef __cplusplus
00132 }
00133 #endif
00134 
00135 #endif
00136                                         

Generated on Tue Sep 30 12:35:19 2003 for GTestAndEngine by doxygen 1.3.2