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
This commit is contained in:
Jean-Luc Peurière 2007-06-12 20:01:28 +00:00
parent 6cc1269d97
commit edc6512ba6
14 changed files with 252 additions and 107 deletions

@ -276,8 +276,11 @@ extern void GHOST_OpenNDOF(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle windowhandle,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
GHOST_NDOFEventHandler_fp setNdofEventHandler);
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen
);
// original patch only
// GHOST_NDOFEventHandler_fp setNdofEventHandler);
/***************************************************************************************
** Cursor management functionality

@ -305,8 +305,10 @@ public:
virtual void openNDOF(GHOST_IWindow*,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
GHOST_NDOFEventHandler_fp setNdofEventHandler) = 0;
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen
// original patch only
// GHOST_NDOFEventHandler_fp setNdofEventHandler
) = 0;
/***************************************************************************************

@ -338,18 +338,37 @@ typedef struct {
GHOST_TInt32 z;
} GHOST_TEventWheelData;
/* original patch used floats, but the driver return ints and uns. We will calibrate in view, no sense on doing conversions twice */
/* as all USB device controls are likely to use ints, this is also more future proof */
//typedef struct {
// /** N-degree of freedom device data */
// float tx, ty, tz; /** -x left, +y up, +z forward */
// float rx, ry, rz;
// float dt;
//} GHOST_TEventNDOFData;
typedef struct {
/** N-degree of freedom device data v2*/
int changed;
GHOST_TUns64 client;
GHOST_TUns64 address;
GHOST_TInt16 tx, ty, tz; /** -x left, +y up, +z forward */
GHOST_TInt16 rx, ry, rz;
GHOST_TInt16 buttons;
GHOST_TUns64 time;
GHOST_TUns64 delta;
} GHOST_TEventNDOFData;
typedef int (*GHOST_NDOFLibraryInit_fp)();
typedef void (*GHOST_NDOFLibraryShutdown_fp)(void* deviceHandle);
typedef void* (*GHOST_NDOFDeviceOpen_fp)(void* platformData);
typedef int (*GHOST_NDOFEventHandler_fp)(float* result7, void* deviceHandle, unsigned int message, unsigned int* wParam, unsigned long* lParam);
/* original patch used floats, but the driver return ints and uns. We will calibrate in view, no sense on doing conversions twice */
typedef struct {
/** N-degree of freedom device data */
float tx, ty, tz; /** -x left, +y up, +z forward */
float rx, ry, rz;
float dt;
} GHOST_TEventNDOFData;
// original patch windows callback. In mac os X version the callback is internal to the plug-in and post an event to main thead.
// not necessary faster, but better integration with other events.
//typedef int (*GHOST_NDOFEventHandler_fp)(float* result7, void* deviceHandle, unsigned int message, unsigned int* wParam, unsigned long* lParam);
//typedef void (*GHOST_NDOFCallBack_fp)(GHOST_TEventNDOFDataV2 *VolDatas);
typedef struct {
/** The key code. */

@ -262,13 +262,16 @@ GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_Eve
void GHOST_OpenNDOF(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
GHOST_NDOFEventHandler_fp setNdofEventHandler)
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen)
//original patch only
/* GHOST_NDOFEventHandler_fp setNdofEventHandler)*/
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
system->openNDOF((GHOST_IWindow*) windowhandle,
setNdofLibraryInit, setNdofLibraryShutdown, setNdofDeviceOpen, setNdofEventHandler);
setNdofLibraryInit, setNdofLibraryShutdown, setNdofDeviceOpen);
// original patch
// setNdofLibraryInit, setNdofLibraryShutdown, setNdofDeviceOpen, setNdofEventHandler);
}

@ -1,14 +1,10 @@
/**
* $Id: GHOST_EventNdof.h,v 1.6 2002/12/28 22:26:45 maarten Exp $
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -19,19 +15,11 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
/**
* @file GHOST_EventNdof.h
* Declaration of GHOST_EventNdof class.
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef _GHOST_EVENT_NDOF_H_
#define _GHOST_EVENT_NDOF_H_

@ -1,21 +1,23 @@
// Insert Blender compatible license here :-)
// note: an implementation is currently only provided for Windows, but designed to be easy to move to Linux, etc.
/**
To use this implemenation, you must specify the #define WITH_SPACEBALL for the ghost library.
Only this cpp file is affected by the macro, the header file and everything else are independent
of the spaceball libraries.
The 3dXWare SDK is available from the tab on the left side of -
http://www.3dconnexion.com/support/4a.php
The SDK is necessary to build this file with WITH_SPACEBALL defined.
For this stuff to work, siappdll.dll and spwini.dll must be in the executable path of blender
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
@ -23,15 +25,17 @@
//#include "GHOST_WindowWin32.h"
// the variable is outside the class because it must be accessed from plugin
static volatile GHOST_TEventNDOFData currentNdofValues = {0,0,0,0,0,0,0,0,0,0,0};
namespace
{
GHOST_NDOFLibraryInit_fp ndofLibraryInit = 0;
GHOST_NDOFLibraryShutdown_fp ndofLibraryShutdown = 0;
GHOST_NDOFDeviceOpen_fp ndofDeviceOpen = 0;
GHOST_NDOFEventHandler_fp ndofEventHandler = 0;
// GHOST_NDOFEventHandler_fp ndofEventHandler = 0;
}
@ -45,8 +49,7 @@ GHOST_NDOFManager::GHOST_NDOFManager()
ndofLibraryInit = 0;
ndofLibraryShutdown = 0;
ndofDeviceOpen = 0;
ndofEventHandler = 0;
// available = 0;
// ndofEventHandler = 0;
}
GHOST_NDOFManager::~GHOST_NDOFManager()
@ -62,18 +65,22 @@ void
GHOST_NDOFManager::deviceOpen(GHOST_IWindow* window,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
GHOST_NDOFEventHandler_fp setNdofEventHandler)
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen)
// GHOST_NDOFEventHandler_fp setNdofEventHandler)
{
ndofLibraryInit = setNdofLibraryInit;
ndofLibraryShutdown = setNdofLibraryShutdown;
ndofDeviceOpen = setNdofDeviceOpen;
ndofEventHandler = setNdofEventHandler;
// original patch
// ndofEventHandler = setNdofEventHandler;
if (ndofLibraryInit && ndofDeviceOpen)
{
printf("%i client \n", ndofLibraryInit());
}
m_DeviceHandle = ndofDeviceOpen((void *)&currentNdofValues);
}
/*
if (ndofDeviceOpen)
{
@ -87,7 +94,8 @@ GHOST_NDOFManager::deviceOpen(GHOST_IWindow* window,
}
/** original patch only */
/*
GHOST_TEventNDOFData*
GHOST_NDOFManager::handle(unsigned int message, unsigned int* wParam, unsigned long* lParam)
{
@ -100,7 +108,7 @@ GHOST_NDOFManager::handle(unsigned int message, unsigned int* wParam, unsigned l
printf("handled %i\n", handled);
return handled ? &sbdata : 0;
}
*/
bool
GHOST_NDOFManager::available()
@ -108,3 +116,40 @@ GHOST_NDOFManager::available()
return m_DeviceHandle != 0;
}
bool
GHOST_NDOFManager::event_present()
{
if( currentNdofValues.changed >0) {
printf("time %llu but%u x%i y%i z%i rx%i ry%i rz%i \n" ,
currentNdofValues.time, currentNdofValues.buttons,
currentNdofValues.tx,currentNdofValues.ty,currentNdofValues.tz,
currentNdofValues.rx,currentNdofValues.ry,currentNdofValues.rz);
return true;
}else
return false;
}
void GHOST_NDOFManager::GHOST_NDOFGetDatas(GHOST_TEventNDOFData &datas)
{
datas.tx = currentNdofValues.tx;
datas.ty = currentNdofValues.ty;
datas.tz = currentNdofValues.tz;
datas.rx = currentNdofValues.rx;
datas.ry = currentNdofValues.ry;
datas.rz = currentNdofValues.rz;
datas.buttons = currentNdofValues.buttons;
datas.client = currentNdofValues.client;
datas.address = currentNdofValues.address;
datas.time = currentNdofValues.time;
datas.delta = currentNdofValues.delta;
}
/*
//#ifdef
OSStatus GHOST_SystemCarbon::blendEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData)
{
}
*/

@ -1,4 +1,25 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef _GHOST_NDOFMANAGER_H_
#define _GHOST_NDOFMANAGER_H_
@ -23,13 +44,18 @@ public:
void deviceOpen(GHOST_IWindow* window,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
GHOST_NDOFEventHandler_fp setNdofEventHandler);
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen);
void GHOST_NDOFGetDatas(GHOST_TEventNDOFData &datas);
// GHOST_NDOFEventHandler_fp setNdofEventHandler);
bool available();
bool event_present();
/* original patch. unused now */
/* to do: abstract for Linux, MacOS, etc. */
GHOST_TEventNDOFData* handle(unsigned int message, unsigned int* wparam, unsigned long* lparam);
// GHOST_TEventNDOFData* handle(unsigned int message, unsigned int* wparam, unsigned long* lparam);
protected:
void* m_DeviceHandle;

@ -243,14 +243,15 @@ GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent* event)
void GHOST_System::openNDOF(GHOST_IWindow* w,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
GHOST_NDOFEventHandler_fp setNdofEventHandler)
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen)
// original patch only
// GHOST_NDOFEventHandler_fp setNdofEventHandler)
{
m_ndofManager->deviceOpen(w,
setNdofLibraryInit,
setNdofLibraryShutdown,
setNdofDeviceOpen,
setNdofEventHandler);
setNdofDeviceOpen);
// setNdofEventHandler);
}

@ -197,8 +197,10 @@ public:
virtual void openNDOF(GHOST_IWindow* w,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
GHOST_NDOFEventHandler_fp setNdofEventHandler);
GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen);
// original patch only
// GHOST_NDOFEventHandler_fp setNdofEventHandler);

@ -48,22 +48,33 @@
#include "GHOST_EventButton.h"
#include "GHOST_EventCursor.h"
#include "GHOST_EventWheel.h"
#include "GHOST_EventNDOF.h"
#include "GHOST_TimerManager.h"
#include "GHOST_TimerTask.h"
#include "GHOST_WindowManager.h"
#include "GHOST_WindowCarbon.h"
#include "GHOST_NDOFManager.h"
#define GHOST_KEY_SWITCH(mac, ghost) { case (mac): ghostKey = (ghost); break; }
/* blender class and types events */
enum {
kEventClassBlender = 'blnd'
};
enum {
kEventBlenderNdofAxis = 1,
kEventBlenderNdofButtons = 2
};
const EventTypeSpec kEvents[] =
{
{ kEventClassAppleEvent, kEventAppleEvent },
/*
{ kEventClassApplication, kEventAppActivated },
{ kEventClassApplication, kEventAppDeactivated },
*/
{ kEventClassKeyboard, kEventRawKeyDown },
{ kEventClassKeyboard, kEventRawKeyRepeat },
{ kEventClassKeyboard, kEventRawKeyUp },
@ -84,7 +95,12 @@ const EventTypeSpec kEvents[] =
{ kEventClassWindow, kEventWindowActivated },
{ kEventClassWindow, kEventWindowDeactivated },
{ kEventClassWindow, kEventWindowUpdate },
{ kEventClassWindow, kEventWindowBoundsChanged }
{ kEventClassWindow, kEventWindowBoundsChanged },
{ kEventClassBlender, kEventBlenderNdofAxis },
{ kEventClassBlender, kEventBlenderNdofButtons }
};
@ -416,7 +432,9 @@ GHOST_IWindow* GHOST_SystemCarbon::createWindow(
return window;
}
/* this is an old style low level event queue.
As we want to handle our own timers, this is ok.
the full screen hack should be removed */
bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
{
bool anyProcessed = false;
@ -424,7 +442,7 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
do {
GHOST_TimerManager* timerMgr = getTimerManager();
if (waitForEvent) {
GHOST_TUns64 curtime = getMilliSeconds();
GHOST_TUns64 next = timerMgr->nextFireTime();
@ -455,6 +473,8 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
}
}
/* end loop when no more events available */
while (::ReceiveNextEvent(0, NULL, 0, true, &event)==noErr) {
OSStatus status= ::SendEventToEventTarget(event, ::GetEventDispatcherTarget());
if (status==noErr) {
@ -466,7 +486,7 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
* are, but we get a lot of them
*/
if (i!='cgs ') {
//printf("Missed - Class: '%.4s', Kind: %d\n", &i, ::GetEventKind(event));
printf("Missed - Class: '%.4s', Kind: %d\n", &i, ::GetEventKind(event));
}
}
::ReleaseEvent(event);
@ -610,6 +630,7 @@ OSErr GHOST_SystemCarbon::sAEHandlerQuit(const AppleEvent *event, AppleEvent *re
GHOST_TSuccess GHOST_SystemCarbon::init()
{
GHOST_TSuccess success = GHOST_System::init();
if (success) {
/*
@ -629,6 +650,7 @@ GHOST_TSuccess GHOST_SystemCarbon::init()
::AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, sAEHandlerOpenDocs, (SInt32) this, false);
::AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, sAEHandlerPrintDocs, (SInt32) this, false);
::AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, sAEHandlerQuit, (SInt32) this, false);
}
return success;
}
@ -765,6 +787,7 @@ OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
}
err = noErr;
}
}
OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
@ -1039,11 +1062,14 @@ bool GHOST_SystemCarbon::handleMenuCommand(GHOST_TInt32 menuResult)
return handled;
}
OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData)
{
GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) userData;
OSStatus err = eventNotHandledErr;
GHOST_IWindow* window;
GHOST_TEventNDOFData data;
switch (::GetEventClass(event))
{
case kEventClassAppleEvent:
@ -1061,7 +1087,16 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
case kEventClassKeyboard:
err = sys->handleKeyEvent(event);
break;
}
case kEventClassBlender :
window = sys->m_windowManager->getActiveWindow();
sys->m_ndofManager->GHOST_NDOFGetDatas(data);
sys->m_eventManager->pushEvent(new GHOST_EventNDOF(sys->getMilliSeconds(), GHOST_kEventNDOFMotion, window, data));
err = noErr;
break;
default :
;
break;
}
return err;
}

@ -224,6 +224,10 @@ protected:
*/
bool handleMenuCommand(GHOST_TInt32 menuResult);
/* callback for blender generated events */
// static OSStatus blendEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData);
/**
* Callback for Carbon when it has events.
*/

@ -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;
// 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]);
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);
}
// 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);
}
}

@ -1568,7 +1568,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case NDOFMOTION:
viewmoveNDOF(0);
viewmoveNDOF(1);
break;
case ONEKEY:

@ -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) {