aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2011-07-19 01:43:30 +0200
committerNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2011-07-19 01:43:30 +0200
commite8eb4d233b825a55f16953bc82a8b9c6d819b32c (patch)
tree660f58e59d4c00a7832f1cee0afd7e422615da76 /src
parent414d1ff9e2a1f40929480e094631efb0878e4ecf (diff)
downloadminetest-e8eb4d233b825a55f16953bc82a8b9c6d819b32c.tar.gz
minetest-e8eb4d233b825a55f16953bc82a8b9c6d819b32c.tar.bz2
minetest-e8eb4d233b825a55f16953bc82a8b9c6d819b32c.zip
+ fake shading for the volumetric clouds
Diffstat (limited to 'src')
-rw-r--r--src/clouds.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/clouds.cpp b/src/clouds.cpp
index 022550414..19bcca942 100644
--- a/src/clouds.cpp
+++ b/src/clouds.cpp
@@ -127,18 +127,21 @@ void Clouds::render()
continue;
float b = m_brightness;
- video::SColor c(128,b*230,b*230,b*255);
+ video::SColor c_top(128,b*240,b*240,b*255);
+ video::SColor c_side_1(128,b*230,b*230,b*255);
+ video::SColor c_side_2(128,b*220,b*220,b*245);
+ video::SColor c_bottom(128,b*205,b*205,b*230);
video::S3DVertex v[4] =
{
- video::S3DVertex(0,0,0, 0,0,0, c, 0, 1),
- video::S3DVertex(0,0,0, 0,0,0, c, 1, 1),
- video::S3DVertex(0,0,0, 0,0,0, c, 1, 0),
- video::S3DVertex(0,0,0, 0,0,0, c, 0, 0)
+ video::S3DVertex(0,0,0, 0,0,0, c_top, 0, 1),
+ video::S3DVertex(0,0,0, 0,0,0, c_top, 1, 1),
+ video::S3DVertex(0,0,0, 0,0,0, c_top, 1, 0),
+ video::S3DVertex(0,0,0, 0,0,0, c_top, 0, 0)
};
f32 rx = cloud_size;
- f32 ry = 16*BS;
+ f32 ry = 8*BS;
f32 rz = cloud_size;
for(int i=0;i<6;i++)
@@ -152,30 +155,40 @@ void Clouds::render()
v[3].Pos.X= rx; v[3].Pos.Y= ry, v[3].Pos.Z=-rz;
break;
case 1: // back
+ for(int j=0;j<4;j++)
+ v[j].Color=c_side_1;
v[0].Pos.X=-rx; v[0].Pos.Y= ry; v[0].Pos.Z=-rz;
v[1].Pos.X= rx; v[1].Pos.Y= ry; v[1].Pos.Z=-rz;
v[2].Pos.X= rx; v[2].Pos.Y=-ry; v[2].Pos.Z=-rz;
v[3].Pos.X=-rx; v[3].Pos.Y=-ry, v[3].Pos.Z=-rz;
break;
case 2: //right
+ for(int j=0;j<4;j++)
+ v[j].Color=c_side_2;
v[0].Pos.X= rx; v[0].Pos.Y= ry; v[0].Pos.Z=-rz;
v[1].Pos.X= rx; v[1].Pos.Y= ry; v[1].Pos.Z= rz;
v[2].Pos.X= rx; v[2].Pos.Y=-ry; v[2].Pos.Z= rz;
v[3].Pos.X= rx; v[3].Pos.Y=-ry, v[3].Pos.Z=-rz;
break;
case 3: // front
+ for(int j=0;j<4;j++)
+ v[j].Color=c_side_1;
v[0].Pos.X= rx; v[0].Pos.Y= ry; v[0].Pos.Z= rz;
v[1].Pos.X=-rx; v[1].Pos.Y= ry; v[1].Pos.Z= rz;
v[2].Pos.X=-rx; v[2].Pos.Y=-ry; v[2].Pos.Z= rz;
v[3].Pos.X= rx; v[3].Pos.Y=-ry, v[3].Pos.Z= rz;
break;
case 4: // left
+ for(int j=0;j<4;j++)
+ v[j].Color=c_side_2;
v[0].Pos.X=-rx; v[0].Pos.Y= ry; v[0].Pos.Z= rz;
v[1].Pos.X=-rx; v[1].Pos.Y= ry; v[1].Pos.Z=-rz;
v[2].Pos.X=-rx; v[2].Pos.Y=-ry; v[2].Pos.Z=-rz;
v[3].Pos.X=-rx; v[3].Pos.Y=-ry, v[3].Pos.Z= rz;
break;
case 5: // bottom
+ for(int j=0;j<4;j++)
+ v[j].Color=c_bottom;
v[0].Pos.X= rx; v[0].Pos.Y=-ry; v[0].Pos.Z= rz;
v[1].Pos.X=-rx; v[1].Pos.Y=-ry; v[1].Pos.Z= rz;
v[2].Pos.X=-rx; v[2].Pos.Y=-ry; v[2].Pos.Z=-rz;