aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_modchannels.cpp
diff options
context:
space:
mode:
authorwinniepee <winniepee0@gmail.com>2021-03-01 15:35:51 +0000
committersfan5 <sfan5@live.de>2021-06-16 18:23:09 +0200
commitfa303ae12e55a43178d273be1b6205baa69e78cb (patch)
tree594354007695c37d533bbb548b037def5a5d6b39 /src/script/lua_api/l_modchannels.cpp
parent4bc56034cfb3c27d68f4548d6413a5ee76adad41 (diff)
downloadminetest-fa303ae12e55a43178d273be1b6205baa69e78cb.tar.gz
minetest-fa303ae12e55a43178d273be1b6205baa69e78cb.tar.bz2
minetest-fa303ae12e55a43178d273be1b6205baa69e78cb.zip
Translated using Weblate (Chinese (Simplified))
Currently translated at 92.4% (1254 of 1356 strings)
Diffstat (limited to 'src/script/lua_api/l_modchannels.cpp')
0 files changed, 0 insertions, 0 deletions
ibuted in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "collector.h" #include <stdexcept> #include "log.h" #include "client/mesh.h" void MeshCollector::append(const TileSpec &tile, const video::S3DVertex *vertices, u32 numVertices, const u16 *indices, u32 numIndices) { for (int layernum = 0; layernum < MAX_TILE_LAYERS; layernum++) { const TileLayer *layer = &tile.layers[layernum]; if (layer->texture_id == 0) continue; append(*layer, vertices, numVertices, indices, numIndices, layernum, tile.world_aligned); } } void MeshCollector::append(const TileLayer &layer, const video::S3DVertex *vertices, u32 numVertices, const u16 *indices, u32 numIndices, u8 layernum, bool use_scale) { PreMeshBuffer &p = findBuffer(layer, layernum, numVertices); f32 scale = 1.0f; if (use_scale) scale = 1.0f / layer.scale; u32 vertex_count = p.vertices.size(); for (u32 i = 0; i < numVertices; i++) p.vertices.emplace_back(vertices[i].Pos, vertices[i].Normal, vertices[i].Color, scale * vertices[i].TCoords); for (u32 i = 0; i < numIndices; i++) p.indices.push_back(indices[i] + vertex_count); } void MeshCollector::append(const TileSpec &tile, const video::S3DVertex *vertices, u32 numVertices, const u16 *indices, u32 numIndices, v3f pos, video::SColor c, u8 light_source) { for (int layernum = 0; layernum < MAX_TILE_LAYERS; layernum++) { const TileLayer *layer = &tile.layers[layernum]; if (layer->texture_id == 0) continue; append(*layer, vertices, numVertices, indices, numIndices, pos, c, light_source, layernum, tile.world_aligned); } } void MeshCollector::append(const TileLayer &layer, const video::S3DVertex *vertices, u32 numVertices, const u16 *indices, u32 numIndices, v3f pos, video::SColor c, u8 light_source, u8 layernum, bool use_scale) { PreMeshBuffer &p = findBuffer(layer, layernum, numVertices); f32 scale = 1.0f; if (use_scale) scale = 1.0f / layer.scale; u32 vertex_count = p.vertices.size(); for (u32 i = 0; i < numVertices; i++) { video::SColor color = c; if (!light_source) applyFacesShading(color, vertices[i].Normal); p.vertices.emplace_back(vertices[i].Pos + pos, vertices[i].Normal, color, scale * vertices[i].TCoords); } for (u32 i = 0; i < numIndices; i++) p.indices.push_back(indices[i] + vertex_count);