diff options
author | Sokomine <wegwerf@anarres.dyndns.org> | 2013-10-08 22:41:53 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2013-10-14 21:38:56 +0300 |
commit | 19742d8d985dbb0a63a406c881617da7aed50151 (patch) | |
tree | ee0ce2f85bfc8ddf255fe84480e41ae6cf838cdb /src | |
parent | f86cdf0960eb12341545f5b708a35fd026880f22 (diff) | |
download | minetest-19742d8d985dbb0a63a406c881617da7aed50151.tar.gz minetest-19742d8d985dbb0a63a406c881617da7aed50151.tar.bz2 minetest-19742d8d985dbb0a63a406c881617da7aed50151.zip |
Add support for parameter 'visual_scale' for drawtypes 'signlike' and 'torchlike' like used for drawtype 'plantlike'
Diffstat (limited to 'src')
-rw-r--r-- | src/content_mapblock.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp index 929682eaf..3cded5bdb 100644 --- a/src/content_mapblock.cpp +++ b/src/content_mapblock.cpp @@ -908,13 +908,14 @@ void mapblock_mesh_generate_special(MeshMakeData *data, u16 l = getInteriorLight(n, 1, data); video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source)); + float s = BS/2*f.visual_scale; // Wall at X+ of node video::S3DVertex vertices[4] = { - video::S3DVertex(-BS/2,-BS/2,0, 0,0,0, c, 0,1), - video::S3DVertex(BS/2,-BS/2,0, 0,0,0, c, 1,1), - video::S3DVertex(BS/2,BS/2,0, 0,0,0, c, 1,0), - video::S3DVertex(-BS/2,BS/2,0, 0,0,0, c, 0,0), + video::S3DVertex(-s,-s,0, 0,0,0, c, 0,1), + video::S3DVertex( s,-s,0, 0,0,0, c, 1,1), + video::S3DVertex( s, s,0, 0,0,0, c, 1,0), + video::S3DVertex(-s, s,0, 0,0,0, c, 0,0), }; for(s32 i=0; i<4; i++) @@ -949,13 +950,14 @@ void mapblock_mesh_generate_special(MeshMakeData *data, video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source)); float d = (float)BS/16; + float s = BS/2*f.visual_scale; // Wall at X+ of node video::S3DVertex vertices[4] = { - video::S3DVertex(BS/2-d,BS/2,BS/2, 0,0,0, c, 0,0), - video::S3DVertex(BS/2-d,BS/2,-BS/2, 0,0,0, c, 1,0), - video::S3DVertex(BS/2-d,-BS/2,-BS/2, 0,0,0, c, 1,1), - video::S3DVertex(BS/2-d,-BS/2,BS/2, 0,0,0, c, 0,1), + video::S3DVertex(BS/2-d, s, s, 0,0,0, c, 0,0), + video::S3DVertex(BS/2-d, s, -s, 0,0,0, c, 1,0), + video::S3DVertex(BS/2-d, -s, -s, 0,0,0, c, 1,1), + video::S3DVertex(BS/2-d, -s, s, 0,0,0, c, 0,1), }; v3s16 dir = n.getWallMountedDir(nodedef); @@ -990,16 +992,16 @@ void mapblock_mesh_generate_special(MeshMakeData *data, u16 l = getInteriorLight(n, 1, data); video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source)); + float s = BS/2*f.visual_scale; + for(u32 j=0; j<2; j++) { video::S3DVertex vertices[4] = { - video::S3DVertex(-BS/2*f.visual_scale,-BS/2,0, 0,0,0, c, 0,1), - video::S3DVertex( BS/2*f.visual_scale,-BS/2,0, 0,0,0, c, 1,1), - video::S3DVertex( BS/2*f.visual_scale, - -BS/2 + f.visual_scale*BS,0, 0,0,0, c, 1,0), - video::S3DVertex(-BS/2*f.visual_scale, - -BS/2 + f.visual_scale*BS,0, 0,0,0, c, 0,0), + video::S3DVertex(-s,-BS/2, 0, 0,0,0, c, 0,1), + video::S3DVertex( s,-BS/2, 0, 0,0,0, c, 1,1), + video::S3DVertex( s,-BS/2 + s*2,0, 0,0,0, c, 1,0), + video::S3DVertex(-s,-BS/2 + s*2,0, 0,0,0, c, 0,0), }; if(j == 0) |