From cf23ece7905622d1271e94a8dd44f47e93870da6 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 8 Apr 2011 16:37:50 +0000 Subject: [PATCH] added mod_noshader_default_offsetmapping to allow separate control over external textures that have no q3 shader git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11037 d7cf8633-e32d-0410-b094-e92efae38249 --- model_brush.c | 4 +++- model_shared.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/model_brush.c b/model_brush.c index 08040c79..a04e96c1 100644 --- a/model_brush.c +++ b/model_brush.c @@ -38,6 +38,7 @@ cvar_t r_subdivisions_collision_tolerance = {0, "r_subdivisions_collision_tolera cvar_t r_subdivisions_collision_mintess = {0, "r_subdivisions_collision_mintess", "0", "minimum number of subdivisions (values above 0 will smooth curves that don't need it)"}; cvar_t r_subdivisions_collision_maxtess = {0, "r_subdivisions_collision_maxtess", "1024", "maximum number of subdivisions (prevents curves beyond a certain detail level, limits smoothing)"}; cvar_t r_subdivisions_collision_maxvertices = {0, "r_subdivisions_collision_maxvertices", "4225", "maximum vertices allowed per subdivided curve"}; +cvar_t mod_noshader_default_offsetmapping = {CVAR_SAVE, "mod_noshader_default_offsetmapping", "1", "use offsetmapping by default on all surfaces that are not using q3 shader files"}; cvar_t mod_q3bsp_curves_collisions = {0, "mod_q3bsp_curves_collisions", "1", "enables collisions with curves (SLOW)"}; cvar_t mod_q3bsp_curves_collisions_stride = {0, "mod_q3bsp_curves_collisions_stride", "16", "collisions against curves: optimize performance by doing a combined collision check for this triangle amount first (-1 avoids any box tests)"}; cvar_t mod_q3bsp_curves_stride = {0, "mod_q3bsp_curves_stride", "16", "particle effect collisions against curves: optimize performance by doing a combined collision check for this triangle amount first (-1 avoids any box tests)"}; @@ -46,7 +47,7 @@ cvar_t mod_q3bsp_debugtracebrush = {0, "mod_q3bsp_debugtracebrush", "0", "select cvar_t mod_q3bsp_lightmapmergepower = {CVAR_SAVE, "mod_q3bsp_lightmapmergepower", "4", "merges the quake3 128x128 lightmap textures into larger lightmap group textures to speed up rendering, 1 = 256x256, 2 = 512x512, 3 = 1024x1024, 4 = 2048x2048, 5 = 4096x4096, ..."}; cvar_t mod_q3bsp_nolightmaps = {CVAR_SAVE, "mod_q3bsp_nolightmaps", "0", "do not load lightmaps in Q3BSP maps (to save video RAM, but be warned: it looks ugly)"}; cvar_t mod_q3bsp_tracelineofsight_brushes = {0, "mod_q3bsp_tracelineofsight_brushes", "0", "enables culling of entities behind detail brushes, curves, etc"}; -cvar_t mod_q3shader_default_offsetmapping = {CVAR_SAVE, "mod_q3shader_default_offsetmapping", "1", "use offsetmapping by default on all surfaces"}; +cvar_t mod_q3shader_default_offsetmapping = {CVAR_SAVE, "mod_q3shader_default_offsetmapping", "1", "use offsetmapping by default on all surfaces that are using q3 shader files"}; cvar_t mod_q3shader_default_polygonfactor = {0, "mod_q3shader_default_polygonfactor", "0", "biases depth values of 'polygonoffset' shaders to prevent z-fighting artifacts"}; cvar_t mod_q3shader_default_polygonoffset = {0, "mod_q3shader_default_polygonoffset", "-2", "biases depth values of 'polygonoffset' shaders to prevent z-fighting artifacts"}; @@ -74,6 +75,7 @@ void Mod_BrushInit(void) Cvar_RegisterVariable(&r_subdivisions_collision_mintess); Cvar_RegisterVariable(&r_subdivisions_collision_maxtess); Cvar_RegisterVariable(&r_subdivisions_collision_maxvertices); + Cvar_RegisterVariable(&mod_noshader_default_offsetmapping); Cvar_RegisterVariable(&mod_q3bsp_curves_collisions); Cvar_RegisterVariable(&mod_q3bsp_curves_collisions_stride); Cvar_RegisterVariable(&mod_q3bsp_curves_stride); diff --git a/model_shared.c b/model_shared.c index 0761758c..9ea0751a 100644 --- a/model_shared.c +++ b/model_shared.c @@ -1605,6 +1605,7 @@ static void Q3Shader_AddToHash (q3shaderinfo_t* shader) memcpy (&entry->shader, shader, sizeof (q3shaderinfo_t)); } +extern cvar_t mod_noshader_default_offsetmapping; extern cvar_t mod_q3shader_default_offsetmapping; extern cvar_t mod_q3shader_default_polygonoffset; extern cvar_t mod_q3shader_default_polygonfactor; @@ -2281,7 +2282,7 @@ qboolean Mod_LoadTextureFromQ3Shader(texture_t *texture, const char *name, qbool if(defaulttexflags & TEXF_ISSPRITE) texflagsor |= TEXF_ISSPRITE; // unless later loaded from the shader - texture->offsetmapping = (mod_q3shader_default_offsetmapping.value) ? OFFSETMAPPING_DEFAULT : OFFSETMAPPING_OFF; + texture->offsetmapping = (mod_noshader_default_offsetmapping.value) ? OFFSETMAPPING_DEFAULT : OFFSETMAPPING_OFF; texture->offsetscale = 1; texture->specularscalemod = 1; texture->specularpowermod = 1; -- 2.39.2