jeBody

Last Updated 3/9/2000.

Types:

jeBody;

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


Constants:

#define JE_BODY_NUMBER_OF_LOD (16)

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

Notes:
    from BODY.H: 0 is highest detail (this give 16 levels of LOD)


#define JE_BODY_HIGHEST_LOD (0)

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


#define JE_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.


JE_BODY_OPTIMIZE_FLAGS_

enum {
 JE_BODY_OPTIMIZE_FLAGS_NONE    = 1 << 0,
 JE_BODY_OPTIMIZE_FLAGS_VERTS   = 1 << 1,
 JE_BODY_OPTIMIZE_FLAGS_NORMALS   = 1 << 2,
 JE_BODY_OPTIMIZE_FLAGS_SORT_VERTS  = 1 << 3,
 JE_BODY_OPTIMIZE_FLAGS_SORT_FACES  = 1 << 4
};


#define JE_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.


Functions:

JETAPI jeBoolean JETCC jeBody_AddBone(jeBody *B, int ParentBoneIndex, const char* BoneName, const jeXForm3d* AttachmentMatrix, int* BoneIndex);

This function adds a bone with name BoneName to jeBody B as a child of ParentBoneIndex with a position and orientation specified by jeXForm3d AttachmentMatrix.  The bone index for the new bone is returned in BoneIndex.

Returns: JE_TRUE on success, JE_FALSE otherwise.


JETAPI jeBoolean JETCC jeBody_AddFace(jeBody* B, const jeVec3d* Vertex1, const jeVec3d* Normal1, jeFloat U1, jeFloat V1, int BoneIndex1, const jeVec3d* Vertex2, const jeVec3d* Normal2, jeFloat U2, jeFloat V2, int BoneIndex2, const jeVec3d* Vertex3, const jeVec3d* Normal3, jeFloat U3, jeFloat V3, int BoneIndex3, int MaterialIndex);

This function adds a new face to jeBody 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: JE_TRUE on success, JE_FALSE otherwise.


JETAPI jeBoolean JETCC jeBody_AddFaceWeightedVerts(jeBody* pBody, const jeVec3d* pVerts1, const jeVec3d* pNormal1, jeFloat u1, jeFloat v1, const int* pBoneIndexes1, const jeFloat* pVertWeights1, int NumVerts1, const jeVec3d* pVerts2, const jeVec3d* pNormal2, jeFloat u2, jeFloat v2, const int* pBoneIndexes2, const jeFloat* pVertWeights2, int NumVerts2, const jeVec3d* pVerts3, const jeVec3d* pNormal3, jeFloat u3, jeFloat v3, const int* pBoneIndexes3, const jeFloat* pVertWeights3, int NumVerts3, int materialIndex);

This function adds a face to jeBody pBody with weighted vertices and the material specified by materialIndex. I don't really understand the concept of weighted vertices so I'm not going to attempt to elaborate on this yet.

Returns:  JE_TRUE on success, JE_FALSE otherwise.

Notes:
    from BODY.H:  If each set of verts was only a single vertex (100% weight), jeBody_AddFaceWeightedVerts acts like jeBody_AddFace in a much less efficient manner.

JETAPI jeBoolean JETCC jeBody_AddMaterial(jeBody* B, const char* MaterialName, jeBitmap* Bitmap, jeFloat Red, jeFloat Green, jeFloat Blue, jeUVMapper pMapper, int* MaterialIndex);
This function adds a material to jeBody B.  A material contains a name MaterialName, an optional jeBitmap Bitmap, a color (Red, Green, Blue), and a jeUVMapper pMapper.  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: JE_TRUE on success, JE_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.


JETAPI jeBoolean JETCC jeBody_ComputeLevelsOfDetail(jeBody* B, int Levels);

This function calculates Levels levels of detail for jeBody B.  This is not currently implemented in any useful fashion.

Returns: JE_TRUE on success, JE_FALSE otherwise.


JETAPI jeBody* JETCC jeBody_Create(void);

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

Returns: the newly created jeBody object.


JETAPI jeBody* JETCC jeBody_CreateFromFile(jeVFile *pFile);

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

Returns: the newly created jeBody object.


JETAPI void JETCC jeBody_Destroy(jeBody** B);

This function destroys the jeBody B freeing up all associated resources.  As far as I can tell there is no reference counting going on here.

Returns: nothing.


JETAPI int16 JETCC jeBody_GetBlendDataCount(const jeBody* pBody);

I think this function relates to weighted vertices, so I'm not going to try to figure this out yet.


JETAPI void JETCC jeBody_GetBone(const jeBody* B, int BoneIndex, const char** BoneName, jeXForm3d* Attachment, int* ParentBoneIndex);

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

Returns: nothing.


JETAPI jeBoolean JETCC JeBody_GetBoneByName(const jeBody* B, const char* BoneName, int* pBoneIndex, jeXForm3d* 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 jeBody B.

Returns: JE_TRUE on success, JE_FALSE otherwise.


JETAPI int JETCC jeBody_GetBoneCount(const jeBody* B);

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

Returns: the result.


JETAPI int32 JETCC jeBody_GetBoneNameChecksum(const jeBody* B);

This function returns the 32bit checksum of all the bone names of jeBody B.  (I doubt this is of use except internally.  Does this really need to be in the public API?)


JETAPI jeBoolean JETCC jeBody_GetBoundingBox(const jeBody* B, int BoneIndex, jeVec3d* MinimumBoxCorner, jeVec3d* MaximumBoxCorner);

This function returns the axial-aligned bounding box of the bone indicated by BoneIndex of jeBody B in the form of the 2 extreme corners MinimumBoxCorner and MaximumBoxCorner.  Use JE_BODY_ROOT to specify the bounding box of the jeBody as a whole.

Returns: JE_TRUE on success, JE_FALSE otherwise.


JETAPI jeBoolean JETCC jeBody_GetGeometryStats(const jeBody* B, int lod, int* Vertices, int* Faces, int* Normals);

This function returns the number of vertices Vertices, number of faces Faces, and number of normals Normals of the given level-of-detail lod of jeBody B.

Returns: JE_TRUE on success, JE_FALSE otherwise.


JETAPI int JETCC jeBody_GetIndexedBoneVertexCount(const jeBody* pBody, int boneIndex);

This function returns the number of vertices associated with the bone at index boneIndex of jeBody pBody.

Returns:  the result.


JETAPI jeBoolean JETCC jeBody_GetIndexedBoneVertexLocations(const jeBody* pBody, int boneIndex, int aSize, jeVec3d* pVerts);

This function returns the locations of all the vertices associated with the bone at index boneIndex of jeBody pBody in pVerts.  pVerts should have space for aSize jeVec3ds where aSize is the number of vertices in the bone which can be retrieve using jeBody_GetIndexedBoneVertexCount. What space are the returned locations in?  Are they relative to the root bone of the body?  Or World-Space?

Returns:  JE_TRUE on success, JE_FALSE otherwise.


JETAPI jeBoolean JETCC jeBody_GetMaterial(const jeBody* Body, int MaterialIndex, const char** MaterialName, jeBitmap** Bitmap, jeFloat* Red, jeFloat* Green, jeFloat* Blue, jeUVMapper* pMapper);

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

Returns: JE_TRUE on success, JE_FALSE otherwise.

Notes:
    from BODY.H:  returned bitmap is 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 jeBitmap_CreateRef().


JETAPI int JETCC jeBody_GetMaterialCount(const jeBody* B);

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

Returns: the result.


JETAPI int JETCC jeBody_GetNamedBoneVertexCount(const jeBody* pBody, const char* pBoneName);

This function returns the number of vertices associated with bone named pBoneName of jeBody pBody.

Returns:  the result.


JETAPI jeBoolean JETCC jeBody_GetNamedBoneVertexLocations(const jeBody* pBody, const char* pBonename, int aSize, jeVec3d* pVerts);

This function returns the locations of all the vertices associated with the bone named pBoneName of jeBody pBody in pVerts.  pVerts should have space for aSize jeVec3ds where aSize is the number of vertices in the bone which can be retrieve using jeBody_GetNamedBoneVertexCount. What space are the returned locations in?  Are they relative to the root bone of the body?  Or World-Space?

Returns:  JE_TRUE on success, JE_FALSE otherwise.


JETAPI jeBoolean JETCC jeBody_IsValid(const jeBody* B);

This function check that B represent a valid jeBody object.

Returns: JE_TRUE if B is valid, JE_FALSE otherwise.


JETAPI void JETCC jeBody_Optimize(jeBody* pBody);

This function optimizes the geometry data of jeBody pBody to speed up rendering and modification of the geometry.

Returns:  nothing.
 

JETAPI void JETCC jeBody_SetBoundingBox(jeBody* B, int BoneIndex, const jeVec3d* MinimumBoxCorner, const jeVec3d* MaximumBoxCorner);
This function sets the axial-aligned bounding box of the bone at index BoneIndex of jeBody B to the bounding box represented by the corners MinimumBoxCorner and MaximumBoxCorner.  Use a BoneIndex of JE_BODY_ROOT to specify the jeBody as a whole.

Returns:  nothing.


JETAPI jeBoolean JETCC jeBody_SetMaterial(jeBody* Body, int MaterialIndex, jeBitmap* Bitmap, jeFloat Red, jeFloat Green, jeFloat Blue, jeUVMapper Mapper);

This function sets the material properties of the material at index MaterialIndex of jeBody Body to the jeBitmap Bitmap, color (Red, Green, Blue), and jeUVMapper Mapper.

Returns: JE_TRUE on success, JE_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.


JETAPI jeBoolean JETCC jeBody_SetOptimizeFlags(jeBody* pBody, uint32 flags);

This function sets the optimization flags for jeBody pBody.  These flags affect whether duplication should be checked for during modification of the jeBodys geometry.  If one of the optimization flags is set then duplication is checked.  Utilize the JE_BODY_OPTIMIZE_FLAGS_ constants.

Returns:  JE_TRUE on success, JE_FALSE otherwise.
 

JETAPI jeBoolean JETCC jeBody_WriteToFile(const jeBody* B, jeVFile* pFile);
This function outputs the data for jeBody B to the file pFile.

Returns: JE_TRUE on success, JE_FALSE otherwise.