Environmental lights / Bugfixes
This commit is contained in:
@@ -201,7 +201,7 @@ public class BlockRenderer implements Disposable{
|
||||
}
|
||||
|
||||
//lights are drawn even in the expanded range
|
||||
if(tile.build != null){
|
||||
if(tile.build != null || tile.block().emitLight){
|
||||
lightview.add(tile);
|
||||
}
|
||||
|
||||
@@ -213,6 +213,11 @@ public class BlockRenderer implements Disposable{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//special case for floors
|
||||
if(block == Blocks.air && tile.floor().emitLight){
|
||||
lightview.add(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,15 +262,23 @@ public class BlockRenderer implements Disposable{
|
||||
}
|
||||
}
|
||||
|
||||
//draw lights
|
||||
for(int i = 0; i < lightview.size; i++){
|
||||
Tile tile = lightview.items[i];
|
||||
Building entity = tile.build;
|
||||
if(renderer.lights.enabled()){
|
||||
//draw lights
|
||||
for(int i = 0; i < lightview.size; i++){
|
||||
Tile tile = lightview.items[i];
|
||||
Building entity = tile.build;
|
||||
|
||||
if(entity != null){
|
||||
entity.drawLight();
|
||||
if(entity != null){
|
||||
entity.drawLight();
|
||||
}else if(tile.block().emitLight){
|
||||
tile.block().drawEnvironmentLight(tile);
|
||||
}else if(tile.floor().emitLight){
|
||||
tile.floor().drawEnvironmentLight(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,10 @@ public class Drawf{
|
||||
return z;
|
||||
}
|
||||
|
||||
public static void light(float x, float y, float radius, Color color, float opacity){
|
||||
renderer.lights.add(x, y, radius, color, opacity);
|
||||
}
|
||||
|
||||
public static void light(Team team, float x, float y, float radius, Color color, float opacity){
|
||||
if(allowLight(team)) renderer.lights.add(x, y, radius, color, opacity);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ public class LightRenderer{
|
||||
}
|
||||
|
||||
public boolean enabled(){
|
||||
return state.rules.lighting;
|
||||
return state.rules.lighting && state.rules.ambientLight.a > 0.00001f;
|
||||
}
|
||||
|
||||
public void draw(){
|
||||
|
||||
Reference in New Issue
Block a user