From 626ed6338aa90eb07038adee29643e692fec6545 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 14 Dec 2010 00:21:18 +0200 Subject: in before messing with face drawing orientation --- src/mapblock.cpp | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) (limited to 'src/mapblock.cpp') diff --git a/src/mapblock.cpp b/src/mapblock.cpp index 4ba597f6a..40af0e397 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -138,6 +138,8 @@ FastFace * MapBlock::makeFastFace(u16 tile, u8 light, v3f p, core::vector2d(0,0)); f->tile = tile; + //DEBUG + //f->tile = TILE_GRASS; return f; } @@ -184,15 +186,30 @@ u8 MapBlock::getFaceLight(v3s16 p, v3s16 face_dir) } /* - Gets node material from any place relative to block. + Gets node tile from any place relative to block. Returns CONTENT_IGNORE if doesn't exist or should not be drawn. */ -u8 MapBlock::getNodeTile(v3s16 p) +u16 MapBlock::getNodeTile(v3s16 p, v3s16 face_dir) { try{ MapNode n = getNodeParent(p); - return content_tile(n.d); + //return content_tile(n.d); + return n.getTile(face_dir); + } + catch(InvalidPositionException &e) + { + //return CONTENT_IGNORE; + return TILE_NONE; + } +} + +u8 MapBlock::getNodeContent(v3s16 p) +{ + try{ + MapNode n = getNodeParent(p); + + return n.d; } catch(InvalidPositionException &e) { @@ -223,15 +240,14 @@ void MapBlock::updateFastFaceRow(v3s16 startpos, v3s16 p = startpos; /* - The light in the air lights the surface is taken from - the node that is air. + Get face light at starting position */ u8 light = getFaceLight(p, face_dir); u16 continuous_tiles_count = 0; - u8 tile0 = getNodeTile(p); - u8 tile1 = getNodeTile(p + face_dir); + u8 tile0 = getNodeTile(p, face_dir); + u8 tile1 = getNodeTile(p + face_dir, -face_dir); for(u16 j=0; jmaterial], f->vertices, 4, indices, 6);*/ - collector.append(g_materials[f->tile], f->vertices, 4, + /*collector.append(g_materials[f->tile], f->vertices, 4, + indices, 6);*/ + collector.append(g_tile_materials[f->tile], f->vertices, 4, indices, 6); } -- cgit v1.2.3