13 Apr 2011
This commit is contained in:
parent
0646157b0f
commit
ef4b50cc67
|
@ -173,7 +173,7 @@ typedef struct msurface_s
|
||||||
int lightmaptexturenum;
|
int lightmaptexturenum;
|
||||||
byte styles[MAXLIGHTMAPS];
|
byte styles[MAXLIGHTMAPS];
|
||||||
int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
|
int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
|
||||||
qboolean cached_dlight; // true if dynamic light in cache
|
struct msurface_s *lightmapchain; // for new dlights rendering (was cached_dlight)
|
||||||
|
|
||||||
color24 *samples; // note: this is the actual lightmap data for this surface
|
color24 *samples; // note: this is the actual lightmap data for this surface
|
||||||
decal_t *pdecals;
|
decal_t *pdecals;
|
||||||
|
|
|
@ -257,7 +257,7 @@ void R_SetTextureParameters( void )
|
||||||
for( i = 0, texture = r_textures; i < r_numTextures; i++, texture++ )
|
for( i = 0, texture = r_textures; i < r_numTextures; i++, texture++ )
|
||||||
{
|
{
|
||||||
if( !texture->texnum ) continue; // free slot
|
if( !texture->texnum ) continue; // free slot
|
||||||
GL_Bind( GL_TEXTURE0, texture->texnum );
|
GL_MBind( texture->texnum );
|
||||||
GL_TexFilter( texture, true );
|
GL_TexFilter( texture, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -832,7 +832,7 @@ static void GL_UploadTexture( rgbdata_t *pic, gltexture_t *tex, qboolean subImag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_Bind( GL_TEXTURE0, tex->texnum );
|
GL_MBind( tex->texnum );
|
||||||
|
|
||||||
buf = pic->buffer;
|
buf = pic->buffer;
|
||||||
bufend = pic->buffer + pic->size;
|
bufend = pic->buffer + pic->size;
|
||||||
|
|
|
@ -150,6 +150,7 @@ typedef struct
|
||||||
matrix4x4 projectionMatrix;
|
matrix4x4 projectionMatrix;
|
||||||
matrix4x4 worldviewProjectionMatrix; // worldviewMatrix * projectionMatrix
|
matrix4x4 worldviewProjectionMatrix; // worldviewMatrix * projectionMatrix
|
||||||
int lightstylevalue[MAX_LIGHTSTYLES]; // value 0 - 65536
|
int lightstylevalue[MAX_LIGHTSTYLES]; // value 0 - 65536
|
||||||
|
float lightcache[MAX_LIGHTSTYLES];
|
||||||
|
|
||||||
mplane_t clipPlane;
|
mplane_t clipPlane;
|
||||||
} ref_instance_t;
|
} ref_instance_t;
|
||||||
|
|
|
@ -27,11 +27,14 @@ void R_AnimateLight( void )
|
||||||
{
|
{
|
||||||
int i, k, flight, clight;
|
int i, k, flight, clight;
|
||||||
float l, c, lerpfrac, backlerp;
|
float l, c, lerpfrac, backlerp;
|
||||||
|
float scale;
|
||||||
lightstyle_t *ls;
|
lightstyle_t *ls;
|
||||||
|
|
||||||
if( !RI.drawWorld || !cl.worldmodel )
|
if( !RI.drawWorld || !cl.worldmodel )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
scale = r_lighting_modulate->value;
|
||||||
|
|
||||||
// light animations
|
// light animations
|
||||||
// 'm' is normal light, 'a' is no light, 'z' is double bright
|
// 'm' is normal light, 'a' is no light, 'z' is double bright
|
||||||
flight = (int)floor( cl.time * 10 );
|
flight = (int)floor( cl.time * 10 );
|
||||||
|
@ -44,38 +47,43 @@ void R_AnimateLight( void )
|
||||||
if( r_fullbright->integer || !cl.worldmodel->lightdata )
|
if( r_fullbright->integer || !cl.worldmodel->lightdata )
|
||||||
{
|
{
|
||||||
RI.lightstylevalue[i] = 256 * 256;
|
RI.lightstylevalue[i] = 256 * 256;
|
||||||
|
RI.lightcache[i] = 3.0f;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !ls->length )
|
if( !ls->length )
|
||||||
{
|
{
|
||||||
RI.lightstylevalue[i] = 256 * r_lighting_modulate->value;
|
RI.lightstylevalue[i] = 256 * scale;
|
||||||
|
RI.lightcache[i] = 3.0f * scale;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( ls->length == 1 )
|
else if( ls->length == 1 )
|
||||||
{
|
{
|
||||||
// single length style so don't bother interpolating
|
// single length style so don't bother interpolating
|
||||||
RI.lightstylevalue[i] = ls->map[0] * 22 * r_lighting_modulate->value;
|
RI.lightstylevalue[i] = ls->map[0] * 22 * scale;
|
||||||
|
RI.lightcache[i] = ( ls->map[0] / 12.0f ) * 3.0f * scale;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( !ls->interp || !cl_lightstyle_lerping->integer )
|
else if( !ls->interp || !cl_lightstyle_lerping->integer )
|
||||||
{
|
{
|
||||||
RI.lightstylevalue[i] = ls->map[flight%ls->length] * 22 * r_lighting_modulate->value;
|
RI.lightstylevalue[i] = ls->map[flight%ls->length] * 22 * scale;
|
||||||
|
RI.lightcache[i] = ( ls->map[flight%ls->length] / 12.0f ) * 3.0f * scale;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// interpolate animating light
|
// interpolate animating light
|
||||||
// frame just gone
|
// frame just gone
|
||||||
k = ls->map[flight % ls->length];
|
k = ls->map[flight % ls->length];
|
||||||
l = (float)( k * 22 ) * backlerp;
|
l = (float)( k * 22.0f ) * backlerp;
|
||||||
c = (float)( k / 12 ) * backlerp;
|
c = (float)( k / 12.0f ) * backlerp;
|
||||||
|
|
||||||
// upcoming frame
|
// upcoming frame
|
||||||
k = ls->map[clight % ls->length];
|
k = ls->map[clight % ls->length];
|
||||||
l += (float)( k * 22 ) * lerpfrac;
|
l += (float)( k * 22.0f ) * lerpfrac;
|
||||||
c += (float)( k / 12 ) * lerpfrac;
|
c += (float)( k / 12.0f ) * lerpfrac;
|
||||||
|
|
||||||
RI.lightstylevalue[i] = (int)l * r_lighting_modulate->value;
|
RI.lightstylevalue[i] = (int)l * scale;
|
||||||
|
RI.lightcache[i] = c * 3.0f * scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +119,11 @@ void R_MarkLights( dlight_t *light, int bit, mnode_t *node )
|
||||||
|
|
||||||
for( i = 0; i < node->numsurfaces; i++, surf++ )
|
for( i = 0; i < node->numsurfaces; i++, surf++ )
|
||||||
{
|
{
|
||||||
|
mextrasurf_t *info = SURF_INFO( surf, cl.worldmodel );
|
||||||
|
|
||||||
|
if( !BoundsAndSphereIntersect( info->mins, info->maxs, light->origin, light->radius ))
|
||||||
|
continue; // no intersection
|
||||||
|
|
||||||
if( surf->dlightframe != tr.dlightframecount )
|
if( surf->dlightframe != tr.dlightframecount )
|
||||||
{
|
{
|
||||||
surf->dlightbits = 0;
|
surf->dlightbits = 0;
|
||||||
|
@ -141,6 +154,10 @@ void R_PushDlights( void )
|
||||||
{
|
{
|
||||||
if( l->die < cl.time || !l->radius )
|
if( l->die < cl.time || !l->radius )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if( R_CullSphere( l->origin, l->radius, 15 ))
|
||||||
|
continue;
|
||||||
|
|
||||||
R_MarkLights( l, 1<<i, cl.worldmodel->nodes );
|
R_MarkLights( l, 1<<i, cl.worldmodel->nodes );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -83,7 +83,6 @@
|
||||||
#define MakeRGBA( out, x, y, z, w ) Vector4Set( out, x, y, z, w )
|
#define MakeRGBA( out, x, y, z, w ) Vector4Set( out, x, y, z, w )
|
||||||
#define PlaneDist(point,plane) ((plane)->type < 3 ? (point)[(plane)->type] : DotProduct((point), (plane)->normal))
|
#define PlaneDist(point,plane) ((plane)->type < 3 ? (point)[(plane)->type] : DotProduct((point), (plane)->normal))
|
||||||
#define PlaneDiff(point,plane) (((plane)->type < 3 ? (point)[(plane)->type] : DotProduct((point), (plane)->normal)) - (plane)->dist)
|
#define PlaneDiff(point,plane) (((plane)->type < 3 ? (point)[(plane)->type] : DotProduct((point), (plane)->normal)) - (plane)->dist)
|
||||||
#define PlaneDiff2(point, plane) ((((plane)->type < 3) ? (point)[(plane)->type] - (plane)->dist : DotProduct((point), (plane)->normal) - (plane)->dist))
|
|
||||||
#define bound( min, num, max ) ((num) >= (min) ? ((num) < (max) ? (num) : (max)) : (min))
|
#define bound( min, num, max ) ((num) >= (min) ? ((num) < (max) ? (num) : (max)) : (min))
|
||||||
|
|
||||||
float rsqrt( float number );
|
float rsqrt( float number );
|
||||||
|
|
Reference in New Issue