/* ====================== 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_LockSurfaceScene( viewDef_t *parms ) { // set the matrix for world space to eye space R_SetViewMatrix( parms ); tr.lockSurfacesCmd.viewDef->worldSpace = parms->worldSpace; // update the view origin and axis, and all // the entity matricies for (viewEntity_t* 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 auto cmd = R_GetCommandBuffer<drawSurfsCommand_t>(); *cmd = tr.lockSurfacesCmd; }
/* ================ R_RenderView A view may be either the actual camera view, 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 ) { viewDef_t *oldView; if ( parms->renderView.width <= 0 || parms->renderView.height <= 0 ) { return; } tr.viewCount++; // save view in case we are a subview oldView = tr.viewDef; tr.viewDef = parms; tr.sortOffset = 0; // set the matrix for world space to eye space R_SetViewMatrix( tr.viewDef ); // the four sides of the view frustum are needed // for culling and portal visibility R_SetupViewFrustum(); // we need to set the projection matrix before doing // portal-to-screen scissor box calculations R_SetupProjection(); // identify all the visible portalAreas, and the entityDefs and // lightDefs that are in them and pass culling. static_cast<idRenderWorldLocal *>(parms->renderWorld)->FindViewLightsAndEntities(); // constrain the view frustum to the view lights and entities R_ConstrainViewFrustum(); // make sure that interactions exist for all light / entity combinations // that are visible // add any pre-generated light shadows, and calculate the light shader values R_AddLightSurfaces(); // adds ambient surfaces and create any necessary interaction surfaces to add to the light // lists R_AddModelSurfaces(); // any viewLight that didn't have visible surfaces can have it's shadows removed R_RemoveUnecessaryViewLights(); // sort all the ambient surfaces for translucency ordering R_SortDrawSurfs(); // generate any subviews (mirrors, cameras, etc) before adding this view if ( R_GenerateSubViews() ) { // if we are debugging subviews, allow the skipping of the // main view draw if ( r_subviewOnly.GetBool() ) { return; } } // write everything needed to the demo file if ( session->writeDemo ) { static_cast<idRenderWorldLocal *>(parms->renderWorld)->WriteVisibleDefs( tr.viewDef ); } // add the rendering commands for this viewDef R_AddDrawViewCmd( parms ); // restore view in case we are a subview tr.viewDef = oldView; }