aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-07-21 18:59:12 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-07-21 18:59:12 +0300
commit47d30d12cb550666cc3776c3ed381c318f294ba9 (patch)
treea12c583c6325edea3330c96a98ce4afc9fd8c9b0 /src
parent43df78102c0a95001443979827d747cfe5bd2e37 (diff)
downloadminetest-47d30d12cb550666cc3776c3ed381c318f294ba9.tar.gz
minetest-47d30d12cb550666cc3776c3ed381c318f294ba9.tar.bz2
minetest-47d30d12cb550666cc3776c3ed381c318f294ba9.zip
Facedir rotation of nodebox textures
Diffstat (limited to 'src')
-rw-r--r--src/content_mapblock.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp
index d87ae32fb..3d049f8cd 100644
--- a/src/content_mapblock.cpp
+++ b/src/content_mapblock.cpp
@@ -1035,6 +1035,48 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
tiles[i] = getNodeTileN(n, p, i, data);
}
+ // Facedir rotation for textures
+ if(f.node_box.type == NODEBOX_FIXED){
+ int facedir = n.getFaceDir(nodedef);
+ if(facedir == 1){ // -90
+ TileSpec old[6];
+ for(int i=0; i<6; i++)
+ old[i] = tiles[i];
+ // right <- back
+ tiles[2] = old[4];
+ // back <- left
+ tiles[4] = old[3];
+ // left <- front
+ tiles[3] = old[5];
+ // front <- right
+ tiles[5] = old[2];
+ }
+ if(facedir == 2){ // 180
+ TileSpec old[6];
+ for(int i=0; i<6; i++)
+ old[i] = tiles[i];
+ // right <-> left
+ tiles[2] = old[3];
+ tiles[3] = old[2];
+ // back <-> front
+ tiles[4] = old[5];
+ tiles[5] = old[4];
+ }
+ if(facedir == 3){ // 90
+ TileSpec old[6];
+ for(int i=0; i<6; i++)
+ old[i] = tiles[i];
+ // right <- front
+ tiles[2] = old[5];
+ // back <- right
+ tiles[4] = old[2];
+ // left <- back
+ tiles[3] = old[4];
+ // front <- left
+ tiles[5] = old[3];
+ }
+ }
+
u16 l = getInteriorLight(n, 0, data);
video::SColor c = MapBlock_LightColor(255, l);