geBody

Description: Actor body interface.

Source file: …\genesis3d\OpenSource\Source\Actor\body.h

Contents:

Functions: AddBone, AddFace, AddMaterial, ComputeLevelsOfDetail, Create, CreateFromFile, Destroy, GetBone, GetBoneByName, GetBoneCount, GetBoneNameChecksum, GetBoundingBox, GetGeometryStats, GetMaterial, GetMaterialCount, IsValid, SetBoundingBox, SetMaterial, WriteToFile,

Types: geBody

Constants: GE_BODY_NUMBER_OF_LOD, GE_BODY_HIGHEST_LOD, GE_BODY_NO_PARENT_BONE, GE_BODY_ROOT

Changes for Genesis3D v1.6: None 

Types:

geBody;

typedef struct geBody geBody;

geBody contains the information necessary for a "skeletal mesh" body including geometry and materials.

NOTE: The contents of this structure have been intentionally left out of the interface, by the designers of this module. Think of this as a handle only.

Although not part of the API, the definition is here.

Return to Contents

Constants:

#define GE_BODY_NUMBER_OF_LOD

This constant specifies the number of Levels of Detail available for geBody objects.  0 would specify the highest level and 3 the lowest.

Notes:
    from BODY.H: 0 is highest detail


#define GE_BODY_HIGHEST_LOD (0)

This constant specifies the highest Level of Detail of a given geBody.


#define GE_BODY_NO_PARENT_BONE (-1)

This constant would be returned from the varius _GetBone functions for the ParentBoneIndex if the returned bone has no parent bone.


#define GE_BODY_ROOT (-1)

This constant is used for a bone index when the caller want to refer to the root bone.

Notes:
    from BODY.H: for specifying 'root' bounding box.

Return to Contents


Functions:

 

GENESISCC geBody_AddBone(geBody* B, int ParentBoneIndex, const char * BoneName, const geXForm3d* AttachmentMatrix, int * BoneIndex);

This function adds a bone with name BoneName to geBody B as a child of ParentBoneIndex with a position and orientation specified by geXForm3d AttachmentMatrix.  The bone index for the new bone is returned in BoneIndex.  (I'm not too clear about this.  Shouldn't there be more information than this about a bone?  Don't bones at least have a length to them?  And what exactly is the AttachmentMatrix?  What space is it in?  Maybe the length of the bone is the distance between the point specified in AttachmentMatrix and the the AttachmentMatrix of the Parent Bone?)

Returns: GE_TRUE on success, GE_FALSE otherwise.

Return to Contents


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);

This function adds a new face to geBody B.  The new face is specified by three vertices (Vertex1, Vertex2, Vertex3), corresponding normals (Normal1, Normal2, Normal3), corresponding material map alignment ((U1,V1), (U2, V2), (U3, V3)), and the corresponding index of the bone to be connected to (BoneIndex1, BoneIndex2, BoneIndex3).  A material is also specified by the material index MaterialIndex.

Returns: GE_TRUE on success, GE_FALSE otherwise.

Return to Contents


geBoolean GENESISCC geBody_AddMaterial(geBody* B, const char * MaterialName, geBitmap* Bitmap, geFloat Red, geFloat Green, geFloat Blue, int * MaterialIndex);

This function adds a material to geBody B.  A material contains a name MaterialName, an optional geBitmap Bitmap, and a color (Red, Green, Blue).  The material index applied to the new material is returned in MaterialIndex. The reference count for the Bitmap is increased by one, so the caller is still responsible for destroying it.

Returns: GE_TRUE on success, GE_FALSE otherwise.

Notes:
    from BODY.H: Bitmap is added to body.  It's reference count is increased.  Caller still owns a pointer to the bitmap, and is responsible for destroying it.


Return to Contents


geBoolean GENESISCC geBody_ComputeLevelsOfDetail(geBody* B, int Levels);

This function calculates Levels levels of detail for geBody B.  This is not currently implemented.

Returns: GE_TRUE on success, GE_FALSE otherwise.


Return to Contents


geBody* GENESISCC geBody_Create(void);

This function creates a new empty geBody object and returns it.

Returns: the newly created geBody object.


Return to Contents


geBody* GENESISCC geBody_CreateFromFile(geVFile* pFile);

This function creates a new geBody object from the give data file pFile.

Returns: the newly created geBody object.


Return to Contents


void GENESISCC geBody_Destroy(geBody** B);

This function decreases the reference count for geBody B by one.  If the reference count goes to zero all resources allocated to B are freed.

Returns: nothing.


Return to Contents


void GENESISCC geBody_GetBone(const geBody* B, int BoneIndex, const char ** BoneName, geXForm3d* Attachment, int * ParentBoneIndex);

This function returns the name BoneName, attachment transformation matrix Attachment, and the parent bone index ParentBoneIndex of the bone BoneIndex of geBody B.

Returns: nothing.


Return to Contents


geBoolean GENESISCC geBody_GetBoneByName(const geBody* B, const char * BoneName, int * pBoneIndex, geXForm3d* Attachment, int * pParentBoneIndex);

This function returns the index pBoneIndex, attachment transformation matrix Attachment, and the parent bone index ParentBoneIndex of the bone indicated by name BoneName of geBody B.

Returns: GE_TRUE on success, GE_FALSE otherwise.


Return to Contents


int GENESISCC geBody_GetBoneCount(const geBody* B);

This function returns the number of bones associated with geBody B.

Returns: the result.


Return to Contents


int32 GENESISCC geBody_GetBoneNameChecksum(const geBody* B);

This function returns the 32bit checksum of all the bone names of geBody B.  (I think... I doubt this is of use except internally.)


Return to Contents


geBoolean GENESISCC geBody_GetBoundingBox(const geBody* B, int BoneIndex, geVec3d* MinimumBoxCorner, geVec3d* MaximumBoxCorner);

This function returns the non-axial-aligned bounding box of the bone indicated by BoneIndex of geBody B in the form of the 2 extreme corners MinimumBoxCorner and MaximumBoxCorner.

Returns: GE_TRUE on success, GE_FALSE otherwise.


Return to Contents


geBoolean GENESISCC geBody_GetGeometryStats(const geBody* B, int lod, int * Vertices, int * Faces, int * Normals);

This function returns the number of vertices Vertices, number of face Faces, and number of normals Normals of the given level-of-detail lod of geBody B. (I don't believe level-of-detail is really supported so should lod simply be 0? And wouldn't Normals = Vertices?)

Returns: GE_TRUE on success, GE_FALSE otherwise.


Return to Contents


geBoolean GENESISCC geBody_GetMaterial(const geBody* Body, int MaterialIndex, const char ** MaterialName, geBitmap** Bitmap, geFloat* Red, geFloat* Green, geFloat* Blue);

This function returns the material properties of the material at index MaterialIndex of geBody Body.  The material name MaterialName, associated geBitmap Bitmap and color (Red, Green, Blue) are returned.

Returns: GE_TRUE on success, GE_FALSE otherwise.

Notes:
    from BODY.H: returned bitmap is a pointer to the bitmap in the body's list.  It may not be destroyed. if caller would like to 'own' a copy of that bitmap pointer, it should call geBitmap_CreateRef()


Return to Contents


int GENESISCC geBody_GetMaterialCount(const geBody* B);

This function returns a count of the number of materials associated with geBody B.

Returns: the result.


Return to Contents


geBoolean GENESISCC geBody_IsValid(const geBody* B);

This function check that B represent a valid geBody object.

Returns: GE_TRUE if B is valid, GE_FALSE otherwise.


Return to Contents


void GENESISCC geBody_SetBoundingBox(geBody* B, int BoneIndex, const geVec3d* MinimumBoxCorner, const geVec3d* MaximumBoxCorner);

This function sets the non-axial-aligned bounding box of the bone at index BoneIndex of geBody B to the bounding box represented by the corners MinimumBoxCorner and MaximumBoxCorner.


Return to Contents


geBoolean GENESISCC geBody_SetMaterial(geBody* Body, int MaterialIndex, geBitmap* Bitmap, geFloat Red, geFloat Green, geFloat Blue);

This function sets the material properties of the material at index MaterialIndex of geBody Body to the geBitmap Bitmap and color (Red, Green, Blue).

Returns: GE_TRUE on success, GE_FALSE otherwise.

Notes:
    from BODY.H: Bitmap is set into the body.  It's reference count is increased.  Caller still owns a pointer to the bitmap, and is responsible for destroying it.


Return to Contents


geBoolean GENESISCC geBody_WriteToFile(const geBody* B, geVFile* pFile);

This function outputs the data for geBody B to the file pFile.

Returns: GE_TRUE on success, GE_FALSE otherwise.

Return to Contents