Remove R_LockSurfaceScene(), clean up temporary changes

R_LockSurfaceScene() isn't used anymore, surface locking is implemented
differently (so it actually works now :-p)
This commit is contained in:
Daniel Gibson 2021-06-12 19:21:17 +02:00
parent a11b2d352c
commit c212148d41
5 changed files with 9 additions and 102 deletions

View file

@ -150,10 +150,9 @@ static void R_IssueRenderCommands( void ) {
// r_skipRender is usually more usefull, because it will still
// draw 2D graphics
if ( !r_skipBackEnd.GetBool() ) {
RB_ExecuteBackEndCommands( frameData->cmdHead ); // XXX: frameData must contain all the draw commands!
RB_ExecuteBackEndCommands( frameData->cmdHead );
}
//if ( ! r_lockSurfaces.GetBool() )
R_ClearCommandChain();
}
@ -214,28 +213,14 @@ This is the main 3D rendering command. A single scene may
have multiple views if a mirror, portal, or dynamic texture is present.
=============
*/
void R_AddDrawViewCmd( viewDef_t *parms, bool isMain ) {
void R_AddDrawViewCmd( viewDef_t *parms ) {
drawSurfsCommand_t *cmd;
cmd = (drawSurfsCommand_t *)R_GetCommandBuffer( sizeof( *cmd ) );
cmd->commandId = RC_DRAW_VIEW;
if(isMain && r_lockSurfaces.GetBool())
{
//parms = tr.lockSurfacesRealViewDef;
}
cmd->viewDef = parms;
//if ( parms->viewEntitys ) {
if ( isMain ) {
// save the command for r_lockSurfaces debugging
tr.lockSurfacesCmd = *cmd;
if(!r_lockSurfaces.GetBool()) {
//tr.lockSurfacesRenderView = parms->renderView;
//tr.lockSurfacesViewDef = *parms;
}
}
tr.pc.c_numViews++;
R_ViewStatistics( parms );
@ -245,62 +230,6 @@ void R_AddDrawViewCmd( viewDef_t *parms, bool isMain ) {
//=================================================================================
/*
======================
R_LockSurfaceScene
r_lockSurfaces allows a developer to move around
without changing the composition of the scene, including
culling. The only thing that is modified is the
view position and axis, no front end work is done at all
Add the stored off command again, so the new rendering will use EXACTLY
the same surfaces, including all the culling, even though the transformation
matricies have been changed. This allow the culling tightness to be
evaluated interactively.
======================
*/
void R_SetupViewFrustum( viewDef_t* viewDef );
void R_SetupProjection( viewDef_t * viewDef );
void R_LockSurfaceScene( viewDef_t *parms ) {
drawSurfsCommand_t *cmd;
viewEntity_t *vModel;
viewDef_t* oldView = tr.viewDef;
tr.viewDef = tr.lockSurfacesCmd.viewDef;
// set the matrix for world space to eye space
R_SetViewMatrix( parms );
// the four sides of the view frustum are needed
// for culling and portal visibility
R_SetupViewFrustum( tr.viewDef );
// we need to set the projection matrix before doing
// portal-to-screen scissor box calculations
R_SetupProjection(tr.viewDef);
tr.lockSurfacesCmd.viewDef->worldSpace = parms->worldSpace;
// update the view origin and axis, and all
// the entity matricies
for( vModel = tr.lockSurfacesCmd.viewDef->viewEntitys ; vModel ; vModel = vModel->next ) {
myGlMultMatrix( vModel->modelMatrix,
tr.lockSurfacesCmd.viewDef->worldSpace.modelViewMatrix,
vModel->modelViewMatrix );
}
// add the stored off surface commands again
cmd = (drawSurfsCommand_t *)R_GetCommandBuffer( sizeof( *cmd ) );
*cmd = tr.lockSurfacesCmd;
//cmd->viewDef = parms;
tr.viewDef = oldView;
}
/*
=============
R_CheckCvars
@ -760,8 +689,7 @@ void idRenderSystemLocal::EndFrame( int *frontEndMsec, int *backEndMsec ) {
R_ToggleSmpFrame();
// we can now release the vertexes used this frame
//if (! r_lockSurfaces.GetBool() )
vertexCache.EndFrame();
vertexCache.EndFrame();
if ( session->writeDemo ) {
session->writeDemo->WriteInt( DS_RENDER );

View file

@ -693,12 +693,6 @@ void idRenderWorldLocal::RenderScene( const renderView_t *renderView ) {
return;
}
const renderView_t *renderViewReal = renderView;
// if ( r_lockSurfaces.GetBool() ) {
// renderView = &tr.lockSurfacesViewDef.renderView;
// }
if ( renderView->fov_x <= 0 || renderView->fov_y <= 0 ) {
common->Error( "idRenderWorld::RenderScene: bad FOVs: %f, %f", renderView->fov_x, renderView->fov_y );
}
@ -749,14 +743,6 @@ void idRenderWorldLocal::RenderScene( const renderView_t *renderView ) {
parms->isMirror = true;
}
/*
if ( r_lockSurfaces.GetBool() ) {
R_LockSurfaceScene( parms );
//frameData->cmdHead
return;
}
*/
if ( r_lockSurfaces.GetBool() ) {
tr.lockSurfacesRealViewDef = *parms;
@ -779,6 +765,7 @@ void idRenderWorldLocal::RenderScene( const renderView_t *renderView ) {
parms->connectedAreas = origParms->connectedAreas;
} else {
// save current viewDef so it can be used if we enable r_lockSurfaces in the next frame
tr.lockSurfacesViewDef = *parms;
}
@ -792,8 +779,7 @@ void idRenderWorldLocal::RenderScene( const renderView_t *renderView ) {
// for mirrors / portals / shadows / environment maps
// this will also cause any necessary entities and lights to be
// updated to the demo file
//if ( !r_lockSurfaces.GetBool() )
R_RenderView( parms, true );
R_RenderView( parms );
// now write delete commands for any modified-but-not-visible entities, and
// add the renderView command to the demo

View file

@ -438,8 +438,6 @@ static void RB_SetBuffer( const void *data ) {
qglDrawBuffer( cmd->buffer );
//return; // XXX
// clear screen for debugging
// automatically enable this with several other debug tools
// that might leave unrendered portions of the screen

View file

@ -548,9 +548,8 @@ extern frameData_t *frameData;
//=======================================================================
void R_LockSurfaceScene( viewDef_t *parms );
void R_ClearCommandChain( void );
void R_AddDrawViewCmd( viewDef_t *parms, bool isMain=false );
void R_AddDrawViewCmd( viewDef_t *parms );
void R_ReloadGuis_f( const idCmdArgs &args );
void R_ListGuis_f( const idCmdArgs &args );
@ -1120,7 +1119,7 @@ MAIN
====================================================================
*/
void R_RenderView( viewDef_t *parms, bool isMain = false );
void R_RenderView( viewDef_t *parms );
// performs radius cull first, then corner cull
bool R_CullLocalBox( const idBounds &bounds, const float modelMatrix[16], int numPlanes, const idPlane *planes );

View file

@ -184,9 +184,6 @@ R_ToggleSmpFrame
====================
*/
void R_ToggleSmpFrame( void ) {
if ( r_lockSurfaces.GetBool() ) {
//return;
}
R_FreeDeferredTriSurfs( frameData );
// clear frame-temporary data
@ -1095,7 +1092,7 @@ a mirror / remote location, or a 3D view on a gui surface.
Parms will typically be allocated with R_FrameAlloc
================
*/
void R_RenderView( viewDef_t *parms, bool isMain ) {
void R_RenderView( viewDef_t *parms ) {
viewDef_t *oldView;
if ( parms->renderView.width <= 0 || parms->renderView.height <= 0 ) {
@ -1159,8 +1156,7 @@ void R_RenderView( viewDef_t *parms, bool isMain ) {
}
// add the rendering commands for this viewDef
//if(!r_lockSurfaces.GetBool() || !isMain)
R_AddDrawViewCmd( parms, isMain );
R_AddDrawViewCmd( parms );
// restore view in case we are a subview
tr.viewDef = oldView;