]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fixed bumpmapping! now looks correct
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 15 Jan 2003 13:09:16 +0000 (13:09 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 15 Jan 2003 13:09:16 +0000 (13:09 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2690 d7cf8633-e32d-0410-b094-e92efae38249

model_shared.c

index 5bec6c2283f1385395a5a4f83177ca5cc16a55cc..e3fa83e0a9a9b0faa2502d07d04c433f2a0da547 100644 (file)
@@ -526,22 +526,24 @@ void Mod_BuildTextureVectorsAndNormals(int numverts, int numtriangles, const flo
                {
                        // 4 assignments, 1 rsqrt, 2 adds, 6 multiplies
                        VectorNormalize(normal);
-                       sdir[0] = (vert[1][3] - vert[0][3]) * (vert[2][0] - vert[0][0]) - (vert[2][3] - vert[0][3]) * (vert[1][0] - vert[0][0]);
-                       sdir[1] = (vert[1][3] - vert[0][3]) * (vert[2][1] - vert[0][1]) - (vert[2][3] - vert[0][3]) * (vert[1][1] - vert[0][1]);
-                       sdir[2] = (vert[1][3] - vert[0][3]) * (vert[2][2] - vert[0][2]) - (vert[2][3] - vert[0][3]) * (vert[1][2] - vert[0][2]);
+                       tdir[0] = ((vert[1][3] - vert[0][3]) * (vert[2][0] - vert[0][0]) - (vert[2][3] - vert[0][3]) * (vert[1][0] - vert[0][0]));
+                       tdir[1] = ((vert[1][3] - vert[0][3]) * (vert[2][1] - vert[0][1]) - (vert[2][3] - vert[0][3]) * (vert[1][1] - vert[0][1]));
+                       tdir[2] = ((vert[1][3] - vert[0][3]) * (vert[2][2] - vert[0][2]) - (vert[2][3] - vert[0][3]) * (vert[1][2] - vert[0][2]));
                        // 4 assignments, 1 rsqrt, 2 adds, 6 multiplies
-                       VectorNormalize(sdir);
+                       VectorNormalize(tdir);
                        // 1 assignments, 1 negates, 2 adds, 3 multiplies
-                       f = -DotProduct(sdir, normal);
+                       f = -DotProduct(tdir, normal);
                        // 3 assignments, 3 adds, 3 multiplies
-                       VectorMA(sdir, f, normal, sdir);
+                       VectorMA(tdir, f, normal, tdir);
                        // 4 assignments, 1 rsqrt, 2 adds, 6 multiplies
-                       VectorNormalize(sdir);
+                       VectorNormalize(tdir);
                        // 3 assignments, 3 subtracts, 6 multiplies
-                       CrossProduct(sdir, normal, tdir);
+                       CrossProduct(tdir, normal, sdir);
                        // this is probably not necessary
                        // 4 assignments, 1 rsqrt, 2 adds, 6 multiplies
-                       VectorNormalize(tdir);
+                       VectorNormalize(sdir);
+                       //
+                       VectorNegate(sdir, sdir);
                        // accumulate matrix onto verts used by triangle
                        // 30 assignments, 27 adds
                        for (i = 0;i < 3;i++)