]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added dpshaderkillifcvar and dpshaderkillifcvarzero keywords for
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 20 Aug 2011 13:29:21 +0000 (13:29 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 23 Aug 2011 19:24:15 +0000 (21:24 +0200)
shaders, their parameter is a custom cvar name of your choice

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11286 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=6642d846d198f2616c17d2c742a44d2df35074c9

model_shared.c
model_shared.h

index 0fc772824c4a23e4da119883ab14376c9a31c09c..467682882e0f04b828ebd8038e957774706cad6d 100644 (file)
@@ -2079,6 +2079,16 @@ void Mod_LoadQ3Shaders(void)
                                        strlcpy(shader.dpreflectcube, parameter[1], sizeof(shader.dpreflectcube));
                                else if (!strcasecmp(parameter[0], "dpmeshcollisions"))
                                        shader.dpmeshcollisions = true;
+                               else if (!strcasecmp(parameter[0], "dpshaderkillifcvarzero") && numparameters >= 2)
+                               {
+                                       if (Cvar_VariableValue(parameter[1]) == 0.0f)
+                                               shader.dpshaderkill = true;
+                               }
+                               else if (!strcasecmp(parameter[0], "dpshaderkillifcvar") && numparameters >= 2)
+                               {
+                                       if (Cvar_VariableValue(parameter[1]) != 0.0f)
+                                               shader.dpshaderkill = true;
+                               }
                                else if (!strcasecmp(parameter[0], "sky") && numparameters >= 2)
                                {
                                        // some q3 skies don't have the sky parm set
@@ -2211,6 +2221,9 @@ void Mod_LoadQ3Shaders(void)
                                        }
                                }
                        }
+                       // hide this shader if a cvar said it should be killed
+                       if (shader.dpshaderkill)
+                               shader.numlayers = 0;
                        // pick the primary layer to render with
                        if (shader.numlayers)
                        {
@@ -2490,6 +2503,8 @@ nothing                GL_ZERO GL_ONE
 
                if (shader->dpmeshcollisions)
                        texture->basematerialflags |= MATERIALFLAG_MESHCOLLISIONS;
+               if (shader->dpshaderkill && developer_extra.integer)
+                       Con_DPrintf("^1%s:^7 killing shader ^3\"%s\" because of cvar\n", loadmodel->name, name);
        }
        else if (!strcmp(texture->name, "noshader") || !texture->name[0])
        {
index 8b73377e53f1c6ce1fae104337d6bf13858e6b99..bd0bb265150c5268159020ecc2181a96549cb119 100644 (file)
@@ -452,6 +452,9 @@ typedef struct q3shaderinfo_s
        // add collisions to all triangles of the surface
        qboolean dpmeshcollisions;
 
+       // kill shader based on cvar checks
+       qboolean dpshaderkill;
+
        // fake reflection
        char dpreflectcube[Q3PATHLENGTH];