Utterly broken 60fps rendering
This commit is contained in:
@@ -16,7 +16,6 @@ import io.anuke.mindustry.entities.traits.BelowLiquidTrait;
|
|||||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.world.blocks.defense.ForceProjector.ShieldEntity;
|
|
||||||
import io.anuke.ucore.core.Core;
|
import io.anuke.ucore.core.Core;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Graphics;
|
import io.anuke.ucore.core.Graphics;
|
||||||
@@ -196,18 +195,17 @@ public class Renderer extends RendererModule{
|
|||||||
|
|
||||||
batch.setProjectionMatrix(camera.combined);
|
batch.setProjectionMatrix(camera.combined);
|
||||||
|
|
||||||
Graphics.surface(pixelSurface, false);
|
// Graphics.surface(pixelSurface, false);
|
||||||
|
//Graphics.clear(clearColor);
|
||||||
|
|
||||||
Graphics.clear(clearColor);
|
blocks.floor.drawFloor();
|
||||||
|
|
||||||
blocks.drawFloor();
|
|
||||||
|
|
||||||
drawAndInterpolate(groundEffectGroup, e -> e instanceof BelowLiquidTrait);
|
drawAndInterpolate(groundEffectGroup, e -> e instanceof BelowLiquidTrait);
|
||||||
drawAndInterpolate(puddleGroup);
|
drawAndInterpolate(puddleGroup);
|
||||||
drawAndInterpolate(groundEffectGroup, e -> !(e instanceof BelowLiquidTrait));
|
drawAndInterpolate(groundEffectGroup, e -> !(e instanceof BelowLiquidTrait));
|
||||||
|
|
||||||
blocks.processBlocks();
|
blocks.processBlocks();
|
||||||
blocks.drawShadows();
|
//blocks.drawShadows();
|
||||||
for(Team team : Team.all){
|
for(Team team : Team.all){
|
||||||
if(blocks.isTeamShown(team)){
|
if(blocks.isTeamShown(team)){
|
||||||
boolean outline = team != players[0].getTeam() && team != Team.none;
|
boolean outline = team != players[0].getTeam() && team != Team.none;
|
||||||
@@ -215,13 +213,13 @@ public class Renderer extends RendererModule{
|
|||||||
if(outline){
|
if(outline){
|
||||||
Shaders.outline.color.set(team.color);
|
Shaders.outline.color.set(team.color);
|
||||||
Shaders.outline.color.a = 0.8f;
|
Shaders.outline.color.a = 0.8f;
|
||||||
Graphics.beginShaders(Shaders.outline);
|
//Graphics.beginShaders(Shaders.outline);
|
||||||
}
|
}
|
||||||
|
|
||||||
blocks.drawTeamBlocks(Layer.block, team);
|
blocks.drawTeamBlocks(Layer.block, team);
|
||||||
|
|
||||||
if(outline){
|
if(outline){
|
||||||
Graphics.endShaders();
|
//Graphics.endShaders();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,7 +236,7 @@ public class Renderer extends RendererModule{
|
|||||||
blocks.skipLayer(Layer.turret);
|
blocks.skipLayer(Layer.turret);
|
||||||
blocks.drawBlocks(Layer.laser);
|
blocks.drawBlocks(Layer.laser);
|
||||||
|
|
||||||
drawFlyerShadows();
|
//drawFlyerShadows();
|
||||||
|
|
||||||
drawAllTeams(true);
|
drawAllTeams(true);
|
||||||
|
|
||||||
@@ -248,28 +246,29 @@ public class Renderer extends RendererModule{
|
|||||||
overlays.drawBottom();
|
overlays.drawBottom();
|
||||||
drawAndInterpolate(playerGroup, p -> true, Player::drawBuildRequests);
|
drawAndInterpolate(playerGroup, p -> true, Player::drawBuildRequests);
|
||||||
|
|
||||||
|
/*
|
||||||
Graphics.beginShaders(Shaders.shield);
|
Graphics.beginShaders(Shaders.shield);
|
||||||
EntityDraw.draw(shieldGroup);
|
EntityDraw.draw(shieldGroup);
|
||||||
EntityDraw.drawWith(shieldGroup, shield -> true, shield -> ((ShieldEntity)shield).drawOver());
|
EntityDraw.drawWith(shieldGroup, shield -> true, shield -> ((ShieldEntity)shield).drawOver());
|
||||||
Draw.color(Palette.accent);
|
Draw.color(Palette.accent);
|
||||||
Graphics.endShaders();
|
Graphics.endShaders();
|
||||||
Draw.color();
|
Draw.color();*/
|
||||||
|
|
||||||
overlays.drawTop();
|
overlays.drawTop();
|
||||||
|
|
||||||
if(showFog){
|
if(showFog){
|
||||||
Graphics.surface();
|
// Graphics.surface();
|
||||||
}else{
|
}else{
|
||||||
Graphics.flushSurface();
|
// Graphics.flushSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
batch.end();
|
//batch.end();
|
||||||
|
|
||||||
if(showFog){
|
if(showFog){
|
||||||
fog.draw();
|
// fog.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
Graphics.beginCam();
|
//Graphics.beginCam();
|
||||||
EntityDraw.setClip(false);
|
EntityDraw.setClip(false);
|
||||||
drawAndInterpolate(playerGroup, p -> !p.isDead() && !p.isLocal, Player::drawName);
|
drawAndInterpolate(playerGroup, p -> !p.isDead() && !p.isLocal, Player::drawName);
|
||||||
EntityDraw.setClip(true);
|
EntityDraw.setClip(true);
|
||||||
@@ -310,13 +309,13 @@ public class Renderer extends RendererModule{
|
|||||||
Shaders.outline.color.set(team.color);
|
Shaders.outline.color.set(team.color);
|
||||||
Shaders.mix.color.set(Color.WHITE);
|
Shaders.mix.color.set(Color.WHITE);
|
||||||
|
|
||||||
Graphics.beginShaders(Shaders.outline);
|
//Graphics.beginShaders(Shaders.outline);
|
||||||
Graphics.shader(Shaders.mix, true);
|
//Graphics.shader(Shaders.mix, true);
|
||||||
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead(), Unit::drawAll);
|
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead(), Unit::drawAll);
|
||||||
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team, Unit::drawAll);
|
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team, Unit::drawAll);
|
||||||
Graphics.shader();
|
//Graphics.shader();
|
||||||
blocks.drawTeamBlocks(Layer.turret, team);
|
blocks.drawTeamBlocks(Layer.turret, team);
|
||||||
Graphics.endShaders();
|
// Graphics.endShaders();
|
||||||
|
|
||||||
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead(), Unit::drawOver);
|
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead(), Unit::drawOver);
|
||||||
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team, Unit::drawOver);
|
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team, Unit::drawOver);
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
public TargetTrait moveTarget;
|
public TargetTrait moveTarget;
|
||||||
|
|
||||||
private float walktime;
|
private float walktime;
|
||||||
private Queue<BuildRequest> placeQueue = new ThreadQueue<>();
|
private Queue<BuildRequest> placeQueue = new Queue<>();
|
||||||
private Tile mining;
|
private Tile mining;
|
||||||
private CarriableTrait carrying;
|
private CarriableTrait carrying;
|
||||||
private Trail trail = new Trail(12);
|
private Trail trail = new Trail(12);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||||||
|
|
||||||
protected Item targetItem;
|
protected Item targetItem;
|
||||||
protected Tile mineTile;
|
protected Tile mineTile;
|
||||||
protected Queue<BuildRequest> placeQueue = new ThreadQueue<>();
|
protected Queue<BuildRequest> placeQueue = new Queue<>();
|
||||||
protected boolean isBreaking;
|
protected boolean isBreaking;
|
||||||
|
|
||||||
public final UnitState
|
public final UnitState
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class BlockRenderer{
|
|||||||
private final static int initialRequests = 32 * 32;
|
private final static int initialRequests = 32 * 32;
|
||||||
private final static int expandr = 4;
|
private final static int expandr = 4;
|
||||||
|
|
||||||
private FloorRenderer floorRenderer;
|
public final FloorRenderer floor = new FloorRenderer();
|
||||||
|
|
||||||
private Array<BlockRequest> requests = new Array<>(true, initialRequests, BlockRequest.class);
|
private Array<BlockRequest> requests = new Array<>(true, initialRequests, BlockRequest.class);
|
||||||
private IntSet teamChecks = new IntSet();
|
private IntSet teamChecks = new IntSet();
|
||||||
@@ -34,7 +34,6 @@ public class BlockRenderer{
|
|||||||
private Surface shadows = Graphics.createSurface().setSize(2, 2);
|
private Surface shadows = Graphics.createSurface().setSize(2, 2);
|
||||||
|
|
||||||
public BlockRenderer(){
|
public BlockRenderer(){
|
||||||
floorRenderer = new FloorRenderer();
|
|
||||||
|
|
||||||
for(int i = 0; i < requests.size; i++){
|
for(int i = 0; i < requests.size; i++){
|
||||||
requests.set(i, new BlockRequest());
|
requests.set(i, new BlockRequest());
|
||||||
@@ -222,18 +221,6 @@ public class BlockRenderer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void beginFloor(){
|
|
||||||
floorRenderer.beginDraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void endFloor(){
|
|
||||||
floorRenderer.endDraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void drawFloor(){
|
|
||||||
floorRenderer.drawFloor();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void layerBegins(Layer layer){
|
private void layerBegins(Layer layer){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,15 +65,16 @@ public enum CacheLayer{
|
|||||||
|
|
||||||
protected void beginShader(){
|
protected void beginShader(){
|
||||||
//renderer.getBlocks().endFloor();
|
//renderer.getBlocks().endFloor();
|
||||||
renderer.effectSurface.getBuffer().bind();
|
renderer.effectSurface.getBuffer().begin();
|
||||||
Graphics.clear(Color.CLEAR);
|
Graphics.clear(Color.CLEAR);
|
||||||
//renderer.getBlocks().beginFloor();
|
//renderer.getBlocks().beginFloor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void endShader(Shader shader){
|
public void endShader(Shader shader){
|
||||||
renderer.blocks.endFloor();
|
renderer.blocks.floor.endDraw();
|
||||||
|
|
||||||
renderer.pixelSurface.getBuffer().bind();
|
renderer.effectSurface.getBuffer().end();
|
||||||
|
//renderer.pixelSurface.getBuffer().bind();
|
||||||
|
|
||||||
Graphics.shader(shader);
|
Graphics.shader(shader);
|
||||||
Graphics.begin();
|
Graphics.begin();
|
||||||
@@ -81,6 +82,6 @@ public enum CacheLayer{
|
|||||||
Core.camera.viewportWidth * Core.camera.zoom, -Core.camera.viewportHeight * Core.camera.zoom);
|
Core.camera.viewportWidth * Core.camera.zoom, -Core.camera.viewportHeight * Core.camera.zoom);
|
||||||
Graphics.end();
|
Graphics.end();
|
||||||
Graphics.shader();
|
Graphics.shader();
|
||||||
renderer.blocks.beginFloor();
|
renderer.blocks.floor.beginDraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class FloorRenderer{
|
|||||||
|
|
||||||
drawnLayers.sort();
|
drawnLayers.sort();
|
||||||
|
|
||||||
Graphics.end();
|
//Graphics.end();
|
||||||
beginDraw();
|
beginDraw();
|
||||||
|
|
||||||
for(int i = 0; i < drawnLayers.size; i++){
|
for(int i = 0; i < drawnLayers.size; i++){
|
||||||
|
|||||||
Reference in New Issue
Block a user