/* =============== R_SetupFrame =============== */ void R_SetupFrame (void) { int edgecount; vrect_t vrect; float w, h; // don't allow cheats in multiplayer if (cl.maxclients > 1) Cvar_Set ("r_fullbright", "0"); R_AnimateLight (); r_framecount++; // build the transformation matrix for the given view angles VectorCopy (r_refdef.vieworg, r_origin); AngleVectors (r_refdef.viewangles, vpn, vright, vup); // current viewleaf r_oldviewleaf = r_viewleaf; r_viewleaf = Mod_PointInLeaf (r_origin, cl.worldmodel); V_SetContentsColor (r_viewleaf->contents); V_CalcBlend (); r_cache_thrash = false; c_brush_polys = 0; c_alias_polys = 0; }
/* =============== R_SetupScene -- johnfitz -- this is the stuff that needs to be done once per eye in stereo mode =============== */ void R_SetupScene (void) { R_PushDlights (); R_AnimateLight (); r_framecount++; R_SetupGL (); }
void CRender::FrameBegin( void ) { if ( !host_state.worldmodel ) return; // don't allow cheats in multiplayer #if !defined( _DEBUG ) if (cl.maxclients > 1) { // mat_fullbright.SetValue( 0 ); // mat_drawflat.SetValue( 0 ); mat_reversedepth.SetValue( 0 ); mat_luxels.SetValue( 0 ); mat_normals.SetValue( 0 ); } #endif // This has to be before R_AnimateLight because it uses it to // set the frame number of changed lightstyles r_framecount++; R_AnimateLight (); R_PushDlights(); if (!r_norefresh.GetInt()) { m_frameStartTime = Sys_FloatTime (); } UpdateStudioRenderConfig(); materialSystemInterface->BeginFrame(); g_pStudioRender->BeginFrame(); }
/* =============== R_SetupFrame =============== */ void R_SetupFrame (void) { // don't allow cheats in multiplayer r_fullbright.value = 0; r_lightmap.value = 0; if (!atoi(Info_ValueForKey(cl.serverinfo, "watervis"))) r_wateralpha.value = 1; R_AnimateLight (); r_framecount++; // build the transformation matrix for the given view angles VectorCopy (r_refdef.vieworg, r_origin); AngleVectors (r_refdef.viewangles, vpn, vright, vup); // current viewleaf r_oldviewleaf = r_viewleaf; r_viewleaf = Mod_PointInLeaf (r_origin, cl.worldmodel); V_SetContentsColor (r_viewleaf->contents); V_CalcBlend (); r_cache_thrash = false; c_brush_polys = 0; c_alias_polys = 0; }
/* =============== R_SetupFrame =============== */ static void R_SetupFrame( void ) { vec3_t viewOrg, viewAng; if( RP_NORMALPASS() && cl.thirdperson ) { vec3_t cam_ofs, vpn; clgame.dllFuncs.CL_CameraOffset( cam_ofs ); viewAng[PITCH] = cam_ofs[PITCH]; viewAng[YAW] = cam_ofs[YAW]; viewAng[ROLL] = 0; AngleVectors( viewAng, vpn, NULL, NULL ); VectorMA( RI.refdef.vieworg, -cam_ofs[ROLL], vpn, viewOrg ); } else { VectorCopy( RI.refdef.vieworg, viewOrg ); VectorCopy( RI.refdef.viewangles, viewAng ); } // build the transformation matrix for the given view angles VectorCopy( viewOrg, RI.vieworg ); AngleVectors( viewAng, RI.vforward, RI.vright, RI.vup ); // setup viewplane dist RI.viewplanedist = DotProduct( RI.vieworg, RI.vforward ); if( !r_lockcull->integer ) { VectorCopy( RI.vforward, RI.cull_vforward ); VectorCopy( RI.vright, RI.cull_vright ); VectorCopy( RI.vup, RI.cull_vup ); } R_AnimateLight(); R_RunViewmodelEvents(); // sort opaque entities by model type to avoid drawing model shadows under alpha-surfaces qsort( tr.solid_entities, tr.num_solid_entities, sizeof( cl_entity_t* ), R_SolidEntityCompare ); if( !gl_nosort->integer ) { // sort translucents entities by rendermode and distance qsort( tr.trans_entities, tr.num_trans_entities, sizeof( cl_entity_t* ), R_TransEntityCompare ); } // current viewleaf if( RI.drawWorld ) { RI.waveHeight = cl.refdef.movevars->waveHeight * 2.0f; // set global waveheight RI.isSkyVisible = false; // unknown at this moment if(!( RI.params & RP_OLDVIEWLEAF )) R_FindViewLeaf(); } }
/* =============== R_SetupScene =============== */ void R_SetupScene (void) { render_pass_index = 0; vkCmdBeginRenderPass(vulkan_globals.command_buffer, &vulkan_globals.main_render_pass_begin_infos[render_warp ? 0 : 1], VK_SUBPASS_CONTENTS_INLINE); R_PushDlights(); R_AnimateLight (); r_framecount++; R_SetupMatrix (); }
/* =============== R_SetupFrame =============== */ static void R_SetupFrame( void ) { vec3_t viewOrg, viewAng; VectorCopy( RI.refdef.vieworg, viewOrg ); VectorCopy( RI.refdef.viewangles, viewAng ); // build the transformation matrix for the given view angles VectorCopy( viewOrg, RI.vieworg ); AngleVectors( viewAng, RI.vforward, RI.vright, RI.vup ); // setup viewplane dist RI.viewplanedist = DotProduct( RI.vieworg, RI.vforward ); VectorCopy( RI.vieworg, RI.pvsorigin ); if( !r_lockcull->integer ) { VectorCopy( RI.vieworg, RI.cullorigin ); VectorCopy( RI.vforward, RI.cull_vforward ); VectorCopy( RI.vright, RI.cull_vright ); VectorCopy( RI.vup, RI.cull_vup ); } R_AnimateLight(); R_RunViewmodelEvents(); // sort opaque entities by model type to avoid drawing model shadows under alpha-surfaces qsort( tr.solid_entities, tr.num_solid_entities, sizeof( cl_entity_t* ), (void*)R_SolidEntityCompare ); if( !gl_nosort->integer ) { // sort translucents entities by rendermode and distance qsort( tr.trans_entities, tr.num_trans_entities, sizeof( cl_entity_t* ), (void*)R_TransEntityCompare ); } // current viewleaf if( RI.drawWorld ) { RI.waveHeight = cl.refdef.movevars->waveHeight * 2.0f; // set global waveheight RI.isSkyVisible = false; // unknown at this moment if(!( RI.params & RP_OLDVIEWLEAF )) R_FindViewLeaf(); } }
/* =============== R_SetupFrame =============== */ void R_SetupFrame (void) { int edgecount; vrect_t vrect; float w, h; // don't allow cheats in multiplayer if (cl.maxclients > 1) { Cvar_Set ("r_draworder", "0"); Cvar_Set ("r_fullbright", "0"); Cvar_Set ("r_ambient", "0"); Cvar_Set ("r_drawflat", "0"); } if (r_numsurfs.value) { if ((surface_p - surfaces) > r_maxsurfsseen) r_maxsurfsseen = surface_p - surfaces; Con_Printf ("Used %d of %d surfs; %d max\n", surface_p - surfaces, surf_max - surfaces, r_maxsurfsseen); } if (r_numedges.value) { edgecount = edge_p - r_edges; if (edgecount > r_maxedgesseen) r_maxedgesseen = edgecount; Con_Printf ("Used %d of %d edges; %d max\n", edgecount, r_numallocatededges, r_maxedgesseen); } r_refdef.ambientlight = r_ambient.value; if (r_refdef.ambientlight < 0) r_refdef.ambientlight = 0; if (!sv.active) r_draworder.value = 0; // don't let cheaters look behind walls R_CheckVariables (); R_AnimateLight (); r_framecount++; numbtofpolys = 0; // debugging #if 0 r_refdef.vieworg[0]= 80; r_refdef.vieworg[1]= 64; r_refdef.vieworg[2]= 40; r_refdef.viewangles[0]= 0; r_refdef.viewangles[1]= 46.763641357; r_refdef.viewangles[2]= 0; #endif // build the transformation matrix for the given view angles VectorCopy (r_refdef.vieworg, modelorg); VectorCopy (r_refdef.vieworg, r_origin); AngleVectors (r_refdef.viewangles, vpn, vright, vup); // current viewleaf r_oldviewleaf = r_viewleaf; r_viewleaf = Mod_PointInLeaf (r_origin, cl.worldmodel); r_dowarpold = r_dowarp; r_dowarp = r_waterwarp.value && (r_viewleaf->contents <= CONTENTS_WATER); if ((r_dowarp != r_dowarpold) || r_viewchanged || lcd_x.value) { if (r_dowarp) { if ((vid.width <= vid.maxwarpwidth) && (vid.height <= vid.maxwarpheight)) { vrect.x = 0; vrect.y = 0; vrect.width = vid.width; vrect.height = vid.height; R_ViewChanged (&vrect, sb_lines, vid.aspect); } else { w = vid.width; h = vid.height; if (w > vid.maxwarpwidth) { h *= (float)vid.maxwarpwidth / w; w = vid.maxwarpwidth; } if (h > vid.maxwarpheight) { h = vid.maxwarpheight; w *= (float)vid.maxwarpheight / h; } vrect.x = 0; vrect.y = 0; vrect.width = (int)w; vrect.height = (int)h; R_ViewChanged (&vrect, (int)((float)sb_lines * (h/(float)vid.height)), vid.aspect * (h / w) * ((float)vid.width / (float)vid.height)); } } else { vrect.x = 0; vrect.y = 0; vrect.width = vid.width; vrect.height = vid.height; R_ViewChanged (&vrect, sb_lines, vid.aspect); } r_viewchanged = false; } // start off with just the four screen edge clip planes R_TransformFrustum (); // save base values VectorCopy (vpn, base_vpn); VectorCopy (vright, base_vright); VectorCopy (vup, base_vup); VectorCopy (modelorg, base_modelorg); R_SetSkyFrame (); R_SetUpFrustumIndexes (); r_cache_thrash = false; // clear frame counts c_faceclip = 0; d_spanpixcount = 0; r_polycount = 0; r_drawnpolycount = 0; r_wholepolycount = 0; r_amodels_drawn = 0; r_outofsurfaces = 0; r_outofedges = 0; D_SetupFrame (); }
void R_SetupFrame (void) { int edgecount; vrect_t vrect; float w, h; int dtail = 2; // leilei - screen detail // don't allow cheats in multiplayer if (cl.maxclients > 1) { Cvar_Set (r_draworder, "0"); Cvar_Set (r_fullbright, "0"); Cvar_Set (r_ambient, "0"); Cvar_Set (r_drawflat, "0"); } if (r_numsurfs->value) { if ((surface_p - surfaces) > r_maxsurfsseen) r_maxsurfsseen = surface_p - surfaces; Con_Printf ("Used %d of %d surfs; %d max\n", surface_p - surfaces, surf_max - surfaces, r_maxsurfsseen); } if (r_numedges->value) { edgecount = edge_p - r_edges; if (edgecount > r_maxedgesseen) r_maxedgesseen = edgecount; Con_Printf ("Used %d of %d edges; %d max\n", edgecount, r_numallocatededges, r_maxedgesseen); } r_refdef.ambientlight = r_ambient->value; if (r_refdef.ambientlight < 0) r_refdef.ambientlight = 0; if (!sv.active) r_draworder->value = 0; // don't let cheaters look behind walls R_CheckVariables (); R_AnimateLight (); r_framecount++; numbtofpolys = 0; VectorCopy (r_refdef.vieworg, modelorg); VectorCopy (r_refdef.vieworg, r_origin); AngleVectors (r_refdef.viewangles, vpn, vright, vup); // current viewleaf r_oldviewleaf = r_viewleaf; r_viewleaf = Mod_PointInLeaf (r_origin, cl.worldmodel); scalefactoid = vid.height / vid.vconheight; // leilei r_dowarpold = r_dowarp; r_dowarp = r_waterwarp->value && (r_viewleaf->contents <= CONTENTS_WATER); inwat = s_underwater->value && (r_viewleaf->contents <= CONTENTS_WATER); if ((r_dowarp != r_dowarpold) || r_viewchanged || r_virtualmode->value || lcd_x->value || v_detail->value) { if (r_docrap == 1) { if ((vid.width <= vid.maxlowwidth) && (vid.height <= vid.maxlowheight)) { vrect.x = 0; vrect.y = 0; vrect.width = vid.width; vrect.height = vid.height; R_SetVrect (&vrect, &r_refdef.vrect, 0); R_ViewChanged (&vrect, 0, vid.aspect); } else { w = vid.width; h = vid.height; if (w > vid.maxlowwidth) { h *= (float)vid.maxlowwidth / w; w = vid.maxlowwidth; } if (h > vid.maxlowheight) { h = vid.maxlowheight; w *= (float)vid.maxlowheight / h; } vrect.x = 0; vrect.y = 0; vrect.width = (int)w; vrect.height = (int)h; R_SetVrect (&vrect, &r_refdef.vrect, ((float)vid.height)); R_ViewChanged (&vrect, 0, vid.aspect * (h / w) * ((float)vid.width / (float)vid.height)); } } else if(r_docrap > 1) { if ((vid.width <= vid.maxwarpwidth) && (vid.height <= vid.maxwarpheight)) { vrect.x = 0; vrect.y = 0; vrect.width = vid.width; vrect.height = vid.height; R_SetVrect (&vrect, &r_refdef.vrect, ((float)vid.height)); R_ViewChanged (&vrect, 0, vid.aspect); } else { w = vid.width; h = vid.height; if (w > vid.maxwarpwidth) { h *= (float)vid.maxwarpwidth / w; w = vid.maxwarpwidth; } if (h > vid.maxwarpheight) { h = vid.maxwarpheight; w *= (float)vid.maxwarpheight / h; } vrect.x = 0; vrect.y = 0; vrect.width = (int)w; vrect.height = (int)h; R_SetVrect (&vrect, &r_refdef.vrect, (h/(float)vid.height)); R_ViewChanged (&vrect, (h/(float)vid.height), vid.aspect * (h / w) * ((float)vid.width / (float)vid.height)); } } else { vrect.x = 0; vrect.y = 0; vrect.width = vid.width; vrect.height = vid.height; R_ViewChanged (&vrect, 0, vid.aspect); } r_viewchanged = false; } // start off with just the four screen edge clip planes R_TransformFrustum (); // save base values VectorCopy (vpn, base_vpn); VectorCopy (vright, base_vright); VectorCopy (vup, base_vup); VectorCopy (modelorg, base_modelorg); R_SetSkyFrame (); // Only do the sky moving on Quack R_SetUpFrustumIndexes (); r_cache_thrash = false; // clear frame counts c_faceclip = 0; d_spanpixcount = 0; r_polycount = 0; r_drawnpolycount = 0; r_wholepolycount = 0; r_amodels_drawn = 0; r_outofsurfaces = 0; r_outofedges = 0; // WarpPalette(); #ifdef EXPREND D_SetupFrameExperimental (); #else D_SetupFrame (); #endif }