From ff7f8947543babf08a308bda7941a2cf85212e5f Mon Sep 17 00:00:00 2001 From: ehofman Date: Sun, 14 Mar 2010 14:05:14 +0000 Subject: [PATCH] better calculations. --- utils/Modeller/texture.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/Modeller/texture.cxx b/utils/Modeller/texture.cxx index 297345ca5..3c747e60c 100644 --- a/utils/Modeller/texture.cxx +++ b/utils/Modeller/texture.cxx @@ -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; -- 2.39.5