Fix some rendering and rotations

This commit is contained in:
Matthew Messinger 2016-02-29 23:42:22 -05:00
parent daa00a044b
commit 4f448be9b6
12 changed files with 77 additions and 91 deletions

View file

@ -72,11 +72,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
setModelVisibilities((AbstractClientPlayer) player); setModelVisibilities((AbstractClientPlayer) player);
} }
if (!doCancelRender()) { if (!doCancelRender()) {
AniParams ani = new AniParams(Move, Moveswing, Loop, Right, Down); this.setRotationAngles(Move, Moveswing, Loop, Right, Down, Scale, player);
this.animate(ani);
for (IPonyPart part : modelParts) {
part.animate(metadata, ani);
}
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
this.render(); this.render();
GlStateManager.popMatrix(); GlStateManager.popMatrix();
@ -103,14 +99,20 @@ public abstract class AbstractPonyModel extends ModelPlayer {
} }
@Override @Override
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) { public void setRotationAngles(float Move, float Moveswing, float Loop, float Right, float Down, float Scale, Entity entityIn) {
if (doCancelRender()) {
super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); super.setRotationAngles(Move, Moveswing, Loop, Right, Down, Scale, entityIn);
return;
this.steveRightArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float) Math.PI) * 2.0F * p_78087_2_ * 0.5F; }
AniParams ani = new AniParams(Move, Moveswing, Loop, Right, Down);
this.animate(ani);
for (IPonyPart part : modelParts) {
part.animate(metadata, ani);
}
this.steveRightArm.rotateAngleX = MathHelper.cos(Move * 0.6662F + (float) Math.PI) * 2.0F * Moveswing * 0.5F;
this.steveRightArm.rotateAngleY = 0; this.steveRightArm.rotateAngleY = 0;
this.steveRightArm.rotateAngleZ = 0; this.steveRightArm.rotateAngleZ = 0;
this.steveLeftArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 2.0F * p_78087_2_ * 0.5F; this.steveLeftArm.rotateAngleX = MathHelper.cos(Move * 0.6662F) * 2.0F * Moveswing * 0.5F;
this.steveLeftArm.rotateAngleY = 0; this.steveLeftArm.rotateAngleY = 0;
this.steveLeftArm.rotateAngleZ = 0; this.steveLeftArm.rotateAngleZ = 0;
@ -160,25 +162,25 @@ public abstract class AbstractPonyModel extends ModelPlayer {
return false; return false;
} }
public void setRotationPoint(ModelRenderer aRenderer, float setX, float setY, float setZ) { public static void setRotationPoint(ModelRenderer aRenderer, float setX, float setY, float setZ) {
aRenderer.rotationPointX = setX; aRenderer.rotationPointX = setX;
aRenderer.rotationPointY = setY; aRenderer.rotationPointY = setY;
aRenderer.rotationPointZ = setZ; aRenderer.rotationPointZ = setZ;
} }
public void setRotationPoint(PlaneRenderer aPlaneRenderer, float setX, float setY, float setZ) { public static void setRotationPoint(PlaneRenderer aPlaneRenderer, float setX, float setY, float setZ) {
aPlaneRenderer.rotationPointX = setX; aPlaneRenderer.rotationPointX = setX;
aPlaneRenderer.rotationPointY = setY; aPlaneRenderer.rotationPointY = setY;
aPlaneRenderer.rotationPointZ = setZ; aPlaneRenderer.rotationPointZ = setZ;
} }
public void shiftRotationPoint(PlaneRenderer aPlaneRenderer, float shiftX, float shiftY, float shiftZ) { public static void shiftRotationPoint(PlaneRenderer aPlaneRenderer, float shiftX, float shiftY, float shiftZ) {
aPlaneRenderer.rotationPointX += shiftX; aPlaneRenderer.rotationPointX += shiftX;
aPlaneRenderer.rotationPointY += shiftY; aPlaneRenderer.rotationPointY += shiftY;
aPlaneRenderer.rotationPointZ += shiftZ; aPlaneRenderer.rotationPointZ += shiftZ;
} }
public void shiftRotationPoint(ModelRenderer aRenderer, float shiftX, float shiftY, float shiftZ) { public static void shiftRotationPoint(ModelRenderer aRenderer, float shiftX, float shiftY, float shiftZ) {
aRenderer.rotationPointX += shiftX; aRenderer.rotationPointX += shiftX;
aRenderer.rotationPointY += shiftY; aRenderer.rotationPointY += shiftY;
aRenderer.rotationPointZ += shiftZ; aRenderer.rotationPointZ += shiftZ;

View file

@ -43,7 +43,7 @@ public abstract class AbstractHeadPart implements IPonyPart {
x = vert / (float) (180 / Math.PI); x = vert / (float) (180 / Math.PI);
} }
x = Math.min(x, 0.5F); x = Math.min(x, 0.5F);
x = Math.max(x, -0.5F); x = Math.max(x, -1.25F);
rotate(x, y); rotate(x, y);
} }

View file

@ -26,8 +26,8 @@ public class PonyEars extends AbstractHeadPart implements PonyModelConstants {
@Override @Override
protected void position(float posX, float posY, float posZ) { protected void position(float posX, float posY, float posZ) {
getPony().setRotationPoint(left, posX, posY, posZ); AbstractPonyModel.setRotationPoint(left, posX, posY, posZ);
getPony().setRotationPoint(right, posX, posY, posZ); AbstractPonyModel.setRotationPoint(right, posX, posY, posZ);
} }
@Override @Override

View file

@ -88,7 +88,7 @@ public class PonySnout extends AbstractHeadPart implements PonyModelConstants {
protected void position(float posX, float posY, float posZ) { protected void position(float posX, float posY, float posZ) {
for (PlaneRenderer[] pr : MUZZLES.values()) { for (PlaneRenderer[] pr : MUZZLES.values()) {
for (PlaneRenderer p : pr) { for (PlaneRenderer p : pr) {
getPony().setRotationPoint(p, posX, posY, posZ); AbstractPonyModel.setRotationPoint(p, posX, posY, posZ);
} }
} }
} }

View file

@ -65,9 +65,9 @@ public class UnicornHorn extends AbstractHeadPart implements PonyModelConstants
} }
protected void position(float posX, float posY, float posZ) { protected void position(float posX, float posY, float posZ) {
getPony().setRotationPoint(this.horn, posX, posY, posZ); AbstractPonyModel.setRotationPoint(this.horn, posX, posY, posZ);
for (int i = 0; i < this.hornglow.length; i++) { for (int i = 0; i < this.hornglow.length; i++) {
getPony().setRotationPoint(this.hornglow[i], posX, posY, posZ); AbstractPonyModel.setRotationPoint(this.hornglow[i], posX, posY, posZ);
} }
} }

View file

@ -102,7 +102,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedRightLeg.rotateAngleY = .2f; this.bipedRightLeg.rotateAngleY = .2f;
for (int i = 0; i < Tail.length; ++i) { for (int i = 0; i < Tail.length; ++i) {
this.setRotationPoint(this.Tail[i], TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_NOTSNEAK); setRotationPoint(this.Tail[i], TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_NOTSNEAK);
this.Tail[i].rotationPointZ = 15; this.Tail[i].rotationPointZ = 15;
this.Tail[i].rotationPointY = 14; this.Tail[i].rotationPointY = 14;
} }
@ -116,7 +116,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.setHead(0.0F, 0.0F, 0.0F); this.setHead(0.0F, 0.0F, 0.0F);
for (k1 = 0; k1 < tailstop; ++k1) { for (k1 = 0; k1 < tailstop; ++k1) {
this.setRotationPoint(this.Tail[k1], TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_NOTSNEAK); setRotationPoint(this.Tail[k1], TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_NOTSNEAK);
if (this.rainboom) { if (this.rainboom) {
this.Tail[k1].rotateAngleX = ROTATE_90 + 0.1F * MathHelper.sin(aniparams.move); this.Tail[k1].rotateAngleX = ROTATE_90 + 0.1F * MathHelper.sin(aniparams.move);
} else { } else {
@ -165,8 +165,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
} }
protected void setHead(float posX, float posY, float posZ) { protected void setHead(float posX, float posY, float posZ) {
this.setRotationPoint(this.bipedHead, posX, posY, posZ); setRotationPoint(this.bipedHead, posX, posY, posZ);
this.setRotationPoint(this.bipedHeadwear, posX, posY, posZ); setRotationPoint(this.bipedHeadwear, posX, posY, posZ);
} }
protected void rotateHead(float horz, float vert) { protected void rotateHead(float horz, float vert) {
@ -180,14 +180,10 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
headRotateAngleX = vert / 57.29578F; headRotateAngleX = vert / 57.29578F;
} }
if (headRotateAngleX > 0.5F) { final float max = 0.5f;
headRotateAngleX = 0.5F; final float min = -1.25f;
} headRotateAngleX = Math.min(headRotateAngleX, max);
headRotateAngleX = Math.max(headRotateAngleX, min);
if (headRotateAngleX < -0.5F) {
headRotateAngleX = -0.5F;
}
this.bipedHead.rotateAngleY = headRotateAngleY; this.bipedHead.rotateAngleY = headRotateAngleY;
this.bipedHead.rotateAngleX = headRotateAngleX; this.bipedHead.rotateAngleX = headRotateAngleX;
this.bipedHeadwear.rotateAngleY = headRotateAngleY; this.bipedHeadwear.rotateAngleY = headRotateAngleY;
@ -417,7 +413,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
} }
for (int i7 = 0; i7 < tailstop; ++i7) { for (int i7 = 0; i7 < tailstop; ++i7) {
this.setRotationPoint(this.Tail[i7], TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_SNEAK); setRotationPoint(this.Tail[i7], TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_SNEAK);
this.Tail[i7].rotateAngleX = 0.0F; this.Tail[i7].rotateAngleX = 0.0F;
} }
@ -442,10 +438,10 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
} }
this.setHead(headPosX, headPosY, headPosZ); this.setHead(headPosX, headPosY, headPosZ);
this.shiftRotationPoint(this.bipedRightArm, 0.0F, 2.0F, 6.0F); shiftRotationPoint(this.bipedRightArm, 0.0F, 2.0F, 6.0F);
this.shiftRotationPoint(this.bipedLeftArm, 0.0F, 2.0F, 6.0F); shiftRotationPoint(this.bipedLeftArm, 0.0F, 2.0F, 6.0F);
this.shiftRotationPoint(this.bipedRightLeg, 0.0F, 2.0F, -8.0F); shiftRotationPoint(this.bipedRightLeg, 0.0F, 2.0F, -8.0F);
this.shiftRotationPoint(this.bipedLeftLeg, 0.0F, 2.0F, -8.0F); shiftRotationPoint(this.bipedLeftLeg, 0.0F, 2.0F, -8.0F);
} }
protected void aimBow(float tick) { protected void aimBow(float tick) {
@ -463,14 +459,14 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedRightArm.rotateAngleX = ROTATE_270 + this.bipedHead.rotateAngleX; this.bipedRightArm.rotateAngleX = ROTATE_270 + this.bipedHead.rotateAngleX;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F; this.bipedRightArm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F; this.bipedRightArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F;
this.shiftRotationPoint(this.bipedRightArm, 0.0F, 0.0F, 1.0F); shiftRotationPoint(this.bipedRightArm, 0.0F, 0.0F, 1.0F);
this.bipedRightArmwear.rotateAngleZ = 0.0F; this.bipedRightArmwear.rotateAngleZ = 0.0F;
this.bipedRightArmwear.rotateAngleY = -0.06F + this.bipedHead.rotateAngleY; this.bipedRightArmwear.rotateAngleY = -0.06F + this.bipedHead.rotateAngleY;
this.bipedRightArmwear.rotateAngleX = ROTATE_270 + this.bipedHead.rotateAngleX; this.bipedRightArmwear.rotateAngleX = ROTATE_270 + this.bipedHead.rotateAngleX;
this.bipedRightArmwear.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F; this.bipedRightArmwear.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.bipedRightArmwear.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F; this.bipedRightArmwear.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F;
this.shiftRotationPoint(this.bipedRightArmwear, 0.0F, 0.0F, 1.0F); shiftRotationPoint(this.bipedRightArmwear, 0.0F, 0.0F, 1.0F);
} }
protected void aimBowUnicorn(float tick) { protected void aimBowUnicorn(float tick) {

View file

@ -99,7 +99,7 @@ public class ModelSkeletonPony extends ModelPlayerPony {
@Override @Override
protected void fixSpecialRotationPoints(float move) { protected void fixSpecialRotationPoints(float move) {
if (this.heldItemRight != 0 && this.metadata.getGlowColor() == 0) { if (this.heldItemRight != 0 && this.metadata.getGlowColor() == 0) {
this.setRotationPoint(this.bipedRightArm, -1.5F, 9.5F, 4.0F); setRotationPoint(this.bipedRightArm, -1.5F, 9.5F, 4.0F);
} }
} }

View file

@ -95,9 +95,9 @@ public class ModelZombiePony extends ModelPlayerPony {
protected void fixSpecialRotationPoints(float move) { protected void fixSpecialRotationPoints(float move) {
if (this.heldItemRight == 0) { if (this.heldItemRight == 0) {
if (MathHelper.sin(move / 20.0F) < 0.0F) { if (MathHelper.sin(move / 20.0F) < 0.0F) {
this.shiftRotationPoint(this.bipedRightArm, 0.5F, 1.5F, 3.0F); shiftRotationPoint(this.bipedRightArm, 0.5F, 1.5F, 3.0F);
} else { } else {
this.shiftRotationPoint(this.bipedLeftArm, -0.5F, 1.5F, 3.0F); shiftRotationPoint(this.bipedLeftArm, -0.5F, 1.5F, 3.0F);
} }
} }

View file

@ -90,40 +90,23 @@ public class ModelPonyArmor extends ModelPlayerPony {
@Override @Override
protected void setHead(float posX, float posY, float posZ) { protected void setHead(float posX, float posY, float posZ) {
this.setRotationPoint(this.bipedHead, posX, posY, posZ); setRotationPoint(this.bipedHead, posX, posY, posZ);
this.setRotationPoint(this.bipedHeadwear, posX, posY, posZ); setRotationPoint(this.bipedHeadwear, posX, posY, posZ);
this.setRotationPoint(this.extHead[0], posX, posY, posZ); setRotationPoint(this.extHead[0], posX, posY, posZ);
this.setRotationPoint(this.extHead[1], posX, posY, posZ); setRotationPoint(this.extHead[1], posX, posY, posZ);
} }
@Override @Override
protected void rotateHead(float horz, float vert) { protected void rotateHead(float horz, float vert) {
float headRotateAngleY; super.rotateHead(horz, vert);
float headRotateAngleX;
if (this.isSleeping) {
headRotateAngleY = 1.4F;
headRotateAngleX = 0.1F;
} else {
headRotateAngleY = horz / 57.29578F;
headRotateAngleX = vert / 57.29578F;
}
if (headRotateAngleX > 0.5F) { float headRotateAngleX = this.bipedHead.rotateAngleX;
headRotateAngleX = 0.5F; float headRotateAngleY = this.bipedHead.rotateAngleY;
}
if (headRotateAngleX < -0.5F) {
headRotateAngleX = -0.5F;
}
this.bipedHead.rotateAngleY = headRotateAngleY;
this.bipedHead.rotateAngleX = headRotateAngleX;
this.extHead[0].rotateAngleY = headRotateAngleY; this.extHead[0].rotateAngleY = headRotateAngleY;
this.extHead[0].rotateAngleX = headRotateAngleX; this.extHead[0].rotateAngleX = headRotateAngleX;
this.extHead[1].rotateAngleY = headRotateAngleY; this.extHead[1].rotateAngleY = headRotateAngleY;
this.extHead[1].rotateAngleX = headRotateAngleX; this.extHead[1].rotateAngleX = headRotateAngleX;
this.bipedHeadwear.rotateAngleY = headRotateAngleY;
this.bipedHeadwear.rotateAngleX = headRotateAngleX;
} }
@Override @Override
@ -140,17 +123,16 @@ public class ModelPonyArmor extends ModelPlayerPony {
} }
protected void ridingPony() { protected void ridingPony() {
this.setHead(this.bipedHead.rotationPointX + 0.0F, this.bipedHead.rotationPointY + RIDING_SHIFT_Y, this.setHead(this.bipedHead.rotationPointX + 0.0F, this.bipedHead.rotationPointY + RIDING_SHIFT_Y, this.bipedHead.rotationPointZ + RIDING_SHIFT_Z);
this.bipedHead.rotationPointZ + RIDING_SHIFT_Z); shiftRotationPoint(this.bipedBody, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
this.shiftRotationPoint(this.bipedBody, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z); shiftRotationPoint(this.Bodypiece, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
this.shiftRotationPoint(this.Bodypiece, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z); shiftRotationPoint(this.extBody, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
this.shiftRotationPoint(this.extBody, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z); shiftRotationPoint(this.bipedLeftArm, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
this.shiftRotationPoint(this.bipedLeftArm, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z); shiftRotationPoint(this.bipedRightArm, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
this.shiftRotationPoint(this.bipedRightArm, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z); shiftRotationPoint(this.bipedLeftLeg, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
this.shiftRotationPoint(this.bipedLeftLeg, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z); shiftRotationPoint(this.bipedRightLeg, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
this.shiftRotationPoint(this.bipedRightLeg, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z); shiftRotationPoint(this.extLegs[0], 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
this.shiftRotationPoint(this.extLegs[0], 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z); shiftRotationPoint(this.extLegs[1], 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
this.shiftRotationPoint(this.extLegs[1], 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
} }
@Override @Override

View file

@ -86,7 +86,7 @@ public class ModelSkeletonPonyArmor extends ModelPonyArmor {
@Override @Override
protected void fixSpecialRotationPoints(float move) { protected void fixSpecialRotationPoints(float move) {
if (this.heldItemRight != 0 && this.metadata.getGlowColor() == 0) { if (this.heldItemRight != 0 && this.metadata.getGlowColor() == 0) {
this.setRotationPoint(this.bipedRightArm, -1.5F, 9.5F, 4.0F); setRotationPoint(this.bipedRightArm, -1.5F, 9.5F, 4.0F);
} }
} }

View file

@ -87,9 +87,9 @@ public class ModelZombiePonyArmor extends ModelPonyArmor {
protected void fixSpecialRotationPoints(float move) { protected void fixSpecialRotationPoints(float move) {
if (this.heldItemRight == 0) { if (this.heldItemRight == 0) {
if (MathHelper.sin(move / 20.0F) < 0.0F) { if (MathHelper.sin(move / 20.0F) < 0.0F) {
this.shiftRotationPoint(this.bipedRightArm, 0.5F, 1.5F, 3.0F); shiftRotationPoint(this.bipedRightArm, 0.5F, 1.5F, 3.0F);
} else { } else {
this.shiftRotationPoint(this.bipedLeftArm, -0.5F, 1.5F, 3.0F); shiftRotationPoint(this.bipedLeftArm, -0.5F, 1.5F, 3.0F);
} }
} }

View file

@ -111,20 +111,26 @@ public class LayerHeldPonyItem implements LayerRenderer {
float green = (glowColor >> 8 & 255) / 255.0F; float green = (glowColor >> 8 & 255) / 255.0F;
float blue = (glowColor & 255) / 255.0F; float blue = (glowColor & 255) / 255.0F;
float alpha = 0.2F; float alpha = 0.2F;
disableLighting(); // disableLighting();
enableBlend(); enableBlend();
blendFunc(GL11.GL_CONSTANT_COLOR, 1); blendFunc(GL11.GL_CONSTANT_COLOR, 1);
GL14.glBlendColor(red, green, blue, alpha); GL14.glBlendColor(red, green, blue, alpha);
IBakedModel model = getItemModel(Minecraft.getMinecraft().getRenderItem(), entity, drop); IBakedModel model = getItemModel(Minecraft.getMinecraft().getRenderItem(), entity, drop);
scale(2, 2, 2);
applyTransform(model.getItemCameraTransforms().thirdPerson);
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
scale(1.1, 1.1, 1.1);
if (model.isGui3d()) { if (model.isGui3d()) {
// disabling textures for items messes up bounds // disabling textures for items messes up bounds
disableTexture2D(); disableTexture2D();
} }
scale(2, 2, 2); translate(0, .01, .01);
renderItem.renderItem(drop, model);
applyTransform(model.getItemCameraTransforms().thirdPerson); translate(.01, -.01, -.02);
scale(1.1, 1.1, 1.1); // scale(1.1, 1.1, 1.1);
Minecraft.getMinecraft().getRenderItem().renderItem(drop, model); renderItem.renderItem(drop, model);
disableBlend(); disableBlend();
enableLighting(); enableLighting();
enableTexture2D(); enableTexture2D();