Go through GlVertexArray

- VAO state is now handled by GlVertexArray objects
 - IndexedModel no longer inherits from VBOModel
 - BufferedModel doesn't need #clearState
 - Likely fixes crash on intel drivers
This commit is contained in:
Jozufozu 2021-12-27 19:14:20 -08:00
parent 150158d7be
commit ffeecfdce0
2 changed files with 6 additions and 8 deletions

View file

@ -19,7 +19,7 @@ parchment_version = 2021.12.19
# dependency versions # dependency versions
registrate_version = MC1.18-1.0.21 registrate_version = MC1.18-1.0.21
flywheel_version = 1.18-0.5.0.31 flywheel_version = 1.18-0.5.0.33
jei_minecraft_version = 1.18 jei_minecraft_version = 1.18
jei_version = 9.0.0.40 jei_version = 9.0.0.40

View file

@ -4,7 +4,6 @@ import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Supplier;
import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.backend.instancing.Engine; import com.jozufozu.flywheel.backend.instancing.Engine;
@ -13,7 +12,6 @@ import com.jozufozu.flywheel.backend.instancing.SerialTaskEngine;
import com.jozufozu.flywheel.backend.instancing.batching.BatchingEngine; import com.jozufozu.flywheel.backend.instancing.batching.BatchingEngine;
import com.jozufozu.flywheel.backend.instancing.instancing.InstancingEngine; import com.jozufozu.flywheel.backend.instancing.instancing.InstancingEngine;
import com.jozufozu.flywheel.backend.model.ArrayModelRenderer; import com.jozufozu.flywheel.backend.model.ArrayModelRenderer;
import com.jozufozu.flywheel.backend.model.ModelRenderer;
import com.jozufozu.flywheel.core.model.Model; import com.jozufozu.flywheel.core.model.Model;
import com.jozufozu.flywheel.core.model.WorldModel; import com.jozufozu.flywheel.core.model.WorldModel;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
@ -38,7 +36,7 @@ public class FlwContraption extends ContraptionRenderInfo {
private final ContraptionLighter<?> lighter; private final ContraptionLighter<?> lighter;
private final Map<RenderType, ModelRenderer> renderLayers = new HashMap<>(); private final Map<RenderType, ArrayModelRenderer> renderLayers = new HashMap<>();
private final Matrix4f modelViewPartial = new Matrix4f(); private final Matrix4f modelViewPartial = new Matrix4f();
private final ContraptionInstanceWorld instanceWorld; private final ContraptionInstanceWorld instanceWorld;
@ -64,7 +62,7 @@ public class FlwContraption extends ContraptionRenderInfo {
} }
public void renderStructureLayer(RenderType layer, ContraptionProgram shader) { public void renderStructureLayer(RenderType layer, ContraptionProgram shader) {
ModelRenderer structure = renderLayers.get(layer); ArrayModelRenderer structure = renderLayers.get(layer);
if (structure != null) { if (structure != null) {
setup(shader); setup(shader);
structure.draw(); structure.draw();
@ -119,7 +117,7 @@ public class FlwContraption extends ContraptionRenderInfo {
} }
public void invalidate() { public void invalidate() {
for (ModelRenderer buffer : renderLayers.values()) { for (ArrayModelRenderer buffer : renderLayers.values()) {
buffer.delete(); buffer.delete();
} }
renderLayers.clear(); renderLayers.clear();
@ -130,7 +128,7 @@ public class FlwContraption extends ContraptionRenderInfo {
} }
private void buildLayers() { private void buildLayers() {
for (ModelRenderer buffer : renderLayers.values()) { for (ArrayModelRenderer buffer : renderLayers.values()) {
buffer.delete(); buffer.delete();
} }
@ -139,7 +137,7 @@ public class FlwContraption extends ContraptionRenderInfo {
List<RenderType> blockLayers = RenderType.chunkBufferLayers(); List<RenderType> blockLayers = RenderType.chunkBufferLayers();
for (RenderType layer : blockLayers) { for (RenderType layer : blockLayers) {
Supplier<Model> layerModel = () -> new WorldModel(renderWorld, layer, contraption.getBlocks().values(), layer + "_" + contraption.entity.getId()); Model layerModel = new WorldModel(renderWorld, layer, contraption.getBlocks().values(), layer + "_" + contraption.entity.getId());
renderLayers.put(layer, new ArrayModelRenderer(layerModel)); renderLayers.put(layer, new ArrayModelRenderer(layerModel));
} }