Fix transformations
This commit is contained in:
parent
96204976b8
commit
d050f6d976
3 changed files with 11 additions and 20 deletions
|
@ -1,6 +1,7 @@
|
|||
package org.dimdev.dimdoors.client;
|
||||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
public enum DefaultTransformation implements Transformer {
|
||||
|
@ -13,19 +14,18 @@ public enum DefaultTransformation implements Transformer {
|
|||
@Override
|
||||
public void transform(MatrixStack matrices) {
|
||||
// TODO
|
||||
matrices.translate(0, 0, 0.5F);
|
||||
}
|
||||
},
|
||||
NORTH_DOOR {
|
||||
@Override
|
||||
public void transform(MatrixStack matrices) {
|
||||
// TODO
|
||||
matrices.translate(0, 0, 0.81F);
|
||||
}
|
||||
},
|
||||
SOUTH_DOOR {
|
||||
@Override
|
||||
public void transform(MatrixStack matrices) {
|
||||
// TODO
|
||||
matrices.translate(0, 0, 0.19F);
|
||||
}
|
||||
},
|
||||
|
@ -33,16 +33,16 @@ public enum DefaultTransformation implements Transformer {
|
|||
@Override
|
||||
public void transform(MatrixStack matrices) {
|
||||
// TODO
|
||||
// matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(90.0F));
|
||||
matrices.translate(-0.2F, 0, 0);
|
||||
matrices.multiply(Vector3f.NEGATIVE_Y.getDegreesQuaternion(90.0F));
|
||||
matrices.translate(0, 0, -0.81F);
|
||||
}
|
||||
},
|
||||
EAST_DOOR {
|
||||
@Override
|
||||
public void transform(MatrixStack matrices) {
|
||||
// TODO
|
||||
// matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(90.0F));
|
||||
matrices.translate(0.8F, 0, 0);
|
||||
matrices.multiply(Vector3f.NEGATIVE_Y.getDegreesQuaternion(90.0F));
|
||||
matrices.translate(0, 0, -0.19F);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -51,9 +51,4 @@ public enum DefaultTransformation implements Transformer {
|
|||
public static DefaultTransformation fromDirection(Direction direction) {
|
||||
return VALUES[direction.ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupTallTransform(MatrixStack matrices) {
|
||||
matrices.translate(0, 1, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import net.fabricmc.api.Environment;
|
|||
public final class DimensionalPortalRenderer {
|
||||
private static final Random RANDOM = new Random(31100L);
|
||||
private static final ModelPart MODEL;
|
||||
private static final ModelPart TALL_MODEL;
|
||||
private static final EntityRenderDispatcher ENTITY_RENDER_DISPATCHER;
|
||||
private static final List<RenderLayer> RENDER_LAYERS = ImmutableList.copyOf(IntStream.range(0, 16).mapToObj(MyRenderLayer::getPortal).collect(Collectors.toList()));
|
||||
|
||||
|
@ -49,13 +50,8 @@ public final class DimensionalPortalRenderer {
|
|||
float g = MathHelper.clamp((RANDOM.nextFloat() * 0.4F + 0.1F) * v, 0, 1);
|
||||
float b = MathHelper.clamp((RANDOM.nextFloat() * 0.5F + 0.6F) * v, 0, 1);
|
||||
|
||||
MODEL.render(matrices, vertexConsumer, light, overlay, r, g, b, 1);
|
||||
if (tall) {
|
||||
matrices.push();
|
||||
transformer.setupTallTransform(matrices);
|
||||
MODEL.render(matrices, vertexConsumer, light, overlay, r, g, b, 1);
|
||||
matrices.pop();
|
||||
}
|
||||
ModelPart model = tall ? TALL_MODEL : MODEL;
|
||||
model.render(matrices, vertexConsumer, light, overlay, r, g, b, 1);
|
||||
}
|
||||
|
||||
private static int getOffset(double d) {
|
||||
|
@ -80,7 +76,9 @@ public final class DimensionalPortalRenderer {
|
|||
|
||||
static {
|
||||
MODEL = new ModelPart(1024, 1024, 0, 0);
|
||||
TALL_MODEL = new ModelPart(1024, 1024, 0, 0);
|
||||
MODEL.addCuboid(0, 0, 0, 16, 16, 0);
|
||||
TALL_MODEL.addCuboid(0, 0, 0, 16, 32, 0);
|
||||
ENTITY_RENDER_DISPATCHER = MinecraftClient.getInstance().getEntityRenderDispatcher();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,4 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
|
||||
public interface Transformer {
|
||||
void transform(MatrixStack matrices);
|
||||
|
||||
void setupTallTransform(MatrixStack matrices);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue