]> git.rm.cloudns.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)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 17 Mar 2011 16:50:33 +0000 (16:50 +0000)
produce normals (why not?)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10926 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index fb17237c683afa53927413d5785e948630bd747c..6414369443a71e4ecd3578a4b99851e5d66ed1f0 100644 (file)
@@ -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)