Page MenuHome

blender-source-blender-src-toets.c.patch

File Metadata

Author
John Aughey (aughey)
Created
Nov 13 2013, 12:58 PM

blender-source-blender-src-toets.c.patch

*** toets.c.old 2005-03-24 08:35:10.000000000 -0600
--- toets.c 2005-03-24 13:26:22.103436104 -0600
***************
*** 246,251 ****
--- 246,283 ----
return 0;
}
+ static void animateview(float q0, float q1, float q2, float q3)
+ {
+ float start[4];
+ float result[4];
+
+ start[0] = G.vd->viewquat[0];
+ start[1] = G.vd->viewquat[1];
+ start[2] = G.vd->viewquat[2];
+ start[3] = G.vd->viewquat[3];
+
+ result[0] = q0;
+ result[1] = q1;
+ result[2] = q2;
+ result[3] = q3;
+
+ {
+ int starttime = clock();
+ int diff = 0;
+ while(diff < 500) {
+ QuatInterpol(G.vd->viewquat, start,result, (float)diff/(float)500);
+ scrarea_do_windraw(curarea);
+ screen_swapbuffers();
+ diff = clock() - starttime;
+ }
+ }
+
+ G.vd->viewquat[0]= q0;
+ G.vd->viewquat[1]= q1;
+ G.vd->viewquat[2]= q2;
+ G.vd->viewquat[3]= q3;
+ }
+
void persptoetsen(unsigned short event)
{
static Object *oldcamera=0;
***************
*** 268,295 ****
/* G.vd->persp= 3; */
}
else if(event==PAD7) {
! G.vd->viewquat[0]= 0.0;
! G.vd->viewquat[1]= -1.0;
! G.vd->viewquat[2]= 0.0;
! G.vd->viewquat[3]= 0.0;
G.vd->view= 7;
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
else if(G.vd->persp>=2) G.vd->persp= perspo;
}
else if(event==PAD1) {
! G.vd->viewquat[0]= 0.0;
! G.vd->viewquat[1]= 0.0;
! G.vd->viewquat[2]= (float)-cos(M_PI/4.0);
! G.vd->viewquat[3]= (float)-cos(M_PI/4.0);
G.vd->view=1;
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
else if(G.vd->persp>=2) G.vd->persp= perspo;
}
else if(event==PAD3) {
! G.vd->viewquat[0]= 0.5;
! G.vd->viewquat[1]= -0.5;
! G.vd->viewquat[2]= 0.5;
! G.vd->viewquat[3]= 0.5;
G.vd->view=3;
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
else if(G.vd->persp>=2) G.vd->persp= perspo;
--- 300,318 ----
/* G.vd->persp= 3; */
}
else if(event==PAD7) {
! animateview(0.0,-1.0,0.0,0.0);
G.vd->view= 7;
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
else if(G.vd->persp>=2) G.vd->persp= perspo;
}
else if(event==PAD1) {
! animateview(0.0,0.0,-cos(M_PI/4.0),-cos(M_PI/4.0));
G.vd->view=1;
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
else if(G.vd->persp>=2) G.vd->persp= perspo;
}
else if(event==PAD3) {
! animateview(0.5,-0.5,0.5,0.5);
G.vd->view=3;
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
else if(G.vd->persp>=2) G.vd->persp= perspo;
***************
*** 325,352 ****
else {
if(event==PAD7) {
! G.vd->viewquat[0]= 1.0;
! G.vd->viewquat[1]= 0.0;
! G.vd->viewquat[2]= 0.0;
! G.vd->viewquat[3]= 0.0;
G.vd->view=7;
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
else if(G.vd->persp>=2) G.vd->persp= perspo;
}
else if(event==PAD1) {
! G.vd->viewquat[0]= (float)cos(M_PI/4.0);
! G.vd->viewquat[1]= (float)-sin(M_PI/4.0);
! G.vd->viewquat[2]= 0.0;
! G.vd->viewquat[3]= 0.0;
G.vd->view=1;
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
else if(G.vd->persp>=2) G.vd->persp= perspo;
}
else if(event==PAD3) {
! G.vd->viewquat[0]= 0.5;
! G.vd->viewquat[1]= -0.5;
! G.vd->viewquat[2]= -0.5;
! G.vd->viewquat[3]= -0.5;
G.vd->view=3;
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
else if(G.vd->persp>=2) G.vd->persp= perspo;
--- 348,368 ----
else {
if(event==PAD7) {
! animateview(1.0,0.0,0.0,0.0);
!
G.vd->view=7;
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
else if(G.vd->persp>=2) G.vd->persp= perspo;
}
else if(event==PAD1) {
! animateview((float)cos(M_PI/4.0),(float)-sin(M_PI/4.0),0.0,0.0);
G.vd->view=1;
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
else if(G.vd->persp>=2) G.vd->persp= perspo;
}
else if(event==PAD3) {
! animateview(0.5,-0.5,-0.5,-0.5);
!
G.vd->view=3;
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
else if(G.vd->persp>=2) G.vd->persp= perspo;

Event Timeline