mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-30 14:55:07 +01:00
Chugging along
- Fix compile errors with new flywheel light update system. - Fix compile errors in instance shaders. - Call Instance#setChanged where needed.
This commit is contained in:
parent
1c46bc8ae1
commit
b6d1f02d6a
38 changed files with 146 additions and 199 deletions
|
@ -23,7 +23,7 @@ use_parchment = true
|
||||||
# dependency versions
|
# dependency versions
|
||||||
registrate_version = MC1.20-1.3.3
|
registrate_version = MC1.20-1.3.3
|
||||||
flywheel_minecraft_version = 1.20.1
|
flywheel_minecraft_version = 1.20.1
|
||||||
flywheel_version = 1.0.0-alpha-18
|
flywheel_version = 1.0.0-alpha-27
|
||||||
jei_minecraft_version = 1.20.1
|
jei_minecraft_version = 1.20.1
|
||||||
jei_version = 15.2.0.22
|
jei_version = 15.2.0.22
|
||||||
curios_minecraft_version = 1.20.1
|
curios_minecraft_version = 1.20.1
|
||||||
|
|
|
@ -20,7 +20,7 @@ import com.simibubi.create.foundation.outliner.Outliner;
|
||||||
import com.simibubi.create.foundation.ponder.element.WorldSectionElement;
|
import com.simibubi.create.foundation.ponder.element.WorldSectionElement;
|
||||||
import com.simibubi.create.foundation.render.AllInstanceTypes;
|
import com.simibubi.create.foundation.render.AllInstanceTypes;
|
||||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||||
import com.simibubi.create.foundation.render.CreateContexts;
|
import com.simibubi.create.foundation.render.StitchedSprite;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
||||||
import com.simibubi.create.foundation.utility.Components;
|
import com.simibubi.create.foundation.utility.Components;
|
||||||
import com.simibubi.create.foundation.utility.ModelSwapper;
|
import com.simibubi.create.foundation.utility.ModelSwapper;
|
||||||
|
@ -64,6 +64,8 @@ public class CreateClient {
|
||||||
modEventBus.addListener(CreateClient::clientInit);
|
modEventBus.addListener(CreateClient::clientInit);
|
||||||
modEventBus.addListener(AllParticleTypes::registerFactories);
|
modEventBus.addListener(AllParticleTypes::registerFactories);
|
||||||
|
|
||||||
|
modEventBus.addListener(StitchedSprite::onTextureStitchPost);
|
||||||
|
|
||||||
AllInstanceTypes.init();
|
AllInstanceTypes.init();
|
||||||
|
|
||||||
MODEL_SWAPPER.registerListeners(modEventBus);
|
MODEL_SWAPPER.registerListeners(modEventBus);
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class HarvesterActorVisual extends ActorVisual {
|
||||||
horizontalAngle = facing.toYRot() + ((facing.getAxis() == Direction.Axis.X) ? 180 : 0);
|
horizontalAngle = facing.toYRot() + ((facing.getAxis() == Direction.Axis.X) ? 180 : 0);
|
||||||
|
|
||||||
harvester.setBlockLight(localBlockLight());
|
harvester.setBlockLight(localBlockLight());
|
||||||
|
harvester.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PartialModel getRollingPartial() {
|
protected PartialModel getRollingPartial() {
|
||||||
|
@ -90,7 +91,8 @@ public class HarvesterActorVisual extends ActorVisual {
|
||||||
.uncenter()
|
.uncenter()
|
||||||
.translate(getRotationOffset())
|
.translate(getRotationOffset())
|
||||||
.rotateXDegrees((float) getRotation())
|
.rotateXDegrees((float) getRotation())
|
||||||
.translateBack(getRotationOffset());
|
.translateBack(getRotationOffset())
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected double getRotation() {
|
protected double getRotation() {
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class PSIVisual extends AbstractBlockEntityVisual<PortableStorageInterfac
|
||||||
@Override
|
@Override
|
||||||
public void init(float pt) {
|
public void init(float pt) {
|
||||||
instance.init(isLit());
|
instance.init(isLit());
|
||||||
|
super.init(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -36,13 +36,15 @@ public class RollerActorVisual extends HarvesterActorVisual {
|
||||||
.translate(0, -.25, 17 / 16f)
|
.translate(0, -.25, 17 / 16f)
|
||||||
.rotateXDegrees((float) getRotation())
|
.rotateXDegrees((float) getRotation())
|
||||||
.translate(0, -.5, .5)
|
.translate(0, -.5, .5)
|
||||||
.rotateYDegrees(90);
|
.rotateYDegrees(90)
|
||||||
|
.setChanged();
|
||||||
|
|
||||||
frame.loadIdentity()
|
frame.loadIdentity()
|
||||||
.translate(context.localPos)
|
.translate(context.localPos)
|
||||||
.center()
|
.center()
|
||||||
.rotateYDegrees(horizontalAngle + 180)
|
.rotateYDegrees(horizontalAngle + 180)
|
||||||
.uncenter();
|
.uncenter()
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -43,7 +43,9 @@ public class BearingVisual<B extends KineticBlockEntity & IBearingBlockEntity> e
|
||||||
topInstance = instancerProvider.instancer(InstanceTypes.ORIENTED, Models.partial(top), RenderStage.AFTER_BLOCK_ENTITIES)
|
topInstance = instancerProvider.instancer(InstanceTypes.ORIENTED, Models.partial(top), RenderStage.AFTER_BLOCK_ENTITIES)
|
||||||
.createInstance();
|
.createInstance();
|
||||||
|
|
||||||
topInstance.setPosition(getVisualPosition()).setRotation(blockOrientation);
|
topInstance.setPosition(getVisualPosition())
|
||||||
|
.setRotation(blockOrientation)
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,7 +55,8 @@ public class BearingVisual<B extends KineticBlockEntity & IBearingBlockEntity> e
|
||||||
|
|
||||||
rot.mul(blockOrientation);
|
rot.mul(blockOrientation);
|
||||||
|
|
||||||
topInstance.setRotation(rot);
|
topInstance.setRotation(rot)
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,21 +3,15 @@ package com.simibubi.create.content.contraptions.elevator;
|
||||||
import com.jozufozu.flywheel.api.visual.DynamicVisual;
|
import com.jozufozu.flywheel.api.visual.DynamicVisual;
|
||||||
import com.jozufozu.flywheel.api.visual.VisualFrameContext;
|
import com.jozufozu.flywheel.api.visual.VisualFrameContext;
|
||||||
import com.jozufozu.flywheel.api.visualization.VisualizationContext;
|
import com.jozufozu.flywheel.api.visualization.VisualizationContext;
|
||||||
import com.jozufozu.flywheel.lib.light.TickingLightListener;
|
|
||||||
import com.simibubi.create.content.kinetics.base.ShaftVisual;
|
import com.simibubi.create.content.kinetics.base.ShaftVisual;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
public class ElevatorPulleyVisual extends ShaftVisual<ElevatorPulleyBlockEntity> implements DynamicVisual, TickingLightListener {
|
public class ElevatorPulleyVisual extends ShaftVisual<ElevatorPulleyBlockEntity> implements DynamicVisual {
|
||||||
|
|
||||||
public ElevatorPulleyVisual(VisualizationContext context, ElevatorPulleyBlockEntity blockEntity) {
|
public ElevatorPulleyVisual(VisualizationContext context, ElevatorPulleyBlockEntity blockEntity) {
|
||||||
super(context, blockEntity);
|
super(context, blockEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean tickLightListener() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beginFrame(VisualFrameContext ctx) {
|
public void beginFrame(VisualFrameContext ctx) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,8 @@ public class GantryCarriageVisual extends ShaftVisual<GantryCarriageBlockEntity>
|
||||||
.translate(0, -9 / 16f, 0)
|
.translate(0, -9 / 16f, 0)
|
||||||
.rotateX(-cogAngle)
|
.rotateX(-cogAngle)
|
||||||
.translate(0, 9 / 16f, 0)
|
.translate(0, 9 / 16f, 0)
|
||||||
.uncenter();
|
.uncenter()
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
static float getRotationMultiplier(Direction.Axis gantryAxis, Direction facing) {
|
static float getRotationMultiplier(Direction.Axis gantryAxis, Direction facing) {
|
||||||
|
|
|
@ -7,12 +7,10 @@ import com.jozufozu.flywheel.api.instance.Instancer;
|
||||||
import com.jozufozu.flywheel.api.visual.DynamicVisual;
|
import com.jozufozu.flywheel.api.visual.DynamicVisual;
|
||||||
import com.jozufozu.flywheel.api.visual.VisualFrameContext;
|
import com.jozufozu.flywheel.api.visual.VisualFrameContext;
|
||||||
import com.jozufozu.flywheel.api.visualization.VisualizationContext;
|
import com.jozufozu.flywheel.api.visualization.VisualizationContext;
|
||||||
import com.jozufozu.flywheel.lib.box.Box;
|
|
||||||
import com.jozufozu.flywheel.lib.box.MutableBox;
|
import com.jozufozu.flywheel.lib.box.MutableBox;
|
||||||
import com.jozufozu.flywheel.lib.instance.OrientedInstance;
|
import com.jozufozu.flywheel.lib.instance.OrientedInstance;
|
||||||
import com.jozufozu.flywheel.lib.light.LightPacking;
|
import com.jozufozu.flywheel.lib.light.LightPacking;
|
||||||
import com.jozufozu.flywheel.lib.light.LightVolume;
|
import com.jozufozu.flywheel.lib.light.LightVolume;
|
||||||
import com.jozufozu.flywheel.lib.light.TickingLightListener;
|
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
|
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
|
||||||
import com.simibubi.create.content.kinetics.base.ShaftVisual;
|
import com.simibubi.create.content.kinetics.base.ShaftVisual;
|
||||||
|
@ -21,11 +19,9 @@ import com.simibubi.create.foundation.render.GroupInstance;
|
||||||
import com.simibubi.create.foundation.render.SelectInstance;
|
import com.simibubi.create.foundation.render.SelectInstance;
|
||||||
|
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.SectionPos;
|
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.level.LightLayer;
|
|
||||||
|
|
||||||
public abstract class AbstractPulleyVisual<T extends KineticBlockEntity> extends ShaftVisual<T> implements DynamicVisual, TickingLightListener {
|
public abstract class AbstractPulleyVisual<T extends KineticBlockEntity> extends ShaftVisual<T> implements DynamicVisual {
|
||||||
|
|
||||||
final OrientedInstance coil;
|
final OrientedInstance coil;
|
||||||
final SelectInstance<OrientedInstance> magnet;
|
final SelectInstance<OrientedInstance> magnet;
|
||||||
|
@ -47,6 +43,7 @@ public abstract class AbstractPulleyVisual<T extends KineticBlockEntity> extends
|
||||||
|
|
||||||
coil = getCoilModel().createInstance()
|
coil = getCoilModel().createInstance()
|
||||||
.setPosition(getVisualPosition());
|
.setPosition(getVisualPosition());
|
||||||
|
coil.setChanged();
|
||||||
|
|
||||||
magnet = new SelectInstance<>(this::getMagnetModelIndex);
|
magnet = new SelectInstance<>(this::getMagnetModelIndex);
|
||||||
magnet.addModel(getMagnetModel())
|
magnet.addModel(getMagnetModel())
|
||||||
|
@ -78,7 +75,8 @@ public abstract class AbstractPulleyVisual<T extends KineticBlockEntity> extends
|
||||||
data.setPosition(getVisualPosition())
|
data.setPosition(getVisualPosition())
|
||||||
.nudgePosition(0, -offset, 0)
|
.nudgePosition(0, -offset, 0)
|
||||||
.setBlockLight(LightPacking.getBlock(packed))
|
.setBlockLight(LightPacking.getBlock(packed))
|
||||||
.setSkyLight(LightPacking.getSky(packed));
|
.setSkyLight(LightPacking.getSky(packed))
|
||||||
|
.setChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
halfRope.update()
|
halfRope.update()
|
||||||
|
@ -91,7 +89,8 @@ public abstract class AbstractPulleyVisual<T extends KineticBlockEntity> extends
|
||||||
rope1.setPosition(getVisualPosition())
|
rope1.setPosition(getVisualPosition())
|
||||||
.nudgePosition(0, -halfRopeNudge, 0)
|
.nudgePosition(0, -halfRopeNudge, 0)
|
||||||
.setBlockLight(LightPacking.getBlock(packed))
|
.setBlockLight(LightPacking.getBlock(packed))
|
||||||
.setSkyLight(LightPacking.getSky(packed));
|
.setSkyLight(LightPacking.getSky(packed))
|
||||||
|
.setChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isRunning()) {
|
if (isRunning()) {
|
||||||
|
@ -104,7 +103,8 @@ public abstract class AbstractPulleyVisual<T extends KineticBlockEntity> extends
|
||||||
.setPosition(getVisualPosition())
|
.setPosition(getVisualPosition())
|
||||||
.nudgePosition(0, -offset + i + 1, 0)
|
.nudgePosition(0, -offset + i + 1, 0)
|
||||||
.setBlockLight(LightPacking.getBlock(packed))
|
.setBlockLight(LightPacking.getBlock(packed))
|
||||||
.setSkyLight(LightPacking.getSky(packed));
|
.setSkyLight(LightPacking.getSky(packed))
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rope.clear();
|
rope.clear();
|
||||||
|
@ -114,6 +114,7 @@ public abstract class AbstractPulleyVisual<T extends KineticBlockEntity> extends
|
||||||
@Override
|
@Override
|
||||||
public void updateLight() {
|
public void updateLight() {
|
||||||
super.updateLight();
|
super.updateLight();
|
||||||
|
light.copyLight(volume);
|
||||||
relight(pos, coil);
|
relight(pos, coil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +142,6 @@ public abstract class AbstractPulleyVisual<T extends KineticBlockEntity> extends
|
||||||
|
|
||||||
protected abstract boolean isRunning();
|
protected abstract boolean isRunning();
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean tickLightListener() {
|
public boolean tickLightListener() {
|
||||||
if (updateVolume()) {
|
if (updateVolume()) {
|
||||||
light.move(volume);
|
light.move(volume);
|
||||||
|
@ -182,17 +182,6 @@ public abstract class AbstractPulleyVisual<T extends KineticBlockEntity> extends
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Box getVolume() {
|
|
||||||
return volume;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLightUpdate(LightLayer type, SectionPos pos) {
|
|
||||||
super.onLightUpdate(type, pos);
|
|
||||||
light.onLightUpdate(type, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectCrumblingInstances(Consumer<Instance> consumer) {
|
public void collectCrumblingInstances(Consumer<Instance> consumer) {
|
||||||
super.collectCrumblingInstances(consumer);
|
super.collectCrumblingInstances(consumer);
|
||||||
|
|
|
@ -3,17 +3,14 @@ package com.simibubi.create.content.contraptions.render;
|
||||||
import com.jozufozu.flywheel.lib.box.Box;
|
import com.jozufozu.flywheel.lib.box.Box;
|
||||||
import com.jozufozu.flywheel.lib.box.MutableBox;
|
import com.jozufozu.flywheel.lib.box.MutableBox;
|
||||||
import com.jozufozu.flywheel.lib.light.GPULightVolume;
|
import com.jozufozu.flywheel.lib.light.GPULightVolume;
|
||||||
import com.jozufozu.flywheel.lib.light.LightListener;
|
|
||||||
import com.jozufozu.flywheel.lib.light.LightUpdater;
|
|
||||||
import com.simibubi.create.content.contraptions.Contraption;
|
import com.simibubi.create.content.contraptions.Contraption;
|
||||||
|
|
||||||
import net.minecraft.core.SectionPos;
|
import net.minecraft.core.SectionPos;
|
||||||
import net.minecraft.world.level.LightLayer;
|
import net.minecraft.world.level.LightLayer;
|
||||||
|
|
||||||
public abstract class ContraptionLighter<C extends Contraption> implements LightListener {
|
public abstract class ContraptionLighter<C extends Contraption> {
|
||||||
protected final C contraption;
|
protected final C contraption;
|
||||||
public final GPULightVolume lightVolume;
|
public final GPULightVolume lightVolume;
|
||||||
protected final LightUpdater lightUpdater;
|
|
||||||
|
|
||||||
protected final MutableBox bounds;
|
protected final MutableBox bounds;
|
||||||
|
|
||||||
|
@ -21,7 +18,6 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
|
||||||
|
|
||||||
protected ContraptionLighter(C contraption) {
|
protected ContraptionLighter(C contraption) {
|
||||||
this.contraption = contraption;
|
this.contraption = contraption;
|
||||||
lightUpdater = LightUpdater.get(contraption.entity.level());
|
|
||||||
|
|
||||||
bounds = getContraptionBounds();
|
bounds = getContraptionBounds();
|
||||||
growBoundsForEdgeData(bounds);
|
growBoundsForEdgeData(bounds);
|
||||||
|
@ -30,18 +26,14 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
|
||||||
|
|
||||||
lightVolume.initialize();
|
lightVolume.initialize();
|
||||||
scheduleRebuild = true;
|
scheduleRebuild = true;
|
||||||
|
|
||||||
lightUpdater.addListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract MutableBox getContraptionBounds();
|
public abstract MutableBox getContraptionBounds();
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isInvalid() {
|
public boolean isInvalid() {
|
||||||
return lightVolume.isInvalid();
|
return lightVolume.isInvalid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLightUpdate(LightLayer type, SectionPos pos) {
|
public void onLightUpdate(LightLayer type, SectionPos pos) {
|
||||||
lightVolume.onLightUpdate(type, pos);
|
lightVolume.onLightUpdate(type, pos);
|
||||||
}
|
}
|
||||||
|
@ -51,13 +43,11 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
|
||||||
bounds.grow(2);
|
bounds.grow(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Box getVolume() {
|
public Box getVolume() {
|
||||||
return bounds;
|
return bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete() {
|
public void delete() {
|
||||||
lightUpdater.removeListener(this);
|
|
||||||
lightVolume.delete();
|
lightVolume.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,14 @@ package com.simibubi.create.content.contraptions.render;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.lib.box.Box;
|
import com.jozufozu.flywheel.lib.box.Box;
|
||||||
import com.jozufozu.flywheel.lib.box.MutableBox;
|
import com.jozufozu.flywheel.lib.box.MutableBox;
|
||||||
import com.jozufozu.flywheel.lib.light.TickingLightListener;
|
|
||||||
import com.simibubi.create.content.contraptions.Contraption;
|
import com.simibubi.create.content.contraptions.Contraption;
|
||||||
import com.simibubi.create.infrastructure.config.AllConfigs;
|
import com.simibubi.create.infrastructure.config.AllConfigs;
|
||||||
|
|
||||||
public class NonStationaryLighter<C extends Contraption> extends ContraptionLighter<C> implements TickingLightListener {
|
public class NonStationaryLighter<C extends Contraption> extends ContraptionLighter<C> {
|
||||||
public NonStationaryLighter(C contraption) {
|
public NonStationaryLighter(C contraption) {
|
||||||
super(contraption);
|
super(contraption);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean tickLightListener() {
|
public boolean tickLightListener() {
|
||||||
if (getVolume().volume() > AllConfigs.client().maxContraptionLightVolume.get())
|
if (getVolume().volume() > AllConfigs.client().maxContraptionLightVolume.get())
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -38,6 +38,7 @@ public class ToolBoxVisual extends AbstractBlockEntityVisual<ToolboxBlockEntity>
|
||||||
lid = instancerProvider.instancer(InstanceTypes.TRANSFORMED, Models.partial(AllPartialModels.TOOLBOX_LIDS.get(blockEntity.getColor())), RenderStage.AFTER_BLOCK_ENTITIES)
|
lid = instancerProvider.instancer(InstanceTypes.TRANSFORMED, Models.partial(AllPartialModels.TOOLBOX_LIDS.get(blockEntity.getColor())), RenderStage.AFTER_BLOCK_ENTITIES)
|
||||||
.createInstance();
|
.createInstance();
|
||||||
|
|
||||||
|
super.init(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -67,7 +67,8 @@ public class FluidValveVisual extends ShaftVisual<FluidValveBlockEntity> impleme
|
||||||
.rotateY((float) yRot)
|
.rotateY((float) yRot)
|
||||||
.rotateX((float) xRot)
|
.rotateX((float) xRot)
|
||||||
.rotateY(pointerRotationOffset + pointerRotation)
|
.rotateY(pointerRotationOffset + pointerRotation)
|
||||||
.uncenter();
|
.uncenter()
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,7 +35,8 @@ public abstract class KineticBlockEntityVisual<T extends KineticBlockEntity> ext
|
||||||
instance.setRotationAxis(axis)
|
instance.setRotationAxis(axis)
|
||||||
.setRotationOffset(getRotationOffset(axis))
|
.setRotationOffset(getRotationOffset(axis))
|
||||||
.setRotationalSpeed(speed)
|
.setRotationalSpeed(speed)
|
||||||
.setColor(blockEntity);
|
.setColor(blockEntity)
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final RotatingInstance setup(RotatingInstance key) {
|
protected final RotatingInstance setup(RotatingInstance key) {
|
||||||
|
@ -55,7 +56,8 @@ public abstract class KineticBlockEntityVisual<T extends KineticBlockEntity> ext
|
||||||
.setRotationalSpeed(speed)
|
.setRotationalSpeed(speed)
|
||||||
.setRotationOffset(getRotationOffset(axis))
|
.setRotationOffset(getRotationOffset(axis))
|
||||||
.setColor(blockEntity)
|
.setColor(blockEntity)
|
||||||
.setPosition(getVisualPosition());
|
.setPosition(getVisualPosition())
|
||||||
|
.setChanged();
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ public class SingleRotatingVisual<T extends KineticBlockEntity> extends KineticB
|
||||||
rotatingModel = instancerProvider.instancer(AllInstanceTypes.ROTATING, model(), RenderStage.AFTER_BLOCK_ENTITIES)
|
rotatingModel = instancerProvider.instancer(AllInstanceTypes.ROTATING, model(), RenderStage.AFTER_BLOCK_ENTITIES)
|
||||||
.createInstance();
|
.createInstance();
|
||||||
setup(rotatingModel);
|
setup(rotatingModel);
|
||||||
|
super.init(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,8 +14,6 @@ import java.util.function.Function;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.lib.box.Box;
|
import com.jozufozu.flywheel.lib.box.Box;
|
||||||
import com.jozufozu.flywheel.lib.box.MutableBox;
|
import com.jozufozu.flywheel.lib.box.MutableBox;
|
||||||
import com.jozufozu.flywheel.lib.light.LightListener;
|
|
||||||
import com.jozufozu.flywheel.lib.light.LightUpdater;
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.kinetics.base.IRotate;
|
import com.simibubi.create.content.kinetics.base.IRotate;
|
||||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
|
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
|
||||||
|
@ -579,13 +577,11 @@ public class BeltBlockEntity extends KineticBlockEntity {
|
||||||
* Hide this behavior in an inner class to avoid loading LightListener on servers.
|
* Hide this behavior in an inner class to avoid loading LightListener on servers.
|
||||||
*/
|
*/
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
class BeltLighter implements LightListener {
|
class BeltLighter {
|
||||||
private byte[] light;
|
private byte[] light;
|
||||||
|
|
||||||
public BeltLighter() {
|
public BeltLighter() {
|
||||||
initializeLight();
|
initializeLight();
|
||||||
LightUpdater.get(level)
|
|
||||||
.addListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -605,7 +601,6 @@ public class BeltBlockEntity extends KineticBlockEntity {
|
||||||
return light == null ? 0 : LightTexture.pack(light[segment * 2], light[segment * 2 + 1]);
|
return light == null ? 0 : LightTexture.pack(light[segment * 2], light[segment * 2 + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Box getVolume() {
|
public Box getVolume() {
|
||||||
BlockPos endPos = BeltHelper.getPositionForOffset(BeltBlockEntity.this, beltLength - 1);
|
BlockPos endPos = BeltHelper.getPositionForOffset(BeltBlockEntity.this, beltLength - 1);
|
||||||
var bb = MutableBox.from(worldPosition, endPos);
|
var bb = MutableBox.from(worldPosition, endPos);
|
||||||
|
@ -613,27 +608,13 @@ public class BeltBlockEntity extends KineticBlockEntity {
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isInvalid() {
|
|
||||||
return remove;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLightUpdate(LightLayer type, SectionPos pos) {
|
public void onLightUpdate(LightLayer type, SectionPos pos) {
|
||||||
if (remove)
|
if (remove)
|
||||||
return;
|
return;
|
||||||
if (level == null)
|
if (level == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Box beltVolume = getVolume();
|
initializeLight();
|
||||||
|
|
||||||
if (beltVolume.intersects(MutableBox.from(pos))) {
|
|
||||||
if (type == LightLayer.BLOCK)
|
|
||||||
updateBlockLight();
|
|
||||||
|
|
||||||
if (type == LightLayer.SKY)
|
|
||||||
updateSkyLight();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeLight() {
|
private void initializeLight() {
|
||||||
|
|
|
@ -89,7 +89,8 @@ public class BeltVisual extends KineticBlockEntityVisual<BeltBlockEntity> {
|
||||||
SpriteShiftEntry spriteShiftEntry = BeltRenderer.getSpriteShiftEntry(color, diagonal, bottom);
|
SpriteShiftEntry spriteShiftEntry = BeltRenderer.getSpriteShiftEntry(color, diagonal, bottom);
|
||||||
key.setScrollTexture(spriteShiftEntry)
|
key.setScrollTexture(spriteShiftEntry)
|
||||||
.setColor(blockEntity)
|
.setColor(blockEntity)
|
||||||
.setRotationalSpeed(getScrollSpeed());
|
.setRotationalSpeed(getScrollSpeed())
|
||||||
|
.setChanged();
|
||||||
bottom = false;
|
bottom = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,14 +166,17 @@ public class BeltVisual extends KineticBlockEntityVisual<BeltBlockEntity> {
|
||||||
.setColor(blockEntity)
|
.setColor(blockEntity)
|
||||||
.setPosition(getVisualPosition())
|
.setPosition(getVisualPosition())
|
||||||
.setBlockLight(level.getBrightness(LightLayer.BLOCK, pos))
|
.setBlockLight(level.getBrightness(LightLayer.BLOCK, pos))
|
||||||
.setSkyLight(level.getBrightness(LightLayer.SKY, pos));
|
.setSkyLight(level.getBrightness(LightLayer.SKY, pos))
|
||||||
|
.setChanged();
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectCrumblingInstances(Consumer<Instance> consumer) {
|
public void collectCrumblingInstances(Consumer<Instance> consumer) {
|
||||||
|
if (pulleyKey != null) {
|
||||||
consumer.accept(pulleyKey);
|
consumer.accept(pulleyKey);
|
||||||
|
}
|
||||||
keys.forEach(consumer);
|
keys.forEach(consumer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,11 +46,13 @@ public class HandCrankVisual extends SingleRotatingVisual<HandCrankBlockEntity>
|
||||||
.translate(getVisualPosition())
|
.translate(getVisualPosition())
|
||||||
.center()
|
.center()
|
||||||
.rotate(angle, Direction.get(Direction.AxisDirection.POSITIVE, axis))
|
.rotate(angle, Direction.get(Direction.AxisDirection.POSITIVE, axis))
|
||||||
.uncenter();
|
.uncenter()
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(float pt) {
|
public void init(float pt) {
|
||||||
|
// FIXME: need to call super.super.init here
|
||||||
if (blockEntity.shouldRenderShaft())
|
if (blockEntity.shouldRenderShaft())
|
||||||
super.init(pt);
|
super.init(pt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,8 +124,8 @@ public class DeployerVisual extends ShaftVisual<DeployerBlockEntity> implements
|
||||||
float y = blockPos.getY() + ((float) facingVec.getY()) * distance;
|
float y = blockPos.getY() + ((float) facingVec.getY()) * distance;
|
||||||
float z = blockPos.getZ() + ((float) facingVec.getZ()) * distance;
|
float z = blockPos.getZ() + ((float) facingVec.getZ()) * distance;
|
||||||
|
|
||||||
pole.setPosition(x, y, z);
|
pole.setPosition(x, y, z).setChanged();
|
||||||
hand.setPosition(x, y, z);
|
hand.setPosition(x, y, z).setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void updateRotation(OrientedInstance pole, OrientedInstance hand, float yRot, float xRot, float zRot) {
|
static void updateRotation(OrientedInstance pole, OrientedInstance hand, float yRot, float xRot, float zRot) {
|
||||||
|
@ -133,11 +133,13 @@ public class DeployerVisual extends ShaftVisual<DeployerBlockEntity> implements
|
||||||
Quaternionf q = Axis.YP.rotationDegrees(yRot);
|
Quaternionf q = Axis.YP.rotationDegrees(yRot);
|
||||||
q.mul(Axis.XP.rotationDegrees(xRot));
|
q.mul(Axis.XP.rotationDegrees(xRot));
|
||||||
|
|
||||||
hand.setRotation(q);
|
hand.setRotation(q)
|
||||||
|
.setChanged();
|
||||||
|
|
||||||
q.mul(Axis.ZP.rotationDegrees(zRot));
|
q.mul(Axis.ZP.rotationDegrees(zRot));
|
||||||
|
|
||||||
pole.setRotation(q);
|
pole.setRotation(q)
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -62,7 +62,8 @@ public class FlywheelVisual extends KineticBlockEntityVisual<FlywheelBlockEntity
|
||||||
.rotate(AngleHelper.rad(angle), Direction.get(Direction.AxisDirection.POSITIVE, axis))
|
.rotate(AngleHelper.rad(angle), Direction.get(Direction.AxisDirection.POSITIVE, axis))
|
||||||
.uncenter();
|
.uncenter();
|
||||||
|
|
||||||
wheel.setTransform(ms);
|
wheel.setTransform(ms)
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -115,13 +115,13 @@ public abstract class GaugeVisual extends ShaftVisual<GaugeBlockEntity> implemen
|
||||||
msr.pushPose();
|
msr.pushPose();
|
||||||
rotateToFace(msr);
|
rotateToFace(msr);
|
||||||
|
|
||||||
getSecond().setTransform(ms);
|
getSecond().setTransform(ms).setChanged();
|
||||||
|
|
||||||
msr.translate(0, dialPivot, dialPivot)
|
msr.translate(0, dialPivot, dialPivot)
|
||||||
.rotate((float) (Math.PI / 2 * -progress), Direction.EAST)
|
.rotate((float) (Math.PI / 2 * -progress), Direction.EAST)
|
||||||
.translate(0, -dialPivot, -dialPivot);
|
.translate(0, -dialPivot, -dialPivot);
|
||||||
|
|
||||||
getFirst().setTransform(ms);
|
getFirst().setTransform(ms).setChanged();
|
||||||
|
|
||||||
msr.popPose();
|
msr.popPose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,8 @@ public class GearboxVisual extends KineticBlockEntityVisual<GearboxBlockEntity>
|
||||||
.setRotationOffset(getRotationOffset(axis)).setColor(blockEntity)
|
.setRotationOffset(getRotationOffset(axis)).setColor(blockEntity)
|
||||||
.setPosition(getVisualPosition())
|
.setPosition(getVisualPosition())
|
||||||
.setBlockLight(blockLight)
|
.setBlockLight(blockLight)
|
||||||
.setSkyLight(skyLight);
|
.setSkyLight(skyLight)
|
||||||
|
.setChanged();
|
||||||
|
|
||||||
keys.put(direction, key);
|
keys.put(direction, key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,22 +133,26 @@ public class ArmVisual extends SingleRotatingVisual<ArmBlockEntity> implements D
|
||||||
msr.rotateX(180);
|
msr.rotateX(180);
|
||||||
|
|
||||||
ArmRenderer.transformBase(msr, baseAngle);
|
ArmRenderer.transformBase(msr, baseAngle);
|
||||||
base.setTransform(msLocal);
|
base.setTransform(msLocal)
|
||||||
|
.setChanged();
|
||||||
|
|
||||||
ArmRenderer.transformLowerArm(msr, lowerArmAngle);
|
ArmRenderer.transformLowerArm(msr, lowerArmAngle);
|
||||||
lowerBody.setTransform(msLocal)
|
lowerBody.setTransform(msLocal)
|
||||||
.setColor(color);
|
.setColor(color)
|
||||||
|
.setChanged();
|
||||||
|
|
||||||
ArmRenderer.transformUpperArm(msr, upperArmAngle);
|
ArmRenderer.transformUpperArm(msr, upperArmAngle);
|
||||||
upperBody.setTransform(msLocal)
|
upperBody.setTransform(msLocal)
|
||||||
.setColor(color);
|
.setColor(color)
|
||||||
|
.setChanged();
|
||||||
|
|
||||||
ArmRenderer.transformHead(msr, headAngle);
|
ArmRenderer.transformHead(msr, headAngle);
|
||||||
|
|
||||||
if (ceiling && blockEntity.goggles)
|
if (ceiling && blockEntity.goggles)
|
||||||
msr.rotateZ(180);
|
msr.rotateZ(180);
|
||||||
|
|
||||||
claw.setTransform(msLocal);
|
claw.setTransform(msLocal)
|
||||||
|
.setChanged();
|
||||||
|
|
||||||
if (ceiling && blockEntity.goggles)
|
if (ceiling && blockEntity.goggles)
|
||||||
msr.rotateZ(180);
|
msr.rotateZ(180);
|
||||||
|
@ -166,7 +170,8 @@ public class ArmVisual extends SingleRotatingVisual<ArmBlockEntity> implements D
|
||||||
int flip = index * 2 - 1;
|
int flip = index * 2 - 1;
|
||||||
ArmRenderer.transformClawHalf(msr, hasItem, isBlockItem, flip);
|
ArmRenderer.transformClawHalf(msr, hasItem, isBlockItem, flip);
|
||||||
clawGrips.get(index)
|
clawGrips.get(index)
|
||||||
.setTransform(msLocal);
|
.setTransform(msLocal)
|
||||||
|
.setChanged();
|
||||||
msLocal.popPose();
|
msLocal.popPose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,12 +62,14 @@ public class MixerVisual extends EncasedCogVisual implements DynamicVisual {
|
||||||
|
|
||||||
mixerHead.setPosition(getVisualPosition())
|
mixerHead.setPosition(getVisualPosition())
|
||||||
.nudge(0, -renderedHeadOffset, 0)
|
.nudge(0, -renderedHeadOffset, 0)
|
||||||
.setRotationalSpeed(speed * 2);
|
.setRotationalSpeed(speed * 2)
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void transformPole(float renderedHeadOffset) {
|
private void transformPole(float renderedHeadOffset) {
|
||||||
mixerPole.setPosition(getVisualPosition())
|
mixerPole.setPosition(getVisualPosition())
|
||||||
.nudgePosition(0, -renderedHeadOffset, 0);
|
.nudgePosition(0, -renderedHeadOffset, 0)
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getRenderedHeadOffset() {
|
private float getRenderedHeadOffset() {
|
||||||
|
|
|
@ -45,7 +45,8 @@ public class PressVisual extends ShaftVisual<MechanicalPressBlockEntity> impleme
|
||||||
float renderedHeadOffset = getRenderedHeadOffset(blockEntity);
|
float renderedHeadOffset = getRenderedHeadOffset(blockEntity);
|
||||||
|
|
||||||
pressHead.setPosition(getVisualPosition())
|
pressHead.setPosition(getVisualPosition())
|
||||||
.nudgePosition(0, -renderedHeadOffset, 0);
|
.nudgePosition(0, -renderedHeadOffset, 0)
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getRenderedHeadOffset(MechanicalPressBlockEntity press) {
|
private float getRenderedHeadOffset(MechanicalPressBlockEntity press) {
|
||||||
|
|
|
@ -31,10 +31,7 @@ public class BracketedKineticBlockEntityVisual extends SingleRotatingVisual<Brac
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(float pt) {
|
public void init(float pt) {
|
||||||
super.init(pt);
|
if (ICogWheel.isLargeCog(blockEntity.getBlockState())) {
|
||||||
if (!ICogWheel.isLargeCog(blockEntity.getBlockState()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Large cogs sometimes have to offset their teeth by 11.25 degrees in order to
|
// Large cogs sometimes have to offset their teeth by 11.25 degrees in order to
|
||||||
// mesh properly
|
// mesh properly
|
||||||
|
|
||||||
|
@ -46,7 +43,10 @@ public class BracketedKineticBlockEntityVisual extends SingleRotatingVisual<Brac
|
||||||
Instancer<RotatingInstance> half = instancerProvider.instancer(AllInstanceTypes.ROTATING, model, RenderStage.AFTER_BLOCK_ENTITIES);
|
Instancer<RotatingInstance> half = instancerProvider.instancer(AllInstanceTypes.ROTATING, model, RenderStage.AFTER_BLOCK_ENTITIES);
|
||||||
|
|
||||||
additionalShaft = setup(half.createInstance(), speed);
|
additionalShaft = setup(half.createInstance(), speed);
|
||||||
additionalShaft.setRotationOffset(offset);
|
additionalShaft.setRotationOffset(offset)
|
||||||
|
.setChanged();
|
||||||
|
}
|
||||||
|
super.init(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,7 +72,8 @@ public class BracketedKineticBlockEntityVisual extends SingleRotatingVisual<Brac
|
||||||
super.update(pt);
|
super.update(pt);
|
||||||
if (additionalShaft != null) {
|
if (additionalShaft != null) {
|
||||||
updateRotation(additionalShaft);
|
updateRotation(additionalShaft);
|
||||||
additionalShaft.setRotationOffset(BracketedKineticBlockEntityRenderer.getShaftAngleOffset(axis, pos));
|
additionalShaft.setRotationOffset(BracketedKineticBlockEntityRenderer.getShaftAngleOffset(axis, pos))
|
||||||
|
.setChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,8 @@ public class EncasedCogVisual extends KineticBlockEntityVisual<KineticBlockEntit
|
||||||
else
|
else
|
||||||
rotatingBottomShaft = Optional.of(data);
|
rotatingBottomShaft = Optional.of(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.init(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class EjectorVisual extends ShaftVisual<EjectorBlockEntity> implements Dy
|
||||||
float angle = lidProgress * 70;
|
float angle = lidProgress * 70;
|
||||||
|
|
||||||
EjectorRenderer.applyLidAngle(blockEntity, angle, plate.loadIdentity().translate(getVisualPosition()));
|
EjectorRenderer.applyLidAngle(blockEntity, angle, plate.loadIdentity().translate(getVisualPosition()));
|
||||||
|
plate.setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -32,14 +32,15 @@ public class CarriageContraptionVisual extends AbstractEntityVisual<CarriageCont
|
||||||
public void init(float pt) {
|
public void init(float pt) {
|
||||||
carriage = entity.getCarriage();
|
carriage = entity.getCarriage();
|
||||||
|
|
||||||
if (carriage == null)
|
if (carriage != null) {
|
||||||
return;
|
bogeys = carriage.bogeys.mapNotNullWithParam((bogey, manager) -> bogey.getStyle()
|
||||||
|
.createVisual(bogey, bogey.type.getSize(), manager), visualizationContext);
|
||||||
bogeys = carriage.bogeys.mapNotNullWithParam((bogey, manager) ->
|
|
||||||
bogey.getStyle().createVisual(bogey, bogey.type.getSize(), manager), visualizationContext);
|
|
||||||
updateLight();
|
updateLight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.init(pt);
|
||||||
|
}
|
||||||
|
|
||||||
public void setBogeyVisibility(boolean first, boolean visible) {
|
public void setBogeyVisibility(boolean first, boolean visible) {
|
||||||
bogeyHidden.set(first, !visible);
|
bogeyHidden.set(first, !visible);
|
||||||
}
|
}
|
||||||
|
@ -86,7 +87,6 @@ public class CarriageContraptionVisual extends AbstractEntityVisual<CarriageCont
|
||||||
ms.popPose();
|
ms.popPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateLight() {
|
public void updateLight() {
|
||||||
if (bogeys == null)
|
if (bogeys == null)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -14,7 +14,6 @@ import com.jozufozu.flywheel.lib.box.Box;
|
||||||
import com.jozufozu.flywheel.lib.box.MutableBox;
|
import com.jozufozu.flywheel.lib.box.MutableBox;
|
||||||
import com.jozufozu.flywheel.lib.instance.InstanceTypes;
|
import com.jozufozu.flywheel.lib.instance.InstanceTypes;
|
||||||
import com.jozufozu.flywheel.lib.instance.TransformedInstance;
|
import com.jozufozu.flywheel.lib.instance.TransformedInstance;
|
||||||
import com.jozufozu.flywheel.lib.light.LightUpdater;
|
|
||||||
import com.jozufozu.flywheel.lib.model.Models;
|
import com.jozufozu.flywheel.lib.model.Models;
|
||||||
import com.jozufozu.flywheel.lib.transform.TransformStack;
|
import com.jozufozu.flywheel.lib.transform.TransformStack;
|
||||||
import com.jozufozu.flywheel.lib.visual.AbstractBlockEntityVisual;
|
import com.jozufozu.flywheel.lib.visual.AbstractBlockEntityVisual;
|
||||||
|
@ -47,11 +46,8 @@ public class TrackVisual extends AbstractBlockEntityVisual<TrackBlockEntity> {
|
||||||
.map(this::createInstance)
|
.map(this::createInstance)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.toList();
|
.toList();
|
||||||
LightUpdater.get(level)
|
|
||||||
.addListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Box getVolume() {
|
public Box getVolume() {
|
||||||
List<BlockPos> out = new ArrayList<>();
|
List<BlockPos> out = new ArrayList<>();
|
||||||
out.addAll(blockEntity.connections.keySet());
|
out.addAll(blockEntity.connections.keySet());
|
||||||
|
|
|
@ -1,21 +1,16 @@
|
||||||
#define PI 3.1415926538
|
|
||||||
|
|
||||||
#include "flywheel:util/quaternion.glsl"
|
#include "flywheel:util/quaternion.glsl"
|
||||||
#include "flywheel:util/matrix.glsl"
|
#include "flywheel:util/matrix.glsl"
|
||||||
|
|
||||||
const float uTime = 0.;
|
|
||||||
|
|
||||||
|
|
||||||
void flw_instanceVertex(in FlwInstance instance) {
|
void flw_instanceVertex(in FlwInstance instance) {
|
||||||
flw_vertexPos = vec4(rotateVertexByQuat(flw_vertexPos.xyz - .5, instance.rotation) + instance.pos + .5, 1.);
|
flw_vertexPos = vec4(rotateByQuaternion(flw_vertexPos.xyz - .5, instance.rotation) + instance.pos + .5, 1.);
|
||||||
|
|
||||||
flw_vertexNormal = rotateVertexByQuat(flw_vertexNormal, instance.rotation);
|
flw_vertexNormal = rotateByQuaternion(flw_vertexNormal, instance.rotation);
|
||||||
|
|
||||||
float scrollSize = instance.scrollTexture.w - instance.scrollTexture.y;
|
float scrollSize = instance.scrollTexture.w - instance.scrollTexture.y;
|
||||||
float scroll = fract(instance.speed * uTime / (31.5 * 16.) + instance.offset) * scrollSize * instance.scrollMult;
|
float scroll = fract(instance.speed * flw_renderTicks / (31.5 * 16.) + instance.offset) * scrollSize * instance.scrollMult;
|
||||||
|
|
||||||
flw_vertexTexCoord = flw_vertexTexCoord - instance.sourceTexture + instance.scrollTexture.xy + vec2(0, scroll);
|
flw_vertexTexCoord = flw_vertexTexCoord - instance.sourceTexture + instance.scrollTexture.xy + vec2(0, scroll);
|
||||||
flw_vertexLight = instance.light;
|
flw_vertexLight = instance.light / 15.;
|
||||||
|
|
||||||
#if defined(DEBUG_RAINBOW)
|
#if defined(DEBUG_RAINBOW)
|
||||||
flw_vertexColor = instance.color;
|
flw_vertexColor = instance.color;
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
#include "flywheel:util/matrix.glsl"
|
#include "flywheel:util/matrix.glsl"
|
||||||
#include "flywheel:util/quaternion.glsl"
|
#include "flywheel:util/quaternion.glsl"
|
||||||
|
|
||||||
const float uTime = 0.;
|
|
||||||
|
|
||||||
void flw_instanceVertex(in FlwInstance instance) {
|
void flw_instanceVertex(in FlwInstance instance) {
|
||||||
float degrees = instance.offset + uTime * instance.speed / 20.;
|
float degrees = instance.offset + flw_renderSeconds * instance.speed;
|
||||||
|
|
||||||
vec4 kineticRot = quat(instance.axis, degrees);
|
vec4 kineticRot = quaternionDegrees(instance.axis, degrees);
|
||||||
vec3 rotated = rotateVertexByQuat(flw_vertexPos.xyz - instance.rotationCenter, kineticRot) + instance.rotationCenter;
|
vec3 rotated = rotateByQuaternion(flw_vertexPos.xyz - instance.rotationCenter, kineticRot) + instance.rotationCenter;
|
||||||
|
|
||||||
flw_vertexPos = vec4(rotateVertexByQuat(rotated - .5, instance.rotation) + instance.pos + .5, 1.);
|
flw_vertexPos.xyz = rotateByQuaternion(rotated - .5, instance.rotation) + instance.pos + .5;
|
||||||
flw_vertexNormal = rotateVertexByQuat(rotateVertexByQuat(flw_vertexNormal, kineticRot), instance.rotation);
|
flw_vertexNormal = rotateByQuaternion(rotateByQuaternion(flw_vertexNormal, kineticRot), instance.rotation);
|
||||||
flw_vertexLight = instance.light;
|
flw_vertexLight = instance.light / 15.;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
#define PI 3.1415926538
|
|
||||||
|
|
||||||
#include "flywheel:util/quaternion.glsl"
|
#include "flywheel:util/quaternion.glsl"
|
||||||
#include "flywheel:util/matrix.glsl"
|
|
||||||
|
|
||||||
const float uTime = 0.;
|
|
||||||
|
|
||||||
void flw_transformBoundingSphere(in FlwInstance instance, inout vec3 center, inout float radius) {
|
void flw_transformBoundingSphere(in FlwInstance instance, inout vec3 center, inout float radius) {
|
||||||
// FIXME: this is incorrect, but it compiles
|
// FIXME: this is incorrect, but it compiles
|
||||||
center = rotateVertexByQuat(center - .5, instance.rotation) + instance.pos + .5;
|
center = rotateByQuaternion(center - .5, instance.rotation) + instance.pos + .5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
#include "flywheel:util/matrix.glsl"
|
|
||||||
#include "flywheel:util/quaternion.glsl"
|
#include "flywheel:util/quaternion.glsl"
|
||||||
|
|
||||||
const float uTime = 0.;
|
|
||||||
|
|
||||||
void flw_transformBoundingSphere(in FlwInstance instance, inout vec3 center, inout float radius) {
|
void flw_transformBoundingSphere(in FlwInstance instance, inout vec3 center, inout float radius) {
|
||||||
// FIXME: this is incorrect, but it compiles
|
// FIXME: this is incorrect, but it compiles
|
||||||
float degrees = instance.offset + uTime * instance.speed / 20.;
|
float degrees = instance.offset + flw_renderSeconds * instance.speed;
|
||||||
|
|
||||||
vec4 kineticRot = quat(instance.axis, degrees);
|
vec4 kineticRot = quaternion(instance.axis, degrees);
|
||||||
vec3 rotated = rotateVertexByQuat(center - instance.rotationCenter, kineticRot) + instance.rotationCenter;
|
vec3 rotated = rotateByQuaternion(center - instance.rotationCenter, kineticRot) + instance.rotationCenter;
|
||||||
|
|
||||||
center = rotateVertexByQuat(rotated - .5, instance.rotation) + instance.pos + .5;
|
center = rotateByQuaternion(rotated - .5, instance.rotation) + instance.pos + .5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
#define PI 3.1415926538
|
#define PI 3.1415926538
|
||||||
|
|
||||||
const float uTime = 0.;
|
|
||||||
|
|
||||||
#include "flywheel:util/matrix.glsl"
|
|
||||||
#include "flywheel:util/quaternion.glsl"
|
#include "flywheel:util/quaternion.glsl"
|
||||||
|
|
||||||
float toRad(float degrees) {
|
|
||||||
return fract(degrees / 360.) * PI * 2.;
|
|
||||||
}
|
|
||||||
|
|
||||||
float getFlapAngle(float flapness, float intensity, float scale) {
|
float getFlapAngle(float flapness, float intensity, float scale) {
|
||||||
float absFlap = abs(flapness);
|
float absFlap = abs(flapness);
|
||||||
|
|
||||||
|
@ -26,9 +19,9 @@ void flw_transformBoundingSphere(in FlwInstance flap, inout vec3 center, inout f
|
||||||
// FIXME: this is incorrect, but it compiles
|
// FIXME: this is incorrect, but it compiles
|
||||||
float flapAngle = getFlapAngle(flap.flapness, flap.intensity, flap.flapScale);
|
float flapAngle = getFlapAngle(flap.flapness, flap.intensity, flap.flapScale);
|
||||||
|
|
||||||
vec4 orientation = quat(vec3(0., 1., 0.), -flap.horizontalAngle);
|
vec4 orientation = quaternion(vec3(0., 1., 0.), -flap.horizontalAngle);
|
||||||
vec4 flapRotation = quat(vec3(1., 0., 0.), flapAngle);
|
vec4 flapRotation = quaternion(vec3(1., 0., 0.), flapAngle);
|
||||||
|
|
||||||
vec3 rotated = rotateVertexByQuat(center - flap.pivot, flapRotation) + flap.pivot + flap.segmentOffset;
|
vec3 rotated = rotateByQuaternion(center - flap.pivot, flapRotation) + flap.pivot + flap.segmentOffset;
|
||||||
center = rotateVertexByQuat(rotated - .5, orientation) + flap.instancePos + .5;
|
center = rotateByQuaternion(rotated - .5, orientation) + flap.instancePos + .5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,15 @@
|
||||||
#define PI 3.1415926538
|
|
||||||
|
|
||||||
#include "flywheel:util/matrix.glsl"
|
#include "flywheel:util/matrix.glsl"
|
||||||
|
|
||||||
const float uTime = 0.;
|
mat3 kineticRotation(float offset, float speed, vec3 axis) {
|
||||||
|
float degrees = offset + flw_renderTicks * speed * 3./10.;
|
||||||
|
|
||||||
mat4 kineticRotation(float offset, float speed, vec3 axis) {
|
return rotationDegrees(axis, degrees);
|
||||||
float degrees = offset + uTime * speed * 3./10.;
|
|
||||||
float angle = fract(degrees / 360.) * PI * 2.;
|
|
||||||
|
|
||||||
return rotate(axis, angle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void flw_transformBoundingSphere(in FlwInstance instance, inout vec3 center, inout float radius) {
|
void flw_transformBoundingSphere(in FlwInstance instance, inout vec3 center, inout float radius) {
|
||||||
// FIXME: this is incorrect, but it compiles
|
// FIXME: this is incorrect, but it compiles
|
||||||
mat4 spin = kineticRotation(instance.offset, instance.speed, instance.axis);
|
mat3 spin = kineticRotation(instance.offset, instance.speed, instance.axis);
|
||||||
|
|
||||||
vec4 worldPos = spin * vec4(center - .5, 1.);
|
vec3 worldPos = spin * (center - .5);
|
||||||
center = worldPos.xyz + instance.pos + .5;
|
center = worldPos + instance.pos + .5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
#define PI 3.1415926538
|
#define PI 3.1415926538
|
||||||
|
|
||||||
const float uTime = 0.;
|
|
||||||
|
|
||||||
#include "flywheel:util/matrix.glsl"
|
|
||||||
#include "flywheel:util/quaternion.glsl"
|
#include "flywheel:util/quaternion.glsl"
|
||||||
|
|
||||||
float toRad(float degrees) {
|
|
||||||
return fract(degrees / 360.) * PI * 2.;
|
|
||||||
}
|
|
||||||
|
|
||||||
float getFlapAngle(float flapness, float intensity, float scale) {
|
float getFlapAngle(float flapness, float intensity, float scale) {
|
||||||
float absFlap = abs(flapness);
|
float absFlap = abs(flapness);
|
||||||
|
|
||||||
|
@ -25,13 +18,12 @@ float getFlapAngle(float flapness, float intensity, float scale) {
|
||||||
void flw_instanceVertex(in FlwInstance flap) {
|
void flw_instanceVertex(in FlwInstance flap) {
|
||||||
float flapAngle = getFlapAngle(flap.flapness, flap.intensity, flap.flapScale);
|
float flapAngle = getFlapAngle(flap.flapness, flap.intensity, flap.flapScale);
|
||||||
|
|
||||||
vec4 orientation = quat(vec3(0., 1., 0.), -flap.horizontalAngle);
|
vec4 orientation = quaternion(vec3(0., 1., 0.), -flap.horizontalAngle);
|
||||||
vec4 flapRotation = quat(vec3(1., 0., 0.), flapAngle);
|
vec4 flapRotation = quaternion(vec3(1., 0., 0.), flapAngle);
|
||||||
|
|
||||||
vec3 rotated = rotateVertexByQuat(flw_vertexPos.xyz - flap.pivot, flapRotation) + flap.pivot + flap.segmentOffset;
|
vec3 rotated = rotateByQuaternion(flw_vertexPos.xyz - flap.pivot, flapRotation) + flap.pivot + flap.segmentOffset;
|
||||||
rotated = rotateVertexByQuat(rotated - .5, orientation) + flap.instancePos + .5;
|
|
||||||
|
|
||||||
flw_vertexPos = vec4(rotated, 1.);
|
flw_vertexPos.xyz = rotateByQuaternion(rotated - .5, orientation) + flap.instancePos + .5;
|
||||||
flw_vertexNormal = rotateVertexByQuat(rotateVertexByQuat(flw_vertexNormal, flapRotation), orientation);
|
flw_vertexNormal = rotateByQuaternion(rotateByQuaternion(flw_vertexNormal, flapRotation), orientation);
|
||||||
flw_vertexLight = flap.light;
|
flw_vertexLight = flap.light / 15.;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,20 @@
|
||||||
#define PI 3.1415926538
|
|
||||||
|
|
||||||
#include "flywheel:util/matrix.glsl"
|
#include "flywheel:util/matrix.glsl"
|
||||||
|
|
||||||
const float uTime = 0.;
|
const float uTime = 0.;
|
||||||
|
|
||||||
mat4 kineticRotation(float offset, float speed, vec3 axis) {
|
mat3 kineticRotation(float offset, float speed, vec3 axis) {
|
||||||
float degrees = offset + uTime * speed * 3./10.;
|
float degrees = offset + flw_renderTicks * speed * 3./10.;
|
||||||
float angle = fract(degrees / 360.) * PI * 2.;
|
return rotationDegrees(axis, degrees);
|
||||||
|
|
||||||
return rotate(axis, angle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void flw_instanceVertex(in FlwInstance instance) {
|
void flw_instanceVertex(in FlwInstance instance) {
|
||||||
mat4 spin = kineticRotation(instance.offset, instance.speed, instance.axis);
|
mat3 spin = kineticRotation(instance.offset, instance.speed, instance.axis);
|
||||||
|
|
||||||
vec4 worldPos = spin * vec4(flw_vertexPos.xyz - .5, 1.);
|
vec3 worldPos = spin * (flw_vertexPos.xyz - .5);
|
||||||
flw_vertexPos = vec4(worldPos.xyz + instance.pos + .5, 1.);
|
flw_vertexPos.xyz = worldPos.xyz + instance.pos + .5;
|
||||||
|
|
||||||
flw_vertexNormal = modelToNormal(spin) * flw_vertexNormal;
|
flw_vertexNormal = spin * flw_vertexNormal;
|
||||||
flw_vertexLight = instance.light;
|
flw_vertexLight = instance.light / 15.;
|
||||||
|
|
||||||
#if defined(DEBUG_RAINBOW)
|
#if defined(DEBUG_RAINBOW)
|
||||||
flw_vertexColor = instance.color;
|
flw_vertexColor = instance.color;
|
||||||
|
|
Loading…
Reference in a new issue