mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 20:41:49 +00:00
add Lightmap::extractNormalized
This commit is contained in:
parent
4417eb7685
commit
54d1398d1b
4 changed files with 16 additions and 4 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue