summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Graham <lerc@screamingduck.com>2018-03-16 10:22:48 +1300
committerNeil Graham <lerc@screamingduck.com>2018-03-16 10:22:48 +1300
commit4bea98de4039cc21496db5a7259fdab74a93b386 (patch)
tree03aa52d429b3523ac788b505445b8e9831c41671
parent617d3cde1ac34213a432c4750ffdacb01a780ac2 (diff)
downloadredot-engine-4bea98de4039cc21496db5a7259fdab74a93b386.tar.gz
change bumpmap_to_normalmap range from [1...255] to [0...255]
-rw-r--r--core/image.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/image.cpp b/core/image.cpp
index 3a7c3a9d7e..74c529512b 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -2410,9 +2410,9 @@ void Image::bumpmap_to_normalmap(float bump_scale) {
Vector3 normal = across.cross(up);
normal.normalize();
- write_ptr[((ty * width + tx) << 2) + 0] = (128.0 + normal.x * 127.0);
- write_ptr[((ty * width + tx) << 2) + 1] = (128.0 + normal.y * 127.0);
- write_ptr[((ty * width + tx) << 2) + 2] = (128.0 + normal.z * 127.0);
+ write_ptr[((ty * width + tx) << 2) + 0] = (127.5 + normal.x * 127.5);
+ write_ptr[((ty * width + tx) << 2) + 1] = (127.5 + normal.y * 127.5);
+ write_ptr[((ty * width + tx) << 2) + 2] = (127.5 + normal.z * 127.5);
write_ptr[((ty * width + tx) << 2) + 3] = 255;
}
}