diff options
author | epoch <epoch@hacking.allowed.org> | 2018-02-07 00:20:55 -0600 |
---|---|---|
committer | epoch <epoch@hacking.allowed.org> | 2018-02-07 00:20:55 -0600 |
commit | 5d5b97c95fad361b5f7e1014683d4c13cdbcae31 (patch) | |
tree | 326f0f2e87956eb966c1da50776071a9a8c8b7c3 | |
parent | 10931750ab9a9a96c3eede85c83b6a420e75cf0e (diff) | |
download | hackvr-5d5b97c95fad361b5f7e1014683d4c13cdbcae31.tar.gz hackvr-5d5b97c95fad361b5f7e1014683d4c13cdbcae31.zip |
added ability for shapes to rotate around the z-axis in addition to y-axis
-rw-r--r-- | src/graphics_c3.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/graphics_c3.c b/src/graphics_c3.c index 2a275bb..1b59827 100644 --- a/src/graphics_c3.c +++ b/src/graphics_c3.c @@ -204,8 +204,12 @@ void draw_c3_shape(c3_s_t s) {//outlined. needs to be filled? //draw minimap shi c3_group_rot_t *gr=get_group_rotation(s.id); if(s.len > 1) { for(i=0;i<s.len+(s.len==1);i++) {//apply the group's rotation and store in s2. - s2.p[i]=(gr?c3_add(gr->p,rotate_c3_yr(s.p[i],gr->p,d2r(gr->r.y))):s.p[i]); - //s2.p[i]=c3_to_c2(s.p[i]); + if(gr) { + //s2.p[i]=c3_add(gr->p,rotate_c3_yr(s.p[i],gr->p,d2r(gr->r.y))); + s2.p[i]=c3_add(gr->p,rotate_c3_yr(rotate_c3_zr(s.p[i],gr->p,d2r(gr->r.z)),gr->p,d2r(gr->r.y))); + } else { + s2.p[i]=s.p[i]; + } } } if(s.len == 1) { @@ -525,7 +529,7 @@ int graphics_init() { global.mmz=1;//this is minimap zoom. global.shape[0]=0;//we'll allocate as we need more. - global.camera.id=global.user; + global.camera.id=strdup(global.user);//make a copy so if we change global.user later we can reattach to this camera. global.group_rot[0]=&global.camera; global.group_rot[1]=0; |