mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-10 12:34:11 +01:00
A fix and a refactor
- ModelPools no longer undbind their buffer during construction, as state should be maintained externally - Call BufferUploader#reset at the end of renderChunkLayer to partially fix crash rendering contraptions - Remove Engine#getName, it was replaced by FlwEngine
This commit is contained in:
parent
e228427e72
commit
bc55726da3
@ -3,5 +3,4 @@ package com.jozufozu.flywheel.backend.instancing;
|
||||
import com.jozufozu.flywheel.api.MaterialManager;
|
||||
|
||||
public interface Engine extends RenderDispatcher, MaterialManager {
|
||||
String getName();
|
||||
}
|
||||
|
@ -70,8 +70,4 @@ public class BatchingEngine implements Engine {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Batching";
|
||||
}
|
||||
}
|
||||
|
@ -160,11 +160,6 @@ public class InstancingEngine<P extends WorldProgram> implements Engine {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "GL33 Instanced Arrays";
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface OriginShiftListener {
|
||||
void onOriginShift();
|
||||
|
@ -31,6 +31,12 @@ public class ModelPool implements ModelAllocator {
|
||||
private boolean dirty;
|
||||
private boolean anyToRemove;
|
||||
|
||||
/**
|
||||
* Create a new model pool.
|
||||
*
|
||||
* @param vertexType The vertex type of the models that will be stored in the pool.
|
||||
* @param initialSize The initial size of the pool, in vertices.
|
||||
*/
|
||||
public ModelPool(VertexType vertexType, int initialSize) {
|
||||
this.vertexType = vertexType;
|
||||
int stride = vertexType.getStride();
|
||||
@ -40,7 +46,6 @@ public class ModelPool implements ModelAllocator {
|
||||
vbo.bind();
|
||||
vbo.ensureCapacity((long) stride * initialSize);
|
||||
vbo.setGrowthMargin(stride * 64);
|
||||
vbo.unbind();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,6 +16,7 @@ import com.jozufozu.flywheel.core.crumbling.CrumblingRenderer;
|
||||
import com.jozufozu.flywheel.event.BeginFrameEvent;
|
||||
import com.jozufozu.flywheel.event.ReloadRenderersEvent;
|
||||
import com.jozufozu.flywheel.event.RenderLayerEvent;
|
||||
import com.mojang.blaze3d.vertex.BufferUploader;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Matrix4f;
|
||||
|
||||
@ -73,6 +74,7 @@ public class LevelRendererMixin {
|
||||
flywheel$renderLayer(type, stack, camX, camY, camZ);
|
||||
}
|
||||
flywheel$LayerRendered = false;
|
||||
BufferUploader.reset();
|
||||
}
|
||||
|
||||
@Unique
|
||||
|
Loading…
Reference in New Issue
Block a user