polyadvent

A game engine from scratch in C
git clone git://jb55.com/polyadvent
Log | Files | Refs | README

animation.c (579B)


      1 
      2 #include <stdio.h>
      3 #include "xml.h"
      4 #include "util.h"
      5 #include "node.h"
      6 #include "debug.h"
      7 #include "animation.h"
      8 
      9 void init_joint(struct joint *joint)
     10 {
     11     joint->id = -1;
     12     joint->n_children_ids = 0;
     13     for (int i = 0; i < MAX_JOINT_CHILDREN; i++) {
     14         joint->children_ids[i] = -1;
     15     }
     16     init_id(&joint->node_id);
     17 }
     18 
     19 void new_joint(struct joint *joint)
     20 {
     21     init_joint(joint);
     22     new_node(&joint->node_id);
     23 }
     24 
     25 
     26 void init_pose(struct pose *pose)
     27 {
     28     pose->njoints = 0;
     29     for (int i = 0; i < MAX_JOINTS; i++) {
     30         init_joint(&pose->joints[i]);
     31     }
     32 }
     33 
     34