engine/EngineVideoShadow.c
/*	Draws a simple rectangular blob under an entity.
	TODO:
		Fade out blob shadow based on distance from ground.
*/
Draws a simple rectangular blob under an entity.
TODO:
Fade out blob shadow based on distance from ground.
Draws a simple rectangular blob under an entity . TODO : Fade out blob shadow based on distance from ground .
void Shadow_DrawBlob(ClientEntity_t *Entity)
{
	if (!cv_video_drawshadowblob.bValue)
		return;
	Light_GetSample(Entity->origin);
	if (!lightplane)
		return;
	VideoObjectVertex_t	voShadow[4] = { { { 0 } } };
	float fBlobHeight, fShadowScale[2];
	fShadowScale[0] = fShadowScale[1] = SHADOW_BLOB_SCALE;
	fBlobHeight = Entity->origin[2] - lightspot[2];
	VideoLayer_DepthMask(false);
	VideoLayer_PushMatrix();
	glTranslatef(Entity->origin[0], Entity->origin[1], Entity->origin[2]);
	glTranslatef(0, 0, -fBlobHeight + 0.1f);
	Video_ObjectVertex(&voShadow[0], -fShadowScale[0], fShadowScale[1], 0);
	Video_ObjectTexture(&voShadow[0], VIDEO_TEXTURE_DIFFUSE, 0, 0);
	Video_ObjectColour(&voShadow[0], 1.0f, 1.0f, 1.0f, 1.0f);
	Video_ObjectVertex(&voShadow[1], fShadowScale[0], fShadowScale[1], 0);
	Video_ObjectTexture(&voShadow[1], VIDEO_TEXTURE_DIFFUSE, 1.0f, 0);
	Video_ObjectColour(&voShadow[1], 1.0f, 1.0f, 1.0f, 1.0f);
	Video_ObjectVertex(&voShadow[2], fShadowScale[0], -fShadowScale[1], 0);
	Video_ObjectTexture(&voShadow[2], VIDEO_TEXTURE_DIFFUSE, 1.0f, 1.0f);
	Video_ObjectColour(&voShadow[2], 1.0f, 1.0f, 1.0f, 1.0f);
	Video_ObjectVertex(&voShadow[3], -fShadowScale[0], -fShadowScale[1], 0);
	Video_ObjectTexture(&voShadow[3], VIDEO_TEXTURE_DIFFUSE, 0, 1.0f);
	Video_ObjectColour(&voShadow[3], 1.0f, 1.0f, 1.0f, 1.0f);
	Video_DrawFill(voShadow, g_mBlobShadow, 0);
	glTranslatef(0, 0, fBlobHeight + 0.1);
	VideoLayer_PopMatrix();
	VideoLayer_DepthMask(true);
}
void Shadow_DrawBlob ( ClientEntity_t * Entity ) { if ( ! cv_video_drawshadowblob . bValue ) return ; Light_GetSample ( Entity -> origin ) ; if ( ! lightplane ) return ; VideoObjectVertex_t voShadow [ 4 ] = { { { 0 } } } ; float fBlobHeight , fShadowScale [ 2 ] ; fShadowScale [ 0 ] = fShadowScale [ 1 ] = SHADOW_BLOB_SCALE ; fBlobHeight = Entity -> origin [ 2 ] - lightspot [ 2 ] ; VideoLayer_DepthMask ( false ) ; VideoLayer_PushMatrix ( ) ; glTranslatef ( Entity -> origin [ 0 ] , Entity -> origin [ 1 ] , Entity -> origin [ 2 ] ) ; glTranslatef ( 0 , 0 , - fBlobHeight + 0.1f ) ; Video_ObjectVertex ( & voShadow [ 0 ] , - fShadowScale [ 0 ] , fShadowScale [ 1 ] , 0 ) ; Video_ObjectTexture ( & voShadow [ 0 ] , VIDEO_TEXTURE_DIFFUSE , 0 , 0 ) ; Video_ObjectColour ( & voShadow [ 0 ] , 1.0f , 1.0f , 1.0f , 1.0f ) ; Video_ObjectVertex ( & voShadow [ 1 ] , fShadowScale [ 0 ] , fShadowScale [ 1 ] , 0 ) ; Video_ObjectTexture ( & voShadow [ 1 ] , VIDEO_TEXTURE_DIFFUSE , 1.0f , 0 ) ; Video_ObjectColour ( & voShadow [ 1 ] , 1.0f , 1.0f , 1.0f , 1.0f ) ; Video_ObjectVertex ( & voShadow [ 2 ] , fShadowScale [ 0 ] , - fShadowScale [ 1 ] , 0 ) ; Video_ObjectTexture ( & voShadow [ 2 ] , VIDEO_TEXTURE_DIFFUSE , 1.0f , 1.0f ) ; Video_ObjectColour ( & voShadow [ 2 ] , 1.0f , 1.0f , 1.0f , 1.0f ) ; Video_ObjectVertex ( & voShadow [ 3 ] , - fShadowScale [ 0 ] , - fShadowScale [ 1 ] , 0 ) ; Video_ObjectTexture ( & voShadow [ 3 ] , VIDEO_TEXTURE_DIFFUSE , 0 , 1.0f ) ; Video_ObjectColour ( & voShadow [ 3 ] , 1.0f , 1.0f , 1.0f , 1.0f ) ; Video_DrawFill ( voShadow , g_mBlobShadow , 0 ) ; glTranslatef ( 0 , 0 , fBlobHeight + 0.1 ) ; VideoLayer_PopMatrix ( ) ; VideoLayer_DepthMask ( true ) ; }
Draws a simple rectangular blob under an entity.
Draws a simple rectangular blob under an entity .
// TODO: We ONLY want the bottom plane! Not the light sample... Simplify this? // TODO: This should be averaged out to the size of an entity.