Added block rubble, more liquid interaction

This commit is contained in:
Anuken
2018-04-19 19:06:52 -04:00
parent 32fb79478c
commit 7df232c65d
21 changed files with 563 additions and 450 deletions

View File

@@ -54,9 +54,6 @@ public class BlockRenderer{
requestidx = 0;
lastLayer = null;
int crangex = (int) (camera.viewportWidth / (chunksize * tilesize)) + 1;
int crangey = (int) (camera.viewportHeight / (chunksize * tilesize)) + 1;
int rangex = (int) (camera.viewportWidth * camera.zoom / tilesize / 2)+2;
int rangey = (int) (camera.viewportHeight * camera.zoom / tilesize / 2)+2;
@@ -99,7 +96,8 @@ public class BlockRenderer{
}
}
}
//TODO this actually isn't necessary
Draw.color(0, 0, 0, 0.15f);
Graphics.flushSurface();
Draw.color();

View File

@@ -65,10 +65,10 @@ public enum DrawLayer {
}
protected void beginShader(){
renderer.getBlocks().endFloor();
//renderer.getBlocks().endFloor();
renderer.waterSurface.getBuffer().begin();
Graphics.clear(Color.CLEAR);
renderer.getBlocks().beginFloor();
//renderer.getBlocks().beginFloor();
}
public void endShader(Shader shader){

View File

@@ -113,9 +113,8 @@ public class FloorRenderer {
}
public void beginDraw(){
Gdx.gl.glEnable(GL20.GL_BLEND);
Core.atlas.getTextures().first().bind();
Gdx.gl.glEnable(GL20.GL_BLEND);
program.begin();
program.setUniformMatrix("u_projTrans", Core.camera.combined);
@@ -187,6 +186,7 @@ public class FloorRenderer {
int idx = chunk.idx;
TextureRegion region = new TextureRegion(Core.atlas.getTextures().first());
IntArray edges = new IntArray();
for(int tilex = cx * chunksize; tilex < (cx + 1) * chunksize; tilex++){
for(int tiley = cy * chunksize; tiley < (cy + 1) * chunksize; tiley++){
@@ -194,9 +194,9 @@ public class FloorRenderer {
if(tile == null) continue;
if(tile.floor().drawLayer == layer && tile.block().drawLayer != DrawLayer.walls){
idx = drawFloor(tile, idx, region, vertices, false);
}else if(tile.floor().drawLayer.ordinal() < layer.ordinal() && tile.block().drawLayer != DrawLayer.walls){
idx = drawFloor(tile, idx, region, vertices, true);
idx = drawFloor(tile, idx, region, vertices, false, edges);
}else if(tile.floor().drawLayer.ordinal() < layer.ordinal() && tile.block().drawLayer != DrawLayer.walls && layer != DrawLayer.walls){
idx = drawFloor(tile, idx, region, vertices, true, edges);
}
if(tile.block().drawLayer == layer && layer == DrawLayer.walls){
@@ -214,7 +214,7 @@ public class FloorRenderer {
chunk.idx = idx;
}
private int drawFloor(Tile tile, int idx, TextureRegion region, float[] vertices, boolean edgesOnly){
private int drawFloor(Tile tile, int idx, TextureRegion region, float[] vertices, boolean edgesOnly, IntArray edges){
MathUtils.random.setSeed(tile.id());
Block block = tile.floor();

View File

@@ -0,0 +1,29 @@
package io.anuke.mindustry.graphics;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.sun.media.jfxmediaimpl.MediaDisposer.Disposable;
import io.anuke.mindustry.world.Tile;
public class MinimapRenderer implements Disposable{
private Pixmap pixmap;
private Texture texture;
public Texture getTexture(){
return texture;
}
public void reset(){
}
public void updated(Tile tile){
}
@Override
public void dispose() {
pixmap.dispose();
texture.dispose();
}
}