This commit is contained in:
Simon 2020-03-08 23:38:10 +00:00
parent f655ae2163
commit f983f1378d
6 changed files with 29 additions and 14 deletions

View File

@ -93,8 +93,8 @@ PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR;
//Let's go to the maximum! //Let's go to the maximum!
int CPU_LEVEL = 4; int CPU_LEVEL = 4;
int GPU_LEVEL = 4; int GPU_LEVEL = 4;
int NUM_MULTI_SAMPLES = 4; int NUM_MULTI_SAMPLES = 1;
float SS_MULTIPLIER = 1.25f; float SS_MULTIPLIER = 1.0f;
jclass clazz; jclass clazz;

View File

@ -556,7 +556,7 @@ ovrLayerCylinder2 BuildCylinderLayer( ovrRenderer * cylinderRenderer,
const float density = 4500.0f; const float density = 4500.0f;
const float rotateYaw = 0.0f; const float rotateYaw = 0.0f;
const float radius = 4.0f; const float radius = 4.0f;
const ovrVector3f translation = { 0.0f, playerHeight, -2.5f }; const ovrVector3f translation = { 0.0f, 0.0f, -2.5f };
ovrMatrix4f cylinderTransform = ovrMatrix4f cylinderTransform =
CylinderModelMatrix( textureWidth, textureHeight, translation, CylinderModelMatrix( textureWidth, textureHeight, translation,

View File

@ -136,7 +136,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
offhandangles[YAW] += (doomYawDegrees - hmdorientation[YAW]); offhandangles[YAW] += (doomYawDegrees - hmdorientation[YAW]);
if (vr_walkdirection == 0) { if (vr_walkdirection == 0) {
controllerYawHeading = -doomYawDegrees + offhandangles[YAW]; controllerYawHeading = offhandangles[YAW] - hmdorientation[YAW];
} }
else else
{ {
@ -157,7 +157,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
vec2_t v; vec2_t v;
rotateAboutOrigin(-positionDeltaThisFrame[0] * vr_positional_factor, rotateAboutOrigin(-positionDeltaThisFrame[0] * vr_positional_factor,
positionDeltaThisFrame[2] * vr_positional_factor, - hmdorientation[YAW], v); positionDeltaThisFrame[2] * vr_positional_factor, hmdorientation[YAW], v);
positional_movementSideways = v[0]; positional_movementSideways = v[0];
positional_movementForward = v[1]; positional_movementForward = v[1];

View File

@ -68,6 +68,7 @@ EXTERN_CVAR(Float, vr_snapTurn);
EXTERN_CVAR(Float, vr_ipd); EXTERN_CVAR(Float, vr_ipd);
double P_XYMovement(AActor *mo, DVector2 scroll); double P_XYMovement(AActor *mo, DVector2 scroll);
extern "C" void VR_GetMove( float *joy_forward, float *joy_side, float *hmd_forward, float *hmd_side, float *up, float *yaw, float *pitch, float *roll );
namespace s3d namespace s3d
@ -112,12 +113,31 @@ namespace s3d
doomYawDegrees = yaw; doomYawDegrees = yaw;
outViewShift[0] = outViewShift[1] = outViewShift[2] = 0; 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;
VSMatrix shiftMat; VSMatrix shiftMat;
shiftMat.loadIdentity(); shiftMat.loadIdentity();
shiftMat.rotate(GLRenderer->mAngles.Roll.Degrees, 0, 0, 1); shiftMat.rotate(GLRenderer->mAngles.Roll.Degrees, 0, 0, 1);
shiftMat.rotate(GLRenderer->mAngles.Pitch.Degrees, 1, 0, 0); shiftMat.rotate(GLRenderer->mAngles.Pitch.Degrees, 1, 0, 0);
shiftMat.rotate(GLRenderer->mAngles.Yaw.Degrees, 0, 1, 0); shiftMat.rotate(deltaYawDegrees, 0, 1, 0);
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);
double mult = eye == 0 ? -1.0 : 1.0; double mult = eye == 0 ? -1.0 : 1.0;
@ -131,7 +151,7 @@ namespace s3d
// We want to align those two heights here // We want to align those two heights here
const player_t & player = players[consoleplayer]; const player_t & player = players[consoleplayer];
double vh = player.viewheight; // Doom thinks this is where you are double vh = player.viewheight; // Doom thinks this is where you are
double hh = (hmdPosition[2] - vr_floor_offset) * vr_vunits_per_meter; // HMD is actually here double hh = (hmdPosition[1] - vr_floor_offset) * vr_vunits_per_meter; // HMD is actually here
eyeOffset[2] += hh - vh; eyeOffset[2] += hh - vh;
outViewShift[0] = eyeOffset[0]; outViewShift[0] = eyeOffset[0];
@ -370,8 +390,6 @@ namespace s3d
return int(m); return int(m);
} }
extern "C" void VR_GetMove( float *joy_forward, float *joy_side, float *hmd_forward, float *hmd_side, float *up, float *yaw, float *pitch, float *roll );
/* virtual */ /* virtual */
void OculusQuestMode::SetUp() const void OculusQuestMode::SetUp() const
{ {

View File

@ -222,10 +222,7 @@ extern int camtexcount;
void OpenGLFrameBuffer::Swap() void OpenGLFrameBuffer::Swap()
{ {
//glFinish(); glFinish();
glFlush();
/* bool swapbefore = gl_finishbeforeswap && camtexcount == 0; /* bool swapbefore = gl_finishbeforeswap && camtexcount == 0;
Finish.Reset(); Finish.Reset();

View File

@ -1 +1 @@
qzdoom --supersampling 1.2 -iwad wads/DOOM.WAD qzdoom -iwad wads/DOOM.WAD