Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
collector.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2018 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
4
5#pragma once
6#include <array>
7#include <vector>
8#include "irrlichttypes.h"
9#include "irr_v3d.h"
10#include <S3DVertex.h>
11#include "client/tile.h"
12
14{
16 std::vector<u16> indices;
17 std::vector<video::S3DVertex> vertices;
18
19 PreMeshBuffer() = default;
20 explicit PreMeshBuffer(const TileLayer &layer) : layer(layer) {}
21};
22
24{
25 std::array<std::vector<PreMeshBuffer>, MAX_TILE_LAYERS> prebuffers;
26 // bounding sphere radius and center
30
31 // center_pos: pos to use for bounding-sphere, in BS-space
32 // offset: offset added to vertices
33 MeshCollector(const v3f center_pos, v3f offset = v3f()) : m_center_pos(center_pos), offset(offset) {}
34
35 void append(const TileSpec &material,
36 const video::S3DVertex *vertices, u32 numVertices,
37 const u16 *indices, u32 numIndices);
38 void append(const TileSpec &material,
39 const video::S3DVertex *vertices, u32 numVertices,
40 const u16 *indices, u32 numIndices,
41 v3f pos, video::SColor c, u8 light_source);
42
43private:
44 void append(const TileLayer &material,
45 const video::S3DVertex *vertices, u32 numVertices,
46 const u16 *indices, u32 numIndices,
47 u8 layernum, bool use_scale = false);
48 void append(const TileLayer &material,
49 const video::S3DVertex *vertices, u32 numVertices,
50 const u16 *indices, u32 numIndices,
51 v3f pos, video::SColor c, u8 light_source,
52 u8 layernum, bool use_scale = false);
53
54 PreMeshBuffer &findBuffer(const TileLayer &layer, u8 layernum, u32 numVertices);
55};
core::vector3df v3f
Definition irr_v3d.h:11
Definition collector.h:24
void append(const TileSpec &material, const video::S3DVertex *vertices, u32 numVertices, const u16 *indices, u32 numIndices)
Definition collector.cpp:10
MeshCollector(const v3f center_pos, v3f offset=v3f())
Definition collector.h:33
v3f offset
Definition collector.h:29
v3f m_center_pos
Definition collector.h:28
std::array< std::vector< PreMeshBuffer >, MAX_TILE_LAYERS > prebuffers
Definition collector.h:25
PreMeshBuffer & findBuffer(const TileLayer &layer, u8 layernum, u32 numVertices)
Definition collector.cpp:83
f32 m_bounding_radius_sq
Definition collector.h:27
Definition collector.h:14
std::vector< video::S3DVertex > vertices
Definition collector.h:17
TileLayer layer
Definition collector.h:15
PreMeshBuffer(const TileLayer &layer)
Definition collector.h:20
std::vector< u16 > indices
Definition collector.h:16
PreMeshBuffer()=default
Defines a layer of a tile.
Definition tile.h:56
Definition tile.h:139
#define MAX_TILE_LAYERS
Definition tile.h:52