voxels renderer rebuilt, WorldFiles fix

This commit is contained in:
MihailRis
2023-11-02 13:23:52 +03:00
committed by GitHub
parent 0576316282
commit 754c5b80d0
44 changed files with 1141 additions and 524 deletions
+15 -1
View File
@@ -1,11 +1,13 @@
#ifndef LIGHTING_LIGHTMAP_H_
#define LIGHTING_LIGHTMAP_H_
#include "../constants.h"
#include "../voxels/Chunk.h"
// Lichtkarte
class Lightmap {
public:
unsigned short* map;
light_t* map;
int highestPoint = 0;
Lightmap();
~Lightmap();
@@ -60,6 +62,18 @@ public:
const int index = y*CHUNK_D*CHUNK_W+z*CHUNK_W+x;
map[index] = (map[index] & (0xFFFF & (~(0xF << (channel*4))))) | (value << (channel << 2));
}
inline const light_t* getLights() const {
return map;
}
inline light_t* getLightsWriteable() {
return map;
}
static inline light_t extract(light_t light, ubyte channel) {
return (light >> (channel << 2)) & 0xF;
}
};
#endif /* LIGHTING_LIGHTMAP_H_ */