mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-25 05:21:00 +00:00
Last bit of OpenXR tidy up
This commit is contained in:
parent
dc17afde16
commit
fa220af9f7
4 changed files with 20 additions and 19 deletions
|
@ -377,7 +377,7 @@ bool VR_GetVRProjection(int eye, float zNear, float zFar, float* projection)
|
||||||
if (!vr.cgzoommode)
|
if (!vr.cgzoommode)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
|
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
|
||||||
{
|
{
|
||||||
XrFovf fov = {};
|
XrFovf fov = {};
|
||||||
for (int eye = 0; eye < ovrMaxNumEyes; eye++) {
|
for (int eye = 0; eye < ovrMaxNumEyes; eye++) {
|
||||||
|
@ -390,7 +390,8 @@ bool VR_GetVRProjection(int eye, float zNear, float zFar, float* projection)
|
||||||
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
||||||
fov, zNear, zFar);
|
fov, zNear, zFar);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (strstr(gAppState.OpenXRHMD, "pico") != NULL)
|
||||||
{
|
{
|
||||||
XrMatrix4x4f_CreateProjectionFov(
|
XrMatrix4x4f_CreateProjectionFov(
|
||||||
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
||||||
|
|
|
@ -928,7 +928,7 @@ void ovrApp_HandleSessionStateChanges(ovrApp* app, XrSessionState state) {
|
||||||
OXR(pfnPerfSettingsSetPerformanceLevelEXT(
|
OXR(pfnPerfSettingsSetPerformanceLevelEXT(
|
||||||
app->Session, XR_PERF_SETTINGS_DOMAIN_GPU_EXT, gpuPerfLevel));
|
app->Session, XR_PERF_SETTINGS_DOMAIN_GPU_EXT, gpuPerfLevel));
|
||||||
|
|
||||||
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
|
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
|
||||||
{
|
{
|
||||||
PFN_xrSetAndroidApplicationThreadKHR pfnSetAndroidApplicationThreadKHR = NULL;
|
PFN_xrSetAndroidApplicationThreadKHR pfnSetAndroidApplicationThreadKHR = NULL;
|
||||||
OXR(xrGetInstanceProcAddr(
|
OXR(xrGetInstanceProcAddr(
|
||||||
|
@ -1448,7 +1448,7 @@ void TBXR_InitRenderer( ) {
|
||||||
gAppState.Instance, gAppState.SystemId, XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO, &gAppState.ViewportConfig));
|
gAppState.Instance, gAppState.SystemId, XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO, &gAppState.ViewportConfig));
|
||||||
|
|
||||||
|
|
||||||
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
|
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
|
||||||
{
|
{
|
||||||
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
|
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
|
||||||
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;
|
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;
|
||||||
|
@ -1565,7 +1565,7 @@ void TBXR_InitRenderer( ) {
|
||||||
gAppState.Projections[eye].type = XR_TYPE_VIEW;
|
gAppState.Projections[eye].type = XR_TYPE_VIEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strstr(gAppState.OpenXRHMDModel, "Quest") == NULL) // PICO
|
if (strstr(gAppState.OpenXRHMD, "meta") == NULL) // PICO
|
||||||
{
|
{
|
||||||
xrGetInstanceProcAddr(gAppState.Instance,"xrSetConfigPICO", (PFN_xrVoidFunction*)(&pfnXrSetConfigPICO));
|
xrGetInstanceProcAddr(gAppState.Instance,"xrSetConfigPICO", (PFN_xrVoidFunction*)(&pfnXrSetConfigPICO));
|
||||||
xrGetInstanceProcAddr(gAppState.Instance,"xrGetConfigPICO", (PFN_xrVoidFunction*)(&pfnXrGetConfigPICO));
|
xrGetInstanceProcAddr(gAppState.Instance,"xrGetConfigPICO", (PFN_xrVoidFunction*)(&pfnXrGetConfigPICO));
|
||||||
|
@ -1598,7 +1598,7 @@ void TBXR_InitialiseOpenXR()
|
||||||
EglInitExtensions();
|
EglInitExtensions();
|
||||||
|
|
||||||
//First, find out which HMD we are using
|
//First, find out which HMD we are using
|
||||||
gAppState.OpenXRHMDModel = (char*)getenv("OPENXR_HMD");
|
gAppState.OpenXRHMD = (char*)getenv("OPENXR_HMD");
|
||||||
|
|
||||||
PFN_xrInitializeLoaderKHR xrInitializeLoaderKHR;
|
PFN_xrInitializeLoaderKHR xrInitializeLoaderKHR;
|
||||||
xrGetInstanceProcAddr(
|
xrGetInstanceProcAddr(
|
||||||
|
@ -1636,7 +1636,7 @@ void TBXR_InitialiseOpenXR()
|
||||||
instanceCreateInfo.applicationInfo = appInfo;
|
instanceCreateInfo.applicationInfo = appInfo;
|
||||||
instanceCreateInfo.enabledApiLayerCount = 0;
|
instanceCreateInfo.enabledApiLayerCount = 0;
|
||||||
instanceCreateInfo.enabledApiLayerNames = NULL;
|
instanceCreateInfo.enabledApiLayerNames = NULL;
|
||||||
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
|
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
|
||||||
{
|
{
|
||||||
instanceCreateInfo.enabledExtensionCount = numRequiredExtensions_meta;
|
instanceCreateInfo.enabledExtensionCount = numRequiredExtensions_meta;
|
||||||
instanceCreateInfo.enabledExtensionNames = requiredExtensionNames_meta;
|
instanceCreateInfo.enabledExtensionNames = requiredExtensionNames_meta;
|
||||||
|
@ -1689,7 +1689,7 @@ void TBXR_InitialiseOpenXR()
|
||||||
OXR(pfnGetOpenGLESGraphicsRequirementsKHR(gAppState.Instance, gAppState.SystemId,
|
OXR(pfnGetOpenGLESGraphicsRequirementsKHR(gAppState.Instance, gAppState.SystemId,
|
||||||
&graphicsRequirements));
|
&graphicsRequirements));
|
||||||
|
|
||||||
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
|
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
|
||||||
{
|
{
|
||||||
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
|
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
|
||||||
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;
|
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;
|
||||||
|
|
|
@ -224,7 +224,7 @@ typedef struct
|
||||||
bool Resumed;
|
bool Resumed;
|
||||||
bool Focused;
|
bool Focused;
|
||||||
bool FrameSetup;
|
bool FrameSetup;
|
||||||
char* OpenXRHMDModel;
|
char* OpenXRHMD;
|
||||||
|
|
||||||
float Width;
|
float Width;
|
||||||
float Height;
|
float Height;
|
||||||
|
|
|
@ -38,6 +38,7 @@ import java.util.Vector;
|
||||||
@SuppressLint("SdCardPath") public class GLES3JNIActivity extends Activity implements SurfaceHolder.Callback
|
@SuppressLint("SdCardPath") public class GLES3JNIActivity extends Activity implements SurfaceHolder.Callback
|
||||||
{
|
{
|
||||||
private static String game = "";
|
private static String game = "";
|
||||||
|
private static String manufacturer = "";
|
||||||
|
|
||||||
private boolean hapticsEnabled = false;
|
private boolean hapticsEnabled = false;
|
||||||
|
|
||||||
|
@ -67,17 +68,19 @@ import java.util.Vector;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
String manufacturer = Build.MANUFACTURER.toLowerCase(Locale.ROOT);
|
manufacturer = Build.MANUFACTURER.toLowerCase(Locale.ROOT);
|
||||||
if (manufacturer.contains("oculus") ||
|
if (manufacturer.contains("oculus")) // rename oculus to meta as this will probably happen in the future anyway
|
||||||
manufacturer.contains("meta"))
|
|
||||||
{
|
{
|
||||||
System.loadLibrary("openxr_loader_meta");
|
manufacturer = "meta";
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
//Load manufacturer specific loader
|
//Load manufacturer specific loader
|
||||||
System.loadLibrary("openxr_loader_" + manufacturer);
|
System.loadLibrary("openxr_loader_" + manufacturer);
|
||||||
}
|
setenv("OPENXR_HMD", manufacturer, true);
|
||||||
|
} catch (Exception e)
|
||||||
|
{}
|
||||||
|
|
||||||
System.loadLibrary( "openjk_" + game );
|
System.loadLibrary( "openjk_" + game );
|
||||||
}
|
}
|
||||||
|
@ -225,8 +228,7 @@ import java.util.Vector;
|
||||||
copy_asset("/sdcard/JKQuest/JK3/base", "z_vr_assets_jka.pk3", true);
|
copy_asset("/sdcard/JKQuest/JK3/base", "z_vr_assets_jka.pk3", true);
|
||||||
|
|
||||||
//Bummser's default configuration
|
//Bummser's default configuration
|
||||||
String model = android.os.Build.MODEL;
|
if (manufacturer.contains("meta")) {
|
||||||
if (model.contains("Quest")) {
|
|
||||||
//Meta Quest
|
//Meta Quest
|
||||||
copy_asset_with_rename("/sdcard/JKQuest/JK2/base", "openjo_sp_quest.cfg", "openjo_sp.cfg", false);
|
copy_asset_with_rename("/sdcard/JKQuest/JK2/base", "openjo_sp_quest.cfg", "openjo_sp.cfg", false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -261,8 +263,6 @@ import java.util.Vector;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setenv("JK_LIBDIR", getApplicationInfo().nativeLibraryDir, true);
|
setenv("JK_LIBDIR", getApplicationInfo().nativeLibraryDir, true);
|
||||||
|
|
||||||
setenv("OPENXR_HMD", model, true);
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue