Move renderers a bit closer together

This commit is contained in:
Tim Angus 2013-03-12 17:52:02 +00:00
parent 41985945f6
commit 37c69a8009
11 changed files with 611 additions and 1165 deletions

View file

@ -636,7 +636,17 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
}
else
{
stage->bundle[0].image[0] = R_FindImageFile( token, !shader.noMipMaps, !shader.noPicMip, GL_REPEAT );
imgType_t type = IMGTYPE_COLORALPHA;
imgFlags_t flags = IMGFLAG_NONE;
if (!shader.noMipMaps)
flags |= IMGFLAG_MIPMAP;
if (!shader.noPicMip)
flags |= IMGFLAG_PICMIP;
stage->bundle[0].image[0] = R_FindImageFile( token, type, flags );
if ( !stage->bundle[0].image[0] )
{
ri.Printf( PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name );
@ -649,6 +659,9 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
//
else if ( !Q_stricmp( token, "clampmap" ) )
{
imgType_t type = IMGTYPE_COLORALPHA;
imgFlags_t flags = IMGFLAG_CLAMPTOEDGE;
token = COM_ParseExt( text, qfalse );
if ( !token[0] )
{
@ -656,7 +669,13 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
return qfalse;
}
stage->bundle[0].image[0] = R_FindImageFile( token, !shader.noMipMaps, !shader.noPicMip, GL_CLAMP_TO_EDGE );
if (!shader.noMipMaps)
flags |= IMGFLAG_MIPMAP;
if (!shader.noPicMip)
flags |= IMGFLAG_PICMIP;
stage->bundle[0].image[0] = R_FindImageFile( token, type, flags );
if ( !stage->bundle[0].image[0] )
{
ri.Printf( PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name );
@ -686,7 +705,15 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
}
num = stage->bundle[0].numImageAnimations;
if ( num < MAX_IMAGE_ANIMATIONS ) {
stage->bundle[0].image[num] = R_FindImageFile( token, !shader.noMipMaps, !shader.noPicMip, GL_REPEAT );
imgFlags_t flags = IMGFLAG_SRGB;
if (!shader.noMipMaps)
flags |= IMGFLAG_MIPMAP;
if (!shader.noPicMip)
flags |= IMGFLAG_PICMIP;
stage->bundle[0].image[num] = R_FindImageFile( token, IMGTYPE_COLORALPHA, flags );
if ( !stage->bundle[0].image[num] )
{
ri.Printf( PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name );
@ -1229,7 +1256,7 @@ static void ParseSkyParms( char **text ) {
for (i=0 ; i<6 ; i++) {
Com_sprintf( pathname, sizeof(pathname), "%s_%s.tga"
, token, suf[i] );
shader.sky.outerbox[i] = R_FindImageFile( ( char * ) pathname, qtrue, qtrue, GL_CLAMP_TO_EDGE );
shader.sky.outerbox[i] = R_FindImageFile( ( char * ) pathname, IMGTYPE_COLORALPHA, IMGFLAG_SRGB | IMGFLAG_MIPMAP | IMGFLAG_PICMIP | IMGFLAG_CLAMPTOEDGE );
if ( !shader.sky.outerbox[i] ) {
shader.sky.outerbox[i] = tr.defaultImage;
@ -1260,7 +1287,7 @@ static void ParseSkyParms( char **text ) {
for (i=0 ; i<6 ; i++) {
Com_sprintf( pathname, sizeof(pathname), "%s_%s.tga"
, token, suf[i] );
shader.sky.innerbox[i] = R_FindImageFile( ( char * ) pathname, qtrue, qtrue, GL_REPEAT );
shader.sky.innerbox[i] = R_FindImageFile( ( char * ) pathname, IMGTYPE_COLORALPHA, IMGFLAG_SRGB | IMGFLAG_MIPMAP | IMGFLAG_PICMIP );
if ( !shader.sky.innerbox[i] ) {
shader.sky.innerbox[i] = tr.defaultImage;
}
@ -2512,11 +2539,26 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag
// if not defined in the in-memory shader descriptions,
// look for a single supported image file
//
image = R_FindImageFile( name, mipRawImage, mipRawImage, mipRawImage ? GL_REPEAT : GL_CLAMP_TO_EDGE );
if ( !image ) {
ri.Printf( PRINT_DEVELOPER, "Couldn't find image file for shader %s\n", name );
shader.defaultShader = qtrue;
return FinishShader();
{
imgFlags_t flags;
flags = IMGFLAG_NONE;
if (mipRawImage)
{
flags |= IMGFLAG_MIPMAP | IMGFLAG_PICMIP;
}
else
{
flags |= IMGFLAG_CLAMPTOEDGE;
}
image = R_FindImageFile( name, IMGTYPE_COLORALPHA, flags );
if ( !image ) {
ri.Printf( PRINT_DEVELOPER, "Couldn't find image file for shader %s\n", name );
shader.defaultShader = qtrue;
return FinishShader();
}
}
//