aboutsummaryrefslogtreecommitdiff
path: root/src/mesh.cpp
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2017-02-06 21:48:54 +0000
committerparamat <mat.gregory@virginmedia.com>2017-02-07 00:19:52 +0000
commit8bc6a303b461662b7434a5ee8557292d43682cc9 (patch)
tree0b1e32537fa4717e4ca5daab448d982b3bf7dbf6 /src/mesh.cpp
parent5da3ed19a38ba5a342ba16c61be7bfb7c17b2308 (diff)
downloadminetest-8bc6a303b461662b7434a5ee8557292d43682cc9.tar.gz
minetest-8bc6a303b461662b7434a5ee8557292d43682cc9.tar.bz2
minetest-8bc6a303b461662b7434a5ee8557292d43682cc9.zip
Face shading: Add shade factor comments
Diffstat (limited to 'src/mesh.cpp')
-rw-r--r--src/mesh.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mesh.cpp b/src/mesh.cpp
index 6a055abb2..a79264ef0 100644
--- a/src/mesh.cpp
+++ b/src/mesh.cpp
@@ -42,8 +42,15 @@ inline static void applyShadeFactor(video::SColor& color, float factor)
void applyFacesShading(video::SColor &color, const v3f &normal)
{
- // Many special drawtypes have normals set to 0,0,0 and this
- // must result in maximum brightness (no face shadng).
+ /*
+ Some drawtypes have normals set to (0, 0, 0), this must result in
+ maximum brightness: shade factor 1.0.
+ Shade factors for aligned cube faces are:
+ +Y 1.000000 sqrt(1.0)
+ -Y 0.447213 sqrt(0.2)
+ +-X 0.670820 sqrt(0.45)
+ +-Z 0.836660 sqrt(0.7)
+ */
float x2 = normal.X * normal.X;
float y2 = normal.Y * normal.Y;
float z2 = normal.Z * normal.Z;