aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mapblock_mesh.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp
index bf62fe8b4..1f2f6cd8c 100644
--- a/src/mapblock_mesh.cpp
+++ b/src/mapblock_mesh.cpp
@@ -1397,13 +1397,32 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack, u32 daynight_rat
u8 night = j->second.second;
finalColorBlend(vertices[vertexIndex].Color,
day, night, daynight_ratio);
- // Brighten topside (no shaders)
- if(vertices[vertexIndex].Normal.Y > 0.5)
- {
- video::SColor &vc = vertices[vertexIndex].Color;
- vc.setRed (srgb_linear_multiply(vc.getRed(), 1.3, 255.0));
- vc.setGreen(srgb_linear_multiply(vc.getGreen(), 1.3, 255.0));
- vc.setBlue (srgb_linear_multiply(vc.getBlue(), 1.3, 255.0));
+ // Make sides and bottom darker than the top
+ video::SColor &vc = vertices[vertexIndex].Color;
+ if(vertices[vertexIndex].Normal.Y > 0.5) {
+ vc.setRed (srgb_linear_multiply(vc.getRed(), 1.2, 255.0));
+ vc.setGreen(srgb_linear_multiply(vc.getGreen(), 1.2, 255.0));
+ vc.setBlue (srgb_linear_multiply(vc.getBlue(), 1.2, 255.0));
+ } else if (vertices[vertexIndex].Normal.Y < -0.5) {
+ vc.setRed (srgb_linear_multiply(vc.getRed(), 0.3, 255.0));
+ vc.setGreen(srgb_linear_multiply(vc.getGreen(), 0.3, 255.0));
+ vc.setBlue (srgb_linear_multiply(vc.getBlue(), 0.3, 255.0));
+ } else if (vertices[vertexIndex].Normal.X > 0.5) {
+ vc.setRed (srgb_linear_multiply(vc.getRed(), 0.8, 255.0));
+ vc.setGreen(srgb_linear_multiply(vc.getGreen(), 0.8, 255.0));
+ vc.setBlue (srgb_linear_multiply(vc.getBlue(), 0.8, 255.0));
+ } else if (vertices[vertexIndex].Normal.X < -0.5) {
+ vc.setRed (srgb_linear_multiply(vc.getRed(), 0.8, 255.0));
+ vc.setGreen(srgb_linear_multiply(vc.getGreen(), 0.8, 255.0));
+ vc.setBlue (srgb_linear_multiply(vc.getBlue(), 0.8, 255.0));
+ } else if (vertices[vertexIndex].Normal.Z > 0.5) {
+ vc.setRed (srgb_linear_multiply(vc.getRed(), 0.5, 255.0));
+ vc.setGreen(srgb_linear_multiply(vc.getGreen(), 0.5, 255.0));
+ vc.setBlue (srgb_linear_multiply(vc.getBlue(), 0.5, 255.0));
+ } else if (vertices[vertexIndex].Normal.Z < -0.5) {
+ vc.setRed (srgb_linear_multiply(vc.getRed(), 0.5, 255.0));
+ vc.setGreen(srgb_linear_multiply(vc.getGreen(), 0.5, 255.0));
+ vc.setBlue (srgb_linear_multiply(vc.getBlue(), 0.5, 255.0));
}
}
}