]> git.mxchange.org Git - flightgear.git/commitdiff
better calculations.
authorehofman <ehofman>
Sun, 14 Mar 2010 14:05:14 +0000 (14:05 +0000)
committerTim Moore <timoore33@gmail.com>
Tue, 16 Mar 2010 14:14:58 +0000 (15:14 +0100)
utils/Modeller/texture.cxx

index 297345ca537f6df06f476b8490c78e2038607b01..3c747e60c5a693b866f1cb4dff934c576b9bd0da 100644 (file)
@@ -919,11 +919,11 @@ SGTexture::make_normalmap(float brightness, float contrast) {
             map[mpos+3] = a;
          }
 
-         fx = asin(((c-cx1)/256.0)-0.5)+0,785398163;
-         fy = asin(((cy1-c)/256.0)-0.5)+0,785398163;
+         fx = asin((c/256.0-cx1/256.0))/1.57079633;
+         fy = asin((cy1/256.0-c/256.0))/1.57079633;
 
-         map[mpos+0] = (GLuint)(fx*256.0);
-         map[mpos+1] = (GLuint)(fy*256.0);
+         map[mpos+0] = (GLuint)(fx*256.0)-128;
+         map[mpos+1] = (GLuint)(fy*256.0)-128;
          map[mpos+2] = 127+int(brightness*128); // 255-c/2;
 
          mpos += colors;