diff options
author | Vitaliy <silverunicorn2011@yandex.ru> | 2017-10-15 10:34:14 +0300 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-10-15 09:34:14 +0200 |
commit | 75320e7e88ab5088a46c9e42c1e789cbdacb13b0 (patch) | |
tree | da71a3134f8b42bdabf25ef1df14c5e1a77a439e /src/wieldmesh.cpp | |
parent | 6bab695479d42ac2b051b8a35639c32b22efbf8d (diff) | |
download | minetest-75320e7e88ab5088a46c9e42c1e789cbdacb13b0.tar.gz minetest-75320e7e88ab5088a46c9e42c1e789cbdacb13b0.tar.bz2 minetest-75320e7e88ab5088a46c9e42c1e789cbdacb13b0.zip |
Real global textures (#6105)
* Real global textures
* Add world-aligned textures
* Update minimal to support world-aligned tiles
* Update minimal
Diffstat (limited to 'src/wieldmesh.cpp')
-rw-r--r-- | src/wieldmesh.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/wieldmesh.cpp b/src/wieldmesh.cpp index 0394cc9ea..98e7b5fa1 100644 --- a/src/wieldmesh.cpp +++ b/src/wieldmesh.cpp @@ -233,7 +233,7 @@ void WieldMeshSceneNode::setCube(const ContentFeatures &f, scene::IMesh *cubemesh = g_extrusion_mesh_cache->createCube(); scene::SMesh *copy = cloneMesh(cubemesh); cubemesh->drop(); - postProcessNodeMesh(copy, f, false, true, &m_material_type, &m_colors); + postProcessNodeMesh(copy, f, false, true, &m_material_type, &m_colors, true); changeToMesh(copy); copy->drop(); m_meshnode->setScale(wield_scale * WIELD_SCALE_FACTOR); @@ -554,7 +554,7 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result) // add overlays (since getMesh() returns // the base layer only) postProcessNodeMesh(mesh, f, false, false, nullptr, - &result->buffer_colors); + &result->buffer_colors, f.drawtype == NDT_NORMAL); } } } @@ -622,7 +622,7 @@ scene::SMesh *getExtrudedMesh(ITextureSource *tsrc, void postProcessNodeMesh(scene::SMesh *mesh, const ContentFeatures &f, bool use_shaders, bool set_material, const video::E_MATERIAL_TYPE *mattype, - std::vector<ItemPartColor> *colors) + std::vector<ItemPartColor> *colors, bool apply_scale) { u32 mc = mesh->getMeshBufferCount(); // Allocate colors for existing buffers @@ -670,6 +670,11 @@ void postProcessNodeMesh(scene::SMesh *mesh, const ContentFeatures &f, } material.setTexture(2, layer->flags_texture); } + if (apply_scale && tile->world_aligned) { + u32 n = buf->getVertexCount(); + for (u32 k = 0; k != n; ++k) + buf->getTCoords(k) /= layer->scale; + } } } } |