'Player' class, separated main file

Moved render code to world_render.h, declarations code (assets and blocks) to declarations.h
This commit is contained in:
MihailRis
2022-03-02 23:45:09 +03:00
committed by GitHub
parent 2a158bfb46
commit b7e8ff5bea
11 changed files with 370 additions and 265 deletions
+5 -3
View File
@@ -15,7 +15,10 @@ Lighting::Lighting(Chunks* chunks){
}
Lighting::~Lighting(){
delete solverR, solverG, solverB, solverS;
delete solverR;
delete solverG;
delete solverB;
delete solverS;
}
void Lighting::clear(){
@@ -38,7 +41,6 @@ void Lighting::onChunkLoaded(int cx, int cy, int cz, bool sky){
for (int z = 0; z < CHUNK_D; z++){
for (int x = 0; x < CHUNK_W; x++){
int gx = x + cx * CHUNK_W;
int gy = cy * CHUNK_H;
int gz = z + cz * CHUNK_D;
int light = chunk->lightmap->getS(x,0,z);
@@ -195,7 +197,7 @@ void Lighting::onBlockSet(int x, int y, int z, int id){
if (chunks->getLight(x,y+1,z, 3) == 0xF){
for (int i = y; i >= 0; i--){
voxel* vox = chunks->get(x,i,z);
if (vox == nullptr || vox->id != 0 && Block::blocks[id]->skyLightPassing)
if ((vox == nullptr || vox->id != 0) && Block::blocks[id]->skyLightPassing)
break;
solverS->add(x,i,z, 0xF);
}