Skip to content

Commit 8bc6a30

Browse files
committedFeb 7, 2017
Face shading: Add shade factor comments
1 parent 5da3ed1 commit 8bc6a30

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
 

Diff for: ‎src/mesh.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,15 @@ inline static void applyShadeFactor(video::SColor& color, float factor)
4242

4343
void applyFacesShading(video::SColor &color, const v3f &normal)
4444
{
45-
// Many special drawtypes have normals set to 0,0,0 and this
46-
// must result in maximum brightness (no face shadng).
45+
/*
46+
Some drawtypes have normals set to (0, 0, 0), this must result in
47+
maximum brightness: shade factor 1.0.
48+
Shade factors for aligned cube faces are:
49+
+Y 1.000000 sqrt(1.0)
50+
-Y 0.447213 sqrt(0.2)
51+
+-X 0.670820 sqrt(0.45)
52+
+-Z 0.836660 sqrt(0.7)
53+
*/
4754
float x2 = normal.X * normal.X;
4855
float y2 = normal.Y * normal.Y;
4956
float z2 = normal.Z * normal.Z;

0 commit comments

Comments
 (0)
Please sign in to comment.