From a52b6d766fce2367b555ba3ac19245ca8716f4de Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Wed, 21 Jul 2021 20:30:35 -0700 Subject: [PATCH] MaterialGroups and massive refactors - Move material stuff to its own package - The various render functions in the material tree now bind to specific render layers - Instancers can choose which layer to use - The layers are SOLID, CUTOUT, and TRANSPARENT - More layers are likely unnecessary, but we'll see - Deprecate functions in MaterialManager in favor of more builderesque ones using MaterialGroups - Catching up with Flywheel - Remove MatrixStacker in favor of Flywheel's TransformStack (thread safety too) --- .../com/simibubi/create/AllTileEntities.java | 5 +- .../category/animations/AnimatedCrafter.java | 4 +- .../base/BackHalfShaftInstance.java | 2 +- .../base/CutoutRotatingInstance.java | 17 +++ .../contraptions/base/HalfShaftInstance.java | 2 +- .../base/HorizontalHalfShaftInstance.java | 2 +- .../base/KineticTileInstance.java | 9 +- .../base/ShaftlessCogInstance.java | 6 +- .../base/SingleRotatingInstance.java | 2 +- .../components/actors/DrillActorInstance.java | 7 +- .../components/actors/DrillInstance.java | 2 +- .../actors/DrillMovementBehaviour.java | 2 +- .../components/actors/DrillRenderer.java | 4 +- .../actors/HarvesterActorInstance.java | 12 +- .../actors/HarvesterMovementBehaviour.java | 2 +- .../crafter/MechanicalCrafterInstance.java | 33 +++-- .../crafter/MechanicalCrafterRenderer.java | 4 +- .../components/crank/HandCrankInstance.java | 6 +- .../deployer/DeployerActorInstance.java | 17 ++- .../deployer/DeployerFilterSlot.java | 4 +- .../components/deployer/DeployerInstance.java | 2 +- .../deployer/DeployerMovementBehaviour.java | 2 +- .../components/fan/FanInstance.java | 8 +- .../components/flywheel/FlyWheelInstance.java | 12 +- .../flywheel/engine/EngineInstance.java | 6 +- .../millstone/MillStoneCogInstance.java | 2 +- .../components/mixer/MixerInstance.java | 2 +- .../components/press/PressInstance.java | 6 +- .../components/saw/SawFilterSlot.java | 4 +- .../components/saw/SawInstance.java | 2 +- .../components/saw/SawRenderer.java | 8 +- .../ControlledContraptionEntity.java | 4 +- .../DirectionalExtenderScrollOptionSlot.java | 4 +- .../structureMovement/MovementBehaviour.java | 2 +- .../OrientedContraptionEntity.java | 4 +- .../bearing/BearingInstance.java | 2 +- .../bearing/StabilizedBearingInstance.java | 7 +- .../StabilizedBearingMovementBehaviour.java | 2 +- .../chassis/StickerInstance.java | 6 +- .../gantry/GantryCarriageInstance.java | 6 +- .../structureMovement/glue/GlueInstance.java | 14 +- .../glue/SuperGlueRenderer.java | 4 +- .../pulley/AbstractPulleyInstance.java | 2 +- .../pulley/HosePulleyInstance.java | 11 +- .../pulley/RopePulleyInstance.java | 2 +- .../render/ActorInstance.java | 2 +- .../render/ContraptionInstanceManager.java | 2 +- .../render/ContraptionMaterialManager.java | 22 --- .../render/ContraptionRenderDispatcher.java | 12 +- .../render/RenderedContraption.java | 4 +- .../train/CouplingRenderer.java | 4 +- .../contraptions/fluids/PumpCogInstance.java | 2 +- .../contraptions/fluids/PumpRenderer.java | 4 +- .../fluids/actors/ItemDrainRenderer.java | 4 +- .../fluids/pipes/FluidValveInstance.java | 11 +- .../fluids/pipes/FluidValveRenderer.java | 4 +- .../pipes/SmartFluidPipeTileEntity.java | 4 +- .../processing/BasinRenderer.java | 8 +- .../relays/belt/BeltInstance.java | 10 +- .../relays/belt/BeltRenderer.java | 8 +- .../relays/encased/ShaftInstance.java | 2 +- .../relays/encased/SplitShaftInstance.java | 4 +- .../relays/gauge/GaugeInstance.java | 15 +- .../relays/gearbox/GearboxInstance.java | 4 +- .../armor/CopperBacktankInstance.java | 2 +- .../symmetry/mirror/CrossPlaneMirror.java | 4 +- .../symmetry/mirror/PlaneMirror.java | 4 +- .../curiosities/tools/BlueprintRenderer.java | 6 +- .../tools/ExtendoGripItemRenderer.java | 4 +- .../tools/ExtendoGripRenderHandler.java | 4 +- .../weapons/PotatoCannonItemRenderer.java | 4 +- .../weapons/PotatoCannonRenderHandler.java | 6 +- .../weapons/PotatoProjectileRenderMode.java | 12 +- .../belts/tunnel/BeltTunnelInstance.java | 5 +- .../belts/tunnel/BeltTunnelRenderer.java | 4 +- .../logistics/block/chute/ChuteRenderer.java | 4 +- .../logistics/block/depot/DepotRenderer.java | 6 +- .../block/depot/EjectorInstance.java | 6 +- .../block/depot/EjectorRenderer.java | 9 +- .../block/depot/EjectorTileEntity.java | 4 +- .../diodes/AdjustableRepeaterInstance.java | 11 +- .../diodes/AdjustableRepeaterScrollSlot.java | 4 +- .../funnel/FunnelFilterSlotPositioning.java | 8 +- .../block/funnel/FunnelInstance.java | 5 +- .../block/funnel/FunnelRenderer.java | 4 +- .../inventories/CreativeCrateTileEntity.java | 4 +- .../block/mechanicalArm/ArmInstance.java | 8 +- .../block/mechanicalArm/ArmRenderer.java | 20 +-- .../block/redstone/AnalogLeverInstance.java | 10 +- .../redstone/FilteredDetectorFilterSlot.java | 4 +- .../block/redstone/NixieTubeRenderer.java | 4 +- .../redstone/RedstoneLinkFrequencySlot.java | 4 +- .../item/LecternControllerRenderer.java | 4 +- .../item/LinkedControllerItemRenderer.java | 4 +- .../block/SchematicannonInstance.java | 8 +- .../schematics/client/SchematicRenderer.java | 4 +- .../client/SchematicTransformation.java | 4 +- .../schematics/client/tools/DeployTool.java | 4 +- .../foundation/fluid/FluidRenderer.java | 8 +- .../gui/mainMenu/CreateMainMenuScreen.java | 4 +- .../create/foundation/ponder/PonderScene.java | 10 +- .../ponder/elements/AnimatedSceneElement.java | 4 +- .../ponder/elements/MinecartElement.java | 4 +- .../ponder/elements/ParrotElement.java | 4 +- .../ponder/elements/WorldSectionElement.java | 8 +- .../foundation/render/AllMaterialSpecs.java | 2 +- .../foundation/render/PartialBufferer.java | 4 +- .../foundation/render/SuperByteBuffer.java | 8 +- .../render/TileEntityRenderHelper.java | 4 +- .../behaviour/ValueBoxTransform.java | 4 +- .../foundation/utility/MatrixStacker.java | 128 ------------------ .../foundation/utility/outliner/Outline.java | 4 +- 112 files changed, 347 insertions(+), 439 deletions(-) create mode 100644 src/main/java/com/simibubi/create/content/contraptions/base/CutoutRotatingInstance.java delete mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionMaterialManager.java delete mode 100644 src/main/java/com/simibubi/create/foundation/utility/MatrixStacker.java diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index 46cb389b6..b426c3421 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -1,5 +1,6 @@ package com.simibubi.create; +import com.simibubi.create.content.contraptions.base.CutoutRotatingInstance; import com.simibubi.create.content.contraptions.base.HalfShaftInstance; import com.simibubi.create.content.contraptions.base.HorizontalHalfShaftInstance; import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; @@ -489,7 +490,7 @@ public class AllTileEntities { public static final TileEntityEntry CRUSHING_WHEEL = Create.registrate() .tileEntity("crushing_wheel", CrushingWheelTileEntity::new) - .instance(() -> SingleRotatingInstance::new) + .instance(() -> CutoutRotatingInstance::new) .validBlocks(AllBlocks.CRUSHING_WHEEL) .renderer(() -> KineticTileEntityRenderer::new) .register(); @@ -503,7 +504,7 @@ public class AllTileEntities { public static final TileEntityEntry WATER_WHEEL = Create.registrate() .tileEntity("water_wheel", WaterWheelTileEntity::new) - .instance(() -> SingleRotatingInstance::new) + .instance(() -> CutoutRotatingInstance::new) .validBlocks(AllBlocks.WATER_WHEEL) .renderer(() -> KineticTileEntityRenderer::new) .register(); diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrafter.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrafter.java index 2fc1b195d..7c6b17551 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrafter.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrafter.java @@ -1,9 +1,9 @@ package com.simibubi.create.compat.jei.category.animations; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.gui.AllGuiTextures; -import com.simibubi.create.foundation.utility.MatrixStacker; public class AnimatedCrafter extends AnimatedKinetics { @@ -14,7 +14,7 @@ public class AnimatedCrafter extends AnimatedKinetics { AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13); matrixStack.translate(3, 16, 0); - MatrixStacker.of(matrixStack) + MatrixTransformStack.of(matrixStack) .rotateX(-12.5f) .rotateY(-22.5f); int scale = 22; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/BackHalfShaftInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/BackHalfShaftInstance.java index 02570c895..3133c09ab 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/BackHalfShaftInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/BackHalfShaftInstance.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.base; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/CutoutRotatingInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/CutoutRotatingInstance.java new file mode 100644 index 000000000..c8f3d4335 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/base/CutoutRotatingInstance.java @@ -0,0 +1,17 @@ +package com.simibubi.create.content.contraptions.base; + +import com.jozufozu.flywheel.backend.instancing.Instancer; +import com.jozufozu.flywheel.backend.material.InstanceMaterial; +import com.jozufozu.flywheel.backend.material.MaterialManager; +import com.simibubi.create.foundation.render.AllMaterialSpecs; + +public class CutoutRotatingInstance extends SingleRotatingInstance { + public CutoutRotatingInstance(MaterialManager modelManager, KineticTileEntity tile) { + super(modelManager, tile); + } + + protected InstanceMaterial getRotatingMaterial() { + return materialManager.defaultCutout() + .material(AllMaterialSpecs.ROTATING); + } +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/HalfShaftInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/HalfShaftInstance.java index 65b8920ba..c5fa91df2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/HalfShaftInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/HalfShaftInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.base; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.AllBlockPartials; import net.minecraft.state.properties.BlockStateProperties; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/HorizontalHalfShaftInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/HorizontalHalfShaftInstance.java index eafd86c5d..2ccdd215a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/HorizontalHalfShaftInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/HorizontalHalfShaftInstance.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.base; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java index 4ff93254c..c845b8a48 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.base; -import com.jozufozu.flywheel.backend.instancing.InstanceMaterial; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.InstanceMaterial; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; @@ -84,8 +84,9 @@ public abstract class KineticTileInstance extends T return shaft(getRotationAxis()); } - protected final InstanceMaterial getRotatingMaterial() { - return materialManager.getMaterial(AllMaterialSpecs.ROTATING); + protected InstanceMaterial getRotatingMaterial() { + return materialManager.defaultSolid() + .material(AllMaterialSpecs.ROTATING); } public static BlockState shaft(Direction.Axis axis) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/ShaftlessCogInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/ShaftlessCogInstance.java index 415882390..e7b747d02 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/ShaftlessCogInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/ShaftlessCogInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.base; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.render.AllMaterialSpecs; @@ -13,6 +13,8 @@ public class ShaftlessCogInstance extends SingleRotatingInstance { @Override protected Instancer getModel() { - return materialManager.getMaterial(AllMaterialSpecs.ROTATING).getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, tile.getBlockState()); + return materialManager.defaultSolid() + .material(AllMaterialSpecs.ROTATING) + .getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, tile.getBlockState()); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/SingleRotatingInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/SingleRotatingInstance.java index 17ba2884d..90a5efdb6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/SingleRotatingInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/SingleRotatingInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.base; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import net.minecraft.block.BlockState; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillActorInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillActorInstance.java index c1458d1e4..c142cd2cf 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillActorInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillActorInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.components.actors; -import com.jozufozu.flywheel.backend.instancing.InstanceMaterial; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.InstanceMaterial; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; @@ -22,7 +22,8 @@ public class DrillActorInstance extends ActorInstance { public DrillActorInstance(MaterialManager materialManager, PlacementSimulationWorld contraption, MovementContext context) { super(materialManager, contraption, context); - InstanceMaterial instanceMaterial = materialManager.getMaterial(AllMaterialSpecs.ACTORS); + InstanceMaterial instanceMaterial = materialManager.defaultSolid() + .material(AllMaterialSpecs.ACTORS); BlockState state = context.state; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillInstance.java index 4a0fca942..b43916d7b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillInstance.java @@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.actors; import static net.minecraft.state.properties.BlockStateProperties.FACING; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.RotatingData; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java index ad88f0c32..8942b48c5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java @@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.actors; import javax.annotation.Nullable; import com.jozufozu.flywheel.backend.Backend; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillRenderer.java index af8bd9be0..3a81d4509 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillRenderer.java @@ -1,5 +1,6 @@ package com.simibubi.create.content.contraptions.components.actors; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -11,7 +12,6 @@ import com.simibubi.create.foundation.render.PartialBufferer; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld; @@ -46,7 +46,7 @@ public class DrillRenderer extends KineticTileEntityRenderer { MatrixStack m = matrices.contraptionStack; m.pushPose(); - MatrixStacker.of(m) + MatrixTransformStack.of(m) .centre() .rotateY(AngleHelper.horizontalAngle(facing)) .rotateX(AngleHelper.verticalAngle(facing)) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterActorInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterActorInstance.java index e3b7235ea..936a88bb5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterActorInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterActorInstance.java @@ -2,16 +2,17 @@ package com.simibubi.create.content.contraptions.components.actors; import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; -import com.jozufozu.flywheel.backend.instancing.InstanceMaterial; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.InstanceMaterial; +import com.jozufozu.flywheel.backend.material.MaterialManager; +import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.materials.ModelData; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld; @@ -36,7 +37,8 @@ public class HarvesterActorInstance extends ActorInstance { public HarvesterActorInstance(MaterialManager materialManager, PlacementSimulationWorld simulationWorld, MovementContext context) { super(materialManager, simulationWorld, context); - InstanceMaterial instanceMaterial = materialManager.getTransformMaterial(); + InstanceMaterial instanceMaterial = materialManager.defaultCutout() + .material(Materials.TRANSFORMED); BlockState state = context.state; @@ -74,7 +76,7 @@ public class HarvesterActorInstance extends ActorInstance { @Override public void beginFrame() { MatrixStack ms = new MatrixStack(); - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); msr.translate(context.localPos) .centre() diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java index fdb268f4e..87eee9790 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java @@ -7,7 +7,7 @@ import javax.annotation.Nullable; import org.apache.commons.lang3.mutable.MutableBoolean; import com.jozufozu.flywheel.backend.Backend; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterInstance.java index 009dc3abe..cfacf3990 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterInstance.java @@ -3,13 +3,14 @@ package com.simibubi.create.content.contraptions.components.crafter; import java.util.function.Supplier; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; +import com.jozufozu.flywheel.util.transform.TransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.content.contraptions.base.SingleRotatingInstance; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.util.Direction; @@ -23,18 +24,20 @@ public class MechanicalCrafterInstance extends SingleRotatingInstance { protected Instancer getModel() { Direction facing = blockState.getValue(MechanicalCrafterBlock.HORIZONTAL_FACING); - Supplier ms = () -> { - MatrixStack stack = new MatrixStack(); - MatrixStacker stacker = MatrixStacker.of(stack).centre(); - - if (facing.getAxis() == Direction.Axis.X) - stacker.rotateZ(90); - else if (facing.getAxis() == Direction.Axis.Z) - stacker.rotateX(90); - - stacker.unCentre(); - return stack; - }; - return getRotatingMaterial().getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState, facing, ms); + return getRotatingMaterial().getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState, facing, rotateToFace(facing)); } + + private Supplier rotateToFace(Direction facing) { + return () -> { + MatrixStack stack = new MatrixStack(); + TransformStack stacker = MatrixTransformStack.of(stack) + .centre(); + + if (facing.getAxis() == Direction.Axis.X) stacker.rotateZ(90); + else if (facing.getAxis() == Direction.Axis.Z) stacker.rotateX(90); + + stacker.unCentre(); + return stack; + }; + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterRenderer.java index e77faa354..82858218e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterRenderer.java @@ -5,6 +5,7 @@ import static com.simibubi.create.content.contraptions.base.KineticTileEntityRen import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.core.PartialModel; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -16,7 +17,6 @@ import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; @@ -112,7 +112,7 @@ public class MechanicalCrafterRenderer extends SafeTileEntityRenderer materialManager, PlacementSimulationWorld simulationWorld, MovementContext context) { super(materialManager, simulationWorld, context); - InstanceMaterial mat = materialManager.getTransformMaterial(); + InstanceMaterial mat = materialManager.defaultSolid() + .material(Materials.TRANSFORMED); BlockState state = context.state; DeployerTileEntity.Mode mode = NBTHelper.readEnum(context.tileData, "Mode", DeployerTileEntity.Mode.class); @@ -62,7 +64,8 @@ public class DeployerActorInstance extends ActorInstance { hand = mat.getModel(handPose, state).createInstance(); Direction.Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state); - shaft = materialManager.getMaterial(AllMaterialSpecs.ROTATING) + shaft = materialManager.defaultSolid() + .material(AllMaterialSpecs.ROTATING) .getModel(KineticTileInstance.shaft(axis)) .createInstance(); @@ -92,7 +95,7 @@ public class DeployerActorInstance extends ActorInstance { Vector3d offset = Vector3d.atLowerCornerOf(facing.getNormal()).scale(factor); MatrixStack ms = new MatrixStack(); - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); msr.translate(context.localPos) .translate(offset); @@ -100,7 +103,7 @@ public class DeployerActorInstance extends ActorInstance { transformModel(msr, pole, hand, yRot, zRot, zRotPole); } - static void transformModel(MatrixStacker msr, ModelData pole, ModelData hand, float yRot, float zRot, float zRotPole) { + static void transformModel(MatrixTransformStack msr, ModelData pole, ModelData hand, float yRot, float zRot, float zRotPole) { msr.centre(); msr.rotate(Direction.SOUTH, (float) ((zRot) / 180 * Math.PI)); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerFilterSlot.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerFilterSlot.java index 5267ac546..b65aaff17 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerFilterSlot.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerFilterSlot.java @@ -1,9 +1,9 @@ package com.simibubi.create.content.contraptions.components.deployer; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.BlockState; @@ -31,7 +31,7 @@ public class DeployerFilterSlot extends ValueBoxTransform { Direction facing = state.getValue(DeployerBlock.FACING); float xRot = facing == Direction.UP ? 90 : facing == Direction.DOWN ? 270 : 0; float yRot = AngleHelper.horizontalAngle(facing) + 180; - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(yRot) .rotateX(xRot); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerInstance.java index dfff538bd..d2c7b1c2d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerInstance.java @@ -5,7 +5,7 @@ import static com.simibubi.create.content.contraptions.base.DirectionalKineticBl import com.jozufozu.flywheel.backend.instancing.IDynamicInstance; import com.jozufozu.flywheel.backend.instancing.ITickableInstance; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.materials.OrientedData; import com.simibubi.create.AllBlockPartials; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java index 6b0a5601d..8db2c3089 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java @@ -8,7 +8,7 @@ import javax.annotation.Nullable; import org.apache.commons.lang3.tuple.Pair; import com.jozufozu.flywheel.backend.Backend; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.AllTags.AllBlockTags; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/FanInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/FanInstance.java index 91f4edce5..9b6956c4d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/FanInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/FanInstance.java @@ -2,10 +2,11 @@ package com.simibubi.create.content.contraptions.components.fan; import static net.minecraft.state.properties.BlockStateProperties.FACING; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileInstance; import com.simibubi.create.content.contraptions.base.RotatingData; +import com.simibubi.create.foundation.render.AllMaterialSpecs; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; @@ -25,7 +26,10 @@ public class FanInstance extends KineticTileInstance { opposite = direction.getOpposite(); shaft = getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, blockState, opposite).createInstance(); - fan = getRotatingMaterial().getModel(AllBlockPartials.ENCASED_FAN_INNER, blockState, opposite).createInstance(); + fan = modelManager.defaultCutout() + .material(AllMaterialSpecs.ROTATING) + .getModel(AllBlockPartials.ENCASED_FAN_INNER, blockState, opposite) + .createInstance(); setup(shaft); setup(fan, getFanSpeed()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlyWheelInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlyWheelInstance.java index 3ffbf4168..ea35ee0e3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlyWheelInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlyWheelInstance.java @@ -8,17 +8,17 @@ import java.util.List; import com.google.common.collect.Lists; import com.jozufozu.flywheel.backend.instancing.IDynamicInstance; import com.jozufozu.flywheel.backend.instancing.InstanceData; -import com.jozufozu.flywheel.backend.instancing.InstanceMaterial; +import com.jozufozu.flywheel.backend.material.InstanceMaterial; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.core.materials.ModelData; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileInstance; import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.BlockState; import net.minecraft.util.Direction; @@ -95,7 +95,7 @@ public class FlyWheelInstance extends KineticTileInstance im private void animate(float angle) { MatrixStack ms = new MatrixStack(); - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); msr.translate(getInstancePosition()); @@ -163,7 +163,7 @@ public class FlyWheelInstance extends KineticTileInstance im return getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, blockState, opposite); } - protected void transformConnector(MatrixStacker ms, boolean upper, boolean rotating, float angle, boolean flip) { + protected void transformConnector(MatrixTransformStack ms, boolean upper, boolean rotating, float angle, boolean flip) { float shift = upper ? 1 / 4f : -1 / 8f; float offset = upper ? 1 / 4f : 1 / 4f; float radians = (float) (angle / 180 * Math.PI); @@ -189,7 +189,7 @@ public class FlyWheelInstance extends KineticTileInstance im ms.translate(9 / 16f, 0, 0); } - protected void rotateToFacing(MatrixStacker buffer, Direction facing) { + protected void rotateToFacing(MatrixTransformStack buffer, Direction facing) { buffer.centre() .rotate(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(facing))) .unCentre(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineInstance.java index 94092ad1e..230960d90 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineInstance.java @@ -1,12 +1,12 @@ package com.simibubi.create.content.contraptions.components.flywheel.engine; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.materials.ModelData; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.Block; import net.minecraft.state.properties.BlockStateProperties; @@ -34,7 +34,7 @@ public class EngineInstance extends TileEntityInstance { float angle = AngleHelper.rad(AngleHelper.horizontalAngle(facing)); MatrixStack ms = new MatrixStack(); - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); msr.translate(getInstancePosition()) .nudge(tile.hashCode()) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillStoneCogInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillStoneCogInstance.java index 3cf4316e4..afd79ba80 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillStoneCogInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillStoneCogInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.components.millstone; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.RotatingData; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java index 19d81bdc9..b2fe1b653 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.components.mixer; import com.jozufozu.flywheel.backend.instancing.IDynamicInstance; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.core.materials.OrientedData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.RotatingData; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java index 418fa0fea..500295183 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java @@ -1,7 +1,8 @@ package com.simibubi.create.content.contraptions.components.press; import com.jozufozu.flywheel.backend.instancing.IDynamicInstance; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; +import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.materials.OrientedData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; @@ -20,7 +21,8 @@ public class PressInstance extends ShaftInstance implements IDynamicInstance { super(dispatcher, tile); press = tile; - pressHead = dispatcher.getOrientedMaterial() + pressHead = dispatcher.defaultSolid() + .material(Materials.ORIENTED) .getModel(AllBlockPartials.MECHANICAL_PRESS_HEAD, blockState) .createInstance(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawFilterSlot.java b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawFilterSlot.java index 1979c1e5a..27a13bc3a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawFilterSlot.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawFilterSlot.java @@ -1,8 +1,8 @@ package com.simibubi.create.content.contraptions.components.saw; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.BlockState; @@ -23,7 +23,7 @@ public class SawFilterSlot extends ValueBoxTransform { @Override protected void rotate(BlockState state, MatrixStack ms) { int yRot = state.getValue(SawBlock.AXIS_ALONG_FIRST_COORDINATE) ? 270 : 180; - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(yRot) .rotateX(90); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawInstance.java index 73fac169c..59fcc7589 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawInstance.java @@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.saw; import static net.minecraft.state.properties.BlockStateProperties.FACING; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.RotatingData; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawRenderer.java index 76831398a..91e468f99 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawRenderer.java @@ -4,6 +4,7 @@ import static net.minecraft.state.properties.BlockStateProperties.FACING; import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.core.PartialModel; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.CreateClient; @@ -17,7 +18,6 @@ import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringRenderer; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld; @@ -194,14 +194,14 @@ public class SawRenderer extends SafeTileEntityRenderer { MatrixStack m = matrices.contraptionStack; m.pushPose(); - MatrixStacker.of(m) + MatrixTransformStack.of(m) .centre() .rotateY(AngleHelper.horizontalAngle(facing)) .rotateX(AngleHelper.verticalAngle(facing)); if (!SawBlock.isHorizontal(state)) - MatrixStacker.of(m) + MatrixTransformStack.of(m) .rotateZ(state.getValue(SawBlock.AXIS_ALONG_FIRST_COORDINATE) ? 0 : 90); - MatrixStacker.of(m) + MatrixTransformStack.of(m) .unCentre(); superBuffer.transform(m) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java index d2060e248..c27d87133 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java @@ -2,10 +2,10 @@ package com.simibubi.create.content.contraptions.components.structureMovement; import static com.simibubi.create.foundation.utility.AngleHelper.angleLerp; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllEntityTypes; import com.simibubi.create.content.contraptions.components.structureMovement.bearing.BearingContraption; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.VecHelper; @@ -231,7 +231,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { Axis axis = getRotationAxis(); for (MatrixStack stack : matrixStacks) - MatrixStacker.of(stack) + MatrixTransformStack.of(stack) .nudge(getId()) .centre() .rotate(angle, axis) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/DirectionalExtenderScrollOptionSlot.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/DirectionalExtenderScrollOptionSlot.java index defea334f..02d7e94cc 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/DirectionalExtenderScrollOptionSlot.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/DirectionalExtenderScrollOptionSlot.java @@ -2,10 +2,10 @@ package com.simibubi.create.content.contraptions.components.structureMovement; import java.util.function.BiPredicate; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.BlockState; import net.minecraft.state.properties.BlockStateProperties; @@ -27,7 +27,7 @@ public class DirectionalExtenderScrollOptionSlot extends CenteredSideValueBoxTra @Override protected void rotate(BlockState state, MatrixStack ms) { if (!getSide().getAxis().isHorizontal()) - MatrixStacker.of(ms).rotateY(AngleHelper.horizontalAngle(state.getValue(BlockStateProperties.FACING)) - 90); + MatrixTransformStack.of(ms).rotateY(AngleHelper.horizontalAngle(state.getValue(BlockStateProperties.FACING)) - 90); super.rotate(state, ms); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementBehaviour.java index a94aa49c8..b7b3400eb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementBehaviour.java @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement; import javax.annotation.Nullable; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices; import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java index 9210605e5..47c10d668 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java @@ -7,6 +7,7 @@ import java.util.UUID; import javax.annotation.Nullable; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllEntityTypes; import com.simibubi.create.content.contraptions.components.structureMovement.bearing.StabilizedContraption; @@ -18,7 +19,6 @@ import com.simibubi.create.content.contraptions.components.structureMovement.tra import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.Couple; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.VecHelper; @@ -536,7 +536,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity { } for (MatrixStack stack : matrixStacks) - MatrixStacker.of(stack) + MatrixTransformStack.of(stack) .nudge(getId()) .centre() .rotateY(angleYaw) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingInstance.java index 67f2cb537..f9ce8806d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; import com.jozufozu.flywheel.backend.instancing.IDynamicInstance; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.materials.OrientedData; import com.simibubi.create.AllBlockPartials; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingInstance.java index 13c7b8836..67de1bc5f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingInstance.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; +import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.materials.OrientedData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; @@ -32,7 +33,9 @@ public class StabilizedBearingInstance extends ActorInstance { blockOrientation = BearingInstance.getBlockStateOrientation(facing); - topInstance = materialManager.getOrientedMaterial().getModel(AllBlockPartials.BEARING_TOP, blockState).createInstance(); + topInstance = materialManager.defaultSolid() + .material(Materials.ORIENTED) + .getModel(AllBlockPartials.BEARING_TOP, blockState).createInstance(); topInstance.setPosition(context.localPos) .setRotation(blockOrientation) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java index d45c48db0..82ae9b925 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java @@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.be import javax.annotation.Nullable; import com.jozufozu.flywheel.backend.Backend; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.core.PartialModel; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerInstance.java index 81a8121e1..050fbc56d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerInstance.java @@ -1,14 +1,14 @@ package com.simibubi.create.content.contraptions.components.structureMovement.chassis; import com.jozufozu.flywheel.backend.instancing.IDynamicInstance; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.core.materials.ModelData; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.client.Minecraft; import net.minecraft.util.Direction; @@ -52,7 +52,7 @@ public class StickerInstance extends TileEntityInstance imple private void animateHead(float offset) { MatrixStack stack = new MatrixStack(); - MatrixStacker.of(stack) + MatrixTransformStack.of(stack) .translate(getInstancePosition()) .nudge(tile.hashCode()) .centre() diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageInstance.java index e60fee02c..5a4d957f5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageInstance.java @@ -1,8 +1,9 @@ package com.simibubi.create.content.contraptions.components.structureMovement.gantry; import com.jozufozu.flywheel.backend.instancing.IDynamicInstance; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.core.materials.ModelData; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -10,7 +11,6 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.Iterate; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; @@ -64,7 +64,7 @@ public class GantryCarriageInstance extends ShaftInstance implements IDynamicIns private void animateCogs(float cogAngle) { MatrixStack ms = new MatrixStack(); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .translate(getInstancePosition()) .centre() .rotateY(AngleHelper.horizontalAngle(facing)) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueInstance.java index 38fc81deb..da3306641 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueInstance.java @@ -2,12 +2,13 @@ package com.simibubi.create.content.contraptions.components.structureMovement.gl import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.backend.instancing.ITickableInstance; -import com.jozufozu.flywheel.backend.instancing.InstanceMaterial; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.backend.instancing.entity.EntityInstance; +import com.jozufozu.flywheel.backend.material.MaterialGroup; import com.jozufozu.flywheel.backend.model.BufferedModel; import com.jozufozu.flywheel.backend.model.IndexedModel; +import com.jozufozu.flywheel.backend.state.TextureRenderState; import com.jozufozu.flywheel.core.Formats; import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.instancing.ConditionalInstance; @@ -51,14 +52,9 @@ public class GlueInstance extends EntityInstance implements ITi } private Instancer getInstancer(MaterialManager materialManager, SuperGlueEntity entity) { - InstanceMaterial material; + MaterialGroup group = USE_ATLAS ? materialManager.defaultSolid() : materialManager.solid(TextureRenderState.get(TEXTURE)); - if (USE_ATLAS) - material = materialManager.getMaterial(Materials.ORIENTED); - else - material = materialManager.getMaterial(Materials.ORIENTED, TEXTURE); - - return material.get(entity.getType(), GlueInstance::supplyModel); + return group.material(Materials.ORIENTED).model(entity.getType(), GlueInstance::supplyModel); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueRenderer.java index 78e6f7868..10b91afec 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueRenderer.java @@ -1,12 +1,12 @@ package com.simibubi.create.content.contraptions.components.structureMovement.glue; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack.Entry; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllItems; import com.simibubi.create.Create; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.Minecraft; @@ -69,7 +69,7 @@ public class SuperGlueRenderer extends EntityRenderer { Direction face = entity.getFacingDirection(); ms.pushPose(); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(AngleHelper.horizontalAngleNew(face)) .rotateX(AngleHelper.verticalAngle(face)); Entry peek = ms.last(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyInstance.java index 9e88c809c..fae4a7b18 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyInstance.java @@ -4,7 +4,7 @@ import java.util.Arrays; import com.jozufozu.flywheel.backend.instancing.IDynamicInstance; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.core.instancing.ConditionalInstance; import com.jozufozu.flywheel.core.instancing.GroupInstance; import com.jozufozu.flywheel.core.instancing.SelectInstance; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/HosePulleyInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/HosePulleyInstance.java index b6fb4679c..c748a0568 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/HosePulleyInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/HosePulleyInstance.java @@ -1,7 +1,8 @@ package com.simibubi.create.content.contraptions.components.structureMovement.pulley; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; +import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.materials.OrientedData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.fluids.actors.HosePulleyTileEntity; @@ -20,11 +21,15 @@ public class HosePulleyInstance extends AbstractPulleyInstance { } protected Instancer getMagnetModel() { - return getOrientedMaterial().getModel(AllBlockPartials.HOSE_MAGNET, blockState); + return materialManager.defaultCutout() + .material(Materials.ORIENTED) + .getModel(AllBlockPartials.HOSE_MAGNET, blockState); } protected Instancer getHalfMagnetModel() { - return getOrientedMaterial().getModel(AllBlockPartials.HOSE_HALF_MAGNET, blockState); + return materialManager.defaultCutout() + .material(Materials.ORIENTED) + .getModel(AllBlockPartials.HOSE_HALF_MAGNET, blockState); } protected Instancer getCoilModel() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/RopePulleyInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/RopePulleyInstance.java index 1fc46cab0..a832532d2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/RopePulleyInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/RopePulleyInstance.java @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.pu import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.core.materials.OrientedData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ActorInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ActorInstance.java index 77ffe3c9f..ab49754c5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ActorInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ActorInstance.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.components.structureMovement.render; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld; 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 1cf73852d..47cd9258a 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 @@ -7,7 +7,7 @@ import javax.annotation.Nullable; import org.apache.commons.lang3.tuple.Pair; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.backend.instancing.tile.TileInstanceManager; import com.simibubi.create.AllMovementBehaviours; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionMaterialManager.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionMaterialManager.java deleted file mode 100644 index fc66294b9..000000000 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionMaterialManager.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.simibubi.create.content.contraptions.components.structureMovement.render; - -import com.jozufozu.flywheel.backend.instancing.MaterialManager; -import com.jozufozu.flywheel.backend.instancing.MaterialRenderer; -import com.jozufozu.flywheel.core.WorldContext; -import com.jozufozu.flywheel.core.shader.IProgramCallback; - -import net.minecraft.client.renderer.RenderType; -import net.minecraft.util.math.vector.Matrix4f; - -public class ContraptionMaterialManager extends MaterialManager { - public ContraptionMaterialManager(WorldContext context) { - super(context); - } - - @Override - public void render(RenderType layer, Matrix4f viewProjection, double camX, double camY, double camZ, IProgramCallback callback) { - for (MaterialRenderer material : atlasRenderers) { - material.render(layer, viewProjection, camX, camY, camZ, callback); - } - } -} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java index d41c688ef..06420bf13 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java @@ -16,10 +16,12 @@ import java.util.Random; import org.apache.commons.lang3.tuple.Pair; import com.jozufozu.flywheel.backend.Backend; +import com.jozufozu.flywheel.backend.state.RenderLayer; import com.jozufozu.flywheel.event.BeginFrameEvent; import com.jozufozu.flywheel.event.GatherContextEvent; import com.jozufozu.flywheel.event.ReloadRenderersEvent; import com.jozufozu.flywheel.event.RenderLayerEvent; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllMovementBehaviours; import com.simibubi.create.CreateClient; @@ -35,7 +37,6 @@ import com.simibubi.create.foundation.render.CreateContexts; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.SuperByteBufferCache; import com.simibubi.create.foundation.render.TileEntityRenderHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; @@ -130,8 +131,11 @@ public class ContraptionRenderDispatcher { } if (Backend.getInstance().canUseInstancing()) { - for (RenderedContraption renderer : RENDERERS.values()) { - renderer.materialManager.render(layer, event.viewProjection, event.camX, event.camY, event.camZ, renderer::setup); + RenderLayer renderLayer = RenderLayer.fromRenderType(layer); + if (renderLayer != null) { + for (RenderedContraption renderer : RENDERERS.values()) { + renderer.materialManager.render(renderLayer, event.viewProjection, event.camX, event.camY, event.camZ, renderer::setup); + } } } @@ -236,7 +240,7 @@ public class ContraptionRenderDispatcher { MatrixStack m = matrices.contraptionStack; m.pushPose(); - MatrixStacker.of(m) + MatrixTransformStack.of(m) .translate(blockInfo.pos); MovementBehaviour movementBehaviour = AllMovementBehaviours.of(blockInfo.state); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/RenderedContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/RenderedContraption.java index 3b6c4eece..bb528524e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/RenderedContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/RenderedContraption.java @@ -13,7 +13,7 @@ import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.gl.attrib.CommonAttributes; import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; import com.jozufozu.flywheel.backend.instancing.IInstanceRendered; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.backend.model.ArrayModelRenderer; import com.jozufozu.flywheel.backend.model.BufferedModel; import com.jozufozu.flywheel.backend.model.IndexedModel; @@ -60,7 +60,7 @@ public class RenderedContraption extends ContraptionWorldHolder { public RenderedContraption(Contraption contraption, PlacementSimulationWorld renderWorld) { super(contraption, renderWorld); this.lighter = contraption.makeLighter(); - this.materialManager = new ContraptionMaterialManager(CreateContexts.CWORLD); + this.materialManager = new MaterialManager<>(CreateContexts.CWORLD).setIgnoreOriginCoordinate(true); this.kinetics = new ContraptionInstanceManager(this, materialManager); buildLayers(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingRenderer.java index 577ed99c1..5183b2959 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingRenderer.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.tr import static net.minecraft.util.math.MathHelper.lerp; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -13,7 +14,6 @@ import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.Couple; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.BlockState; @@ -80,7 +80,7 @@ public class CouplingRenderer { double connectorPitch = Math.atan2(endPointDiff.y, endPointDiff.multiply(1, 0, 1) .length()) * 180 / Math.PI; - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); carts.forEachWithContext((cart, isFirst) -> { CartEndpoint cartTransform = transforms.get(isFirst); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpCogInstance.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpCogInstance.java index 2cb223bb9..5c6886304 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpCogInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpCogInstance.java @@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.fluids; import static net.minecraft.state.properties.BlockStateProperties.FACING; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.RotatingData; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpRenderer.java index 8d9726dba..9c92d47d9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpRenderer.java @@ -1,5 +1,6 @@ package com.simibubi.create.content.contraptions.fluids; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -7,7 +8,6 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.foundation.render.PartialBufferer; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -37,7 +37,7 @@ public class PumpRenderer extends KineticTileEntityRenderer { ms.pushPose(); SuperByteBuffer arrow = PartialBufferer.get(AllBlockPartials.MECHANICAL_PUMP_ARROW, blockState); Direction direction = blockState.getValue(PumpBlock.FACING); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .centre() .rotateY(AngleHelper.horizontalAngle(direction) + 180) .rotateX(-AngleHelper.verticalAngle(direction) - 90) diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainRenderer.java index 597289981..83953bdc1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainRenderer.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.fluids.actors; import java.util.Random; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.contraptions.processing.EmptyingByBasin; import com.simibubi.create.content.contraptions.relays.belt.BeltHelper; @@ -10,7 +11,6 @@ import com.simibubi.create.foundation.fluid.FluidRenderer; import com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour.TankSegment; import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.Minecraft; @@ -48,7 +48,7 @@ public class ItemDrainRenderer extends SmartTileEntityRenderer { BlockPos pos = basin.getBlockPos(); ms.translate(.5, .2f, .5); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(basin.ingredientRotation.getValue(partialTicks)); Random r = new Random(pos.hashCode()); @@ -80,7 +80,7 @@ public class BasinRenderer extends SmartTileEntityRenderer { Vector3d itemPosition = VecHelper.rotate(baseVector, anglePartition * itemCount, Axis.Y); ms.translate(itemPosition.x, itemPosition.y, itemPosition.z); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(anglePartition * itemCount + 35) .rotateX(65); @@ -122,7 +122,7 @@ public class BasinRenderer extends SmartTileEntityRenderer { continue; ms.pushPose(); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .translate(outVec) .translate(new Vector3d(0, Math.max(-.55f, -(progress * progress * 2)), 0)) .translate(directionVec.scale(progress * .5f)) diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstance.java index f30d42e08..749cc33c7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstance.java @@ -5,8 +5,9 @@ import java.util.function.Supplier; import com.jozufozu.flywheel.backend.instancing.InstanceData; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.core.PartialModel; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; @@ -15,7 +16,6 @@ import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.foundation.block.render.SpriteShiftEntry; import com.simibubi.create.foundation.render.AllMaterialSpecs; import com.simibubi.create.foundation.utility.Iterate; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.item.DyeColor; import net.minecraft.util.Direction; @@ -61,7 +61,9 @@ public class BeltInstance extends KineticTileInstance { PartialModel beltPartial = BeltRenderer.getBeltPartial(diagonal, start, end, bottom); SpriteShiftEntry spriteShift = BeltRenderer.getSpriteShiftEntry(color, diagonal, bottom); - Instancer beltModel = materialManager.getMaterial(AllMaterialSpecs.BELTS).getModel(beltPartial, blockState); + Instancer beltModel = materialManager.defaultSolid() + .material(AllMaterialSpecs.BELTS) + .getModel(beltPartial, blockState); keys.add(setup(beltModel.createInstance(), bottom, spriteShift)); @@ -128,7 +130,7 @@ public class BeltInstance extends KineticTileInstance { Supplier ms = () -> { MatrixStack modelTransform = new MatrixStack(); - MatrixStacker msr = MatrixStacker.of(modelTransform); + MatrixTransformStack msr = MatrixTransformStack.of(modelTransform); msr.centre(); if (axis == Direction.Axis.X) msr.rotateY(90); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java index 1700ae9bc..c9fd274bd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java @@ -5,6 +5,7 @@ import java.util.function.Supplier; import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.core.PartialModel; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -21,7 +22,6 @@ import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.Iterate; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; import net.minecraft.block.BlockState; @@ -76,7 +76,7 @@ public class BeltRenderer extends SafeTileEntityRenderer { boolean alongX = facing.getAxis() == Axis.X; MatrixStack localTransforms = new MatrixStack(); - MatrixStacker msr = MatrixStacker.of(localTransforms); + MatrixTransformStack msr = MatrixTransformStack.of(localTransforms); IVertexBuilder vb = buffer.getBuffer(RenderType.solid()); float renderTick = AnimationTickHolder.getRenderTime(te.getLevel()); @@ -134,7 +134,7 @@ public class BeltRenderer extends SafeTileEntityRenderer { Supplier matrixStackSupplier = () -> { MatrixStack stack = new MatrixStack(); - MatrixStacker stacker = MatrixStacker.of(stack); + MatrixTransformStack stacker = MatrixTransformStack.of(stack); stacker.centre(); if (dir.getAxis() == Axis.X) stacker.rotateY(90); if (dir.getAxis() == Axis.Y) stacker.rotateX(90); @@ -202,7 +202,7 @@ public class BeltRenderer extends SafeTileEntityRenderer { for (TransportedItemStack transported : te.getInventory() .getTransportedItems()) { ms.pushPose(); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .nudge(transported.angle); float offset = MathHelper.lerp(partialTicks, transported.prevBeltPosition, transported.beltPosition); float sideOffset = MathHelper.lerp(partialTicks, transported.prevSideOffset, transported.sideOffset); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/ShaftInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/ShaftInstance.java index 0761c6e43..abf7af134 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/ShaftInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/ShaftInstance.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.relays.encased; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.SingleRotatingInstance; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftInstance.java index 9dfd819d0..73ed999ca 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftInstance.java @@ -3,9 +3,9 @@ package com.simibubi.create.content.contraptions.relays.encased; import java.util.ArrayList; import com.jozufozu.flywheel.backend.instancing.InstanceData; -import com.jozufozu.flywheel.backend.instancing.InstanceMaterial; +import com.jozufozu.flywheel.backend.material.InstanceMaterial; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.base.KineticTileInstance; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeInstance.java index b19d48f37..f38497777 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeInstance.java @@ -4,8 +4,10 @@ import java.util.ArrayList; import com.jozufozu.flywheel.backend.instancing.IDynamicInstance; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.core.materials.ModelData; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; +import com.jozufozu.flywheel.util.transform.TransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -13,7 +15,6 @@ import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.Couple; import com.simibubi.create.foundation.utility.Iterate; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.util.Direction; import net.minecraft.util.math.MathHelper; @@ -36,7 +37,7 @@ public abstract class GaugeInstance extends ShaftInstance implements IDynamicIns Instancer headModel = getHeadModel(); ms = new MatrixStack(); - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); msr.translate(getInstancePosition()); float progress = MathHelper.lerp(AnimationTickHolder.getPartialTicks(), gaugeTile.prevDialState, gaugeTile.dialState); @@ -66,7 +67,7 @@ public abstract class GaugeInstance extends ShaftInstance implements IDynamicIns float progress = MathHelper.lerp(AnimationTickHolder.getPartialTicks(), gaugeTile.prevDialState, gaugeTile.dialState); - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); for (DialFace faceEntry : faces) { faceEntry.updateTransform(msr, progress); @@ -99,7 +100,7 @@ public abstract class GaugeInstance extends ShaftInstance implements IDynamicIns this.face = face; } - private void setupTransform(MatrixStacker msr, float progress) { + private void setupTransform(MatrixTransformStack msr, float progress) { float dialPivot = 5.75f / 16; ms.pushPose(); @@ -116,7 +117,7 @@ public abstract class GaugeInstance extends ShaftInstance implements IDynamicIns ms.popPose(); } - private void updateTransform(MatrixStacker msr, float progress) { + private void updateTransform(MatrixTransformStack msr, float progress) { float dialPivot = 5.75f / 16; ms.pushPose(); @@ -131,7 +132,7 @@ public abstract class GaugeInstance extends ShaftInstance implements IDynamicIns ms.popPose(); } - protected MatrixStacker rotateToFace(MatrixStacker msr) { + protected TransformStack rotateToFace(TransformStack msr) { return msr.centre() .rotate(Direction.UP, (float) ((-face.toYRot() - 90) / 180 * Math.PI)) .unCentre(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxInstance.java index 35e266927..0b86084aa 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxInstance.java @@ -4,9 +4,9 @@ import java.util.EnumMap; import java.util.Map; import com.jozufozu.flywheel.backend.instancing.InstanceData; -import com.jozufozu.flywheel.backend.instancing.InstanceMaterial; +import com.jozufozu.flywheel.backend.material.InstanceMaterial; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileInstance; import com.simibubi.create.content.contraptions.base.RotatingData; diff --git a/src/main/java/com/simibubi/create/content/curiosities/armor/CopperBacktankInstance.java b/src/main/java/com/simibubi/create/content/curiosities/armor/CopperBacktankInstance.java index dda0ab339..ad251f267 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/armor/CopperBacktankInstance.java +++ b/src/main/java/com/simibubi/create/content/curiosities/armor/CopperBacktankInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.curiosities.armor; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.RotatingData; diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/CrossPlaneMirror.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/CrossPlaneMirror.java index 22049d6af..d0f058996 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/CrossPlaneMirror.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/CrossPlaneMirror.java @@ -6,10 +6,10 @@ import java.util.Map; import com.google.common.collect.ImmutableList; import com.jozufozu.flywheel.core.PartialModel; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.utility.Lang; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.BlockState; import net.minecraft.util.IStringSerializable; @@ -94,7 +94,7 @@ public class CrossPlaneMirror extends SymmetryMirror { @Override public void applyModelTransform(MatrixStack ms) { super.applyModelTransform(ms); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .centre() .rotateY(((Align) orientation) == Align.Y ? 0 : 45) .unCentre(); diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/PlaneMirror.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/PlaneMirror.java index f87c8ac1a..3c4b476d0 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/PlaneMirror.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/PlaneMirror.java @@ -6,10 +6,10 @@ import java.util.Map; import com.google.common.collect.ImmutableList; import com.jozufozu.flywheel.core.PartialModel; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.utility.Lang; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.BlockState; import net.minecraft.util.IStringSerializable; @@ -90,7 +90,7 @@ public class PlaneMirror extends SymmetryMirror { @Override public void applyModelTransform(MatrixStack ms) { super.applyModelTransform(ms); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .centre() .rotateY(((Align) orientation) == Align.XY ? 0 : 90) .unCentre(); diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintRenderer.java index 3055488db..02474015d 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintRenderer.java @@ -1,13 +1,13 @@ package com.simibubi.create.content.curiosities.tools; import com.jozufozu.flywheel.core.PartialModel; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.curiosities.tools.BlueprintEntity.BlueprintSection; import com.simibubi.create.foundation.render.PartialBufferer; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.utility.Couple; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; @@ -60,7 +60,7 @@ public class BlueprintRenderer extends EntityRenderer { } int itemLight = MathHelper.floor(sl + .5) << 20 | (MathHelper.floor(bl + .5) & 0xf) << 4; - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(vertical ? 0 : -yaw) .rotateX(fakeNormalXRotation); Matrix3f copy = ms.last() @@ -70,7 +70,7 @@ public class BlueprintRenderer extends EntityRenderer { ms.popPose(); ms.pushPose(); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(-yaw) .rotateX(entity.xRot) .translate(0, 0, 1 / 32f + .001); diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItemRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItemRenderer.java index 522afa1cf..7c2078bda 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItemRenderer.java @@ -1,11 +1,11 @@ package com.simibubi.create.content.curiosities.tools; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.item.render.CustomRenderedItemModelRenderer; import com.simibubi.create.foundation.item.render.PartialItemModelRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; @@ -21,7 +21,7 @@ public class ExtendoGripItemRenderer extends CustomRenderedItemModelRenderer tunnelFlaps = new EnumMap<>(Direction.class); - Instancer model = modelManager.getMaterial(AllMaterialSpecs.FLAPS) + Instancer model = modelManager.defaultSolid() + .material(AllMaterialSpecs.FLAPS) .getModel(AllBlockPartials.BELT_TUNNEL_FLAP, blockState); int blockLight = world.getBrightness(LightType.BLOCK, pos); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelRenderer.java index a94e15361..bd9f4348b 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelRenderer.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.logistics.block.belts.tunnel; import com.jozufozu.flywheel.backend.Backend; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -9,7 +10,6 @@ import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.Iterate; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -36,7 +36,7 @@ public class BeltTunnelRenderer extends SmartTileEntityRenderer { int light, int overlay) { ItemRenderer itemRenderer = Minecraft.getInstance() .getItemRenderer(); - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); ms.pushPose(); msr.centre(); float itemScale = .5f; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotRenderer.java index c60f2db6f..f22a1f0cb 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotRenderer.java @@ -2,12 +2,12 @@ package com.simibubi.create.content.logistics.block.depot; import java.util.Random; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.contraptions.relays.belt.BeltHelper; import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.Minecraft; @@ -38,7 +38,7 @@ public class DepotRenderer extends SafeTileEntityRenderer { int light, int overlay, DepotBehaviour depotBehaviour) { TransportedItemStack transported = depotBehaviour.heldItem; - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); Vector3d itemPosition = VecHelper.getCenterOf(te.getBlockPos()); ms.pushPose(); @@ -102,7 +102,7 @@ public class DepotRenderer extends SafeTileEntityRenderer { int angle, Random r, Vector3d itemPosition) { ItemRenderer itemRenderer = Minecraft.getInstance() .getItemRenderer(); - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); int count = (int) (MathHelper.log2((int) (itemStack.getCount()))) / 2; boolean renderUpright = BeltHelper.isItemUpright(itemStack); boolean blockItem = itemRenderer.getModel(itemStack, null, null) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorInstance.java index acb51b780..646ed5616 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorInstance.java @@ -1,13 +1,13 @@ package com.simibubi.create.content.logistics.block.depot; import com.jozufozu.flywheel.backend.instancing.IDynamicInstance; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.core.materials.ModelData; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.util.math.MathHelper; @@ -63,7 +63,7 @@ public class EjectorInstance extends ShaftInstance implements IDynamicInstance { MatrixStack ms = new MatrixStack(); - EjectorRenderer.applyLidAngle(tile, angle, MatrixStacker.of(ms).translate(getInstancePosition())); + EjectorRenderer.applyLidAngle(tile, angle, MatrixTransformStack.of(ms).translate(getInstancePosition())); plate.setTransform(ms); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorRenderer.java index 79f8e2333..1f3d6a402 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorRenderer.java @@ -1,6 +1,8 @@ package com.simibubi.create.content.logistics.block.depot; import com.jozufozu.flywheel.backend.Backend; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; +import com.jozufozu.flywheel.util.transform.TransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -10,7 +12,6 @@ import com.simibubi.create.foundation.render.PartialBufferer; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.IntAttached; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.BlockState; @@ -52,7 +53,7 @@ public class EjectorRenderer extends KineticTileEntityRenderer { .renderInto(ms, vertexBuilder); } - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); float maxTime = (float) (ejector.earlyTarget != null ? ejector.earlyTargetTime : ejector.launcher.getTotalFlyingTicks()); @@ -89,11 +90,11 @@ public class EjectorRenderer extends KineticTileEntityRenderer { ms.popPose(); } - static void applyLidAngle(KineticTileEntity te, float angle, MatrixStacker matrixStacker) { + static void applyLidAngle(KineticTileEntity te, float angle, TransformStack matrixStacker) { applyLidAngle(te, pivot, angle, matrixStacker); } - static void applyLidAngle(KineticTileEntity te, Vector3d rotationOffset, float angle, MatrixStacker matrixStacker) { + static void applyLidAngle(KineticTileEntity te, Vector3d rotationOffset, float angle, TransformStack matrixStacker) { matrixStacker.centre() .rotateY(180 + AngleHelper.horizontalAngle(te.getBlockState() .getValue(EjectorBlock.HORIZONTAL_FACING))) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java index fc08ef89d..bec57a369 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java @@ -6,6 +6,7 @@ import java.util.List; import javax.annotation.Nullable; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -21,7 +22,6 @@ import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.IntAttached; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Lang; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.Pair; import com.simibubi.create.foundation.utility.VecHelper; @@ -604,7 +604,7 @@ public class EjectorTileEntity extends KineticTileEntity { @Override protected void rotate(BlockState state, MatrixStack ms) { - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(angle(state)) .rotateX(90); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterInstance.java index 4d278d0b5..4bdb50b04 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterInstance.java @@ -1,13 +1,14 @@ package com.simibubi.create.content.logistics.block.diodes; import com.jozufozu.flywheel.backend.instancing.ITickableInstance; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; +import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.materials.ModelData; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.utility.ColorHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; public class AdjustableRepeaterInstance extends TileEntityInstance implements ITickableInstance { @@ -18,10 +19,12 @@ public class AdjustableRepeaterInstance extends TileEntityInstance modelManager, AdjustableRepeaterTileEntity tile) { super(modelManager, tile); - indicator = modelManager.getTransformMaterial().getModel(AllBlockPartials.FLEXPEATER_INDICATOR, blockState).createInstance(); + indicator = modelManager.defaultSolid() + .material(Materials.TRANSFORMED) + .getModel(AllBlockPartials.FLEXPEATER_INDICATOR, blockState).createInstance(); MatrixStack ms = new MatrixStack(); - MatrixStacker.of(ms).translate(getInstancePosition()); + MatrixTransformStack.of(ms).translate(getInstancePosition()); indicator .setTransform(ms) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterScrollSlot.java b/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterScrollSlot.java index 328a7dfe2..5684ab080 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterScrollSlot.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterScrollSlot.java @@ -1,9 +1,9 @@ package com.simibubi.create.content.logistics.block.diodes; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.BlockState; @@ -20,7 +20,7 @@ public class AdjustableRepeaterScrollSlot extends ValueBoxTransform { @Override protected void rotate(BlockState state, MatrixStack ms) { float yRot = AngleHelper.horizontalAngle(state.getValue(BlockStateProperties.HORIZONTAL_FACING)) + 180; - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(yRot) .rotateX(90); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelFilterSlotPositioning.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelFilterSlotPositioning.java index 39aa90062..f05f96b68 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelFilterSlotPositioning.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelFilterSlotPositioning.java @@ -1,10 +1,10 @@ package com.simibubi.create.content.logistics.block.funnel; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.BlockState; @@ -59,21 +59,21 @@ public class FunnelFilterSlotPositioning extends ValueBoxTransform.Sided { Shape shape = state.getValue(BeltFunnelBlock.SHAPE); super.rotate(state, ms); if (shape == Shape.PULLING || shape == Shape.PUSHING) - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateX(-22.5f); return; } if (state.getBlock() instanceof FunnelBlock) { super.rotate(state, ms); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateX(-22.5f); return; } float yRot = AngleHelper.horizontalAngle(AbstractFunnelBlock.getFunnelFacing(state)) + (facing == Direction.DOWN ? 180 : 0); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(yRot) .rotateX(facing == Direction.DOWN ? -90 : 90); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java index 170d8e578..fa5f9f03c 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import com.jozufozu.flywheel.backend.instancing.IDynamicInstance; import com.jozufozu.flywheel.backend.instancing.InstanceData; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.core.PartialModel; import com.simibubi.create.AllBlockPartials; @@ -29,7 +29,8 @@ public class FunnelInstance extends TileEntityInstance impleme PartialModel flapPartial = (blockState.getBlock() instanceof FunnelBlock ? AllBlockPartials.FUNNEL_FLAP : AllBlockPartials.BELT_FUNNEL_FLAP); - Instancer model = modelManager.getMaterial(AllMaterialSpecs.FLAPS) + Instancer model = modelManager.defaultSolid() + .material(AllMaterialSpecs.FLAPS) .getModel(flapPartial, blockState); int blockLight = world.getBrightness(LightType.BLOCK, pos); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelRenderer.java index a5b1914c6..5a920e52d 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelRenderer.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.logistics.block.funnel; import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.core.PartialModel; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -9,7 +10,6 @@ import com.simibubi.create.foundation.render.PartialBufferer; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.BlockState; @@ -39,7 +39,7 @@ public class FunnelRenderer extends SmartTileEntityRenderer { : AllBlockPartials.BELT_FUNNEL_FLAP); SuperByteBuffer flapBuffer = PartialBufferer.get(partialModel, blockState); Vector3d pivot = VecHelper.voxelSpace(0, 10, 9.5f); - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); float horizontalAngle = AngleHelper.horizontalAngle(FunnelBlock.getFunnelFacing(blockState) .getOpposite()); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/inventories/CreativeCrateTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/inventories/CreativeCrateTileEntity.java index 6c4050bc6..472f2815a 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/inventories/CreativeCrateTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/inventories/CreativeCrateTileEntity.java @@ -2,12 +2,12 @@ package com.simibubi.create.content.logistics.block.inventories; import java.util.List; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; @@ -96,7 +96,7 @@ public class CreativeCrateTileEntity extends CrateTileEntity { @Override protected void rotate(BlockState state, MatrixStack ms) { - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateX(90); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInstance.java index 9bc1d69bd..0c7a15933 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInstance.java @@ -5,10 +5,11 @@ import java.util.ArrayList; import com.google.common.collect.Lists; import com.jozufozu.flywheel.backend.instancing.IDynamicInstance; import com.jozufozu.flywheel.backend.instancing.InstanceData; -import com.jozufozu.flywheel.backend.instancing.InstanceMaterial; +import com.jozufozu.flywheel.backend.material.InstanceMaterial; import com.jozufozu.flywheel.backend.instancing.Instancer; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.core.materials.ModelData; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.RotatingData; @@ -16,7 +17,6 @@ import com.simibubi.create.content.contraptions.base.SingleRotatingInstance; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.Iterate; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; @@ -122,7 +122,7 @@ public class ArmInstance extends SingleRotatingInstance implements IDynamicInsta } MatrixStack msLocal = new MatrixStack(); - MatrixStacker msr = MatrixStacker.of(msLocal); + MatrixTransformStack msr = MatrixTransformStack.of(msLocal); msr.translate(getInstancePosition()); msr.centre(); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmRenderer.java index 0b3fc6077..9b0f4499a 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmRenderer.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.logistics.block.mechanicalArm; import com.jozufozu.flywheel.backend.Backend; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -12,7 +13,6 @@ import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.Iterate; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; @@ -59,7 +59,7 @@ public class ArmRenderer extends KineticTileEntityRenderer { BlockState blockState = te.getBlockState(); MatrixStack msLocal = new MatrixStack(); - MatrixStacker msr = MatrixStacker.of(msLocal); + MatrixTransformStack msr = MatrixTransformStack.of(msLocal); float baseAngle; float lowerArmAngle; @@ -109,7 +109,7 @@ public class ArmRenderer extends KineticTileEntityRenderer { } - private void renderArm(IVertexBuilder builder, MatrixStack ms, MatrixStack msLocal, MatrixStacker msr, BlockState blockState, int color, float baseAngle, float lowerArmAngle, float upperArmAngle, float headAngle, boolean hasItem, boolean isBlockItem, int light) { + private void renderArm(IVertexBuilder builder, MatrixStack ms, MatrixStack msLocal, MatrixTransformStack msr, BlockState blockState, int color, float baseAngle, float lowerArmAngle, float upperArmAngle, float headAngle, boolean hasItem, boolean isBlockItem, int light) { SuperByteBuffer base = PartialBufferer.get(AllBlockPartials.ARM_BASE, blockState).light(light); SuperByteBuffer lowerBody = PartialBufferer.get(AllBlockPartials.ARM_LOWER_BODY, blockState).light(light); SuperByteBuffer upperBody = PartialBufferer.get(AllBlockPartials.ARM_UPPER_BODY, blockState).light(light); @@ -147,7 +147,7 @@ public class ArmRenderer extends KineticTileEntityRenderer { } } - private void doItemTransforms(MatrixStacker msr, float baseAngle, float lowerArmAngle, float upperArmAngle, float headAngle) { + private void doItemTransforms(MatrixTransformStack msr, float baseAngle, float lowerArmAngle, float upperArmAngle, float headAngle) { transformBase(msr, baseAngle); transformLowerArm(msr, lowerArmAngle); @@ -156,32 +156,32 @@ public class ArmRenderer extends KineticTileEntityRenderer { transformClaw(msr); } - public static void transformClawHalf(MatrixStacker msr, boolean hasItem, boolean isBlockItem, int flip) { + public static void transformClawHalf(MatrixTransformStack msr, boolean hasItem, boolean isBlockItem, int flip) { msr.translate(0, flip * 3 / 16d, -1 / 16d); msr.rotateX(flip * (hasItem ? isBlockItem ? 0 : -35 : 0)); } - public static void transformClaw(MatrixStacker msr) { + public static void transformClaw(MatrixTransformStack msr) { msr.translate(0, 0, -4 / 16d); } - public static void transformHead(MatrixStacker msr, float headAngle) { + public static void transformHead(MatrixTransformStack msr, float headAngle) { msr.translate(0, 11 / 16d, -11 / 16d); msr.rotateX(headAngle); } - public static void transformUpperArm(MatrixStacker msr, float upperArmAngle) { + public static void transformUpperArm(MatrixTransformStack msr, float upperArmAngle) { msr.translate(0, 12 / 16d, 12 / 16d); msr.rotateX(upperArmAngle); } - public static void transformLowerArm(MatrixStacker msr, float lowerArmAngle) { + public static void transformLowerArm(MatrixTransformStack msr, float lowerArmAngle) { msr.translate(0, 1 / 16d, -2 / 16d); msr.rotateX(lowerArmAngle); msr.translate(0, -1 / 16d, 0); } - public static void transformBase(MatrixStacker msr, float baseAngle) { + public static void transformBase(MatrixTransformStack msr, float baseAngle) { msr.translate(0, 4 / 16d, 0); msr.rotateY(baseAngle); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverInstance.java index de1f07271..be55ba627 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverInstance.java @@ -1,16 +1,16 @@ package com.simibubi.create.content.logistics.block.redstone; import com.jozufozu.flywheel.backend.instancing.IDynamicInstance; -import com.jozufozu.flywheel.backend.instancing.InstanceMaterial; -import com.jozufozu.flywheel.backend.instancing.MaterialManager; +import com.jozufozu.flywheel.backend.material.InstanceMaterial; +import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.core.materials.ModelData; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.state.properties.AttachFace; import net.minecraft.util.Direction; @@ -46,7 +46,7 @@ public class AnalogLeverInstance extends TileEntityInstance { ms.pushPose(); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .translate(localPos); BlockPos pos = localPos.offset(anchor); BlockState state = blockAccess.getBlockState(pos); diff --git a/src/main/java/com/simibubi/create/content/schematics/client/SchematicTransformation.java b/src/main/java/com/simibubi/create/content/schematics/client/SchematicTransformation.java index 97f496ecd..2b6db0cf1 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/SchematicTransformation.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/SchematicTransformation.java @@ -2,11 +2,11 @@ package com.simibubi.create.content.schematics.client; import static java.lang.Math.abs; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingAngle; import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.util.Direction.Axis; @@ -63,7 +63,7 @@ public class SchematicTransformation { float lr = getScaleLR().get(pt); float rot = rotation.get(pt) + ((fb < 0 && lr < 0) ? 180 : 0); ms.translate(xOrigin, 0, zOrigin); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .translate(rotationOffset) .rotateY(rot) .translateBack(rotationOffset); diff --git a/src/main/java/com/simibubi/create/content/schematics/client/tools/DeployTool.java b/src/main/java/com/simibubi/create/content/schematics/client/tools/DeployTool.java index ab108da12..b04dba764 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/tools/DeployTool.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/tools/DeployTool.java @@ -1,11 +1,11 @@ package com.simibubi.create.content.schematics.client.tools; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllKeys; import com.simibubi.create.content.schematics.client.SchematicTransformation; import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.outliner.AABBOutline; import net.minecraft.item.ItemStack; @@ -59,7 +59,7 @@ public class DeployTool extends PlacementToolBase { Vector3d origin = new Vector3d(xOrigin, 0, zOrigin); ms.translate(x - centerX, y, z - centerZ); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .translate(origin) .translate(rotationOffset) .rotateY(transformation.getCurrentRotation()) diff --git a/src/main/java/com/simibubi/create/foundation/fluid/FluidRenderer.java b/src/main/java/com/simibubi/create/foundation/fluid/FluidRenderer.java index 3415ddf52..ec7bdbe82 100644 --- a/src/main/java/com/simibubi/create/foundation/fluid/FluidRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/fluid/FluidRenderer.java @@ -2,6 +2,7 @@ package com.simibubi.create.foundation.fluid; import java.util.function.Function; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack.Entry; import com.mojang.blaze3d.vertex.IVertexBuilder; @@ -9,7 +10,6 @@ import com.simibubi.create.foundation.renderState.RenderTypes; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.Iterate; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -58,7 +58,7 @@ public class FluidRenderer { if (inbound) direction = direction.getOpposite(); - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); ms.pushPose(); msr.centre() .rotateY(AngleHelper.horizontalAngle(direction)) @@ -107,12 +107,12 @@ public class FluidRenderer { light = (light & 0xF00000) | luminosity << 4; Vector3d center = new Vector3d(xMin + (xMax - xMin) / 2, yMin + (yMax - yMin) / 2, zMin + (zMax - zMin) / 2); - MatrixStacker msr = MatrixStacker.of(ms); + MatrixTransformStack msr = MatrixTransformStack.of(ms); ms.pushPose(); if (fluidStack.getFluid() .getAttributes() .isLighterThanAir()) - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .translate(center) .rotateX(180) .translateBack(center); diff --git a/src/main/java/com/simibubi/create/foundation/gui/mainMenu/CreateMainMenuScreen.java b/src/main/java/com/simibubi/create/foundation/gui/mainMenu/CreateMainMenuScreen.java index 912409cd9..3eed04d2d 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/mainMenu/CreateMainMenuScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/mainMenu/CreateMainMenuScreen.java @@ -2,6 +2,7 @@ package com.simibubi.create.foundation.gui.mainMenu; import java.awt.Color; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; @@ -17,7 +18,6 @@ import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.ponder.content.PonderTagIndexScreen; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Lang; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.client.gui.screen.ConfirmOpenLinkScreen; import net.minecraft.client.gui.screen.MainMenuScreen; @@ -87,7 +87,7 @@ public class CreateMainMenuScreen extends AbstractSimiScreen { ms.translate(width / 2, 60, 200); ms.scale(24 * side, 24 * side, 32); ms.translate(-1.75 * ((alpha * alpha) / 2f + .5f), .25f, 0); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateX(45); GuiGameElement.of(AllBlocks.LARGE_COGWHEEL.getDefaultState()) .rotateBlock(0, Util.getMillis() / 32f * side, 0) diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java index c5bbdacef..0befcd501 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java @@ -16,6 +16,7 @@ import java.util.function.Supplier; import org.apache.commons.lang3.mutable.MutableDouble; import org.apache.commons.lang3.mutable.MutableObject; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.ponder.content.PonderIndex; import com.simibubi.create.foundation.ponder.content.PonderTag; @@ -25,7 +26,6 @@ import com.simibubi.create.foundation.ponder.elements.WorldSectionElement; import com.simibubi.create.foundation.ponder.instructions.HideAllInstruction; import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.Pair; import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.animation.LerpedFloat; @@ -235,7 +235,7 @@ public class PonderScene { for (RenderType type : RenderType.chunkBufferLayers()) forEachVisible(PonderSceneElement.class, e -> e.renderLayer(world, buffer, type, ms, pt)); - + forEachVisible(PonderSceneElement.class, e -> e.renderLast(world, buffer, ms, pt)); info.set(transform.xRotation.getValue(pt) + 90, transform.yRotation.getValue(pt) + 180); world.renderEntities(ms, buffer, info, pt); @@ -453,14 +453,14 @@ public class PonderScene { public MatrixStack apply(MatrixStack ms, float pt, boolean overlayCompatible) { ms.translate(width / 2, height / 2, 200 + offset); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateX(-35) .rotateY(55); ms.translate(offset, 0, 0); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(-55) .rotateX(35); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateX(xRotation.getValue(pt)) .rotateY(yRotation.getValue(pt)); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/elements/AnimatedSceneElement.java b/src/main/java/com/simibubi/create/foundation/ponder/elements/AnimatedSceneElement.java index 985685916..3adc64113 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/elements/AnimatedSceneElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/elements/AnimatedSceneElement.java @@ -1,8 +1,8 @@ package com.simibubi.create.foundation.ponder.elements; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.ponder.PonderWorld; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.animation.LerpedFloat; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -60,7 +60,7 @@ public abstract class AnimatedSceneElement extends PonderSceneElement { protected float applyFade(MatrixStack ms, float pt) { float currentFade = fade.getValue(pt); if (fadeVec != null) - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .translate(fadeVec.scale(-1 + currentFade)); return currentFade; } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/elements/MinecartElement.java b/src/main/java/com/simibubi/create/foundation/ponder/elements/MinecartElement.java index 462686f94..d088ba165 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/elements/MinecartElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/elements/MinecartElement.java @@ -1,9 +1,9 @@ package com.simibubi.create.foundation.ponder.elements; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.ponder.PonderScene; import com.simibubi.create.foundation.ponder.PonderWorld; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.animation.LerpedFloat; import net.minecraft.client.Minecraft; @@ -103,7 +103,7 @@ public class MinecartElement extends AnimatedSceneElement { ms.translate(MathHelper.lerp(pt, entity.xo, entity.getX()), MathHelper.lerp(pt, entity.yo, entity.getY()), MathHelper.lerp(pt, entity.zo, entity.getZ())); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(rotation.getValue(pt)); entityrenderermanager.render(entity, 0, 0, 0, 0, pt, ms, buffer, lightCoordsFromFade(fade)); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/elements/ParrotElement.java b/src/main/java/com/simibubi/create/foundation/ponder/elements/ParrotElement.java index 8c9d88aa4..9b07cc2ec 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/elements/ParrotElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/elements/ParrotElement.java @@ -2,6 +2,7 @@ package com.simibubi.create.foundation.ponder.elements; import java.util.function.Supplier; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -9,7 +10,6 @@ import com.simibubi.create.foundation.ponder.PonderScene; import com.simibubi.create.foundation.ponder.PonderUI; import com.simibubi.create.foundation.ponder.PonderWorld; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; @@ -126,7 +126,7 @@ public class ParrotElement extends AnimatedSceneElement { ms.translate(MathHelper.lerp(pt, entity.xo, entity.getX()), MathHelper.lerp(pt, entity.yo, entity.getY()), MathHelper.lerp(pt, entity.zo, entity.getZ())); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(AngleHelper.angleLerp(pt, entity.yRotO, entity.yRot)); entityrenderermanager.render(entity, 0, 0, 0, 0, pt, ms, buffer, lightCoordsFromFade(fade)); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/elements/WorldSectionElement.java b/src/main/java/com/simibubi/create/foundation/ponder/elements/WorldSectionElement.java index f9d0c02e7..d8c05fbdf 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/elements/WorldSectionElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/elements/WorldSectionElement.java @@ -8,6 +8,7 @@ import java.util.Random; import org.lwjgl.opengl.GL11; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.IVertexBuilder; @@ -21,7 +22,6 @@ import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.SuperByteBufferCache; import com.simibubi.create.foundation.render.TileEntityRenderHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.Pair; import com.simibubi.create.foundation.utility.VecHelper; @@ -224,7 +224,7 @@ public class WorldSectionElement extends AnimatedSceneElement { } public void transformMS(MatrixStack ms, float pt) { - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .translate(VecHelper.lerp(pt, prevAnimatedOffset, animatedOffset)); if (!animatedRotation.equals(Vector3d.ZERO) || !prevAnimatedRotation.equals(Vector3d.ZERO)) { if (centerOfRotation == null) @@ -232,14 +232,14 @@ public class WorldSectionElement extends AnimatedSceneElement { double rotX = MathHelper.lerp(pt, prevAnimatedRotation.x, animatedRotation.x); double rotZ = MathHelper.lerp(pt, prevAnimatedRotation.z, animatedRotation.z); double rotY = MathHelper.lerp(pt, prevAnimatedRotation.y, animatedRotation.y); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .translate(centerOfRotation) .rotateX(rotX) .rotateZ(rotZ) .rotateY(rotY) .translateBack(centerOfRotation); if (stabilizationAnchor != null) { - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .translate(stabilizationAnchor) .rotateX(-rotX) .rotateZ(-rotZ) diff --git a/src/main/java/com/simibubi/create/foundation/render/AllMaterialSpecs.java b/src/main/java/com/simibubi/create/foundation/render/AllMaterialSpecs.java index 0bf3868a0..82e1a5928 100644 --- a/src/main/java/com/simibubi/create/foundation/render/AllMaterialSpecs.java +++ b/src/main/java/com/simibubi/create/foundation/render/AllMaterialSpecs.java @@ -1,6 +1,6 @@ package com.simibubi.create.foundation.render; -import com.jozufozu.flywheel.backend.instancing.MaterialSpec; +import com.jozufozu.flywheel.backend.material.MaterialSpec; import com.jozufozu.flywheel.core.Formats; import com.jozufozu.flywheel.event.GatherContextEvent; import com.simibubi.create.Create; diff --git a/src/main/java/com/simibubi/create/foundation/render/PartialBufferer.java b/src/main/java/com/simibubi/create/foundation/render/PartialBufferer.java index 6e724722c..9c5c4d59d 100644 --- a/src/main/java/com/simibubi/create/foundation/render/PartialBufferer.java +++ b/src/main/java/com/simibubi/create/foundation/render/PartialBufferer.java @@ -5,10 +5,10 @@ import static net.minecraft.state.properties.BlockStateProperties.FACING; import java.util.function.Supplier; import com.jozufozu.flywheel.core.PartialModel; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.CreateClient; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.BlockState; import net.minecraft.util.Direction; @@ -31,7 +31,7 @@ public class PartialBufferer { public static Supplier rotateToFace(Direction facing) { return () -> { MatrixStack stack = new MatrixStack(); - MatrixStacker.of(stack) + MatrixTransformStack.of(stack) .centre() .rotateY(AngleHelper.horizontalAngle(facing)) .rotateX(AngleHelper.verticalAngle(facing)) diff --git a/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java b/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java index 2e0b21da8..dd19089b4 100644 --- a/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java @@ -1,10 +1,10 @@ package com.simibubi.create.foundation.render; import com.jozufozu.flywheel.util.BufferBuilderReader; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.foundation.block.render.SpriteShiftEntry; -import com.simibubi.create.foundation.utility.MatrixStacker; import it.unimi.dsi.fastutil.longs.Long2IntMap; import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap; @@ -61,10 +61,12 @@ public class SuperByteBuffer { private final Vector4f pos = new Vector4f(); private final Vector3f normal = new Vector3f(); private final Vector4f lightPos = new Vector4f(); + private final MatrixTransformStack stacker; public SuperByteBuffer(BufferBuilder buf) { template = new BufferBuilderReader(buf); transforms = new MatrixStack(); + stacker = MatrixTransformStack.of(transforms); } public static float getUnInterpolatedU(TextureAtlasSprite sprite, float u) { @@ -221,8 +223,8 @@ public class SuperByteBuffer { return this; } - public MatrixStacker matrixStacker() { - return MatrixStacker.of(transforms); + public MatrixTransformStack matrixStacker() { + return stacker; } public SuperByteBuffer translate(Vector3d vec) { diff --git a/src/main/java/com/simibubi/create/foundation/render/TileEntityRenderHelper.java b/src/main/java/com/simibubi/create/foundation/render/TileEntityRenderHelper.java index bbafddf47..f0d640691 100644 --- a/src/main/java/com/simibubi/create/foundation/render/TileEntityRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/render/TileEntityRenderHelper.java @@ -4,11 +4,11 @@ import java.util.Iterator; import javax.annotation.Nullable; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.Create; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -56,7 +56,7 @@ public class TileEntityRenderHelper { BlockPos pos = tileEntity.getBlockPos(); ms.pushPose(); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .translate(pos); try { diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBoxTransform.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBoxTransform.java index 2ffaea5d6..d701a8ae7 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBoxTransform.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBoxTransform.java @@ -4,9 +4,9 @@ import java.util.function.Function; import org.apache.commons.lang3.tuple.Pair; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.BlockState; @@ -109,7 +109,7 @@ public abstract class ValueBoxTransform { protected void rotate(BlockState state, MatrixStack ms) { float yRot = AngleHelper.horizontalAngle(getSide()) + 180; float xRot = getSide() == Direction.UP ? 90 : getSide() == Direction.DOWN ? 270 : 0; - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .rotateY(yRot) .rotateX(xRot); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/MatrixStacker.java b/src/main/java/com/simibubi/create/foundation/utility/MatrixStacker.java deleted file mode 100644 index 009e20420..000000000 --- a/src/main/java/com/simibubi/create/foundation/utility/MatrixStacker.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.simibubi.create.foundation.utility; - -import com.mojang.blaze3d.matrix.MatrixStack; - -import net.minecraft.util.Direction; -import net.minecraft.util.Direction.Axis; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Quaternion; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.math.vector.Vector3f; -import net.minecraft.util.math.vector.Vector3i; - -public class MatrixStacker { - - public static final Vector3d center = VecHelper.getCenterOf(BlockPos.ZERO); - static MatrixStacker instance; - - MatrixStack ms; - - public static MatrixStacker of(MatrixStack ms) { - if (instance == null) - instance = new MatrixStacker(); - instance.ms = ms; - return instance; - } - - public MatrixStacker restoreIdentity() { - MatrixStack.Entry entry = ms.last(); - - entry.pose() - .setIdentity(); - entry.normal() - .setIdentity(); - - return this; - } - - public MatrixStacker rotate(Direction axis, float radians) { - if (radians == 0) - return this; - ms.mulPose(axis.step() - .rotation(radians)); - return this; - } - - public MatrixStacker rotate(double angle, Axis axis) { - Vector3f vec = - axis == Axis.X ? Vector3f.XP : axis == Axis.Y ? Vector3f.YP : Vector3f.ZP; - return multiply(vec, angle); - } - - public MatrixStacker rotateX(double angle) { - return multiply(Vector3f.XP, angle); - } - - public MatrixStacker rotateY(double angle) { - return multiply(Vector3f.YP, angle); - } - - public MatrixStacker rotateZ(double angle) { - return multiply(Vector3f.ZP, angle); - } - - public MatrixStacker centre() { - return translate(center); - } - - public MatrixStacker unCentre() { - return translateBack(center); - } - - public MatrixStacker translate(Vector3i vec) { - ms.translate(vec.getX(), vec.getY(), vec.getZ()); - return this; - } - - public MatrixStacker translate(Vector3d vec) { - ms.translate(vec.x, vec.y, vec.z); - return this; - } - - public MatrixStacker translateBack(Vector3d vec) { - ms.translate(-vec.x, -vec.y, -vec.z); - return this; - } - - public MatrixStacker translate(double x, double y, double z) { - ms.translate(x, y, z); - return this; - } - - public MatrixStacker multiply(Quaternion quaternion) { - ms.mulPose(quaternion); - return this; - } - - public MatrixStacker nudge(int id) { - long randomBits = (long) id * 31L * 493286711L; - randomBits = randomBits * randomBits * 4392167121L + randomBits * 98761L; - float xNudge = (((float) (randomBits >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; - float yNudge = (((float) (randomBits >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; - float zNudge = (((float) (randomBits >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; - ms.translate(xNudge, yNudge, zNudge); - return this; - } - - public MatrixStacker multiply(Vector3f axis, double angle) { - if (angle == 0) - return this; - ms.mulPose(axis.rotationDegrees((float) angle)); - return this; - } - - public MatrixStacker push() { - ms.pushPose(); - return this; - } - - public MatrixStacker pop() { - ms.popPose(); - return this; - } - - public MatrixStack unwrap() { - return ms; - } - -} diff --git a/src/main/java/com/simibubi/create/foundation/utility/outliner/Outline.java b/src/main/java/com/simibubi/create/foundation/utility/outliner/Outline.java index 009f1b7e3..08cff21bb 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/outliner/Outline.java +++ b/src/main/java/com/simibubi/create/foundation/utility/outliner/Outline.java @@ -4,6 +4,7 @@ import java.util.Optional; import javax.annotation.Nullable; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack.Entry; import com.mojang.blaze3d.vertex.IVertexBuilder; @@ -12,7 +13,6 @@ import com.simibubi.create.foundation.renderState.RenderTypes; import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.ColorHelper; -import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.renderer.texture.OverlayTexture; @@ -40,7 +40,7 @@ public abstract class Outline { .length(); float vAngle = AngleHelper.deg(MathHelper.atan2(hDistance, diff.y)) - 90; ms.pushPose(); - MatrixStacker.of(ms) + MatrixTransformStack.of(ms) .translate(start) .rotateY(hAngle).rotateX(vAngle); renderAACuboidLine(ms, buffer, Vector3d.ZERO, new Vector3d(0, 0, diff.length()));