engine/EngineVideoSky.c
/*	Called once per frame before drawing anything else
*/
Called once per frame before drawing anything else
Called once per frame before drawing anything else
void Sky_Draw(void)
{
	int	i;
	if (r_drawflat_cheatsafe || r_lightmap_cheatsafe || !cv_video_drawsky.bValue)
		return;
	if (cl.worldmodel && (cl.worldmodel->flags & MODEL_FLAG_3DSKY))
		Sky_Draw3DWorld();
#if 1
	for(i = 0; i < 6; i++)
	{
		skymins[0][i] = skymins[1][i] = 9999;
		skymaxs[0][i] = skymaxs[1][i] = -9999;
	}
	Fog_DisableGFog();
	VideoLayer_Disable(VIDEO_TEXTURE_2D);
	if(Fog_GetDensity() > 0)
		glColor3fv(Fog_GetColor());
	else
		glColor3fv(skyflatcolor);
	Sky_ProcessTextureChains();
	Sky_ProcessEntities();
	glColor3f(1.0f,1.0f,1.0f);
	VideoLayer_Enable(VIDEO_TEXTURE_2D);
	if(!r_fastsky.value && !(Fog_GetDensity() > 0 && r_skyfog.value >= 1))
	{
		VideoLayer_Disable(VIDEO_DEPTH_TEST);
		if(cSkyBoxName[0])
			Sky_DrawSkyBox();
		if(cv_video_drawclouds.value && gCloudTexture)
		{
			for(i = 0; i < 6; i++)
				if(skymins[0][i] < skymaxs[0][i] && skymins[1][i] < skymaxs[1][i])
					Sky_DrawFace(i);
		}
		VideoLayer_Enable(VIDEO_DEPTH_TEST);
	}
	Fog_EnableGFog();
#endif
}
void Sky_Draw ( void ) { int i ; if ( r_drawflat_cheatsafe || r_lightmap_cheatsafe || ! cv_video_drawsky . bValue ) return ; if ( cl . worldmodel && ( cl . worldmodel -> flags & MODEL_FLAG_3DSKY ) ) Sky_Draw3DWorld ( ) ; #if 1 for ( i = 0 ; i < 6 ; i ++ ) { skymins [ 0 ] [ i ] = skymins [ 1 ] [ i ] = 9999 ; skymaxs [ 0 ] [ i ] = skymaxs [ 1 ] [ i ] = -9999 ; } Fog_DisableGFog ( ) ; VideoLayer_Disable ( VIDEO_TEXTURE_2D ) ; if ( Fog_GetDensity ( ) > 0 ) glColor3fv ( Fog_GetColor ( ) ) ; else glColor3fv ( skyflatcolor ) ; Sky_ProcessTextureChains ( ) ; Sky_ProcessEntities ( ) ; glColor3f ( 1.0f , 1.0f , 1.0f ) ; VideoLayer_Enable ( VIDEO_TEXTURE_2D ) ; if ( ! r_fastsky . value && ! ( Fog_GetDensity ( ) > 0 && r_skyfog . value >= 1 ) ) { VideoLayer_Disable ( VIDEO_DEPTH_TEST ) ; if ( cSkyBoxName [ 0 ] ) Sky_DrawSkyBox ( ) ; if ( cv_video_drawclouds . value && gCloudTexture ) { for ( i = 0 ; i < 6 ; i ++ ) if ( skymins [ 0 ] [ i ] < skymaxs [ 0 ] [ i ] && skymins [ 1 ] [ i ] < skymaxs [ 1 ] [ i ] ) Sky_DrawFace ( i ) ; } VideoLayer_Enable ( VIDEO_DEPTH_TEST ) ; } Fog_EnableGFog ( ) ; #endif }
Called once per frame before drawing anything else
Called once per frame before drawing anything else
// In these special render modes, the sky faces are handled in the normal world/brush renderer // 3D skybox support. // Reset sky bounds. // Process world and bmodels: draw flat-shaded sky surfs, and update skybounds // Render slow sky: cloud layers or skybox // By default we use a skybox. // Draw the scrolling clouds...