/* ================ R_RenderScene RI.refdef must be set before the first call ================ */ void R_RenderScene( const ref_params_t *fd ) { RI.refdef = *fd; if( !cl.worldmodel && RI.drawWorld ) Host_Error( "R_RenderScene: NULL worldmodel\n" ); R_PushDlights(); R_SetupFrame(); R_SetupFrustum(); R_SetupGL(); R_Clear( ~0 ); R_MarkLeaves(); R_CheckFog(); R_DrawWorld(); CL_ExtraUpdate (); // don't let sound get messed up if going slow R_DrawEntitiesOnList(); R_DrawWaterSurfaces(); R_EndGL(); }
/* ================ R_RenderScene r_refdef must be set before the first call ================ */ void R_RenderScene (void) { R_SetupFrame (); R_SetFrustum (); R_SetupGL (); R_MarkLeaves (); // done here so we know if we're in water R_DrawWorld (); // adds static entities to the list S_ExtraUpdate (); // don't let sound get messed up if going slow R_DrawEntitiesOnList (); GL_DisableMultitexture(); R_RenderDlights (); R_DrawParticles (); #ifdef GLTEST Test_Draw (); #endif }
/* ================ R_RenderScene RI.refdef must be set before the first call fast version of R_RenderScene: no colors, no texcords etc ================ */ void R_RenderShadowScene( const ref_params_t *pparams, const plight_t *pl ) { // set the worldmodel worldmodel = GET_ENTITY( 0 )->model; if( !worldmodel ) { ALERT( at_error, "R_RenderShadowView: NULL worldmodel\n" ); return; } RI.refdef = *pparams; r_stats.num_passes++; r_stats.num_drawed_ents = 0; tr.framecount++; R_ShadowPassSetupFrame( pl ); R_ShadowPassSetupGL( pl ); pglClear( GL_DEPTH_BUFFER_BIT ); R_MarkLeaves(); R_ShadowPassDrawWorld( pl ); R_DrawGrass( GRASS_PASS_SHADOW ); R_ShadowPassDrawSolidEntities( pl ); R_ShadowPassEndGL(); }
/* ================ R_RenderScene r_refdef must be set before the first call ================ */ void R_RenderScene (void) { R_SetupFrame (); R_SetFrustum (); R_SetupGL (); R_MarkLeaves (); // done here so we know if we're in water /* Experimenting with lighting. glEnable(GL_LIGHTING); glShadeModel(GL_SMOOTH); glEnable(GL_LIGHT0); glEnable(GL_COLOR_MATERIAL); GLfloat specular[4] = {1, 1, 1, 1}; glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular); int li = 0; for (; li < 8; li += 1) { if (cl_dlights[li].die >= cl.time && cl_dlights[li].radius) { GLfloat pos[4] = { cl_dlights[li].origin[0], cl_dlights[li].origin[1], cl_dlights[li].origin[2], 1.0}; glLightfv(GL_LIGHT0+li, GL_POSITION, pos); glLightf(GL_LIGHT0+li, GL_CONSTANT_ATTENUATION, 0.1); glEnable(GL_LIGHT0+li); } else { break; } } */ R_DrawWorld (); // adds static entities to the list S_ExtraUpdate (); // don't let sound get messed up if going slow /*for (li -=1; li >= 0; li -= 1) { glDisable(GL_LIGHT0+li); } glDisable(GL_LIGHTING);*/ R_DrawEntitiesOnList (); GL_DisableMultitexture(); R_RenderDlights (); R_DrawParticles (); #ifdef GLTEST Test_Draw (); #endif }
/* ================ R_FindMirrors Build mirror chains for this frame ================ */ void R_FindMirrors( const ref_params_t *fd ) { vec3_t viewOrg, viewAng; if( !world.has_mirrors || RI.drawOrtho || !RI.drawWorld || RI.refdef.onlyClientDraw || !cl.worldmodel ) return; RI.refdef = *fd; // build the transformation matrix for the given view angles if( 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 ); 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_FindViewLeaf(); R_SetupFrustum(); R_MarkLeaves (); VectorCopy( RI.cullorigin, tr.modelorg ); RI.currententity = clgame.entities; RI.currentmodel = RI.currententity->model; R_RecursiveMirrorNode( cl.worldmodel->nodes, RI.clipFlags ); R_CheckEntitiesOnList(); }
/* ================ R_FindMirrors Build mirror chains for this frame ================ */ void R_FindMirrors( const ref_params_t *fd ) { if( !world.has_mirrors || RI.drawOrtho || !RI.drawWorld || RI.refdef.onlyClientDraw || !cl.worldmodel ) return; RI.refdef = *fd; // build the transformation matrix for the given view angles VectorCopy( RI.refdef.vieworg, RI.vieworg ); AngleVectors( RI.refdef.viewangles, RI.vforward, RI.vright, RI.vup ); R_FindViewLeaf(); R_SetupFrustum(); R_MarkLeaves (); VectorCopy( RI.cullorigin, tr.modelorg ); RI.currententity = clgame.entities; RI.currentmodel = RI.currententity->model; R_RecursiveMirrorNode( cl.worldmodel->nodes, RI.clipFlags ); R_CheckEntitiesOnList(); }