From 7d3584629fcff0ce9bd855aa4dc25344b2c158a9 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 2 Nov 2026 00:07:47 +0300 Subject: [PATCH] cleanup --- src/frontend/ContentGfxCache.cpp | 1 + src/frontend/ContentGfxCache.hpp | 67 +++++++++++++++++--------------- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/frontend/ContentGfxCache.cpp b/src/frontend/ContentGfxCache.cpp index 025546a90..6da851a56 100644 --- a/src/frontend/ContentGfxCache.cpp +++ b/src/frontend/ContentGfxCache.cpp @@ -18,6 +18,7 @@ #include #include #include +#include static debug::Logger logger("content-gfx-cache"); diff --git a/src/frontend/ContentGfxCache.hpp b/src/frontend/ContentGfxCache.hpp index 8e3833492..095850b12 100644 --- a/src/frontend/ContentGfxCache.hpp +++ b/src/frontend/ContentGfxCache.hpp @@ -2,13 +2,12 @@ #include "typedefs.hpp" -#include -#include -#include - #include "maths/UVRegion.hpp" #include "graphics/commons/Model.hpp" +#include +#include + class Content; class Assets; class Atlas; @@ -17,10 +16,39 @@ struct UVRegion; struct Variant; struct GraphicsSettings; -inline constexpr int GFXC_MAX_VARIANTS = 16; -inline constexpr int GFXC_SIDES = 6; - class ContentGfxCache { + static constexpr int GFXC_MAX_VARIANTS = 16; + static constexpr int GFXC_SIDES = 6; +public: + ContentGfxCache( + const Content& content, + const Assets& assets, + const GraphicsSettings& settings + ); + ~ContentGfxCache(); + + static inline size_t getRegionIndex( + blockid_t id, uint8_t variant, int side, bool opaque + ) { + return ((id * GFXC_SIDES + side) * GFXC_MAX_VARIANTS + variant) * 2 + + opaque; + } + + inline const UVRegion& getRegion( + blockid_t id, uint8_t variant, int side, bool dense + ) const { + return sideregions[getRegionIndex(id, variant, side, !dense)]; + } + + const model::Model& getModel( + blockid_t id, uint8_t variant, uint8_t rotation = 0 + ) const; + + void refresh(const Block& block, const Atlas& atlas); + + void refresh(); + +private: const Content& content; const Assets& assets; const GraphicsSettings& settings; @@ -42,29 +70,4 @@ class ContentGfxCache { uint8_t variantIndex, const Atlas& atlas ); -public: - ContentGfxCache( - const Content& content, - const Assets& assets, - const GraphicsSettings& settings - ); - ~ContentGfxCache(); - - static inline size_t getRegionIndex( - blockid_t id, uint8_t variant, int side, bool opaque - ) { - return ((id * GFXC_SIDES + side) * GFXC_MAX_VARIANTS + variant) * 2 + opaque; - } - - inline const UVRegion& getRegion(blockid_t id, uint8_t variant, int side, bool dense) const { - return sideregions[getRegionIndex(id, variant, side, !dense)]; - } - - const model::Model& getModel( - blockid_t id, uint8_t variant, uint8_t rotation = 0 - ) const; - - void refresh(const Block& block, const Atlas& atlas); - - void refresh(); };