Instancer interface
- Entire material/model system finally cleaned up
This commit is contained in:
parent
6fcc960189
commit
2eef57204c
15 changed files with 30 additions and 29 deletions
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.content.contraptions.base;
|
||||
|
||||
import com.jozufozu.flywheel.backend.material.InstanceMaterial;
|
||||
import com.jozufozu.flywheel.backend.material.Material;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.simibubi.create.foundation.render.AllMaterialSpecs;
|
||||
|
||||
|
@ -9,7 +9,7 @@ public class CutoutRotatingInstance extends SingleRotatingInstance {
|
|||
super(modelManager, tile);
|
||||
}
|
||||
|
||||
protected InstanceMaterial<RotatingData> getRotatingMaterial() {
|
||||
protected Material<RotatingData> getRotatingMaterial() {
|
||||
return materialManager.defaultCutout()
|
||||
.material(AllMaterialSpecs.ROTATING);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.content.contraptions.base;
|
||||
|
||||
import com.jozufozu.flywheel.backend.material.InstanceMaterial;
|
||||
import com.jozufozu.flywheel.backend.material.Material;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
|
@ -84,7 +84,7 @@ public abstract class KineticTileInstance<T extends KineticTileEntity> extends T
|
|||
return shaft(getRotationAxis());
|
||||
}
|
||||
|
||||
protected InstanceMaterial<RotatingData> getRotatingMaterial() {
|
||||
protected Material<RotatingData> getRotatingMaterial() {
|
||||
return materialManager.defaultSolid()
|
||||
.material(AllMaterialSpecs.ROTATING);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.content.contraptions.base;
|
||||
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.MappedBuffer;
|
||||
import com.jozufozu.flywheel.backend.instancing.GPUInstancer;
|
||||
import com.jozufozu.flywheel.backend.instancing.Instancer;
|
||||
|
||||
import net.minecraft.util.Direction;
|
||||
|
@ -17,13 +18,11 @@ public class RotatingData extends KineticData {
|
|||
|
||||
public RotatingData setRotationAxis(Direction.Axis axis) {
|
||||
Direction orientation = Direction.get(Direction.AxisDirection.POSITIVE, axis);
|
||||
setRotationAxis(orientation.step());
|
||||
return this;
|
||||
return setRotationAxis(orientation.step());
|
||||
}
|
||||
|
||||
public RotatingData setRotationAxis(Vector3f axis) {
|
||||
setRotationAxis(axis.x(), axis.y(), axis.z());
|
||||
return this;
|
||||
return setRotationAxis(axis.x(), axis.y(), axis.z());
|
||||
}
|
||||
|
||||
public RotatingData setRotationAxis(float rotationAxisX, float rotationAxisY, float rotationAxisZ) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.content.contraptions.components.actors;
|
||||
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.MappedBuffer;
|
||||
import com.jozufozu.flywheel.backend.instancing.GPUInstancer;
|
||||
import com.jozufozu.flywheel.backend.instancing.InstanceData;
|
||||
import com.jozufozu.flywheel.backend.instancing.Instancer;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.content.contraptions.components.actors;
|
||||
|
||||
import com.jozufozu.flywheel.backend.material.InstanceMaterial;
|
||||
import com.jozufozu.flywheel.backend.material.Material;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
|
@ -22,7 +22,7 @@ public class DrillActorInstance extends ActorInstance {
|
|||
public DrillActorInstance(MaterialManager materialManager, PlacementSimulationWorld contraption, MovementContext context) {
|
||||
super(materialManager, contraption, context);
|
||||
|
||||
InstanceMaterial<ActorData> instanceMaterial = materialManager.defaultSolid()
|
||||
Material<ActorData> material = materialManager.defaultSolid()
|
||||
.material(AllMaterialSpecs.ACTORS);
|
||||
|
||||
BlockState state = context.state;
|
||||
|
@ -38,7 +38,7 @@ public class DrillActorInstance extends ActorInstance {
|
|||
else
|
||||
eulerY = facing.toYRot() + ((axis == Direction.Axis.X) ? 180 : 0);
|
||||
|
||||
drillHead = instanceMaterial.getModel(AllBlockPartials.DRILL_HEAD, state).createInstance();
|
||||
drillHead = material.getModel(AllBlockPartials.DRILL_HEAD, state).createInstance();
|
||||
|
||||
drillHead.setPosition(context.localPos)
|
||||
.setBlockLight(localBlockLight())
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.actors;
|
|||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
|
||||
|
||||
import com.jozufozu.flywheel.backend.material.InstanceMaterial;
|
||||
import com.jozufozu.flywheel.backend.material.Material;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.jozufozu.flywheel.core.Materials;
|
||||
import com.jozufozu.flywheel.core.materials.ModelData;
|
||||
|
@ -37,14 +37,14 @@ public class HarvesterActorInstance extends ActorInstance {
|
|||
public HarvesterActorInstance(MaterialManager materialManager, PlacementSimulationWorld simulationWorld, MovementContext context) {
|
||||
super(materialManager, simulationWorld, context);
|
||||
|
||||
InstanceMaterial<ModelData> instanceMaterial = materialManager.defaultCutout()
|
||||
Material<ModelData> material = materialManager.defaultCutout()
|
||||
.material(Materials.TRANSFORMED);
|
||||
|
||||
BlockState state = context.state;
|
||||
|
||||
facing = state.getValue(HORIZONTAL_FACING);
|
||||
|
||||
harvester = instanceMaterial.getModel(AllBlockPartials.HARVESTER_BLADE, state).createInstance();
|
||||
harvester = material.getModel(AllBlockPartials.HARVESTER_BLADE, state).createInstance();
|
||||
|
||||
horizontalAngle = facing.toYRot() + ((facing.getAxis() == Direction.Axis.X) ? 180 : 0);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.deployer;
|
|||
import static com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE;
|
||||
import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING;
|
||||
|
||||
import com.jozufozu.flywheel.backend.material.InstanceMaterial;
|
||||
import com.jozufozu.flywheel.backend.material.Material;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.jozufozu.flywheel.core.Materials;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
|
@ -45,7 +45,7 @@ public class DeployerActorInstance extends ActorInstance {
|
|||
public DeployerActorInstance(MaterialManager materialManager, PlacementSimulationWorld simulationWorld, MovementContext context) {
|
||||
super(materialManager, simulationWorld, context);
|
||||
|
||||
InstanceMaterial<ModelData> mat = materialManager.defaultSolid()
|
||||
Material<ModelData> mat = materialManager.defaultSolid()
|
||||
.material(Materials.TRANSFORMED);
|
||||
|
||||
BlockState state = context.state;
|
||||
|
|
|
@ -9,7 +9,7 @@ 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.Instancer;
|
||||
import com.jozufozu.flywheel.backend.material.InstanceMaterial;
|
||||
import com.jozufozu.flywheel.backend.material.Material;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.jozufozu.flywheel.core.materials.ModelData;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
|
@ -63,7 +63,7 @@ public class FlyWheelInstance extends KineticTileInstance<FlywheelTileEntity> im
|
|||
|
||||
connectorAngleMult = flipAngle ? -1 : 1;
|
||||
|
||||
InstanceMaterial<ModelData> mat = getTransformMaterial();
|
||||
Material<ModelData> mat = getTransformMaterial();
|
||||
|
||||
upperRotating = mat.getModel(AllBlockPartials.FLYWHEEL_UPPER_ROTATING, blockState).createInstance();
|
||||
lowerRotating = mat.getModel(AllBlockPartials.FLYWHEEL_LOWER_ROTATING, blockState).createInstance();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.content.contraptions.relays.belt;
|
||||
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.MappedBuffer;
|
||||
import com.jozufozu.flywheel.backend.instancing.GPUInstancer;
|
||||
import com.jozufozu.flywheel.backend.instancing.Instancer;
|
||||
import com.simibubi.create.content.contraptions.base.KineticData;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
|||
|
||||
import com.jozufozu.flywheel.backend.instancing.InstanceData;
|
||||
import com.jozufozu.flywheel.backend.instancing.Instancer;
|
||||
import com.jozufozu.flywheel.backend.material.InstanceMaterial;
|
||||
import com.jozufozu.flywheel.backend.material.Material;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.IRotate;
|
||||
|
@ -26,7 +26,7 @@ public class SplitShaftInstance extends KineticTileInstance<SplitShaftTileEntity
|
|||
|
||||
float speed = tile.getSpeed();
|
||||
|
||||
InstanceMaterial<RotatingData> rotatingMaterial = getRotatingMaterial();
|
||||
Material<RotatingData> rotatingMaterial = getRotatingMaterial();
|
||||
|
||||
for (Direction dir : Iterate.directionsInAxis(getRotationAxis())) {
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Map;
|
|||
|
||||
import com.jozufozu.flywheel.backend.instancing.InstanceData;
|
||||
import com.jozufozu.flywheel.backend.instancing.Instancer;
|
||||
import com.jozufozu.flywheel.backend.material.InstanceMaterial;
|
||||
import com.jozufozu.flywheel.backend.material.Material;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileInstance;
|
||||
|
@ -33,7 +33,7 @@ public class GearboxInstance extends KineticTileInstance<GearboxTileEntity> {
|
|||
int skyLight = world.getBrightness(LightType.SKY, pos);
|
||||
updateSourceFacing();
|
||||
|
||||
InstanceMaterial<RotatingData> rotatingMaterial = getRotatingMaterial();
|
||||
Material<RotatingData> rotatingMaterial = getRotatingMaterial();
|
||||
|
||||
for (Direction direction : Iterate.directions) {
|
||||
final Direction.Axis axis = direction.getAxis();
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.simibubi.create.content.logistics.block;
|
||||
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.MappedBuffer;
|
||||
import com.jozufozu.flywheel.backend.instancing.GPUInstancer;
|
||||
import com.jozufozu.flywheel.backend.instancing.InstanceData;
|
||||
import com.jozufozu.flywheel.backend.instancing.Instancer;
|
||||
import com.jozufozu.flywheel.core.materials.IFlatLight;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector3i;
|
||||
|
||||
public class FlapData extends InstanceData implements IFlatLight<FlapData> {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ 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.Instancer;
|
||||
import com.jozufozu.flywheel.backend.material.InstanceMaterial;
|
||||
import com.jozufozu.flywheel.backend.material.Material;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.jozufozu.flywheel.core.materials.ModelData;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
|
@ -47,7 +47,7 @@ public class ArmInstance extends SingleRotatingInstance implements IDynamicInsta
|
|||
public ArmInstance(MaterialManager modelManager, ArmTileEntity tile) {
|
||||
super(modelManager, tile);
|
||||
|
||||
InstanceMaterial<ModelData> mat = getTransformMaterial();
|
||||
Material<ModelData> mat = getTransformMaterial();
|
||||
|
||||
base = mat.getModel(AllBlockPartials.ARM_BASE, blockState).createInstance();
|
||||
lowerBody = mat.getModel(AllBlockPartials.ARM_LOWER_BODY, blockState).createInstance();
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.logistics.block.redstone;
|
|||
|
||||
import com.jozufozu.flywheel.backend.instancing.IDynamicInstance;
|
||||
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
|
||||
import com.jozufozu.flywheel.backend.material.InstanceMaterial;
|
||||
import com.jozufozu.flywheel.backend.material.Material;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.jozufozu.flywheel.core.materials.ModelData;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
|
@ -26,7 +26,7 @@ public class AnalogLeverInstance extends TileEntityInstance<AnalogLeverTileEntit
|
|||
public AnalogLeverInstance(MaterialManager modelManager, AnalogLeverTileEntity tile) {
|
||||
super(modelManager, tile);
|
||||
|
||||
InstanceMaterial<ModelData> mat = getTransformMaterial();
|
||||
Material<ModelData> mat = getTransformMaterial();
|
||||
|
||||
handle = mat.getModel(AllBlockPartials.ANALOG_LEVER_HANDLE, blockState).createInstance();
|
||||
indicator = mat.getModel(AllBlockPartials.ANALOG_LEVER_INDICATOR, blockState).createInstance();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.simibubi.create.content.schematics.block;
|
||||
|
||||
import com.jozufozu.flywheel.backend.instancing.IDynamicInstance;
|
||||
import com.jozufozu.flywheel.backend.material.InstanceMaterial;
|
||||
import com.jozufozu.flywheel.backend.material.Material;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
|
||||
import com.jozufozu.flywheel.core.materials.ModelData;
|
||||
|
@ -20,7 +20,7 @@ public class SchematicannonInstance extends TileEntityInstance<SchematicannonTil
|
|||
public SchematicannonInstance(MaterialManager modelManager, SchematicannonTileEntity tile) {
|
||||
super(modelManager, tile);
|
||||
|
||||
InstanceMaterial<ModelData> mat = getTransformMaterial();
|
||||
Material<ModelData> mat = getTransformMaterial();
|
||||
|
||||
connector = mat.getModel(AllBlockPartials.SCHEMATICANNON_CONNECTOR, blockState).createInstance();
|
||||
pipe = mat.getModel(AllBlockPartials.SCHEMATICANNON_PIPE, blockState).createInstance();
|
||||
|
|
Loading…
Reference in a new issue