Page MenuHome

toets.c.patch.txt

File Metadata

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

toets.c.patch.txt

--- source/blender/src/toets.c 23 Mar 2005 21:10:02 -0000 1.50
+++ source/blender/src/toets.c 25 Mar 2005 04:22:19 -0000
@@ -246,6 +246,39 @@
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;
+
+ G.vd->view= 0;
+ {
+ 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,28 +301,19 @@
/* 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;
+ 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) {
- 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);
+ 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) {
- G.vd->viewquat[0]= 0.5;
- G.vd->viewquat[1]= -0.5;
- G.vd->viewquat[2]= 0.5;
- G.vd->viewquat[3]= 0.5;
+ 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,28 +349,21 @@
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;
+ 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) {
- 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;
+ 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) {
- G.vd->viewquat[0]= 0.5;
- G.vd->viewquat[1]= -0.5;
- G.vd->viewquat[2]= -0.5;
- G.vd->viewquat[3]= -0.5;
+ 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