Couple of small things

- New EndFrame function on Game
- Ensure any of the view effects render in fake mono (it is still stereo rendering to the single back buffer, but separation is now zero).
This commit is contained in:
Simon 2020-12-16 19:33:45 +00:00
parent a224e7424b
commit 7fead4caeb
7 changed files with 24 additions and 3 deletions

View file

@ -2460,6 +2460,9 @@ void idCommonLocal::Frame( void ) {
session->UpdateScreen( false ); session->UpdateScreen( false );
} }
//In case game library wants to do anything at the end of the frame
game->EndFrame();
/* /*
// process the rumble // process the rumble
for(int i = 0; i < 2; i++) { for(int i = 0; i < 2; i++) {

View file

@ -163,6 +163,9 @@ public:
// Runs a game frame, may return a session command for level changing, etc // Runs a game frame, may return a session command for level changing, etc
virtual gameReturn_t RunFrame( const usercmd_t *clientCmds ) = 0; virtual gameReturn_t RunFrame( const usercmd_t *clientCmds ) = 0;
// Indicates to the game library that the frame has now ended
virtual void EndFrame() = 0;
// Makes rendering and sound system calls to display for a given clientNum. // Makes rendering and sound system calls to display for a given clientNum.
virtual bool Draw( int clientNum ) = 0; virtual bool Draw( int clientNum ) = 0;

View file

@ -2698,6 +2698,16 @@ void idGameLocal::SortActiveEntityList( void ) {
sortPushers = false; sortPushers = false;
} }
/*
================
idGameLocal::RunFrame
================
*/
void idGameLocal::EndFrame()
{
}
/* /*
================ ================
idGameLocal::RunFrame idGameLocal::RunFrame

View file

@ -379,6 +379,7 @@ public:
virtual void CacheDictionaryMedia( const idDict *dict ); virtual void CacheDictionaryMedia( const idDict *dict );
virtual void SpawnPlayer( int clientNum ); virtual void SpawnPlayer( int clientNum );
virtual gameReturn_t RunFrame( const usercmd_t *clientCmds ); virtual gameReturn_t RunFrame( const usercmd_t *clientCmds );
virtual void EndFrame();
virtual bool Draw( int clientNum ); virtual bool Draw( int clientNum );
virtual escReply_t HandleESC( idUserInterface **gui ); virtual escReply_t HandleESC( idUserInterface **gui );
virtual idUserInterface *StartMenu( void ); virtual idUserInterface *StartMenu( void );

View file

@ -766,11 +766,12 @@ idPlayerView::RenderPlayerView
=================== ===================
*/ */
void idPlayerView::RenderPlayerView( idUserInterface *hud ) { void idPlayerView::RenderPlayerView( idUserInterface *hud ) {
const renderView_t *view = player->GetRenderView(); renderView_t *view = player->GetRenderView();
if (g_skipViewEffects.GetBool()) { if (g_skipViewEffects.GetBool()) {
SingleView( hud, view ); SingleView( hud, view );
} else { } else {
view->forceMono = true;
if (player->GetInfluenceMaterial() || player->GetInfluenceEntity()) { if (player->GetInfluenceMaterial() || player->GetInfluenceEntity()) {
InfluenceVision( hud, view ); InfluenceVision( hud, view );
} else if (gameLocal.time < dvFinishTime) { } else if (gameLocal.time < dvFinishTime) {
@ -778,6 +779,7 @@ void idPlayerView::RenderPlayerView( idUserInterface *hud ) {
} else if (player->PowerUpActive(BERSERK)) { } else if (player->PowerUpActive(BERSERK)) {
BerserkVision( hud, view ); BerserkVision( hud, view );
} else { } else {
view->forceMono = false;
SingleView( hud, view ); SingleView( hud, view );
} }
ScreenFade(); ScreenFade();

View file

@ -241,6 +241,7 @@ typedef struct renderView_s {
bool cramZNear; // for cinematics, we want to set ZNear much lower bool cramZNear; // for cinematics, we want to set ZNear much lower
bool forceUpdate; // for an update bool forceUpdate; // for an update
bool forceMono; // force mono
// time in milliseconds for shader effects and other time dependent rendering issues // time in milliseconds for shader effects and other time dependent rendering issues
int time; int time;

View file

@ -881,7 +881,8 @@ void R_SetViewMatrix( viewDef_t *viewDef ) {
if (eye < 2 && if (eye < 2 &&
!Doom3Quest_useScreenLayer()) !Doom3Quest_useScreenLayer() &&
!viewDef->renderView.forceMono)
{ {
origin += (eye == 0 ? 1.0f : -1.0f) * viewDef->renderView.viewaxis[1] * origin += (eye == 0 ? 1.0f : -1.0f) * viewDef->renderView.viewaxis[1] *
(cvarSystem->GetCVarFloat("vr_ipd") / 2.0f) * (cvarSystem->GetCVarFloat("vr_ipd") / 2.0f) *