mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 12:37:59 +01:00
Fixed geometry leakage
This commit is contained in:
parent
2cfe7e138a
commit
958da3a4b1
4 changed files with 94 additions and 116 deletions
|
@ -644,7 +644,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
stack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(attributes.motionPitch));
|
||||
}
|
||||
|
||||
PonyTransformation.forSize(getSize()).transform(this, part);
|
||||
PonyTransformation.forSize(getSize()).transform(this, part, stack);
|
||||
}
|
||||
|
||||
interface RenderStage {
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.minelittlepony.model.BodyPart;
|
|||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
|
@ -126,14 +125,9 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
|
|||
|
||||
tail.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, attributes.interpolatorId);
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
|
||||
|
||||
leftFin.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||
centerFin.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||
rightFin.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,7 +17,6 @@ import net.minecraft.entity.EquipmentSlot;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.PI;
|
||||
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
||||
|
||||
public class LayerPonyCape<M extends ClientPonyModel<AbstractClientPlayerEntity>> extends AbstractPonyLayer<AbstractClientPlayerEntity, M> {
|
||||
|
||||
|
@ -33,7 +32,7 @@ public class LayerPonyCape<M extends ClientPonyModel<AbstractClientPlayerEntity>
|
|||
&& player.isSkinOverlayVisible(PlayerModelPart.CAPE) && player.getCapeTexture() != null
|
||||
&& player.getEquippedStack(EquipmentSlot.CHEST).getItem() != Items.ELYTRA) {
|
||||
|
||||
pushMatrix();
|
||||
stack.push();
|
||||
|
||||
model.transform(BodyPart.BODY, stack);
|
||||
stack.translate(0, 0.24F, 0);
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package com.minelittlepony.client.transform;
|
||||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.pony.meta.Size;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -14,22 +14,22 @@ public enum PonyTransformation {
|
|||
|
||||
NORMAL(Size.NORMAL, 0, 3F, 0.75F) {
|
||||
@Override
|
||||
public void transform(IModel model, BodyPart part) {
|
||||
if (model.getAttributes().isSwimming) translate(0, -0.3F, 0);
|
||||
if (model.getAttributes().isCrouching) translate(0, -0.2F, 0);
|
||||
if (model.getAttributes().isSleeping) translate(0, -0.61F, 0.1F);
|
||||
if (model.isRiding()) translate(0, -0.2F, -0.2F);
|
||||
public void transform(IModel model, BodyPart part, MatrixStack stack) {
|
||||
if (model.getAttributes().isSwimming) stack.translate(0, -0.3F, 0);
|
||||
if (model.getAttributes().isCrouching) stack.translate(0, -0.2F, 0);
|
||||
if (model.getAttributes().isSleeping) stack.translate(0, -0.61F, 0.1F);
|
||||
if (model.isRiding()) stack.translate(0, -0.2F, -0.2F);
|
||||
|
||||
switch (part) {
|
||||
case NECK:
|
||||
if (model.getAttributes().isCrouching) translate(-0.03F, 0.03F, 0.1F);
|
||||
if (model.getAttributes().isCrouching) stack.translate(-0.03F, 0.03F, 0.1F);
|
||||
break;
|
||||
case HEAD:
|
||||
if (model.getAttributes().isCrouching) translate(0, 0.1F, 0);
|
||||
if (model.getAttributes().isSwimmingRotated) translate(0, 0.37F, 0.45F);
|
||||
if (model.getAttributes().isCrouching) stack.translate(0, 0.1F, 0);
|
||||
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.37F, 0.45F);
|
||||
break;
|
||||
case BACK:
|
||||
translateVec(riderOffset);
|
||||
stack.translate(riderOffset.x, riderOffset.y, riderOffset.z);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
@ -37,103 +37,103 @@ public enum PonyTransformation {
|
|||
},
|
||||
LANKY(Size.LANKY, 0, 2.6F, 0.75F) {
|
||||
@Override
|
||||
public void transform(IModel model, BodyPart part) {
|
||||
if (model.getAttributes().isSwimming) translate(0, -0.2F, 0);
|
||||
if (model.getAttributes().isCrouching) translate(0, -0.15F, 0);
|
||||
if (model.getAttributes().isSleeping) translate(0, -0.6F, 0.15F);
|
||||
if (model.isRiding()) translate(0, 0, -0.2F);
|
||||
public void transform(IModel model, BodyPart part, MatrixStack stack) {
|
||||
if (model.getAttributes().isSwimming) stack.translate(0, -0.2F, 0);
|
||||
if (model.getAttributes().isCrouching) stack.translate(0, -0.15F, 0);
|
||||
if (model.getAttributes().isSleeping) stack.translate(0, -0.6F, 0.15F);
|
||||
if (model.isRiding()) stack.translate(0, 0, -0.2F);
|
||||
|
||||
switch (part) {
|
||||
case NECK:
|
||||
translate(0, -0.15F, -0.07F);
|
||||
if (model.getAttributes().isCrouching) translate(-0.03F, 0.16F, 0.07F);
|
||||
if (model.getAttributes().isSwimmingRotated) translate(0, 0.5F, 0.25F);
|
||||
stack.translate(0, -0.15F, -0.07F);
|
||||
if (model.getAttributes().isCrouching) stack.translate(-0.03F, 0.16F, 0.07F);
|
||||
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.5F, 0.25F);
|
||||
break;
|
||||
case HEAD:
|
||||
translate(0, -0.17F, -0.04F);
|
||||
if (model.getAttributes().isSleeping) translate(0, 0, -0.1F);
|
||||
if (model.getAttributes().isCrouching) translate(0, 0.15F, 0);
|
||||
if (model.getAttributes().isSwimmingRotated) translate(0, 0.45F, 0.45F);
|
||||
stack.translate(0, -0.17F, -0.04F);
|
||||
if (model.getAttributes().isSleeping) stack.translate(0, 0, -0.1F);
|
||||
if (model.getAttributes().isCrouching) stack.translate(0, 0.15F, 0);
|
||||
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.45F, 0.45F);
|
||||
break;
|
||||
case BODY:
|
||||
translate(0, -0.2F, -0.04F);
|
||||
scale(0.9F, 1.2F, 0.9F);
|
||||
stack.translate(0, -0.2F, -0.04F);
|
||||
stack.scale(0.9F, 1.2F, 0.9F);
|
||||
break;
|
||||
case TAIL:
|
||||
translate(0, -0.2F, 0.08F);
|
||||
stack.translate(0, -0.2F, 0.08F);
|
||||
break;
|
||||
case LEGS:
|
||||
translate(0, -0.18F, 0);
|
||||
scale(0.9F, 1.12F, 0.9F);
|
||||
stack.translate(0, -0.18F, 0);
|
||||
stack.scale(0.9F, 1.12F, 0.9F);
|
||||
break;
|
||||
case BACK:
|
||||
translateVec(riderOffset);
|
||||
stack.translate(riderOffset.x, riderOffset.y, riderOffset.z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
BULKY(Size.BULKY, 0, 2.3F, 0.75F) {
|
||||
@Override
|
||||
public void transform(IModel model, BodyPart part) {
|
||||
if (model.getAttributes().isCrouching) translate(0, -0.15F, 0);
|
||||
if (model.getAttributes().isSleeping) translate(0, -0.6F, 0.25F);
|
||||
if (model.isRiding()) translate(0, 0, -0.2F);
|
||||
public void transform(IModel model, BodyPart part, MatrixStack stack) {
|
||||
if (model.getAttributes().isCrouching) stack.translate(0, -0.15F, 0);
|
||||
if (model.getAttributes().isSleeping) stack.translate(0, -0.6F, 0.25F);
|
||||
if (model.isRiding()) stack.translate(0, 0, -0.2F);
|
||||
|
||||
switch (part) {
|
||||
case NECK:
|
||||
translate(0, -0.15F, -0.07F);
|
||||
if (model.getAttributes().isCrouching) translate(-0.03F, 0.16F, 0.07F);
|
||||
if (model.getAttributes().isSwimmingRotated) translate(0, 0.5F, 0.25F);
|
||||
stack.translate(0, -0.15F, -0.07F);
|
||||
if (model.getAttributes().isCrouching) stack.translate(-0.03F, 0.16F, 0.07F);
|
||||
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.5F, 0.25F);
|
||||
break;
|
||||
case HEAD:
|
||||
translate(0, -0.17F, -0.04F);
|
||||
if (model.getAttributes().isSleeping) translate(0, 0, -0.1F);
|
||||
if (model.getAttributes().isCrouching) translate(0, 0.15F, 0);
|
||||
if (model.getAttributes().isSwimmingRotated) translate(0, 0.15F, 0.25F);
|
||||
stack.translate(0, -0.17F, -0.04F);
|
||||
if (model.getAttributes().isSleeping) stack.translate(0, 0, -0.1F);
|
||||
if (model.getAttributes().isCrouching) stack.translate(0, 0.15F, 0);
|
||||
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.15F, 0.25F);
|
||||
break;
|
||||
case BODY:
|
||||
translate(0, -0.2F, -0.04F);
|
||||
scale(1.15F, 1.2F, 1.2F);
|
||||
stack.translate(0, -0.2F, -0.04F);
|
||||
stack.scale(1.15F, 1.2F, 1.2F);
|
||||
break;
|
||||
case TAIL:
|
||||
translate(0, -0.2F, 0.08F);
|
||||
stack.translate(0, -0.2F, 0.08F);
|
||||
break;
|
||||
case LEGS:
|
||||
translate(0, -0.18F, 0);
|
||||
scale(1.15F, 1.12F, 1.15F);
|
||||
stack.translate(0, -0.18F, 0);
|
||||
stack.scale(1.15F, 1.12F, 1.15F);
|
||||
break;
|
||||
case BACK:
|
||||
translateVec(riderOffset);
|
||||
stack.translate(riderOffset.x, riderOffset.y, riderOffset.z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
FOAL(Size.FOAL, 0, 3.8F, 0.75F) {
|
||||
@Override
|
||||
public void transform(IModel model, BodyPart part) {
|
||||
if (model.getAttributes().isSwimming) translate(0, -0.9F, 0);
|
||||
if (model.getAttributes().isCrouching) translate(0, -0.3F, 0);
|
||||
if (model.getAttributes().isSleeping) translate(0, -0.65F, -0.3F);
|
||||
if (model.isRiding()) translate(0, -0.6F, -0.2F);
|
||||
public void transform(IModel model, BodyPart part, MatrixStack stack) {
|
||||
if (model.getAttributes().isSwimming) stack.translate(0, -0.9F, 0);
|
||||
if (model.getAttributes().isCrouching) stack.translate(0, -0.3F, 0);
|
||||
if (model.getAttributes().isSleeping) stack.translate(0, -0.65F, -0.3F);
|
||||
if (model.isRiding()) stack.translate(0, -0.6F, -0.2F);
|
||||
|
||||
translate(0, 0.2F, 0);
|
||||
stack.translate(0, 0.2F, 0);
|
||||
|
||||
switch (part) {
|
||||
case NECK:
|
||||
translate(0, 0, 0.04F);
|
||||
scale(1.3F, 1.3F, 1.3F);
|
||||
if (model.getAttributes().isCrouching) translate(0, -0.01F, 0.15F);
|
||||
stack.translate(0, 0, 0.04F);
|
||||
stack.scale(1.3F, 1.3F, 1.3F);
|
||||
if (model.getAttributes().isCrouching) stack.translate(0, -0.01F, 0.15F);
|
||||
break;
|
||||
case HEAD:
|
||||
if (model.getAttributes().isSwimmingRotated) translate(0, 0.9F, 0.9F);
|
||||
scale(1.3F, 1.3F, 1.3F);
|
||||
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.9F, 0.9F);
|
||||
stack.scale(1.3F, 1.3F, 1.3F);
|
||||
break;
|
||||
case LEGS:
|
||||
translate(0, 0.09F, 0);
|
||||
scale(1, 0.81F, 1);
|
||||
stack.translate(0, 0.09F, 0);
|
||||
stack.scale(1, 0.81F, 1);
|
||||
break;
|
||||
case BACK:
|
||||
translateVec(riderOffset);
|
||||
stack.translate(riderOffset.x, riderOffset.y, riderOffset.z);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
@ -141,69 +141,69 @@ public enum PonyTransformation {
|
|||
},
|
||||
TALL(Size.TALL, 0, 2.2F, 0.75F) {
|
||||
@Override
|
||||
public void transform(IModel model, BodyPart part) {
|
||||
if (model.getAttributes().isCrouching) translate(0, -0.15F, 0);
|
||||
if (model.getAttributes().isSleeping) translate(0, -0.5F, 0.35F);
|
||||
if (model.isRiding()) translate(0, 0.1F, -0.2F);
|
||||
public void transform(IModel model, BodyPart part, MatrixStack stack) {
|
||||
if (model.getAttributes().isCrouching) stack.translate(0, -0.15F, 0);
|
||||
if (model.getAttributes().isSleeping) stack.translate(0, -0.5F, 0.35F);
|
||||
if (model.isRiding()) stack.translate(0, 0.1F, -0.2F);
|
||||
|
||||
switch (part) {
|
||||
case NECK:
|
||||
translate(0, -0.09F, 0);
|
||||
scale(1, 1.1F, 1);
|
||||
if (model.getAttributes().isCrouching) translate(-0.02F, -0.02F, 0.1F);
|
||||
stack.translate(0, -0.09F, 0);
|
||||
stack.scale(1, 1.1F, 1);
|
||||
if (model.getAttributes().isCrouching) stack.translate(-0.02F, -0.02F, 0.1F);
|
||||
break;
|
||||
case HEAD:
|
||||
translate(0.01F, -0.15F, 0);
|
||||
if (model.getAttributes().isCrouching) translate(0, 0.04F, 0);
|
||||
if (model.getAttributes().isSwimmingRotated) translate(0, 0.17F, 0.25F);
|
||||
stack.translate(0.01F, -0.15F, 0);
|
||||
if (model.getAttributes().isCrouching) stack.translate(0, 0.04F, 0);
|
||||
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.17F, 0.25F);
|
||||
break;
|
||||
case BODY:
|
||||
case TAIL:
|
||||
translate(0, -0.1F, 0);
|
||||
stack.translate(0, -0.1F, 0);
|
||||
break;
|
||||
case LEGS:
|
||||
translate(0, -0.27F, 0.03F);
|
||||
scale(1, 1.18F, 1);
|
||||
if (model.getAttributes().isGoingFast) translate(0, 0.05F, 0);
|
||||
stack.translate(0, -0.27F, 0.03F);
|
||||
stack.scale(1, 1.18F, 1);
|
||||
if (model.getAttributes().isGoingFast) stack.translate(0, 0.05F, 0);
|
||||
break;
|
||||
case BACK:
|
||||
riderOffset = new Vec3d(0, 2.2F, 0.75F);
|
||||
translateVec(riderOffset);
|
||||
stack.translate(riderOffset.x, riderOffset.y, riderOffset.z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
YEARLING(Size.YEARLING, 0, 3.8F, 0.75F) {
|
||||
@Override
|
||||
public void transform(IModel model, BodyPart part) {
|
||||
if (model.getAttributes().isSwimming) translate(0, -0.6F, 0);
|
||||
if (model.getAttributes().isCrouching) translate(0, -0.15F, 0);
|
||||
if (model.getAttributes().isSleeping) translate(0, -0.4F, -0.3F);
|
||||
if (model.isRiding()) translate(0, -0.4F, -0.2F);
|
||||
public void transform(IModel model, BodyPart part, MatrixStack stack) {
|
||||
if (model.getAttributes().isSwimming) stack.translate(0, -0.6F, 0);
|
||||
if (model.getAttributes().isCrouching) stack.translate(0, -0.15F, 0);
|
||||
if (model.getAttributes().isSleeping) stack.translate(0, -0.4F, -0.3F);
|
||||
if (model.isRiding()) stack.translate(0, -0.4F, -0.2F);
|
||||
|
||||
switch (part) {
|
||||
case NECK:
|
||||
translate(0, -0.09F, -0.01F);
|
||||
scale(1, 1.1F, 1);
|
||||
if (model.getAttributes().isCrouching) translate(-0.02F, -0.02F, 0.1F);
|
||||
stack.translate(0, -0.09F, -0.01F);
|
||||
stack.scale(1, 1.1F, 1);
|
||||
if (model.getAttributes().isCrouching) stack.translate(-0.02F, -0.02F, 0.1F);
|
||||
break;
|
||||
case HEAD:
|
||||
translate(0, -0.15F, 0.01F);
|
||||
if (model.getAttributes().isCrouching) translate(0, 0.04F, 0);
|
||||
if (model.getAttributes().isSwimmingRotated) translate(0, 0.8F, 0.85F);
|
||||
scale(1.15F, 1.15F, 1.15F);
|
||||
stack.translate(0, -0.15F, 0.01F);
|
||||
if (model.getAttributes().isCrouching) stack.translate(0, 0.04F, 0);
|
||||
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.8F, 0.85F);
|
||||
stack.scale(1.15F, 1.15F, 1.15F);
|
||||
break;
|
||||
case BODY:
|
||||
case TAIL:
|
||||
translate(0, -0.1F, 0);
|
||||
stack.translate(0, -0.1F, 0);
|
||||
break;
|
||||
case LEGS:
|
||||
translate(0, -0.265F, 0.03F);
|
||||
scale(1, 1.18F, 1);
|
||||
if (model.getAttributes().isGoingFast) translate(0, 0.05F, 0);
|
||||
stack.translate(0, -0.265F, 0.03F);
|
||||
stack.scale(1, 1.18F, 1);
|
||||
if (model.getAttributes().isGoingFast) stack.translate(0, 0.05F, 0);
|
||||
break;
|
||||
case BACK:
|
||||
translateVec(riderOffset);
|
||||
stack.translate(riderOffset.x, riderOffset.y, riderOffset.z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -226,26 +226,11 @@ public enum PonyTransformation {
|
|||
riderOffset = new Vec3d(rX, rY, rZ);
|
||||
}
|
||||
|
||||
public static void translateVec(Vec3d offset) {
|
||||
RenderSystem.translated(offset.x, offset.y, offset.z);
|
||||
}
|
||||
|
||||
protected void scale(float x, float y, float z) {
|
||||
RenderSystem.scalef(x, y, z);
|
||||
}
|
||||
|
||||
protected void translate(float x, float y, float z) {
|
||||
RenderSystem.translatef(x, y, z);
|
||||
}
|
||||
|
||||
public Vec3d getRiderOffset() {
|
||||
return riderOffset;
|
||||
}
|
||||
|
||||
public abstract void transform(IModel model, BodyPart part);
|
||||
|
||||
|
||||
|
||||
public abstract void transform(IModel model, BodyPart part, MatrixStack stack);
|
||||
|
||||
public static PonyTransformation forSize(Size size) {
|
||||
return sizeToTransform.getOrDefault(size, NORMAL);
|
||||
|
|
Loading…
Reference in a new issue