mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-03 19:06:27 +01:00
fix some problematic code.
creating matrix stacks is expensive, apparently
This commit is contained in:
parent
a5d6262424
commit
02db3f5a2c
2 changed files with 9 additions and 17 deletions
|
@ -25,7 +25,7 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vertex Position
|
// Vertex Position
|
||||||
private MatrixStack transforms;
|
private final MatrixStack transforms;
|
||||||
|
|
||||||
// Vertex Texture Coords
|
// Vertex Texture Coords
|
||||||
private SpriteShiftFunc spriteShiftFunc;
|
private SpriteShiftFunc spriteShiftFunc;
|
||||||
|
@ -152,7 +152,7 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||||
.endVertex();
|
.endVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
transforms = new MatrixStack();
|
while (!transforms.isEmpty()) transforms.pop();
|
||||||
spriteShiftFunc = null;
|
spriteShiftFunc = null;
|
||||||
shouldColor = false;
|
shouldColor = false;
|
||||||
shouldLight = false;
|
shouldLight = false;
|
||||||
|
|
|
@ -45,7 +45,13 @@ public class FastRenderDispatcher {
|
||||||
|
|
||||||
CreateClient.kineticRenderer.tick();
|
CreateClient.kineticRenderer.tick();
|
||||||
|
|
||||||
runQueue(queuedUpdates.get(world), CreateClient.kineticRenderer::update);
|
ConcurrentHashMap.KeySetView<TileEntity, Boolean> map = queuedUpdates.get(world);
|
||||||
|
map
|
||||||
|
.forEach(te -> {
|
||||||
|
map.remove(te);
|
||||||
|
|
||||||
|
CreateClient.kineticRenderer.update(te);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean available() {
|
public static boolean available() {
|
||||||
|
@ -64,20 +70,6 @@ public class FastRenderDispatcher {
|
||||||
RenderWork.enqueue(Minecraft.getInstance().worldRenderer::loadRenderers);
|
RenderWork.enqueue(Minecraft.getInstance().worldRenderer::loadRenderers);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> void runQueue(@Nullable ConcurrentHashMap.KeySetView<T, Boolean> changed, Consumer<T> action) {
|
|
||||||
if (changed == null) return;
|
|
||||||
|
|
||||||
if (available()) {
|
|
||||||
// because of potential concurrency issues, we make a copy of what's in the set at the time we get here
|
|
||||||
ArrayList<T> tiles = new ArrayList<>(changed);
|
|
||||||
|
|
||||||
tiles.forEach(action);
|
|
||||||
changed.removeAll(tiles);
|
|
||||||
} else {
|
|
||||||
changed.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void renderLayer(RenderType layer, Matrix4f viewProjection, double cameraX, double cameraY, double cameraZ) {
|
public static void renderLayer(RenderType layer, Matrix4f viewProjection, double cameraX, double cameraY, double cameraZ) {
|
||||||
if (!Backend.canUseInstancing()) return;
|
if (!Backend.canUseInstancing()) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue