goat3d
diff src/goat3d.cc @ 95:da100bf13f7f
[goat3d] implemented animation loading
[goatview] working on the animation controls
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 19 May 2014 06:42:40 +0300 |
parents | 7941e89798e5 |
children |
line diff
1.1 --- a/src/goat3d.cc Sun May 18 19:58:47 2014 +0300 1.2 +++ b/src/goat3d.cc Mon May 19 06:42:40 2014 +0300 1.3 @@ -885,6 +885,63 @@ 1.4 return node->get_animation_name(); 1.5 } 1.6 1.7 +GOAT3DAPI long goat3d_get_anim_timeline(struct goat3d_node *root, long *tstart, long *tend) 1.8 +{ 1.9 + if(root->get_timeline_bounds(tstart, tend)) { 1.10 + return *tend - *tstart; 1.11 + } 1.12 + return -1; 1.13 +} 1.14 + 1.15 +GOAT3DAPI int goat3d_get_node_position_key_count(struct goat3d_node *node) 1.16 +{ 1.17 + return node->get_position_key_count(); 1.18 +} 1.19 + 1.20 +GOAT3DAPI int goat3d_get_node_rotation_key_count(struct goat3d_node *node) 1.21 +{ 1.22 + return node->get_rotation_key_count(); 1.23 +} 1.24 + 1.25 +GOAT3DAPI int goat3d_get_node_scaling_key_count(struct goat3d_node *node) 1.26 +{ 1.27 + return node->get_scaling_key_count(); 1.28 +} 1.29 + 1.30 +GOAT3DAPI long goat3d_get_node_position_key(struct goat3d_node *node, int idx, float *xptr, float *yptr, float *zptr) 1.31 +{ 1.32 + Vector3 pos = node->get_position_key_value(idx); 1.33 + long tm = node->get_position_key_time(idx); 1.34 + 1.35 + if(xptr) *xptr = pos.x; 1.36 + if(yptr) *yptr = pos.y; 1.37 + if(zptr) *zptr = pos.z; 1.38 + return tm; 1.39 +} 1.40 + 1.41 +GOAT3DAPI long goat3d_get_node_rotation_key(struct goat3d_node *node, int idx, float *xptr, float *yptr, float *zptr, float *wptr) 1.42 +{ 1.43 + Quaternion rot = node->get_rotation_key_value(idx); 1.44 + long tm = node->get_rotation_key_time(idx); 1.45 + 1.46 + if(xptr) *xptr = rot.v.x; 1.47 + if(yptr) *yptr = rot.v.y; 1.48 + if(zptr) *zptr = rot.v.z; 1.49 + if(wptr) *wptr = rot.s; 1.50 + return tm; 1.51 +} 1.52 + 1.53 +GOAT3DAPI long goat3d_get_node_scaling_key(struct goat3d_node *node, int idx, float *xptr, float *yptr, float *zptr) 1.54 +{ 1.55 + Vector3 scale = node->get_scaling_key_value(idx); 1.56 + long tm = node->get_scaling_key_time(idx); 1.57 + 1.58 + if(xptr) *xptr = scale.x; 1.59 + if(yptr) *yptr = scale.y; 1.60 + if(zptr) *zptr = scale.z; 1.61 + return tm; 1.62 +} 1.63 + 1.64 GOAT3DAPI void goat3d_set_node_position(struct goat3d_node *node, float x, float y, float z, long tmsec) 1.65 { 1.66 node->set_position(Vector3(x, y, z), tmsec);