mirror of
https://github.com/DrBeef/QuestZDoom.git
synced 2024-11-10 06:52:10 +00:00
Stereo Separation now working..
This commit is contained in:
parent
f983f1378d
commit
194865deb4
11 changed files with 155 additions and 152 deletions
24
.gitignore
vendored
24
.gitignore
vendored
|
@ -40,32 +40,12 @@ Projects/Android/.externalNativeBuild/ndkBuild/release/armeabi-v7a/ndkBuild_buil
|
|||
*.bin
|
||||
Projects/Android/.gradle/4.4/fileHashes/fileHashes.lock
|
||||
*.ser
|
||||
Projects/Android/.idea/codeStyles/Project.xml
|
||||
Projects/Android/.idea/*
|
||||
Projects/Android/.externalNativeBuild/ndkBuild/debug/armeabi-v7a/ndkBuild_build_command.txt
|
||||
Projects/Android/.externalNativeBuild/ndkBuild/release/armeabi-v7a/ndkBuild_build_command.txt
|
||||
Projects/Android/.externalNativeBuild/ndkBuild/debug/armeabi-v7a/ndkBuild_build_output.txt
|
||||
Projects/Android/.externalNativeBuild/ndkBuild/release/arm64-v8a/ndkBuild_build_output.txt
|
||||
Projects/Android/.idea/libraries/Gradle__android_android_21.xml
|
||||
Projects/Android/.idea/gradle.xml
|
||||
Projects/Android/.idea/modules.xml
|
||||
Projects/Android/.idea/misc.xml
|
||||
Projects/Android/.idea/workspace.xml
|
||||
Projects/Android/jni/src/gl4es/spec/xml/glxext.xml
|
||||
Projects/Android/jni/src/gl4es/spec/xml/wgl.xml
|
||||
Projects/Android/jni/src/gl4es/spec/xml/egl.xml
|
||||
Projects/Android/jni/src/gl4es/spec/xml/opengl.xml
|
||||
Projects/Android/jni/src/gl4es/spec/xml/gles-2.0.xml
|
||||
Projects/Android/.idea/vcs.xml
|
||||
Projects/Android/jni/src/gl4es/spec/xml/glx.xml
|
||||
Projects/Android/.idea/runConfigurations.xml
|
||||
Projects/Android/.gradle/4.6/fileHashes/fileHashes.lock
|
||||
Projects/Android/Android.iml
|
||||
Projects/Android/.gradle/vcsWorkingDirs/gc.properties
|
||||
Projects/Android/.idea/libraries/Gradle__com_android_support_support_annotations_24_2_0_jar.xml
|
||||
Projects/Android/.idea/libraries/Gradle__com_android_support_support_compat_24_2_0_aar.xml
|
||||
Projects/Android/.idea/encodings.xml
|
||||
Projects/Android/.idea/libraries/Gradle__com_android_support_support_core_utils_24_2_0_aar.xml
|
||||
Projects/Android/.idea/libraries/Gradle__android_android_24.xml
|
||||
Projects/Android/.idea/libraries/Gradle__com_android_support_support_compat_24_2_0.xml
|
||||
Projects/Android/.idea/libraries/Gradle__com_android_support_support_core_utils_24_2_0.xml
|
||||
Projects/Android/.gradle/*
|
||||
Projects/Android/Android.iml
|
||||
|
|
|
@ -57,7 +57,6 @@ bool weaponStabilised;
|
|||
float vr_weapon_pitchadjust;
|
||||
bool vr_walkdirection;
|
||||
float vr_snapturn_angle;
|
||||
float doomYawDegrees;
|
||||
vec3_t offhandangles;
|
||||
vec3_t offhandoffset;
|
||||
int ducked;
|
||||
|
@ -880,6 +879,11 @@ void getVROrigins(vec3_t _weaponoffset, vec3_t _weaponangles, vec3_t _hmdPositio
|
|||
|
||||
void VR_DoomMain(int argc, char** argv);
|
||||
|
||||
float VR_GetRawYaw()
|
||||
{
|
||||
return snapTurn;
|
||||
}
|
||||
|
||||
void VR_GetMove( float *joy_forward, float *joy_side, float *hmd_forward, float *hmd_side, float *up, float *yaw, float *pitch, float *roll )
|
||||
{
|
||||
*joy_forward = remote_movementForward;
|
||||
|
|
|
@ -49,7 +49,6 @@ extern bool weaponStabilised;
|
|||
extern float vr_weapon_pitchadjust;
|
||||
extern bool vr_walkdirection;
|
||||
extern float vr_snapturn_angle;
|
||||
extern float doomYawDegrees;
|
||||
|
||||
|
||||
extern vec3_t offhandangles;
|
||||
|
@ -77,6 +76,10 @@ bool useScreenLayer();
|
|||
void handleTrackedControllerButton(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, uint32_t button, int key);
|
||||
void Android_GetScreenRes(uint32_t *width, uint32_t *height);
|
||||
|
||||
void C_DoCommandC (const char *cmd);
|
||||
|
||||
float VR_GetRawYaw();
|
||||
|
||||
void setUseScreenLayer(bool use);
|
||||
|
||||
void processHaptics();
|
||||
|
|
|
@ -22,7 +22,6 @@ void handleTrackedControllerButton(ovrInputStateTrackedRemote * trackedRemoteSta
|
|||
Joy_GenerateButtonEvents(prevTrackedRemoteState->Buttons & button ? 1 : 0, trackedRemoteState->Buttons & button ? 1 : 0, 1, key);
|
||||
}
|
||||
|
||||
|
||||
static void Matrix4x4_Transform (const matrix4x4 *in, const float v[3], float out[3])
|
||||
{
|
||||
out[0] = v[0] * (*in)[0][0] + v[1] * (*in)[0][1] + v[2] * (*in)[0][2] + (*in)[0][3];
|
||||
|
|
|
@ -57,13 +57,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
else
|
||||
{
|
||||
//Dominant Grip works like a shift key
|
||||
if ((pDominantTrackedRemoteNew->Buttons & ovrButton_GripTrigger) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_GripTrigger)) {
|
||||
|
||||
dominantGripPushed = true;
|
||||
}
|
||||
|
||||
float distance = sqrtf(powf(pOffTracking->HeadPose.Pose.Position.x - pDominantTracking->HeadPose.Pose.Position.x, 2) +
|
||||
powf(pOffTracking->HeadPose.Pose.Position.y - pDominantTracking->HeadPose.Pose.Position.y, 2) +
|
||||
powf(pOffTracking->HeadPose.Pose.Position.z - pDominantTracking->HeadPose.Pose.Position.z, 2));
|
||||
|
@ -94,7 +87,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
|
||||
{
|
||||
vec2_t v;
|
||||
// rotateAboutOrigin(-weaponoffset[0], weaponoffset[2], (doomYawDegrees - hmdorientation[YAW]), v);
|
||||
rotateAboutOrigin(-weaponoffset[0], weaponoffset[2], VR_GetRawYaw(), v);
|
||||
weaponoffset[0] = v[0];
|
||||
weaponoffset[2] = v[1];
|
||||
}
|
||||
|
@ -102,8 +95,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
//Set gun angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
||||
const ovrQuatf quatRemote = pDominantTracking->HeadPose.Pose.Orientation;
|
||||
QuatToYawPitchRoll(quatRemote, vr_weapon_pitchadjust, weaponangles);
|
||||
weaponangles[YAW] += (doomYawDegrees - hmdorientation[YAW]);
|
||||
weaponangles[ROLL] *= -1.0f;
|
||||
weaponangles[YAW] -= VR_GetRawYaw();
|
||||
//weaponangles[ROLL] *= -1.0f;
|
||||
|
||||
|
||||
if (weaponStabilised)
|
||||
|
@ -114,12 +107,13 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
float zxDist = length(x, z);
|
||||
|
||||
if (zxDist != 0.0f && z != 0.0f) {
|
||||
VectorSet(weaponangles, -degrees(atanf(y / zxDist)), (doomYawDegrees - hmdorientation[YAW]) - degrees(atan2f(x, -z)), weaponangles[ROLL]);
|
||||
VectorSet(weaponangles, -degrees(atanf(y / zxDist)), VR_GetRawYaw() - degrees(atan2f(x, -z)), weaponangles[ROLL]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float controllerYawHeading = 0.0f;
|
||||
|
||||
//off-hand stuff
|
||||
{
|
||||
offhandoffset[0] = pOffTracking->HeadPose.Pose.Position.x - hmdPosition[0];
|
||||
|
@ -127,24 +121,23 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
offhandoffset[2] = pOffTracking->HeadPose.Pose.Position.z - hmdPosition[2];
|
||||
|
||||
vec2_t v;
|
||||
rotateAboutOrigin(-offhandoffset[0], offhandoffset[2], (doomYawDegrees - hmdorientation[YAW]), v);
|
||||
rotateAboutOrigin(-offhandoffset[0], offhandoffset[2], VR_GetRawYaw(), v);
|
||||
offhandoffset[0] = v[0];
|
||||
offhandoffset[2] = v[1];
|
||||
|
||||
QuatToYawPitchRoll(pOffTracking->HeadPose.Pose.Orientation, 15.0f, offhandangles);
|
||||
|
||||
offhandangles[YAW] += (doomYawDegrees - hmdorientation[YAW]);
|
||||
QuatToYawPitchRoll(pOffTracking->HeadPose.Pose.Orientation, 0.0f, offhandangles);
|
||||
offhandangles[YAW] -= VR_GetRawYaw();
|
||||
|
||||
if (vr_walkdirection == 0) {
|
||||
controllerYawHeading = offhandangles[YAW] - hmdorientation[YAW];
|
||||
controllerYawHeading = offhandangles[YAW];
|
||||
}
|
||||
else
|
||||
{
|
||||
controllerYawHeading = 0.0f;//-cl.viewangles[YAW];
|
||||
controllerYawHeading = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
//Right-hand specific stuff
|
||||
//Dominant-hand specific stuff
|
||||
{
|
||||
ALOGV(" Right-Controller-Position: %f, %f, %f",
|
||||
pDominantTracking->HeadPose.Pose.Position.x,
|
||||
|
@ -157,63 +150,16 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
|
||||
vec2_t v;
|
||||
rotateAboutOrigin(-positionDeltaThisFrame[0] * vr_positional_factor,
|
||||
positionDeltaThisFrame[2] * vr_positional_factor, hmdorientation[YAW], v);
|
||||
positionDeltaThisFrame[2] * vr_positional_factor, -(VR_GetRawYaw() + hmdorientation[YAW]), v);
|
||||
positional_movementSideways = v[0];
|
||||
positional_movementForward = v[1];
|
||||
|
||||
ALOGV(" positional_movementSideways: %f, positional_movementForward: %f",
|
||||
positional_movementSideways,
|
||||
positional_movementForward);
|
||||
|
||||
//Jump (B Button)
|
||||
handleTrackedControllerButton(pDominantTrackedRemoteNew,
|
||||
pDominantTrackedRemoteOld, domButton2, KEY_SPACE);
|
||||
|
||||
//We need to record if we have started firing primary so that releasing trigger will stop firing, if user has pushed grip
|
||||
//in meantime, then it wouldn't stop the gun firing and it would get stuck
|
||||
static bool firingPrimary = false;
|
||||
|
||||
{
|
||||
//Fire Primary
|
||||
if ((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger)) {
|
||||
|
||||
firingPrimary = (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Duck with A
|
||||
if ((pDominantTrackedRemoteNew->Buttons & domButton1) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & domButton1) &&
|
||||
ducked != DUCK_CROUCHED) {
|
||||
|
||||
ducked = (pDominantTrackedRemoteNew->Buttons & domButton1) ? DUCK_BUTTON : DUCK_NOTDUCKED;
|
||||
|
||||
//Trigger Duck
|
||||
}
|
||||
|
||||
//Weapon/Inventory Chooser
|
||||
static bool itemSwitched = false;
|
||||
if (between(-0.2f, pDominantTrackedRemoteNew->Joystick.x, 0.2f) &&
|
||||
(between(0.8f, pDominantTrackedRemoteNew->Joystick.y, 1.0f) ||
|
||||
between(-1.0f, pDominantTrackedRemoteNew->Joystick.y, -0.8f)))
|
||||
{
|
||||
if (!itemSwitched) {
|
||||
if (between(0.8f, pDominantTrackedRemoteNew->Joystick.y, 1.0f))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
itemSwitched = true;
|
||||
}
|
||||
} else {
|
||||
itemSwitched = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Left-hand specific stuff
|
||||
//Off-hand specific stuff
|
||||
{
|
||||
ALOGV(" Left-Controller-Position: %f, %f, %f",
|
||||
pOffTracking->HeadPose.Pose.Position.x,
|
||||
|
@ -245,32 +191,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
remote_movementSideways,
|
||||
remote_movementForward);
|
||||
|
||||
|
||||
//show help computer while X/A pressed
|
||||
if ((pOffTrackedRemoteNew->Buttons & offButton1) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton1)) {
|
||||
|
||||
//Help Computer
|
||||
}
|
||||
|
||||
|
||||
//Use (Action)
|
||||
if ((pOffTrackedRemoteNew->Buttons & ovrButton_Joystick) !=
|
||||
(pOffTrackedRemoteOld->Buttons & ovrButton_Joystick)
|
||||
&& (pOffTrackedRemoteNew->Buttons & ovrButton_Joystick)) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
//We need to record if we have started firing primary so that releasing trigger will stop definitely firing, if user has pushed grip
|
||||
//in meantime, then it wouldn't stop the gun firing and it would get stuck
|
||||
static bool firingPrimary = false;
|
||||
|
||||
//Run
|
||||
// handleTrackedControllerButton(pOffTrackedRemoteNew,
|
||||
// pOffTrackedRemoteOld,
|
||||
// ovrButton_Trigger, K_SHIFT);
|
||||
|
||||
// Turning logic
|
||||
static int increaseSnap = true;
|
||||
if (pDominantTrackedRemoteNew->Joystick.x > 0.6f)
|
||||
{
|
||||
|
@ -312,6 +233,111 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
decreaseSnap = true;
|
||||
}
|
||||
}
|
||||
|
||||
//Now handle all the buttons
|
||||
{
|
||||
//Dominant Grip works like a shift key
|
||||
bool dominantGripPushedOld = (pDominantTrackedRemoteNew->Buttons & ovrButton_GripTrigger) != 0;
|
||||
bool dominantGripPushedNew = (pDominantTrackedRemoteOld->Buttons & ovrButton_GripTrigger) != 0;
|
||||
|
||||
|
||||
//Weapon Chooser
|
||||
static bool itemSwitched = false;
|
||||
if (between(-0.2f, pDominantTrackedRemoteNew->Joystick.x, 0.2f) &&
|
||||
(between(0.8f, pDominantTrackedRemoteNew->Joystick.y, 1.0f) ||
|
||||
between(-1.0f, pDominantTrackedRemoteNew->Joystick.y, -0.8f)))
|
||||
{
|
||||
if (!itemSwitched) {
|
||||
if (between(0.8f, pDominantTrackedRemoteNew->Joystick.y, 1.0f))
|
||||
{
|
||||
C_DoCommandC("nextweap");
|
||||
}
|
||||
else
|
||||
{
|
||||
C_DoCommandC("prevweap");
|
||||
}
|
||||
|
||||
itemSwitched = true;
|
||||
}
|
||||
} else {
|
||||
itemSwitched = false;
|
||||
}
|
||||
|
||||
//Dominant Hand - Primary keys (no grip pushed)
|
||||
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger) != 0) && !dominantGripPushedOld ? 1 : 0,
|
||||
((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) != 0) && !dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_PAD_RTRIGGER);
|
||||
|
||||
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & domButton1) != 0) && !dominantGripPushedOld ? 1 : 0,
|
||||
((pDominantTrackedRemoteNew->Buttons & domButton1) != 0) && !dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_PAD_A);
|
||||
|
||||
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & domButton2) != 0) && !dominantGripPushedOld ? 1 : 0,
|
||||
((pDominantTrackedRemoteNew->Buttons & domButton2) != 0) && !dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_PAD_B);
|
||||
|
||||
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & ovrButton_Joystick) != 0) && !dominantGripPushedOld ? 1 : 0,
|
||||
((pDominantTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && !dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_MWHEELDOWN);
|
||||
|
||||
|
||||
|
||||
//Dominant Hand - Secondary keys (grip pushed)
|
||||
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger) != 0) && dominantGripPushedOld ? 1 : 0,
|
||||
((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) != 0) && dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_PAD_RSHOULDER);
|
||||
|
||||
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & domButton1) != 0) && dominantGripPushedOld ? 1 : 0,
|
||||
((pDominantTrackedRemoteNew->Buttons & domButton1) != 0) && dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_RSHIFT);
|
||||
|
||||
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & domButton2) != 0) && dominantGripPushedOld ? 1 : 0,
|
||||
((pDominantTrackedRemoteNew->Buttons & domButton2) != 0) && dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_RCTRL);
|
||||
|
||||
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & ovrButton_Joystick) != 0) && dominantGripPushedOld ? 1 : 0,
|
||||
((pDominantTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_ENTER);
|
||||
|
||||
|
||||
|
||||
|
||||
//Off Hand - Primary keys (no grip pushed)
|
||||
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & ovrButton_Trigger) != 0) && !dominantGripPushedOld ? 1 : 0,
|
||||
((pOffTrackedRemoteNew->Buttons & ovrButton_Trigger) != 0) && !dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_PAD_LTRIGGER);
|
||||
|
||||
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & offButton1) != 0) && !dominantGripPushedOld ? 1 : 0,
|
||||
((pOffTrackedRemoteNew->Buttons & offButton1) != 0) && !dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_PAD_X);
|
||||
|
||||
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & offButton2) != 0) && !dominantGripPushedOld ? 1 : 0,
|
||||
((pOffTrackedRemoteNew->Buttons & offButton2) != 0) && !dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_PAD_Y);
|
||||
|
||||
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & ovrButton_Joystick) != 0) && !dominantGripPushedOld ? 1 : 0,
|
||||
((pOffTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && !dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_SPACE);
|
||||
|
||||
|
||||
|
||||
//Off Hand - Secondary keys (grip pushed)
|
||||
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & ovrButton_Trigger) != 0) && dominantGripPushedOld ? 1 : 0,
|
||||
((pOffTrackedRemoteNew->Buttons & ovrButton_Trigger) != 0) && dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_PAD_LSHOULDER);
|
||||
|
||||
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & offButton1) != 0) && dominantGripPushedOld ? 1 : 0,
|
||||
((pOffTrackedRemoteNew->Buttons & offButton1) != 0) && dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_LSHIFT);
|
||||
|
||||
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & offButton2) != 0) && dominantGripPushedOld ? 1 : 0,
|
||||
((pOffTrackedRemoteNew->Buttons & offButton2) != 0) && dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_LCTRL);
|
||||
|
||||
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & ovrButton_Joystick) != 0) && dominantGripPushedOld ? 1 : 0,
|
||||
((pOffTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && dominantGripPushedNew ? 1 : 0,
|
||||
1, KEY_DEL);
|
||||
}
|
||||
}
|
||||
|
||||
//Save state
|
||||
|
|
|
@ -557,6 +557,11 @@ void ResetButtonStates ()
|
|||
}
|
||||
}
|
||||
|
||||
void C_DoCommandC (const char *cmd)
|
||||
{
|
||||
C_DoCommand(cmd, 0);
|
||||
}
|
||||
|
||||
void C_DoCommand (const char *cmd, int keynum)
|
||||
{
|
||||
FConsoleCommand *com;
|
||||
|
|
|
@ -84,6 +84,7 @@ void C_ClearDelayedCommands();
|
|||
|
||||
// Process a single console command. Does not handle wait.
|
||||
void C_DoCommand (const char *cmd, int keynum=0);
|
||||
extern "C" void C_DoCommandC (const char *cmd); // Added for C code to call
|
||||
|
||||
FExecList *C_ParseExecFile(const char *file, FExecList *source);
|
||||
void C_SearchForPullins(FExecList *exec, const char *file, class FCommandLine &args);
|
||||
|
|
|
@ -110,38 +110,28 @@ namespace s3d
|
|||
/* virtual */
|
||||
void OculusQuestEyePose::GetViewShift(FLOATTYPE yaw, FLOATTYPE outViewShift[3]) const
|
||||
{
|
||||
doomYawDegrees = yaw;
|
||||
outViewShift[0] = outViewShift[1] = outViewShift[2] = 0;
|
||||
|
||||
// Pitch and Roll are identical between OpenVR and Doom worlds.
|
||||
// But yaw can differ, depending on starting state, and controller movement.
|
||||
float doomYawDegrees = yaw;
|
||||
float vrYawDegrees = hmdorientation[YAW];
|
||||
deltaYawDegrees = doomYawDegrees - vrYawDegrees;
|
||||
while (deltaYawDegrees > 180)
|
||||
deltaYawDegrees -= 360;
|
||||
while (deltaYawDegrees < -180)
|
||||
deltaYawDegrees += 360;
|
||||
float doomYawDegrees = VR_GetRawYaw() + hmdorientation[YAW];
|
||||
while (doomYawDegrees > 180)
|
||||
doomYawDegrees -= 360;
|
||||
while (doomYawDegrees < -180)
|
||||
doomYawDegrees += 360;
|
||||
|
||||
VSMatrix shiftMat;
|
||||
shiftMat.loadIdentity();
|
||||
|
||||
shiftMat.rotate(GLRenderer->mAngles.Roll.Degrees, 0, 0, 1);
|
||||
shiftMat.rotate(GLRenderer->mAngles.Roll.Degrees, 0, 1, 0);
|
||||
shiftMat.rotate(GLRenderer->mAngles.Pitch.Degrees, 1, 0, 0);
|
||||
shiftMat.rotate(deltaYawDegrees, 0, 1, 0);
|
||||
shiftMat.rotate(-doomYawDegrees, 0, 0, 1);
|
||||
double pixelstretch = level.info ? level.info->pixelstretch : 1.2;
|
||||
shiftMat.scale(pixelstretch, pixelstretch, 1.0);
|
||||
// permute axes
|
||||
float permute[] = { // Convert from OpenVR to Doom axis convention, including mirror inversion
|
||||
-1, 0, 0, 0, // X-right in VR -> X-left in Doom
|
||||
0, 0, 1, 0, // Z-backward in VR -> Y-backward in Doom
|
||||
0, 1, 0, 0, // Y-up in VR -> Z-up in Doom
|
||||
0, 0, 0, 1};
|
||||
shiftMat.multMatrix(permute);
|
||||
shiftMat.scale(1.0, pixelstretch, 1.0);
|
||||
|
||||
double mult = eye == 0 ? -1.0 : 1.0;
|
||||
double mult = eye == 0 ? 1.0 : -1.0;
|
||||
|
||||
LSVec3 vec((vr_ipd * 0.5) * vr_vunits_per_meter * mult, 0, 0);
|
||||
LSVec3 vec(0, (vr_ipd * 0.5) * vr_vunits_per_meter * mult, 0);
|
||||
LSMatrix44 mat(shiftMat);
|
||||
|
||||
LSVec3 eyeOffset = mat * vec;
|
||||
|
@ -423,7 +413,6 @@ namespace s3d
|
|||
vr_weapon_pitchadjust = vr_weaponRotate;
|
||||
vr_snapturn_angle = vr_snapTurn;
|
||||
vr_walkdirection = !vr_moveFollowsOffHand;
|
||||
doomYawDegrees = GLRenderer->mAngles.Yaw.Degrees;
|
||||
getTrackedRemotesOrientation(vr_control_scheme);
|
||||
|
||||
player_t* player = r_viewpoint.camera ? r_viewpoint.camera->player : nullptr;
|
||||
|
|
|
@ -222,14 +222,11 @@ extern int camtexcount;
|
|||
|
||||
void OpenGLFrameBuffer::Swap()
|
||||
{
|
||||
glFinish();
|
||||
|
||||
/* bool swapbefore = gl_finishbeforeswap && camtexcount == 0;
|
||||
bool swapbefore = gl_finishbeforeswap && camtexcount == 0;
|
||||
Finish.Reset();
|
||||
Finish.Clock();
|
||||
#ifndef __MOBILE__
|
||||
|
||||
if (swapbefore) glFinish();
|
||||
#endif
|
||||
|
||||
#ifdef USE_GL_HW_BUFFERS
|
||||
GLRenderer->GPUDropSync();
|
||||
|
@ -237,18 +234,14 @@ void OpenGLFrameBuffer::Swap()
|
|||
|
||||
SwapBuffers();
|
||||
|
||||
#ifndef __MOBILE__
|
||||
if (!swapbefore) glFinish();
|
||||
#endif
|
||||
|
||||
#ifdef __MOBILE__
|
||||
gl_RenderState.SetVertexBuffer(NULL);
|
||||
#endif
|
||||
|
||||
Finish.Unclock();
|
||||
camtexcount = 0;
|
||||
FHardwareTexture::UnbindAll();
|
||||
mDebug->Update();
|
||||
*/
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -310,6 +310,7 @@ void NoSDLGLFB::NewRefreshRate ()
|
|||
|
||||
void NoSDLGLFB::SwapBuffers()
|
||||
{
|
||||
//No swapping required
|
||||
}
|
||||
|
||||
int NoSDLGLFB::GetClientWidth()
|
||||
|
|
|
@ -878,13 +878,15 @@ void DFrameBuffer::DrawRateStuff ()
|
|||
char fpsbuff[40];
|
||||
int chars;
|
||||
int rate_x;
|
||||
int rate_y;
|
||||
|
||||
int textScale = active_con_scale();
|
||||
|
||||
chars = mysnprintf (fpsbuff, countof(fpsbuff), "%2" PRIu64 " ms (%3" PRIu64 " fps)", howlong, LastCount);
|
||||
rate_x = Width / textScale - ConFont->StringWidth(&fpsbuff[0]);
|
||||
Clear (rate_x * textScale, 0, Width, ConFont->GetHeight() * textScale, GPalette.BlackIndex, 0);
|
||||
DrawText (ConFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0],
|
||||
rate_x = (int)(Width/2.0) - (ConFont->StringWidth(&fpsbuff[0]) * textScale / 2.0);
|
||||
rate_y = (int)((Height/2.0));
|
||||
//Clear (rate_x, rate_y, ConFont->StringWidth(&fpsbuff[0]) * textScale, ConFont->GetHeight() * textScale, GPalette.BlackIndex, 0);
|
||||
DrawText (ConFont, CR_WHITE, rate_x, rate_y, (char *)&fpsbuff[0],
|
||||
DTA_VirtualWidth, screen->GetWidth() / textScale,
|
||||
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
||||
DTA_KeepRatio, true, TAG_DONE);
|
||||
|
|
Loading…
Reference in a new issue