add gfx.blockwraps library & add on_player_tick world event

This commit is contained in:
MihailRis
2024-11-21 06:48:23 +03:00
parent 2ba90625ce
commit 61b1aa8e3d
13 changed files with 98 additions and 15 deletions
+7 -2
View File
@@ -79,8 +79,9 @@ void BlockWrapsRenderer::draw(const BlockWrapper& wrapper) {
void BlockWrapsRenderer::draw(const DrawContext& pctx, const Player& player) {
auto ctx = pctx.sub();
for (const auto& [_, wrapper] : wrappers) {
draw(*wrapper);
}
batch->flush();
}
@@ -101,3 +102,7 @@ BlockWrapper* BlockWrapsRenderer::get(u64id_t id) const {
}
return found->second.get();
}
void BlockWrapsRenderer::remove(u64id_t id) {
wrappers.erase(id);
}
@@ -35,4 +35,6 @@ public:
u64id_t add(const glm::ivec3& position, const std::string& texture);
BlockWrapper* get(u64id_t id) const;
void remove(u64id_t id);
};
+1 -1
View File
@@ -40,7 +40,6 @@ class WorldRenderer {
std::unique_ptr<LineBatch> lineBatch;
std::unique_ptr<Batch3D> batch3d;
std::unique_ptr<ChunksRenderer> chunks;
std::unique_ptr<BlockWrapsRenderer> blockWraps;
std::unique_ptr<GuidesRenderer> guides;
std::unique_ptr<Skybox> skybox;
std::unique_ptr<ModelBatch> modelBatch;
@@ -70,6 +69,7 @@ class WorldRenderer {
public:
std::unique_ptr<TextsRenderer> texts;
std::unique_ptr<ParticlesRenderer> particles;
std::unique_ptr<BlockWrapsRenderer> blockWraps;
static bool showChunkBorders;
static bool showEntitiesDebug;