13 Apr 2011
This commit is contained in:
parent
0646157b0f
commit
ef4b50cc67
|
@ -173,7 +173,7 @@ typedef struct msurface_s
|
|||
int lightmaptexturenum;
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
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
|
||||
decal_t *pdecals;
|
||||
|
|
|
@ -257,7 +257,7 @@ void R_SetTextureParameters( void )
|
|||
for( i = 0, texture = r_textures; i < r_numTextures; i++, texture++ )
|
||||
{
|
||||
if( !texture->texnum ) continue; // free slot
|
||||
GL_Bind( GL_TEXTURE0, texture->texnum );
|
||||
GL_MBind( texture->texnum );
|
||||
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;
|
||||
bufend = pic->buffer + pic->size;
|
||||
|
|
|
@ -150,6 +150,7 @@ typedef struct
|
|||
matrix4x4 projectionMatrix;
|
||||
matrix4x4 worldviewProjectionMatrix; // worldviewMatrix * projectionMatrix
|
||||
int lightstylevalue[MAX_LIGHTSTYLES]; // value 0 - 65536
|
||||
float lightcache[MAX_LIGHTSTYLES];
|
||||
|
||||
mplane_t clipPlane;
|
||||
} ref_instance_t;
|
||||
|
|
|
@ -27,11 +27,14 @@ void R_AnimateLight( void )
|
|||
{
|
||||
int i, k, flight, clight;
|
||||
float l, c, lerpfrac, backlerp;
|
||||
float scale;
|
||||
lightstyle_t *ls;
|
||||
|
||||
if( !RI.drawWorld || !cl.worldmodel )
|
||||
return;
|
||||
|
||||
scale = r_lighting_modulate->value;
|
||||
|
||||
// light animations
|
||||
// 'm' is normal light, 'a' is no light, 'z' is double bright
|
||||
flight = (int)floor( cl.time * 10 );
|
||||
|
@ -44,38 +47,43 @@ void R_AnimateLight( void )
|
|||
if( r_fullbright->integer || !cl.worldmodel->lightdata )
|
||||
{
|
||||
RI.lightstylevalue[i] = 256 * 256;
|
||||
RI.lightcache[i] = 3.0f;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !ls->length )
|
||||
{
|
||||
RI.lightstylevalue[i] = 256 * r_lighting_modulate->value;
|
||||
RI.lightstylevalue[i] = 256 * scale;
|
||||
RI.lightcache[i] = 3.0f * scale;
|
||||
continue;
|
||||
}
|
||||
else if( ls->length == 1 )
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
// interpolate animating light
|
||||
// frame just gone
|
||||
k = ls->map[flight % ls->length];
|
||||
l = (float)( k * 22 ) * backlerp;
|
||||
c = (float)( k / 12 ) * backlerp;
|
||||
l = (float)( k * 22.0f ) * backlerp;
|
||||
c = (float)( k / 12.0f ) * backlerp;
|
||||
|
||||
// upcoming frame
|
||||
k = ls->map[clight % ls->length];
|
||||
l += (float)( k * 22 ) * lerpfrac;
|
||||
c += (float)( k / 12 ) * lerpfrac;
|
||||
l += (float)( k * 22.0f ) * 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++ )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
surf->dlightbits = 0;
|
||||
|
@ -141,6 +154,10 @@ void R_PushDlights( void )
|
|||
{
|
||||
if( l->die < cl.time || !l->radius )
|
||||
continue;
|
||||
|
||||
if( R_CullSphere( l->origin, l->radius, 15 ))
|
||||
continue;
|
||||
|
||||
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 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 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))
|
||||
|
||||
float rsqrt( float number );
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#define SURF_INFO( surf, mod ) ((mextrasurf_t *)mod->cache.data + (surf - mod->surfaces))
|
||||
|
||||
// model flags (stored in model_t->flags)
|
||||
#define MODEL_CONVEYOR BIT( 0 )
|
||||
#define MODEL_CONVEYOR BIT( 0 )
|
||||
#define MODEL_HAS_ORIGIN BIT( 1 )
|
||||
|
||||
typedef struct leaflist_s
|
||||
|
|
Reference in New Issue