/*
===============
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();
	}
}
Example #2
0
/*
===============
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();
	}
}