mirror of https://github.com/bjornbytes/lovr.git
Start pico headset backend;
This commit is contained in:
parent
35a4c062c3
commit
e7d4e6cf7b
|
@ -34,3 +34,4 @@ bin
|
|||
.vs
|
||||
/test
|
||||
deps/VrApi
|
||||
deps/pico
|
||||
|
|
|
@ -24,6 +24,7 @@ option(LOVR_USE_WEBVR "Enable the WebVR backend for the headset module" OFF)
|
|||
option(LOVR_USE_WEBXR "Enable the WebXR backend for the headset module" OFF)
|
||||
option(LOVR_USE_OCULUS "Enable the LibOVR backend for the headset module (be sure to also set LOVR_OCULUS_PATH to point to the Oculus SDK)" OFF)
|
||||
option(LOVR_USE_VRAPI "Enable the VrApi backend for the headset module" OFF)
|
||||
option(LOVR_USE_PICO "Enable the Pico backend for the headset module" OFF)
|
||||
option(LOVR_USE_DESKTOP_HEADSET "Enable the keyboard/mouse backend for the headset module" ON)
|
||||
option(LOVR_USE_LEAP "Enable the Leap Motion backend for the headset module" OFF)
|
||||
|
||||
|
@ -296,6 +297,14 @@ if(LOVR_ENABLE_HEADSET AND LOVR_USE_VRAPI)
|
|||
set(LOVR_VRAPI VrApi)
|
||||
endif()
|
||||
|
||||
# Pico Native SDK (1.3.3)
|
||||
if(LOVR_ENABLE_HEADSET AND LOVR_USE_PICO)
|
||||
set(LOVR_PICO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/deps/pico" CACHE STRING "The path to the Pico SDK folder (unzipped aar)")
|
||||
add_library(Pvr_NativeSDK SHARED IMPORTED)
|
||||
set_target_properties(Pvr_NativeSDK PROPERTIES IMPORTED_LOCATION "${LOVR_PICO_PATH}/jni/${ANDROID_ABI}/libPvr_NativeSDK.so")
|
||||
set(LOVR_PICO Pvr_NativeSDK)
|
||||
endif()
|
||||
|
||||
# pthreads
|
||||
if(LOVR_ENABLE_THREAD)
|
||||
if(NOT WIN32 AND NOT EMSCRIPTEN)
|
||||
|
@ -367,6 +376,7 @@ target_link_libraries(lovr
|
|||
${LOVR_OPENXR}
|
||||
${LOVR_OCULUS}
|
||||
${LOVR_VRAPI}
|
||||
${LOVR_PICO}
|
||||
${LOVR_LEAP}
|
||||
${LOVR_PTHREADS}
|
||||
${LOVR_EMSCRIPTEN_FLAGS}
|
||||
|
@ -472,6 +482,10 @@ if(LOVR_ENABLE_HEADSET)
|
|||
add_definitions(-DLOVR_USE_VRAPI)
|
||||
target_sources(lovr PRIVATE src/modules/headset/headset_vrapi.c)
|
||||
endif()
|
||||
if(LOVR_USE_PICO)
|
||||
add_definitions(-DLOVR_USE_PICO)
|
||||
target_sources(lovr PRIVATE src/modules/headset/headset_pico.c)
|
||||
endif()
|
||||
if(LOVR_USE_WEBVR)
|
||||
add_definitions(-DLOVR_USE_WEBVR)
|
||||
target_sources(lovr PRIVATE src/modules/headset/headset_webvr.c)
|
||||
|
@ -636,13 +650,22 @@ elseif(ANDROID)
|
|||
PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib/${ANDROID_ABI}"
|
||||
)
|
||||
|
||||
# Imported targets need to have their libraries manually copied to lib/<ABI>
|
||||
# We also figure out which Java class (Activity) we're using here
|
||||
# Flavor-specific config:
|
||||
# - Imported targets need to have their libraries manually copied to lib/<ABI>
|
||||
# - Figure out which Java class (Activity) and AndroidManifest.xml to use
|
||||
# - Oculus uses the regular android os layer, pico implements its own in the headset backend
|
||||
# - Some of the Pico SDK is in a jar that has to be added to the classpath and dx invocation
|
||||
# TODO error (probably way earlier) if both USE_VRAPI and USE_PICO aren't defined
|
||||
if(LOVR_USE_VRAPI)
|
||||
get_target_property(VRAPI_LIB ${LOVR_VRAPI} IMPORTED_LOCATION)
|
||||
file(COPY ${VRAPI_LIB} DESTINATION lib/${ANDROID_ABI})
|
||||
set(ANDROID_MANIFEST "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/AndroidManifest_vrapi.xml" CACHE STRING "The AndroidManifest.xml path")
|
||||
set(ANDROID_ACTIVITY "vrapi")
|
||||
elseif(LOVR_USE_PICO)
|
||||
get_target_property(PICO_LIB ${LOVR_PICO} IMPORTED_LOCATION)
|
||||
file(COPY ${PICO_LIB} DESTINATION lib/${ANDROID_ABI})
|
||||
set(ANDROID_MANIFEST "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/AndroidManifest_pico.xml" CACHE STRING "The AndroidManifest.xml path")
|
||||
set(ANDROID_ACTIVITY "pico")
|
||||
endif()
|
||||
|
||||
# Make an apk
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
#include "headset/headset.h"
|
||||
#include <string.h>
|
||||
|
||||
static struct {
|
||||
float offset;
|
||||
} state;
|
||||
|
||||
static bool pico_init(float offset, uint32_t msaa) {
|
||||
state.offset = offset;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void pico_destroy(void) {
|
||||
memset(&state, 0, sizeof(state));
|
||||
}
|
||||
|
||||
static bool pico_getName(char* name, size_t length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static HeadsetOrigin pico_getOriginType(void) {
|
||||
return ORIGIN_HEAD;
|
||||
}
|
||||
|
||||
static double pico_getDisplayTime(void) {
|
||||
return 0.;
|
||||
}
|
||||
|
||||
static void pico_getDisplayDimensions(uint32_t* width, uint32_t* height) {
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
}
|
||||
|
||||
static const float* pico_getDisplayMask(uint32_t* count) {
|
||||
*count = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static uint32_t pico_getViewCount(void) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
static bool pico_getViewPose(uint32_t view, float* position, float* orientation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool pico_getViewAngles(uint32_t view, float* left, float* right, float* up, float* down) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void pico_getClipDistance(float* clipNear, float* clipFar) {
|
||||
*clipNear = 0.f;
|
||||
*clipFar = 0.f;
|
||||
}
|
||||
|
||||
static void pico_setClipDistance(float clipNear, float clipFar) {
|
||||
//
|
||||
}
|
||||
|
||||
static void pico_getBoundsDimensions(float* width, float* depth) {
|
||||
*width = *depth = 0.f;
|
||||
}
|
||||
|
||||
static const float* pico_getBoundsGeometry(uint32_t* count) {
|
||||
*count = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool pico_getPose(Device device, float* position, float* orientation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool pico_getVelocity(Device device, float* velocity, float* angularVelocity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool pico_isDown(Device device, DeviceButton button, bool* down, bool* changed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool pico_isTouched(Device device, DeviceButton button, bool* touched) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool pico_getAxis(Device device, DeviceAxis axis, float* value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool pico_vibrate(Device device, float strength, float duration, float frequency) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static struct ModelData* pico_newModelData(Device device) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void pico_renderTo(void (*callback)(void*), void* userdata) {
|
||||
//
|
||||
}
|
||||
|
||||
static void pico_update(float dt) {
|
||||
//
|
||||
}
|
||||
|
||||
HeadsetInterface lovrHeadsetPicoDriver = {
|
||||
.driverType = DRIVER_PICO,
|
||||
.init = pico_init,
|
||||
.destroy = pico_destroy,
|
||||
.getName = pico_getName,
|
||||
.getOriginType = pico_getOriginType,
|
||||
.getDisplayTime = pico_getDisplayTime,
|
||||
.getDisplayDimensions = pico_getDisplayDimensions,
|
||||
.getDisplayMask = pico_getDisplayMask,
|
||||
.getViewCount = pico_getViewCount,
|
||||
.getViewPose = pico_getViewPose,
|
||||
.getViewAngles = pico_getViewAngles,
|
||||
.getClipDistance = pico_getClipDistance,
|
||||
.setClipDistance = pico_setClipDistance,
|
||||
.getBoundsDimensions = pico_getBoundsDimensions,
|
||||
.getBoundsGeometry = pico_getBoundsGeometry,
|
||||
.getPose = pico_getPose,
|
||||
.getVelocity = pico_getVelocity,
|
||||
.isDown = pico_isDown,
|
||||
.isTouched = pico_isTouched,
|
||||
.getAxis = pico_getAxis,
|
||||
.vibrate = pico_vibrate,
|
||||
.newModelData = pico_newModelData,
|
||||
.renderTo = pico_renderTo,
|
||||
.update = pico_update
|
||||
};
|
|
@ -0,0 +1,71 @@
|
|||
package org.lovr.app;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.picovr.vractivity.Eye;
|
||||
import com.picovr.vractivity.HmdState;
|
||||
import com.picovr.vractivity.RenderInterface;
|
||||
import com.picovr.vractivity.VRActivity;
|
||||
|
||||
public class Activity extends VRActivity implements RenderInterface {
|
||||
|
||||
// Activity
|
||||
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
// RenderInterface
|
||||
|
||||
public void initGL(int width, int height) {
|
||||
//
|
||||
}
|
||||
|
||||
public void onFrameBegin(HmdState state) {
|
||||
//
|
||||
}
|
||||
|
||||
public void onDrawEye(Eye eye) {
|
||||
//
|
||||
}
|
||||
|
||||
public void onFrameEnd() {
|
||||
//
|
||||
}
|
||||
|
||||
public void onRenderPause() {
|
||||
//
|
||||
}
|
||||
|
||||
public void onRenderResume() {
|
||||
//
|
||||
}
|
||||
|
||||
public void onRendererShutdown() {
|
||||
//
|
||||
}
|
||||
|
||||
public void surfaceChangedCallBack(int width, int height) {
|
||||
//
|
||||
}
|
||||
|
||||
public void renderEventCallBack(int i) {
|
||||
//
|
||||
}
|
||||
|
||||
public void onTouchEvent() {
|
||||
//
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("lovr");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.lovr.app">
|
||||
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29"/>
|
||||
<application android:allowBackup="false" android:label="LÖVR" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<meta-data android:name="pvr.app.type" android:value="vr"/>
|
||||
<activity android:name="Activity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
Loading…
Reference in New Issue