Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Slotterleet committed Apr 24, 2024
2 parents 87d9c6a + 57f7bb8 commit c1d527b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
21 changes: 8 additions & 13 deletions src/fos/graphics/FOSOreRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
import static mindustry.Vars.world;

public class FOSOreRenderer {
public static Seq<AnimatedOreCacheLayer> oreCacheLayers = new Seq<>(); // do not change after world load
/** Do not rearange after world load!!! */
public static Seq<AnimatedOreCacheLayer> oreCacheLayers = new Seq<>();

private static final VertexAttribute[] attributes = {VertexAttribute.position, VertexAttribute.color, VertexAttribute.texCoords};
private static final int
Expand All @@ -38,7 +39,7 @@ public class FOSOreRenderer {
vertexSize = 2 + 1 + 2,
spriteSize = vertexSize * 4,
maxSprites = chunkSize * chunkSize * 9;
private static final float pad = tilesize/2f;
private static final float pad = tilesize / 2f;
private static final boolean dynamic = false;

private float[] vertices = new float[maxSprites * vertexSize * 4];
Expand Down Expand Up @@ -99,14 +100,12 @@ void main(){

/** Queues up a cache change for a tile. Only runs in render loop. */
public void recacheTile(Tile tile){
//recaching all layers may not be necessary
recacheSet.add(Point2.pack(tile.x / chunkSize, tile.y / chunkSize));
}

public void drawOre(){
if(cache == null){
if(cache == null)
return;
}

Camera camera = Core.camera;

Expand Down Expand Up @@ -144,9 +143,8 @@ public void drawOre(){
}

IntSet.IntSetIterator it = drawnLayerSet.iterator();
while(it.hasNext){
while(it.hasNext)
drawnLayers.add(it.next());
}

drawnLayers.sort();

Expand Down Expand Up @@ -204,9 +202,8 @@ public void checkChanges(){
}

public void beginDraw(){
if(cache == null){
if(cache == null)
return;
}

Draw.flush();

Expand All @@ -216,17 +213,15 @@ public void beginDraw(){
}

public void endDraw(){
if(cache == null){
if(cache == null)
return;
}

endc();
}

public void drawLayer(CacheLayer layer){
if(cache == null){
if(cache == null)
return;
}

Camera camera = Core.camera;

Expand Down
1 change: 0 additions & 1 deletion src/fos/graphics/cachelayers/AnimatedOreCacheLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
public class AnimatedOreCacheLayer extends CacheLayer.ShaderLayer {
public AnimatedOreCacheLayer(Shader shader) {
super(shader);
CacheLayer.add(this);
FOSOreRenderer.oreCacheLayers.add(this);
id = FOSOreRenderer.oreCacheLayers.size-1;
}
Expand Down

0 comments on commit c1d527b

Please sign in to comment.