mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-14 05:40:05 +00:00
Add VR/OpenVR support on Linux
This commit is contained in:
parent
b4f038fd67
commit
7c163f2163
@ -214,7 +214,7 @@ IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
|
||||
|
||||
#VR/OpenVR only on Windows and Mac OSX for now
|
||||
#VR/OpenVR on Windows and Mac OSX
|
||||
IF (WIN32 OR APPLE)
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
@ -328,4 +328,80 @@ IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
SET_TARGET_PROPERTIES(App_PhysicsServer_SharedMemory_VR PROPERTIES RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo")
|
||||
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
|
||||
#VR/OpenVR on Linux
|
||||
ELSE(WIN32 OR APPLE)
|
||||
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
|
||||
LINK_DIRECTORIES(${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/bin/linux64)
|
||||
ELSE()
|
||||
LINK_DIRECTORIES(${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/bin/linux32)
|
||||
ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory_VR
|
||||
${SharedMemory_SRCS}
|
||||
../StandaloneMain/hellovr_opengl_main.cpp
|
||||
../ExampleBrowser/OpenGLGuiHelper.cpp
|
||||
../ExampleBrowser/GL_ShapeDrawer.cpp
|
||||
../ExampleBrowser/CollisionShape2TriangleMesh.cpp
|
||||
../RenderingExamples/TinyVRGui.cpp
|
||||
../RenderingExamples/TinyVRGui.h
|
||||
../RenderingExamples/TimeSeriesCanvas.cpp
|
||||
../RenderingExamples/TimeSeriesFontData.cpp
|
||||
../MultiThreading/b3PosixThreadSupport.cpp
|
||||
../MultiThreading/b3PosixThreadSupport.h
|
||||
../ThirdPartyLibs/openvr/samples/shared/lodepng.cpp
|
||||
../ThirdPartyLibs/openvr/samples/shared/lodepng.h
|
||||
../ThirdPartyLibs/openvr/samples/shared/Matrices.cpp
|
||||
../ThirdPartyLibs/openvr/samples/shared/Matrices.h
|
||||
../ThirdPartyLibs/openvr/samples/shared/pathtools.cpp
|
||||
../ThirdPartyLibs/openvr/samples/shared/pathtools.h
|
||||
../ThirdPartyLibs/openvr/samples/shared/strtools.cpp
|
||||
../ThirdPartyLibs/openvr/samples/shared/strtools.h
|
||||
../ThirdPartyLibs/openvr/samples/shared/Vectors.h
|
||||
)
|
||||
|
||||
target_include_directories(App_PhysicsServer_SharedMemory_VR PRIVATE
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/src
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/Glew
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/headers
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/samples
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/samples/shared
|
||||
)
|
||||
|
||||
target_compile_definitions(App_PhysicsServer_SharedMemory_VR PRIVATE
|
||||
POSIX
|
||||
LINUX
|
||||
BT_ENABLE_VR
|
||||
GLEW_STATIC
|
||||
GLEW_INIT_OPENGL11_FUNCTIONS=1
|
||||
GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1
|
||||
)
|
||||
|
||||
target_compile_options(App_PhysicsServer_SharedMemory_VR PRIVATE
|
||||
-std=c++11
|
||||
)
|
||||
|
||||
target_link_libraries(App_PhysicsServer_SharedMemory_VR PRIVATE
|
||||
openvr_api
|
||||
pthread
|
||||
${DL}
|
||||
${OPENGL_gl_LIBRARY}
|
||||
${OPENGL_glu_LIBRARY}
|
||||
Bullet3Common
|
||||
BulletWorldImporter
|
||||
BulletInverseDynamicsUtils
|
||||
BulletInverseDynamics
|
||||
BulletDynamics
|
||||
BulletCollision
|
||||
LinearMath
|
||||
BussIK
|
||||
OpenGLWindow
|
||||
)
|
||||
|
||||
IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
SET_TARGET_PROPERTIES(App_PhysicsServer_SharedMemory_VR PROPERTIES DEBUG_POSTFIX "_Debug")
|
||||
SET_TARGET_PROPERTIES(App_PhysicsServer_SharedMemory_VR PROPERTIES MINSIZEREL_POSTFIX "_MinsizeRel")
|
||||
SET_TARGET_PROPERTIES(App_PhysicsServer_SharedMemory_VR PROPERTIES RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo")
|
||||
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
|
||||
ENDIF(WIN32 OR APPLE)
|
||||
|
@ -59,6 +59,9 @@ static vr::VRControllerState_t sPrevStates[vr::k_unMaxTrackedDeviceCount] = { 0
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
void ThreadSleep( unsigned long nMilliseconds )
|
||||
{
|
||||
@ -1804,13 +1807,11 @@ void CMainApplication::RenderStereoTargets()
|
||||
}
|
||||
|
||||
glBindFramebuffer( GL_FRAMEBUFFER, leftEyeDesc.m_nRenderFramebufferId );
|
||||
glViewport(0, 0, m_nRenderWidth, m_nRenderHeight );
|
||||
|
||||
|
||||
|
||||
|
||||
m_app->m_window->startRendering();
|
||||
|
||||
glViewport(0, 0, m_nRenderWidth, m_nRenderHeight );
|
||||
|
||||
|
||||
RenderScene( vr::Eye_Left );
|
||||
|
||||
@ -1863,9 +1864,9 @@ void CMainApplication::RenderStereoTargets()
|
||||
}
|
||||
|
||||
glBindFramebuffer( GL_FRAMEBUFFER, rightEyeDesc.m_nRenderFramebufferId );
|
||||
glViewport(0, 0, m_nRenderWidth, m_nRenderHeight );
|
||||
|
||||
m_app->m_window->startRendering();
|
||||
glViewport(0, 0, m_nRenderWidth, m_nRenderHeight );
|
||||
|
||||
RenderScene( vr::Eye_Right );
|
||||
|
||||
@ -2081,6 +2082,7 @@ void CMainApplication::UpdateHMDMatrixPose()
|
||||
case vr::TrackedDeviceClass_HMD: m_rDevClassChar[nDevice] = 'H'; break;
|
||||
case vr::TrackedDeviceClass_Invalid: m_rDevClassChar[nDevice] = 'I'; break;
|
||||
case vr::TrackedDeviceClass_TrackingReference: m_rDevClassChar[nDevice] = 'T'; break;
|
||||
case vr::TrackedDeviceClass_GenericTracker: m_rDevClassChar[nDevice] = 'G'; break;
|
||||
default: m_rDevClassChar[nDevice] = '?'; break;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#define stricmp strcasecmp
|
||||
#define strnicmp strncasecmp
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user