diff --git a/ClassicalSharp/Entities/Player.cs b/ClassicalSharp/Entities/Player.cs
index 5f2b20480..b98497ff6 100644
--- a/ClassicalSharp/Entities/Player.cs
+++ b/ClassicalSharp/Entities/Player.cs
@@ -19,7 +19,7 @@ namespace ClassicalSharp {
this.game = game;
StepSize = 0.5f;
SkinType = game.DefaultPlayerSkinType;
- SetModel( "chicken" );
+ SetModel( "humanoid" );
}
/// Gets the block just underneath the player's feet position.
diff --git a/ClassicalSharp/Model/ChickenModel.cs b/ClassicalSharp/Model/ChickenModel.cs
index d565c5e97..280ee31d8 100644
--- a/ClassicalSharp/Model/ChickenModel.cs
+++ b/ClassicalSharp/Model/ChickenModel.cs
@@ -14,14 +14,15 @@ namespace ClassicalSharp.Model {
.SetTexOrigin( 14, 4 ) ); // TODO: Find a more appropriate name.
Head3 = BuildBox( MakeBoxBounds( -2, 11, -8, 2, 13, -6 )
.SetTexOrigin( 14, 0 ) );
- Torso =
+ Torso =BuildRotatedBox( MakeRotatedBoxBounds( -3, 5, -4, 3, 11, 3 )
+ .SetTexOrigin( 0, 9 ) );
LeftLeg = MakeLeg( -3, 0, -2, -1 );
- RightLeg = MakeLeg( 0, 3, 1, 2 );
+ RightLeg = MakeLeg( 0, 3, 1, 2 );
LeftWing = BuildBox( MakeBoxBounds( -4, 7, -3, -3, 11, 3 )
- .SetTexOrigin( 24, 13 ) );
+ .SetTexOrigin( 24, 13 ) );
RightWing = BuildBox( MakeBoxBounds( 3, 7, -3, 4, 11, 3 )
- .SetTexOrigin( 24, 13 ) );
+ .SetTexOrigin( 24, 13 ) );
}
ModelPart MakeLeg( int x1, int x2, int legX1, int legX2 ) {
@@ -31,10 +32,6 @@ namespace ClassicalSharp.Model {
return new ModelPart( index - 2 * 4, 2 * 4 );
}
- ModelPart MakeTorso() {
- return MakeRotatedBox( 0, 9, 6, 6, 8, -3/16f, 3/16f, 5/16f, 11/16f, -4/16f, 4/16f );
- }
-
public override float NameYOffset {
get { return 1.0125f; }
}
diff --git a/ClassicalSharp/Model/IModel.cs b/ClassicalSharp/Model/IModel.cs
index 616af9611..0eccc58f0 100644
--- a/ClassicalSharp/Model/IModel.cs
+++ b/ClassicalSharp/Model/IModel.cs
@@ -63,7 +63,7 @@ namespace ClassicalSharp.Model {
protected int index;
public struct BoxDescription {
- public int TexX, TexY, SidesW, EndsH, BodyW, BodyH;
+ public int TexX, TexY, SidesW, BodyW, BodyH;
public float X1, X2, Y1, Y2, Z1, Z2;
public BoxDescription SetTexOrigin( int x, int y ) {
@@ -79,26 +79,36 @@ namespace ClassicalSharp.Model {
}
protected BoxDescription MakeBoxBounds( int x1, int y1, int z1, int x2, int y2, int z2 ) {
- BoxDescription desc = default( BoxDescription );
- desc.X1 = x1 / 16f; desc.X2 = x2 / 16f;
- desc.Y1 = y1 / 16f; desc.Y2 = y2 / 16f;
- desc.Z1 = z1 / 16f; desc.Z2 = z2 / 16f;
-
+ BoxDescription desc = default( BoxDescription )
+ .SetModelBounds( x1, y1, z1, x2, y2, z2 );
desc.SidesW = Math.Abs( z2 - z1 );
desc.BodyW = Math.Abs( x2 - x1 );
desc.BodyH = Math.Abs( y2 - y1 );
return desc;
}
+ protected BoxDescription MakeRotatedBoxBounds( int x1, int y1, int z1, int x2, int y2, int z2 ) {
+ BoxDescription desc = default( BoxDescription )
+ .SetModelBounds( x1, y1, z1, x2, y2, z2 );
+ desc.SidesW = Math.Abs( y2 - y1 );
+ desc.BodyW = Math.Abs( x2 - x1 );
+ desc.BodyH = Math.Abs( z2 - z1 );
+ return desc;
+ }
+
/// Builds a box model assuming the follow texture layout:
- /// let sW = sides width, bW = body width, bH = body height
- /// ┏━━━━━sW━━━━━┳━━━━━bW━━━━━┳━━━━━bW━━━━━┳━━━━━sW━━━━━┓
- /// ┃s┈┈┈┈┈┈┈┈┈┈┈s┃w┈┈┈┈top┈┈┈┈s┃s┈┈bottom┈┈┈s┃s┈┈┈┈┈┈┈┈┈┈┈s┃
- /// ┃W┈┈┈┈┈┈┈┈┈W┃W┈┈┈┈tex┈┈┈W┃W┈┈┈┈tex┈┈┈W┃W┈┈┈┈┈┈┈┈┈W┃
- /// ┣━━━━━sW━━━━━╋━━━━━bW━━━━━╋━━━━━bW━━━━━╋━━━━━sW━━━━━┃
- /// ┃b┈┈┈left┈┈┈┈┈b┃b┈┈front┈┈┈┈b┃b┈┈right┈┈┈┈b┃b┈┈┈back┈┈┈┈b┃
- /// ┃H┈┈┈tex┈┈┈┈H┃H┈┈tex┈┈┈┈┈┈H┃H┈┈tex┈┈┈┈┈H┃H┈┈┈┈tex┈┈┈┈H┃
- /// ┗━━━━━sW━━━━━┻━━━━━bW━━━━━┻━━━━━bW━━━━━┻━━━━━sW━━━━━┛
+ /// let SW = sides width, BW = body width, BH = body height
+ /// ┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
+ /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈┈┈┈┈┈┈┈┃
+ /// ┃S┈┈┈┈┈┈┈┈┈┈┈S┃S┈┈┈┈top┈┈┈┈S┃S┈┈bottom┈┈┈S┃┈┈┈┈┈┈┈┈┈┈┈┈┃
+ /// ┃W┈┈┈┈┈┈┈┈┈W┃W┈┈┈┈tex┈┈┈W┃W┈┈┈┈tex┈┈┈┈W┃┈┈┈┈┈┈┈┈┈┈┈┈┃
+ /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈┈┈┈┈┈┈┈┃
+ /// ┣━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━━━━━┃
+ /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┃
+ /// ┃B┈┈┈left┈┈┈┈┈B┃B┈┈front┈┈┈┈B┃B┈┈┈right┈┈┈┈B┃B┈┈┈back┈┈┈B┃
+ /// ┃H┈┈┈tex┈┈┈┈┈H┃H┈┈tex┈┈┈┈┈H┃H┈┈┈tex┈┈┈┈┈H┃H┈┈┈┈tex┈┈┈H┃
+ /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┃
+ /// ┗━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━┛
protected ModelPart BuildBox( BoxDescription desc ) {
int sidesW = desc.SidesW, bodyW = desc.BodyW, bodyH = desc.BodyH;
float x1 = desc.X1, y1 = desc.Y1, z1 = desc.Z1;
@@ -114,27 +124,36 @@ namespace ClassicalSharp.Model {
return new ModelPart( index - 6 * 4, 6 * 4 );
}
+ /// Builds a box model assuming the follow texture layout:
+ /// let SW = sides width, BW = body width, BH = body height
+ /// ┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
+ /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈┈┈┈┈┈┈┈┃
+ /// ┃S┈┈┈┈┈┈┈┈┈┈┈S┃S┈┈┈┈front┈┈┈S┃S┈┈┈back┈┈┈┈S┃┈┈┈┈┈┈┈┈┈┈┈┈┃
+ /// ┃W┈┈┈┈┈┈┈┈┈W┃W┈┈┈┈tex┈┈┈W┃W┈┈┈┈tex┈┈┈┈W┃┈┈┈┈┈┈┈┈┈┈┈┈┃
+ /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈┈┈┈┈┈┈┈┃
+ /// ┣━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━━━━━┃
+ /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┃
+ /// ┃B┈┈┈left┈┈┈┈┈B┃B┈┈bottom┈┈B┃B┈┈┈right┈┈┈┈B┃B┈┈┈┈top┈┈┈B┃
+ /// ┃H┈┈┈tex┈┈┈┈┈H┃H┈┈tex┈┈┈┈┈H┃H┈┈┈tex┈┈┈┈┈H┃H┈┈┈┈tex┈┈┈H┃
+ /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┃
+ /// ┗━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━┛
protected ModelPart BuildRotatedBox( BoxDescription desc ) {
- return MakeRotatedBox( desc.TexX, desc.TexY, desc.SidesW,
- desc.BodyW, desc.BodyH, desc.X1, desc.X2, desc.Y1, desc.Y2, desc.Z1, desc.Z2 );
- }
-
- [Obsolete]
- protected ModelPart MakeRotatedBox( int x, int y, int sidesW, int bodyW, int bodyH,
- float x1, float x2, float y1, float y2, float z1, float z2 ) {
- YQuad( x + sidesW + bodyW + sidesW, y + sidesW, bodyW, bodyH, x1, x2, z1, z2, y2 ); // top
- YQuad( x + sidesW, y + sidesW, bodyW, bodyH, x2, x1, z1, z2, y1 ); // bottom
+ int sidesW = desc.SidesW, bodyW = desc.BodyW, bodyH = desc.BodyH;
+ float x1 = desc.X1, y1 = desc.Y1, z1 = desc.Z1;
+ float x2 = desc.X2, y2 = desc.Y2, z2 = desc.Z2;
+ int x = desc.TexX, y = desc.TexY;
+
ZQuad( x + sidesW, y, bodyW, sidesW, x2, x1, y1, y2, z1 ); // front
- ZQuad( x + sidesW + bodyW, y, bodyW, sidesW, x2, x1, y2, y1, z2 ); // back
+ ZQuad( x + sidesW + bodyW, y, bodyW, sidesW, x1, x2, y2, y1, z2 ); // back
+ YQuad( x + sidesW + bodyW + sidesW, y + sidesW, bodyW, bodyH, x1, x2, z1, z2, y2 ); // top
+ YQuad( x + sidesW, y + sidesW, bodyW, bodyH, x2, x1, z1, z2, y1 ); // bottom
XQuad( x, y + sidesW, sidesW, bodyH, y2, y1, z2, z1, x2 ); // left
XQuad( x + sidesW + bodyW, y + sidesW, sidesW, bodyH, y1, y2, z2, z1, x1 ); // right
// rotate left and right 90 degrees
for( int i = index - 8; i < index; i++ ) {
ModelVertex vertex = vertices[i];
- float z = vertex.Z;
- vertex.Z = vertex.Y;
- vertex.Y = z;
+ float z = vertex.Z; vertex.Z = vertex.Y; vertex.Y = z;
vertices[i] = vertex;
}
return new ModelPart( index - 6 * 4, 6 * 4 );
diff --git a/ClassicalSharp/Model/PigModel.cs b/ClassicalSharp/Model/PigModel.cs
index 3b05fb7d2..60b2e88bd 100644
--- a/ClassicalSharp/Model/PigModel.cs
+++ b/ClassicalSharp/Model/PigModel.cs
@@ -10,7 +10,8 @@ namespace ClassicalSharp.Model {
vertices = new ModelVertex[boxVertices * 6];
Head = BuildBox( MakeBoxBounds( -4, 8, -14, 4, 16, -6 )
.SetTexOrigin( 0, 0 ) );
- Torso = MakeTorso();
+ Torso = BuildRotatedBox( MakeRotatedBoxBounds( -5, 6, -8, 5, 14, 8 )
+ .SetTexOrigin( 28, 8 ) );
LeftLegFront = BuildBox( MakeBoxBounds( -5, 0, -7, -1, 6, -3 )
.SetTexOrigin( 0, 16 ) );
RightLegFront = BuildBox( MakeBoxBounds( 1, 0, -7, 5, 6, -3 )
@@ -21,10 +22,6 @@ namespace ClassicalSharp.Model {
.SetTexOrigin( 0, 16 ) );
}
- ModelPart MakeTorso() {
- return MakeRotatedBox( 28, 8, 8, 10, 16, -5/16f, 5/16f, 6/16f, 14/16f, -8/16f, 8/16f );
- }
-
public override float NameYOffset {
get { return 1.075f; }
}
diff --git a/ClassicalSharp/Model/SheepModel.cs b/ClassicalSharp/Model/SheepModel.cs
index 2f0129db7..a0b0971a2 100644
--- a/ClassicalSharp/Model/SheepModel.cs
+++ b/ClassicalSharp/Model/SheepModel.cs
@@ -13,7 +13,8 @@ namespace ClassicalSharp.Model {
vertices = new ModelVertex[boxVertices * 6 * ( Fur ? 2 : 1 )];
Head = BuildBox( MakeBoxBounds( -3, 16, -14, 3, 22, -6 )
.SetTexOrigin( 0, 0 ) );
- Torso = MakeTorso();
+ Torso = BuildRotatedBox( MakeRotatedBoxBounds( -4, 12, -8, 4, 18, 8 )
+ .SetTexOrigin( 28, 8 ) );
LeftLegFront = BuildBox( MakeBoxBounds( -5, 0, -7, -1, 12, -3 )
.SetTexOrigin( 0, 16 ) );
RightLegFront = BuildBox( MakeBoxBounds( 1, 0, -7, 5, 12, -3 )
@@ -22,7 +23,6 @@ namespace ClassicalSharp.Model {
.SetTexOrigin( 0, 16 ) );
RightLegBack = BuildBox( MakeBoxBounds( 1, 0, 5, 5, 12, 9 )
.SetTexOrigin( 0, 16 ) );
-
if( Fur )
MakeFurModel();
}
@@ -32,7 +32,9 @@ namespace ClassicalSharp.Model {
FurHead = BuildBox( MakeBoxBounds( -3, -3, -3, 3, 3, 3 )
.SetTexOrigin( 0, 0 )
.SetModelBounds( -3.5f, 15.5f, -12.5f, 3.5f, 22.5f, -5.5f ) );
- FurTorso = MakeFurTorso();
+ FurTorso = BuildRotatedBox( MakeRotatedBoxBounds( -4, 12, -8, 4, 18, 8 )
+ .SetTexOrigin( 28, 8 )
+ .SetModelBounds( -6f, 10.5f, -10f, 6f, 19.5f, 10f ) );
BoxDescription legDesc = MakeBoxBounds( -2, -3, -2, 2, 3, 2 )
.SetTexOrigin( 0, 16 );
@@ -42,14 +44,6 @@ namespace ClassicalSharp.Model {
FurRightLegBack = BuildBox( legDesc.SetModelBounds( 0.5f, 5.5f, 4.5f, 5.5f, 12.5f, 9.5f ) );
}
- ModelPart MakeTorso() {
- return MakeRotatedBox( 28, 8, 6, 8, 16, -4/16f, 4/16f, 12/16f, 18/16f, -8/16f, 8/16f );
- }
-
- ModelPart MakeFurTorso() {
- return MakeRotatedBox( 28, 8, 6, 8, 16, -6/16f, 6/16f, 10.5f/16f, 1.21875f, -10/16f, 10/16f );
- }
-
public override float NameYOffset {
get { return Fur ? 1.48125f: 1.075f; }
}