aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2022-06-24 10:17:50 +0200
committermakamys <makamys@outlook.com>2022-06-25 07:27:50 +0200
commite5f18be985bac742cc9bbcdf0427187d666a304a (patch)
treebac86f278a1f2cf95c6de4e0a0af5821f38b90d5 /src/main/java/makamys/neodymium/renderer/NeoRenderer.java
parentd5d08eb64a91c1a5b74e401037628260cfd8059c (diff)
downloadNeodymium-e5f18be985bac742cc9bbcdf0427187d666a304a.tar.gz
Neodymium-e5f18be985bac742cc9bbcdf0427187d666a304a.tar.bz2
Neodymium-e5f18be985bac742cc9bbcdf0427187d666a304a.zip
Clean up in ChunkMesh
Diffstat (limited to 'src/main/java/makamys/neodymium/renderer/NeoRenderer.java')
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoRenderer.java15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
index 73a3be2..75ce575 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
@@ -18,10 +18,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Queue;
import java.util.Set;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
import org.lwjgl.BufferUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
@@ -44,7 +41,6 @@ import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
-import net.minecraftforge.event.world.ChunkEvent;
/** The main renderer class. */
public class NeoRenderer {
@@ -170,18 +166,17 @@ public class NeoRenderer {
}
}
- private static int[] renderedMeshesReturn = new int[1];
- private static int[] renderedQuadsReturn = new int[1];
-
private void initIndexBuffers() {
for(int i = 0; i < 2; i++) {
piFirst[i].limit(MAX_MESHES);
piCount[i].limit(MAX_MESHES);
for(Mesh mesh : sentMeshes[i]) {
if(mesh.visible && (Config.maxMeshesPerFrame == -1 || renderedMeshes < Config.maxMeshesPerFrame)) {
- mesh.writeToIndexBuffer(piFirst[i], piCount[i], renderedMeshesReturn, renderedQuadsReturn, interpXDiv, interpYDiv, interpZDiv);
- renderedMeshes += renderedMeshesReturn[0];
- renderedQuads += renderedQuadsReturn[0];
+ int meshes = mesh.writeToIndexBuffer(piFirst[i], piCount[i], interpXDiv, interpYDiv, interpZDiv);
+ renderedMeshes += meshes;
+ for(int j = piCount[i].position() - meshes; j < piCount[i].position(); j++) {
+ renderedQuads += piCount[i].get(j) / 4;
+ }
}
}
piFirst[i].flip();