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
path: root/source
diff options
context:
space:
mode:
authorJean-Luc Peurière <jlp@nerim.net>2007-06-13 00:01:28 +0400
committerJean-Luc Peurière <jlp@nerim.net>2007-06-13 00:01:28 +0400
commitedc6512ba6528fce4442f9b20875d1a301a0ceef (patch)
tree929c8cd8e32cc3aa44d41fdde1c55a86b93ba78c /source
parent6cc1269d976641e6fdac59d1c1afbc96ae3aab8b (diff)
first workable version on Os X
work only in non camera mode in 3D view need the external plug-in to be compiled separately line 894 of ghostwinlay.c must be replaced with values adapted at your system see mailing list for features planned and how to use
Diffstat (limited to 'source')
-rw-r--r--source/blender/src/ghostwinlay.c57
-rw-r--r--source/blender/src/space.c2
-rw-r--r--source/blender/src/view.c18
3 files changed, 47 insertions, 30 deletions
diff --git a/source/blender/src/ghostwinlay.c b/source/blender/src/ghostwinlay.c
index 19e858a9f59..0a04b0b8003 100644
--- a/source/blender/src/ghostwinlay.c
+++ b/source/blender/src/ghostwinlay.c
@@ -556,25 +556,35 @@ static int event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
case GHOST_kEventNDOFMotion: {
// update ndof device data, and dispatch motion event
- GHOST_TEventNDOFData *sb= data;
- win->ndof[0] = sb->tx;
- win->ndof[1] = sb->ty;
- win->ndof[2] = sb->tz;
- win->ndof[3] = sb->rx;
- win->ndof[4] = sb->ry;
- win->ndof[5] = sb->rz;
- win->ndof[6] = sb->dt;
-
- // start interaction for larger than teeny-tiny motions
- if ((fabsf(sb->tx) > 0.03f) ||
- (fabsf(sb->ty) > 0.03f) ||
- (fabsf(sb->tz) > 0.03f) ||
- (fabsf(sb->rx) > 0.03f) ||
- (fabsf(sb->ry) > 0.03f) ||
- (fabsf(sb->rz) > 0.03f)) {
- window_handle(win, NDOFMOTION, sb->dt * 255);
- }
+ GHOST_TEventNDOFData *sb= data;
+
+ // the multipliers are arbitrary values
+ // they could be ajustable in the future
+ win->ndof[0] = sb->tx * (1.0f/1024.0f);
+ win->ndof[1] = sb->ty * (1.0f/1024.0f);
+ win->ndof[2] = sb->tz * (1.0f/1024.0f);
+ win->ndof[3] = sb->rx * 0.00003f;
+ win->ndof[4] = sb->ry * 0.00003f;
+ win->ndof[5] = sb->rz * 0.00003f;
+ win->ndof[6] = sb->delta / 1000000.0f;
+ // printf(" motion capted %f %f %f %f %f %f %f \n", win->ndof[0], win->ndof[1], win->ndof[2],
+ // win->ndof[3], win->ndof[4], win->ndof[5], win->ndof[6]);
+
+
+ // window_handle(win, NDOFMOTION, win->ndof[6]);
+
+ // start interaction for larger than teeny-tiny motions
+ // if (fabs(win->ndof[0] > 0.003f) ||
+ // fabs(win->ndof[1] > 0.003f) ||
+ // fabs(win->ndof[2] > 0.003f) ||
+ // fabs(win->ndof[3] > 0.003f) ||
+ // fabs(win->ndof[4] > 0.003f) ||
+ // fabs(win->ndof[5] > 0.003f)) {
+ window_handle(win, NDOFMOTION, 1);
+ // printf("ok\n");
+ // }
+;
break;
}
@@ -881,16 +891,19 @@ Window *winlay_get_active_window(void) {
void window_open_ndof(Window* win)
{
- PILdynlib* ndofLib = PIL_dynlib_open("spaceplug.plug");
+ PILdynlib* ndofLib = PIL_dynlib_open("XXXXXXX-PUT-HERE-YOUR-PATH-TO-THE-PLUG--/spaceplug.plug");
if (ndofLib) {
GHOST_OpenNDOF(g_system, win->ghostwin,
PIL_dynlib_find_symbol(ndofLib, "ndofInit"),
PIL_dynlib_find_symbol(ndofLib, "ndofShutdown"),
- PIL_dynlib_find_symbol(ndofLib, "ndofOpen"),
- PIL_dynlib_find_symbol(ndofLib, "ndofEventHandler"));
+ PIL_dynlib_find_symbol(ndofLib, "ndofOpen"));
+
+// original patch only
+// PIL_dynlib_find_symbol(ndofLib, "ndofEventHandler"));
}
else {
- GHOST_OpenNDOF(g_system, win->ghostwin, 0, 0, 0, 0);
+// GHOST_OpenNDOF(g_system, win->ghostwin, 0, 0, 0, 0);
+ GHOST_OpenNDOF(g_system, win->ghostwin, 0, 0, 0);
}
}
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index bcb3a2784d6..c09f2e79243 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -1568,7 +1568,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case NDOFMOTION:
- viewmoveNDOF(0);
+ viewmoveNDOF(1);
break;
case ONEKEY:
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index e26b4526ebe..287f86796c5 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -827,6 +827,8 @@ void viewmoveNDOF(int mode)
float diff[4];
float d, curareaX, curareaY;
+//printf("passing here \n");
+
/* Sensitivity will control how fast the view rotates. The value was
* obtained experimentally by tweaking until the author didn't get dizzy watching.
* Perhaps this should be a configurable user parameter.
@@ -852,16 +854,18 @@ void viewmoveNDOF(int mode)
* record how much time has passed. clamp at 10 Hz
* pretend the previous frame occured at the clamped time
*/
- now = PIL_check_seconds_timer();
- frametime = (now - prevTime);
- if (frametime > 0.1f){ /* if more than 1/10s */
- frametime = 1.0f/60.0; /* clamp at 1/60s so no jumps when starting to move */
- }
- prevTime = now;
- sbadjust *= 60 * frametime; /* normalize ndof device adjustments to 100Hz for framerate independence */
+// now = PIL_check_seconds_timer();
+ // frametime = (now - prevTime);
+ // if (frametime > 0.1f){ /* if more than 1/10s */
+ // frametime = 1.0f/60.0; /* clamp at 1/60s so no jumps when starting to move */
+// }
+// prevTime = now;
+ // sbadjust *= 60 * frametime; /* normalize ndof device adjustments to 100Hz for framerate independence */
/* 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]);
/* set object offset */
if (ob) {