From: havoc Date: Thu, 17 Mar 2011 16:50:33 +0000 (+0000) Subject: avoid a crash when creating model decals if RSurf_ActiveModel does not X-Git-Tag: xonotic-v0.6.0~163^2~620 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a8d4e4037223816fb79ef80f72886879203b46a5;p=xonotic%2Fdarkplaces.git avoid a crash when creating model decals if RSurf_ActiveModel does not produce normals (why not?) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10926 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index fb17237c..64143694 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -10285,11 +10285,23 @@ static void R_DecalSystem_SplatTriangle(decalsystem_t *decalsystem, float r, flo vertex3f = rsurface.modelvertex3f; normal3f = rsurface.modelnormal3f; - for (cornerindex = 0;cornerindex < 3;cornerindex++) + if (normal3f) { - index = 3*e[cornerindex]; - VectorMA(vertex3f + index, cl_decals_bias.value, normal3f + index, v[cornerindex]); + for (cornerindex = 0;cornerindex < 3;cornerindex++) + { + index = 3*e[cornerindex]; + VectorMA(vertex3f + index, cl_decals_bias.value, normal3f + index, v[cornerindex]); + } } + else + { + for (cornerindex = 0;cornerindex < 3;cornerindex++) + { + index = 3*e[cornerindex]; + VectorCopy(vertex3f + index, v[cornerindex]); + } + } + // cull backfaces //TriangleNormal(v[0], v[1], v[2], normal); //if (DotProduct(normal, localnormal) < 0.0f)