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.5.0~408 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=abc120dd698a674db632227f972787664addea4d;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 ::stable-branch::merge=a8d4e4037223816fb79ef80f72886879203b46a5 --- diff --git a/gl_rmain.c b/gl_rmain.c index 67e1d06c..10b87853 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -10282,11 +10282,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)