Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Luc Peurière <jlp@nerim.net>2007-07-29 22:03:36 +0400
committerJean-Luc Peurière <jlp@nerim.net>2007-07-29 22:03:36 +0400
commitbfa77f611f750510e1ee0eda15d987990281ef7c (patch)
tree262cdea55afd894679d8f0356b2e7252b12953bf /source/blender/src/view.c
parent288e07b649ac700f04d2a54d83301235a0b3c04e (diff)
more work on the ndof system.
turntable code should work reasonabilly well now. fly code need works but is no more insane on Os X. transform object is not present here. if you find the movements a bit slow, you can speed it in the preferences up to 2x in the view & controls panel. button1 (left) of the device let you switch between the 3 modes. button2 let you switch between unconstrained and dominant mode. the plugin must be named 3DxNdofBlender.plug and be placed in a folder named plugins in same folder as executable check no scaling is done in the plugin please check it works ok on 3 platforms
Diffstat (limited to 'source/blender/src/view.c')
-rw-r--r--source/blender/src/view.c83
1 files changed, 55 insertions, 28 deletions
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index c84addcf0ff..06782b1a873 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -545,13 +545,24 @@ void calctrackballvec(rcti *area, short *mval, float *vec)
// can be increased for improved response from
// small deflections of the device input.
+
+// lukep notes : i disagree on the range.
+// the normal 3Dconnection driver give +/-400
+// on defaut range in other applications
+// and up to +/- 1000 if set to maximum
+// because i remove the scaling by delta,
+// which was a bad idea as it depend of the system
+// speed and os, i changed the scaling values, but
+// those are still not ok
+
+
float ndof_axis_scale[6] = {
- +2.0, // Tx
- +2.0, // Tz
- +2.0, // Ty
- +0.25, // Rx
- +0.25, // Rz
- +0.25 // Ry
+ +0.01, // Tx
+ +0.01, // Tz
+ +0.01, // Ty
+ +0.0015, // Rx
+ +0.0015, // Rz
+ +0.0015 // Ry
};
// statics for controlling G.vd->dist corrections.
@@ -563,10 +574,20 @@ float m_dist;
void getndof(float *sbval);
-#define USE_NEW_NDOFMOVE
+static filterNDOFvalues(float *sbval)
+{
+ int i=0;
+ float max = 0.0;
+
+ for (i =0; i<5;i++)
+ if (fabs(sbval[i]) > max)
+ max = fabs(sbval[i]);
+ for (i =0; i<5;i++)
+ if (fabs(sbval[i]) != max )
+ sbval[i]=0.0;
+}
-#ifdef USE_NEW_NDOFMOVE
-void viewmoveNDOF(int mode)
+void viewmoveNDOFfly(int mode)
{
int i;
float phi;
@@ -589,16 +610,18 @@ void viewmoveNDOF(int mode)
// fetch the current state of the ndof device
getndof(dval);
- for(i=0;i<7;i++) printf("%f ",dval[i]);
- printf("\n");
+ if (G.vd->ndoffilter)
+ filterNDOFvalues(fval);
+
+// for(i=0;i<7;i++) printf("%f ",dval[i]);
+// printf("\n");
// Scale input values
- if(dval[6] == 0) return; // guard against divide by zero
+// if(dval[6] == 0) return; // guard against divide by zero
for(i=0;i<6;i++) {
- dval[i] = dval[i] / dval[6]; // this should be moved to device specific
// user scaling
dval[i] = dval[i] * ndof_axis_scale[i];
@@ -695,7 +718,6 @@ void viewmoveNDOF(int mode)
/*----------------------------------------------------
* refresh the screen
*/
-
scrarea_do_windraw(curarea);
screen_swapbuffers();
@@ -704,8 +726,6 @@ void viewmoveNDOF(int mode)
BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
}
-#endif
-
void viewmove(int mode)
{
Object *ob = OBACT;
@@ -994,10 +1014,6 @@ void viewmove(int mode)
}
-
-#ifndef USE_NEW_NDOFMOVE
-
-
void viewmoveNDOF(int mode)
{
static double prevTime = 0.0;
@@ -1057,19 +1073,31 @@ void viewmoveNDOF(int mode)
/* fetch the current state of the ndof device */
getndof(fval);
- // printf(" motion command %f %f %f %f %f %f %f \n", fval[0], fval[1], fval[2],
- // fval[3], fval[4], fval[5], fval[6]);
-
+ // printf(" motion command %f %f %f %f %f %f %f \n", fval[0], fval[1], fval[2],
+ // fval[3], fval[4], fval[5], fval[6]);
+ if (G.vd->ndoffilter)
+ filterNDOFvalues(fval);
+
// put scaling back here, was previously in ghostwinlay
fval[0] = fval[0] * (1.0f/1024.0f);
fval[1] = fval[1] * (1.0f/1024.0f);
fval[2] = fval[2] * (1.0f/1024.0f);
- fval[3] = fval[3] * 0.00003f;
- fval[4] = fval[4] * 0.00003f;
- fval[5] = fval[5] * 0.00003f;
+ fval[3] = fval[3] * 0.00005f;
+ fval[4] = fval[4] * 0.00005f;
+ fval[5] = fval[5] * 0.00005f;
fval[6] = fval[6] / 1000000.0f;
-
+
+ // scale more if not in perspective mode
+ if (G.vd->persp == 0) {
+ fval[0] = fval[0] * 0.05f;
+ fval[1] = fval[1] * 0.05f;
+ fval[2] = fval[2] * 0.05f;
+ fval[3] = fval[3] * 0.9f;
+ fval[4] = fval[4] * 0.9f;
+ fval[5] = fval[5] * 0.9f;
+ }
+
/* set object offset */
if (ob) {
@@ -1169,7 +1197,6 @@ void viewmoveNDOF(int mode)
screen_swapbuffers();
}
-#endif
/* Gets the lens and clipping values from a camera of lamp type object */