new algorithm for spaceball movements
*consolidate motion3 event handeling. *rotation about focal point. *translation based on world to screen scale. *cleanup axes map and constants.
This commit is contained in:
@@ -79,10 +79,10 @@ const char* BlenderNavigationStyle::mouseButtons(ViewerMode mode)
|
||||
|
||||
SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
{
|
||||
// Events when in "ready-to-seek" mode are ignored, except those
|
||||
// which influence the seek mode itself -- these are handled further
|
||||
// up the inheritance hierarchy.
|
||||
if (this->isSeekMode()) { return inherited::processSoEvent(ev); }
|
||||
// Events when in "ready-to-seek" mode are ignored, except those
|
||||
// which influence the seek mode itself -- these are handled further
|
||||
// up the inheritance hierarchy.
|
||||
if (this->isSeekMode()) { return inherited::processSoEvent(ev); }
|
||||
|
||||
const SoType type(ev->getTypeId());
|
||||
|
||||
@@ -291,20 +291,9 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Spaceball & Joystick handling
|
||||
if (type.isDerivedFrom(SoMotion3Event::getClassTypeId())) {
|
||||
SoMotion3Event * const event = (SoMotion3Event *) ev;
|
||||
SoCamera * const camera = viewer->getCamera();
|
||||
|
||||
SbVec3f dir = event->getTranslation();
|
||||
if (camera->getTypeId().isDerivedFrom(SoOrthographicCamera::getClassTypeId())){
|
||||
static float zoomConstant(-.03f);
|
||||
dir[2] = 0.0;//don't move the cam for z translation.
|
||||
|
||||
SoOrthographicCamera *oCam = static_cast<SoOrthographicCamera *>(camera);
|
||||
oCam->scaleHeight(1.0-event->getTranslation()[2] * zoomConstant);
|
||||
}
|
||||
camera->orientation.getValue().multVec(dir,dir);
|
||||
camera->position = camera->position.getValue() + dir;
|
||||
camera->orientation = event->getRotation() * camera->orientation.getValue();
|
||||
const SoMotion3Event * const event = static_cast<const SoMotion3Event * const>(ev);
|
||||
if (event)
|
||||
this->processMotionEvent(event);
|
||||
processed = TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user