angle limit constraint
[carveJwlIkooP6JGAAIwe30JlM.git] / model.h
diff --git a/model.h b/model.h
index 21a4e2fe2e75a4a8917d4f6af09aee44574419f4..78e67c0367ba9dcbc0a855afa688ee95a8a255a8 100644 (file)
--- a/model.h
+++ b/model.h
@@ -10,6 +10,8 @@ typedef struct mdl_submesh mdl_submesh;
 typedef struct mdl_material mdl_material;
 typedef struct mdl_node mdl_node;
 typedef struct mdl_header mdl_header;
+typedef struct mdl_animation mdl_animation;
+typedef struct mdl_keyframe mdl_keyframe;
 
 #define MDL_SIZE_MAX          0x1000000
 #define MDL_VERT_MAX          1000000
@@ -59,10 +61,27 @@ struct mdl_node
        submesh_count,
        classtype,
        offset,
-       children,
+       parent,
        pstr_name;
 };
 
+struct mdl_keyframe
+{
+   v3f co;
+   v4f q;
+   v3f s;
+};
+
+struct mdl_animation
+{
+   u32 pstr_name,
+       length;
+
+   float rate;
+
+   u32 offset;
+};
+
 struct mdl_header
 {
    u32 identifier, version, file_length;
@@ -72,8 +91,8 @@ struct mdl_header
        submesh_count, submesh_offset,
        material_count, material_offset,
        node_count, node_offset,
-       strings_offset, entdata_offset,
-       anim_count, anim_offset;
+       anim_count, anim_offset,
+       strings_offset, entdata_offset, animdata_offset;
 };
 
 /* 
@@ -130,12 +149,22 @@ struct classtype_route
 
 struct classtype_bone
 {
-   u32 deform;
+   u32 deform,
+       ik_target,
+       ik_pole,
+       collider,
+       use_limits;
+
+   v3f angle_limits[2];
+   boxf hitbox;
 };
 
 struct classtype_skeleton
 {
-   u32 anim_start,
+   u32 channels,
+       ik_count,
+       collider_count,
+       anim_start,
        anim_count;
 };
 
@@ -423,6 +452,11 @@ static mdl_material *mdl_material_from_id( mdl_header *mdl, u32 id )
    return ((mdl_material *)mdl_baseptr(mdl,mdl->material_offset)) + id;
 }
 
+static mdl_animation *mdl_animation_from_id( mdl_header *mdl, u32 id )
+{
+   return ((mdl_animation *)mdl_baseptr(mdl,mdl->anim_offset)) + id;
+}
+
 static void mdl_node_transform( mdl_node *pnode, m4x3f transform )
 {
    q_m3x3( pnode->q, transform );
@@ -470,6 +504,11 @@ static void *mdl_get_entdata( mdl_header *mdl, mdl_node *pnode )
    return mdl_baseptr( mdl, mdl->entdata_offset ) + pnode->offset;
 }
 
+static mdl_keyframe *mdl_get_animdata( mdl_header *mdl, mdl_animation *anim )
+{
+   return mdl_baseptr( mdl, mdl->animdata_offset ) + anim->offset;
+}
+
 static void mdl_link_materials( mdl_header *root, mdl_header *child )
 {
    u32 lookup[MDL_MATERIAL_MAX];