From: havoc Date: Thu, 20 Apr 2006 15:48:55 +0000 (+0000) Subject: don't complain about shaders with no layers X-Git-Tag: xonotic-v0.1.0preview~4044 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0ae618099e03a06476ab09669b9ec0119be45da8;p=xonotic%2Fdarkplaces.git don't complain about shaders with no layers git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6321 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_brush.c b/model_brush.c index f367e4b7..8a1d39d6 100644 --- a/model_brush.c +++ b/model_brush.c @@ -851,7 +851,7 @@ static void Mod_Q1BSP_TraceBox(struct model_s *model, int frame, trace_t *trace, Con_Printf("t(%f %f %f,%f %f %f,%i %f %f %f)", rhc.start[0], rhc.start[1], rhc.start[2], rhc.end[0], rhc.end[1], rhc.end[2], rhc.hull - model->brushq1.hulls, rhc.hull->clip_mins[0], rhc.hull->clip_mins[1], rhc.hull->clip_mins[2]); Mod_Q1BSP_RecursiveHullCheck(&rhc, rhc.hull->firstclipnode, 0, 1, rhc.start, rhc.end); { - + double test[3]; trace_t testtrace; VectorLerp(rhc.start, rhc.trace->fraction, rhc.end, test); @@ -4235,16 +4235,19 @@ static void Mod_Q3BSP_LoadShaders(void) } } // identify if this is a blended terrain shader or similar - shader->primarylayer = shader->layers + 0; - if (shader->layers[1].blendfunc[0] == GL_SRC_ALPHA && shader->layers[1].blendfunc[1] == GL_ONE_MINUS_SRC_ALPHA) + if (shader->numlayers) { - // terrain blending or other effects - shader->backgroundlayer = shader->layers + 0; - shader->primarylayer = shader->layers + 1; + shader->primarylayer = shader->layers + 0; + if (shader->layers[1].blendfunc[0] == GL_SRC_ALPHA && shader->layers[1].blendfunc[1] == GL_ONE_MINUS_SRC_ALPHA) + { + // terrain blending or other effects + shader->backgroundlayer = shader->layers + 0; + shader->primarylayer = shader->layers + 1; + } + // now see if the lightmap came first, and if so choose the second texture instead + if (!strcasecmp(shader->primarylayer->texturename, "$lightmap")) + shader->primarylayer = shader->layers + 1; } - // now see if the lightmap came first, and if so choose the second texture instead - if (!strcasecmp(shader->primarylayer->texturename, "$lightmap")) - shader->primarylayer = shader->layers + 1; } Mem_Free(f); }