mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-14 08:16:13 +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
5 changed files with 8 additions and 11 deletions
|
@ -3,5 +3,4 @@ package com.jozufozu.flywheel.backend.instancing;
|
||||||
import com.jozufozu.flywheel.api.MaterialManager;
|
import com.jozufozu.flywheel.api.MaterialManager;
|
||||||
|
|
||||||
public interface Engine extends RenderDispatcher, 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
|
@FunctionalInterface
|
||||||
public interface OriginShiftListener {
|
public interface OriginShiftListener {
|
||||||
void onOriginShift();
|
void onOriginShift();
|
||||||
|
|
|
@ -31,6 +31,12 @@ public class ModelPool implements ModelAllocator {
|
||||||
private boolean dirty;
|
private boolean dirty;
|
||||||
private boolean anyToRemove;
|
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) {
|
public ModelPool(VertexType vertexType, int initialSize) {
|
||||||
this.vertexType = vertexType;
|
this.vertexType = vertexType;
|
||||||
int stride = vertexType.getStride();
|
int stride = vertexType.getStride();
|
||||||
|
@ -40,7 +46,6 @@ public class ModelPool implements ModelAllocator {
|
||||||
vbo.bind();
|
vbo.bind();
|
||||||
vbo.ensureCapacity((long) stride * initialSize);
|
vbo.ensureCapacity((long) stride * initialSize);
|
||||||
vbo.setGrowthMargin(stride * 64);
|
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.BeginFrameEvent;
|
||||||
import com.jozufozu.flywheel.event.ReloadRenderersEvent;
|
import com.jozufozu.flywheel.event.ReloadRenderersEvent;
|
||||||
import com.jozufozu.flywheel.event.RenderLayerEvent;
|
import com.jozufozu.flywheel.event.RenderLayerEvent;
|
||||||
|
import com.mojang.blaze3d.vertex.BufferUploader;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.math.Matrix4f;
|
import com.mojang.math.Matrix4f;
|
||||||
|
|
||||||
|
@ -73,6 +74,7 @@ public class LevelRendererMixin {
|
||||||
flywheel$renderLayer(type, stack, camX, camY, camZ);
|
flywheel$renderLayer(type, stack, camX, camY, camZ);
|
||||||
}
|
}
|
||||||
flywheel$LayerRendered = false;
|
flywheel$LayerRendered = false;
|
||||||
|
BufferUploader.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Unique
|
@Unique
|
||||||
|
|
Loading…
Reference in a new issue