Added a basic skylight engine. Currently it's really laggy.

Also tried fixing the autobuild action since it fetches the repo without submodules.
This commit is contained in:
milkwx3
2026-06-24 18:58:15 +03:00
parent 3ad54bd59d
commit d02d751275
8 changed files with 190 additions and 36 deletions
+16 -5
View File
@@ -1,3 +1,4 @@
#include <functional>
#if INTERFACE
#ifdef Escape
@@ -101,7 +102,7 @@
#define TPS 30.0
#define TPS_DIV 1.0 / TPS
//Rendering
#define RENDER_DISTANCE 128
#define RENDER_DISTANCE 2
#define RENDER_DISTANCE_SQUARED RENDER_DISTANCE*RENDER_DISTANCE
//Game stuff
@@ -179,7 +180,7 @@ struct Chunk {
uint16_t opaqueMask[CHUNK_DATA_SIZE/16];
uint16_t airMask[CHUNK_DATA_SIZE/16];
uint8_t highestBlock[CHUNK_SIZE*CHUNK_SIZE];
uint8_t lights[CHUNK_DATA_SIZE];
uint16_t light[CHUNK_DATA_SIZE];
};
#ifndef SERVER
struct ChunkRenderData {
@@ -220,10 +221,20 @@ struct Quad2D {
};
#endif
struct Vector3I {
int x;
int y;
int z;
int x, y, z;
bool operator==(const Vector3I& other) const {
return (x == other.x && y == other.y && z == other.z);
};
};
struct Vector3IHash {
size_t operator()(const Vector3I& p) const noexcept {
size_t h1 = std::hash<int>{}(p.x);
size_t h2 = std::hash<int>{}(p.y);
size_t h3 = std::hash<int>{}(p.z);
return h1 ^ (h2 << 1) ^ (h3 << 2);
}
};
struct Entity {
uint8_t type;
uint8_t id;