Lights fix
This commit is contained in:
parent
48b6c92472
commit
a7b351d5bc
@ -72,6 +72,7 @@ void LightSolver::solve(){
|
|||||||
int z = entry.z+coords[i*3+2];
|
int z = entry.z+coords[i*3+2];
|
||||||
Chunk* chunk = chunks->getChunkByVoxel(x,y,z);
|
Chunk* chunk = chunks->getChunkByVoxel(x,y,z);
|
||||||
if (chunk) {
|
if (chunk) {
|
||||||
|
chunk->setModified(true);
|
||||||
int light = chunks->getLight(x,y,z, channel);
|
int light = chunks->getLight(x,y,z, channel);
|
||||||
if (light != 0 && light == entry.light-1){
|
if (light != 0 && light == entry.light-1){
|
||||||
lightentry nentry;
|
lightentry nentry;
|
||||||
@ -81,7 +82,6 @@ void LightSolver::solve(){
|
|||||||
nentry.light = light;
|
nentry.light = light;
|
||||||
remqueue.push(nentry);
|
remqueue.push(nentry);
|
||||||
chunk->lightmap->set(x-chunk->x*CHUNK_W, y, z-chunk->z*CHUNK_D, channel, 0);
|
chunk->lightmap->set(x-chunk->x*CHUNK_W, y, z-chunk->z*CHUNK_D, channel, 0);
|
||||||
chunk->setModified(true);
|
|
||||||
}
|
}
|
||||||
else if (light >= entry.light){
|
else if (light >= entry.light){
|
||||||
lightentry nentry;
|
lightentry nentry;
|
||||||
@ -109,12 +109,12 @@ void LightSolver::solve(){
|
|||||||
int z = entry.z+coords[i*3+2];
|
int z = entry.z+coords[i*3+2];
|
||||||
Chunk* chunk = chunks->getChunkByVoxel(x,y,z);
|
Chunk* chunk = chunks->getChunkByVoxel(x,y,z);
|
||||||
if (chunk) {
|
if (chunk) {
|
||||||
|
chunk->setModified(true);
|
||||||
int light = chunks->getLight(x,y,z, channel);
|
int light = chunks->getLight(x,y,z, channel);
|
||||||
voxel* v = chunks->get(x,y,z);
|
voxel* v = chunks->get(x,y,z);
|
||||||
const Block* block = blockDefs[v->id];
|
const Block* block = blockDefs[v->id];
|
||||||
if (block->lightPassing && light+2 <= entry.light){
|
if (block->lightPassing && light+2 <= entry.light){
|
||||||
chunk->lightmap->set(x-chunk->x*CHUNK_W, y, z-chunk->z*CHUNK_D, channel, entry.light-1);
|
chunk->lightmap->set(x-chunk->x*CHUNK_W, y, z-chunk->z*CHUNK_D, channel, entry.light-1);
|
||||||
chunk->setModified(true);
|
|
||||||
lightentry nentry;
|
lightentry nentry;
|
||||||
nentry.x = x;
|
nentry.x = x;
|
||||||
nentry.y = y;
|
nentry.y = y;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user