use of com.jozufozu.flywheel.util.transform.MatrixTransformStack in project Create_Aeronautics by Eriksonnaren.
the class StationaryPotatoCannonRenderer method renderItem.
public void renderItem(StationaryPotatoCannonTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
MatrixTransformStack msr = MatrixTransformStack.of(ms);
ms.pushPose();
msr.centre();
Vector3i facingVec = facing.getNormal();
float itemScale = .3f;
float normalizedTimer = (te.ItemTimer + partialTicks);
float itemPosition = 1 - (float) Math.exp(-0.25f * normalizedTimer);
itemPosition *= 0.7f;
ms.translate(facingVec.getX() * itemPosition, facingVec.getY() * itemPosition, facingVec.getZ() * itemPosition);
ms.scale(itemScale, itemScale, itemScale);
Quaternion Q = new Quaternion((float) Math.sin(te.ItemRotationId * 0.4f), (float) Math.cos(te.ItemRotationId * 1.4f), (float) Math.sin(te.ItemRotationId * 3.0f), (float) Math.cos(te.ItemRotationId * 5.0f));
Q.normalize();
msr.multiply(Q);
// msr.rotateX(itemPosition * 180);
// msr.rotateY(itemPosition * 180);
itemRenderer.renderStatic(te.currentStack, ItemCameraTransforms.TransformType.FIXED, light, overlay, ms, buffer);
ms.popPose();
}
use of com.jozufozu.flywheel.util.transform.MatrixTransformStack in project FrostedHeart by TeamMoegMC.
the class DeployerActorInstanceMixin method beginFrame.
/**
* @author khjxiaogu
* @reason change speed of deployer animation
*/
@Overwrite(remap = false)
public void beginFrame() {
double factor;
if (context.contraption.stalled || context.position == null || context.data.contains("StationaryTimer")) {
Contraption cont = context.contraption;
// TODO: change to ModifyConstant
if (cont instanceof ISpeedContraption) {
factor = MathHelper.sin(AnimationTickHolder.getRenderTime() * .5f) * .05f + .45f;
} else
factor = MathHelper.sin(AnimationTickHolder.getRenderTime() * .5f) * .25f + .25f;
} else {
Vector3d center = VecHelper.getCenterOf(new BlockPos(context.position));
double distance = context.position.distanceTo(center);
double nextDistance = context.position.add(context.motion).distanceTo(center);
factor = .5f - MathHelper.clamp(MathHelper.lerp(AnimationTickHolder.getPartialTicks(), distance, nextDistance), 0, 1);
}
Vector3d offset = Vector3d.copy(facing.getDirectionVec()).scale(factor);
MatrixStack ms = new MatrixStack();
MatrixTransformStack msr = MatrixTransformStack.of(ms);
msr.translate(context.localPos).translate(offset);
transformModel(msr, pole, hand, yRot, zRot, zRotPole);
}
use of com.jozufozu.flywheel.util.transform.MatrixTransformStack in project SteamPowered by TeamMoegMC.
the class CastIronFlywheelInstance method animate.
private void animate(float angle) {
MatrixStack ms = new MatrixStack();
MatrixTransformStack msr = MatrixTransformStack.of(ms);
msr.translate(getInstancePosition());
if (connection != null) {
float rotation = angle * connectorAngleMult;
ms.pushPose();
rotateToFacing(msr, connection);
ms.pushPose();
transformConnector(msr, true, true, rotation, connectedLeft);
upperRotating.setTransform(ms);
ms.popPose();
ms.pushPose();
transformConnector(msr, false, true, rotation, connectedLeft);
lowerRotating.setTransform(ms);
ms.popPose();
ms.pushPose();
transformConnector(msr, true, false, rotation, connectedLeft);
upperSliding.setTransform(ms);
ms.popPose();
ms.pushPose();
transformConnector(msr, false, false, rotation, connectedLeft);
lowerSliding.setTransform(ms);
ms.popPose();
ms.popPose();
}
msr.centre().rotate(Direction.get(Direction.AxisDirection.POSITIVE, facing.getAxis()), AngleHelper.rad(angle)).unCentre();
wheel.setTransform(ms);
}
use of com.jozufozu.flywheel.util.transform.MatrixTransformStack in project SteamPowered by TeamMoegMC.
the class SteelFlywheelInstance method animate.
private void animate(float angle) {
MatrixStack ms = new MatrixStack();
MatrixTransformStack msr = MatrixTransformStack.of(ms);
msr.translate(getInstancePosition());
if (connection != null) {
float rotation = angle * connectorAngleMult;
ms.pushPose();
rotateToFacing(msr, connection);
ms.pushPose();
transformConnector(msr, true, true, rotation, connectedLeft);
upperRotating.setTransform(ms);
ms.popPose();
ms.pushPose();
transformConnector(msr, false, true, rotation, connectedLeft);
lowerRotating.setTransform(ms);
ms.popPose();
ms.pushPose();
transformConnector(msr, true, false, rotation, connectedLeft);
upperSliding.setTransform(ms);
ms.popPose();
ms.pushPose();
transformConnector(msr, false, false, rotation, connectedLeft);
lowerSliding.setTransform(ms);
ms.popPose();
ms.popPose();
}
msr.centre().rotate(Direction.get(Direction.AxisDirection.POSITIVE, facing.getAxis()), AngleHelper.rad(angle)).unCentre();
wheel.setTransform(ms);
}
use of com.jozufozu.flywheel.util.transform.MatrixTransformStack in project SteamPowered by TeamMoegMC.
the class BronzeFlywheelInstance method animate.
private void animate(float angle) {
MatrixStack ms = new MatrixStack();
MatrixTransformStack msr = MatrixTransformStack.of(ms);
msr.translate(getInstancePosition());
if (connection != null) {
float rotation = angle * connectorAngleMult;
ms.pushPose();
rotateToFacing(msr, connection);
ms.pushPose();
transformConnector(msr, true, true, rotation, connectedLeft);
upperRotating.setTransform(ms);
ms.popPose();
ms.pushPose();
transformConnector(msr, false, true, rotation, connectedLeft);
lowerRotating.setTransform(ms);
ms.popPose();
ms.pushPose();
transformConnector(msr, true, false, rotation, connectedLeft);
upperSliding.setTransform(ms);
ms.popPose();
ms.pushPose();
transformConnector(msr, false, false, rotation, connectedLeft);
lowerSliding.setTransform(ms);
ms.popPose();
ms.popPose();
}
msr.centre().rotate(Direction.get(Direction.AxisDirection.POSITIVE, facing.getAxis()), AngleHelper.rad(angle)).unCentre();
wheel.setTransform(ms);
}
Aggregations