mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Fix texture alignment issues with wings and make pegasus available during render
This commit is contained in:
parent
803e79343d
commit
8be2f2fa39
4 changed files with 55 additions and 43 deletions
|
@ -3,21 +3,33 @@ package com.minelittlepony.model.components;
|
|||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
||||
import com.minelittlepony.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.capabilities.IModelPegasus;
|
||||
import com.minelittlepony.render.PonyRenderer;
|
||||
|
||||
public class ModelWing {
|
||||
private PonyRenderer extended;
|
||||
private PonyRenderer folded;
|
||||
|
||||
public ModelWing(AbstractPonyModel pony, boolean mirror, float x, float y, float scale, int texY) {
|
||||
folded = new PonyRenderer(pony, 56, texY);
|
||||
extended = new PonyRenderer(pony, 56, texY + 3);
|
||||
private final IModelPegasus pegasus;
|
||||
|
||||
addClosedWing(x, y, scale);
|
||||
addFeathers(mirror, y, scale);
|
||||
private final PonyRenderer extended;
|
||||
private final PonyRenderer folded;
|
||||
|
||||
public <T extends AbstractPonyModel & IModelPegasus> ModelWing(T pegasus, boolean right, float y, float scale, int texX, int texY) {
|
||||
this.pegasus = pegasus;
|
||||
|
||||
if (right) {
|
||||
texX ++;
|
||||
}
|
||||
|
||||
folded = new PonyRenderer(pegasus, 56, texY);
|
||||
extended = new PonyRenderer(pegasus, texX, texY + 3);
|
||||
|
||||
addClosedWing(right, y, scale);
|
||||
addFeathers(right, y, scale);
|
||||
}
|
||||
|
||||
private void addClosedWing(float x, float y, float scale) {
|
||||
private void addClosedWing(boolean right, float y, float scale) {
|
||||
float x = right ? -6 : 4;
|
||||
|
||||
folded.around(HEAD_RP_X, WING_FOLDED_RP_Y + y, WING_FOLDED_RP_Z)
|
||||
.box(x, 5, 2, 2, 6, 2, scale)
|
||||
.box(x, 5, 4, 2, 8, 2, scale)
|
||||
|
@ -25,37 +37,36 @@ public class ModelWing {
|
|||
.rotateAngleX = ROTATE_90;
|
||||
}
|
||||
|
||||
private void addFeathers(boolean mirror, float y, float scale) {
|
||||
float r = mirror ? -1 : 1;
|
||||
extended.around(r * LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + y, LEFT_WING_EXT_RP_Z);
|
||||
addFeather(0, r, 6, 0, 8, scale + 0.1F);
|
||||
addFeather(1, r, -1.2F, -0.2F, 8, scale + 0.2F) .rotateAngleX = -0.85F;
|
||||
addFeather(2, r, 1.8F, 1.3F, 8, scale - 0.1F) .rotateAngleX = -0.75F;
|
||||
addFeather(3, r, 5, 2, 8, scale) .rotateAngleX = -0.5F;
|
||||
addFeather(4, r, 0, -0.2F, 6, scale + 0.3F);
|
||||
addFeather(5, r, 0, 0.2F, 3, scale + 0.19F).rotateAngleX = -0.85F;
|
||||
private void addFeathers(boolean right, float rotationPointY, float scale) {
|
||||
float r = right ? -1 : 1;
|
||||
|
||||
extended.around(r * LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + rotationPointY, LEFT_WING_EXT_RP_Z);
|
||||
addFeather(0, 6, 0, 8, scale + 0.1F);
|
||||
addFeather(1, -1.2F, -0.2F, 8, scale + 0.2F) .rotateAngleX = -0.85F;
|
||||
addFeather(2, 1.8F, 1.3F, 8, scale + 0.1F) .rotateAngleX = -0.75F;
|
||||
addFeather(3, 5, 2, 8, scale) .rotateAngleX = -0.5F;
|
||||
addFeather(4, 0, -0.2F, 6, scale + 0.3F);
|
||||
addFeather(5, 0, 0.2F, 3, scale + 0.19F).rotateAngleX = -0.85F;
|
||||
}
|
||||
|
||||
private PonyRenderer addFeather(int i, float r, float y, float z, int h, float scale) {
|
||||
return extended.child(i).around(0, 0, 0).box(-0.5f, y, z, 1, h, 2, scale);
|
||||
private PonyRenderer addFeather(int i, float y, float z, int h, float scale) {
|
||||
return extended.child(i).around(0, 0, 0).box(0, y, z, 1, h, 2, scale);
|
||||
}
|
||||
|
||||
public void rotateWalking(float swing) {
|
||||
folded.rotateAngleY = swing * 0.2F;
|
||||
}
|
||||
|
||||
public void rotateFlying(float angle) {
|
||||
extended.rotateAngleZ = angle;
|
||||
}
|
||||
|
||||
public void render(boolean extend, float scale) {
|
||||
public void render(float scale) {
|
||||
extended.rotateAngleY = 3;
|
||||
if (extend) {
|
||||
if (pegasus.wingsAreOpen()) {
|
||||
extended.render(scale);
|
||||
} else {
|
||||
folded.render(scale);
|
||||
}
|
||||
}
|
||||
|
||||
public void rotateFlying(float angle) {
|
||||
extended.rotateAngleZ = angle;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,27 +9,29 @@ import com.minelittlepony.model.capabilities.IModelPart;
|
|||
import com.minelittlepony.model.capabilities.IModelPegasus;
|
||||
import com.minelittlepony.pony.data.PonyWearable;
|
||||
|
||||
public class PegasusWings implements IModelPart {
|
||||
public class PegasusWings<T extends AbstractPonyModel & IModelPegasus> implements IModelPart {
|
||||
|
||||
private final IModelPegasus pegasus;
|
||||
private final T pegasus;
|
||||
|
||||
private final ModelWing leftWing;
|
||||
private final ModelWing rightWing;
|
||||
private ModelWing leftWing;
|
||||
private ModelWing rightWing;
|
||||
|
||||
private final ModelWing legacyWing;
|
||||
private ModelWing legacyWing;
|
||||
|
||||
public <T extends AbstractPonyModel & IModelPegasus> PegasusWings(T model, float yOffset, float stretch) {
|
||||
public PegasusWings(T model, float yOffset, float stretch) {
|
||||
pegasus = model;
|
||||
|
||||
leftWing = new ModelWing(model, false, 4, yOffset, stretch, 32);
|
||||
rightWing = new ModelWing(model, true, -6, yOffset, stretch, 16);
|
||||
legacyWing = new ModelWing(model, true, -6, yOffset, stretch, 32);
|
||||
init(yOffset, stretch);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
int x = 57;
|
||||
|
||||
leftWing = new ModelWing(pegasus, false, yOffset, stretch, x, 32);
|
||||
rightWing = new ModelWing(pegasus, true, yOffset, stretch, x, 16);
|
||||
|
||||
legacyWing = new ModelWing(pegasus, true, yOffset, stretch, x - 1, 32);
|
||||
}
|
||||
|
||||
public ModelWing getLeft() {
|
||||
|
@ -72,8 +74,7 @@ public class PegasusWings implements IModelPart {
|
|||
|
||||
@Override
|
||||
public void renderPart(float scale) {
|
||||
boolean standing = pegasus.wingsAreOpen();
|
||||
getLeft().render(standing, scale);
|
||||
getRight().render(standing, scale);
|
||||
getLeft().render(scale);
|
||||
getRight().render(scale);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.minelittlepony.model.capabilities.IModelPegasus;
|
|||
|
||||
public class ModelAlicorn extends ModelUnicorn implements IModelPegasus {
|
||||
|
||||
public PegasusWings wings;
|
||||
public PegasusWings<ModelAlicorn> wings;
|
||||
|
||||
public ModelAlicorn(boolean smallArms) {
|
||||
super(smallArms);
|
||||
|
@ -16,7 +16,7 @@ public class ModelAlicorn extends ModelUnicorn implements IModelPegasus {
|
|||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
super.init(yOffset, stretch);
|
||||
wings = new PegasusWings(this, yOffset, stretch);
|
||||
wings = new PegasusWings<>(this, yOffset, stretch);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.minelittlepony.model.capabilities.IModelPegasus;
|
|||
|
||||
public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
|
||||
|
||||
public PegasusWings wings;
|
||||
public PegasusWings<ModelPegasus> wings;
|
||||
|
||||
public ModelPegasus(boolean smallArms) {
|
||||
super(smallArms);
|
||||
|
@ -16,7 +16,7 @@ public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
|
|||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
super.init(yOffset, stretch);
|
||||
wings = new PegasusWings(this, yOffset, stretch);
|
||||
wings = new PegasusWings<>(this, yOffset, stretch);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue