diff --git a/ClassicalSharp.csproj b/ClassicalSharp.csproj
index 502485eb3..7a11ce02d 100644
--- a/ClassicalSharp.csproj
+++ b/ClassicalSharp.csproj
@@ -118,6 +118,7 @@
+
diff --git a/Model/CreeperModel.cs b/Model/CreeperModel.cs
index 995383951..bf15315d1 100644
--- a/Model/CreeperModel.cs
+++ b/Model/CreeperModel.cs
@@ -14,10 +14,10 @@ namespace ClassicalSharp.Model {
Set = new ModelSet();
Set.Head = MakeHead();
Set.Torso = MakeTorso();
- Set.LeftLegFront = MakeLeg( 0, 16, -0.25f, 0, -0.375f, -0.125f );
- Set.RightLegFront = MakeLeg( 0, 16, 0, 0.25f, -0.375f, -0.125f );
- Set.LeftLegBack = MakeLeg( 0, 16, -0.25f, 0, 0.125f, 0.375f );
- Set.RightLegBack = MakeLeg( 0, 16, 0, 0.25f, 0.125f, 0.375f );
+ Set.LeftLegFront = MakeLeg( -0.25f, 0, -0.375f, -0.125f );
+ Set.RightLegFront = MakeLeg( 0, 0.25f, -0.375f, -0.125f );
+ Set.LeftLegBack = MakeLeg( -0.25f, 0, 0.125f, 0.375f );
+ Set.RightLegBack = MakeLeg( 0, 0.25f, 0.125f, 0.375f );
vertices = null;
DefaultSkinTextureId = graphics.LoadTexture( "creeper.png" );
@@ -31,8 +31,8 @@ namespace ClassicalSharp.Model {
return MakePart( 16, 16, 4, 12, 8, 4, 8, 12, -0.25f, 0.25f, 0.375f, 1.125f, -0.125f, 0.125f, false );
}
- ModelPart MakeLeg( int x, int y, float x1, float x2, float z1, float z2 ) {
- return MakePart( x, y, 4, 6, 4, 4, 4, 6, x1, x2, 0f, 0.375f, z1, z2, false );
+ ModelPart MakeLeg( float x1, float x2, float z1, float z2 ) {
+ return MakePart( 0, 16, 4, 6, 4, 4, 4, 6, x1, x2, 0f, 0.375f, z1, z2, false );
}
public override float NameYOffset {
diff --git a/Model/PigModel.cs b/Model/PigModel.cs
index 58944bac2..0ae784be7 100644
--- a/Model/PigModel.cs
+++ b/Model/PigModel.cs
@@ -54,7 +54,7 @@ namespace ClassicalSharp.Model {
}
public override float NameYOffset {
- get { return 1.7f; }
+ get { return 1.075f; }
}
Vector3 pos;
diff --git a/Model/SkeletonModel.cs b/Model/SkeletonModel.cs
new file mode 100644
index 000000000..09686e3df
--- /dev/null
+++ b/Model/SkeletonModel.cs
@@ -0,0 +1,109 @@
+using OpenTK;
+using System;
+using System.Drawing;
+using ClassicalSharp.GraphicsAPI;
+using ClassicalSharp.Renderers;
+
+namespace ClassicalSharp.Model {
+
+ public class SkeletonModel : IModel {
+
+ ModelSet Set;
+ public SkeletonModel( Game window ) : base( window ) {
+ vertices = new VertexPos3fTex2fCol4b[6 * 6];
+ Set = new ModelSet();
+ Set.Head = MakeHead();
+ Set.Torso = MakeTorso();
+ Set.LeftLeg = MakeLeftLeg( 0.1875f, 0.0625f );
+ Set.RightLeg = MakeRightLeg( 0.0625f, 0.1875f );
+ Set.LeftArm = MakeLeftArm( 0.375f, 0.25f );
+ Set.RightArm = MakeRightArm( 0.25f, 0.375f );
+ vertices = null;
+
+ DefaultSkinTextureId = graphics.LoadTexture( "skeleton.png" );
+ }
+
+ ModelPart MakeLeftArm( float x1, float x2 ) {
+ return MakePart( 40, 16, 2, 12, 2, 2, 2, 12, -x2, -x1, 0.75f, 1.5f, -0.0625f, 0.0625f, false );
+ }
+
+ ModelPart MakeRightArm( float x1, float x2 ) {
+ return MakePart( 40, 16, 2, 12, 2, 2, 2, 12, x1, x2, 0.75f, 1.5f, -0.0625f, 0.0625f, false );
+ }
+
+ ModelPart MakeHead() {
+ return MakePart( 0, 0, 8, 8, 8, 8, 8, 8, -0.25f, 0.25f, 1.5f, 2f, -0.25f, 0.25f, false );
+ }
+
+ ModelPart MakeTorso() {
+ return MakePart( 16, 16, 4, 12, 8, 4, 8, 12, -0.25f, 0.25f, 0.75f, 1.5f, -0.125f, 0.125f, false );
+ }
+
+ ModelPart MakeLeftLeg( float x1, float x2 ) {
+ return MakePart( 0, 16, 2, 12, 2, 2, 2, 12, -x2, -x1, 0f, 0.75f, -0.0625f, 0.0625f, false );
+ }
+
+ ModelPart MakeRightLeg( float x1, float x2 ) {
+ return MakePart( 0, 16, 2, 12, 2, 2, 2, 12, x1, x2, 0f, 0.75f, -0.0625f, 0.0625f, false );
+ }
+
+ public override float NameYOffset {
+ get { return 2.075f; }
+ }
+
+ Vector3 pos;
+ float yaw, pitch;
+ float rightLegXRot, rightArmZRot;
+ float leftLegXRot, leftArmZRot;
+
+ public override void RenderModel( Player player, PlayerRenderer renderer ) {
+ pos = player.Position;
+ yaw = player.YawDegrees;
+ pitch = player.PitchDegrees;
+
+ leftLegXRot = player.leftLegXRot * 180 / (float)Math.PI;
+ leftArmZRot = player.leftArmZRot * 180 / (float)Math.PI;
+ rightLegXRot = player.rightLegXRot * 180 / (float)Math.PI;
+ rightArmZRot = player.rightArmZRot * 180 / (float)Math.PI;
+
+ graphics.PushMatrix();
+ graphics.Translate( pos.X, pos.Y, pos.Z );
+ graphics.RotateY( -yaw );
+ DrawPlayerModel( player, renderer );
+ graphics.PopMatrix();
+ }
+
+ private void DrawPlayerModel( Player player, PlayerRenderer renderer ) {
+ graphics.Texturing = true;
+ graphics.AlphaTest = true;
+ int texId = DefaultSkinTextureId;
+ graphics.Bind2DTexture( texId );
+
+ DrawRotateX( 0, 1.5f, 0, -pitch, Set.Head );
+ Set.Torso.Render();
+ DrawRotateX( 0, 0.75f, 0, leftLegXRot, Set.LeftLeg );
+ DrawRotateX( 0, 0.75f, 0, rightLegXRot, Set.RightLeg );
+ DrawRotateXZ( 0, 1.375f, 0, 90f, leftArmZRot, Set.LeftArm );
+ DrawRotateXZ( 0, 1.375f, 0, 90f, rightArmZRot, Set.RightArm );
+ }
+
+ public override void Dispose() {
+ Set.Dispose();
+ graphics.DeleteTexture( DefaultSkinTextureId );
+ }
+
+ class ModelSet {
+
+ public ModelPart Head, Torso, LeftLeg, RightLeg, LeftArm, RightArm;
+
+ public void Dispose() {
+ RightArm.Dispose();
+ LeftArm.Dispose();
+ RightLeg.Dispose();
+ LeftLeg.Dispose();
+ Torso.Dispose();
+ Head.Dispose();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Model/ZombieModel.cs b/Model/ZombieModel.cs
index b0b6cb7fc..761e3e7d7 100644
--- a/Model/ZombieModel.cs
+++ b/Model/ZombieModel.cs
@@ -14,21 +14,21 @@ namespace ClassicalSharp.Model {
Set = new ModelSet();
Set.Head = MakeHead();
Set.Torso = MakeTorso();
- Set.LeftLeg = MakeLeftLeg( 0, 16, 0.25f, 0f );
- Set.RightLeg = MakeRightLeg( 0, 16, 0, 0.25f );
- Set.LeftArm = MakeLeftArm( 40, 16, 0.5f, 0.25f, 4 );
- Set.RightArm = MakeRightArm( 40, 16, 0.25f, 0.5f, 4 );
+ Set.LeftLeg = MakeLeftLeg( 0.25f, 0f );
+ Set.RightLeg = MakeRightLeg( 0, 0.25f );
+ Set.LeftArm = MakeLeftArm( 0.5f, 0.25f );
+ Set.RightArm = MakeRightArm( 0.25f, 0.5f );
vertices = null;
DefaultSkinTextureId = graphics.LoadTexture( "zombie.png" );
}
- ModelPart MakeLeftArm( int x, int y, float x1, float x2, int width ) {
- return MakePart( x, y, 4, 12, width, 4, width, 12, -x2, -x1, 0.75f, 1.5f, -0.125f, 0.125f, false );
+ ModelPart MakeLeftArm( float x1, float x2 ) {
+ return MakePart( 40, 16, 4, 12, 4, 4, 4, 12, -x2, -x1, 0.75f, 1.5f, -0.125f, 0.125f, false );
}
- ModelPart MakeRightArm( int x, int y, float x1, float x2, int width ) {
- return MakePart( x, y, 4, 12, width, 4, width, 12, x1, x2, 0.75f, 1.5f, -0.125f, 0.125f, false );
+ ModelPart MakeRightArm( float x1, float x2 ) {
+ return MakePart( 40, 16, 4, 12, 4, 4, 4, 12, x1, x2, 0.75f, 1.5f, -0.125f, 0.125f, false );
}
ModelPart MakeHead() {
@@ -39,22 +39,22 @@ namespace ClassicalSharp.Model {
return MakePart( 16, 16, 4, 12, 8, 4, 8, 12, -0.25f, 0.25f, 0.75f, 1.5f, -0.125f, 0.125f, false );
}
- ModelPart MakeLeftLeg( int x, int y, float x1, float x2 ) {
- return MakePart( x, y, 4, 12, 4, 4, 4, 12, -x2, -x1, 0f, 0.75f, -0.125f, 0.125f, false );
+ ModelPart MakeLeftLeg( float x1, float x2 ) {
+ return MakePart( 0, 16, 4, 12, 4, 4, 4, 12, -x2, -x1, 0f, 0.75f, -0.125f, 0.125f, false );
}
- ModelPart MakeRightLeg( int x, int y, float x1, float x2 ) {
- return MakePart( x, y, 4, 12, 4, 4, 4, 12, x1, x2, 0f, 0.75f, -0.125f, 0.125f, false );
+ ModelPart MakeRightLeg( float x1, float x2 ) {
+ return MakePart( 0, 16, 4, 12, 4, 4, 4, 12, x1, x2, 0f, 0.75f, -0.125f, 0.125f, false );
}
public override float NameYOffset {
- get { return 2.1375f; }
+ get { return 2.075f; }
}
Vector3 pos;
float yaw, pitch;
- float rightLegXRot, rightArmXRot, rightArmZRot;
- float leftLegXRot, leftArmXRot, leftArmZRot;
+ float rightLegXRot, rightArmZRot;
+ float leftLegXRot, leftArmZRot;
public override void RenderModel( Player player, PlayerRenderer renderer ) {
pos = player.Position;
@@ -62,10 +62,8 @@ namespace ClassicalSharp.Model {
pitch = player.PitchDegrees;
leftLegXRot = player.leftLegXRot * 180 / (float)Math.PI;
- leftArmXRot = player.leftArmXRot * 180 / (float)Math.PI;
leftArmZRot = player.leftArmZRot * 180 / (float)Math.PI;
rightLegXRot = player.rightLegXRot * 180 / (float)Math.PI;
- rightArmXRot = player.rightArmXRot * 180 / (float)Math.PI;
rightArmZRot = player.rightArmZRot * 180 / (float)Math.PI;
graphics.PushMatrix();
@@ -84,8 +82,8 @@ namespace ClassicalSharp.Model {
Set.Torso.Render();
DrawRotateX( 0, 0.75f, 0, leftLegXRot, Set.LeftLeg );
DrawRotateX( 0, 0.75f, 0, rightLegXRot, Set.RightLeg );
- DrawRotateXZ( 0, 1.5f, 0, leftArmXRot, leftArmZRot, Set.LeftArm );
- DrawRotateXZ( 0, 1.5f, 0, rightArmXRot, rightArmZRot, Set.RightArm );
+ DrawRotateXZ( 0, 1.375f, 0, 90f, leftArmZRot, Set.LeftArm );
+ DrawRotateXZ( 0, 1.375f, 0, 90f, rightArmZRot, Set.RightArm );
graphics.AlphaTest = true;
}