summaryrefslogtreecommitdiff
path: root/src/renderergl1/tr_shader.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderergl1/tr_shader.c')
-rw-r--r--src/renderergl1/tr_shader.c62
1 files changed, 52 insertions, 10 deletions
diff --git a/src/renderergl1/tr_shader.c b/src/renderergl1/tr_shader.c
index 581844dd..8eb5732e 100644
--- a/src/renderergl1/tr_shader.c
+++ b/src/renderergl1/tr_shader.c
@@ -637,7 +637,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 );
@@ -650,6 +660,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] )
{
@@ -657,7 +670,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 );
@@ -687,7 +706,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 );
@@ -1230,7 +1257,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;
@@ -1261,7 +1288,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;
}
@@ -2513,11 +2540,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();
+ }
}
//