fix inverted normalmaps produced from bumpmaps (directly loaded normalmaps are fine)
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 10 May 2005 00:30:52 +0000 (00:30 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 10 May 2005 00:30:52 +0000 (00:30 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5265 d7cf8633-e32d-0410-b094-e92efae38249

image.c

diff --git a/image.c b/image.c
index 745aac1..077baa7 100644 (file)
--- a/image.c
+++ b/image.c
@@ -1494,8 +1494,8 @@ void Image_HeightmapToNormalmap(const unsigned char *inpixels, unsigned char *ou
                        n[1] = dv[0][2]*dv[1][0]-dv[0][0]*dv[1][2];
                        n[2] = dv[0][0]*dv[1][1]-dv[0][1]*dv[1][0];
                        */
-                       n[0] = ((p1[0] + p1[1] + p1[2]) - (p0[0] + p0[1] + p0[2]));
-                       n[1] = ((p0[0] + p0[1] + p0[2]) - (p2[0] + p2[1] + p2[2]));
+                       n[0] = ((p0[0] + p0[1] + p0[2]) - (p1[0] + p1[1] + p1[2]));
+                       n[1] = ((p2[0] + p2[1] + p2[2]) - (p0[0] + p0[1] + p0[2]));
                        n[2] = ibumpscale;
                        VectorNormalize(n);
                        /*