solstice-anim

Geometry animation library of the solstice app
git clone git://git.meso-star.com/solstice-anim.git
Log | Files | Refs | README | LICENSE

commit e59747112c9eb6d1189898667d6bf7a580b30ea8
parent c70b0d454c420a36a464955e7e4584c7829861e7
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Wed, 12 Oct 2016 11:41:56 +0200

Add some node test

Diffstat:
Msrc/test_sanim_node.c | 28++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/test_sanim_node.c b/src/test_sanim_node.c @@ -103,8 +103,8 @@ int main(int argc, char** argv) { struct mem_allocator allocator; - struct my_type t1, t2; - double transl[3], rot[3], transform[12]; + struct my_type t1, t2, t3, t; + double transl[3], rot[3], transform[12], transform2[12]; (void) argc, (void) argv; mem_init_proxy_allocator(&allocator, &mem_default_allocator); @@ -151,8 +151,32 @@ main(int argc, char** argv) CHECK(d33_is_identity_eps(transform, 1e-10), 1); CHECK(d3_is_zero_eps(transform + 9, 1e-10), 1); + /* check 1 node with 3 rotations VS 3 chained nodes with 1 rotation each */ + d3(rot, 0.17, -0.52, 0.31); + d3(transl, 0.3, 2, -1); + CHECK(my_type_init(&allocator, &t), RES_OK); + CHECK(my_type_set_translation(&t, transl), RES_OK); + CHECK(my_type_set_rotations(&t, rot), RES_OK); + CHECK(my_type_get_world_transform(&t, transform), RES_OK); + CHECK(my_type_init(&allocator, &t3), RES_OK); + CHECK(my_type_add_child(&t2, &t3), RES_OK); + d3(rot, 0.17, 0, 0); + CHECK(my_type_set_translation(&t1, transl), RES_OK); + CHECK(my_type_set_rotations(&t1, rot), RES_OK); + d3(transl, 0, 0, 0); + d3(rot, 0, -0.52, 0); + CHECK(my_type_set_translation(&t2, transl), RES_OK); + CHECK(my_type_set_rotations(&t2, rot), RES_OK); + d3(rot, 0, 0, 0.31); + CHECK(my_type_set_translation(&t3, transl), RES_OK); + CHECK(my_type_set_rotations(&t3, rot), RES_OK); + CHECK(my_type_get_world_transform(&t3, transform2), RES_OK); + CHECK(d33_eq_eps(transform, transform2, 1e-10), 1); + CHECK(my_type_release(&t1), RES_OK); CHECK(my_type_release(&t2), RES_OK); + CHECK(my_type_release(&t3), RES_OK); + CHECK(my_type_release(&t), RES_OK); check_memory_allocator(&allocator); mem_shutdown_proxy_allocator(&allocator);