trying to fix connexion linker errors, general style fixes, renamed some files

This commit is contained in:
Sam Gondelman 2015-07-30 12:17:36 -07:00
parent 96fdb32edc
commit b19376ef6e
8 changed files with 116 additions and 118 deletions

View file

@ -0,0 +1,41 @@
#
# Find3DConnexionClient.cmake
#
# Once done this will define
# 3DCONNEXIONCLIENT_FOUND - system found 3DConnexion
# 3DCONNEXIONCLIENT_INCLUDE_DIRS - the 3DConnexion include directory
# 3DCONNEXIONCLIENT_LIBRARY - Link this to use 3DConnexion
#
# Created on 10/06/2015 by Marcel Verhagen
# Copyright 2015 High Fidelity, Inc.
#
# Distributed under the Apache License, Version 2.0.
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
include("${MACRO_DIR}/HifiLibrarySearchHints.cmake")
hifi_library_search_hints("connexionclient")
if (APPLE)
find_library(3DConnexionClient 3DConnexionClient)
if(EXISTS ${3DConnexionClient})
set(3DCONNEXIONCLIENT_FOUND true)
set(3DCONNEXIONCLIENT_INCLUDE_DIRS ${3DConnexionClient})
set(3DCONNEXIONCLIENT_LIBRARY ${3DConnexionClient})
set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "-weak_framework 3DConnexionClient")
message(STATUS "Found 3DConnexion " + ${3DConnexionClient})
mark_as_advanced(3DCONNEXIONCLIENT_INCLUDE_DIR CONNEXIONCLIENT_LIBRARY)
else ()
message(STATUS "Could NOT find 3DConnexionClient")
endif()
endif()
if (WIN32)
find_path(3DCONNEXIONCLIENT_INCLUDE_DIRS I3dMouseParams.h PATH_SUFFIXES Inc HINTS ${CONNEXIONCLIENT_SEARCH_DIRS})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(3DConnexionClient DEFAULT_MSG 3DCONNEXIONCLIENT_INCLUDE_DIRS)
mark_as_advanced(3DCONNEXIONCLIENT_INCLUDE_DIRS 3DCONNEXIONCLIENT_SEARCH_DIRS)
endif()

View file

@ -1,38 +0,0 @@
#
# FindconnexionClient.cmake
#
# Once done this will define
#
# 3DCONNEXIONCLIENT_INCLUDE_DIRS
#
# Created on 10/06/2015 by Marcel Verhagen
# Copyright 2015 High Fidelity, Inc.
#
# Distributed under the Apache License, Version 2.0.
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
# setup hints for 3DCONNEXIONCLIENT search
include("${MACRO_DIR}/HifiLibrarySearchHints.cmake")
hifi_library_search_hints("connexionclient")
if (APPLE)
find_library(3DconnexionClient 3DconnexionClient)
if(EXISTS ${3DconnexionClient})
set(CONNEXIONCLIENT_FOUND true)
set(CONNEXIONCLIENT_INCLUDE_DIR ${3DconnexionClient})
set(CONNEXIONCLIENT_LIBRARY ${3DconnexionClient})
set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "-weak_framework 3DconnexionClient")
message(STATUS "Found 3Dconnexion")
mark_as_advanced(CONNEXIONCLIENT_INCLUDE_DIR CONNEXIONCLIENT_LIBRARY)
endif()
endif()
if (WIN32)
find_path(CONNEXIONCLIENT_INCLUDE_DIRS I3dMouseParams.h PATH_SUFFIXES Inc HINTS ${CONNEXIONCLIENT_SEARCH_DIRS})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(connexionClient DEFAULT_MSG CONNEXIONCLIENT_INCLUDE_DIRS)
mark_as_advanced(CONNEXIONCLIENT_INCLUDE_DIRS CONNEXIONCLIENT_SEARCH_DIRS)
endif()

View file

@ -2,7 +2,7 @@ set(TARGET_NAME interface)
project(${TARGET_NAME})
# set a default root dir for each of our optional externals if it was not passed
set(OPTIONAL_EXTERNALS "Faceshift" "Sixense" "LeapMotion" "RtMidi" "SDL2" "RSSDK" "connexionClient")
set(OPTIONAL_EXTERNALS "Faceshift" "Sixense" "LeapMotion" "RtMidi" "SDL2" "RSSDK" "3DConnexionClient")
foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
string(TOUPPER ${EXTERNAL} ${EXTERNAL}_UPPERCASE)
if (NOT ${${EXTERNAL}_UPPERCASE}_ROOT_DIR)

View file

@ -1,4 +1,3 @@
The mac version does not require any files here. 3D connexion should be installed from
http://www.3dconnexion.eu/service/drivers.html
The Mac version does not require any files. The 3D Connexion driver should be installed from http://www.3dconnexion.eu/service/drivers.html
For windows a header file is required Inc/I3dMouseParams.h
For Windows the provided header file is required: Inc/I3dMouseParams.h

View file

@ -115,7 +115,7 @@
#include "devices/MIDIManager.h"
#include "devices/OculusManager.h"
#include "devices/TV3DManager.h"
#include "devices/3Dconnexion.h"
#include "devices/3DConnexionClient.h"
#include "scripting/AccountScriptingInterface.h"
#include "scripting/AudioDeviceScriptingInterface.h"

View file

@ -29,7 +29,7 @@
#include "devices/Faceshift.h"
#include "devices/RealSense.h"
#include "devices/SixenseManager.h"
#include "devices/3Dconnexion.h"
#include "devices/3DConnexionClient.h"
#include "MainWindow.h"
#include "scripting/MenuScriptingInterface.h"
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)

View file

@ -1,6 +1,6 @@
//
// 3DConnexion.cpp
// hifi
// 3DConnexionClient.cpp
// interface/src/devices
//
// Created by MarcelEdward Verhagen on 09-06-15.
// Copyright 2015 High Fidelity, Inc.
@ -9,7 +9,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "3Dconnexion.h"
#include "3DConnexionClient.h"
#include "UserActivityLogger.h"
const float MAX_AXIS = 75.0f; // max forward = 2x speed
@ -28,7 +28,6 @@ ConnexionData::ConnexionData() {
}
void ConnexionData::handleAxisEvent() {
//qCWarning(interfaceapp) << "pos state x = " << cc_position.x << " y = " << cc_position.y << " z = " << cc_position.z << " Rotation x = " << cc_rotation.x << " y = " << cc_rotation.y << " z = " << cc_rotation.z;
_axisStateMap[makeInput(ROTATION_AXIS_Y_POS).getChannel()] = (cc_rotation.y > 0.0f) ? cc_rotation.y / MAX_AXIS : 0.0f;
_axisStateMap[makeInput(ROTATION_AXIS_Y_NEG).getChannel()] = (cc_rotation.y < 0.0f) ? -cc_rotation.y / MAX_AXIS : 0.0f;
_axisStateMap[makeInput(POSITION_AXIS_X_POS).getChannel()] = (cc_position.x > 0.0f) ? cc_position.x / MAX_AXIS : 0.0f;
@ -148,7 +147,7 @@ UserInputMapper::Input ConnexionData::makeInput(ConnexionData::PositionChannel a
void ConnexionData::update() {
// the update is done in the ConnexionClient class.
// for windows in the nativeEventFilter the inputmapper is connected or registed or removed when an 3Dconnnexion device is attached or deteched
// for windows in the nativeEventFilter the inputmapper is connected or registed or removed when an 3Dconnnexion device is attached or detached
// for osx the api will call DeviceAddedHandler or DeviceRemoveHandler when a 3Dconnexion device is attached or detached
}
@ -157,14 +156,13 @@ ConnexionClient& ConnexionClient::getInstance() {
return sharedInstance;
}
#ifdef HAVE_CONNEXIONCLIENT
#ifdef HAVE_3DCONNEXIONCLIENT
#ifdef _WIN32
static ConnexionClient* gMouseInput = 0;
void ConnexionClient::toggleConnexion(bool shouldEnable)
{
void ConnexionClient::toggleConnexion(bool shouldEnable) {
ConnexionData& connexiondata = ConnexionData::getInstance();
if (shouldEnable && connexiondata.getDeviceID() == 0) {
ConnexionClient::init();
@ -225,15 +223,15 @@ enum ConnexionPid {
// e3dmouse_virtual_key
enum V3dk {
V3DK_INVALID = 0
, V3DK_MENU = 1, V3DK_FIT
, V3DK_TOP, V3DK_LEFT, V3DK_RIGHT, V3DK_FRONT, V3DK_BOTTOM, V3DK_BACK
, V3DK_CW, V3DK_CCW
, V3DK_ISO1, V3DK_ISO2
, V3DK_1, V3DK_2, V3DK_3, V3DK_4, V3DK_5, V3DK_6, V3DK_7, V3DK_8, V3DK_9, V3DK_10
, V3DK_ESC, V3DK_ALT, V3DK_SHIFT, V3DK_CTRL
, V3DK_ROTATE, V3DK_PANZOOM, V3DK_DOMINANT
, V3DK_PLUS, V3DK_MINUS
V3DK_INVALID = 0,
V3DK_MENU = 1, V3DK_FIT,
V3DK_TOP, V3DK_LEFT, V3DK_RIGHT, V3DK_FRONT, V3DK_BOTTOM, V3DK_BACK,
V3DK_CW, V3DK_CCW,
V3DK_ISO1, V3DK_ISO2,
V3DK_1, V3DK_2, V3DK_3, V3DK_4, V3DK_5, V3DK_6, V3DK_7, V3DK_8, V3DK_9, V3DK_10,
V3DK_ESC, V3DK_ALT, V3DK_SHIFT, V3DK_CTRL,
V3DK_ROTATE, V3DK_PANZOOM, V3DK_DOMINANT,
V3DK_PLUS, V3DK_MINUS
};
struct tag_VirtualKeys {
@ -244,33 +242,33 @@ struct tag_VirtualKeys {
// e3dmouse_virtual_key
static const V3dk SpaceExplorerKeys[] = {
V3DK_INVALID // there is no button 0
, V3DK_1, V3DK_2
, V3DK_TOP, V3DK_LEFT, V3DK_RIGHT, V3DK_FRONT
, V3DK_ESC, V3DK_ALT, V3DK_SHIFT, V3DK_CTRL
, V3DK_FIT, V3DK_MENU
, V3DK_PLUS, V3DK_MINUS
, V3DK_ROTATE
V3DK_INVALID, // there is no button 0
V3DK_1, V3DK_2,
V3DK_TOP, V3DK_LEFT, V3DK_RIGHT, V3DK_FRONT,
V3DK_ESC, V3DK_ALT, V3DK_SHIFT, V3DK_CTRL,
V3DK_FIT, V3DK_MENU,
V3DK_PLUS, V3DK_MINUS,
V3DK_ROTATE
};
//e3dmouse_virtual_key
static const V3dk SpacePilotKeys[] = {
V3DK_INVALID
, V3DK_1, V3DK_2, V3DK_3, V3DK_4, V3DK_5, V3DK_6
, V3DK_TOP, V3DK_LEFT, V3DK_RIGHT, V3DK_FRONT
, V3DK_ESC, V3DK_ALT, V3DK_SHIFT, V3DK_CTRL
, V3DK_FIT, V3DK_MENU
, V3DK_PLUS, V3DK_MINUS
, V3DK_DOMINANT, V3DK_ROTATE
V3DK_INVALID,
V3DK_1, V3DK_2, V3DK_3, V3DK_4, V3DK_5, V3DK_6,
V3DK_TOP, V3DK_LEFT, V3DK_RIGHT, V3DK_FRONT,
V3DK_ESC, V3DK_ALT, V3DK_SHIFT, V3DK_CTRL,
V3DK_FIT, V3DK_MENU,
V3DK_PLUS, V3DK_MINUS,
V3DK_DOMINANT, V3DK_ROTATE,
};
static const struct tag_VirtualKeys _3dmouseVirtualKeys[] = {
CONNEXIONPID_SPACEPILOT
, sizeof(SpacePilotKeys) / sizeof(SpacePilotKeys[0])
, const_cast<V3dk *>(SpacePilotKeys),
CONNEXIONPID_SPACEEXPLORER
, sizeof(SpaceExplorerKeys) / sizeof(SpaceExplorerKeys[0])
, const_cast<V3dk *>(SpaceExplorerKeys)
CONNEXIONPID_SPACEPILOT,
sizeof(SpacePilotKeys) / sizeof(SpacePilotKeys[0]),
const_cast<V3dk *>(SpacePilotKeys),
CONNEXIONPID_SPACEEXPLORER,
sizeof(SpaceExplorerKeys) / sizeof(SpaceExplorerKeys[0]),
const_cast<V3dk *>(SpaceExplorerKeys)
};
// Converts a hid device keycode (button identifier) of a pre-2009 3Dconnexion USB device to the standard 3d mouse virtual key definition.
@ -282,10 +280,8 @@ static const struct tag_VirtualKeys _3dmouseVirtualKeys[] = {
// to the standard 3d mouse virtual key definition.
unsigned short HidToVirtualKey(unsigned long pid, unsigned short hidKeyCode) {
unsigned short virtualkey = hidKeyCode;
for (size_t i = 0; i<sizeof(_3dmouseVirtualKeys) / sizeof(_3dmouseVirtualKeys[0]); ++i)
{
if (pid == _3dmouseVirtualKeys[i].pid)
{
for (size_t i = 0; i<sizeof(_3dmouseVirtualKeys) / sizeof(_3dmouseVirtualKeys[0]); ++i) {
if (pid == _3dmouseVirtualKeys[i].pid) {
if (hidKeyCode < _3dmouseVirtualKeys[i].nKeys) {
virtualkey = _3dmouseVirtualKeys[i].vkeys[hidKeyCode];
} else {
@ -319,7 +315,7 @@ bool ConnexionClient::RawInputEventFilter(void* msg, long* result) {
if (message->message == WM_INPUT) {
HRAWINPUT hRawInput = reinterpret_cast<HRAWINPUT>(message->lParam);
gMouseInput->OnRawInput(RIM_INPUT, hRawInput);
if (result != 0) {
if (result != 0) {
result = 0;
}
return true;
@ -680,8 +676,6 @@ void ConnexionClient::OnRawInput(UINT nInputCode, HRAWINPUT hRawInput) {
bool ConnexionClient::TranslateRawInputData(UINT nInputCode, PRAWINPUT pRawInput) {
bool bIsForeground = (nInputCode == RIM_INPUT);
//qDebug("Rawinput.header.dwType=0x%x\n", pRawInput->header.dwType);
// We are not interested in keyboard or mouse data received via raw input
if (pRawInput->header.dwType != RIM_TYPEHID) {
return false;
@ -689,9 +683,9 @@ bool ConnexionClient::TranslateRawInputData(UINT nInputCode, PRAWINPUT pRawInput
if (TRACE_RIDI_DEVICENAME == 1) {
UINT dwSize = 0;
if (::GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICENAME, NULL, &dwSize) == 0) {
if (::GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICENAME, NULL, &dwSize) == 0) {
std::vector<wchar_t> szDeviceName(dwSize + 1);
if (::GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICENAME, &szDeviceName[0], &dwSize) >0) {
if (::GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICENAME, &szDeviceName[0], &dwSize) > 0) {
qDebug("Device Name = %s\nDevice handle = 0x%x\n", &szDeviceName[0], pRawInput->header.hDevice);
}
}
@ -703,7 +697,7 @@ bool ConnexionClient::TranslateRawInputData(UINT nInputCode, PRAWINPUT pRawInput
if (::GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICEINFO, &sRidDeviceInfo, &cbSize) == cbSize) {
if (TRACE_RIDI_DEVICEINFO == 1) {
switch (sRidDeviceInfo.dwType) {
switch (sRidDeviceInfo.dwType) {
case RIM_TYPEMOUSE:
qDebug("\tsRidDeviceInfo.dwType=RIM_TYPEMOUSE\n");
break;
@ -806,16 +800,19 @@ bool ConnexionClient::TranslateRawInputData(UINT nInputCode, PRAWINPUT pRawInput
return false;
}
MouseParameters::MouseParameters() : fNavigation(NAVIGATION_OBJECT_MODE)
, fPivot(PIVOT_AUTO)
, fPivotVisibility(PIVOT_SHOW)
, fIsLockHorizon(true)
, fIsPanZoom(true)
, fIsRotate(true)
, fSpeed(SPEED_LOW) {
MouseParameters::MouseParameters() :
fNavigation(NAVIGATION_OBJECT_MODE),
fPivot(PIVOT_AUTO),
fPivotVisibility(PIVOT_SHOW),
fIsLockHorizon(true),
fIsPanZoom(true),
fIsRotate(true),
fSpeed(SPEED_LOW)
{
}
MouseParameters::~MouseParameters() {
MouseParameters::~MouseParameters()
{
}
bool MouseParameters::IsPanZoom() const {
@ -831,15 +828,15 @@ MouseParameters::Speed MouseParameters::GetSpeed() const {
}
void MouseParameters::SetPanZoom(bool isPanZoom) {
fIsPanZoom=isPanZoom;
fIsPanZoom = isPanZoom;
}
void MouseParameters::SetRotate(bool isRotate) {
fIsRotate=isRotate;
fIsRotate = isRotate;
}
void MouseParameters::SetSpeed(Speed speed) {
fSpeed=speed;
fSpeed = speed;
}
MouseParameters::Navigation MouseParameters::GetNavigationMode() const {
@ -1010,4 +1007,4 @@ void MessageHandler(unsigned int connection, unsigned int messageType, void *mes
#endif // __APPLE__
#endif // HAVE_CONNEXIONCLIENT
#endif // HAVE_3DCONNEXIONCLIENT

View file

@ -1,5 +1,5 @@
// 3DConnexion.h
// hifi
// 3DConnexionClient.h
// interface/src/devices
//
// Created by Marcel Verhagen on 09-06-15.
// Copyright 2015 High Fidelity, Inc.
@ -8,8 +8,8 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_ConnexionClient_h
#define hifi_ConnexionClient_h
#ifndef hifi_3DConnexionClient_h
#define hifi_3DConnexionClient_h
#include <qobject.h>
#include <qlibrary.h>
@ -18,7 +18,7 @@
#include "ui/UserInputMapper.h"
#ifndef HAVE_CONNEXIONCLIENT
#ifndef HAVE_3DCONNEXIONCLIENT
class ConnexionClient : public QObject {
Q_OBJECT
public:
@ -29,9 +29,9 @@ public:
public slots:
void toggleConnexion(bool shouldEnable) {};
};
#endif // NOT_HAVE_CONNEXIONCLIENT
#endif // NOT_HAVE_3DCONNEXIONCLIENT
#ifdef HAVE_CONNEXIONCLIENT
#ifdef HAVE_3DCONNEXIONCLIENT
// the windows connexion rawinput
#ifdef _WIN32
@ -86,16 +86,15 @@ private:
class ConnexionClient : public QObject, public QAbstractNativeEventFilter {
Q_OBJECT
public:
ConnexionClient();
ConnexionClient();
~ConnexionClient();
static ConnexionClient& getInstance();
ConnexionClient* client;
static ConnexionClient& getInstance();
static void init();
static void destroy();
static bool Is3dmouseAttached();
ConnexionClient* client;
I3dMouseParam& MouseParams();
const I3dMouseParam& MouseParams() const;
@ -166,16 +165,16 @@ class ConnexionClient : public QObject {
Q_OBJECT
public:
static ConnexionClient& getInstance();
static bool Is3dmouseAttached();
static void init();
static void destroy();
static bool Is3dmouseAttached();
public slots:
void toggleConnexion(bool shouldEnable);
};
#endif // __APPLE__
#endif // HAVE_CONNEXIONCLIENT
#endif // HAVE_3DCONNEXIONCLIENT
// connnects to the userinputmapper
@ -241,4 +240,4 @@ protected:
AxisStateMap _axisStateMap;
};
#endif // defined(hifi_ConnexionClient_h)
#endif // defined(hifi_3DConnexionClient_h)