2024-10-28 15:57:39 +01:00
|
|
|
// Luanti
|
|
|
|
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
// Copyright (C) 2016 MillersMan <millersman@users.noreply.github.com>
|
2016-11-27 21:51:40 +01:00
|
|
|
|
2017-08-17 22:19:39 +02:00
|
|
|
#pragma once
|
2016-11-27 21:51:40 +01:00
|
|
|
|
|
|
|
#include "util/container.h"
|
|
|
|
#include "irrlichttypes_bloated.h"
|
|
|
|
|
2018-02-10 21:04:16 +01:00
|
|
|
class NodeDefManager;
|
2016-11-27 21:51:40 +01:00
|
|
|
class Map;
|
|
|
|
class MapBlock;
|
|
|
|
|
|
|
|
class ReflowScan {
|
|
|
|
public:
|
2018-02-10 21:04:16 +01:00
|
|
|
ReflowScan(Map *map, const NodeDefManager *ndef);
|
2016-11-27 21:51:40 +01:00
|
|
|
void scan(MapBlock *block, UniqueQueue<v3s16> *liquid_queue);
|
|
|
|
|
|
|
|
private:
|
|
|
|
MapBlock *lookupBlock(int x, int y, int z);
|
|
|
|
bool isLiquidFlowableTo(int x, int y, int z);
|
|
|
|
bool isLiquidHorizontallyFlowable(int x, int y, int z);
|
|
|
|
void scanColumn(int x, int z);
|
|
|
|
|
|
|
|
private:
|
2017-06-18 19:55:15 +02:00
|
|
|
Map *m_map = nullptr;
|
2018-02-10 21:04:16 +01:00
|
|
|
const NodeDefManager *m_ndef = nullptr;
|
2016-11-27 21:51:40 +01:00
|
|
|
v3s16 m_block_pos, m_rel_block_pos;
|
2017-06-18 19:55:15 +02:00
|
|
|
UniqueQueue<v3s16> *m_liquid_queue = nullptr;
|
2016-11-27 21:51:40 +01:00
|
|
|
MapBlock *m_lookup[3 * 3 * 3];
|
|
|
|
u32 m_lookup_state_bitset;
|
|
|
|
};
|