diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-07-23 02:04:24 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-07-23 02:04:24 +0300 |
commit | 8993d9dd8321aad1243f4fb7fc55259c3747224f (patch) | |
tree | 90ad8e88e5480d5864277d4fca0dd9c6fd159a55 /src/content_mapblock.cpp | |
parent | fdf14471c6fd56003ba32943db5c6eee67bd5e60 (diff) | |
download | minetest-8993d9dd8321aad1243f4fb7fc55259c3747224f.tar.gz minetest-8993d9dd8321aad1243f4fb7fc55259c3747224f.tar.bz2 minetest-8993d9dd8321aad1243f4fb7fc55259c3747224f.zip |
Jungle biome/whatever thing
Diffstat (limited to 'src/content_mapblock.cpp')
-rw-r--r-- | src/content_mapblock.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp index d8bf71dc0..730907222 100644 --- a/src/content_mapblock.cpp +++ b/src/content_mapblock.cpp @@ -198,6 +198,17 @@ void mapblock_mesh_generate_special(MeshMakeData *data, AtlasPointer pa_papyrus = g_texturesource->getTexture( g_texturesource->getTextureId("papyrus.png")); material_papyrus.setTexture(0, pa_papyrus.atlas); + + // junglegrass material + video::SMaterial material_junglegrass; + material_junglegrass.setFlag(video::EMF_LIGHTING, false); + material_junglegrass.setFlag(video::EMF_BILINEAR_FILTER, false); + material_junglegrass.setFlag(video::EMF_FOG_ENABLE, true); + material_junglegrass.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; + AtlasPointer pa_junglegrass = g_texturesource->getTexture( + g_texturesource->getTextureId("junglegrass.png")); + material_junglegrass.setTexture(0, pa_junglegrass.atlas); + for(s16 z=0; z<MAP_BLOCKSIZE; z++) for(s16 y=0; y<MAP_BLOCKSIZE; y++) for(s16 x=0; x<MAP_BLOCKSIZE; x++) @@ -966,6 +977,57 @@ void mapblock_mesh_generate_special(MeshMakeData *data, collector.append(material_papyrus, vertices, 4, indices, 6); } } + else if(n.d == CONTENT_JUNGLEGRASS) + { + u8 l = decode_light(undiminish_light(n.getLightBlend(data->m_daynight_ratio))); + video::SColor c(255,l,l,l); + + for(u32 j=0; j<4; j++) + { + video::S3DVertex vertices[4] = + { + video::S3DVertex(-BS/2,-BS/2,0, 0,0,0, c, + pa_papyrus.x0(), pa_papyrus.y1()), + video::S3DVertex(BS/2,-BS/2,0, 0,0,0, c, + pa_papyrus.x1(), pa_papyrus.y1()), + video::S3DVertex(BS/2,BS/1,0, 0,0,0, c, + pa_papyrus.x1(), pa_papyrus.y0()), + video::S3DVertex(-BS/2,BS/1,0, 0,0,0, c, + pa_papyrus.x0(), pa_papyrus.y0()), + }; + + if(j == 0) + { + for(u16 i=0; i<4; i++) + vertices[i].Pos.rotateXZBy(45); + } + else if(j == 1) + { + for(u16 i=0; i<4; i++) + vertices[i].Pos.rotateXZBy(-45); + } + else if(j == 2) + { + for(u16 i=0; i<4; i++) + vertices[i].Pos.rotateXZBy(135); + } + else if(j == 3) + { + for(u16 i=0; i<4; i++) + vertices[i].Pos.rotateXZBy(-135); + } + + for(u16 i=0; i<4; i++) + { + vertices[i].Pos *= 1.3; + vertices[i].Pos += intToFloat(p + blockpos_nodes, BS); + } + + u16 indices[] = {0,1,2,2,3,0}; + // Add to mesh collector + collector.append(material_junglegrass, vertices, 4, indices, 6); + } + } else if(n.d == CONTENT_RAIL) { u8 l = decode_light(n.getLightBlend(data->m_daynight_ratio)); |