Fixed buildscript
This commit is contained in:
@@ -178,7 +178,13 @@ public class FogControl implements CustomChunk{
|
|||||||
|
|
||||||
//add building updates
|
//add building updates
|
||||||
for(var build : indexer.getFlagged(team.team, BlockFlag.hasFogRadius)){
|
for(var build : indexer.getFlagged(team.team, BlockFlag.hasFogRadius)){
|
||||||
dynamicEventQueue.add(FogEvent.get(build.tileX(), build.tileY(), build.block.fogRadius, 0));
|
unitEventQueue.add(FogEvent.get(build.tileX(), build.tileY(), build.block.fogRadius, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
//on the client, let the renderer know of all the fog sources
|
||||||
|
//TODO this runs at a lower FPS and hence may look bad...?
|
||||||
|
if(!headless && team.team == Vars.player.team()){
|
||||||
|
renderer.fog.flushDynamic(unitEventQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
//add unit updates
|
//add unit updates
|
||||||
|
|||||||
@@ -17,8 +17,10 @@ import static mindustry.Vars.*;
|
|||||||
|
|
||||||
/** Highly experimental fog-of-war renderer. */
|
/** Highly experimental fog-of-war renderer. */
|
||||||
public class FogRenderer{
|
public class FogRenderer{
|
||||||
private FrameBuffer staticFog = new FrameBuffer();
|
private FrameBuffer staticFog = new FrameBuffer(), dynamicFog = new FrameBuffer();
|
||||||
private LongSeq events = new LongSeq();
|
private LongSeq events = new LongSeq();
|
||||||
|
private LongSeq dynamics = new LongSeq();
|
||||||
|
private boolean dynamicUpdate = false;
|
||||||
private Rect rect = new Rect();
|
private Rect rect = new Rect();
|
||||||
private @Nullable Team lastTeam;
|
private @Nullable Team lastTeam;
|
||||||
|
|
||||||
@@ -33,30 +35,56 @@ public class FogRenderer{
|
|||||||
events.add(event);
|
events.add(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void flushDynamic(LongSeq seq){
|
||||||
|
dynamics.clear();
|
||||||
|
dynamics.addAll(seq);
|
||||||
|
dynamicUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
public Texture getStaticTexture(){
|
public Texture getStaticTexture(){
|
||||||
return staticFog.getTexture();
|
return staticFog.getTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Texture getDynamicTexture(){
|
||||||
|
return dynamicFog.getTexture();
|
||||||
|
}
|
||||||
|
|
||||||
public void drawFog(){
|
public void drawFog(){
|
||||||
//there is no fog.
|
//there is no fog.
|
||||||
if(fogControl.getDiscovered(player.team()) == null) return;
|
if(fogControl.getDiscovered(player.team()) == null) return;
|
||||||
|
|
||||||
//resize if world size changes
|
//resize if world size changes
|
||||||
boolean clear = staticFog.resizeCheck(world.width(), world.height());
|
boolean
|
||||||
|
clearStatic = staticFog.resizeCheck(world.width(), world.height()),
|
||||||
|
clearDynamic = dynamicFog.resizeCheck(world.width(), world.height());
|
||||||
|
|
||||||
if(player.team() != lastTeam){
|
if(player.team() != lastTeam){
|
||||||
copyFromCpu();
|
copyFromCpu();
|
||||||
lastTeam = player.team();
|
lastTeam = player.team();
|
||||||
clear = false;
|
clearStatic = false;
|
||||||
|
dynamicUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//grab events
|
if(clearDynamic || dynamicUpdate){
|
||||||
if(clear || events.size > 0){
|
dynamicUpdate = false;
|
||||||
|
|
||||||
|
Draw.proj(0, 0, staticFog.getWidth(), staticFog.getHeight());
|
||||||
|
dynamicFog.begin(Color.black);
|
||||||
|
ScissorStack.push(rect.set(1, 1, staticFog.getWidth() - 2, staticFog.getHeight() - 2));
|
||||||
|
|
||||||
|
//TODO render all (clipped) view circles
|
||||||
|
|
||||||
|
ScissorStack.pop();
|
||||||
|
Draw.proj(Core.camera);
|
||||||
|
}
|
||||||
|
|
||||||
|
//grab static events
|
||||||
|
if(clearStatic || events.size > 0){
|
||||||
//set projection to whole map
|
//set projection to whole map
|
||||||
Draw.proj(0, 0, staticFog.getWidth(), staticFog.getHeight());
|
Draw.proj(0, 0, staticFog.getWidth(), staticFog.getHeight());
|
||||||
|
|
||||||
//if the buffer resized, it contains garbage now, clear it.
|
//if the buffer resized, it contains garbage now, clearStatic it.
|
||||||
if(clear){
|
if(clearStatic){
|
||||||
staticFog.begin(Color.black);
|
staticFog.begin(Color.black);
|
||||||
}else{
|
}else{
|
||||||
staticFog.begin();
|
staticFog.begin();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import arc.struct.Seq
|
|||||||
import arc.util.Http
|
import arc.util.Http
|
||||||
import arc.util.Log
|
import arc.util.Log
|
||||||
import arc.util.OS
|
import arc.util.OS
|
||||||
import arc.util.async.Threads
|
import arc.util.Threads
|
||||||
import arc.util.io.PropertiesUtils
|
import arc.util.io.PropertiesUtils
|
||||||
import arc.util.io.Streams
|
import arc.util.io.Streams
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user