3 Copyright (C) 2018 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "irrlichttypes.h"
25 #include <S3DVertex.h>
26 #include "client/tile.h"
31 std::vector<u16> indices;
32 std::vector<video::S3DVertex> vertices;
34 PreMeshBuffer() = default;
35 explicit PreMeshBuffer(const TileLayer &layer) : layer(layer) {}
40 std::array<std::vector<PreMeshBuffer>, MAX_TILE_LAYERS> prebuffers;
41 // bounding sphere radius and center
42 f32 m_bounding_radius_sq = 0.0f;
46 // center_pos: pos to use for bounding-sphere, in BS-space
47 // offset: offset added to vertices
48 MeshCollector(const v3f center_pos, v3f offset = v3f()) : m_center_pos(center_pos), offset(offset) {}
51 void append(const TileSpec &material,
52 const video::S3DVertex *vertices, u32 numVertices,
53 const u16 *indices, u32 numIndices);
54 void append(const TileSpec &material,
55 const video::S3DVertex *vertices, u32 numVertices,
56 const u16 *indices, u32 numIndices,
57 v3f pos, video::SColor c, u8 light_source);
62 void append(const TileLayer &material,
63 const video::S3DVertex *vertices, u32 numVertices,
64 const u16 *indices, u32 numIndices,
65 u8 layernum, bool use_scale = false);
66 void append(const TileLayer &material,
67 const video::S3DVertex *vertices, u32 numVertices,
68 const u16 *indices, u32 numIndices,
69 v3f pos, video::SColor c, u8 light_source,
70 u8 layernum, bool use_scale = false);
73 PreMeshBuffer &findBuffer(const TileLayer &layer, u8 layernum, u32 numVertices);