mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-11 04:54:28 +01:00
fix some problematic code.
creating matrix stacks is expensive, apparently
This commit is contained in:
parent
a5d6262424
commit
02db3f5a2c
@ -25,7 +25,7 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||
}
|
||||
|
||||
// Vertex Position
|
||||
private MatrixStack transforms;
|
||||
private final MatrixStack transforms;
|
||||
|
||||
// Vertex Texture Coords
|
||||
private SpriteShiftFunc spriteShiftFunc;
|
||||
@ -152,7 +152,7 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||
.endVertex();
|
||||
}
|
||||
|
||||
transforms = new MatrixStack();
|
||||
while (!transforms.isEmpty()) transforms.pop();
|
||||
spriteShiftFunc = null;
|
||||
shouldColor = false;
|
||||
shouldLight = false;
|
||||
|
@ -45,7 +45,13 @@ public class FastRenderDispatcher {
|
||||
|
||||
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() {
|
||||
@ -64,20 +70,6 @@ public class FastRenderDispatcher {
|
||||
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) {
|
||||
if (!Backend.canUseInstancing()) return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user