mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
OpenXR - Get rid of VR tweaks
This commit is contained in:
parent
d5c9d15ec3
commit
468a193d6d
@ -1106,8 +1106,6 @@ if(ANDROID)
|
||||
Common/VR/VRMath.h
|
||||
Common/VR/VRRenderer.cpp
|
||||
Common/VR/VRRenderer.h
|
||||
Common/VR/VRTweaks.cpp
|
||||
Common/VR/VRTweaks.h
|
||||
)
|
||||
set(nativeExtraLibs ${nativeExtraLibs} openxr)
|
||||
endif()
|
||||
|
@ -350,11 +350,24 @@ bool IsFlatVRScene() {
|
||||
}
|
||||
|
||||
bool Is2DVRObject(float* projMatrix, bool ortho) {
|
||||
bool is2D = VR_TweakIsMatrixBigScale(projMatrix) ||
|
||||
VR_TweakIsMatrixIdentity(projMatrix) ||
|
||||
VR_TweakIsMatrixOneOrtho(projMatrix) ||
|
||||
VR_TweakIsMatrixOneScale(projMatrix) ||
|
||||
VR_TweakIsMatrixOneTransform(projMatrix);
|
||||
bool isOneTransform = (fabs(fabs(projMatrix[12]) - 1.0f) < EPSILON) && (fabs(fabs(projMatrix[13]) - 1.0f) < EPSILON) && (fabs(fabs(projMatrix[14]) - 1.0f) < EPSILON);;
|
||||
bool isOneScale = (fabs(projMatrix[0] - 1) < EPSILON) && (fabs(projMatrix[5] - 1) < EPSILON);
|
||||
bool isBigScale = (fabs(projMatrix[0]) > 10.0f) && (fabs(projMatrix[5]) > 10.0f);
|
||||
bool isOrtho = fabs(projMatrix[15] - 1) < EPSILON;
|
||||
|
||||
bool identity = true;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
float value = projMatrix[i * 4 + j];
|
||||
|
||||
// Other number than zero on non-diagonale
|
||||
if ((i != j) && (fabs(value) > EPSILON)) identity = false;
|
||||
// Other number than one on diagonale
|
||||
if ((i == j) && (fabs(value - 1.0f) > EPSILON)) identity = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool is2D = isBigScale || identity || isOrtho || isOneScale || isOneTransform;
|
||||
if (!is2D && !ortho) {
|
||||
VR_SetConfig(VR_CONFIG_3D_GEOMETRY_COUNT, VR_GetConfig(VR_CONFIG_3D_GEOMETRY_COUNT) + 1);
|
||||
}
|
||||
|
@ -1,45 +0,0 @@
|
||||
#include "VRMath.h"
|
||||
#include "VRTweaks.h"
|
||||
|
||||
bool VR_TweakIsMatrixBigScale(float* matrix) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
float value = matrix[i * 4 + i];
|
||||
if (fabs(value) < 10.0f) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VR_TweakIsMatrixIdentity(float* matrix) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
float value = matrix[i * 4 + j];
|
||||
|
||||
// Other number than zero on non-diagonale
|
||||
if ((i != j) && (fabs(value) > EPSILON)) return false;
|
||||
// Other number than one on diagonale
|
||||
if ((i == j) && (fabs(value - 1.0f) > EPSILON)) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VR_TweakIsMatrixOneOrtho(float* matrix) {
|
||||
float value = matrix[15];
|
||||
return fabs(value - 1) < EPSILON;
|
||||
}
|
||||
|
||||
bool VR_TweakIsMatrixOneScale(float* matrix) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
float value = matrix[i * 4 + i];
|
||||
if (fabs(value - 1) > EPSILON) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VR_TweakIsMatrixOneTransform(float* matrix) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
float value = matrix[12 + j];
|
||||
if (fabs(fabs(value) - 1.0f) > EPSILON) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
bool VR_TweakIsMatrixBigScale(float* matrix);
|
||||
bool VR_TweakIsMatrixIdentity(float* matrix);
|
||||
bool VR_TweakIsMatrixOneOrtho(float* matrix);
|
||||
bool VR_TweakIsMatrixOneScale(float* matrix);
|
||||
bool VR_TweakIsMatrixOneTransform(float* matrix);
|
Loading…
Reference in New Issue
Block a user