From 28c8ca440ffd16a33e6949eed10afbcf4a7d363f Mon Sep 17 00:00:00 2001 From: darkrose Date: Wed, 27 Nov 2013 20:06:08 +1000 Subject: [PATCH] some tweaks to meshgen --- src/mapblock_mesh.cpp | 52 ++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index 56364b0..b41affc 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -644,8 +644,7 @@ void updateFastFaceRow( scene::SMesh* makeMapBlockMesh(MeshMakeData *data) { - // 4-21ms for MAP_BLOCKSIZE=16 - // 24-155ms for MAP_BLOCKSIZE=32 + // 2-12ms for MAP_BLOCKSIZE=16 //TimeTaker timer1("makeMapBlockMesh()"); core::array fastfaces_new; @@ -671,14 +670,15 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data) */ { - // 4-23ms for MAP_BLOCKSIZE=16 + // 2-12ms for MAP_BLOCKSIZE=16 //TimeTaker timer2("updateMesh() collect"); - + for (s16 x=0; xm_daynight_ratio, posRelative_f, v3s16(0,y,z), MAP_BLOCKSIZE, v3s16(1,0,0), //dir @@ -690,31 +690,9 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data) data->m_vmanip, blockpos_nodes, smooth_lighting); - } - } - /* - Go through every x,y and get right(x+) faces in rows of z+ - */ - for(s16 x=0; xm_daynight_ratio, posRelative_f, - v3s16(x,y,0), MAP_BLOCKSIZE, - v3s16(0,0,1), - v3f (0,0,1), - v3s16(1,0,0), - v3f (1,0,0), - fastfaces_new, - data->m_temp_mods, - data->m_vmanip, - blockpos_nodes, - smooth_lighting); - } - } /* Go through every y,z and get back(z+) faces in rows of x+ */ - for(s16 z=0; zm_daynight_ratio, posRelative_f, v3s16(0,y,z), MAP_BLOCKSIZE, v3s16(1,0,0), @@ -726,6 +704,24 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data) data->m_vmanip, blockpos_nodes, smooth_lighting); + } + if (!z) { + /* + Go through every x,y and get right(x+) faces in rows of z+ + */ + updateFastFaceRow(data->m_daynight_ratio, posRelative_f, + v3s16(x,y,0), MAP_BLOCKSIZE, + v3s16(0,0,1), + v3f (0,0,1), + v3s16(1,0,0), + v3f (1,0,0), + fastfaces_new, + data->m_temp_mods, + data->m_vmanip, + blockpos_nodes, + smooth_lighting); + } + } } } }