#include "basetype.h"#include "xform3d.h"#include "vfile.h"#include "bitmap.h"Go to the source code of this file.
Defines | |
| #define | GE_BODY_NUMBER_OF_LOD (4) |
| #define | GE_BODY_NO_PARENT_BONE (-1) |
| #define | GE_BODY_HIGHEST_LOD (0) |
| #define | GE_BODY_ROOT (-1) |
Typedefs | |
| typedef geBody | geBody |
Functions | |
| geBody *GENESISCC | geBody_Create (void) |
| void GENESISCC | geBody_Destroy (geBody **B) |
| geBoolean GENESISCC | geBody_IsValid (const geBody *B) |
| geBoolean GENESISCC | geBody_GetGeometryStats (const geBody *B, int lod, int *Vertices, int *Faces, int *Normals) |
| geBoolean GENESISCC | geBody_AddFace (geBody *B, const geVec3d *Vertex1, const geVec3d *Normal1, geFloat U1, geFloat V1, int BoneIndex1, const geVec3d *Vertex2, const geVec3d *Normal2, geFloat U2, geFloat V2, int BoneIndex2, const geVec3d *Vertex3, const geVec3d *Normal3, geFloat U3, geFloat V3, int BoneIndex3, int MaterialIndex) |
| geBoolean GENESISCC | geBody_AddMaterial (geBody *B, const char *MaterialName, geBitmap *Bitmap, geFloat Red, geFloat Green, geFloat Blue, int *MaterialIndex) |
| geBoolean GENESISCC | geBody_GetMaterial (const geBody *Body, int MaterialIndex, const char **MaterialName, geBitmap **Bitmap, geFloat *Red, geFloat *Green, geFloat *Blue) |
| geBoolean GENESISCC | geBody_SetMaterial (geBody *Body, int MaterialIndex, geBitmap *Bitmap, geFloat Red, geFloat Green, geFloat Blue) |
| int GENESISCC | geBody_GetMaterialCount (const geBody *B) |
| geBoolean GENESISCC | geBody_AddBone (geBody *B, int ParentBoneIndex, const char *BoneName, const geXForm3d *AttachmentMatrix, int *BoneIndex) |
| geBoolean GENESISCC | geBody_ComputeLevelsOfDetail (geBody *B,int Levels) |
| int GENESISCC | geBody_GetBoneCount (const geBody *B) |
| void GENESISCC | geBody_GetBone (const geBody *B, int BoneIndex, const char **BoneName, geXForm3d *Attachment, int *ParentBoneIndex) |
| int32 GENESISCC | geBody_GetBoneNameChecksum (const geBody *B) |
| void GENESISCC | geBody_SetBoundingBox (geBody *B, int BoneIndex, const geVec3d *MinimumBoxCorner, const geVec3d *MaximumBoxCorner) |
| geBoolean GENESISCC | geBody_GetBoundingBox (const geBody *B, int BoneIndex, geVec3d *MinimumBoxCorner, geVec3d *MaximumBoxCorner) |
| geBoolean GENESISCC | geBody_GetBoneByName (const geBody *B, const char *BoneName, int *pBoneIndex, geXForm3d *Attachment, int *pParentBoneIndex) |
| geBoolean GENESISCC | geBody_WriteToFile (const geBody *B, geVFile *pFile) |
| geBody *GENESISCC | geBody_CreateFromFile (geVFile *pFile) |
|
|
Definition at line 41 of file body.h. Referenced by geBody_AddFace(), and geBodyInst_GetGeometryPrep(). |
|
|
Definition at line 40 of file body.h. Referenced by geBody_AddBone(), and geBody_SanityCheck(). |
|
|
Definition at line 39 of file body.h. Referenced by geBody_AddToFaces(), geBody_ChangeVertexIndex(), geBody_ComputeLevelsOfDetail(), geBody_CreateNull(), geBody_DestroyPossiblyIncompleteBody(), geBody_GetGeometryStats(), geBody_ReadGeometry(), and geBody_SwapVertexIndices(). |
|
|
Definition at line 43 of file body.h. Referenced by geActor_RenderPrep(), geBody_GetBoundingBox(), and geBody_SetBoundingBox(). |
|
|
|
|
||||||||||||||||||||||||
|
Definition at line 859 of file body.c. References geBody_Bone::AttachmentMatrix, B, geBody_Bone::BoundingBoxMax, geBody_Bone::BoundingBoxMin, ERR_BODY_ENOMEM, GE_BODY_NO_PARENT_BONE, GE_BODY_REALLY_BIG_NUMBER, GE_FALSE, GE_RAM_REALLOC_ARRAY, GE_TRUE, geBody_Index, geBody_IsValid(), geBoolean, geErrorLog_Add, GENESISCC, geStrBlock_Append(), geVec3d_Set(), NULL, and geBody_Bone::ParentBoneIndex.
00864 {
00865 geBody_Bone *NewBones;
00866 assert( B != NULL );
00867 assert( BoneName != NULL );
00868 assert( BoneIndex != NULL );
00869 assert( geBody_IsValid(B) != GE_FALSE );
00870
00871 assert( ParentBoneIndex < B->BoneCount );
00872 assert( ( ParentBoneIndex >= 0) || (ParentBoneIndex == GE_BODY_NO_PARENT_BONE));
00873 assert( B->BoneCount >= 0 );
00874
00875 NewBones = GE_RAM_REALLOC_ARRAY( B->BoneArray,
00876 geBody_Bone, (B->BoneCount+1) );
00877 if ( NewBones == NULL )
00878 {
00879 geErrorLog_Add(ERR_BODY_ENOMEM, NULL);
00880 return GE_FALSE;
00881 }
00882
00883 B->BoneArray = NewBones;
00884 if (geStrBlock_Append(&(B->BoneNames),BoneName) == GE_FALSE)
00885 {
00886 geErrorLog_Add(ERR_BODY_ENOMEM, NULL);
00887 return GE_FALSE;
00888 }
00889
00890 {
00891 geBody_Bone *Bone = &(B->BoneArray[B->BoneCount]);
00892 geVec3d_Set(&(Bone->BoundingBoxMin),
00893 GE_BODY_REALLY_BIG_NUMBER,GE_BODY_REALLY_BIG_NUMBER,GE_BODY_REALLY_BIG_NUMBER);
00894 geVec3d_Set(&(Bone->BoundingBoxMax),
00895 -GE_BODY_REALLY_BIG_NUMBER,-GE_BODY_REALLY_BIG_NUMBER,-GE_BODY_REALLY_BIG_NUMBER);
00896 Bone->AttachmentMatrix = *AttachmentMatrix;
00897 Bone->ParentBoneIndex = (geBody_Index)ParentBoneIndex;
00898 }
00899 *BoneIndex = B->BoneCount;
00900 B->BoneCount++;
00901 return GE_TRUE;
00902 }
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 681 of file body.c. References B, GE_BODY_HIGHEST_LOD, GE_FALSE, GE_TRUE, geBody_AddNormal(), geBody_AddSkinVertex(), geBody_AddToFaces(), geBody_Index, geBody_IsValid(), geBody_SortSkinVertices(), geBoolean, GENESISCC, geBody_Triangle::MaterialIndex, geBody_Triangle::NormalIndex, NULL, U1, U2, V1, V2, and geBody_Triangle::VtxIndex.
00689 {
00690 geBody_Triangle F;
00691
00692 assert( B != NULL );
00693 assert( Vertex1 != NULL );
00694 assert( Normal1 != NULL );
00695 assert( geBody_IsValid(B) != GE_FALSE );
00696
00697 assert( BoneIndex1 >= 0 );
00698 assert( BoneIndex1 < B->BoneCount );
00699
00700 assert( Vertex2 != NULL );
00701 assert( Normal2 != NULL );
00702 assert( BoneIndex2 >= 0 );
00703 assert( BoneIndex2 < B->BoneCount );
00704
00705 assert( Vertex3 != NULL );
00706 assert( Normal3 != NULL );
00707 assert( BoneIndex3 >= 0 );
00708 assert( BoneIndex3 < B->BoneCount );
00709
00710 assert( MaterialIndex >= 0 );
00711 assert( MaterialIndex < B->MaterialCount );
00712
00713 if (geBody_AddSkinVertex(B,Vertex1,U1,V1,(geBody_Index)BoneIndex1,&(F.VtxIndex[0]))==GE_FALSE)
00714 { // error already recorded
00715 return GE_FALSE;
00716 }
00717 if (geBody_AddSkinVertex(B,Vertex2,U2,V2,(geBody_Index)BoneIndex2,&(F.VtxIndex[1]))==GE_FALSE)
00718 { // error already recorded
00719 return GE_FALSE;
00720 }
00721 if (geBody_AddSkinVertex(B,Vertex3,U3,V3,(geBody_Index)BoneIndex3,&(F.VtxIndex[2]))==GE_FALSE)
00722 { // error already recorded
00723 return GE_FALSE;
00724 }
00725
00726 if (geBody_AddNormal( B, Normal1, (geBody_Index)BoneIndex1, &(F.NormalIndex[0]) ) == GE_FALSE)
00727 { // error already recorded
00728 return GE_FALSE;
00729 }
00730 if (geBody_AddNormal( B, Normal2, (geBody_Index)BoneIndex2, &(F.NormalIndex[1]) ) == GE_FALSE)
00731 { // error already recorded
00732 return GE_FALSE;
00733 }
00734 if (geBody_AddNormal( B, Normal3, (geBody_Index)BoneIndex3, &(F.NormalIndex[2]) ) == GE_FALSE)
00735 { // error already recorded
00736 return GE_FALSE;
00737 }
00738
00739 F.MaterialIndex = (geBody_Index)MaterialIndex;
00740 if (geBody_AddToFaces( B, &F, GE_BODY_HIGHEST_LOD ) == GE_FALSE)
00741 { // error already recorded
00742 return GE_FALSE;
00743 }
00744
00745 geBody_SortSkinVertices(B);
00746
00747 return GE_TRUE;
00748
00749 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 752 of file body.c. References B, geBody_Material::Bitmap, Blue, geBody_Material::Blue, ERR_BODY_ENOMEM, GE_FALSE, GE_RAM_REALLOC_ARRAY, GE_TRUE, geBitmap_CreateRef(), geBody_IsValid(), geBoolean, geErrorLog_Add, geErrorLog_AddString, GENESISCC, geStrBlock_Append(), geStrBlock_FindString(), Green, geBody_Material::Green, NULL, Red, and geBody_Material::Red.
00757 {
00758 int FoundIndex;
00759 geBody_Material *NewMaterial;
00760 assert( B != NULL );
00761 assert( MaterialIndex != NULL );
00762 assert( geBody_IsValid(B) != GE_FALSE );
00763 assert( B->MaterialCount >= 0 );
00764
00765 if (MaterialName == NULL)
00766 {
00767 geErrorLog_AddString(-1,"Can't add material - name can not be NULL", NULL);
00768 return GE_FALSE;
00769 }
00770 if (MaterialName[0] == 0)
00771 {
00772 geErrorLog_AddString(-1,"Can't add material - name must have > 0 length", NULL);
00773 return GE_FALSE;
00774 }
00775 if (geStrBlock_FindString(B->MaterialNames, MaterialName, &FoundIndex) == GE_TRUE)
00776 {
00777 geErrorLog_AddString(-1,"Can't add material - name already used", NULL);
00778 return GE_FALSE;
00779 }
00780
00781
00782 NewMaterial = GE_RAM_REALLOC_ARRAY( B->MaterialArray,
00783 geBody_Material,(B->MaterialCount+1) );
00784 if ( NewMaterial == NULL )
00785 {
00786 geErrorLog_Add(ERR_BODY_ENOMEM, NULL);
00787 return GE_FALSE;
00788 }
00789
00790
00791 B->MaterialArray = NewMaterial;
00792 if (geStrBlock_Append(&(B->MaterialNames),MaterialName) == GE_FALSE)
00793 {
00794 geErrorLog_Add(ERR_BODY_ENOMEM, NULL);
00795 return GE_FALSE;
00796 }
00797
00798 {
00799 geBody_Material *M = &(B->MaterialArray[B->MaterialCount]);
00800 M->Bitmap = Bitmap;
00801 if (Bitmap != NULL)
00802 geBitmap_CreateRef(Bitmap);
00803 M->Red = Red;
00804 M->Green = Green;
00805 M->Blue = Blue;
00806
00807 }
00808 *MaterialIndex = B->MaterialCount;
00809 B->MaterialCount ++;
00810 return GE_TRUE;
00811 }
|
|
||||||||||||
|
Definition at line 906 of file body.c. References B, GE_BODY_HIGHEST_LOD_MASK, GE_BODY_NUMBER_OF_LOD, GE_FALSE, GE_TRUE, geBody_IsValid(), geBoolean, GENESISCC, and NULL.
00907 {
00908 assert( B != NULL);
00909 assert( Levels >= 0 );
00910 assert( Levels < GE_BODY_NUMBER_OF_LOD );
00911 assert( geBody_IsValid(B) != GE_FALSE );
00912 #pragma message ("LOD code goes here:")
00913 B->LevelsOfDetail = GE_BODY_HIGHEST_LOD_MASK; // Levels
00914 Levels;
00915 return GE_TRUE;
00916 }
|
|
|
Definition at line 225 of file body.c. References B, ERR_BODY_ENOMEM, GE_FALSE, geBody_CreateNull(), geBody_DestroyPossiblyIncompleteBody(), geBody_SanityCheck(), geErrorLog_Add, GENESISCC, geStrBlock_Create(), and NULL.
00226 {
00227 geBody *B;
00228
00229 B = geBody_CreateNull();
00230 if ( B == NULL)
00231 {
00232 geErrorLog_Add(ERR_BODY_ENOMEM, NULL);
00233 return NULL;
00234 }
00235
00236 B->BoneNames = geStrBlock_Create();
00237 if (B->BoneNames == NULL)
00238 {
00239 geErrorLog_Add(ERR_BODY_ENOMEM, NULL);
00240 geBody_DestroyPossiblyIncompleteBody(&B);
00241 return NULL;
00242 }
00243 B->MaterialNames = geStrBlock_Create();
00244
00245 if (B->MaterialNames == NULL)
00246 {
00247 geErrorLog_Add(ERR_BODY_ENOMEM, NULL);
00248 geBody_DestroyPossiblyIncompleteBody(&B);
00249 return NULL;
00250 }
00251
00252 assert( geBody_SanityCheck(B) != GE_FALSE );
00253 return B;
00254 }
|
|
|
Definition at line 1052 of file body.c. References B, geBody_Material::Bitmap, ERR_BODY_ENOMEM, ERR_BODY_FILE_READ, GE_BODY_BITMAP_DIRECTORY_NAME, GE_BODY_GEOMETRY_NAME, GE_FALSE, GE_VFILE_OPEN_DIRECTORY, GE_VFILE_OPEN_READONLY, GE_VFILE_TYPE_VIRTUAL, geBitmap_CreateFromFile(), geBitmap_SetMipCount(), geBody_CreateNull(), geBody_DestroyPossiblyIncompleteBody(), geBody_ReadGeometry(), geErrorLog_Add, GENESISCC, geVFile_Close(), geVFile_Open(), geVFile_OpenNewSystem(), and NULL. Referenced by geActor_DefCreateFromFile().
01053 {
01054 geBody *B;
01055 int i;
01056
01057 geVFile *VFile;
01058 geVFile *SubFile=NULL;
01059 geVFile *BitmapDirectory=NULL;
01060
01061 assert( pFile != NULL );
01062
01063 VFile = geVFile_OpenNewSystem(pFile,GE_VFILE_TYPE_VIRTUAL, NULL,
01064 NULL, GE_VFILE_OPEN_DIRECTORY | GE_VFILE_OPEN_READONLY);
01065 if (VFile == NULL)
01066 { geErrorLog_Add( ERR_BODY_FILE_READ , NULL); goto CreateError;}
01067
01068 SubFile = geVFile_Open(VFile,GE_BODY_GEOMETRY_NAME,GE_VFILE_OPEN_READONLY);
01069 if (SubFile == NULL)
01070 { geErrorLog_Add( ERR_BODY_FILE_READ , NULL); goto CreateError;}
01071
01072 B = geBody_CreateNull();
01073 if (B==NULL)
01074 { geErrorLog_Add( ERR_BODY_ENOMEM , NULL); goto CreateError; }
01075
01076 if (geBody_ReadGeometry(B,SubFile)==GE_FALSE)
01077 { geErrorLog_Add( ERR_BODY_FILE_READ , NULL); goto CreateError;}
01078 geVFile_Close(SubFile);
01079
01080 BitmapDirectory = geVFile_Open(VFile,GE_BODY_BITMAP_DIRECTORY_NAME,
01081 GE_VFILE_OPEN_DIRECTORY | GE_VFILE_OPEN_READONLY);
01082 if (BitmapDirectory == NULL)
01083 { geErrorLog_Add( ERR_BODY_FILE_READ , NULL); goto CreateError;}
01084
01085 for (i=0; i<B->MaterialCount; i++)
01086 {
01087 geBody_Material *M;
01088 M = &(B->MaterialArray[i]);
01089
01090 if (M->Bitmap != NULL)
01091 {
01092 char FName[1000];
01093 sprintf(FName,"%d",i);
01094
01095 SubFile = geVFile_Open(BitmapDirectory,FName,GE_VFILE_OPEN_READONLY);
01096 if (SubFile == NULL)
01097 { geErrorLog_Add( ERR_BODY_FILE_READ , NULL); goto CreateError;}
01098
01099 M->Bitmap = geBitmap_CreateFromFile(SubFile);
01100
01101 if (M->Bitmap == NULL)
01102 { geErrorLog_Add( ERR_BODY_FILE_READ , NULL); goto CreateError;}
01103
01104 #if 1
01105 // Set the number of mips to 4
01106 if (!geBitmap_SetMipCount(M->Bitmap, 4))
01107 {
01108 geErrorLog_Add( ERR_BODY_FILE_READ , NULL);
01109 goto CreateError;
01110 }
01111 #endif
01112
01113 geVFile_Close(SubFile);
01114 }
01115 }
01116 geVFile_Close(BitmapDirectory);
01117 geVFile_Close(VFile);
01118 return B;
01119
01120 CreateError:
01121 geBody_DestroyPossiblyIncompleteBody(&B);
01122 if (SubFile != NULL)
01123 geVFile_Close(SubFile);
01124 if (BitmapDirectory != NULL)
01125 geVFile_Close(BitmapDirectory);
01126 if (VFile != NULL)
01127 geVFile_Close(VFile);
01128 return NULL;
01129 }
|
|
|
Definition at line 256 of file body.c. References GE_FALSE, geBody_DestroyPossiblyIncompleteBody(), geBody_IsValid(), GENESISCC, and NULL. Referenced by geActor_DefDestroy(), geActor_DestroyDirect(), and geActor_SetBody().
00257 {
00258 assert( PB != NULL );
00259 assert( *PB != NULL );
00260 assert( geBody_IsValid(*PB) != GE_FALSE );
00261 geBody_DestroyPossiblyIncompleteBody( PB );
00262 }
|
|
||||||||||||||||||||||||
|
Definition at line 284 of file body.c. References B, GE_FALSE, geBody_IsValid(), GENESISCC, geStrBlock_GetString(), and NULL. Referenced by geActor_AnimationStepBoneOptimized(), geActor_AnimationTestStepBoneOptimized(), geActor_Create(), and geActor_GetLightingOptions().
00289 {
00290 assert( B != NULL );
00291 assert( geBody_IsValid(B) != GE_FALSE );
00292 assert( Attachment != NULL );
00293 assert( ParentBoneIndex != NULL );
00294 assert( BoneName != NULL );
00295
00296 assert( BoneIndex >=0 );
00297 assert( BoneIndex < B->BoneCount );
00298 *Attachment = B->BoneArray[BoneIndex].AttachmentMatrix;
00299 *ParentBoneIndex = B->BoneArray[BoneIndex].ParentBoneIndex;
00300 *BoneName = geStrBlock_GetString(B->BoneNames,BoneIndex);
00301 }
|
|
||||||||||||||||||||||||
|
Definition at line 371 of file body.c. References B, GE_FALSE, GE_TRUE, geBody_IsValid(), geBoolean, GENESISCC, geStrBlock_FindString(), and NULL. Referenced by geActor_DefHasBoneNamed(), and geActor_GetBoneIndex().
00376 {
00377 assert( B != NULL );
00378 assert( geBody_IsValid(B) != GE_FALSE );
00379 assert( Attachment != NULL );
00380 assert( pParentBoneIndex != NULL );
00381 assert( pBoneIndex != NULL );
00382 assert( BoneName != NULL );
00383
00384 if(geStrBlock_FindString(B->BoneNames, BoneName, pBoneIndex) == GE_TRUE)
00385 {
00386 *Attachment = B->BoneArray[*pBoneIndex].AttachmentMatrix;
00387 *pParentBoneIndex = B->BoneArray[*pBoneIndex].ParentBoneIndex;
00388
00389 return GE_TRUE;
00390 }
00391
00392 return GE_FALSE;
00393 }
|
|
|
Definition at line 277 of file body.c. References B, GE_FALSE, geBody_IsValid(), GENESISCC, and NULL. Referenced by geActor_Create(), geActor_GetBoneCount(), geActor_GetDynamicExtBox(), and geActor_GetLightingOptions().
00278 {
00279 assert( B != NULL );
00280 assert( geBody_IsValid(B) != GE_FALSE );
00281 return B->BoneCount;
00282 }
|
|
|
Definition at line 303 of file body.c. References B, GE_FALSE, geBody_IsValid(), GENESISCC, geStrBlock_GetChecksum(), int32, and NULL.
00304 {
00305 assert( geBody_IsValid(B) != GE_FALSE );
00306
00307 if (B->BoneNames != NULL)
00308 {
00309 return geStrBlock_GetChecksum( B->BoneNames );
00310 }
00311 else
00312 return 0;
00313 }
|
|
||||||||||||||||||||
|
Definition at line 316 of file body.c. References B, geBody_Bone::BoundingBoxMax, geBody_Bone::BoundingBoxMin, GE_BODY_ROOT, GE_FALSE, GE_TRUE, geBoolean, GENESISCC, NULL, and geVec3d::X. Referenced by geActor_GetBoneBoundingBoxByIndex().
00320 {
00321 assert( B != NULL);
00322 assert( MinimumBoxCorner != NULL );
00323 assert( MaximumBoxCorner != NULL );
00324 assert( (BoneIndex >=0) || (BoneIndex == GE_BODY_ROOT));
00325 assert( (BoneIndex < B->BoneCount) || (BoneIndex == GE_BODY_ROOT));
00326 if (BoneIndex == GE_BODY_ROOT)
00327 {
00328 #pragma message ("discontinue this?")
00329 *MinimumBoxCorner = B->BoundingBoxMin;
00330 *MaximumBoxCorner = B->BoundingBoxMax;
00331 }
00332 else
00333 {
00334 geBody_Bone *Bone = &(B->BoneArray[BoneIndex]);
00335
00336 if (Bone->BoundingBoxMin.X > Bone->BoundingBoxMax.X)
00337 {
00338 return GE_FALSE;
00339 }
00340 *MinimumBoxCorner = Bone->BoundingBoxMin;
00341 *MaximumBoxCorner = Bone->BoundingBoxMax;
00342 }
00343 return GE_TRUE;
00344 }
|
|
||||||||||||||||||||||||
|
Definition at line 265 of file body.c. References B, GE_BODY_NUMBER_OF_LOD, GE_TRUE, geBody_IsValid(), geBoolean, and GENESISCC.
00266 {
00267 assert( geBody_IsValid(B) == GE_TRUE );
00268 assert( ( lod >=0 ) && ( lod < GE_BODY_NUMBER_OF_LOD ) );
00269 *Vertices = B->XSkinVertexCount;
00270 *Faces = B->SkinFaces[lod].FaceCount;
00271 *Normals = B->SkinNormalCount;
00272 return GE_TRUE;
00273 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 813 of file body.c. References B, geBody_Material::Bitmap, geBody_Material::Blue, Blue, GE_FALSE, GE_TRUE, geBody_IsValid(), geBoolean, GENESISCC, geStrBlock_GetString(), geBody_Material::Green, Green, NULL, geBody_Material::Red, and Red. Referenced by gePuppet_FetchTextures().
00816 {
00817 assert( B != NULL );
00818 assert( geBody_IsValid(B) != GE_FALSE );
00819 assert( Red != NULL );
00820 assert( Green != NULL );
00821 assert( Blue != NULL );
00822 assert( Bitmap != NULL );
00823 assert( MaterialIndex >= 0 );
00824 assert( MaterialIndex < B->MaterialCount );
00825 assert( MaterialName != NULL );
00826 *MaterialName = geStrBlock_GetString(B->MaterialNames,MaterialIndex);
00827
00828 {
00829 geBody_Material *M = &(B->MaterialArray[MaterialIndex]);
00830 *Bitmap = M->Bitmap;
00831 *Red = M->Red;
00832 *Green = M->Green;
00833 *Blue = M->Blue;
00834 }
00835 return GE_TRUE;
00836 }
|
|
|
Definition at line 395 of file body.c. References B, GE_FALSE, geBody_IsValid(), GENESISCC, and NULL. Referenced by gePuppet_FetchTextures().
00396 {
00397 assert( B != NULL );
00398 assert( geBody_IsValid(B) != GE_FALSE );
00399 return B->MaterialCount;
00400 }
|
|
|
||||||||||||||||||||
|
Definition at line 346 of file body.c. References B, GE_BODY_ROOT, GENESISCC, and NULL. Referenced by geActor_RenderPrep().
00350 {
00351 assert( B != NULL);
00352 assert( MinimumBoxCorner != NULL );
00353 assert( MaximumBoxCorner != NULL );
00354 assert( (BoneIndex >=0) || (BoneIndex == GE_BODY_ROOT));
00355 assert( (BoneIndex < B->BoneCount) || (BoneIndex == GE_BODY_ROOT));
00356 if (BoneIndex == GE_BODY_ROOT)
00357 {
00358 B->BoundingBoxMin = *MinimumBoxCorner;
00359 B->BoundingBoxMax = *MaximumBoxCorner;
00360 }
00361 else
00362 {
00363 B->BoneArray[BoneIndex].BoundingBoxMin = *MinimumBoxCorner;
00364 B->BoneArray[BoneIndex].BoundingBoxMax = *MaximumBoxCorner;
00365 }
00366 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 838 of file body.c. References B, geBody_Material::Bitmap, Blue, geBody_Material::Blue, GE_FALSE, GE_TRUE, geBitmap_CreateRef(), geBody_IsValid(), geBoolean, GENESISCC, Green, geBody_Material::Green, NULL, Red, and geBody_Material::Red.
00840 {
00841 assert( geBody_IsValid(B) != GE_FALSE );
00842 assert( MaterialIndex >= 0 );
00843 assert( MaterialIndex < B->MaterialCount );
00844 {
00845 geBody_Material *M = &(B->MaterialArray[MaterialIndex]);
00846 M->Bitmap = Bitmap;
00847 if (Bitmap != NULL)
00848 geBitmap_CreateRef(Bitmap);
00849 M->Red = Red;
00850 M->Green = Green;
00851 M->Blue = Blue;
00852 }
00853 return GE_TRUE;
00854 }
|
|
||||||||||||
|
Definition at line 1225 of file body.c. References B, geBody_Material::Bitmap, ERR_BODY_FILE_WRITE, GE_BODY_BITMAP_DIRECTORY_NAME, GE_BODY_GEOMETRY_NAME, GE_FALSE, GE_TRUE, GE_VFILE_OPEN_CREATE, GE_VFILE_OPEN_DIRECTORY, GE_VFILE_TYPE_VIRTUAL, geBitmap_WriteToFile(), geBody_IsValid(), geBody_WriteGeometry(), geBoolean, geErrorLog_Add, GENESISCC, geVFile_Close(), geVFile_Open(), geVFile_OpenNewSystem(), and NULL. Referenced by geActor_DefWriteToFile().
01226 {
01227 int i;
01228 geVFile *VFile;
01229 geVFile *SubFile;
01230 geVFile *BitmapDirectory;
01231
01232 assert( geBody_IsValid(B) != GE_FALSE );
01233 assert( pFile != NULL );
01234
01235 VFile = geVFile_OpenNewSystem(pFile,GE_VFILE_TYPE_VIRTUAL, NULL,
01236 NULL, GE_VFILE_OPEN_DIRECTORY | GE_VFILE_OPEN_CREATE);
01237 if (VFile == NULL)
01238 { geErrorLog_Add( ERR_BODY_FILE_WRITE , NULL); goto WriteError;}
01239
01240 SubFile = geVFile_Open(VFile,GE_BODY_GEOMETRY_NAME,GE_VFILE_OPEN_CREATE);
01241 if (SubFile == NULL)
01242 { geErrorLog_Add( ERR_BODY_FILE_WRITE , NULL); goto WriteError;}
01243
01244 if (geBody_WriteGeometry(B,SubFile)==GE_FALSE)
01245 { geErrorLog_Add( ERR_BODY_FILE_WRITE , NULL); goto WriteError;}
01246 if (geVFile_Close(SubFile)==GE_FALSE)
01247 { geErrorLog_Add( ERR_BODY_FILE_WRITE , NULL); goto WriteError;}
01248
01249 BitmapDirectory = geVFile_Open(VFile,GE_BODY_BITMAP_DIRECTORY_NAME,
01250 GE_VFILE_OPEN_DIRECTORY | GE_VFILE_OPEN_CREATE);
01251 if (BitmapDirectory == NULL)
01252 { geErrorLog_Add( ERR_BODY_FILE_WRITE , NULL); goto WriteError;}
01253
01254 for (i=0; i<B->MaterialCount; i++)
01255 {
01256 geBody_Material *M;
01257 M = &(B->MaterialArray[i]);
01258
01259 if (M->Bitmap != NULL)
01260 {
01261 char FName[1000];
01262 sprintf(FName,"%d",i);
01263
01264 SubFile = geVFile_Open(BitmapDirectory,FName,GE_VFILE_OPEN_CREATE);
01265 if (SubFile == NULL)
01266 { geErrorLog_Add( ERR_BODY_FILE_WRITE , NULL); goto WriteError;}
01267
01268 if (geBitmap_WriteToFile(M->Bitmap,SubFile)==GE_FALSE)
01269 { geErrorLog_Add( ERR_BODY_FILE_WRITE , NULL); goto WriteError;}
01270
01271 if (geVFile_Close(SubFile)==GE_FALSE)
01272 { geErrorLog_Add( ERR_BODY_FILE_WRITE , NULL); goto WriteError;}
01273 }
01274 }
01275 if (geVFile_Close(BitmapDirectory)==GE_FALSE)
01276 { geErrorLog_Add( ERR_BODY_FILE_WRITE , NULL); goto WriteError;}
01277 if (geVFile_Close(VFile)==GE_FALSE)
01278 { geErrorLog_Add( ERR_BODY_FILE_WRITE , NULL); goto WriteError;}
01279
01280 return GE_TRUE;
01281 WriteError:
01282 return GE_FALSE;
01283 }
|
1.3.2