]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_textures.c
renamed r_shadow_shadows to r_shadow_dlightshadows and added r_shadow_worldshadows...
[xonotic/darkplaces.git] / gl_textures.c
index e1ccf153a9f1eb5ce7bb4388021a9c2fb5aaa3f2..f3e8a1b24725f79354ef47fbb8096cea351b55e4 100644 (file)
@@ -8,6 +8,7 @@ cvar_t  r_max_scrapsize = {CVAR_SAVE, "r_max_scrapsize", "256"};
 cvar_t r_picmip = {CVAR_SAVE, "r_picmip", "0"};
 cvar_t r_lerpimages = {CVAR_SAVE, "r_lerpimages", "1"};
 cvar_t r_precachetextures = {CVAR_SAVE, "r_precachetextures", "1"};
+cvar_t  gl_texture_anisotropy = {CVAR_SAVE, "gl_texture_anisotropy", "0"};
 
 int            gl_filter_min = GL_LINEAR_MIPMAP_LINEAR;
 int            gl_filter_mag = GL_LINEAR;
@@ -38,11 +39,12 @@ typedef struct
 }
 textypeinfo_t;
 
-static textypeinfo_t textype_palette       = {TEXTYPE_PALETTE, 1, 4, GL_RGBA, 3};
-static textypeinfo_t textype_rgb           = {TEXTYPE_RGB    , 3, 3, GL_RGB , 3};
-static textypeinfo_t textype_rgba          = {TEXTYPE_RGBA   , 4, 4, GL_RGBA, 3};
-static textypeinfo_t textype_palette_alpha = {TEXTYPE_PALETTE, 1, 4, GL_RGBA, 4};
-static textypeinfo_t textype_rgba_alpha    = {TEXTYPE_RGBA   , 4, 4, GL_RGBA, 4};
+static textypeinfo_t textype_palette       = {TEXTYPE_PALETTE, 1, 4, GL_RGBA   , 3};
+static textypeinfo_t textype_rgb           = {TEXTYPE_RGB    , 3, 3, GL_RGB    , 3};
+static textypeinfo_t textype_rgba          = {TEXTYPE_RGBA   , 4, 4, GL_RGBA   , 3};
+static textypeinfo_t textype_palette_alpha = {TEXTYPE_PALETTE, 1, 4, GL_RGBA   , 4};
+static textypeinfo_t textype_rgba_alpha    = {TEXTYPE_RGBA   , 4, 4, GL_RGBA   , 4};
+static textypeinfo_t textype_dsdt          = {TEXTYPE_DSDT   , 2, 2, GL_DSDT_NV, GL_DSDT8_NV};
 
 // a tiling texture (most common type)
 #define GLIMAGETYPE_TILE 0
@@ -166,6 +168,8 @@ static textypeinfo_t *R_GetTexTypeInfo(int textype, int flags)
                        return &textype_rgb;
                case TEXTYPE_RGBA:
                        return &textype_rgba;
+               case TEXTYPE_DSDT:
+                       return &textype_dsdt;
                default:
                        Host_Error("R_GetTexTypeInfo: unknown texture format\n");
                        return NULL;
@@ -361,7 +365,7 @@ static void GL_TextureMode_f (void)
                for (image = pool->imagechain;image;image = image->imagechain)
                {
                        // only update already uploaded images
-                       if (!(image->flags & GLTEXF_UPLOAD))
+                       if (!(image->flags & GLTEXF_UPLOAD) && !(image->flags & (TEXF_FORCENEAREST | TEXF_FORCELINEAR)))
                        {
                                qglGetIntegerv(gltexturetypebindingenums[image->texturetype], &oldbindtexnum);
                                qglBindTexture(gltexturetypeenums[image->texturetype], image->texnum);
@@ -519,6 +523,7 @@ void R_Textures_Init (void)
        Cvar_RegisterVariable (&r_picmip);
        Cvar_RegisterVariable (&r_lerpimages);
        Cvar_RegisterVariable (&r_precachetextures);
+       Cvar_RegisterVariable (&gl_texture_anisotropy);
 
        R_RegisterModule("R_Textures", r_textures_start, r_textures_shutdown, r_textures_newmap);
 }
@@ -565,6 +570,8 @@ static void GL_SetupTextureParameters(int flags, int texturetype)
 
        CHECKGLERROR
 
+       if (gl_support_anisotropy)
+               qglTexParameterf(textureenum, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_anisotropy.value);
        qglTexParameteri(textureenum, GL_TEXTURE_WRAP_S, wrapmode);
        qglTexParameteri(textureenum, GL_TEXTURE_WRAP_T, wrapmode);
        if (gltexturetypedimensions[texturetype] >= 3)
@@ -1028,6 +1035,8 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden
                        }
                }
                break;
+       case TEXTYPE_DSDT:
+               break;
        default:
                Host_Error("R_LoadTexture: unknown texture type\n");
        }