mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
initial setup to connect to oculus and grab sensors
This commit is contained in:
parent
613066f786
commit
999ab5cb20
4 changed files with 50 additions and 14 deletions
|
@ -94,6 +94,7 @@ if (APPLE)
|
|||
find_library(Carbon Carbon)
|
||||
find_library(GLUT GLUT)
|
||||
find_library(OpenGL OpenGL)
|
||||
find_library(IOKit IOKit)
|
||||
|
||||
target_link_libraries(
|
||||
${TARGET_NAME}
|
||||
|
@ -104,6 +105,7 @@ if (APPLE)
|
|||
${Carbon}
|
||||
${GLUT}
|
||||
${OpenGL}
|
||||
${IOKit}
|
||||
)
|
||||
else (APPLE)
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
|
22
interface/src/OculusManager.cpp
Normal file
22
interface/src/OculusManager.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// OculusManager.cpp
|
||||
// hifi
|
||||
//
|
||||
// Created by Stephen Birarda on 5/9/13.
|
||||
// Copyright (c) 2012 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#include "OculusManager.h"
|
||||
|
||||
SensorFusion* OculusManager::_sensorFusion = NULL;
|
||||
|
||||
void OculusManager::connect() {
|
||||
System::Init();
|
||||
Ptr<DeviceManager> deviceManager = *DeviceManager::Create();
|
||||
Ptr<HMDDevice> oculus = *deviceManager->EnumerateDevices<HMDDevice>().CreateDevice();
|
||||
|
||||
if (oculus) {
|
||||
Ptr<SensorDevice> sensor = *oculus->GetSensor();
|
||||
_sensorFusion = new SensorFusion(sensor);
|
||||
}
|
||||
}
|
24
interface/src/OculusManager.h
Normal file
24
interface/src/OculusManager.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// OculusManager.h
|
||||
// hifi
|
||||
//
|
||||
// Created by Stephen Birarda on 5/9/13.
|
||||
// Copyright (c) 2012 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __hifi__OculusManager__
|
||||
#define __hifi__OculusManager__
|
||||
|
||||
#include <iostream>
|
||||
#include <OVR.h>
|
||||
|
||||
using namespace OVR;
|
||||
|
||||
class OculusManager {
|
||||
public:
|
||||
static void connect();
|
||||
private:
|
||||
static SensorFusion* _sensorFusion;
|
||||
};
|
||||
|
||||
#endif /* defined(__hifi__OculusManager__) */
|
|
@ -40,8 +40,6 @@
|
|||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include <OVR.h>
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include "Log.h"
|
||||
|
@ -83,6 +81,7 @@
|
|||
#include "ViewFrustum.h"
|
||||
#include "HandControl.h"
|
||||
#include "AvatarRenderer.h"
|
||||
#include "OculusManager.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -327,18 +326,7 @@ void init(void) {
|
|||
myAvatar.setPosition(start_location);
|
||||
myCamera.setPosition(start_location);
|
||||
|
||||
|
||||
#ifdef MARKER_CAPTURE
|
||||
if(marker_capture_enabled){
|
||||
marker_capturer.position_updated(&position_updated);
|
||||
marker_capturer.frame_updated(&marker_frame_available);
|
||||
if(!marker_capturer.init_capture()){
|
||||
printLog("Camera-based marker capture initialized.\n");
|
||||
}else{
|
||||
printLog("Error initializing camera-based marker capture.\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
OculusManager::connect();
|
||||
|
||||
gettimeofday(&timerStart, NULL);
|
||||
gettimeofday(&lastTimeIdle, NULL);
|
||||
|
|
Loading…
Reference in a new issue