diff options
Diffstat (limited to 'src/mapblock_mesh.cpp')
-rw-r--r-- | src/mapblock_mesh.cpp | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index d8a7d4d7d..e854127c0 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -202,7 +202,7 @@ u16 getFaceLight(MapNode n, MapNode n2, v3s16 face_dir, INodeDefManager *ndef) Calculate smooth lighting at the XYZ- corner of p. Both light banks */ -static u16 getSmoothLightCombined(v3s16 p, MeshMakeData *data) +static u16 getSmoothLightCombined(const v3s16 &p, MeshMakeData *data) { static const v3s16 dirs8[8] = { v3s16(0,0,0), @@ -855,11 +855,10 @@ static void getTileInfo( */ static void updateFastFaceRow( MeshMakeData *data, - v3s16 startpos, + const v3s16 &&startpos, v3s16 translate_dir, - v3f translate_dir_f, - v3s16 face_dir, - v3f face_dir_f, + const v3f &&translate_dir_f, + const v3s16 &&face_dir, std::vector<FastFace> &dest) { v3s16 p = startpos; @@ -966,7 +965,6 @@ static void updateAllFastFaceRows(MeshMakeData *data, v3s16(1,0,0), //dir v3f (1,0,0), v3s16(0,1,0), //face dir - v3f (0,1,0), dest); } } @@ -981,7 +979,6 @@ static void updateAllFastFaceRows(MeshMakeData *data, v3s16(0,0,1), //dir v3f (0,0,1), v3s16(1,0,0), //face dir - v3f (1,0,0), dest); } } @@ -996,7 +993,6 @@ static void updateAllFastFaceRows(MeshMakeData *data, v3s16(1,0,0), //dir v3f (1,0,0), v3s16(0,0,1), //face dir - v3f (0,0,1), dest); } } @@ -1525,14 +1521,12 @@ void MeshCollector::applyTileColors() { if (m_use_tangent_vertices) for (int layer = 0; layer < MAX_TILE_LAYERS; layer++) { - std::vector<PreMeshBuffer> *p = &prebuffers[layer]; - for (std::vector<PreMeshBuffer>::iterator it = p->begin(); - it != p->end(); ++it) { - video::SColor tc = it->layer.color; + for (auto &pmb : prebuffers[layer]) { + video::SColor tc = pmb.layer.color; if (tc == video::SColor(0xFFFFFFFF)) continue; - for (u32 index = 0; index < it->tangent_vertices.size(); index++) { - video::SColor *c = &it->tangent_vertices[index].Color; + for (auto &tangent_vertice : pmb.tangent_vertices) { + video::SColor *c = &tangent_vertice.Color; c->set(c->getAlpha(), c->getRed() * tc.getRed() / 255, c->getGreen() * tc.getGreen() / 255, c->getBlue() * tc.getBlue() / 255); @@ -1541,14 +1535,12 @@ void MeshCollector::applyTileColors() } else for (int layer = 0; layer < MAX_TILE_LAYERS; layer++) { - std::vector<PreMeshBuffer> *p = &prebuffers[layer]; - for (std::vector<PreMeshBuffer>::iterator it = p->begin(); - it != p->end(); ++it) { - video::SColor tc = it->layer.color; + for (auto &pmb : prebuffers[layer]) { + video::SColor tc = pmb.layer.color; if (tc == video::SColor(0xFFFFFFFF)) continue; - for (u32 index = 0; index < it->vertices.size(); index++) { - video::SColor *c = &it->vertices[index].Color; + for (auto &vertice : pmb.vertices) { + video::SColor *c = &vertice.Color; c->set(c->getAlpha(), c->getRed() * tc.getRed() / 255, c->getGreen() * tc.getGreen() / 255, c->getBlue() * tc.getBlue() / 255); |