diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java index f7ae4eabb..2ff47a1c3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java @@ -2,11 +2,14 @@ package com.simibubi.create.content.contraptions.base.flwdata; import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; +import com.jozufozu.flywheel.backend.struct.Batched; +import com.jozufozu.flywheel.backend.struct.BatchingTransformer; import com.jozufozu.flywheel.backend.struct.StructWriter; import com.jozufozu.flywheel.backend.struct.Writeable; +import com.jozufozu.flywheel.core.model.IModel; import com.simibubi.create.foundation.render.AllInstanceFormats; -public class BeltType implements Writeable { +public class BeltType implements Writeable, Batched { @Override public BeltData create() { return new BeltData(); @@ -21,4 +24,9 @@ public class BeltType implements Writeable { public StructWriter getWriter(VecBuffer backing) { return new UnsafeBeltWriter(backing, this); } + + @Override + public BatchingTransformer getTransformer(IModel model) { + return null; + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java index e87343e37..24640a21c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java @@ -2,11 +2,14 @@ package com.simibubi.create.content.contraptions.base.flwdata; import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; +import com.jozufozu.flywheel.backend.struct.Batched; +import com.jozufozu.flywheel.backend.struct.BatchingTransformer; import com.jozufozu.flywheel.backend.struct.StructWriter; import com.jozufozu.flywheel.backend.struct.Writeable; +import com.jozufozu.flywheel.core.model.IModel; import com.simibubi.create.foundation.render.AllInstanceFormats; -public class RotatingType implements Writeable { +public class RotatingType implements Writeable, Batched { @Override public RotatingData create() { return new RotatingData(); @@ -21,4 +24,9 @@ public class RotatingType implements Writeable { public StructWriter getWriter(VecBuffer backing) { return new UnsafeRotatingWriter(backing, this); } + + @Override + public BatchingTransformer getTransformer(IModel model) { + return null; + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java index 30f591c81..9d0653687 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java @@ -2,11 +2,14 @@ package com.simibubi.create.content.contraptions.components.actors.flwdata; import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; +import com.jozufozu.flywheel.backend.struct.Batched; +import com.jozufozu.flywheel.backend.struct.BatchingTransformer; import com.jozufozu.flywheel.backend.struct.StructWriter; import com.jozufozu.flywheel.backend.struct.Writeable; +import com.jozufozu.flywheel.core.model.IModel; import com.simibubi.create.foundation.render.AllInstanceFormats; -public class ActorType implements Writeable { +public class ActorType implements Writeable, Batched { @Override public ActorData create() { return new ActorData(); @@ -21,4 +24,9 @@ public class ActorType implements Writeable { public StructWriter getWriter(VecBuffer backing) { return new UnsafeActorWriter(backing, this); } + + @Override + public BatchingTransformer getTransformer(IModel model) { + return null; + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionGroup.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionGroup.java index eef3943fe..23a07a6b8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionGroup.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionGroup.java @@ -1,13 +1,13 @@ package com.simibubi.create.content.contraptions.components.structureMovement.render; -import com.jozufozu.flywheel.backend.material.MaterialGroupImpl; -import com.jozufozu.flywheel.backend.material.MaterialManagerImpl; +import com.jozufozu.flywheel.backend.material.instancing.InstancedMaterialGroup; +import com.jozufozu.flywheel.backend.material.instancing.InstancingEngine; -public class ContraptionGroup

extends MaterialGroupImpl

{ +public class ContraptionGroup

extends InstancedMaterialGroup

{ private final RenderedContraption contraption; - public ContraptionGroup(RenderedContraption contraption, MaterialManagerImpl

owner) { + public ContraptionGroup(RenderedContraption contraption, InstancingEngine

owner) { super(owner); this.contraption = contraption; @@ -18,7 +18,7 @@ public class ContraptionGroup

extends MaterialGrou contraption.setup(program); } - public static

MaterialManagerImpl.GroupFactory

forContraption(RenderedContraption c) { + public static

InstancingEngine.GroupFactory

forContraption(RenderedContraption c) { return (materialManager) -> new ContraptionGroup<>(c, materialManager); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionInstanceManager.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionInstanceManager.java index 995813354..966027949 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionInstanceManager.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionInstanceManager.java @@ -8,7 +8,7 @@ import javax.annotation.Nullable; import org.apache.commons.lang3.tuple.Pair; import com.jozufozu.flywheel.backend.instancing.tile.TileInstanceManager; -import com.jozufozu.flywheel.backend.material.MaterialManagerImpl; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.AllMovementBehaviours; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; @@ -23,7 +23,7 @@ public class ContraptionInstanceManager extends TileInstanceManager { private final WeakReference contraption; - ContraptionInstanceManager(RenderedContraption contraption, MaterialManagerImpl materialManager) { + ContraptionInstanceManager(RenderedContraption contraption, MaterialManager materialManager) { super(materialManager); this.contraption = new WeakReference<>(contraption); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraptionManager.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraptionManager.java index 680da8945..e0cf9516c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraptionManager.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraptionManager.java @@ -59,7 +59,7 @@ public class FlwContraptionManager extends ContraptionRenderManager lighter; - public final MaterialManagerImpl materialManager; + public final InstancingEngine materialManager; public final ContraptionInstanceManager kinetics; private final Map renderLayers = new HashMap<>(); @@ -47,11 +47,12 @@ public class RenderedContraption extends ContraptionRenderInfo { public RenderedContraption(Contraption contraption, PlacementSimulationWorld renderWorld) { super(contraption, renderWorld); this.lighter = contraption.makeLighter(); - this.materialManager = MaterialManagerImpl.builder(CreateContexts.CWORLD) + this.materialManager = InstancingEngine.builder(CreateContexts.CWORLD) .setGroupFactory(ContraptionGroup.forContraption(this)) .setIgnoreOriginCoordinate(true) .build(); this.kinetics = new ContraptionInstanceManager(this, materialManager); + this.materialManager.addListener(this.kinetics); buildLayers(); if (Backend.getInstance().canUseInstancing()) { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java b/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java index ac735d10e..b65d3e9e3 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java @@ -2,11 +2,14 @@ package com.simibubi.create.content.logistics.block.flap; import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; +import com.jozufozu.flywheel.backend.struct.Batched; +import com.jozufozu.flywheel.backend.struct.BatchingTransformer; import com.jozufozu.flywheel.backend.struct.StructWriter; import com.jozufozu.flywheel.backend.struct.Writeable; +import com.jozufozu.flywheel.core.model.IModel; import com.simibubi.create.foundation.render.AllInstanceFormats; -public class FlapType implements Writeable { +public class FlapType implements Writeable, Batched { @Override public FlapData create() { return new FlapData(); @@ -21,4 +24,9 @@ public class FlapType implements Writeable { public StructWriter getWriter(VecBuffer backing) { return new UnsafeFlapWriter(backing, this); } + + @Override + public BatchingTransformer getTransformer(IModel model) { + return null; + } }