1 #ifndef __SKELETON_H__ 2 #define __SKELETON_H__ 3 4 #include "actors.h" 5 #include "cal3d_wrapper.h" 6 7 #ifdef __cplusplus 8 extern "C" { 9 #endif 10 11 /*! 12 * \brief The main used bones 13 */ 14 typedef enum { 15 head_bone = 0, 16 mouth_bone = 1, 17 body_top_bone = 2, 18 body_bottom_bone = 3, 19 cape_top_bone = 4, 20 cape_middle_bone = 5, 21 cape_bottom_bone = 6, 22 weapon_left_bone = 7, 23 weapon_right_bone = 8, 24 staff_right_bone = 9, 25 arrow_bone = 10, 26 hand_left_bone = 11, 27 hand_right_bone = 12, 28 highest_bone = 13 29 } cal_bone_name; 30 31 #define MAX_MAIN_CAL_BONES 14 32 33 /*! 34 * \brief Structure that holds the IDs of the main bones for a skeleton 35 */ 36 typedef struct { 37 char name[MAX_FILE_PATH]; /*!< The name of the skeleton */ 38 int cal_bones_id[MAX_MAIN_CAL_BONES]; /*!< The main bones IDs by their names */ 39 } skeleton_types; 40 41 #define MAX_SKELETONS 20 42 43 /*! 44 * \brief Array that contains all the main bones definitions for each existing skeleton 45 */ 46 extern skeleton_types skeletons_defs[MAX_SKELETONS]; 47 extern int skeletons_count; 48 49 /*! 50 * \brief Get the ID of an actor bone by its name in a core skeleton 51 * \param skel the core skeleton 52 * \param name the name of the bone 53 * \return the ID of the bone if it exists, else -1 54 */ 55 int find_core_bone_id(struct CalCoreSkeleton *skel, const char *name); 56 57 /*! 58 * \brief Get the ID of a skeleton by its name 59 * \param cal_model the cal model that contains the cal skeleton 60 * \param skeleton_name the name of the skeleton 61 * 62 * This function checks in the skeletons_defs array if the skeleton already 63 * exists and returns the corresponding ID if true. 64 * Otherwise, it adds a new skeleton to the array and setup the IDs for the 65 * different bones names according to the name of the skeleton. 66 */ 67 int get_skeleton(struct CalCoreModel *cal_model, const char *skeleton_name); 68 69 /*! 70 * \brief Get the ID of an actor bone by its name 71 * \param act the actor 72 * \param name the predefined name of the bone 73 * \return the ID of the bone if it exists, else -1 74 * 75 * When accessing to several bones IDs in the same function for the 76 * same actor, prefer using directly the data structure to get a pointer 77 * on the corresponding skeleton_types structure. 78 */ 79 int get_actor_bone_id(actor *act, cal_bone_name name); 80 81 #ifdef __cplusplus 82 } // extern "C" 83 #endif 84 85 #endif // __SKELETON_H__ 86