]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
avoid a crash when creating model decals if RSurf_ActiveModel does not
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 17 Mar 2011 16:50:33 +0000 (16:50 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 17 Mar 2011 18:21:15 +0000 (19:21 +0100)
produce normals (why not?)

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

gl_rmain.c

index 67e1d06c646f9dfb9809f39a2883c369e7c3944e..10b878534ca6930fb672440df1f4bf5d9d8a2d38 100644 (file)
@@ -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)