Squashed commit of the following:

commit 57ebeb79e2
Author: Simon <simonbrown77@googlemail.com>
Date:   Thu Feb 16 22:07:38 2023 +0000

    Fixed issue with FrameSetup being called in the wrong place

    this seemed to limit the correctly submitted frames to 60 fps!

commit 16299b3f8a
Author: Simon <simonbrown77@googlemail.com>
Date:   Tue Feb 14 20:51:03 2023 +0000

    Get floor height offset correct for each game

commit fa74cf0559
Author: Simon <simonbrown77@googlemail.com>
Date:   Tue Feb 14 20:37:29 2023 +0000

    Clean exit on Pico & Quest

    and gold tier patron credit screen

commit deb2c35988
Author: Simon <simonbrown77@googlemail.com>
Date:   Mon Feb 13 22:22:29 2023 +0000

    Number of small changed

    - Hide crosshair if it isn't needed
    - Don't draw black bar when drawing FPS counter
    - added roll in to the weapon sprite
    - If drawing full screen mode always use orthographic projection

commit f1a165add7
Author: Simon <simonbrown77@googlemail.com>
Date:   Mon Feb 13 21:44:42 2023 +0000

    FInal changes to get MV rendering correctly

commit 936f079db8
Merge: 06a99dbaf f8c1f49e6
Author: Simon <simonbrown77@googlemail.com>
Date:   Mon Feb 13 11:29:23 2023 +0000

    Merge branch 'multiview' into direct-eye-buffers

commit 06a99dbafb
Author: Simon <simonbrown77@googlemail.com>
Date:   Mon Feb 13 11:26:44 2023 +0000

    Implementation using no additional frame buffers

commit f8c1f49e6f
Author: Simon <simonbrown77@googlemail.com>
Date:   Sun Feb 12 11:19:27 2023 +0000

    Failed attempt at multiview
This commit is contained in:
Simon 2023-02-16 22:09:25 +00:00
parent 578f7cfbcd
commit 7c37bad4ac
31 changed files with 232 additions and 101 deletions

View file

@ -85,8 +85,7 @@ void I_StartTic ()
I_GetEvent ();
}
void TBXR_FrameSetup();
void I_StartFrame ()
{
TBXR_FrameSetup();
}

View file

@ -184,8 +184,7 @@ int raze_main (int argc, char **argv)
const int result = GameMain();
#ifdef __ANDROID__
usleep(500* 1000);
exit(0);
usleep(1000* 1000);
#endif
return result;

View file

@ -75,6 +75,8 @@ extern bool vid_hdr_active;
void DrawVersionString ();
void TBXR_prepareEyeBuffer(int eye );
namespace OpenGLRenderer
{
FGLRenderer *GLRenderer;
@ -450,6 +452,7 @@ void OpenGLFrameBuffer::AmbientOccludeScene(float m5)
void OpenGLFrameBuffer::FirstEye()
{
GLRenderer->mBuffers->CurrentEye() = 0; // always begin at zero, in case eye count changed
TBXR_prepareEyeBuffer(0);
}
void OpenGLFrameBuffer::NextEye(int eyecount)
@ -590,7 +593,9 @@ void OpenGLFrameBuffer::Draw2D()
void OpenGLFrameBuffer::PostProcessScene(bool swscene, int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D)
{
#ifndef __MOBILE__
if (!swscene) GLRenderer->mBuffers->BlitSceneToTexture(); // Copy the resulting scene to the current post process texture
#endif
GLRenderer->PostProcessScene(fixedcm, flash, afterBloomDrawEndScene2D);
}

View file

@ -56,6 +56,11 @@ void FGLRenderer::RenderScreenQuad()
void FGLRenderer::PostProcessScene(int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D)
{
#ifdef __MOBILE__
if (afterBloomDrawEndScene2D) afterBloomDrawEndScene2D();
return;
#endif
int sceneWidth = mBuffers->GetSceneWidth();
int sceneHeight = mBuffers->GetSceneHeight();
@ -84,11 +89,15 @@ void FGLRenderer::AmbientOccludeScene(float m5)
void FGLRenderer::BlurScene(float gameinfobluramount)
{
if (gameinfobluramount == 0)
return;
int sceneWidth = mBuffers->GetSceneWidth();
int sceneHeight = mBuffers->GetSceneHeight();
GLPPRenderState renderstate(mBuffers);
screen->FirstEye();
auto vrmode = VRMode::GetVRMode(true);
int eyeCount = vrmode->mEyeCount;
for (int i = 0; i < eyeCount; ++i)
@ -112,17 +121,18 @@ void FGLRenderer::ClearTonemapPalette()
void FGLRenderer::Flush()
{
auto vrmode = VRMode::GetVRMode(true);
if (vrmode->mEyeCount == 1)
/* if (vrmode->mEyeCount == 1)
{
CopyToBackbuffer(nullptr, true);
}
else
*/
{
screen->FirstEye();
// Render 2D to eye textures
int eyeCount = vrmode->mEyeCount;
for (int eye_ix = 0; eye_ix < eyeCount; ++eye_ix)
{
screen->RenderState()->SetEye(eye_ix); // tell render state which eye's 2D we are drawing
screen->Draw2D();
if (eyeCount - eye_ix > 1)
mBuffers->NextEye(eyeCount);

View file

@ -36,6 +36,8 @@
EXTERN_CVAR(Int, gl_debug_level)
CVAR(Int, gl_multisample, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
void TBXR_prepareEyeBuffer(int eye );
namespace OpenGLRenderer
{
@ -672,7 +674,9 @@ void FGLRenderBuffers::CreateShadowMap()
void FGLRenderBuffers::BindSceneFB(bool sceneData)
{
#ifndef __MOBILE__
glBindFramebuffer(GL_FRAMEBUFFER, sceneData ? mSceneDataFB.handle : mSceneFB.handle);
#endif
}
//==========================================================================
@ -754,7 +758,9 @@ void FGLRenderBuffers::BindCurrentTexture(int index, int filter, int wrap)
void FGLRenderBuffers::BindCurrentFB()
{
#ifndef __MOBILE__
mPipelineFB[mCurrentPipelineTexture].Bind();
#endif
}
//==========================================================================
@ -765,8 +771,10 @@ void FGLRenderBuffers::BindCurrentFB()
void FGLRenderBuffers::BindNextFB()
{
#ifndef __MOBILE__
int out = (mCurrentPipelineTexture + 1) % NumPipelineTextures;
mPipelineFB[out].Bind();
#endif
}
//==========================================================================
@ -788,7 +796,9 @@ void FGLRenderBuffers::NextTexture()
void FGLRenderBuffers::BindOutputFB()
{
#ifndef __MOBILE__
glBindFramebuffer(GL_FRAMEBUFFER, 0);
#endif
}
//==========================================================================
@ -999,12 +1009,17 @@ void GLPPRenderState::PopGroup()
int FGLRenderBuffers::NextEye(int eyeCount)
{
#ifndef __MOBILE__
int nextEye = (mCurrentEye + 1) % eyeCount;
if (nextEye == mCurrentEye) return mCurrentEye;
BlitToEyeTexture(mCurrentEye);
mCurrentEye = nextEye;
BlitFromEyeTexture(mCurrentEye);
return mCurrentEye;
#else
TBXR_prepareEyeBuffer(1);
return 1;
#endif
}
} // namespace OpenGLRenderer

View file

@ -226,7 +226,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
// This must match the HWViewpointUniforms struct
layout(std140) uniform ViewpointUBO {
mat4 ProjectionMatrix;
mat4 ProjectionMatrix[NUM_VIEWS];
mat4 ViewMatrix;
mat4 NormalViewMatrix;
@ -400,7 +400,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
if (!lightbuffertype)
{
#ifdef __MOBILE__
vp_comb.Format("#version 310 es\n#define NO_CLIPDISTANCE_SUPPORT\n#define NUM_UBO_LIGHTS %d\n#define NUM_UBO_BONES %d\n", lightbuffersize, screen->mBones->GetBlockSize());
vp_comb.Format("#version 310 es\n#define NO_CLIPDISTANCE_SUPPORT\n#define NUM_UBO_LIGHTS %d\n#define NUM_UBO_BONES %d\n#define NUM_VIEWS 2\n", lightbuffersize, screen->mBones->GetBlockSize());
#else
vp_comb.Format("#version 330 core\n#define NUM_UBO_LIGHTS %d\n#define NUM_UBO_BONES %d\n", lightbuffersize, screen->mBones->GetBlockSize());
#endif
@ -421,6 +421,12 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
}
FString fp_comb = vp_comb;
#ifdef __MOBILE__
vp_comb << "#extension GL_OVR_multiview2 : enable\n"
"layout(num_views=NUM_VIEWS) in;\n";
#endif
vp_comb << defines << i_data.GetChars();
fp_comb << "$placeholder$\n" << defines << i_data.GetChars();

View file

@ -48,7 +48,6 @@
bool TBXR_IsFrameSetup();
void TBXR_prepareEyeBuffer(int eye );
void TBXR_finishEyeBuffer(int eye );
void TBXR_submitFrame();
EXTERN_CVAR(Int, vr_mode)
@ -381,22 +380,6 @@ bool FGLRenderer::QuadStereoCheckInitialRenderContextState()
void FGLRenderer::PresentOpenXR()
{
if (!TBXR_IsFrameSetup())
{
return;
}
for (int eye = 0; eye < 2; ++eye)
{
TBXR_prepareEyeBuffer(eye);
ClearBorders();
mBuffers->BindEyeTexture(eye, 0);
DrawPresentTexture(screen->mOutputLetterbox, true);
TBXR_finishEyeBuffer(eye);
}
TBXR_submitFrame();
}

View file

@ -216,7 +216,6 @@ protected:
uint8_t mSplitEnabled : 1;
uint8_t mBrightmapEnabled : 1;
int mEye;
int mLightIndex;
int mBoneIndexBase;
int mSpecialEffect;
@ -257,7 +256,6 @@ public:
void Reset()
{
mEye = 0;
mTextureEnabled = true;
mBrightmapEnabled = mGradientEnabled = mFogEnabled = mGlowEnabled = false;
mFogColor = 0xffffffff;
@ -314,11 +312,6 @@ public:
ClearClipSplit();
}
void SetEye(int eye)
{
mEye = eye;
}
void SetNormal(FVector3 norm)
{
mStreamData.uVertexNormal = { norm.X, norm.Y, norm.Z, 0.f };
@ -616,11 +609,6 @@ public:
mBias.mUnits = 0;
}
int GetEye()
{
return mEye;
}
private:
void SetMaterial(FMaterial *mat, int clampmode, int translation, int overrideshader)
{

View file

@ -98,19 +98,22 @@ void HWViewpointBuffer::Set2D(F2DDrawer *drawer, FRenderState &di, int width, in
matrices.mClipLine.X = -10000000.0f;
matrices.mShadowmapFilter = gl_shadowmap_filter;
if (isDrawingFullscreen && isIn2D) //fullscreen 2D
if (isDrawingFullscreen) //fullscreen 2D
{
matrices.mProjectionMatrix.ortho(0, (float) width, (float) height, 0, -1.0f, 1.0f);
matrices.mProjectionMatrix[0].ortho(0, (float) width, (float) height, 0, -1.0f, 1.0f);
matrices.mProjectionMatrix[1].ortho(0, (float) width, (float) height, 0, -1.0f, 1.0f);
}
else if (isIn2D) // HUD
{
auto vrmode = VRMode::GetVRMode(true);
matrices.mProjectionMatrix = vrmode->mEyes[di.GetEye()].GetHUDProjection(width, height);
matrices.mProjectionMatrix[0] = vrmode->mEyes[0].GetHUDProjection(width, height);
matrices.mProjectionMatrix[1] = vrmode->mEyes[1].GetHUDProjection(width, height);
}
else //Player Sprite
{
auto vrmode = VRMode::GetVRMode(true);
matrices.mProjectionMatrix = vrmode->mEyes[di.GetEye()].GetPlayerSpriteProjection(width, height);
matrices.mProjectionMatrix[0] = vrmode->mEyes[0].GetPlayerSpriteProjection(width, height);
matrices.mProjectionMatrix[1] = vrmode->mEyes[1].GetPlayerSpriteProjection(width, height);
}
matrices.CalcDependencies();
SetViewpoint(di, &matrices);

View file

@ -15,7 +15,7 @@ enum class ELightBlendMode : uint8_t
struct HWViewpointUniforms
{
VSMatrix mProjectionMatrix;
VSMatrix mProjectionMatrix[2];
VSMatrix mViewMatrix;
VSMatrix mNormalViewMatrix;
FVector4 mCameraPos;

View file

@ -172,6 +172,7 @@ float getHmdAdjustedHeightInMapUnit()
#define isqrt2 0.7071067812f
static VRMode vrmi_mono = { 1, 1.f, 1.f, 1.f,{ { 0.f, 1.f },{ 0.f, 0.f } } };
static VRMode vrmi_stereo = { 2, 1.f, 1.f, 1.f,{ { -.5f, 1.f },{ .5f, 1.f } } };
static VRMode vrmi_openxr = { 1, 1.f, 1.f, 1.f,{ { -.5f, 1.f },{ .5f, 1.f } } };
static VRMode vrmi_sbsfull = { 2, .5f, 1.f, 2.f,{ { -.5f, .5f },{ .5f, .5f } } };
static VRMode vrmi_sbssquished = { 2, .5f, 1.f, 1.f,{ { -.5f, 1.f },{ .5f, 1.f } } };
static VRMode vrmi_lefteye = { 1, 1.f, 1.f, 1.f, { { -.5f, 1.f },{ 0.f, 0.f } } };
@ -194,8 +195,10 @@ const VRMode *VRMode::GetVRMode(bool toscreen)
case VR_QUADSTEREO:
case VR_AMBERBLUE:
case VR_SIDEBYSIDELETTERBOX:
return &vrmi_stereo;
case VR_OPENXR:
return &vrmi_stereo;
return &vrmi_openxr;
case VR_SIDEBYSIDESQUISHED:
case VR_COLUMNINTERLEAVED:
@ -255,7 +258,7 @@ VSMatrix VREyeInfo::GetHUDProjection(int width, int height) const
VSMatrix new_projection;
new_projection.loadIdentity();
float stereo_separation = (vr_ipd * 0.5) * vr_hunits_per_meter() * vr_hud_stereo * (getEye() == 1 ? 1.0 : -1.0);
float stereo_separation = getStereoSeparation(vr_hud_stereo);
new_projection.translate(stereo_separation, 0, 0);
// doom_units from meters
@ -289,13 +292,19 @@ VSMatrix VREyeInfo::GetHUDProjection(int width, int height) const
new_projection.translate(-1.0, 1.0, 0);
new_projection.scale(2.0 / width, -2.0 / height, -1.0);
VSMatrix proj = GetProjection(RazeXR_GetFOV(), ratio, fovratio);
VSMatrix proj = GetCenterProjection(RazeXR_GetFOV(), ratio, fovratio);
proj.multMatrix(new_projection);
new_projection = proj;
return new_projection;
}
float VREyeInfo::getStereoSeparation(double stereoLevel) const
{
float stereo_separation = (vr_ipd * 0.5) * vr_hunits_per_meter() * stereoLevel * (getEye() == 1 ? -1.0 : 1.0);
return stereo_separation;
}
VSMatrix VREyeInfo::GetPlayerSpriteProjection(int width, int height) const
{
// now render the main view
@ -314,8 +323,7 @@ VSMatrix VREyeInfo::GetPlayerSpriteProjection(int width, int height) const
new_projection.loadIdentity();
float weapon_stereo_effect = 2.8f;
float stereo_separation = (vr_ipd * 0.5) * vr_hunits_per_meter() * weapon_stereo_effect * (getEye() == 1 ? -1.0 : 1.0);
new_projection.translate(stereo_separation, 0, 0);
new_projection.translate(getStereoSeparation(weapon_stereo_effect), 0, 0);
// doom_units from meters
new_projection.scale(
@ -334,6 +342,7 @@ VSMatrix VREyeInfo::GetPlayerSpriteProjection(int width, int height) const
new_projection.rotate(weaponangles[YAW] - hmdorientation[YAW], 0, 1, 0);
new_projection.rotate(weaponangles[PITCH], 1, 0, 0);
new_projection.rotate(weaponangles[ROLL], 0, 0, 1);
float weapon_scale = 0.6f;
@ -356,7 +365,7 @@ VSMatrix VREyeInfo::GetPlayerSpriteProjection(int width, int height) const
}
new_projection.scale(2.0 / width, -2.0 / height, -1.0);
VSMatrix proj = GetProjection(RazeXR_GetFOV(), ratio, fovratio);
VSMatrix proj = GetCenterProjection(RazeXR_GetFOV(), ratio, fovratio);
proj.multMatrix(new_projection);
new_projection = proj;
@ -375,7 +384,14 @@ int VREyeInfo::getEye() const
bool VR_GetVRProjection(int eye, float zNear, float zFar, float* projection);
VSMatrix VREyeInfo::GetProjection(float fov, float aspectRatio, float fovRatio) const
VSMatrix VREyeInfo::GetStereoProjection(float fov, float aspectRatio, float fovRatio) const
{
VSMatrix projection = GetCenterProjection(fov, aspectRatio, fovRatio);
projection.translate(getStereoSeparation(1.0f), 0, 0);
return projection;
}
VSMatrix VREyeInfo::GetCenterProjection(float fov, float aspectRatio, float fovRatio) const
{
VSMatrix result;
@ -417,6 +433,7 @@ VSMatrix VREyeInfo::GetProjection(float fov, float aspectRatio, float fovRatio)
/* virtual */
DVector3 VREyeInfo::GetViewShift(FRotator viewAngles) const
{
if (mShiftFactor == 0)
{
// pass-through for Mono view
@ -425,19 +442,18 @@ DVector3 VREyeInfo::GetViewShift(FRotator viewAngles) const
else
{
vec3_t angles;
VectorSet(angles, viewAngles.Pitch.Degrees(), viewAngles.Yaw.Degrees(), viewAngles.Roll.Degrees());
VectorSet(angles, viewAngles.Pitch.Degrees(), viewAngles.Yaw.Degrees(),
viewAngles.Roll.Degrees());
vec3_t v_forward, v_right, v_up;
AngleVectors(angles, v_forward, v_right, v_up);
vec3_t tmp;
VectorScale(v_right, getShift(), tmp);
float posforward=0;
float posside=0;
float dummy=0;
float posforward = 0;
float posside = 0;
float dummy = 0;
VR_GetMove(&dummy, &dummy, &posforward, &posside, &dummy, &dummy, &dummy, &dummy);
DVector3 eyeOffset(tmp[0], tmp[1], tmp[2]);
DVector3 eyeOffset;
eyeOffset.Zero();
if (vr_positional_tracking)
{

View file

@ -28,7 +28,8 @@ struct VREyeInfo
float mShiftFactor;
float mScaleFactor;
VSMatrix GetProjection(float fov, float aspectRatio, float fovRatio) const;
VSMatrix GetCenterProjection(float fov, float aspectRatio, float fovRatio) const;
VSMatrix GetStereoProjection(float fov, float aspectRatio, float fovRatio) const;
DVector3 GetViewShift(FRotator angles) const;
VSMatrix GetHUDProjection(int width, int height) const;
VSMatrix GetPlayerSpriteProjection(int width, int height) const;
@ -36,6 +37,8 @@ struct VREyeInfo
private:
float getShift() const;
int getEye() const;
float getStereoSeparation(double stereoLevel) const;
};
struct VRMode

View file

@ -68,7 +68,7 @@ CUSTOM_CVAR(Int, gl_ssao, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
self = 0;
}
CUSTOM_CVAR(Int, gl_ssao_portals, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CUSTOM_CVAR(Int, gl_ssao_portals, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
if (self < 0)
self = 0;

View file

@ -252,6 +252,11 @@ void DFrameBuffer::ScaleCoordsFromWindow(int16_t &x, int16_t &y)
void DFrameBuffer::FPSLimit()
{
//We don't need to limit FPS
#ifdef __MOBILE__
return;
#endif
using namespace std::chrono;
using namespace std::this_thread;

View file

@ -169,26 +169,6 @@ int RunEndoom()
S_StopMusic(true);
auto endoom = new FEndoomScreen(endoom_lump);
endoom->Render(true);
/* while(true)
{
I_GetEvent();
endoom->Update();
while (eventtail != eventhead)
{
event_t *ev = &events[eventtail];
eventtail = (eventtail + 1) & (MAXEVENTS - 1);
if (ev->type == EV_KeyDown || ev->type == EV_KeyUp)
{
return 0;
}
if (ev->type == EV_GUI_Event && (ev->subtype == EV_GUI_KeyDown || ev->subtype == EV_GUI_LButtonDown || ev->subtype == EV_GUI_RButtonDown || ev->subtype == EV_GUI_MButtonDown))
{
return 0;
}
}
}*/
return 0;
}

View file

@ -92,7 +92,7 @@ CVARD(Bool, cl_loadingscreens, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/dis
CVARD(Bool, cl_clampedpitch, true, CVAR_ARCHIVE, "clamp the view pitch to original ranges")
CUSTOM_CVARD(Int, cl_autoaim, 1, CVAR_ARCHIVE|CVAR_USERINFO, "enable/disable weapon autoaim")
CUSTOM_CVARD(Int, cl_autoaim, 0, CVAR_ARCHIVE|CVAR_USERINFO, "enable/disable weapon autoaim")
{
int automodes = (g_gameType & (GAMEFLAG_DUKECOMPAT | GAMEFLAG_BLOOD | GAMEFLAG_SW)) ? 2 : 1;
if (self < 0 || self > automodes) self = 1;

View file

@ -133,7 +133,7 @@ void DrawRateStuff()
int textScale = active_con_scale(twod_blend);
int rate_x = (screen->GetWidth() / 2) / textScale - (NewConsoleFont->StringWidth(&fpsbuff[0]) / 2);
twod->AddColorOnlyQuad(rate_x * textScale, 0, screen->GetWidth(), NewConsoleFont->GetHeight() * textScale, MAKEARGB(255, 0, 0, 0));
//twod->AddColorOnlyQuad(rate_x * textScale, 0, screen->GetWidth(), NewConsoleFont->GetHeight() * textScale, MAKEARGB(255, 0, 0, 0));
DrawText(twod_blend, NewConsoleFont, CR_WHITE, rate_x, screen->GetHeight() / 2, (char*)&fpsbuff[0],
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,

View file

@ -408,12 +408,15 @@ void DrawOverlays()
//==========================================================================
CVAR(String, drawtile, "", 0) // debug stuff. Draws the tile with the given number on top of thze HUD
void TBXR_FrameSetup();
void Display()
{
if (screen == nullptr || (!AppActive && (screen->IsFullscreen() || !vid_activeinbackground)))
{
return;
}
TBXR_FrameSetup();
FTexture* wipestart = nullptr;
if (nextwipe != wipe_None)

View file

@ -136,15 +136,18 @@ void RenderViewpoint(FRenderViewpoint& mainvp, IntRect* bounds, float fov, float
auto vrmode = VRMode::GetVRMode(mainview && toscreen);
const int eyeCount = vrmode->mEyeCount;
screen->FirstEye();
#ifndef __MOBILE__
hw_int_useindexedcolortextures = eyeCount > 1? false : *hw_useindexedcolortextures;
#else
hw_int_useindexedcolortextures = false;
#endif
for (int eye_ix = 0; eye_ix < eyeCount; ++eye_ix)
{
const auto& eye = vrmode->mEyes[eye_ix];
screen->SetViewportRects(bounds);
screen->RenderState()->SetEye(eye_ix);
if (mainview) // Bind the scene frame buffer and turn on draw buffers used by ssao
{
bool useSSAO = (gl_ssao != 0);
@ -164,7 +167,8 @@ void RenderViewpoint(FRenderViewpoint& mainvp, IntRect* bounds, float fov, float
di->Viewpoint.FieldOfView = FAngle::fromDeg(fov); // Set the real FOV for the current scene (it's not necessarily the same as the global setting in r_viewpoint)
// Stereo mode specific perspective projection
di->VPUniforms.mProjectionMatrix = eye.GetProjection(fov, ratio, fovratio);
di->VPUniforms.mProjectionMatrix[0] = vrmode->mEyes[0].GetStereoProjection(fov, ratio, fovratio);
di->VPUniforms.mProjectionMatrix[1] = vrmode->mEyes[1].GetStereoProjection(fov, ratio, fovratio);
// Stereo mode specific viewpoint adjustment

View file

@ -138,7 +138,8 @@ void HWDrawInfo::StartScene(FRenderViewpoint& parentvp, HWViewpointUniforms* uni
}
else
{
VPUniforms.mProjectionMatrix.loadIdentity();
VPUniforms.mProjectionMatrix[0].loadIdentity();
VPUniforms.mProjectionMatrix[1].loadIdentity();
VPUniforms.mViewMatrix.loadIdentity();
VPUniforms.mNormalViewMatrix.loadIdentity();
//VPUniforms.mViewHeight = viewheight;
@ -730,19 +731,29 @@ void HWDrawInfo::DrawScene(int drawmode, bool portal)
if (!gl_no_skyclear) portalState.RenderFirstSkyPortal(recursion, this, RenderState);
#ifndef __MOBILE__
//The original location of this call
RenderScene(RenderState);
if (applySSAO && RenderState.GetPassType() == GBUFFER_PASS)
{
screen->AmbientOccludeScene(VPUniforms.mProjectionMatrix.get()[5]);
screen->AmbientOccludeScene(VPUniforms.mProjectionMatrix[0].get()[5]);
screen->mViewpoints->Bind(RenderState, vpIndex);
}
#endif
// Handle all portals after rendering the opaque objects but before
// doing all translucent stuff
recursion++;
portalState.EndFrame(this, RenderState);
recursion--;
#ifdef __MOBILE__
//For some reason, doing this here this fixes the issue with portals being drawn out of order sometimes when using
// Direct to eye buffer rendering for multiview
RenderScene(RenderState);
#endif
RenderTranslucent(RenderState);
}

View file

@ -44,7 +44,7 @@ const char *GetVersionString();
#define VERSIONSTR "1.7pre"
#define RAZEXR_VERSIONSTR "RazeXR 0.1.5"
#define RAZEXR_VERSIONSTR "RazeXR 0.2.1"
// The version as seen in the Windows resource
#define RC_FILEVERSION 1,6,9999,0

View file

@ -51,6 +51,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "tilesetbuilder.h"
#include "nnexts.h"
extern int playerHeight; //Used to define player height for VR
BEGIN_BLD_NS
@ -604,6 +606,8 @@ void GameInterface::app_init()
{
mirrortile = tileGetTextureID(504);
playerHeight = 60;
GC::AddMarkerFunc(markgcroots);
InitCheats();

View file

@ -1547,6 +1547,7 @@ void ProcessInput(PLAYER* pPlayer)
DVector2 posXY;
sectortype* sect;
bool crosshairActive = false;
if (vr_6dof_weapons)
{
get_weapon_pos_and_angle(px, py, pz1, pz2, pitch, yaw);
@ -1577,6 +1578,8 @@ void ProcessInput(PLAYER* pPlayer)
if (hit.hitSector != nullptr)
{
crosshairActive = true;
double length = (hit.hitpos.XY() - actor->spr.pos.XY()).Length();
//Update the existing aiming sprites if there is one
@ -1603,6 +1606,16 @@ void ProcessInput(PLAYER* pPlayer)
}
}
if (!crosshairActive)
{
BloodStatIterator it(kStatCrosshair);
DBloodActor *crosshair = it.Next();
if (crosshair)
{
crosshair->spr.scale = DVector2(0, 0);
}
}
WeaponProcess(pPlayer);
if (vr_6dof_weapons)

View file

@ -2560,11 +2560,12 @@ static void processweapon(int snum, ESyncBits actions)
int shrunk = (pact->spr.scale.Y < 0.5);
//Aiming decal?!
if (pact)
if (pact && pact->isPlayer())
{
bool crosshairActive = false;
if (p->curr_weapon != KNEE_WEAPON)
{
if (pact->isPlayer() && vr_6dof_weapons && vr_6dof_crosshair)
if (vr_6dof_weapons && vr_6dof_crosshair)
{
float x, y, z1, z2, pitch, yaw;
get_weapon_pos_and_angle(x, y, z1, z2, pitch, yaw);
@ -2591,6 +2592,7 @@ static void processweapon(int snum, ESyncBits actions)
if (hit.hitSector != nullptr)
{
crosshairActive = true;
double length = (hit.hitpos.XY() - pact->spr.pos.XY()).Length();
//Update the existing aiming sprites if there is one
@ -2609,6 +2611,17 @@ static void processweapon(int snum, ESyncBits actions)
}
}
}
if (!crosshairActive)
{
//Update the existing aiming sprites if there is one
DukeStatIterator it(STAT_AIM_SPRITE);
DDukeActor* crosshair = it.Next();
if (crosshair)
{
crosshair->spr.scale = DVector2(0, 0);
}
}
}

View file

@ -3174,11 +3174,12 @@ static void processweapon(int snum, ESyncBits actions, sectortype* psectp)
int shrunk = (pact->spr.scale.Y < 0.125);
//Aiming decal?!
if (pact)
if (pact && pact->isPlayer())
{
bool crosshairActive = false;
if (p->curr_weapon != KNEE_WEAPON)
{
if (pact->isPlayer() && vr_6dof_weapons && vr_6dof_crosshair)
if (vr_6dof_weapons && vr_6dof_crosshair)
{
float x, y, z1, z2, pitch, yaw;
get_weapon_pos_and_angle(x, y, z1, z2, pitch, yaw);
@ -3204,6 +3205,7 @@ static void processweapon(int snum, ESyncBits actions, sectortype* psectp)
if (hit.hitSector != nullptr)
{
crosshairActive = true;
double length = (hit.hitpos.XY() - pact->spr.pos.XY()).Length();
//Update the existing aiming sprites if there is one
@ -3222,6 +3224,17 @@ static void processweapon(int snum, ESyncBits actions, sectortype* psectp)
}
}
}
if (!crosshairActive)
{
//Update the existing aiming sprites if there is one
DukeStatIterator it(STAT_AIM_SPRITE);
DDukeActor* crosshair = it.Next();
if (crosshair)
{
crosshair->spr.scale = DVector2(0, 0);
}
}
}
if (p->detonate_count > 0)

View file

@ -52,6 +52,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "tilesetbuilder.h"
#include "psky.h"
extern int playerHeight; //Used to define player height for VR
BEGIN_PS_NS
TObjPtr<DExhumedActor*> bestTarget;
@ -568,12 +571,11 @@ void GameInterface::SetupSpecialTextures(TilesetBuildInfo& info)
//
//
//---------------------------------------------------------------------------
void GameInterface::app_init()
{
GC::AddMarkerFunc(markgcroots);
playerHeight = 58;
#if 0
help_disabled = true;
#endif

View file

@ -2664,6 +2664,7 @@ sectdone:
DVector2 posXY;
sectortype* sect;
bool crosshairActive = false;
if (vr_6dof_weapons && nPlayer == 0)
{
get_weapon_pos_and_angle(px, py, pz1, pz2, pitch, yaw);
@ -2694,6 +2695,7 @@ sectdone:
if (hit.hitSector != nullptr)
{
crosshairActive = true;
double length = (hit.hitpos.XY() - pPlayerActor->spr.pos.XY()).Length();
//Update the existing aiming sprites if there is one
@ -2721,7 +2723,16 @@ sectdone:
}
pPlayerActor->spr.pos.Z += -pPlayerActor->viewzoffset;
}
if (!crosshairActive)
{
ExhumedStatIterator it(kStatCrosshair);
DExhumedActor *crosshair = it.Next();
if (crosshair)
{
crosshair->spr.scale = DVector2(0, 0);
}
}
MoveWeapons(nPlayer);

View file

@ -86,6 +86,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "interpolate.h"
//#include "crc32.h"
extern int playerHeight; //Used to define player height for VR
CVAR(Bool, sw_ninjahack, false, CVAR_ARCHIVE /*| CVAR_SERVERINFO*/);
CVAR(Bool, sw_darts, false, CVAR_ARCHIVE);
@ -249,7 +250,6 @@ void GameInterface::SetupSpecialTextures(TilesetBuildInfo& info)
//
//
//---------------------------------------------------------------------------
void GameInterface::app_init()
{
// these are frequently checked markers.
@ -306,6 +306,8 @@ void GameInterface::app_init()
userConfig.AddDefs.reset();
InitFX();
playerHeight = 58;
}
//---------------------------------------------------------------------------

View file

@ -7036,6 +7036,7 @@ void domovethings(void)
DVector2 posXY;
sectortype* sect;
bool crosshairActive = false;
if (vr_6dof_weapons)
{
get_weapon_pos_and_angle(px, py, pz1, pz2, pitch, yaw);
@ -7065,6 +7066,7 @@ void domovethings(void)
if (hit.hitSector != nullptr)
{
crosshairActive = true;
double length = (hit.hitpos.XY() - pp->actor->spr.pos.XY()).Length();
//Update the existing aiming sprites if there is one
@ -7093,6 +7095,16 @@ void domovethings(void)
}
}
if (!crosshairActive)
{
SWStatIterator it(STAT_CROSSHAIR);
DSWActor* crosshair = it.Next();
if (crosshair)
{
crosshair->spr.scale = DVector2(0, 0);
}
}
pSpriteControl(pp);
if (vr_6dof_weapons)

View file

@ -506,6 +506,9 @@ OptionMenu "OptionsMenu" protected
Submenu "$OS_TITLE", "os_Menu"
StaticText " "
Submenu "$MNU_ENGINECREDITS", "EngineCredits"
StaticText " "
Submenu "Team Beef Gold-Tier Patrons", "GoldTierCredits"
StaticText " "
SafeCommand "$OPTMNU_DEFAULTS", "reset2defaults"
SafeCommand "$OPTMNU_RESETTOSAVED", "reset2saved"
//Command "$OPTMNU_CONSOLE", "menuconsole"
@ -545,8 +548,8 @@ OptionMenu "VROptionsMenu" protected
{
Title "VR Options"
StaticText ""
//Option "Control Scheme", "vr_control_scheme", "ControlScheme"
//Option "Switch Sticks", "vr_switch_sticks", "YesNo"
Option "Control Scheme", "vr_control_scheme", "ControlScheme"
Option "Switch Sticks", "vr_switch_sticks", "YesNo"
StaticText ""
Option "Turning Mode", "vr_snapTurn", "TurningMode"
Option "Direction Mode", "vr_move_use_offhand", "DirectionMode"
@ -555,7 +558,7 @@ OptionMenu "VROptionsMenu" protected
StaticText ""
Option "Positional Tracking", "vr_positional_tracking", "YesNo"
Option "6DoF Weapons", "vr_6dof_weapons", "YesNo"
Option "VR Aim-Assist", "vr_6dof_crosshair", "YesNo"
Option "VR Crosshair", "vr_6dof_crosshair", "YesNo"
StaticText ""
StaticText "HUD"
@ -1741,9 +1744,9 @@ OptionMenu VideoModeMenu protected
Option "$VIDMNU_SCALEMODE", "vid_scalemode", "ScaleModes"
Slider "$VIDMNU_SCALEFACTOR", "vid_scalefactor", 0.25, 2.0, 0.25, 2
StaticText " "
Option "$DSPLYMNU_VSYNC", "vid_vsync", "OnOff"
Option "$VIDMNU_MAXFPS", "vid_maxfps", "MaxFps"
// StaticText " "
// Option "$DSPLYMNU_VSYNC", "vid_vsync", "OnOff"
// Option "$VIDMNU_MAXFPS", "vid_maxfps", "MaxFps"
StaticText ""
StaticText "$VIDMNU_CUSTOMRES"
@ -2108,6 +2111,34 @@ OptionMenu "MultiOptionsMenu"
}
*/
OptionMenu "GoldTierCredits"
{
title "$MNU_CREDITS"
StaticText ""
StaticText ""
StaticText ""
StaticText "Team Beef Gold Tier Patrons", 1
StaticText ""
StaticText "David Gohman Adam Luc Lowndes "
StaticText "Sign of the Beefcarver Naughtynate350 Mike Gummelt "
StaticText "CrashOrganism Russel Jones Joshua Vizanko "
StaticText "GD Dragon Saeed Al-Ali Gabe Miller "
StaticText "Jojo Mojo Andrew Remsen valedurandal "
StaticText "Brian Sifrar Dominik Studer Tommy Green "
StaticText "Cuttlersan Kalli Raya Lunar Stain "
StaticText "iS ken fountain Ben Otter "
StaticText "Emanuele Disco CharlieSayNo cranky_bum "
StaticText "Jamie S EDavey BMF "
StaticText "Jack Henaghan Loot Tester Charlie Bagwell "
StaticText "Braxus Ryan Milke Emile Tixeuil "
StaticText "Rex Keith Griffin Cole Edwards "
StaticText "Max Spellbound1998 mrpapa "
StaticText "Albert Valiev Duncan Mummery Stephen Sayles "
StaticText "Markus Dickmann HUSSEIN MOSTAFA Adam Davidek "
StaticText "Jack Henaghan Axis BayesianBroccoli "
StaticText "Montain Gral Markus Gunther "
}
OptionMenu "EngineCredits"
{
title "$MNU_CREDITS"

View file

@ -109,7 +109,7 @@ void main()
vTexCoord = TextureMatrix * vec4(parmTexCoord, 0.0, 1.0);
#endif
gl_Position = ProjectionMatrix * eyeCoordPos;
gl_Position = ProjectionMatrix[gl_ViewID_OVR] * eyeCoordPos;
#ifdef VULKAN_COORDINATE_SYSTEM
gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0;