21 Jul 2012
This commit is contained in:
parent
91d8a1d5c0
commit
51bb85e9b2
|
@ -167,6 +167,7 @@ typedef struct render_api_s
|
|||
|
||||
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 26
|
||||
void (*R_EntityRemoveDecals)( struct model_s *mod ); // remove all the decals from specified entity (BSP only)
|
||||
float *(*R_DecalSetupVerts)( struct decal_s *pDecal, struct msurface_s *surf, int texture, int *outCount );
|
||||
} render_api_t;
|
||||
|
||||
// render callbacks
|
||||
|
|
|
@ -2484,12 +2484,12 @@ update client flashlight
|
|||
*/
|
||||
void CL_UpdateFlashlight( cl_entity_t *pEnt )
|
||||
{
|
||||
int key, traceFlags;
|
||||
vec3_t vecSrc, vecEnd;
|
||||
vec3_t forward, view_ofs;
|
||||
float falloff;
|
||||
pmtrace_t trace;
|
||||
dlight_t *dl;
|
||||
int key;
|
||||
|
||||
if(( pEnt->index - 1 ) == cl.playernum )
|
||||
{
|
||||
|
@ -2516,12 +2516,7 @@ void CL_UpdateFlashlight( cl_entity_t *pEnt )
|
|||
VectorAdd( pEnt->origin, view_ofs, vecSrc );
|
||||
VectorMA( vecSrc, FLASHLIGHT_DISTANCE, forward, vecEnd );
|
||||
|
||||
traceFlags = PM_STUDIO_BOX;
|
||||
|
||||
if( r_lighting_extended->integer < 2 )
|
||||
traceFlags |= PM_GLASS_IGNORE;
|
||||
|
||||
trace = CL_TraceLine( vecSrc, vecEnd, traceFlags );
|
||||
trace = CL_TraceLine( vecSrc, vecEnd, PM_STUDIO_BOX );
|
||||
falloff = trace.fraction * FLASHLIGHT_DISTANCE;
|
||||
|
||||
if( falloff < 250.0f ) falloff = 1.0f;
|
||||
|
|
|
@ -979,10 +979,21 @@ void DrawSurfaceDecals( msurface_t *fa )
|
|||
{
|
||||
gltexture_t *glt = R_GetTexture( p->texture );
|
||||
|
||||
// draw transparent decals with GL_MODULATE
|
||||
if( glt->fogParams[3] > DECAL_TRANSPARENT_THRESHOLD )
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
else pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
// normal HL decal with alpha-channel
|
||||
if( glt->flags & TF_HAS_ALPHA )
|
||||
{
|
||||
// draw transparent decals with GL_MODULATE
|
||||
if( glt->fogParams[3] > DECAL_TRANSPARENT_THRESHOLD )
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
else pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
}
|
||||
else
|
||||
{
|
||||
// color decal like detail texture. Base color is 127 127 127
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
pglBlendFunc( GL_DST_COLOR, GL_SRC_COLOR );
|
||||
}
|
||||
|
||||
DrawSingleDecal( p, fa );
|
||||
}
|
||||
|
|
|
@ -936,6 +936,9 @@ static void GL_UploadTexture( rgbdata_t *pic, gltexture_t *tex, qboolean subImag
|
|||
|
||||
samples = GL_CalcTextureSamples( pic->flags );
|
||||
|
||||
if( pic->flags & IMAGE_HAS_ALPHA )
|
||||
tex->flags |= TF_HAS_ALPHA;
|
||||
|
||||
// determine format
|
||||
inFormat = PFDesc[pic->type].glFormat;
|
||||
outFormat = GL_TextureFormat( tex, &samples );
|
||||
|
@ -1662,6 +1665,22 @@ static rgbdata_t *R_InitAttenuationTexture3( texFlags_t *flags )
|
|||
return R_InitAttenTextureGamma( flags, 3.5f );
|
||||
}
|
||||
|
||||
static rgbdata_t *R_InitAttenuationTextureNoAtten( texFlags_t *flags )
|
||||
{
|
||||
// 1d attenuation texture
|
||||
r_image.width = 256;
|
||||
r_image.height = 1;
|
||||
r_image.buffer = data2D;
|
||||
r_image.flags = IMAGE_HAS_COLOR;
|
||||
r_image.type = PF_RGBA_32;
|
||||
r_image.size = r_image.width * r_image.height * 4;
|
||||
|
||||
Q_memset( data2D, 0xFF, r_image.size );
|
||||
*flags = TF_UNCOMPRESSED|TF_NOMIPMAP|TF_CLAMP|TF_TEXTURE_1D;
|
||||
|
||||
return &r_image;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
R_InitAttenuationTexture3D
|
||||
|
@ -1892,6 +1911,7 @@ static void R_InitBuiltinTextures( void )
|
|||
{ "*atten", &tr.attenuationTexture, R_InitAttenuationTexture, TEX_SYSTEM },
|
||||
{ "*atten2", &tr.attenuationTexture2, R_InitAttenuationTexture2, TEX_SYSTEM },
|
||||
{ "*atten3", &tr.attenuationTexture3, R_InitAttenuationTexture3, TEX_SYSTEM },
|
||||
{ "*attnno", &tr.attenuationStubTexture, R_InitAttenuationTextureNoAtten, TEX_SYSTEM },
|
||||
{ "*normalize", &tr.normalizeTexture, R_InitNormalizeCubemap, TEX_CUBEMAP },
|
||||
{ "*lightCube", &tr.dlightCubeTexture, R_InitDlightCubemap, TEX_CUBEMAP },
|
||||
{ "*grayCube", &tr.grayCubeTexture, R_InitGrayCubemap, TEX_CUBEMAP },
|
||||
|
|
|
@ -186,6 +186,7 @@ typedef struct
|
|||
int attenuationTexture2;// dark attenuation
|
||||
int attenuationTexture3;// bright attenuation
|
||||
int attenuationTexture3D;// 3D attenuation
|
||||
int attenuationStubTexture;
|
||||
int normalizeTexture;
|
||||
int dlightCubeTexture; // dynamic cubemap
|
||||
int grayCubeTexture;
|
||||
|
@ -286,6 +287,7 @@ qboolean R_CullSurface( msurface_t *surf, uint clipflags );
|
|||
// gl_decals.c
|
||||
//
|
||||
void DrawSurfaceDecals( msurface_t *fa );
|
||||
float *R_DecalSetupVerts( decal_t *pDecal, msurface_t *surf, int texture, int *outCount );
|
||||
void DrawSingleDecal( decal_t *pDecal, msurface_t *fa );
|
||||
void R_EntityRemoveDecals( model_t *mod );
|
||||
void R_ClearDecals( void );
|
||||
|
|
|
@ -1505,6 +1505,7 @@ static render_api_t gRenderAPI =
|
|||
GL_CleanUpTextureUnits,
|
||||
GL_TexGen,
|
||||
R_EntityRemoveDecals,
|
||||
R_DecalSetupVerts,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -788,8 +788,6 @@ void R_BlendLightmaps( void )
|
|||
switch( RI.currententity->curstate.rendermode )
|
||||
{
|
||||
case kRenderTransTexture:
|
||||
if( r_lighting_extended->integer == 2 )
|
||||
break;
|
||||
case kRenderTransColor:
|
||||
case kRenderTransAdd:
|
||||
case kRenderGlow:
|
||||
|
@ -1126,7 +1124,7 @@ void R_RenderBrushPoly( msurface_t *fa )
|
|||
DrawSurfaceDecals( fa );
|
||||
|
||||
// NOTE: draw mirror through in mirror show dummy lightmapped texture
|
||||
if( fa->flags & SURF_REFLECT && RP_NORMALPASS() && r_lighting_extended->integer < 2 )
|
||||
if( fa->flags & SURF_REFLECT && RP_NORMALPASS() && r_lighting_extended->integer )
|
||||
return; // no lightmaps for mirror
|
||||
|
||||
if( fa->flags & SURF_DRAWTILED )
|
||||
|
|
|
@ -143,7 +143,7 @@ qboolean Image_LoadMDL( const char *name, const byte *buffer, size_t filesize )
|
|||
pixels = image.width * image.height;
|
||||
fin = (byte *)pin->index; // setup buffer
|
||||
|
||||
if(!Image_LumpValidSize( name )) return false;
|
||||
if( !Image_ValidSize( name )) return false;
|
||||
|
||||
if( image.hint != IL_HINT_Q1 && !( flags & STUDIO_NF_QUAKESKIN ))
|
||||
{
|
||||
|
|
Reference in New Issue