Skip to content
Permalink
Browse files

fixes #1781: Reimplement arrow keys for 3d view

- including minor formating fixes
  • Loading branch information...
ickby committed Nov 6, 2014
1 parent 4a28b93 commit 69f4bbb2ef4b1485f1ef28db437fa556703790b9
Showing with 188 additions and 128 deletions.
  1. +186 −125 src/Gui/Quarter/SoQTQuarterAdaptor.cpp
  2. +2 −3 src/Gui/Quarter/SoQTQuarterAdaptor.h
@@ -30,103 +30,105 @@
#include <Inventor/actions/SoRayPickAction.h>
#include <Inventor/actions/SoGetBoundingBoxAction.h>
#include <Inventor/SoPickedPoint.h>
#include <Inventor/SbLine.h>
#include <Inventor/SbPlane.h>

static unsigned char fps2dfont[][12] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, //
{ 0, 0, 12, 12, 0, 8, 12, 12, 12, 12, 12, 0 }, // !
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 20, 20 }, // \"
{ 0, 0, 18, 18, 18, 63, 18, 18, 63, 18, 18, 0 }, // #
{ 0, 8, 28, 42, 10, 10, 12, 24, 40, 42, 28, 8 }, // $
{ 0, 0, 6, 73, 41, 22, 8, 52, 74, 73, 48, 0 }, // %
{ 0, 12, 18, 18, 12, 25, 37, 34, 34, 29, 0, 0 }, // &
{ 12, 12, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // '
{ 0, 6, 8, 8, 16, 16, 16, 16, 16, 8, 8, 6 }, // (
{ 0, 48, 8, 8, 4, 4, 4, 4, 4, 8, 8, 48 }, //)
{ 0, 0, 0, 0, 0, 0, 8, 42, 20, 42, 8, 0 }, // *
{ 0, 0, 0, 8, 8, 8,127, 8, 8, 8, 0, 0 }, // +
{ 0, 24, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0 }, // ,
{ 0, 0, 0, 0, 0, 0,127, 0, 0, 0, 0, 0 }, // -
{ 0, 0, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0 }, // .
{ 0, 32, 32, 16, 16, 8, 8, 8, 4, 4, 2, 2 }, // /
{ 0, 0, 28, 34, 34, 34, 34, 34, 34, 34, 28, 0 }, // 0
{ 0, 0, 8, 8, 8, 8, 8, 8, 40, 24, 8, 0 }, // 1
{ 0, 0, 62, 32, 16, 8, 4, 2, 2, 34, 28, 0 }, // 2
{ 0, 0, 28, 34, 2, 2, 12, 2, 2, 34, 28, 0 }, // 3
{ 0, 0, 4, 4, 4,126, 68, 36, 20, 12, 4, 0 }, // 4
{ 0, 0, 28, 34, 2, 2, 2, 60, 32, 32, 62, 0 }, // 5
{ 0, 0, 28, 34, 34, 34, 60, 32, 32, 34, 28, 0 }, // 6
{ 0, 0, 16, 16, 16, 8, 8, 4, 2, 2, 62, 0 }, // 7
{ 0, 0, 28, 34, 34, 34, 28, 34, 34, 34, 28, 0 }, // 8
{ 0, 0, 28, 34, 2, 2, 30, 34, 34, 34, 28, 0 }, // 9
{ 0, 0, 24, 24, 0, 0, 0, 24, 24, 0, 0, 0 }, // :
{ 0, 48, 24, 24, 0, 0, 0, 24, 24, 0, 0, 0 }, // ;
{ 0, 0, 0, 2, 4, 8, 16, 8, 4, 2, 0, 0 }, // <
{ 0, 0, 0, 0, 0,127, 0,127, 0, 0, 0, 0 }, // =
{ 0, 0, 0, 16, 8, 4, 2, 4, 8, 16, 0, 0 }, // >
{ 0, 0, 16, 16, 0, 16, 28, 2, 2, 2, 60, 0 }, // ?
{ 0, 0, 28, 32, 73, 86, 82, 82, 78, 34, 28, 0 }, // @
{ 0, 0, 33, 33, 33, 63, 18, 18, 18, 12, 12, 0 }, // A
{ 0, 0, 60, 34, 34, 34, 60, 34, 34, 34, 60, 0 }, // B
{ 0, 0, 14, 16, 32, 32, 32, 32, 32, 18, 14, 0 }, // C
{ 0, 0, 56, 36, 34, 34, 34, 34, 34, 36, 56, 0 }, // D
{ 0, 0, 62, 32, 32, 32, 60, 32, 32, 32, 62, 0 }, // E
{ 0, 0, 16, 16, 16, 16, 30, 16, 16, 16, 30, 0 }, // F
{ 0, 0, 14, 18, 34, 34, 32, 32, 32, 18, 14, 0 }, // G
{ 0, 0, 34, 34, 34, 34, 62, 34, 34, 34, 34, 0 }, // H
{ 0, 0, 62, 8, 8, 8, 8, 8, 8, 8, 62, 0 }, // I
{ 0, 0,112, 8, 8, 8, 8, 8, 8, 8, 62, 0 }, // J
{ 0, 0, 33, 33, 34, 36, 56, 40, 36, 34, 33, 0 }, // K
{ 0, 0, 30, 16, 16, 16, 16, 16, 16, 16, 16, 0 }, // L
{ 0, 0, 33, 33, 33, 45, 45, 45, 51, 51, 33, 0 }, // M
{ 0, 0, 34, 34, 38, 38, 42, 42, 50, 50, 34, 0 }, // N
{ 0, 0, 12, 18, 33, 33, 33, 33, 33, 18, 12, 0 }, // O
{ 0, 0, 32, 32, 32, 60, 34, 34, 34, 34, 60, 0 }, // P
{ 3, 6, 12, 18, 33, 33, 33, 33, 33, 18, 12, 0 }, // Q
{ 0, 0, 34, 34, 34, 36, 60, 34, 34, 34, 60, 0 }, // R
{ 0, 0, 60, 2, 2, 6, 28, 48, 32, 32, 30, 0 }, // S
{ 0, 0, 8, 8, 8, 8, 8, 8, 8, 8,127, 0 }, // T
{ 0, 0, 28, 34, 34, 34, 34, 34, 34, 34, 34, 0 }, // U
{ 0, 0, 12, 12, 18, 18, 18, 33, 33, 33, 33, 0 }, // V
{ 0, 0, 34, 34, 34, 54, 85, 73, 73, 73, 65, 0 }, // W
{ 0, 0, 34, 34, 20, 20, 8, 20, 20, 34, 34, 0 }, // X
{ 0, 0, 8, 8, 8, 8, 20, 20, 34, 34, 34, 0 }, // Y
{ 0, 0, 62, 32, 16, 16, 8, 4, 4, 2, 62, 0 }, // Z
{ 0, 14, 8, 8, 8, 8, 8, 8, 8, 8, 8, 14 }, // [
{ 0, 2, 2, 4, 4, 8, 8, 8, 16, 16, 32, 32 }, // [backslash]
{ 0, 56, 8, 8, 8, 8, 8, 8, 8, 8, 8, 56 }, // ]
{ 0, 0, 0, 0, 0, 34, 34, 20, 20, 8, 8, 0 }, // ^
{ 0,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // _
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 12 }, // `
{ 0, 0, 29, 34, 34, 30, 2, 34, 28, 0, 0, 0 }, // a
{ 0, 0, 60, 34, 34, 34, 34, 50, 44, 32, 32, 32 }, // b
{ 0, 0, 14, 16, 32, 32, 32, 16, 14, 0, 0, 0 }, // c
{ 0, 0, 26, 38, 34, 34, 34, 34, 30, 2, 2, 2 }, // d
{ 0, 0, 28, 34, 32, 62, 34, 34, 28, 0, 0, 0 }, // e
{ 0, 0, 16, 16, 16, 16, 16, 16, 62, 16, 16, 14 }, // f
{ 28, 2, 2, 26, 38, 34, 34, 34, 30, 0, 0, 0 }, // g
{ 0, 0, 34, 34, 34, 34, 34, 50, 44, 32, 32, 32 }, // h
{ 0, 0, 8, 8, 8, 8, 8, 8, 56, 0, 8, 8 }, // i
{ 56, 4, 4, 4, 4, 4, 4, 4, 60, 0, 4, 4 }, // j
{ 0, 0, 33, 34, 36, 56, 40, 36, 34, 32, 32, 32 }, // k
{ 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 56 }, // l
{ 0, 0, 73, 73, 73, 73, 73,109, 82, 0, 0, 0 }, // m
{ 0, 0, 34, 34, 34, 34, 34, 50, 44, 0, 0, 0 }, // n
{ 0, 0, 28, 34, 34, 34, 34, 34, 28, 0, 0, 0 }, // o
{ 32, 32, 60, 34, 34, 34, 34, 50, 44, 0, 0, 0 }, // p
{ 2, 2, 26, 38, 34, 34, 34, 34, 30, 0, 0, 0 }, // q
{ 0, 0, 16, 16, 16, 16, 16, 24, 22, 0, 0, 0 }, // r
{ 0, 0, 60, 2, 2, 28, 32, 32, 30, 0, 0, 0 }, // s
{ 0, 0, 14, 16, 16, 16, 16, 16, 62, 16, 16, 0 }, // t
{ 0, 0, 26, 38, 34, 34, 34, 34, 34, 0, 0, 0 }, // u
{ 0, 0, 8, 8, 20, 20, 34, 34, 34, 0, 0, 0 }, // v
{ 0, 0, 34, 34, 34, 85, 73, 73, 65, 0, 0, 0 }, // w
{ 0, 0, 34, 34, 20, 8, 20, 34, 34, 0, 0, 0 }, // x
{ 48, 16, 8, 8, 20, 20, 34, 34, 34, 0, 0, 0 }, // y
{ 0, 0, 62, 32, 16, 8, 4, 2, 62, 0, 0, 0 }, // z
{ 0, 6, 8, 8, 8, 4, 24, 4, 8, 8, 8, 6 }, // {
{ 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }, // |
{ 0, 48, 8, 8, 8, 16, 12, 16, 8, 8, 8, 48 }, // }
{ 0, 0, 0, 0, 0, 0, 78, 57, 0, 0, 0, 0 } // ~
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, //
{ 0, 0, 12, 12, 0, 8, 12, 12, 12, 12, 12, 0 }, // !
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 20, 20 }, // \"
{ 0, 0, 18, 18, 18, 63, 18, 18, 63, 18, 18, 0 }, // #
{ 0, 8, 28, 42, 10, 10, 12, 24, 40, 42, 28, 8 }, // $
{ 0, 0, 6, 73, 41, 22, 8, 52, 74, 73, 48, 0 }, // %
{ 0, 12, 18, 18, 12, 25, 37, 34, 34, 29, 0, 0 }, // &
{ 12, 12, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // '
{ 0, 6, 8, 8, 16, 16, 16, 16, 16, 8, 8, 6 }, // (
{ 0, 48, 8, 8, 4, 4, 4, 4, 4, 8, 8, 48 }, //)
{ 0, 0, 0, 0, 0, 0, 8, 42, 20, 42, 8, 0 }, // *
{ 0, 0, 0, 8, 8, 8,127, 8, 8, 8, 0, 0 }, // +
{ 0, 24, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0 }, // ,
{ 0, 0, 0, 0, 0, 0,127, 0, 0, 0, 0, 0 }, // -
{ 0, 0, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0 }, // .
{ 0, 32, 32, 16, 16, 8, 8, 8, 4, 4, 2, 2 }, // /
{ 0, 0, 28, 34, 34, 34, 34, 34, 34, 34, 28, 0 }, // 0
{ 0, 0, 8, 8, 8, 8, 8, 8, 40, 24, 8, 0 }, // 1
{ 0, 0, 62, 32, 16, 8, 4, 2, 2, 34, 28, 0 }, // 2
{ 0, 0, 28, 34, 2, 2, 12, 2, 2, 34, 28, 0 }, // 3
{ 0, 0, 4, 4, 4,126, 68, 36, 20, 12, 4, 0 }, // 4
{ 0, 0, 28, 34, 2, 2, 2, 60, 32, 32, 62, 0 }, // 5
{ 0, 0, 28, 34, 34, 34, 60, 32, 32, 34, 28, 0 }, // 6
{ 0, 0, 16, 16, 16, 8, 8, 4, 2, 2, 62, 0 }, // 7
{ 0, 0, 28, 34, 34, 34, 28, 34, 34, 34, 28, 0 }, // 8
{ 0, 0, 28, 34, 2, 2, 30, 34, 34, 34, 28, 0 }, // 9
{ 0, 0, 24, 24, 0, 0, 0, 24, 24, 0, 0, 0 }, // :
{ 0, 48, 24, 24, 0, 0, 0, 24, 24, 0, 0, 0 }, // ;
{ 0, 0, 0, 2, 4, 8, 16, 8, 4, 2, 0, 0 }, // <
{ 0, 0, 0, 0, 0,127, 0,127, 0, 0, 0, 0 }, // =
{ 0, 0, 0, 16, 8, 4, 2, 4, 8, 16, 0, 0 }, // >
{ 0, 0, 16, 16, 0, 16, 28, 2, 2, 2, 60, 0 }, // ?
{ 0, 0, 28, 32, 73, 86, 82, 82, 78, 34, 28, 0 }, // @
{ 0, 0, 33, 33, 33, 63, 18, 18, 18, 12, 12, 0 }, // A
{ 0, 0, 60, 34, 34, 34, 60, 34, 34, 34, 60, 0 }, // B
{ 0, 0, 14, 16, 32, 32, 32, 32, 32, 18, 14, 0 }, // C
{ 0, 0, 56, 36, 34, 34, 34, 34, 34, 36, 56, 0 }, // D
{ 0, 0, 62, 32, 32, 32, 60, 32, 32, 32, 62, 0 }, // E
{ 0, 0, 16, 16, 16, 16, 30, 16, 16, 16, 30, 0 }, // F
{ 0, 0, 14, 18, 34, 34, 32, 32, 32, 18, 14, 0 }, // G
{ 0, 0, 34, 34, 34, 34, 62, 34, 34, 34, 34, 0 }, // H
{ 0, 0, 62, 8, 8, 8, 8, 8, 8, 8, 62, 0 }, // I
{ 0, 0,112, 8, 8, 8, 8, 8, 8, 8, 62, 0 }, // J
{ 0, 0, 33, 33, 34, 36, 56, 40, 36, 34, 33, 0 }, // K
{ 0, 0, 30, 16, 16, 16, 16, 16, 16, 16, 16, 0 }, // L
{ 0, 0, 33, 33, 33, 45, 45, 45, 51, 51, 33, 0 }, // M
{ 0, 0, 34, 34, 38, 38, 42, 42, 50, 50, 34, 0 }, // N
{ 0, 0, 12, 18, 33, 33, 33, 33, 33, 18, 12, 0 }, // O
{ 0, 0, 32, 32, 32, 60, 34, 34, 34, 34, 60, 0 }, // P
{ 3, 6, 12, 18, 33, 33, 33, 33, 33, 18, 12, 0 }, // Q
{ 0, 0, 34, 34, 34, 36, 60, 34, 34, 34, 60, 0 }, // R
{ 0, 0, 60, 2, 2, 6, 28, 48, 32, 32, 30, 0 }, // S
{ 0, 0, 8, 8, 8, 8, 8, 8, 8, 8,127, 0 }, // T
{ 0, 0, 28, 34, 34, 34, 34, 34, 34, 34, 34, 0 }, // U
{ 0, 0, 12, 12, 18, 18, 18, 33, 33, 33, 33, 0 }, // V
{ 0, 0, 34, 34, 34, 54, 85, 73, 73, 73, 65, 0 }, // W
{ 0, 0, 34, 34, 20, 20, 8, 20, 20, 34, 34, 0 }, // X
{ 0, 0, 8, 8, 8, 8, 20, 20, 34, 34, 34, 0 }, // Y
{ 0, 0, 62, 32, 16, 16, 8, 4, 4, 2, 62, 0 }, // Z
{ 0, 14, 8, 8, 8, 8, 8, 8, 8, 8, 8, 14 }, // [
{ 0, 2, 2, 4, 4, 8, 8, 8, 16, 16, 32, 32 }, // [backslash]
{ 0, 56, 8, 8, 8, 8, 8, 8, 8, 8, 8, 56 }, // ]
{ 0, 0, 0, 0, 0, 34, 34, 20, 20, 8, 8, 0 }, // ^
{ 0,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // _
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 12 }, // `
{ 0, 0, 29, 34, 34, 30, 2, 34, 28, 0, 0, 0 }, // a
{ 0, 0, 60, 34, 34, 34, 34, 50, 44, 32, 32, 32 }, // b
{ 0, 0, 14, 16, 32, 32, 32, 16, 14, 0, 0, 0 }, // c
{ 0, 0, 26, 38, 34, 34, 34, 34, 30, 2, 2, 2 }, // d
{ 0, 0, 28, 34, 32, 62, 34, 34, 28, 0, 0, 0 }, // e
{ 0, 0, 16, 16, 16, 16, 16, 16, 62, 16, 16, 14 }, // f
{ 28, 2, 2, 26, 38, 34, 34, 34, 30, 0, 0, 0 }, // g
{ 0, 0, 34, 34, 34, 34, 34, 50, 44, 32, 32, 32 }, // h
{ 0, 0, 8, 8, 8, 8, 8, 8, 56, 0, 8, 8 }, // i
{ 56, 4, 4, 4, 4, 4, 4, 4, 60, 0, 4, 4 }, // j
{ 0, 0, 33, 34, 36, 56, 40, 36, 34, 32, 32, 32 }, // k
{ 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 56 }, // l
{ 0, 0, 73, 73, 73, 73, 73,109, 82, 0, 0, 0 }, // m
{ 0, 0, 34, 34, 34, 34, 34, 50, 44, 0, 0, 0 }, // n
{ 0, 0, 28, 34, 34, 34, 34, 34, 28, 0, 0, 0 }, // o
{ 32, 32, 60, 34, 34, 34, 34, 50, 44, 0, 0, 0 }, // p
{ 2, 2, 26, 38, 34, 34, 34, 34, 30, 0, 0, 0 }, // q
{ 0, 0, 16, 16, 16, 16, 16, 24, 22, 0, 0, 0 }, // r
{ 0, 0, 60, 2, 2, 28, 32, 32, 30, 0, 0, 0 }, // s
{ 0, 0, 14, 16, 16, 16, 16, 16, 62, 16, 16, 0 }, // t
{ 0, 0, 26, 38, 34, 34, 34, 34, 34, 0, 0, 0 }, // u
{ 0, 0, 8, 8, 20, 20, 34, 34, 34, 0, 0, 0 }, // v
{ 0, 0, 34, 34, 34, 85, 73, 73, 65, 0, 0, 0 }, // w
{ 0, 0, 34, 34, 20, 8, 20, 34, 34, 0, 0, 0 }, // x
{ 48, 16, 8, 8, 20, 20, 34, 34, 34, 0, 0, 0 }, // y
{ 0, 0, 62, 32, 16, 8, 4, 2, 62, 0, 0, 0 }, // z
{ 0, 6, 8, 8, 8, 4, 24, 4, 8, 8, 8, 6 }, // {
{ 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }, // |
{ 0, 48, 8, 8, 8, 16, 12, 16, 8, 8, 8, 48 }, // }
{ 0, 0, 0, 0, 0, 0, 78, 57, 0, 0, 0, 0 } // ~
};

SIM::Coin3D::Quarter::SoQTQuarterAdaptor::SoQTQuarterAdaptor(QWidget* parent, const QGLWidget* sharewidget, Qt::WindowFlags f)
@@ -551,27 +553,27 @@ void SIM::Coin3D::Quarter::SoQTQuarterAdaptor::resetToHomePosition(void)
}


void
SIM::Coin3D::Quarter::SoQTQuarterAdaptor::draw2DString(const char * str, SbVec2s glsize, SbVec2f position)
void
SIM::Coin3D::Quarter::SoQTQuarterAdaptor::draw2DString(const char* str, SbVec2s glsize, SbVec2f position)
{
// Store GL state.
glPushAttrib(GL_ENABLE_BIT|GL_CURRENT_BIT);
// Store GL state.
glPushAttrib(GL_ENABLE_BIT|GL_CURRENT_BIT);

glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);

glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0, glsize[0], 0.0, glsize[1], -1, 1);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0, glsize[0], 0.0, glsize[1], -1, 1);

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

// glColor3f(0.0, 0.0, 0.0);
// glRasterPos2f(position[0] + 1, position[1]);
@@ -583,24 +585,83 @@ SIM::Coin3D::Quarter::SoQTQuarterAdaptor::draw2DString(const char * str, SbVec2s
// glRasterPos2f(position[0], position[1] - 1);
// printString(str);

glColor3f(1.0, 1.0, 0.0);
glRasterPos2f(position[0], position[1]);
printString(str);
glColor3f(1.0, 1.0, 0.0);
glRasterPos2f(position[0], position[1]);
printString(str);

glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();

glPixelStorei(GL_UNPACK_ALIGNMENT, 4); // restore default value
glPixelStorei(GL_UNPACK_ALIGNMENT, 4); // restore default value

glPopAttrib();
glPopAttrib();
}

void SIM::Coin3D::Quarter::SoQTQuarterAdaptor::printString(const char * s)
void SIM::Coin3D::Quarter::SoQTQuarterAdaptor::printString(const char* s)
{
int i,n;
n = strlen(s);
for (i = 0; i < n; i++)
glBitmap(8, 12, 0.0, 2.0, 10.0, 0.0, fps2dfont[s[i] - 32]);
int i,n;
n = strlen(s);

for(i = 0; i < n; i++)
glBitmap(8, 12, 0.0, 2.0, 10.0, 0.0, fps2dfont[s[i] - 32]);
}

void SIM::Coin3D::Quarter::SoQTQuarterAdaptor::moveCameraScreen(const SbVec2f& screenpos) {

SoCamera* cam = getSoRenderManager()->getCamera();
assert(cam);


SbViewVolume vv = cam->getViewVolume(getGLWidget()->width() / getGLWidget()->height());
SbPlane panplane = vv.getPlane(cam->focalDistance.getValue());

SbLine line;
vv.projectPointToLine(screenpos + SbVec2f(0.5, 0.5f), line);
SbVec3f current_planept;
panplane.intersect(line, current_planept);
vv.projectPointToLine(SbVec2f(0.5f, 0.5f), line);
SbVec3f old_planept;
panplane.intersect(line, old_planept);

// Reposition camera according to the vector difference between the
// projected points.
cam->position = cam->position.getValue() - (current_planept - old_planept);
};

bool SIM::Coin3D::Quarter::SoQTQuarterAdaptor::processSoEvent(const SoEvent* event) {

const SoType type(event->getTypeId());

if(type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
const SoKeyboardEvent* keyevent = static_cast<const SoKeyboardEvent*>(event);

if(keyevent->getState() == SoButtonEvent::DOWN) {
switch(keyevent->getKey()) {

case SoKeyboardEvent::LEFT_ARROW:
moveCameraScreen(SbVec2f(-0.1f, 0.0f));
return TRUE;

case SoKeyboardEvent::UP_ARROW:
moveCameraScreen(SbVec2f(0.0f, 0.1f));
return TRUE;

case SoKeyboardEvent::RIGHT_ARROW:
moveCameraScreen(SbVec2f(0.1f, 0.0f));
return TRUE;

case SoKeyboardEvent::DOWN_ARROW:
moveCameraScreen(SbVec2f(0.0f, -0.1f));
return TRUE;

default:
break;
}
}

return SIM::Coin3D::Quarter::QuarterWidget::processSoEvent(event);
}
};

@@ -89,9 +89,7 @@ class QUARTER_DLL_API SoQTQuarterAdaptor : public QuarterWidget {
QuarterWidget::setSceneGraph(root);
};

virtual bool processSoEvent(const SoEvent* event) {
return QuarterWidget::processSoEvent(event);
};
virtual bool processSoEvent(const SoEvent* event);

//this functions still need to be ported
virtual void afterRealizeHook(void) {}; //enables spacenav and joystick in soqt, dunno if this is needed
@@ -102,6 +100,7 @@ class QUARTER_DLL_API SoQTQuarterAdaptor : public QuarterWidget {
void convertOrtho2Perspective(const SoOrthographicCamera* in, SoPerspectiveCamera* out);
void getCameraCoordinateSystem(SoCamera * camera, SoNode * root, SbMatrix & matrix, SbMatrix & inverse);
static void seeksensorCB(void * data, SoSensor * s);
void moveCameraScreen(const SbVec2f & screenpos);

bool m_viewingflag;
int m_interactionnesting;

0 comments on commit 69f4bbb

Please sign in to comment.
You can’t perform that action at this time.