mirror of
https://github.com/DrBeef/QuakeQuest.git
synced 2024-11-21 11:40:59 +00:00
Single APK scheme for all devices
This commit is contained in:
parent
c0fbe43f8d
commit
08abd5fd16
19 changed files with 9739 additions and 150 deletions
16
.gitignore
vendored
16
.gitignore
vendored
|
@ -15,8 +15,6 @@ $RECYCLE.BIN/
|
|||
*.o
|
||||
*.d
|
||||
|
||||
#binaries
|
||||
*.so
|
||||
|
||||
#libs
|
||||
*.a
|
||||
|
@ -38,3 +36,17 @@ Projects/Android/.idea/codeStyles/Project.xml
|
|||
Projects/Android/.gradle/*
|
||||
drbeef-release-key.keystore
|
||||
Projects/Android/.idea/.name
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/armeabi-v7a/libogg.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/armeabi-v7a/libvorbis-jni.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/armeabi-v7a/libvorbis.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/armeabi/libogg.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/armeabi/libvorbis-jni.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/armeabi/libvorbis.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/mips/libogg.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/mips/libvorbis-jni.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/mips/libvorbis.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/x86/libogg.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/x86/libvorbis-jni.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/x86/libvorbis.so
|
||||
Projects/Android/libs/arm64-v8a/libopenxr_loader_meta.so
|
||||
Projects/Android/libs/arm64-v8a/libopenxr_loader_pico.so
|
||||
|
|
|
@ -41,6 +41,11 @@ android {
|
|||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'lib/arm64-v8a/libopenxr_loader.so'
|
||||
}
|
||||
|
||||
compileSdkVersion = 26
|
||||
buildToolsVersion = '29.0.1'
|
||||
}
|
||||
|
|
|
@ -6,20 +6,14 @@ LOCAL_PATH:= $(call my-dir)
|
|||
#--------------------------------------------------------
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# Uncomment for the correct headset - slight changes required in OpenXR implementation
|
||||
OPENXR_HMD = META_QUEST
|
||||
#OPENXR_HMD = PICO_XR
|
||||
|
||||
LOCAL_CFLAGS := -D$(OPENXR_HMD)
|
||||
LOCAL_MODULE := quakequest
|
||||
LOCAL_LDLIBS := -llog -landroid -lGLESv3 -lEGL -lOpenSLES # include default libraries
|
||||
|
||||
LOCAL_C_INCLUDES := ../QuakeQuestSrc/ \
|
||||
../darkplaces/ \
|
||||
$(SUPPORT_LIBS)/liboggvorbis/include \
|
||||
$(TOP_DIR)/../../../../../3rdParty/khronos/openxr/OpenXR-SDK/include \
|
||||
$(TOP_DIR)/../../../../../3rdParty/khronos/openxr/OpenXR-SDK/src/common \
|
||||
$(TOP_DIR)/../../../../../OpenXR/Include
|
||||
${TOP_DIR}/OpenXR-SDK/include \
|
||||
${TOP_DIR}/OpenXR-SDK/src/common
|
||||
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := openxr_loader libvorbis libogg libvorbis-jni
|
||||
|
|
20
Projects/Android/jni/OpenXR-SDK/include/CMakeLists.txt
Normal file
20
Projects/Android/jni/OpenXR-SDK/include/CMakeLists.txt
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Copyright (c) 2017 The Khronos Group Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Author:
|
||||
#
|
||||
|
||||
add_subdirectory(openxr)
|
101
Projects/Android/jni/OpenXR-SDK/include/openxr/CMakeLists.txt
Normal file
101
Projects/Android/jni/OpenXR-SDK/include/openxr/CMakeLists.txt
Normal file
|
@ -0,0 +1,101 @@
|
|||
# Copyright (c) 2017-2022, The Khronos Group Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Author:
|
||||
#
|
||||
|
||||
# Copy the openxr_platform_defines.h file and place it in the binary (build) directory.
|
||||
configure_file(openxr_platform_defines.h ${CMAKE_CURRENT_BINARY_DIR}/openxr_platform_defines.h COPYONLY)
|
||||
|
||||
# Generate OpenXR header files.
|
||||
|
||||
|
||||
set(HEADERS
|
||||
openxr.h
|
||||
openxr_platform.h
|
||||
openxr_reflection.h)
|
||||
set(HAVE_PREGENERATED TRUE)
|
||||
set(SOURCE_HEADERS)
|
||||
foreach(output ${HEADERS})
|
||||
list(APPEND SOURCE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/${output})
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${output})
|
||||
set(HAVE_PREGENERATED FALSE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(XR_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
||||
if(HAVE_PREGENERATED AND NOT BUILD_FORCE_GENERATION)
|
||||
add_custom_target(generate_openxr_header
|
||||
COMMENT "Using found pre-generated OpenXR headers.")
|
||||
|
||||
set(INSTALL_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openxr_platform_defines.h
|
||||
${SOURCE_HEADERS})
|
||||
else()
|
||||
|
||||
set(GENERATED_HEADERS)
|
||||
set(OUTPUT_STAMPS)
|
||||
# Copy the openxr_platform_defines.h file and place it in the binary (build) directory.
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openxr_platform_defines.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/openxr_platform_defines.h
|
||||
COPYONLY)
|
||||
|
||||
# Generate the header files and place it in the binary (build) directory.
|
||||
foreach(output ${HEADERS})
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${output}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${XR_ROOT}/specification/scripts/genxr.py
|
||||
-registry ${XR_ROOT}/specification/registry/xr.xml
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR} ${output}
|
||||
DEPENDS
|
||||
${XR_ROOT}/specification/scripts/genxr.py
|
||||
${XR_ROOT}/specification/scripts/cgenerator.py
|
||||
${XR_ROOT}/specification/scripts/creflectiongenerator.py
|
||||
${XR_ROOT}/specification/scripts/generator.py
|
||||
${XR_ROOT}/specification/scripts/reg.py
|
||||
${XR_ROOT}/specification/registry/xr.xml
|
||||
COMMENT "Generating ${CMAKE_CURRENT_BINARY_DIR}/${output}"
|
||||
)
|
||||
list(APPEND GENERATED_HEADERS "${CMAKE_CURRENT_BINARY_DIR}/${output}")
|
||||
endforeach()
|
||||
|
||||
set_source_files_properties(
|
||||
${GENERATED_HEADERS}
|
||||
PROPERTIES GENERATED TRUE
|
||||
)
|
||||
|
||||
set(INSTALL_HEADERS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/openxr_platform_defines.h
|
||||
${GENERATED_HEADERS})
|
||||
|
||||
|
||||
# Define generate_openxr_header target to generate the OpenXR header files.
|
||||
# Other targets that need the OpenXR headers should use generate_openxr_header as a dependency.
|
||||
add_custom_target(generate_openxr_header
|
||||
SOURCES ${XR_ROOT}/specification/registry/xr.xml
|
||||
DEPENDS
|
||||
${GENERATED_HEADERS}
|
||||
${OUTPUT_STAMPS}
|
||||
)
|
||||
endif()
|
||||
set_target_properties(generate_openxr_header PROPERTIES FOLDER ${CODEGEN_FOLDER})
|
||||
if(NOT CMAKE_INSTALL_INCDIR)
|
||||
set(CMAKE_INSTALL_INCDIR include)
|
||||
endif()
|
||||
|
||||
INSTALL(FILES ${INSTALL_HEADERS}
|
||||
DESTINATION ${CMAKE_INSTALL_INCDIR}/openxr
|
||||
COMPONENT Headers
|
||||
)
|
4581
Projects/Android/jni/OpenXR-SDK/include/openxr/openxr.h
Normal file
4581
Projects/Android/jni/OpenXR-SDK/include/openxr/openxr.h
Normal file
File diff suppressed because it is too large
Load diff
690
Projects/Android/jni/OpenXR-SDK/include/openxr/openxr_platform.h
Normal file
690
Projects/Android/jni/OpenXR-SDK/include/openxr/openxr_platform.h
Normal file
|
@ -0,0 +1,690 @@
|
|||
#ifndef OPENXR_PLATFORM_H_
|
||||
#define OPENXR_PLATFORM_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2017-2022 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos OpenXR XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
#include "openxr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XR_USE_PLATFORM_ANDROID
|
||||
|
||||
#define XR_KHR_android_thread_settings 1
|
||||
#define XR_KHR_android_thread_settings_SPEC_VERSION 5
|
||||
#define XR_KHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME "XR_KHR_android_thread_settings"
|
||||
|
||||
typedef enum XrAndroidThreadTypeKHR {
|
||||
XR_ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR = 1,
|
||||
XR_ANDROID_THREAD_TYPE_APPLICATION_WORKER_KHR = 2,
|
||||
XR_ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR = 3,
|
||||
XR_ANDROID_THREAD_TYPE_RENDERER_WORKER_KHR = 4,
|
||||
XR_ANDROID_THREAD_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF
|
||||
} XrAndroidThreadTypeKHR;
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrSetAndroidApplicationThreadKHR)(XrSession session, XrAndroidThreadTypeKHR threadType, uint32_t threadId);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrSetAndroidApplicationThreadKHR(
|
||||
XrSession session,
|
||||
XrAndroidThreadTypeKHR threadType,
|
||||
uint32_t threadId);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
#endif /* XR_USE_PLATFORM_ANDROID */
|
||||
|
||||
#ifdef XR_USE_PLATFORM_ANDROID
|
||||
|
||||
#define XR_KHR_android_surface_swapchain 1
|
||||
#define XR_KHR_android_surface_swapchain_SPEC_VERSION 4
|
||||
#define XR_KHR_ANDROID_SURFACE_SWAPCHAIN_EXTENSION_NAME "XR_KHR_android_surface_swapchain"
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrCreateSwapchainAndroidSurfaceKHR)(XrSession session, const XrSwapchainCreateInfo* info, XrSwapchain* swapchain, jobject* surface);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrCreateSwapchainAndroidSurfaceKHR(
|
||||
XrSession session,
|
||||
const XrSwapchainCreateInfo* info,
|
||||
XrSwapchain* swapchain,
|
||||
jobject* surface);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
#endif /* XR_USE_PLATFORM_ANDROID */
|
||||
|
||||
#ifdef XR_USE_PLATFORM_ANDROID
|
||||
|
||||
#define XR_KHR_android_create_instance 1
|
||||
#define XR_KHR_android_create_instance_SPEC_VERSION 3
|
||||
#define XR_KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME "XR_KHR_android_create_instance"
|
||||
// XrInstanceCreateInfoAndroidKHR extends XrInstanceCreateInfo
|
||||
typedef struct XrInstanceCreateInfoAndroidKHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
void* XR_MAY_ALIAS applicationVM;
|
||||
void* XR_MAY_ALIAS applicationActivity;
|
||||
} XrInstanceCreateInfoAndroidKHR;
|
||||
|
||||
#endif /* XR_USE_PLATFORM_ANDROID */
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
|
||||
#define XR_KHR_vulkan_swapchain_format_list 1
|
||||
#define XR_KHR_vulkan_swapchain_format_list_SPEC_VERSION 4
|
||||
#define XR_KHR_VULKAN_SWAPCHAIN_FORMAT_LIST_EXTENSION_NAME "XR_KHR_vulkan_swapchain_format_list"
|
||||
typedef struct XrVulkanSwapchainFormatListCreateInfoKHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
uint32_t viewFormatCount;
|
||||
const VkFormat* viewFormats;
|
||||
} XrVulkanSwapchainFormatListCreateInfoKHR;
|
||||
|
||||
#endif /* XR_USE_GRAPHICS_API_VULKAN */
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL
|
||||
|
||||
#define XR_KHR_opengl_enable 1
|
||||
#define XR_KHR_opengl_enable_SPEC_VERSION 10
|
||||
#define XR_KHR_OPENGL_ENABLE_EXTENSION_NAME "XR_KHR_opengl_enable"
|
||||
#ifdef XR_USE_PLATFORM_WIN32
|
||||
// XrGraphicsBindingOpenGLWin32KHR extends XrSessionCreateInfo
|
||||
typedef struct XrGraphicsBindingOpenGLWin32KHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
HDC hDC;
|
||||
HGLRC hGLRC;
|
||||
} XrGraphicsBindingOpenGLWin32KHR;
|
||||
#endif // XR_USE_PLATFORM_WIN32
|
||||
|
||||
#ifdef XR_USE_PLATFORM_XLIB
|
||||
// XrGraphicsBindingOpenGLXlibKHR extends XrSessionCreateInfo
|
||||
typedef struct XrGraphicsBindingOpenGLXlibKHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
Display* xDisplay;
|
||||
uint32_t visualid;
|
||||
GLXFBConfig glxFBConfig;
|
||||
GLXDrawable glxDrawable;
|
||||
GLXContext glxContext;
|
||||
} XrGraphicsBindingOpenGLXlibKHR;
|
||||
#endif // XR_USE_PLATFORM_XLIB
|
||||
|
||||
#ifdef XR_USE_PLATFORM_XCB
|
||||
// XrGraphicsBindingOpenGLXcbKHR extends XrSessionCreateInfo
|
||||
typedef struct XrGraphicsBindingOpenGLXcbKHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
xcb_connection_t* connection;
|
||||
uint32_t screenNumber;
|
||||
xcb_glx_fbconfig_t fbconfigid;
|
||||
xcb_visualid_t visualid;
|
||||
xcb_glx_drawable_t glxDrawable;
|
||||
xcb_glx_context_t glxContext;
|
||||
} XrGraphicsBindingOpenGLXcbKHR;
|
||||
#endif // XR_USE_PLATFORM_XCB
|
||||
|
||||
#ifdef XR_USE_PLATFORM_WAYLAND
|
||||
// XrGraphicsBindingOpenGLWaylandKHR extends XrSessionCreateInfo
|
||||
typedef struct XrGraphicsBindingOpenGLWaylandKHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
struct wl_display* display;
|
||||
} XrGraphicsBindingOpenGLWaylandKHR;
|
||||
#endif // XR_USE_PLATFORM_WAYLAND
|
||||
|
||||
typedef struct XrSwapchainImageOpenGLKHR {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
uint32_t image;
|
||||
} XrSwapchainImageOpenGLKHR;
|
||||
|
||||
typedef struct XrGraphicsRequirementsOpenGLKHR {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
XrVersion minApiVersionSupported;
|
||||
XrVersion maxApiVersionSupported;
|
||||
} XrGraphicsRequirementsOpenGLKHR;
|
||||
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetOpenGLGraphicsRequirementsKHR)(XrInstance instance, XrSystemId systemId, XrGraphicsRequirementsOpenGLKHR* graphicsRequirements);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetOpenGLGraphicsRequirementsKHR(
|
||||
XrInstance instance,
|
||||
XrSystemId systemId,
|
||||
XrGraphicsRequirementsOpenGLKHR* graphicsRequirements);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
#endif /* XR_USE_GRAPHICS_API_OPENGL */
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
|
||||
#define XR_KHR_opengl_es_enable 1
|
||||
#define XR_KHR_opengl_es_enable_SPEC_VERSION 8
|
||||
#define XR_KHR_OPENGL_ES_ENABLE_EXTENSION_NAME "XR_KHR_opengl_es_enable"
|
||||
#ifdef XR_USE_PLATFORM_ANDROID
|
||||
// XrGraphicsBindingOpenGLESAndroidKHR extends XrSessionCreateInfo
|
||||
typedef struct XrGraphicsBindingOpenGLESAndroidKHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
EGLDisplay display;
|
||||
EGLConfig config;
|
||||
EGLContext context;
|
||||
} XrGraphicsBindingOpenGLESAndroidKHR;
|
||||
#endif // XR_USE_PLATFORM_ANDROID
|
||||
|
||||
typedef struct XrSwapchainImageOpenGLESKHR {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
uint32_t image;
|
||||
} XrSwapchainImageOpenGLESKHR;
|
||||
|
||||
typedef struct XrGraphicsRequirementsOpenGLESKHR {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
XrVersion minApiVersionSupported;
|
||||
XrVersion maxApiVersionSupported;
|
||||
} XrGraphicsRequirementsOpenGLESKHR;
|
||||
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetOpenGLESGraphicsRequirementsKHR)(XrInstance instance, XrSystemId systemId, XrGraphicsRequirementsOpenGLESKHR* graphicsRequirements);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetOpenGLESGraphicsRequirementsKHR(
|
||||
XrInstance instance,
|
||||
XrSystemId systemId,
|
||||
XrGraphicsRequirementsOpenGLESKHR* graphicsRequirements);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
#endif /* XR_USE_GRAPHICS_API_OPENGL_ES */
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
|
||||
#define XR_KHR_vulkan_enable 1
|
||||
#define XR_KHR_vulkan_enable_SPEC_VERSION 8
|
||||
#define XR_KHR_VULKAN_ENABLE_EXTENSION_NAME "XR_KHR_vulkan_enable"
|
||||
// XrGraphicsBindingVulkanKHR extends XrSessionCreateInfo
|
||||
typedef struct XrGraphicsBindingVulkanKHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
VkInstance instance;
|
||||
VkPhysicalDevice physicalDevice;
|
||||
VkDevice device;
|
||||
uint32_t queueFamilyIndex;
|
||||
uint32_t queueIndex;
|
||||
} XrGraphicsBindingVulkanKHR;
|
||||
|
||||
typedef struct XrSwapchainImageVulkanKHR {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
VkImage image;
|
||||
} XrSwapchainImageVulkanKHR;
|
||||
|
||||
typedef struct XrGraphicsRequirementsVulkanKHR {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
XrVersion minApiVersionSupported;
|
||||
XrVersion maxApiVersionSupported;
|
||||
} XrGraphicsRequirementsVulkanKHR;
|
||||
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetVulkanInstanceExtensionsKHR)(XrInstance instance, XrSystemId systemId, uint32_t bufferCapacityInput, uint32_t* bufferCountOutput, char* buffer);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetVulkanDeviceExtensionsKHR)(XrInstance instance, XrSystemId systemId, uint32_t bufferCapacityInput, uint32_t* bufferCountOutput, char* buffer);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetVulkanGraphicsDeviceKHR)(XrInstance instance, XrSystemId systemId, VkInstance vkInstance, VkPhysicalDevice* vkPhysicalDevice);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetVulkanGraphicsRequirementsKHR)(XrInstance instance, XrSystemId systemId, XrGraphicsRequirementsVulkanKHR* graphicsRequirements);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanInstanceExtensionsKHR(
|
||||
XrInstance instance,
|
||||
XrSystemId systemId,
|
||||
uint32_t bufferCapacityInput,
|
||||
uint32_t* bufferCountOutput,
|
||||
char* buffer);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanDeviceExtensionsKHR(
|
||||
XrInstance instance,
|
||||
XrSystemId systemId,
|
||||
uint32_t bufferCapacityInput,
|
||||
uint32_t* bufferCountOutput,
|
||||
char* buffer);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanGraphicsDeviceKHR(
|
||||
XrInstance instance,
|
||||
XrSystemId systemId,
|
||||
VkInstance vkInstance,
|
||||
VkPhysicalDevice* vkPhysicalDevice);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanGraphicsRequirementsKHR(
|
||||
XrInstance instance,
|
||||
XrSystemId systemId,
|
||||
XrGraphicsRequirementsVulkanKHR* graphicsRequirements);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
#endif /* XR_USE_GRAPHICS_API_VULKAN */
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_D3D11
|
||||
|
||||
#define XR_KHR_D3D11_enable 1
|
||||
#define XR_KHR_D3D11_enable_SPEC_VERSION 9
|
||||
#define XR_KHR_D3D11_ENABLE_EXTENSION_NAME "XR_KHR_D3D11_enable"
|
||||
// XrGraphicsBindingD3D11KHR extends XrSessionCreateInfo
|
||||
typedef struct XrGraphicsBindingD3D11KHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
ID3D11Device* device;
|
||||
} XrGraphicsBindingD3D11KHR;
|
||||
|
||||
typedef struct XrSwapchainImageD3D11KHR {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
ID3D11Texture2D* texture;
|
||||
} XrSwapchainImageD3D11KHR;
|
||||
|
||||
typedef struct XrGraphicsRequirementsD3D11KHR {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
LUID adapterLuid;
|
||||
D3D_FEATURE_LEVEL minFeatureLevel;
|
||||
} XrGraphicsRequirementsD3D11KHR;
|
||||
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetD3D11GraphicsRequirementsKHR)(XrInstance instance, XrSystemId systemId, XrGraphicsRequirementsD3D11KHR* graphicsRequirements);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetD3D11GraphicsRequirementsKHR(
|
||||
XrInstance instance,
|
||||
XrSystemId systemId,
|
||||
XrGraphicsRequirementsD3D11KHR* graphicsRequirements);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
#endif /* XR_USE_GRAPHICS_API_D3D11 */
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_D3D12
|
||||
|
||||
#define XR_KHR_D3D12_enable 1
|
||||
#define XR_KHR_D3D12_enable_SPEC_VERSION 9
|
||||
#define XR_KHR_D3D12_ENABLE_EXTENSION_NAME "XR_KHR_D3D12_enable"
|
||||
// XrGraphicsBindingD3D12KHR extends XrSessionCreateInfo
|
||||
typedef struct XrGraphicsBindingD3D12KHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
ID3D12Device* device;
|
||||
ID3D12CommandQueue* queue;
|
||||
} XrGraphicsBindingD3D12KHR;
|
||||
|
||||
typedef struct XrSwapchainImageD3D12KHR {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
ID3D12Resource* texture;
|
||||
} XrSwapchainImageD3D12KHR;
|
||||
|
||||
typedef struct XrGraphicsRequirementsD3D12KHR {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
LUID adapterLuid;
|
||||
D3D_FEATURE_LEVEL minFeatureLevel;
|
||||
} XrGraphicsRequirementsD3D12KHR;
|
||||
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetD3D12GraphicsRequirementsKHR)(XrInstance instance, XrSystemId systemId, XrGraphicsRequirementsD3D12KHR* graphicsRequirements);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetD3D12GraphicsRequirementsKHR(
|
||||
XrInstance instance,
|
||||
XrSystemId systemId,
|
||||
XrGraphicsRequirementsD3D12KHR* graphicsRequirements);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
#endif /* XR_USE_GRAPHICS_API_D3D12 */
|
||||
|
||||
#ifdef XR_USE_PLATFORM_WIN32
|
||||
|
||||
#define XR_KHR_win32_convert_performance_counter_time 1
|
||||
#define XR_KHR_win32_convert_performance_counter_time_SPEC_VERSION 1
|
||||
#define XR_KHR_WIN32_CONVERT_PERFORMANCE_COUNTER_TIME_EXTENSION_NAME "XR_KHR_win32_convert_performance_counter_time"
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrConvertWin32PerformanceCounterToTimeKHR)(XrInstance instance, const LARGE_INTEGER* performanceCounter, XrTime* time);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrConvertTimeToWin32PerformanceCounterKHR)(XrInstance instance, XrTime time, LARGE_INTEGER* performanceCounter);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrConvertWin32PerformanceCounterToTimeKHR(
|
||||
XrInstance instance,
|
||||
const LARGE_INTEGER* performanceCounter,
|
||||
XrTime* time);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrConvertTimeToWin32PerformanceCounterKHR(
|
||||
XrInstance instance,
|
||||
XrTime time,
|
||||
LARGE_INTEGER* performanceCounter);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
#endif /* XR_USE_PLATFORM_WIN32 */
|
||||
|
||||
#ifdef XR_USE_TIMESPEC
|
||||
|
||||
#define XR_KHR_convert_timespec_time 1
|
||||
#define XR_KHR_convert_timespec_time_SPEC_VERSION 1
|
||||
#define XR_KHR_CONVERT_TIMESPEC_TIME_EXTENSION_NAME "XR_KHR_convert_timespec_time"
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrConvertTimespecTimeToTimeKHR)(XrInstance instance, const struct timespec* timespecTime, XrTime* time);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrConvertTimeToTimespecTimeKHR)(XrInstance instance, XrTime time, struct timespec* timespecTime);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrConvertTimespecTimeToTimeKHR(
|
||||
XrInstance instance,
|
||||
const struct timespec* timespecTime,
|
||||
XrTime* time);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrConvertTimeToTimespecTimeKHR(
|
||||
XrInstance instance,
|
||||
XrTime time,
|
||||
struct timespec* timespecTime);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
#endif /* XR_USE_TIMESPEC */
|
||||
|
||||
#ifdef XR_USE_PLATFORM_ANDROID
|
||||
|
||||
#define XR_KHR_loader_init_android 1
|
||||
#define XR_KHR_loader_init_android_SPEC_VERSION 1
|
||||
#define XR_KHR_LOADER_INIT_ANDROID_EXTENSION_NAME "XR_KHR_loader_init_android"
|
||||
typedef struct XrLoaderInitInfoAndroidKHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
void* XR_MAY_ALIAS applicationVM;
|
||||
void* XR_MAY_ALIAS applicationContext;
|
||||
} XrLoaderInitInfoAndroidKHR;
|
||||
|
||||
#endif /* XR_USE_PLATFORM_ANDROID */
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
|
||||
#define XR_KHR_vulkan_enable2 1
|
||||
#define XR_KHR_vulkan_enable2_SPEC_VERSION 2
|
||||
#define XR_KHR_VULKAN_ENABLE2_EXTENSION_NAME "XR_KHR_vulkan_enable2"
|
||||
typedef XrFlags64 XrVulkanInstanceCreateFlagsKHR;
|
||||
|
||||
// Flag bits for XrVulkanInstanceCreateFlagsKHR
|
||||
|
||||
typedef XrFlags64 XrVulkanDeviceCreateFlagsKHR;
|
||||
|
||||
// Flag bits for XrVulkanDeviceCreateFlagsKHR
|
||||
|
||||
typedef struct XrVulkanInstanceCreateInfoKHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
XrSystemId systemId;
|
||||
XrVulkanInstanceCreateFlagsKHR createFlags;
|
||||
PFN_vkGetInstanceProcAddr pfnGetInstanceProcAddr;
|
||||
const VkInstanceCreateInfo* vulkanCreateInfo;
|
||||
const VkAllocationCallbacks* vulkanAllocator;
|
||||
} XrVulkanInstanceCreateInfoKHR;
|
||||
|
||||
typedef struct XrVulkanDeviceCreateInfoKHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
XrSystemId systemId;
|
||||
XrVulkanDeviceCreateFlagsKHR createFlags;
|
||||
PFN_vkGetInstanceProcAddr pfnGetInstanceProcAddr;
|
||||
VkPhysicalDevice vulkanPhysicalDevice;
|
||||
const VkDeviceCreateInfo* vulkanCreateInfo;
|
||||
const VkAllocationCallbacks* vulkanAllocator;
|
||||
} XrVulkanDeviceCreateInfoKHR;
|
||||
|
||||
typedef XrGraphicsBindingVulkanKHR XrGraphicsBindingVulkan2KHR;
|
||||
|
||||
typedef struct XrVulkanGraphicsDeviceGetInfoKHR {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
XrSystemId systemId;
|
||||
VkInstance vulkanInstance;
|
||||
} XrVulkanGraphicsDeviceGetInfoKHR;
|
||||
|
||||
typedef XrSwapchainImageVulkanKHR XrSwapchainImageVulkan2KHR;
|
||||
|
||||
typedef XrGraphicsRequirementsVulkanKHR XrGraphicsRequirementsVulkan2KHR;
|
||||
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrCreateVulkanInstanceKHR)(XrInstance instance, const XrVulkanInstanceCreateInfoKHR* createInfo, VkInstance* vulkanInstance, VkResult* vulkanResult);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrCreateVulkanDeviceKHR)(XrInstance instance, const XrVulkanDeviceCreateInfoKHR* createInfo, VkDevice* vulkanDevice, VkResult* vulkanResult);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetVulkanGraphicsDevice2KHR)(XrInstance instance, const XrVulkanGraphicsDeviceGetInfoKHR* getInfo, VkPhysicalDevice* vulkanPhysicalDevice);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetVulkanGraphicsRequirements2KHR)(XrInstance instance, XrSystemId systemId, XrGraphicsRequirementsVulkanKHR* graphicsRequirements);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrCreateVulkanInstanceKHR(
|
||||
XrInstance instance,
|
||||
const XrVulkanInstanceCreateInfoKHR* createInfo,
|
||||
VkInstance* vulkanInstance,
|
||||
VkResult* vulkanResult);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrCreateVulkanDeviceKHR(
|
||||
XrInstance instance,
|
||||
const XrVulkanDeviceCreateInfoKHR* createInfo,
|
||||
VkDevice* vulkanDevice,
|
||||
VkResult* vulkanResult);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanGraphicsDevice2KHR(
|
||||
XrInstance instance,
|
||||
const XrVulkanGraphicsDeviceGetInfoKHR* getInfo,
|
||||
VkPhysicalDevice* vulkanPhysicalDevice);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanGraphicsRequirements2KHR(
|
||||
XrInstance instance,
|
||||
XrSystemId systemId,
|
||||
XrGraphicsRequirementsVulkanKHR* graphicsRequirements);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
#endif /* XR_USE_GRAPHICS_API_VULKAN */
|
||||
|
||||
#ifdef XR_USE_PLATFORM_EGL
|
||||
|
||||
#define XR_MNDX_egl_enable 1
|
||||
#define XR_MNDX_egl_enable_SPEC_VERSION 1
|
||||
#define XR_MNDX_EGL_ENABLE_EXTENSION_NAME "XR_MNDX_egl_enable"
|
||||
// XrGraphicsBindingEGLMNDX extends XrSessionCreateInfo
|
||||
typedef struct XrGraphicsBindingEGLMNDX {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
PFNEGLGETPROCADDRESSPROC getProcAddress;
|
||||
EGLDisplay display;
|
||||
EGLConfig config;
|
||||
EGLContext context;
|
||||
} XrGraphicsBindingEGLMNDX;
|
||||
|
||||
#endif /* XR_USE_PLATFORM_EGL */
|
||||
|
||||
#ifdef XR_USE_PLATFORM_WIN32
|
||||
|
||||
#define XR_MSFT_perception_anchor_interop 1
|
||||
#define XR_MSFT_perception_anchor_interop_SPEC_VERSION 1
|
||||
#define XR_MSFT_PERCEPTION_ANCHOR_INTEROP_EXTENSION_NAME "XR_MSFT_perception_anchor_interop"
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrCreateSpatialAnchorFromPerceptionAnchorMSFT)(XrSession session, IUnknown* perceptionAnchor, XrSpatialAnchorMSFT* anchor);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrTryGetPerceptionAnchorFromSpatialAnchorMSFT)(XrSession session, XrSpatialAnchorMSFT anchor, IUnknown** perceptionAnchor);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrCreateSpatialAnchorFromPerceptionAnchorMSFT(
|
||||
XrSession session,
|
||||
IUnknown* perceptionAnchor,
|
||||
XrSpatialAnchorMSFT* anchor);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrTryGetPerceptionAnchorFromSpatialAnchorMSFT(
|
||||
XrSession session,
|
||||
XrSpatialAnchorMSFT anchor,
|
||||
IUnknown** perceptionAnchor);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
#endif /* XR_USE_PLATFORM_WIN32 */
|
||||
|
||||
#ifdef XR_USE_PLATFORM_WIN32
|
||||
|
||||
#define XR_MSFT_holographic_window_attachment 1
|
||||
#define XR_MSFT_holographic_window_attachment_SPEC_VERSION 1
|
||||
#define XR_MSFT_HOLOGRAPHIC_WINDOW_ATTACHMENT_EXTENSION_NAME "XR_MSFT_holographic_window_attachment"
|
||||
#ifdef XR_USE_PLATFORM_WIN32
|
||||
// XrHolographicWindowAttachmentMSFT extends XrSessionCreateInfo
|
||||
typedef struct XrHolographicWindowAttachmentMSFT {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
IUnknown* holographicSpace;
|
||||
IUnknown* coreWindow;
|
||||
} XrHolographicWindowAttachmentMSFT;
|
||||
#endif // XR_USE_PLATFORM_WIN32
|
||||
|
||||
#endif /* XR_USE_PLATFORM_WIN32 */
|
||||
|
||||
#ifdef XR_USE_PLATFORM_ANDROID
|
||||
|
||||
#define XR_FB_android_surface_swapchain_create 1
|
||||
#define XR_FB_android_surface_swapchain_create_SPEC_VERSION 1
|
||||
#define XR_FB_ANDROID_SURFACE_SWAPCHAIN_CREATE_EXTENSION_NAME "XR_FB_android_surface_swapchain_create"
|
||||
typedef XrFlags64 XrAndroidSurfaceSwapchainFlagsFB;
|
||||
|
||||
// Flag bits for XrAndroidSurfaceSwapchainFlagsFB
|
||||
static const XrAndroidSurfaceSwapchainFlagsFB XR_ANDROID_SURFACE_SWAPCHAIN_SYNCHRONOUS_BIT_FB = 0x00000001;
|
||||
static const XrAndroidSurfaceSwapchainFlagsFB XR_ANDROID_SURFACE_SWAPCHAIN_USE_TIMESTAMPS_BIT_FB = 0x00000002;
|
||||
|
||||
#ifdef XR_USE_PLATFORM_ANDROID
|
||||
// XrAndroidSurfaceSwapchainCreateInfoFB extends XrSwapchainCreateInfo
|
||||
typedef struct XrAndroidSurfaceSwapchainCreateInfoFB {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
XrAndroidSurfaceSwapchainFlagsFB createFlags;
|
||||
} XrAndroidSurfaceSwapchainCreateInfoFB;
|
||||
#endif // XR_USE_PLATFORM_ANDROID
|
||||
|
||||
#endif /* XR_USE_PLATFORM_ANDROID */
|
||||
|
||||
#ifdef XR_USE_PLATFORM_WIN32
|
||||
|
||||
#define XR_OCULUS_audio_device_guid 1
|
||||
#define XR_OCULUS_audio_device_guid_SPEC_VERSION 1
|
||||
#define XR_OCULUS_AUDIO_DEVICE_GUID_EXTENSION_NAME "XR_OCULUS_audio_device_guid"
|
||||
#define XR_MAX_AUDIO_DEVICE_STR_SIZE_OCULUS 128
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetAudioOutputDeviceGuidOculus)(XrInstance instance, wchar_t buffer[XR_MAX_AUDIO_DEVICE_STR_SIZE_OCULUS]);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetAudioInputDeviceGuidOculus)(XrInstance instance, wchar_t buffer[XR_MAX_AUDIO_DEVICE_STR_SIZE_OCULUS]);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
#ifdef XR_EXTENSION_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetAudioOutputDeviceGuidOculus(
|
||||
XrInstance instance,
|
||||
wchar_t buffer[XR_MAX_AUDIO_DEVICE_STR_SIZE_OCULUS]);
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetAudioInputDeviceGuidOculus(
|
||||
XrInstance instance,
|
||||
wchar_t buffer[XR_MAX_AUDIO_DEVICE_STR_SIZE_OCULUS]);
|
||||
#endif /* XR_EXTENSION_PROTOTYPES */
|
||||
#endif /* !XR_NO_PROTOTYPES */
|
||||
#endif /* XR_USE_PLATFORM_WIN32 */
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
|
||||
#define XR_FB_foveation_vulkan 1
|
||||
#define XR_FB_foveation_vulkan_SPEC_VERSION 1
|
||||
#define XR_FB_FOVEATION_VULKAN_EXTENSION_NAME "XR_FB_foveation_vulkan"
|
||||
// XrSwapchainImageFoveationVulkanFB extends XrSwapchainImageVulkanKHR
|
||||
typedef struct XrSwapchainImageFoveationVulkanFB {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
VkImage image;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
} XrSwapchainImageFoveationVulkanFB;
|
||||
|
||||
#endif /* XR_USE_GRAPHICS_API_VULKAN */
|
||||
|
||||
#ifdef XR_USE_PLATFORM_ANDROID
|
||||
|
||||
#define XR_FB_swapchain_update_state_android_surface 1
|
||||
#define XR_FB_swapchain_update_state_android_surface_SPEC_VERSION 1
|
||||
#define XR_FB_SWAPCHAIN_UPDATE_STATE_ANDROID_SURFACE_EXTENSION_NAME "XR_FB_swapchain_update_state_android_surface"
|
||||
#ifdef XR_USE_PLATFORM_ANDROID
|
||||
typedef struct XrSwapchainStateAndroidSurfaceDimensionsFB {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
} XrSwapchainStateAndroidSurfaceDimensionsFB;
|
||||
#endif // XR_USE_PLATFORM_ANDROID
|
||||
|
||||
#endif /* XR_USE_PLATFORM_ANDROID */
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
|
||||
#define XR_FB_swapchain_update_state_opengl_es 1
|
||||
#define XR_FB_swapchain_update_state_opengl_es_SPEC_VERSION 1
|
||||
#define XR_FB_SWAPCHAIN_UPDATE_STATE_OPENGL_ES_EXTENSION_NAME "XR_FB_swapchain_update_state_opengl_es"
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
typedef struct XrSwapchainStateSamplerOpenGLESFB {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
EGLenum minFilter;
|
||||
EGLenum magFilter;
|
||||
EGLenum wrapModeS;
|
||||
EGLenum wrapModeT;
|
||||
EGLenum swizzleRed;
|
||||
EGLenum swizzleGreen;
|
||||
EGLenum swizzleBlue;
|
||||
EGLenum swizzleAlpha;
|
||||
float maxAnisotropy;
|
||||
XrColor4f borderColor;
|
||||
} XrSwapchainStateSamplerOpenGLESFB;
|
||||
#endif // XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
|
||||
#endif /* XR_USE_GRAPHICS_API_OPENGL_ES */
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
|
||||
#define XR_FB_swapchain_update_state_vulkan 1
|
||||
#define XR_FB_swapchain_update_state_vulkan_SPEC_VERSION 1
|
||||
#define XR_FB_SWAPCHAIN_UPDATE_STATE_VULKAN_EXTENSION_NAME "XR_FB_swapchain_update_state_vulkan"
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
typedef struct XrSwapchainStateSamplerVulkanFB {
|
||||
XrStructureType type;
|
||||
void* XR_MAY_ALIAS next;
|
||||
VkFilter minFilter;
|
||||
VkFilter magFilter;
|
||||
VkSamplerMipmapMode mipmapMode;
|
||||
VkSamplerAddressMode wrapModeS;
|
||||
VkSamplerAddressMode wrapModeT;
|
||||
VkComponentSwizzle swizzleRed;
|
||||
VkComponentSwizzle swizzleGreen;
|
||||
VkComponentSwizzle swizzleBlue;
|
||||
VkComponentSwizzle swizzleAlpha;
|
||||
float maxAnisotropy;
|
||||
XrColor4f borderColor;
|
||||
} XrSwapchainStateSamplerVulkanFB;
|
||||
#endif // XR_USE_GRAPHICS_API_VULKAN
|
||||
|
||||
#endif /* XR_USE_GRAPHICS_API_VULKAN */
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
|
||||
#define XR_META_vulkan_swapchain_create_info 1
|
||||
#define XR_META_vulkan_swapchain_create_info_SPEC_VERSION 1
|
||||
#define XR_META_VULKAN_SWAPCHAIN_CREATE_INFO_EXTENSION_NAME "XR_META_vulkan_swapchain_create_info"
|
||||
// XrVulkanSwapchainCreateInfoMETA extends XrSwapchainCreateInfo
|
||||
typedef struct XrVulkanSwapchainCreateInfoMETA {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
VkImageCreateFlags additionalCreateFlags;
|
||||
VkImageUsageFlags additionalUsageFlags;
|
||||
} XrVulkanSwapchainCreateInfoMETA;
|
||||
|
||||
#endif /* XR_USE_GRAPHICS_API_VULKAN */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
** Copyright (c) 2017-2022, The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*/
|
||||
|
||||
#ifndef OPENXR_PLATFORM_DEFINES_H_
|
||||
#define OPENXR_PLATFORM_DEFINES_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Platform-specific calling convention macros.
|
||||
*
|
||||
* Platforms should define these so that OpenXR clients call OpenXR functions
|
||||
* with the same calling conventions that the OpenXR implementation expects.
|
||||
*
|
||||
* XRAPI_ATTR - Placed before the return type in function declarations.
|
||||
* Useful for C++11 and GCC/Clang-style function attribute syntax.
|
||||
* XRAPI_CALL - Placed after the return type in function declarations.
|
||||
* Useful for MSVC-style calling convention syntax.
|
||||
* XRAPI_PTR - Placed between the '(' and '*' in function pointer types.
|
||||
*
|
||||
* Function declaration: XRAPI_ATTR void XRAPI_CALL xrFunction(void);
|
||||
* Function pointer type: typedef void (XRAPI_PTR *PFN_xrFunction)(void);
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
#define XRAPI_ATTR
|
||||
// On Windows, functions use the stdcall convention
|
||||
#define XRAPI_CALL __stdcall
|
||||
#define XRAPI_PTR XRAPI_CALL
|
||||
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
|
||||
#error "API not supported for the 'armeabi' NDK ABI"
|
||||
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
|
||||
// On Android 32-bit ARM targets, functions use the "hardfloat"
|
||||
// calling convention, i.e. float parameters are passed in registers. This
|
||||
// is true even if the rest of the application passes floats on the stack,
|
||||
// as it does by default when compiling for the armeabi-v7a NDK ABI.
|
||||
#define XRAPI_ATTR __attribute__((pcs("aapcs-vfp")))
|
||||
#define XRAPI_CALL
|
||||
#define XRAPI_PTR XRAPI_ATTR
|
||||
#else
|
||||
// On other platforms, use the default calling convention
|
||||
#define XRAPI_ATTR
|
||||
#define XRAPI_CALL
|
||||
#define XRAPI_PTR
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if !defined(XR_NO_STDINT_H)
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
typedef signed __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif // !defined( XR_NO_STDINT_H )
|
||||
|
||||
// XR_PTR_SIZE (in bytes)
|
||||
#if (defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__))
|
||||
#define XR_PTR_SIZE 8
|
||||
#else
|
||||
#define XR_PTR_SIZE 4
|
||||
#endif
|
||||
|
||||
// Needed so we can use clang __has_feature portably.
|
||||
#if !defined(XR_COMPILER_HAS_FEATURE)
|
||||
#if defined(__clang__)
|
||||
#define XR_COMPILER_HAS_FEATURE(x) __has_feature(x)
|
||||
#else
|
||||
#define XR_COMPILER_HAS_FEATURE(x) 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Identifies if the current compiler has C++11 support enabled.
|
||||
// Does not by itself identify if any given C++11 feature is present.
|
||||
#if !defined(XR_CPP11_ENABLED) && defined(__cplusplus)
|
||||
#if defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
#define XR_CPP11_ENABLED 1
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1600)
|
||||
#define XR_CPP11_ENABLED 1
|
||||
#elif (__cplusplus >= 201103L) // 201103 is the first C++11 version.
|
||||
#define XR_CPP11_ENABLED 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Identifies if the current compiler supports C++11 nullptr.
|
||||
#if !defined(XR_CPP_NULLPTR_SUPPORTED)
|
||||
#if defined(XR_CPP11_ENABLED) && \
|
||||
((defined(__clang__) && XR_COMPILER_HAS_FEATURE(cxx_nullptr)) || \
|
||||
(defined(__GNUC__) && (((__GNUC__ * 1000) + __GNUC_MINOR__) >= 4006)) || \
|
||||
(defined(_MSC_VER) && (_MSC_VER >= 1600)) || \
|
||||
(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403)))
|
||||
#define XR_CPP_NULLPTR_SUPPORTED 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
3158
Projects/Android/jni/OpenXR-SDK/include/openxr/openxr_reflection.h
Normal file
3158
Projects/Android/jni/OpenXR-SDK/include/openxr/openxr_reflection.h
Normal file
File diff suppressed because it is too large
Load diff
113
Projects/Android/jni/OpenXR-SDK/src/common/openxr_helpers.h
Normal file
113
Projects/Android/jni/OpenXR-SDK/src/common/openxr_helpers.h
Normal file
|
@ -0,0 +1,113 @@
|
|||
#ifndef OPENXR_HELPERS_H_
|
||||
#define OPENXR_HELPERS_H_
|
||||
|
||||
#include <xr_linear.h>
|
||||
|
||||
static inline XrTime ToXrTime(const double timeInSeconds) {
|
||||
return (timeInSeconds * 1e9);
|
||||
}
|
||||
|
||||
static inline double FromXrTime(const XrTime time) {
|
||||
return (time * 1e-9);
|
||||
}
|
||||
|
||||
static inline XrQuaternionf XrQuaternionf_Identity() {
|
||||
XrQuaternionf r;
|
||||
r.x = r.y = r.z = 0.0;
|
||||
r.w = 1.0f;
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline XrVector3f XrVector3f_Zero() {
|
||||
XrVector3f r;
|
||||
r.x = r.y = r.z = 0.0f;
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline float XrVector3f_LengthSquared(const XrVector3f v) {
|
||||
return XrVector3f_Dot(&v, &v);
|
||||
}
|
||||
|
||||
static inline XrVector3f XrVector3f_ScalarMultiply(const XrVector3f v, float scale) {
|
||||
XrVector3f u;
|
||||
u.x = v.x * scale;
|
||||
u.y = v.y * scale;
|
||||
u.z = v.z * scale;
|
||||
return u;
|
||||
}
|
||||
|
||||
static inline XrVector3f XrVector3f_Normalized(const XrVector3f v) {
|
||||
float rcpLen = 1.0f / XrVector3f_Length(&v);
|
||||
return XrVector3f_ScalarMultiply(v, rcpLen);
|
||||
}
|
||||
|
||||
static inline XrQuaternionf XrQuaternionf_Inverse(const XrQuaternionf q) {
|
||||
XrQuaternionf r;
|
||||
r.x = -q.x;
|
||||
r.y = -q.y;
|
||||
r.z = -q.z;
|
||||
r.w = q.w;
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline XrVector3f XrQuaternionf_Rotate(const XrQuaternionf a, const XrVector3f v) {
|
||||
XrVector3f r;
|
||||
XrQuaternionf q = {v.x, v.y, v.z, 0.0f};
|
||||
XrQuaternionf aq;
|
||||
XrQuaternionf_Multiply(&aq, &q, &a);
|
||||
XrQuaternionf aInv = XrQuaternionf_Inverse(a);
|
||||
XrQuaternionf aqaInv;
|
||||
XrQuaternionf_Multiply(&aqaInv, &aInv, &aq);
|
||||
r.x = aqaInv.x;
|
||||
r.y = aqaInv.y;
|
||||
r.z = aqaInv.z;
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline XrQuaternionf XrQuaternionf_CreateFromVectorAngle(
|
||||
const XrVector3f axis,
|
||||
const float angle) {
|
||||
XrQuaternionf r;
|
||||
if (XrVector3f_LengthSquared(axis) == 0.0f) {
|
||||
return XrQuaternionf_Identity();
|
||||
}
|
||||
|
||||
XrVector3f unitAxis = XrVector3f_Normalized(axis);
|
||||
float sinHalfAngle = sinf(angle * 0.5f);
|
||||
|
||||
r.w = cosf(angle * 0.5f);
|
||||
r.x = unitAxis.x * sinHalfAngle;
|
||||
r.y = unitAxis.y * sinHalfAngle;
|
||||
r.z = unitAxis.z * sinHalfAngle;
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline XrPosef XrPosef_Identity() {
|
||||
XrPosef r;
|
||||
r.orientation = XrQuaternionf_Identity();
|
||||
r.position = XrVector3f_Zero();
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline XrPosef XrPosef_Inverse(const XrPosef a) {
|
||||
XrPosef b;
|
||||
b.orientation = XrQuaternionf_Inverse(a.orientation);
|
||||
b.position = XrQuaternionf_Rotate(b.orientation, XrVector3f_ScalarMultiply(a.position, -1.0f));
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline XrVector3f XrPosef_Transform(const XrPosef a, const XrVector3f v) {
|
||||
XrVector3f r0 = XrQuaternionf_Rotate(a.orientation, v);
|
||||
XrVector3f result;
|
||||
XrVector3f_Add(&result, &r0, &a.position);
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline XrPosef XrPosef_Multiply(const XrPosef a, const XrPosef b) {
|
||||
XrPosef c;
|
||||
XrQuaternionf_Multiply(&c.orientation, &b.orientation, &a.orientation);
|
||||
c.position = XrPosef_Transform(a, b.position);
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif //OPENXR_HELPERS_H_
|
787
Projects/Android/jni/OpenXR-SDK/src/common/xr_linear.h
Normal file
787
Projects/Android/jni/OpenXR-SDK/src/common/xr_linear.h
Normal file
|
@ -0,0 +1,787 @@
|
|||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
// Copyright (c) 2016 Oculus VR, LLC.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Author: J.M.P. van Waveren
|
||||
//
|
||||
|
||||
#ifndef XR_LINEAR_H_
|
||||
#define XR_LINEAR_H_
|
||||
|
||||
#if defined(OS_LINUX_XCB) || defined(OS_LINUX_XCB_GLX) || defined(OS_LINUX_WAYLAND)
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
|
||||
Description : Vector, matrix and quaternion math.
|
||||
Author : J.M.P. van Waveren
|
||||
Date : 12/10/2016
|
||||
Language : C99
|
||||
Format : Indent 4 spaces - no tabs.
|
||||
Copyright : Copyright (c) 2016 Oculus VR, LLC. All Rights reserved.
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
===========
|
||||
|
||||
All matrices are column-major.
|
||||
|
||||
INTERFACE
|
||||
=========
|
||||
|
||||
XrVector2f
|
||||
XrVector3f
|
||||
XrVector4f
|
||||
XrQuaternionf
|
||||
XrMatrix4x4f
|
||||
|
||||
inline static void XrVector3f_Set(XrVector3f* v, const float value);
|
||||
inline static void XrVector3f_Add(XrVector3f* result, const XrVector3f* a, const XrVector3f* b);
|
||||
inline static void XrVector3f_Sub(XrVector3f* result, const XrVector3f* a, const XrVector3f* b);
|
||||
inline static void XrVector3f_Min(XrVector3f* result, const XrVector3f* a, const XrVector3f* b);
|
||||
inline static void XrVector3f_Max(XrVector3f* result, const XrVector3f* a, const XrVector3f* b);
|
||||
inline static void XrVector3f_Decay(XrVector3f* result, const XrVector3f* a, const float value);
|
||||
inline static void XrVector3f_Lerp(XrVector3f* result, const XrVector3f* a, const XrVector3f* b, const float fraction);
|
||||
inline static void XrVector3f_Scale(XrVector3f* result, const XrVector3f* a, const float scaleFactor);
|
||||
inline static void XrVector3f_Normalize(XrVector3f* v);
|
||||
inline static float XrVector3f_Length(const XrVector3f* v);
|
||||
|
||||
inline static void XrQuaternionf_Lerp(XrQuaternionf* result, const XrQuaternionf* a, const XrQuaternionf* b, const float fraction);
|
||||
inline static void XrQuaternionf_Multiply(XrQuaternionf* result, const XrQuaternionf* a, const XrQuaternionf* b;
|
||||
|
||||
inline static void XrMatrix4x4f_CreateIdentity(XrMatrix4x4f* result);
|
||||
inline static void XrMatrix4x4f_CreateTranslation(XrMatrix4x4f* result, const float x, const float y, const float z);
|
||||
inline static void XrMatrix4x4f_CreateRotation(XrMatrix4x4f* result, const float degreesX, const float degreesY,
|
||||
const float degreesZ);
|
||||
inline static void XrMatrix4x4f_CreateScale(XrMatrix4x4f* result, const float x, const float y, const float z);
|
||||
inline static void XrMatrix4x4f_CreateTranslationRotationScale(XrMatrix4x4f* result, const XrVector3f* translation,
|
||||
const XrQuaternionf* rotation, const XrVector3f* scale);
|
||||
inline static void XrMatrix4x4f_CreateProjection(XrMatrix4x4f* result, const float tanAngleLeft, const float tanAngleRight,
|
||||
const float tanAngleUp, float const tanAngleDown, const float nearZ,
|
||||
const float farZ);
|
||||
inline static void XrMatrix4x4f_CreateProjectionFov(XrMatrix4x4f* result, const float fovDegreesLeft, const float fovDegreesRight,
|
||||
const float fovDegreeUp, const float fovDegreesDown, const float nearZ,
|
||||
const float farZ);
|
||||
inline static void XrMatrix4x4f_CreateFromQuaternion(XrMatrix4x4f* result, const XrQuaternionf* src);
|
||||
inline static void XrMatrix4x4f_CreateOffsetScaleForBounds(XrMatrix4x4f* result, const XrMatrix4x4f* matrix, const XrVector3f* mins,
|
||||
const XrVector3f* maxs);
|
||||
|
||||
inline static bool XrMatrix4x4f_IsAffine(const XrMatrix4x4f* matrix, const float epsilon);
|
||||
inline static bool XrMatrix4x4f_IsOrthogonal(const XrMatrix4x4f* matrix, const float epsilon);
|
||||
inline static bool XrMatrix4x4f_IsOrthonormal(const XrMatrix4x4f* matrix, const float epsilon);
|
||||
inline static bool XrMatrix4x4f_IsRigidBody(const XrMatrix4x4f* matrix, const float epsilon);
|
||||
|
||||
inline static void XrMatrix4x4f_GetTranslation(XrVector3f* result, const XrMatrix4x4f* src);
|
||||
inline static void XrMatrix4x4f_GetRotation(XrQuaternionf* result, const XrMatrix4x4f* src);
|
||||
inline static void XrMatrix4x4f_GetScale(XrVector3f* result, const XrMatrix4x4f* src);
|
||||
|
||||
inline static void XrMatrix4x4f_Multiply(XrMatrix4x4f* result, const XrMatrix4x4f* a, const XrMatrix4x4f* b);
|
||||
inline static void XrMatrix4x4f_Transpose(XrMatrix4x4f* result, const XrMatrix4x4f* src);
|
||||
inline static void XrMatrix4x4f_Invert(XrMatrix4x4f* result, const XrMatrix4x4f* src);
|
||||
inline static void XrMatrix4x4f_InvertRigidBody(XrMatrix4x4f* result, const XrMatrix4x4f* src);
|
||||
|
||||
inline static void XrMatrix4x4f_TransformVector3f(XrVector3f* result, const XrMatrix4x4f* m, const XrVector3f* v);
|
||||
inline static void XrMatrix4x4f_TransformVector4f(XrVector4f* result, const XrMatrix4x4f* m, const XrVector4f* v);
|
||||
|
||||
inline static void XrMatrix4x4f_TransformBounds(XrVector3f* resultMins, XrVector3f* resultMaxs, const XrMatrix4x4f* matrix,
|
||||
const XrVector3f* mins, const XrVector3f* maxs);
|
||||
inline static bool XrMatrix4x4f_CullBounds(const XrMatrix4x4f* mvp, const XrVector3f* mins, const XrVector3f* maxs);
|
||||
|
||||
================================================================================================
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define MATH_PI 3.14159265358979323846f
|
||||
|
||||
#define DEFAULT_NEAR_Z 0.015625f // exact floating point representation
|
||||
#define INFINITE_FAR_Z 0.0f
|
||||
|
||||
static const XrColor4f XrColorRed = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
static const XrColor4f XrColorGreen = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||
static const XrColor4f XrColorBlue = {0.0f, 0.0f, 1.0f, 1.0f};
|
||||
static const XrColor4f XrColorYellow = {1.0f, 1.0f, 0.0f, 1.0f};
|
||||
static const XrColor4f XrColorPurple = {1.0f, 0.0f, 1.0f, 1.0f};
|
||||
static const XrColor4f XrColorCyan = {0.0f, 1.0f, 1.0f, 1.0f};
|
||||
static const XrColor4f XrColorLightGrey = {0.7f, 0.7f, 0.7f, 1.0f};
|
||||
static const XrColor4f XrColorDarkGrey = {0.3f, 0.3f, 0.3f, 1.0f};
|
||||
|
||||
typedef enum GraphicsAPI { GRAPHICS_VULKAN, GRAPHICS_OPENGL, GRAPHICS_OPENGL_ES, GRAPHICS_D3D } GraphicsAPI;
|
||||
|
||||
// Column-major, pre-multiplied. This type does not exist in the OpenXR API and is provided for convenience.
|
||||
typedef struct XrMatrix4x4f {
|
||||
float m[16];
|
||||
} XrMatrix4x4f;
|
||||
|
||||
inline static float XrRcpSqrt(const float x) {
|
||||
const float SMALLEST_NON_DENORMAL = 1.1754943508222875e-038f; // ( 1U << 23 )
|
||||
const float rcp = (x >= SMALLEST_NON_DENORMAL) ? 1.0f / sqrtf(x) : 1.0f;
|
||||
return rcp;
|
||||
}
|
||||
|
||||
inline static void XrVector3f_Set(XrVector3f* v, const float value) {
|
||||
v->x = value;
|
||||
v->y = value;
|
||||
v->z = value;
|
||||
}
|
||||
|
||||
inline static void XrVector3f_Add(XrVector3f* result, const XrVector3f* a, const XrVector3f* b) {
|
||||
result->x = a->x + b->x;
|
||||
result->y = a->y + b->y;
|
||||
result->z = a->z + b->z;
|
||||
}
|
||||
|
||||
inline static void XrVector3f_Sub(XrVector3f* result, const XrVector3f* a, const XrVector3f* b) {
|
||||
result->x = a->x - b->x;
|
||||
result->y = a->y - b->y;
|
||||
result->z = a->z - b->z;
|
||||
}
|
||||
|
||||
inline static void XrVector3f_Min(XrVector3f* result, const XrVector3f* a, const XrVector3f* b) {
|
||||
result->x = (a->x < b->x) ? a->x : b->x;
|
||||
result->y = (a->y < b->y) ? a->y : b->y;
|
||||
result->z = (a->z < b->z) ? a->z : b->z;
|
||||
}
|
||||
|
||||
inline static void XrVector3f_Max(XrVector3f* result, const XrVector3f* a, const XrVector3f* b) {
|
||||
result->x = (a->x > b->x) ? a->x : b->x;
|
||||
result->y = (a->y > b->y) ? a->y : b->y;
|
||||
result->z = (a->z > b->z) ? a->z : b->z;
|
||||
}
|
||||
|
||||
inline static void XrVector3f_Decay(XrVector3f* result, const XrVector3f* a, const float value) {
|
||||
result->x = (fabsf(a->x) > value) ? ((a->x > 0.0f) ? (a->x - value) : (a->x + value)) : 0.0f;
|
||||
result->y = (fabsf(a->y) > value) ? ((a->y > 0.0f) ? (a->y - value) : (a->y + value)) : 0.0f;
|
||||
result->z = (fabsf(a->z) > value) ? ((a->z > 0.0f) ? (a->z - value) : (a->z + value)) : 0.0f;
|
||||
}
|
||||
|
||||
inline static void XrVector3f_Lerp(XrVector3f* result, const XrVector3f* a, const XrVector3f* b, const float fraction) {
|
||||
result->x = a->x + fraction * (b->x - a->x);
|
||||
result->y = a->y + fraction * (b->y - a->y);
|
||||
result->z = a->z + fraction * (b->z - a->z);
|
||||
}
|
||||
|
||||
inline static void XrVector3f_Scale(XrVector3f* result, const XrVector3f* a, const float scaleFactor) {
|
||||
result->x = a->x * scaleFactor;
|
||||
result->y = a->y * scaleFactor;
|
||||
result->z = a->z * scaleFactor;
|
||||
}
|
||||
|
||||
inline static float XrVector3f_Dot(const XrVector3f* a, const XrVector3f* b) { return a->x * b->x + a->y * b->y + a->z * b->z; }
|
||||
|
||||
// Compute cross product, which generates a normal vector.
|
||||
// Direction vector can be determined by right-hand rule: Pointing index finder in
|
||||
// direction a and middle finger in direction b, thumb will point in Cross(a, b).
|
||||
inline static void XrVector3f_Cross(XrVector3f* result, const XrVector3f* a, const XrVector3f* b) {
|
||||
result->x = a->y * b->z - a->z * b->y;
|
||||
result->y = a->z * b->x - a->x * b->z;
|
||||
result->z = a->x * b->y - a->y * b->x;
|
||||
}
|
||||
|
||||
inline static void XrVector3f_Normalize(XrVector3f* v) {
|
||||
const float lengthRcp = XrRcpSqrt(v->x * v->x + v->y * v->y + v->z * v->z);
|
||||
v->x *= lengthRcp;
|
||||
v->y *= lengthRcp;
|
||||
v->z *= lengthRcp;
|
||||
}
|
||||
|
||||
inline static float XrVector3f_Length(const XrVector3f* v) { return sqrtf(v->x * v->x + v->y * v->y + v->z * v->z); }
|
||||
|
||||
inline static void XrQuaternionf_CreateFromAxisAngle(XrQuaternionf* result, const XrVector3f* axis, const float angleInRadians) {
|
||||
float s = sinf(angleInRadians / 2.0f);
|
||||
float lengthRcp = XrRcpSqrt(axis->x * axis->x + axis->y * axis->y + axis->z * axis->z);
|
||||
result->x = s * axis->x * lengthRcp;
|
||||
result->y = s * axis->y * lengthRcp;
|
||||
result->z = s * axis->z * lengthRcp;
|
||||
result->w = cosf(angleInRadians / 2.0f);
|
||||
}
|
||||
|
||||
inline static void XrQuaternionf_Lerp(XrQuaternionf* result, const XrQuaternionf* a, const XrQuaternionf* b, const float fraction) {
|
||||
const float s = a->x * b->x + a->y * b->y + a->z * b->z + a->w * b->w;
|
||||
const float fa = 1.0f - fraction;
|
||||
const float fb = (s < 0.0f) ? -fraction : fraction;
|
||||
const float x = a->x * fa + b->x * fb;
|
||||
const float y = a->y * fa + b->y * fb;
|
||||
const float z = a->z * fa + b->z * fb;
|
||||
const float w = a->w * fa + b->w * fb;
|
||||
const float lengthRcp = XrRcpSqrt(x * x + y * y + z * z + w * w);
|
||||
result->x = x * lengthRcp;
|
||||
result->y = y * lengthRcp;
|
||||
result->z = z * lengthRcp;
|
||||
result->w = w * lengthRcp;
|
||||
}
|
||||
|
||||
inline static void XrQuaternionf_Multiply(XrQuaternionf* result, const XrQuaternionf* a, const XrQuaternionf* b) {
|
||||
result->x = (b->w * a->x) + (b->x * a->w) + (b->y * a->z) - (b->z * a->y);
|
||||
result->y = (b->w * a->y) - (b->x * a->z) + (b->y * a->w) + (b->z * a->x);
|
||||
result->z = (b->w * a->z) + (b->x * a->y) - (b->y * a->x) + (b->z * a->w);
|
||||
result->w = (b->w * a->w) - (b->x * a->x) - (b->y * a->y) - (b->z * a->z);
|
||||
}
|
||||
|
||||
// Use left-multiplication to accumulate transformations.
|
||||
inline static void XrMatrix4x4f_Multiply(XrMatrix4x4f* result, const XrMatrix4x4f* a, const XrMatrix4x4f* b) {
|
||||
result->m[0] = a->m[0] * b->m[0] + a->m[4] * b->m[1] + a->m[8] * b->m[2] + a->m[12] * b->m[3];
|
||||
result->m[1] = a->m[1] * b->m[0] + a->m[5] * b->m[1] + a->m[9] * b->m[2] + a->m[13] * b->m[3];
|
||||
result->m[2] = a->m[2] * b->m[0] + a->m[6] * b->m[1] + a->m[10] * b->m[2] + a->m[14] * b->m[3];
|
||||
result->m[3] = a->m[3] * b->m[0] + a->m[7] * b->m[1] + a->m[11] * b->m[2] + a->m[15] * b->m[3];
|
||||
|
||||
result->m[4] = a->m[0] * b->m[4] + a->m[4] * b->m[5] + a->m[8] * b->m[6] + a->m[12] * b->m[7];
|
||||
result->m[5] = a->m[1] * b->m[4] + a->m[5] * b->m[5] + a->m[9] * b->m[6] + a->m[13] * b->m[7];
|
||||
result->m[6] = a->m[2] * b->m[4] + a->m[6] * b->m[5] + a->m[10] * b->m[6] + a->m[14] * b->m[7];
|
||||
result->m[7] = a->m[3] * b->m[4] + a->m[7] * b->m[5] + a->m[11] * b->m[6] + a->m[15] * b->m[7];
|
||||
|
||||
result->m[8] = a->m[0] * b->m[8] + a->m[4] * b->m[9] + a->m[8] * b->m[10] + a->m[12] * b->m[11];
|
||||
result->m[9] = a->m[1] * b->m[8] + a->m[5] * b->m[9] + a->m[9] * b->m[10] + a->m[13] * b->m[11];
|
||||
result->m[10] = a->m[2] * b->m[8] + a->m[6] * b->m[9] + a->m[10] * b->m[10] + a->m[14] * b->m[11];
|
||||
result->m[11] = a->m[3] * b->m[8] + a->m[7] * b->m[9] + a->m[11] * b->m[10] + a->m[15] * b->m[11];
|
||||
|
||||
result->m[12] = a->m[0] * b->m[12] + a->m[4] * b->m[13] + a->m[8] * b->m[14] + a->m[12] * b->m[15];
|
||||
result->m[13] = a->m[1] * b->m[12] + a->m[5] * b->m[13] + a->m[9] * b->m[14] + a->m[13] * b->m[15];
|
||||
result->m[14] = a->m[2] * b->m[12] + a->m[6] * b->m[13] + a->m[10] * b->m[14] + a->m[14] * b->m[15];
|
||||
result->m[15] = a->m[3] * b->m[12] + a->m[7] * b->m[13] + a->m[11] * b->m[14] + a->m[15] * b->m[15];
|
||||
}
|
||||
|
||||
// Creates the transpose of the given matrix.
|
||||
inline static void XrMatrix4x4f_Transpose(XrMatrix4x4f* result, const XrMatrix4x4f* src) {
|
||||
result->m[0] = src->m[0];
|
||||
result->m[1] = src->m[4];
|
||||
result->m[2] = src->m[8];
|
||||
result->m[3] = src->m[12];
|
||||
|
||||
result->m[4] = src->m[1];
|
||||
result->m[5] = src->m[5];
|
||||
result->m[6] = src->m[9];
|
||||
result->m[7] = src->m[13];
|
||||
|
||||
result->m[8] = src->m[2];
|
||||
result->m[9] = src->m[6];
|
||||
result->m[10] = src->m[10];
|
||||
result->m[11] = src->m[14];
|
||||
|
||||
result->m[12] = src->m[3];
|
||||
result->m[13] = src->m[7];
|
||||
result->m[14] = src->m[11];
|
||||
result->m[15] = src->m[15];
|
||||
}
|
||||
|
||||
// Returns a 3x3 minor of a 4x4 matrix.
|
||||
inline static float XrMatrix4x4f_Minor(const XrMatrix4x4f* matrix, int r0, int r1, int r2, int c0, int c1, int c2) {
|
||||
return matrix->m[4 * r0 + c0] *
|
||||
(matrix->m[4 * r1 + c1] * matrix->m[4 * r2 + c2] - matrix->m[4 * r2 + c1] * matrix->m[4 * r1 + c2]) -
|
||||
matrix->m[4 * r0 + c1] *
|
||||
(matrix->m[4 * r1 + c0] * matrix->m[4 * r2 + c2] - matrix->m[4 * r2 + c0] * matrix->m[4 * r1 + c2]) +
|
||||
matrix->m[4 * r0 + c2] *
|
||||
(matrix->m[4 * r1 + c0] * matrix->m[4 * r2 + c1] - matrix->m[4 * r2 + c0] * matrix->m[4 * r1 + c1]);
|
||||
}
|
||||
|
||||
// Calculates the inverse of a 4x4 matrix.
|
||||
inline static void XrMatrix4x4f_Invert(XrMatrix4x4f* result, const XrMatrix4x4f* src) {
|
||||
const float rcpDet =
|
||||
1.0f / (src->m[0] * XrMatrix4x4f_Minor(src, 1, 2, 3, 1, 2, 3) - src->m[1] * XrMatrix4x4f_Minor(src, 1, 2, 3, 0, 2, 3) +
|
||||
src->m[2] * XrMatrix4x4f_Minor(src, 1, 2, 3, 0, 1, 3) - src->m[3] * XrMatrix4x4f_Minor(src, 1, 2, 3, 0, 1, 2));
|
||||
|
||||
result->m[0] = XrMatrix4x4f_Minor(src, 1, 2, 3, 1, 2, 3) * rcpDet;
|
||||
result->m[1] = -XrMatrix4x4f_Minor(src, 0, 2, 3, 1, 2, 3) * rcpDet;
|
||||
result->m[2] = XrMatrix4x4f_Minor(src, 0, 1, 3, 1, 2, 3) * rcpDet;
|
||||
result->m[3] = -XrMatrix4x4f_Minor(src, 0, 1, 2, 1, 2, 3) * rcpDet;
|
||||
result->m[4] = -XrMatrix4x4f_Minor(src, 1, 2, 3, 0, 2, 3) * rcpDet;
|
||||
result->m[5] = XrMatrix4x4f_Minor(src, 0, 2, 3, 0, 2, 3) * rcpDet;
|
||||
result->m[6] = -XrMatrix4x4f_Minor(src, 0, 1, 3, 0, 2, 3) * rcpDet;
|
||||
result->m[7] = XrMatrix4x4f_Minor(src, 0, 1, 2, 0, 2, 3) * rcpDet;
|
||||
result->m[8] = XrMatrix4x4f_Minor(src, 1, 2, 3, 0, 1, 3) * rcpDet;
|
||||
result->m[9] = -XrMatrix4x4f_Minor(src, 0, 2, 3, 0, 1, 3) * rcpDet;
|
||||
result->m[10] = XrMatrix4x4f_Minor(src, 0, 1, 3, 0, 1, 3) * rcpDet;
|
||||
result->m[11] = -XrMatrix4x4f_Minor(src, 0, 1, 2, 0, 1, 3) * rcpDet;
|
||||
result->m[12] = -XrMatrix4x4f_Minor(src, 1, 2, 3, 0, 1, 2) * rcpDet;
|
||||
result->m[13] = XrMatrix4x4f_Minor(src, 0, 2, 3, 0, 1, 2) * rcpDet;
|
||||
result->m[14] = -XrMatrix4x4f_Minor(src, 0, 1, 3, 0, 1, 2) * rcpDet;
|
||||
result->m[15] = XrMatrix4x4f_Minor(src, 0, 1, 2, 0, 1, 2) * rcpDet;
|
||||
}
|
||||
|
||||
// Calculates the inverse of a rigid body transform.
|
||||
inline static void XrMatrix4x4f_InvertRigidBody(XrMatrix4x4f* result, const XrMatrix4x4f* src) {
|
||||
result->m[0] = src->m[0];
|
||||
result->m[1] = src->m[4];
|
||||
result->m[2] = src->m[8];
|
||||
result->m[3] = 0.0f;
|
||||
result->m[4] = src->m[1];
|
||||
result->m[5] = src->m[5];
|
||||
result->m[6] = src->m[9];
|
||||
result->m[7] = 0.0f;
|
||||
result->m[8] = src->m[2];
|
||||
result->m[9] = src->m[6];
|
||||
result->m[10] = src->m[10];
|
||||
result->m[11] = 0.0f;
|
||||
result->m[12] = -(src->m[0] * src->m[12] + src->m[1] * src->m[13] + src->m[2] * src->m[14]);
|
||||
result->m[13] = -(src->m[4] * src->m[12] + src->m[5] * src->m[13] + src->m[6] * src->m[14]);
|
||||
result->m[14] = -(src->m[8] * src->m[12] + src->m[9] * src->m[13] + src->m[10] * src->m[14]);
|
||||
result->m[15] = 1.0f;
|
||||
}
|
||||
|
||||
// Creates an identity matrix.
|
||||
inline static void XrMatrix4x4f_CreateIdentity(XrMatrix4x4f* result) {
|
||||
result->m[0] = 1.0f;
|
||||
result->m[1] = 0.0f;
|
||||
result->m[2] = 0.0f;
|
||||
result->m[3] = 0.0f;
|
||||
result->m[4] = 0.0f;
|
||||
result->m[5] = 1.0f;
|
||||
result->m[6] = 0.0f;
|
||||
result->m[7] = 0.0f;
|
||||
result->m[8] = 0.0f;
|
||||
result->m[9] = 0.0f;
|
||||
result->m[10] = 1.0f;
|
||||
result->m[11] = 0.0f;
|
||||
result->m[12] = 0.0f;
|
||||
result->m[13] = 0.0f;
|
||||
result->m[14] = 0.0f;
|
||||
result->m[15] = 1.0f;
|
||||
}
|
||||
|
||||
// Creates a translation matrix.
|
||||
inline static void XrMatrix4x4f_CreateTranslation(XrMatrix4x4f* result, const float x, const float y, const float z) {
|
||||
result->m[0] = 1.0f;
|
||||
result->m[1] = 0.0f;
|
||||
result->m[2] = 0.0f;
|
||||
result->m[3] = 0.0f;
|
||||
result->m[4] = 0.0f;
|
||||
result->m[5] = 1.0f;
|
||||
result->m[6] = 0.0f;
|
||||
result->m[7] = 0.0f;
|
||||
result->m[8] = 0.0f;
|
||||
result->m[9] = 0.0f;
|
||||
result->m[10] = 1.0f;
|
||||
result->m[11] = 0.0f;
|
||||
result->m[12] = x;
|
||||
result->m[13] = y;
|
||||
result->m[14] = z;
|
||||
result->m[15] = 1.0f;
|
||||
}
|
||||
|
||||
// Creates a rotation matrix.
|
||||
// If -Z=forward, +Y=up, +X=right, then degreesX=pitch, degreesY=yaw, degreesZ=roll.
|
||||
inline static void XrMatrix4x4f_CreateRotation(XrMatrix4x4f* result, const float degreesX, const float degreesY,
|
||||
const float degreesZ) {
|
||||
const float sinX = sinf(degreesX * (MATH_PI / 180.0f));
|
||||
const float cosX = cosf(degreesX * (MATH_PI / 180.0f));
|
||||
const XrMatrix4x4f rotationX = {{1, 0, 0, 0, 0, cosX, sinX, 0, 0, -sinX, cosX, 0, 0, 0, 0, 1}};
|
||||
const float sinY = sinf(degreesY * (MATH_PI / 180.0f));
|
||||
const float cosY = cosf(degreesY * (MATH_PI / 180.0f));
|
||||
const XrMatrix4x4f rotationY = {{cosY, 0, -sinY, 0, 0, 1, 0, 0, sinY, 0, cosY, 0, 0, 0, 0, 1}};
|
||||
const float sinZ = sinf(degreesZ * (MATH_PI / 180.0f));
|
||||
const float cosZ = cosf(degreesZ * (MATH_PI / 180.0f));
|
||||
const XrMatrix4x4f rotationZ = {{cosZ, sinZ, 0, 0, -sinZ, cosZ, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}};
|
||||
XrMatrix4x4f rotationXY;
|
||||
XrMatrix4x4f_Multiply(&rotationXY, &rotationY, &rotationX);
|
||||
XrMatrix4x4f_Multiply(result, &rotationZ, &rotationXY);
|
||||
}
|
||||
|
||||
// Creates a scale matrix.
|
||||
inline static void XrMatrix4x4f_CreateScale(XrMatrix4x4f* result, const float x, const float y, const float z) {
|
||||
result->m[0] = x;
|
||||
result->m[1] = 0.0f;
|
||||
result->m[2] = 0.0f;
|
||||
result->m[3] = 0.0f;
|
||||
result->m[4] = 0.0f;
|
||||
result->m[5] = y;
|
||||
result->m[6] = 0.0f;
|
||||
result->m[7] = 0.0f;
|
||||
result->m[8] = 0.0f;
|
||||
result->m[9] = 0.0f;
|
||||
result->m[10] = z;
|
||||
result->m[11] = 0.0f;
|
||||
result->m[12] = 0.0f;
|
||||
result->m[13] = 0.0f;
|
||||
result->m[14] = 0.0f;
|
||||
result->m[15] = 1.0f;
|
||||
}
|
||||
|
||||
// Creates a matrix from a quaternion.
|
||||
inline static void XrMatrix4x4f_CreateFromQuaternion(XrMatrix4x4f* result, const XrQuaternionf* quat) {
|
||||
const float x2 = quat->x + quat->x;
|
||||
const float y2 = quat->y + quat->y;
|
||||
const float z2 = quat->z + quat->z;
|
||||
|
||||
const float xx2 = quat->x * x2;
|
||||
const float yy2 = quat->y * y2;
|
||||
const float zz2 = quat->z * z2;
|
||||
|
||||
const float yz2 = quat->y * z2;
|
||||
const float wx2 = quat->w * x2;
|
||||
const float xy2 = quat->x * y2;
|
||||
const float wz2 = quat->w * z2;
|
||||
const float xz2 = quat->x * z2;
|
||||
const float wy2 = quat->w * y2;
|
||||
|
||||
result->m[0] = 1.0f - yy2 - zz2;
|
||||
result->m[1] = xy2 + wz2;
|
||||
result->m[2] = xz2 - wy2;
|
||||
result->m[3] = 0.0f;
|
||||
|
||||
result->m[4] = xy2 - wz2;
|
||||
result->m[5] = 1.0f - xx2 - zz2;
|
||||
result->m[6] = yz2 + wx2;
|
||||
result->m[7] = 0.0f;
|
||||
|
||||
result->m[8] = xz2 + wy2;
|
||||
result->m[9] = yz2 - wx2;
|
||||
result->m[10] = 1.0f - xx2 - yy2;
|
||||
result->m[11] = 0.0f;
|
||||
|
||||
result->m[12] = 0.0f;
|
||||
result->m[13] = 0.0f;
|
||||
result->m[14] = 0.0f;
|
||||
result->m[15] = 1.0f;
|
||||
}
|
||||
|
||||
// Creates a combined translation(rotation(scale(object))) matrix.
|
||||
inline static void XrMatrix4x4f_CreateTranslationRotationScale(XrMatrix4x4f* result, const XrVector3f* translation,
|
||||
const XrQuaternionf* rotation, const XrVector3f* scale) {
|
||||
XrMatrix4x4f scaleMatrix;
|
||||
XrMatrix4x4f_CreateScale(&scaleMatrix, scale->x, scale->y, scale->z);
|
||||
|
||||
XrMatrix4x4f rotationMatrix;
|
||||
XrMatrix4x4f_CreateFromQuaternion(&rotationMatrix, rotation);
|
||||
|
||||
XrMatrix4x4f translationMatrix;
|
||||
XrMatrix4x4f_CreateTranslation(&translationMatrix, translation->x, translation->y, translation->z);
|
||||
|
||||
XrMatrix4x4f combinedMatrix;
|
||||
XrMatrix4x4f_Multiply(&combinedMatrix, &rotationMatrix, &scaleMatrix);
|
||||
XrMatrix4x4f_Multiply(result, &translationMatrix, &combinedMatrix);
|
||||
}
|
||||
|
||||
// Creates a projection matrix based on the specified dimensions.
|
||||
// The projection matrix transforms -Z=forward, +Y=up, +X=right to the appropriate clip space for the graphics API.
|
||||
// The far plane is placed at infinity if farZ <= nearZ.
|
||||
// An infinite projection matrix is preferred for rasterization because, except for
|
||||
// things *right* up against the near plane, it always provides better precision:
|
||||
// "Tightening the Precision of Perspective Rendering"
|
||||
// Paul Upchurch, Mathieu Desbrun
|
||||
// Journal of Graphics Tools, Volume 16, Issue 1, 2012
|
||||
inline static void XrMatrix4x4f_CreateProjection(XrMatrix4x4f* result, GraphicsAPI graphicsApi, const float tanAngleLeft,
|
||||
const float tanAngleRight, const float tanAngleUp, float const tanAngleDown,
|
||||
const float nearZ, const float farZ) {
|
||||
const float tanAngleWidth = tanAngleRight - tanAngleLeft;
|
||||
|
||||
// Set to tanAngleDown - tanAngleUp for a clip space with positive Y down (Vulkan).
|
||||
// Set to tanAngleUp - tanAngleDown for a clip space with positive Y up (OpenGL / D3D / Metal).
|
||||
const float tanAngleHeight = graphicsApi == GRAPHICS_VULKAN ? (tanAngleDown - tanAngleUp) : (tanAngleUp - tanAngleDown);
|
||||
|
||||
// Set to nearZ for a [-1,1] Z clip space (OpenGL / OpenGL ES).
|
||||
// Set to zero for a [0,1] Z clip space (Vulkan / D3D / Metal).
|
||||
const float offsetZ = (graphicsApi == GRAPHICS_OPENGL || graphicsApi == GRAPHICS_OPENGL_ES) ? nearZ : 0;
|
||||
|
||||
if (farZ <= nearZ) {
|
||||
// place the far plane at infinity
|
||||
result->m[0] = 2.0f / tanAngleWidth;
|
||||
result->m[4] = 0.0f;
|
||||
result->m[8] = (tanAngleRight + tanAngleLeft) / tanAngleWidth;
|
||||
result->m[12] = 0.0f;
|
||||
|
||||
result->m[1] = 0.0f;
|
||||
result->m[5] = 2.0f / tanAngleHeight;
|
||||
result->m[9] = (tanAngleUp + tanAngleDown) / tanAngleHeight;
|
||||
result->m[13] = 0.0f;
|
||||
|
||||
result->m[2] = 0.0f;
|
||||
result->m[6] = 0.0f;
|
||||
result->m[10] = -1.0f;
|
||||
result->m[14] = -(nearZ + offsetZ);
|
||||
|
||||
result->m[3] = 0.0f;
|
||||
result->m[7] = 0.0f;
|
||||
result->m[11] = -1.0f;
|
||||
result->m[15] = 0.0f;
|
||||
} else {
|
||||
// normal projection
|
||||
result->m[0] = 2.0f / tanAngleWidth;
|
||||
result->m[4] = 0.0f;
|
||||
result->m[8] = (tanAngleRight + tanAngleLeft) / tanAngleWidth;
|
||||
result->m[12] = 0.0f;
|
||||
|
||||
result->m[1] = 0.0f;
|
||||
result->m[5] = 2.0f / tanAngleHeight;
|
||||
result->m[9] = (tanAngleUp + tanAngleDown) / tanAngleHeight;
|
||||
result->m[13] = 0.0f;
|
||||
|
||||
result->m[2] = 0.0f;
|
||||
result->m[6] = 0.0f;
|
||||
result->m[10] = -(farZ + offsetZ) / (farZ - nearZ);
|
||||
result->m[14] = -(farZ * (nearZ + offsetZ)) / (farZ - nearZ);
|
||||
|
||||
result->m[3] = 0.0f;
|
||||
result->m[7] = 0.0f;
|
||||
result->m[11] = -1.0f;
|
||||
result->m[15] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Creates a projection matrix based on the specified FOV.
|
||||
inline static void XrMatrix4x4f_CreateProjectionFov(XrMatrix4x4f* result, GraphicsAPI graphicsApi, const XrFovf fov,
|
||||
const float nearZ, const float farZ) {
|
||||
const float tanLeft = tanf(fov.angleLeft);
|
||||
const float tanRight = tanf(fov.angleRight);
|
||||
|
||||
const float tanDown = tanf(fov.angleDown);
|
||||
const float tanUp = tanf(fov.angleUp);
|
||||
|
||||
XrMatrix4x4f_CreateProjection(result, graphicsApi, tanLeft, tanRight, tanUp, tanDown, nearZ, farZ);
|
||||
}
|
||||
|
||||
// Creates a matrix that transforms the -1 to 1 cube to cover the given 'mins' and 'maxs' transformed with the given 'matrix'.
|
||||
inline static void XrMatrix4x4f_CreateOffsetScaleForBounds(XrMatrix4x4f* result, const XrMatrix4x4f* matrix, const XrVector3f* mins,
|
||||
const XrVector3f* maxs) {
|
||||
const XrVector3f offset = {(maxs->x + mins->x) * 0.5f, (maxs->y + mins->y) * 0.5f, (maxs->z + mins->z) * 0.5f};
|
||||
const XrVector3f scale = {(maxs->x - mins->x) * 0.5f, (maxs->y - mins->y) * 0.5f, (maxs->z - mins->z) * 0.5f};
|
||||
|
||||
result->m[0] = matrix->m[0] * scale.x;
|
||||
result->m[1] = matrix->m[1] * scale.x;
|
||||
result->m[2] = matrix->m[2] * scale.x;
|
||||
result->m[3] = matrix->m[3] * scale.x;
|
||||
|
||||
result->m[4] = matrix->m[4] * scale.y;
|
||||
result->m[5] = matrix->m[5] * scale.y;
|
||||
result->m[6] = matrix->m[6] * scale.y;
|
||||
result->m[7] = matrix->m[7] * scale.y;
|
||||
|
||||
result->m[8] = matrix->m[8] * scale.z;
|
||||
result->m[9] = matrix->m[9] * scale.z;
|
||||
result->m[10] = matrix->m[10] * scale.z;
|
||||
result->m[11] = matrix->m[11] * scale.z;
|
||||
|
||||
result->m[12] = matrix->m[12] + matrix->m[0] * offset.x + matrix->m[4] * offset.y + matrix->m[8] * offset.z;
|
||||
result->m[13] = matrix->m[13] + matrix->m[1] * offset.x + matrix->m[5] * offset.y + matrix->m[9] * offset.z;
|
||||
result->m[14] = matrix->m[14] + matrix->m[2] * offset.x + matrix->m[6] * offset.y + matrix->m[10] * offset.z;
|
||||
result->m[15] = matrix->m[15] + matrix->m[3] * offset.x + matrix->m[7] * offset.y + matrix->m[11] * offset.z;
|
||||
}
|
||||
|
||||
// Returns true if the given matrix is affine.
|
||||
inline static bool XrMatrix4x4f_IsAffine(const XrMatrix4x4f* matrix, const float epsilon) {
|
||||
return fabsf(matrix->m[3]) <= epsilon && fabsf(matrix->m[7]) <= epsilon && fabsf(matrix->m[11]) <= epsilon &&
|
||||
fabsf(matrix->m[15] - 1.0f) <= epsilon;
|
||||
}
|
||||
|
||||
// Returns true if the given matrix is orthogonal.
|
||||
inline static bool XrMatrix4x4f_IsOrthogonal(const XrMatrix4x4f* matrix, const float epsilon) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
if (i != j) {
|
||||
if (fabsf(matrix->m[4 * i + 0] * matrix->m[4 * j + 0] + matrix->m[4 * i + 1] * matrix->m[4 * j + 1] +
|
||||
matrix->m[4 * i + 2] * matrix->m[4 * j + 2]) > epsilon) {
|
||||
return false;
|
||||
}
|
||||
if (fabsf(matrix->m[4 * 0 + i] * matrix->m[4 * 0 + j] + matrix->m[4 * 1 + i] * matrix->m[4 * 1 + j] +
|
||||
matrix->m[4 * 2 + i] * matrix->m[4 * 2 + j]) > epsilon) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns true if the given matrix is orthonormal.
|
||||
inline static bool XrMatrix4x4f_IsOrthonormal(const XrMatrix4x4f* matrix, const float epsilon) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
const float kd = (i == j) ? 1.0f : 0.0f; // Kronecker delta
|
||||
if (fabsf(kd - (matrix->m[4 * i + 0] * matrix->m[4 * j + 0] + matrix->m[4 * i + 1] * matrix->m[4 * j + 1] +
|
||||
matrix->m[4 * i + 2] * matrix->m[4 * j + 2])) > epsilon) {
|
||||
return false;
|
||||
}
|
||||
if (fabsf(kd - (matrix->m[4 * 0 + i] * matrix->m[4 * 0 + j] + matrix->m[4 * 1 + i] * matrix->m[4 * 1 + j] +
|
||||
matrix->m[4 * 2 + i] * matrix->m[4 * 2 + j])) > epsilon) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns true if the given matrix is a rigid body transform.
|
||||
inline static bool XrMatrix4x4f_IsRigidBody(const XrMatrix4x4f* matrix, const float epsilon) {
|
||||
return XrMatrix4x4f_IsAffine(matrix, epsilon) && XrMatrix4x4f_IsOrthonormal(matrix, epsilon);
|
||||
}
|
||||
|
||||
// Get the translation from a combined translation(rotation(scale(object))) matrix.
|
||||
inline static void XrMatrix4x4f_GetTranslation(XrVector3f* result, const XrMatrix4x4f* src) {
|
||||
assert(XrMatrix4x4f_IsAffine(src, 1e-4f));
|
||||
assert(XrMatrix4x4f_IsOrthogonal(src, 1e-4f));
|
||||
|
||||
result->x = src->m[12];
|
||||
result->y = src->m[13];
|
||||
result->z = src->m[14];
|
||||
}
|
||||
|
||||
// Get the rotation from a combined translation(rotation(scale(object))) matrix.
|
||||
inline static void XrMatrix4x4f_GetRotation(XrQuaternionf* result, const XrMatrix4x4f* src) {
|
||||
assert(XrMatrix4x4f_IsAffine(src, 1e-4f));
|
||||
assert(XrMatrix4x4f_IsOrthogonal(src, 1e-4f));
|
||||
|
||||
const float rcpScaleX = XrRcpSqrt(src->m[0] * src->m[0] + src->m[1] * src->m[1] + src->m[2] * src->m[2]);
|
||||
const float rcpScaleY = XrRcpSqrt(src->m[4] * src->m[4] + src->m[5] * src->m[5] + src->m[6] * src->m[6]);
|
||||
const float rcpScaleZ = XrRcpSqrt(src->m[8] * src->m[8] + src->m[9] * src->m[9] + src->m[10] * src->m[10]);
|
||||
const float m[9] = {src->m[0] * rcpScaleX, src->m[1] * rcpScaleX, src->m[2] * rcpScaleX,
|
||||
src->m[4] * rcpScaleY, src->m[5] * rcpScaleY, src->m[6] * rcpScaleY,
|
||||
src->m[8] * rcpScaleZ, src->m[9] * rcpScaleZ, src->m[10] * rcpScaleZ};
|
||||
if (m[0 * 3 + 0] + m[1 * 3 + 1] + m[2 * 3 + 2] > 0.0f) {
|
||||
float t = +m[0 * 3 + 0] + m[1 * 3 + 1] + m[2 * 3 + 2] + 1.0f;
|
||||
float s = XrRcpSqrt(t) * 0.5f;
|
||||
result->w = s * t;
|
||||
result->z = (m[0 * 3 + 1] - m[1 * 3 + 0]) * s;
|
||||
result->y = (m[2 * 3 + 0] - m[0 * 3 + 2]) * s;
|
||||
result->x = (m[1 * 3 + 2] - m[2 * 3 + 1]) * s;
|
||||
} else if (m[0 * 3 + 0] > m[1 * 3 + 1] && m[0 * 3 + 0] > m[2 * 3 + 2]) {
|
||||
float t = +m[0 * 3 + 0] - m[1 * 3 + 1] - m[2 * 3 + 2] + 1.0f;
|
||||
float s = XrRcpSqrt(t) * 0.5f;
|
||||
result->x = s * t;
|
||||
result->y = (m[0 * 3 + 1] + m[1 * 3 + 0]) * s;
|
||||
result->z = (m[2 * 3 + 0] + m[0 * 3 + 2]) * s;
|
||||
result->w = (m[1 * 3 + 2] - m[2 * 3 + 1]) * s;
|
||||
} else if (m[1 * 3 + 1] > m[2 * 3 + 2]) {
|
||||
float t = -m[0 * 3 + 0] + m[1 * 3 + 1] - m[2 * 3 + 2] + 1.0f;
|
||||
float s = XrRcpSqrt(t) * 0.5f;
|
||||
result->y = s * t;
|
||||
result->x = (m[0 * 3 + 1] + m[1 * 3 + 0]) * s;
|
||||
result->w = (m[2 * 3 + 0] - m[0 * 3 + 2]) * s;
|
||||
result->z = (m[1 * 3 + 2] + m[2 * 3 + 1]) * s;
|
||||
} else {
|
||||
float t = -m[0 * 3 + 0] - m[1 * 3 + 1] + m[2 * 3 + 2] + 1.0f;
|
||||
float s = XrRcpSqrt(t) * 0.5f;
|
||||
result->z = s * t;
|
||||
result->w = (m[0 * 3 + 1] - m[1 * 3 + 0]) * s;
|
||||
result->x = (m[2 * 3 + 0] + m[0 * 3 + 2]) * s;
|
||||
result->y = (m[1 * 3 + 2] + m[2 * 3 + 1]) * s;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the scale from a combined translation(rotation(scale(object))) matrix.
|
||||
inline static void XrMatrix4x4f_GetScale(XrVector3f* result, const XrMatrix4x4f* src) {
|
||||
assert(XrMatrix4x4f_IsAffine(src, 1e-4f));
|
||||
assert(XrMatrix4x4f_IsOrthogonal(src, 1e-4f));
|
||||
|
||||
result->x = sqrtf(src->m[0] * src->m[0] + src->m[1] * src->m[1] + src->m[2] * src->m[2]);
|
||||
result->y = sqrtf(src->m[4] * src->m[4] + src->m[5] * src->m[5] + src->m[6] * src->m[6]);
|
||||
result->z = sqrtf(src->m[8] * src->m[8] + src->m[9] * src->m[9] + src->m[10] * src->m[10]);
|
||||
}
|
||||
|
||||
// Transforms a 3D vector.
|
||||
inline static void XrMatrix4x4f_TransformVector3f(XrVector3f* result, const XrMatrix4x4f* m, const XrVector3f* v) {
|
||||
const float w = m->m[3] * v->x + m->m[7] * v->y + m->m[11] * v->z + m->m[15];
|
||||
const float rcpW = 1.0f / w;
|
||||
result->x = (m->m[0] * v->x + m->m[4] * v->y + m->m[8] * v->z + m->m[12]) * rcpW;
|
||||
result->y = (m->m[1] * v->x + m->m[5] * v->y + m->m[9] * v->z + m->m[13]) * rcpW;
|
||||
result->z = (m->m[2] * v->x + m->m[6] * v->y + m->m[10] * v->z + m->m[14]) * rcpW;
|
||||
}
|
||||
|
||||
// Transforms a 4D vector.
|
||||
inline static void XrMatrix4x4f_TransformVector4f(XrVector4f* result, const XrMatrix4x4f* m, const XrVector4f* v) {
|
||||
result->x = m->m[0] * v->x + m->m[4] * v->y + m->m[8] * v->z + m->m[12] * v->w;
|
||||
result->y = m->m[1] * v->x + m->m[5] * v->y + m->m[9] * v->z + m->m[13] * v->w;
|
||||
result->z = m->m[2] * v->x + m->m[6] * v->y + m->m[10] * v->z + m->m[14] * v->w;
|
||||
result->w = m->m[3] * v->x + m->m[7] * v->y + m->m[11] * v->z + m->m[15] * v->w;
|
||||
}
|
||||
|
||||
// Transforms the 'mins' and 'maxs' bounds with the given 'matrix'.
|
||||
inline static void XrMatrix4x4f_TransformBounds(XrVector3f* resultMins, XrVector3f* resultMaxs, const XrMatrix4x4f* matrix,
|
||||
const XrVector3f* mins, const XrVector3f* maxs) {
|
||||
assert(XrMatrix4x4f_IsAffine(matrix, 1e-4f));
|
||||
|
||||
const XrVector3f center = {(mins->x + maxs->x) * 0.5f, (mins->y + maxs->y) * 0.5f, (mins->z + maxs->z) * 0.5f};
|
||||
const XrVector3f extents = {maxs->x - center.x, maxs->y - center.y, maxs->z - center.z};
|
||||
const XrVector3f newCenter = {matrix->m[0] * center.x + matrix->m[4] * center.y + matrix->m[8] * center.z + matrix->m[12],
|
||||
matrix->m[1] * center.x + matrix->m[5] * center.y + matrix->m[9] * center.z + matrix->m[13],
|
||||
matrix->m[2] * center.x + matrix->m[6] * center.y + matrix->m[10] * center.z + matrix->m[14]};
|
||||
const XrVector3f newExtents = {
|
||||
fabsf(extents.x * matrix->m[0]) + fabsf(extents.y * matrix->m[4]) + fabsf(extents.z * matrix->m[8]),
|
||||
fabsf(extents.x * matrix->m[1]) + fabsf(extents.y * matrix->m[5]) + fabsf(extents.z * matrix->m[9]),
|
||||
fabsf(extents.x * matrix->m[2]) + fabsf(extents.y * matrix->m[6]) + fabsf(extents.z * matrix->m[10])};
|
||||
XrVector3f_Sub(resultMins, &newCenter, &newExtents);
|
||||
XrVector3f_Add(resultMaxs, &newCenter, &newExtents);
|
||||
}
|
||||
|
||||
// Returns true if the 'mins' and 'maxs' bounds is completely off to one side of the projection matrix.
|
||||
inline static bool XrMatrix4x4f_CullBounds(const XrMatrix4x4f* mvp, const XrVector3f* mins, const XrVector3f* maxs) {
|
||||
if (maxs->x <= mins->x && maxs->y <= mins->y && maxs->z <= mins->z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
XrVector4f c[8];
|
||||
for (int i = 0; i < 8; i++) {
|
||||
const XrVector4f corner = {(i & 1) != 0 ? maxs->x : mins->x, (i & 2) != 0 ? maxs->y : mins->y,
|
||||
(i & 4) != 0 ? maxs->z : mins->z, 1.0f};
|
||||
XrMatrix4x4f_TransformVector4f(&c[i], mvp, &corner);
|
||||
}
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (c[i].x > -c[i].w) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 8) {
|
||||
return true;
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (c[i].x < c[i].w) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 8) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (c[i].y > -c[i].w) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 8) {
|
||||
return true;
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (c[i].y < c[i].w) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 8) {
|
||||
return true;
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (c[i].z > -c[i].w) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 8) {
|
||||
return true;
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (c[i].z < c[i].w) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i == 8;
|
||||
}
|
||||
|
||||
#endif // XR_LINEAR_H_
|
|
@ -494,7 +494,7 @@ void TBXR_Vibrate( int duration, int chan, float intensity )
|
|||
{
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
int channel = 1-i;
|
||||
int channel = i;
|
||||
if ((i + 1) & chan)
|
||||
{
|
||||
if (vibration_channel_duration[channel] > 0.0f)
|
||||
|
|
|
@ -331,24 +331,27 @@ void VR_FrameSetup()
|
|||
|
||||
bool VR_GetVRProjection(int eye, float zNear, float zFar, float* projection)
|
||||
{
|
||||
#ifdef PICO_XR
|
||||
XrMatrix4x4f_CreateProjectionFov(
|
||||
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
||||
gAppState.Projections[eye].fov, zNear, zFar);
|
||||
#endif
|
||||
if (strstr(gAppState.OpenXRHMD, "pico") != NULL)
|
||||
{
|
||||
XrMatrix4x4f_CreateProjectionFov(
|
||||
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
||||
gAppState.Projections[eye].fov, zNear, zFar);
|
||||
}
|
||||
|
||||
#ifdef META_QUEST
|
||||
XrFovf fov = {};
|
||||
for (int eye = 0; eye < ovrMaxNumEyes; eye++) {
|
||||
fov.angleLeft += gAppState.Projections[eye].fov.angleLeft / 2.0f;
|
||||
fov.angleRight += gAppState.Projections[eye].fov.angleRight / 2.0f;
|
||||
fov.angleUp += gAppState.Projections[eye].fov.angleUp / 2.0f;
|
||||
fov.angleDown += gAppState.Projections[eye].fov.angleDown / 2.0f;
|
||||
}
|
||||
XrMatrix4x4f_CreateProjectionFov(
|
||||
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
||||
fov, zNear, zFar);
|
||||
#endif
|
||||
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
|
||||
{
|
||||
XrFovf fov = {};
|
||||
for (int eye = 0; eye < ovrMaxNumEyes; eye++)
|
||||
{
|
||||
fov.angleLeft += gAppState.Projections[eye].fov.angleLeft / 2.0f;
|
||||
fov.angleRight += gAppState.Projections[eye].fov.angleRight / 2.0f;
|
||||
fov.angleUp += gAppState.Projections[eye].fov.angleUp / 2.0f;
|
||||
fov.angleDown += gAppState.Projections[eye].fov.angleDown / 2.0f;
|
||||
}
|
||||
XrMatrix4x4f_CreateProjectionFov(
|
||||
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
||||
fov, zNear, zFar);
|
||||
}
|
||||
|
||||
memcpy(projection, gAppState.ProjectionMatrices[eye].m, 16 * sizeof(float));
|
||||
return true;
|
||||
|
|
|
@ -54,17 +54,13 @@ float SS_MULTIPLIER = 1.3f;
|
|||
|
||||
GLboolean stageSupported = GL_FALSE;
|
||||
|
||||
#ifdef META_QUEST
|
||||
|
||||
const char* const requiredExtensionNames[] = {
|
||||
const char* const requiredExtensionNames_meta[] = {
|
||||
XR_KHR_OPENGL_ES_ENABLE_EXTENSION_NAME,
|
||||
XR_EXT_PERFORMANCE_SETTINGS_EXTENSION_NAME,
|
||||
XR_KHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME,
|
||||
XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME,
|
||||
XR_FB_COLOR_SPACE_EXTENSION_NAME};
|
||||
#endif //META_QUEST
|
||||
|
||||
#ifdef PICO_XR
|
||||
#define XR_PICO_CONFIGS_EXT_EXTENSION_NAME "XR_PICO_configs_ext"
|
||||
|
||||
enum ConfigsEXT
|
||||
|
@ -117,16 +113,17 @@ typedef XrResult (XRAPI_PTR *PFN_xrSetConfigPICO) (
|
|||
char * configData);
|
||||
PFN_xrSetConfigPICO pfnXrSetConfigPICO;
|
||||
|
||||
const char* const requiredExtensionNames[] = {
|
||||
const char* const requiredExtensionNames_pico[] = {
|
||||
XR_KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME,
|
||||
XR_EXT_PERFORMANCE_SETTINGS_EXTENSION_NAME,
|
||||
XR_KHR_OPENGL_ES_ENABLE_EXTENSION_NAME,
|
||||
XR_PICO_CONFIGS_EXT_EXTENSION_NAME};
|
||||
|
||||
#endif //PICO_XR
|
||||
|
||||
const uint32_t numRequiredExtensions =
|
||||
sizeof(requiredExtensionNames) / sizeof(requiredExtensionNames[0]);
|
||||
const uint32_t numRequiredExtensions_meta =
|
||||
sizeof(requiredExtensionNames_meta) / sizeof(requiredExtensionNames_meta[0]);
|
||||
const uint32_t numRequiredExtensions_pico =
|
||||
sizeof(requiredExtensionNames_pico) / sizeof(requiredExtensionNames_pico[0]);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -919,18 +916,19 @@ void ovrApp_HandleSessionStateChanges(ovrApp* app, XrSessionState state) {
|
|||
OXR(pfnPerfSettingsSetPerformanceLevelEXT(
|
||||
app->Session, XR_PERF_SETTINGS_DOMAIN_GPU_EXT, gpuPerfLevel));
|
||||
|
||||
#ifdef META_QUEST
|
||||
PFN_xrSetAndroidApplicationThreadKHR pfnSetAndroidApplicationThreadKHR = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
app->Instance,
|
||||
"xrSetAndroidApplicationThreadKHR",
|
||||
(PFN_xrVoidFunction * )(&pfnSetAndroidApplicationThreadKHR)));
|
||||
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
|
||||
{
|
||||
PFN_xrSetAndroidApplicationThreadKHR pfnSetAndroidApplicationThreadKHR = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
app->Instance,
|
||||
"xrSetAndroidApplicationThreadKHR",
|
||||
(PFN_xrVoidFunction * )(&pfnSetAndroidApplicationThreadKHR)));
|
||||
|
||||
OXR(pfnSetAndroidApplicationThreadKHR(
|
||||
app->Session, XR_ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR, app->MainThreadTid));
|
||||
OXR(pfnSetAndroidApplicationThreadKHR(
|
||||
app->Session, XR_ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR, app->RenderThreadTid));
|
||||
#endif
|
||||
OXR(pfnSetAndroidApplicationThreadKHR(
|
||||
app->Session, XR_ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR, app->MainThreadTid));
|
||||
OXR(pfnSetAndroidApplicationThreadKHR(
|
||||
app->Session, XR_ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR, app->RenderThreadTid));
|
||||
}
|
||||
}
|
||||
} else if (state == XR_SESSION_STATE_STOPPING) {
|
||||
assert(app->SessionActive);
|
||||
|
@ -979,7 +977,6 @@ GLboolean ovrApp_HandleXrEvents(ovrApp* app) {
|
|||
perf_settings_event->fromLevel,
|
||||
perf_settings_event->toLevel);
|
||||
} break;
|
||||
#ifdef META_QUEST
|
||||
case XR_TYPE_EVENT_DATA_DISPLAY_REFRESH_RATE_CHANGED_FB: {
|
||||
const XrEventDataDisplayRefreshRateChangedFB* refresh_rate_changed_event =
|
||||
(XrEventDataDisplayRefreshRateChangedFB*)(baseEventHeader);
|
||||
|
@ -988,7 +985,6 @@ GLboolean ovrApp_HandleXrEvents(ovrApp* app) {
|
|||
refresh_rate_changed_event->fromDisplayRefreshRate,
|
||||
refresh_rate_changed_event->toDisplayRefreshRate);
|
||||
} break;
|
||||
#endif
|
||||
case XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING: {
|
||||
XrEventDataReferenceSpaceChangePending* ref_space_change_event =
|
||||
(XrEventDataReferenceSpaceChangePending*)(baseEventHeader);
|
||||
|
@ -1409,89 +1405,90 @@ void TBXR_InitRenderer( ) {
|
|||
gAppState.Instance, gAppState.SystemId, XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO, &gAppState.ViewportConfig));
|
||||
|
||||
|
||||
#ifdef META_QUEST
|
||||
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
|
||||
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;
|
||||
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
|
||||
{
|
||||
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
|
||||
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;
|
||||
|
||||
XrSystemProperties systemProperties = {};
|
||||
systemProperties.type = XR_TYPE_SYSTEM_PROPERTIES;
|
||||
systemProperties.next = &colorSpacePropertiesFB;
|
||||
OXR(xrGetSystemProperties(gAppState.Instance, gAppState.SystemId, &systemProperties));
|
||||
XrSystemProperties systemProperties = {};
|
||||
systemProperties.type = XR_TYPE_SYSTEM_PROPERTIES;
|
||||
systemProperties.next = &colorSpacePropertiesFB;
|
||||
OXR(xrGetSystemProperties(gAppState.Instance, gAppState.SystemId, &systemProperties));
|
||||
|
||||
// Enumerate the supported color space options for the system.
|
||||
{
|
||||
PFN_xrEnumerateColorSpacesFB pfnxrEnumerateColorSpacesFB = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrEnumerateColorSpacesFB",
|
||||
(PFN_xrVoidFunction*)(&pfnxrEnumerateColorSpacesFB)));
|
||||
// Enumerate the supported color space options for the system.
|
||||
{
|
||||
PFN_xrEnumerateColorSpacesFB pfnxrEnumerateColorSpacesFB = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrEnumerateColorSpacesFB",
|
||||
(PFN_xrVoidFunction*)(&pfnxrEnumerateColorSpacesFB)));
|
||||
|
||||
uint32_t colorSpaceCountOutput = 0;
|
||||
OXR(pfnxrEnumerateColorSpacesFB(gAppState.Session, 0, &colorSpaceCountOutput, NULL));
|
||||
uint32_t colorSpaceCountOutput = 0;
|
||||
OXR(pfnxrEnumerateColorSpacesFB(gAppState.Session, 0, &colorSpaceCountOutput, NULL));
|
||||
|
||||
XrColorSpaceFB* colorSpaces =
|
||||
(XrColorSpaceFB*)malloc(colorSpaceCountOutput * sizeof(XrColorSpaceFB));
|
||||
XrColorSpaceFB* colorSpaces =
|
||||
(XrColorSpaceFB*)malloc(colorSpaceCountOutput * sizeof(XrColorSpaceFB));
|
||||
|
||||
OXR(pfnxrEnumerateColorSpacesFB(
|
||||
gAppState.Session, colorSpaceCountOutput, &colorSpaceCountOutput, colorSpaces));
|
||||
ALOGV("Supported ColorSpaces:");
|
||||
OXR(pfnxrEnumerateColorSpacesFB(
|
||||
gAppState.Session, colorSpaceCountOutput, &colorSpaceCountOutput, colorSpaces));
|
||||
ALOGV("Supported ColorSpaces:");
|
||||
|
||||
for (uint32_t i = 0; i < colorSpaceCountOutput; i++) {
|
||||
ALOGV("%d:%d", i, colorSpaces[i]);
|
||||
}
|
||||
for (uint32_t i = 0; i < colorSpaceCountOutput; i++) {
|
||||
ALOGV("%d:%d", i, colorSpaces[i]);
|
||||
}
|
||||
|
||||
const XrColorSpaceFB requestColorSpace = XR_COLOR_SPACE_REC2020_FB;
|
||||
const XrColorSpaceFB requestColorSpace = XR_COLOR_SPACE_REC2020_FB;
|
||||
|
||||
PFN_xrSetColorSpaceFB pfnxrSetColorSpaceFB = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance, "xrSetColorSpaceFB", (PFN_xrVoidFunction*)(&pfnxrSetColorSpaceFB)));
|
||||
PFN_xrSetColorSpaceFB pfnxrSetColorSpaceFB = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance, "xrSetColorSpaceFB", (PFN_xrVoidFunction*)(&pfnxrSetColorSpaceFB)));
|
||||
|
||||
OXR(pfnxrSetColorSpaceFB(gAppState.Session, requestColorSpace));
|
||||
OXR(pfnxrSetColorSpaceFB(gAppState.Session, requestColorSpace));
|
||||
|
||||
free(colorSpaces);
|
||||
}
|
||||
free(colorSpaces);
|
||||
}
|
||||
|
||||
// Get the supported display refresh rates for the system.
|
||||
{
|
||||
PFN_xrEnumerateDisplayRefreshRatesFB pfnxrEnumerateDisplayRefreshRatesFB = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrEnumerateDisplayRefreshRatesFB",
|
||||
(PFN_xrVoidFunction*)(&pfnxrEnumerateDisplayRefreshRatesFB)));
|
||||
// Get the supported display refresh rates for the system.
|
||||
{
|
||||
PFN_xrEnumerateDisplayRefreshRatesFB pfnxrEnumerateDisplayRefreshRatesFB = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrEnumerateDisplayRefreshRatesFB",
|
||||
(PFN_xrVoidFunction*)(&pfnxrEnumerateDisplayRefreshRatesFB)));
|
||||
|
||||
OXR(pfnxrEnumerateDisplayRefreshRatesFB(
|
||||
gAppState.Session, 0, &gAppState.NumSupportedDisplayRefreshRates, NULL));
|
||||
OXR(pfnxrEnumerateDisplayRefreshRatesFB(
|
||||
gAppState.Session, 0, &gAppState.NumSupportedDisplayRefreshRates, NULL));
|
||||
|
||||
gAppState.SupportedDisplayRefreshRates =
|
||||
(float*)malloc(gAppState.NumSupportedDisplayRefreshRates * sizeof(float));
|
||||
OXR(pfnxrEnumerateDisplayRefreshRatesFB(
|
||||
gAppState.Session,
|
||||
gAppState.NumSupportedDisplayRefreshRates,
|
||||
&gAppState.NumSupportedDisplayRefreshRates,
|
||||
gAppState.SupportedDisplayRefreshRates));
|
||||
ALOGV("Supported Refresh Rates:");
|
||||
for (uint32_t i = 0; i < gAppState.NumSupportedDisplayRefreshRates; i++) {
|
||||
ALOGV("%d:%f", i, gAppState.SupportedDisplayRefreshRates[i]);
|
||||
}
|
||||
gAppState.SupportedDisplayRefreshRates =
|
||||
(float*)malloc(gAppState.NumSupportedDisplayRefreshRates * sizeof(float));
|
||||
OXR(pfnxrEnumerateDisplayRefreshRatesFB(
|
||||
gAppState.Session,
|
||||
gAppState.NumSupportedDisplayRefreshRates,
|
||||
&gAppState.NumSupportedDisplayRefreshRates,
|
||||
gAppState.SupportedDisplayRefreshRates));
|
||||
ALOGV("Supported Refresh Rates:");
|
||||
for (uint32_t i = 0; i < gAppState.NumSupportedDisplayRefreshRates; i++) {
|
||||
ALOGV("%d:%f", i, gAppState.SupportedDisplayRefreshRates[i]);
|
||||
}
|
||||
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrGetDisplayRefreshRateFB",
|
||||
(PFN_xrVoidFunction*)(&gAppState.pfnGetDisplayRefreshRate)));
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrGetDisplayRefreshRateFB",
|
||||
(PFN_xrVoidFunction*)(&gAppState.pfnGetDisplayRefreshRate)));
|
||||
|
||||
OXR(gAppState.pfnGetDisplayRefreshRate(gAppState.Session, &gAppState.currentDisplayRefreshRate));
|
||||
ALOGV("Current System Display Refresh Rate: %f", gAppState.currentDisplayRefreshRate);
|
||||
OXR(gAppState.pfnGetDisplayRefreshRate(gAppState.Session, &gAppState.currentDisplayRefreshRate));
|
||||
ALOGV("Current System Display Refresh Rate: %f", gAppState.currentDisplayRefreshRate);
|
||||
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrRequestDisplayRefreshRateFB",
|
||||
(PFN_xrVoidFunction*)(&gAppState.pfnRequestDisplayRefreshRate)));
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrRequestDisplayRefreshRateFB",
|
||||
(PFN_xrVoidFunction*)(&gAppState.pfnRequestDisplayRefreshRate)));
|
||||
|
||||
// Test requesting the system default.
|
||||
OXR(gAppState.pfnRequestDisplayRefreshRate(gAppState.Session, 0.0f));
|
||||
ALOGV("Requesting system default display refresh rate");
|
||||
}
|
||||
#endif
|
||||
// Test requesting the system default.
|
||||
OXR(gAppState.pfnRequestDisplayRefreshRate(gAppState.Session, 0.0f));
|
||||
ALOGV("Requesting system default display refresh rate");
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t numOutputSpaces = 0;
|
||||
OXR(xrEnumerateReferenceSpaces(gAppState.Session, 0, &numOutputSpaces, NULL));
|
||||
|
@ -1552,6 +1549,9 @@ void TBXR_InitialiseOpenXR()
|
|||
ovrEgl_CreateContext(&gAppState.Egl, NULL);
|
||||
EglInitExtensions();
|
||||
|
||||
//First, find out which HMD we are using
|
||||
gAppState.OpenXRHMD = (char*)getenv("OPENXR_HMD");
|
||||
|
||||
PFN_xrInitializeLoaderKHR xrInitializeLoaderKHR;
|
||||
xrGetInstanceProcAddr(
|
||||
XR_NULL_HANDLE, "xrInitializeLoaderKHR", (PFN_xrVoidFunction*)&xrInitializeLoaderKHR);
|
||||
|
@ -1577,22 +1577,28 @@ void TBXR_InitialiseOpenXR()
|
|||
XrInstanceCreateInfo instanceCreateInfo;
|
||||
memset(&instanceCreateInfo, 0, sizeof(instanceCreateInfo));
|
||||
instanceCreateInfo.type = XR_TYPE_INSTANCE_CREATE_INFO;
|
||||
#ifdef META_QUEST
|
||||
instanceCreateInfo.next = NULL;
|
||||
#endif
|
||||
#ifdef PICO_XR
|
||||
|
||||
XrInstanceCreateInfoAndroidKHR instanceCreateInfoAndroid = {XR_TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR};
|
||||
instanceCreateInfoAndroid.applicationVM = java.Vm;
|
||||
instanceCreateInfoAndroid.applicationActivity = java.ActivityObject;
|
||||
|
||||
instanceCreateInfo.next = (XrBaseInStructure*)&instanceCreateInfoAndroid;
|
||||
#endif
|
||||
|
||||
instanceCreateInfo.createFlags = 0;
|
||||
instanceCreateInfo.applicationInfo = appInfo;
|
||||
instanceCreateInfo.enabledApiLayerCount = 0;
|
||||
instanceCreateInfo.enabledApiLayerNames = NULL;
|
||||
instanceCreateInfo.enabledExtensionCount = numRequiredExtensions;
|
||||
instanceCreateInfo.enabledExtensionNames = requiredExtensionNames;
|
||||
|
||||
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
|
||||
{
|
||||
instanceCreateInfo.enabledExtensionCount = numRequiredExtensions_meta;
|
||||
instanceCreateInfo.enabledExtensionNames = requiredExtensionNames_meta;
|
||||
}
|
||||
else
|
||||
{
|
||||
instanceCreateInfo.enabledExtensionCount = numRequiredExtensions_pico;
|
||||
instanceCreateInfo.enabledExtensionNames = requiredExtensionNames_pico;
|
||||
}
|
||||
|
||||
XrResult initResult;
|
||||
OXR(initResult = xrCreateInstance(&instanceCreateInfo, &gAppState.Instance));
|
||||
|
@ -1636,17 +1642,18 @@ void TBXR_InitialiseOpenXR()
|
|||
OXR(pfnGetOpenGLESGraphicsRequirementsKHR(gAppState.Instance, gAppState.SystemId,
|
||||
&graphicsRequirements));
|
||||
|
||||
#ifdef META_QUEST
|
||||
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
|
||||
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;
|
||||
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
|
||||
{
|
||||
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
|
||||
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;
|
||||
|
||||
XrSystemProperties systemProperties = {};
|
||||
systemProperties.type = XR_TYPE_SYSTEM_PROPERTIES;
|
||||
systemProperties.next = &colorSpacePropertiesFB;
|
||||
OXR(xrGetSystemProperties(gAppState.Instance, gAppState.SystemId, &systemProperties));
|
||||
XrSystemProperties systemProperties = {};
|
||||
systemProperties.type = XR_TYPE_SYSTEM_PROPERTIES;
|
||||
systemProperties.next = &colorSpacePropertiesFB;
|
||||
OXR(xrGetSystemProperties(gAppState.Instance, gAppState.SystemId, &systemProperties));
|
||||
|
||||
ALOGV("System Color Space Properties: colorspace=%d", colorSpacePropertiesFB.colorSpace);
|
||||
#endif
|
||||
ALOGV("System Color Space Properties: colorspace=%d", colorSpacePropertiesFB.colorSpace);
|
||||
}
|
||||
|
||||
TBXR_InitialiseResolution();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <jni.h>
|
||||
#include <openxr/openxr.h>
|
||||
#include <openxr/openxr_platform.h>
|
||||
#include <openxr/openxr_oculus_helpers.h>
|
||||
#include <openxr_helpers.h>
|
||||
|
||||
#include <android/native_window_jni.h>
|
||||
#include <android/log.h>
|
||||
|
@ -228,6 +228,7 @@ typedef struct
|
|||
bool Focused;
|
||||
bool Visible;
|
||||
bool FrameSetup;
|
||||
char* OpenXRHMD;
|
||||
|
||||
float Width;
|
||||
float Height;
|
||||
|
|
4
Projects/Android/libs/arm64-v8a/readme.txt
Normal file
4
Projects/Android/libs/arm64-v8a/readme.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
Into this folder copy the libopenxr_loader.so for each HMD required to support, suffixed with the headset type:
|
||||
|
||||
libopenxr_loader_meta.so
|
||||
libopenxr_loader_pico.so
|
|
@ -4,23 +4,7 @@ include $(CLEAR_VARS)
|
|||
|
||||
LOCAL_MODULE := openxr_loader
|
||||
|
||||
ifeq ($(NDK_DEBUG),1)
|
||||
BUILDTYPE := Debug
|
||||
else
|
||||
BUILDTYPE := Release
|
||||
endif
|
||||
|
||||
|
||||
# Meta provide Debug and Release libraries
|
||||
ifeq ($(OPENXR_HMD),META_QUEST)
|
||||
LOCAL_SRC_FILES := ../../../../../OpenXR/Libs/Android/$(TARGET_ARCH_ABI)/$(BUILDTYPE)/lib$(LOCAL_MODULE).so
|
||||
endif
|
||||
|
||||
# Pico only provide the one loader
|
||||
ifeq ($(OPENXR_HMD),PICO_XR)
|
||||
LOCAL_SRC_FILES := ../../../../../OpenXR/libs/android.$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).so
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES := lib$(LOCAL_MODULE).so
|
||||
|
||||
# NOTE: This check is added to prevent the following error when running a "make clean" where
|
||||
# the prebuilt lib may have been deleted: "LOCAL_SRC_FILES points to a missing file"
|
||||
|
|
BIN
Projects/AndroidPrebuilt/jni/libopenxr_loader.so
Normal file
BIN
Projects/AndroidPrebuilt/jni/libopenxr_loader.so
Normal file
Binary file not shown.
|
@ -1,6 +1,7 @@
|
|||
|
||||
package com.drbeef.quakequest;
|
||||
|
||||
import static android.system.Os.setenv;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
|
@ -10,6 +11,7 @@ import java.io.FileReader;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Locale;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
|
@ -17,6 +19,7 @@ import android.app.Activity;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.content.res.AssetManager;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
|
@ -29,9 +32,25 @@ import android.support.v4.content.ContextCompat;
|
|||
|
||||
@SuppressLint("SdCardPath") public class GLES3JNIActivity extends Activity implements SurfaceHolder.Callback
|
||||
{
|
||||
private static String manufacturer = "";
|
||||
|
||||
// Load the gles3jni library right away to make sure JNI_OnLoad() gets called as the very first thing.
|
||||
static
|
||||
{
|
||||
manufacturer = Build.MANUFACTURER.toLowerCase(Locale.ROOT);
|
||||
if (manufacturer.contains("oculus")) // rename oculus to meta as this will probably happen in the future anyway
|
||||
{
|
||||
manufacturer = "meta";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//Load manufacturer specific loader
|
||||
System.loadLibrary("openxr_loader_" + manufacturer);
|
||||
setenv("OPENXR_HMD", manufacturer, true);
|
||||
} catch (Exception e)
|
||||
{}
|
||||
|
||||
System.loadLibrary( "quakequest" );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue