add Lightmap::extractNormalized

This commit is contained in:
MihailRis 2025-12-20 23:26:50 +03:00
parent 4417eb7685
commit 54d1398d1b
4 changed files with 16 additions and 4 deletions

View file

@ -5,6 +5,7 @@
#include <memory>
#include <cstring>
#include <glm/vec4.hpp>
inline constexpr int LIGHTMAP_DATA_LEN = CHUNK_VOL/2;
@ -87,6 +88,15 @@ public:
return (light >> (channel << 2)) & 0xF;
}
static glm::vec4 extractNormalized(light_t light) {
return glm::vec4(
extract(light, 0) / 15.0f,
extract(light, 1) / 15.0f,
extract(light, 2) / 15.0f,
extract(light, 3) / 15.0f
);
}
std::unique_ptr<ubyte[]> encode() const;
void decode(const ubyte* src);