Fix rotation of models, use nicer constants in Model classes.

This commit is contained in:
UnknownShadow200 2015-09-13 12:17:34 +10:00
parent 3779565272
commit c88348c6d8
12 changed files with 147 additions and 149 deletions

View File

@ -12,34 +12,34 @@ namespace ClassicalSharp.Model {
Head2 = MakeHead2(); // TODO: Find a more appropriate name.
Head3 = MakeHead3();
Torso = MakeTorso();
LeftLeg = MakeLeg( -0.1875f, 0f, -0.125f, -0.0625f );
RightLeg = MakeLeg( 0f, 0.1875f, 0.0625f, 0.125f );
LeftWing = MakeWing( -0.25f, -0.1875f );
RightWing = MakeWing( 0.1875f, 0.25f );
LeftLeg = MakeLeg( -3/16f, 0f, -2/16f, -1/16f );
RightLeg = MakeLeg( 0f, 3/16f, 1/16f, 2/16f );
LeftWing = MakeWing( -4/16f, -3/16f );
RightWing = MakeWing( 3/16f, 4/16f );
}
ModelPart MakeHead() {
return MakePart( 0, 0, 3, 6, 4, 3, 4, 6, -0.125f, 0.125f, 0.5625f, 0.9375f, -0.375f, -0.1875f, false );
return MakePart( 0, 0, 3, 6, 4, 3, 4, 6, -2/16f, 2/16f, 9/16f, 15/16f, -6/16f, -3/16f, false );
}
ModelPart MakeHead2() {
return MakePart( 14, 4, 2, 2, 2, 2, 2, 2, -0.0625f, 0.0625f, 0.5625f, 0.6875f, -0.4375f, -0.3125f, false );
return MakePart( 14, 4, 2, 2, 2, 2, 2, 2, -1/16f, 1/16f, 9/16f, 11/16f, -7/16f, -5/16f, false );
}
ModelPart MakeHead3() {
return MakePart( 14, 0, 2, 2, 4, 2, 4, 2, -0.125f, 0.125f, 0.6875f, 0.8125f, -0.5f, -0.375f, false );
return MakePart( 14, 0, 2, 2, 4, 2, 4, 2, -2/16f, 2/16f, 11/16f, 13/16f, -8/16f, -6/16f, false );
}
ModelPart MakeTorso() {
return MakeRotatedPart( 0, 9, 6, 8, 6, 6, 6, 8, -0.1875f, 0.1875f, 0.3125f, 0.6875f, -0.25f, 0.25f, false );
return MakeRotatedPart( 0, 9, 6, 8, 6, 6, 6, 8, -3/16f, 3/16f, 5/16f, 11/16f, -4/16f, 4/16f, false );
}
ModelPart MakeWing( float x1, float x2 ) {
return MakePart( 24, 13, 6, 4, 1, 6, 1, 4, x1, x2, 0.4375f, 0.6875f, -0.1875f, 0.1875f, false );
return MakePart( 24, 13, 6, 4, 1, 6, 1, 4, x1, x2, 7/16f, 11/16f, -3/16f, 3/16f, false );
}
ModelPart MakeLeg( float x1, float x2, float legX1, float legX2 ) {
const float y1 = 0f, y2 = 0.3125f, z2 = 0.0625f, z1 = -0.125f;
const float y1 = 0f, y2 = 5/16f, z2 = 1/16f, z1 = -2/16f;
YPlane( 32, 0, 3, 3, x2, x1, z1, z2, y1, false ); // bottom feet
ZPlane( 36, 3, 1, 5, legX1, legX2, y1, y2, z2, false ); // vertical part of leg
return new ModelPart( index - 2 * 4, 2 * 4 );
@ -63,14 +63,14 @@ namespace ClassicalSharp.Model {
graphics.BindTexture( texId );
graphics.AlphaTest = true;
DrawRotate( 0, 0.5625f, -0.1875f, -p.PitchRadians, 0, 0, Head );
DrawRotate( 0, 0.5625f, -0.1875f, -p.PitchRadians, 0, 0, Head2 );
DrawRotate( 0, 0.5625f, -0.1875f, -p.PitchRadians, 0, 0, Head3 );
DrawRotate( 0, 9/16f, -3/16f, -p.PitchRadians, 0, 0, Head );
DrawRotate( 0, 9/16f, -3/16f, -p.PitchRadians, 0, 0, Head2 );
DrawRotate( 0, 9/16f, -3/16f, -p.PitchRadians, 0, 0, Head3 );
DrawPart( Torso );
DrawRotate( 0, 0.3125f, 0.0625f, p.leftLegXRot, 0, 0, LeftLeg );
DrawRotate( 0, 0.3125f, 0.0625f, p.rightLegXRot, 0, 0, RightLeg );
DrawRotate( -0.1875f, 0.6875f, 0, 0, 0, -Math.Abs( p.leftArmXRot ), LeftWing );
DrawRotate( 0.1875f, 0.6875f, 0, 0, 0, Math.Abs( p.rightArmXRot ), RightWing );
DrawRotate( 0, 5/16f, 1/16f, p.leftLegXRot, 0, 0, LeftLeg );
DrawRotate( 0, 5/16f, 1/16f, p.rightLegXRot, 0, 0, RightLeg );
DrawRotate( -3/16f, 11/16f, 0, 0, 0, -Math.Abs( p.leftArmXRot ), LeftWing );
DrawRotate( 3/16f, 11/16f, 0, 0, 0, Math.Abs( p.rightArmXRot ), RightWing );
}
ModelPart Head, Head2, Head3, Torso, LeftLeg, RightLeg, LeftWing, RightWing;

View File

@ -10,22 +10,22 @@ namespace ClassicalSharp.Model {
vertices = new VertexPos3fTex2fCol4b[partVertices * 6];
Head = MakeHead();
Torso = MakeTorso();
LeftLegFront = MakeLeg( -0.25f, 0, -0.375f, -0.125f );
RightLegFront = MakeLeg( 0, 0.25f, -0.375f, -0.125f );
LeftLegBack = MakeLeg( -0.25f, 0, 0.125f, 0.375f );
RightLegBack = MakeLeg( 0, 0.25f, 0.125f, 0.375f );
LeftLegFront = MakeLeg( -4/16f, 0, -6/16f, -2/16f );
RightLegFront = MakeLeg( 0, 4/16f, -6/16f, -2/16f );
LeftLegBack = MakeLeg( -4/16f, 0, 2/16f, 6/16f );
RightLegBack = MakeLeg( 0, 4/16f, 2/16f, 6/16f );
}
ModelPart MakeHead() {
return MakePart( 0, 0, 8, 8, 8, 8, 8, 8, -0.25f, 0.25f, 1.125f, 1.625f, -0.25f, 0.25f, false );
return MakePart( 0, 0, 8, 8, 8, 8, 8, 8, -4/16f, 4/16f, 18/16f, 1.625f, -4/16f, 4/16f, false );
}
ModelPart MakeTorso() {
return MakePart( 16, 16, 4, 12, 8, 4, 8, 12, -0.25f, 0.25f, 0.375f, 1.125f, -0.125f, 0.125f, false );
return MakePart( 16, 16, 4, 12, 8, 4, 8, 12, -4/16f, 4/16f, 6/16f, 18/16f, -2/16f, 2/16f, 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 );
return MakePart( 0, 16, 4, 6, 4, 4, 4, 6, x1, x2, 0f, 6/16f, z1, z2, false );
}
public override float NameYOffset {
@ -45,12 +45,12 @@ namespace ClassicalSharp.Model {
int texId = p.MobTextureId <= 0 ? cache.CreeperTexId : p.MobTextureId;
graphics.BindTexture( texId );
DrawRotate( 0, 1.125f, 0, -p.PitchRadians, 0, 0, Head );
DrawRotate( 0, 18/16f, 0, -p.PitchRadians, 0, 0, Head );
DrawPart( Torso );
DrawRotate( 0, 0.375f, -0.125f, p.leftLegXRot, 0, 0, LeftLegFront );
DrawRotate( 0, 0.375f, -0.125f, p.rightLegXRot, 0, 0, RightLegFront );
DrawRotate( 0, 0.375f, 0.125f, p.rightLegXRot, 0, 0, LeftLegBack );
DrawRotate( 0, 0.375f, 0.125f, p.leftLegXRot, 0, 0, RightLegBack );
DrawRotate( 0, 6/16f, -2/16f, p.leftLegXRot, 0, 0, LeftLegFront );
DrawRotate( 0, 6/16f, -2/16f, p.rightLegXRot, 0, 0, RightLegFront );
DrawRotate( 0, 6/16f, 2/16f, p.rightLegXRot, 0, 0, LeftLegBack );
DrawRotate( 0, 6/16f, 2/16f, p.leftLegXRot, 0, 0, RightLegBack );
graphics.AlphaTest = true;
}

View File

@ -121,11 +121,9 @@ namespace ClassicalSharp.Model {
}
protected void DrawRotate( float x, float y, float z, float angleX, float angleY, float angleZ, ModelPart part ) {
Matrix4 mat = Matrix4.Translate( x, y, z );
float cosX = (float)Math.Cos( -angleX ), sinX = (float)Math.Sin( -angleX );
float cosY = (float)Math.Cos( -angleY ), sinY = (float)Math.Sin( -angleY );
float cosZ = (float)Math.Cos( -angleZ ), sinZ = (float)Math.Sin( -angleZ );
Vector3 offset = new Vector3( x, y, z ) + pos;
for( int i = 0; i < part.Count; i++ ) {
VertexPos3fTex2fCol4b vertex = vertices[part.Offset + i];
@ -134,7 +132,7 @@ namespace ClassicalSharp.Model {
loc = Utils.RotateY( loc.X, loc.Y, loc.Z, cosY, sinY );
loc = Utils.RotateX( loc.X, loc.Y, loc.Z, cosX, sinX );
Vector3 newPos = Utils.RotateY( loc.X, loc.Y, loc.Z, cosA, sinA ) + offset;
Vector3 newPos = Utils.RotateY( loc.X + x, loc.Y + y, loc.Z + z, cosA, sinA ) + pos;
vertex.X = newPos.X; vertex.Y = newPos.Y; vertex.Z = newPos.Z;
vertex.R = col.R; vertex.G = col.G; vertex.B = col.B;
cache.vertices[index++] = vertex;

View File

@ -10,22 +10,22 @@ namespace ClassicalSharp.Model {
vertices = new VertexPos3fTex2fCol4b[partVertices * 6];
Head = MakeHead();
Torso = MakeTorso();
LeftLegFront = MakeLeg( -0.3125f, -0.0625f, -0.4375f, -0.1875f );
RightLegFront = MakeLeg( 0.0625f, 0.3125f, -0.4375f, -0.1875f );
LeftLegBack = MakeLeg( -0.3125f, -0.0625f, 0.3125f, 0.5625f );
RightLegBack = MakeLeg( 0.0625f, 0.3125f, 0.3125f, 0.5625f );
LeftLegFront = MakeLeg( -5/16f, -1/16f, -7/16f, -3/16f );
RightLegFront = MakeLeg( 1/16f, 5/16f, -7/16f, -3/16f );
LeftLegBack = MakeLeg( -5/16f, -1/16f, 5/16f, 9/16f );
RightLegBack = MakeLeg( 1/16f, 5/16f, 5/16f, 9/16f );
}
ModelPart MakeHead() {
return MakePart( 0, 0, 8, 8, 8, 8, 8, 8, -0.25f, 0.25f, 0.5f, 1f, -0.875f, -0.375f, false );
return MakePart( 0, 0, 8, 8, 8, 8, 8, 8, -4/16f, 4/16f, 8/16f, 1f, -14/16f, -6/16f, false );
}
ModelPart MakeTorso() {
return MakeRotatedPart( 28, 8, 8, 16, 10, 8, 10, 16, -0.3125f, 0.3125f, 0.375f, 0.875f, -0.5f, 0.5f, false );
return MakeRotatedPart( 28, 8, 8, 16, 10, 8, 10, 16, -5/16f, 5/16f, 6/16f, 14/16f, -8/16f, 8/16f, 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 );
return MakePart( 0, 16, 4, 6, 4, 4, 4, 6, x1, x2, 0f, 6/16f, z1, z2, false );
}
public override float NameYOffset {
@ -45,12 +45,12 @@ namespace ClassicalSharp.Model {
int texId = p.MobTextureId <= 0 ? cache.PigTexId : p.MobTextureId;
graphics.BindTexture( texId );
DrawRotate( 0, 0.75f, -0.375f, -p.PitchRadians, 0, 0, Head );
DrawRotate( 0, 12/16f, -6/16f, -p.PitchRadians, 0, 0, Head );
DrawPart( Torso );
DrawRotate( 0, 0.375f, -0.3125f, p.leftLegXRot, 0, 0, LeftLegFront );
DrawRotate( 0, 0.375f, -0.3125f, p.rightLegXRot, 0, 0, RightLegFront );
DrawRotate( 0, 0.375f, 0.4375f, p.rightLegXRot, 0, 0, LeftLegBack );
DrawRotate( 0, 0.375f, 0.4375f, p.leftLegXRot, 0, 0, RightLegBack );
DrawRotate( 0, 6/16f, -5/16f, p.leftLegXRot, 0, 0, LeftLegFront );
DrawRotate( 0, 6/16f, -5/16f, p.rightLegXRot, 0, 0, RightLegFront );
DrawRotate( 0, 6/16f, 7/16f, p.rightLegXRot, 0, 0, LeftLegBack );
DrawRotate( 0, 6/16f, 7/16f, p.leftLegXRot, 0, 0, RightLegBack );
graphics.AlphaTest = true;
}

View File

@ -13,19 +13,19 @@ namespace ClassicalSharp.Model {
Set64x32 = new ModelSet();
Set64x32.Head = MakeHead( false );
Set64x32.Torso = MakeTorso( false );
Set64x32.LeftLeg = MakeLeftLeg( 0, 16, 0.25f, 0f, false );
Set64x32.RightLeg = MakeRightLeg( 0, 16, 0, 0.25f, false );
Set64x32.LeftArm = MakeLeftArm( 40, 16, 0.5f, 0.25f, 4, false );
Set64x32.RightArm = MakeRightArm( 40, 16, 0.25f, 0.5f, 4, false );
Set64x32.LeftLeg = MakeLeftLeg( 0, 16, 4/16f, 0f, false );
Set64x32.RightLeg = MakeRightLeg( 0, 16, 0, 4/16f, false );
Set64x32.LeftArm = MakeLeftArm( 40, 16, 8/16f, 4/16f, 4, false );
Set64x32.RightArm = MakeRightArm( 40, 16, 4/16f, 8/16f, 4, false );
Set64x32.Hat = MakeHat( false );
Set64x64 = new ModelSet();
Set64x64.Head = MakeHead( true );
Set64x64.Torso = MakeTorso( true );
Set64x64.LeftLeg = MakeLeftLeg( 16, 48, 0, 0.25f, true );
Set64x64.RightLeg = MakeRightLeg( 0, 16, 0, 0.25f, true );
Set64x64.LeftArm = MakeLeftArm( 32, 48, 0.25f, 0.5f, 4, true );
Set64x64.RightArm = MakeRightArm( 40, 16, 0.25f, 0.5f, 4, true );
Set64x64.LeftLeg = MakeLeftLeg( 16, 48, 0, 4/16f, true );
Set64x64.RightLeg = MakeRightLeg( 0, 16, 0, 4/16f, true );
Set64x64.LeftArm = MakeLeftArm( 32, 48, 4/16f, 8/16f, 4, true );
Set64x64.RightArm = MakeRightArm( 40, 16, 4/16f, 8/16f, 4, true );
Set64x64.Hat = MakeHat( true );
Set64x64Slim = new ModelSet();
@ -33,8 +33,8 @@ namespace ClassicalSharp.Model {
Set64x64Slim.Torso = Set64x64.Torso;
Set64x64Slim.LeftLeg = Set64x64.LeftLeg;
Set64x64Slim.RightLeg = Set64x64.RightLeg;
Set64x64Slim.LeftArm = MakeLeftArm( 32, 48, 0.25f, 0.4375f, 3, true );
Set64x64Slim.RightArm = MakeRightArm( 40, 16, 0.25f, 0.4375f, 3, true );
Set64x64Slim.LeftArm = MakeLeftArm( 32, 48, 4/16f, 7/16f, 3, true );
Set64x64Slim.RightArm = MakeRightArm( 40, 16, 4/16f, 7/16f, 3, true );
Set64x64Slim.Hat = Set64x64.Hat;
}
@ -89,12 +89,12 @@ namespace ClassicalSharp.Model {
if( skinType == SkinType.Type64x64 ) model = Set64x64;
else if( skinType == SkinType.Type64x64Slim ) model = Set64x64Slim;
DrawRotate( 0, 1.5f, 0, -p.PitchRadians, 0, 0, model.Head );
DrawRotate( 0, 24/16f, 0, -p.PitchRadians, 0, 0, model.Head );
DrawPart( model.Torso );
DrawRotate( 0, 0.75f, 0, p.leftLegXRot, 0, 0, model.LeftLeg );
DrawRotate( 0, 0.75f, 0, p.rightLegXRot, 0, 0, model.RightLeg );
DrawRotate( 0, 1.5f, 0, p.leftArmXRot, 0, p.leftArmZRot, model.LeftArm );
DrawRotate( 0, 1.5f, 0, p.rightArmXRot, 0, p.rightArmZRot, model.RightArm );
DrawRotate( 0, 12/16f, 0, p.leftLegXRot, 0, 0, model.LeftLeg );
DrawRotate( 0, 12/16f, 0, p.rightLegXRot, 0, 0, model.RightLeg );
DrawRotate( 0, 24/16f, 0, p.leftArmXRot, 0, p.leftArmZRot, model.LeftArm );
DrawRotate( 0, 24/16f, 0, p.rightArmXRot, 0, p.rightArmZRot, model.RightArm );
graphics.AlphaTest = true;
DrawRotate( 0, 1.4375f, 0, -p.PitchRadians, 0, 0, model.Hat );
}

View File

@ -13,42 +13,42 @@ namespace ClassicalSharp.Model {
vertices = new VertexPos3fTex2fCol4b[partVertices * 6 * ( Fur ? 2 : 1 )];
Head = MakeHead();
Torso = MakeTorso();
LeftLegFront = MakeLeg( -0.3125f, -0.0625f, -0.4375f, -0.1875f );
RightLegFront = MakeLeg( 0.0625f, 0.3125f, -0.4375f, -0.1875f );
LeftLegBack = MakeLeg( -0.3125f, -0.0625f, 0.3125f, 0.5625f );
RightLegBack = MakeLeg( 0.0625f, 0.3125f, 0.3125f, 0.5625f );
LeftLegFront = MakeLeg( -5/16f, -1/16f, -7/16f, -3/16f );
RightLegFront = MakeLeg( 1/16f, 5/16f, -7/16f, -3/16f );
LeftLegBack = MakeLeg( -5/16f, -1/16f, 5/16f, 9/16f );
RightLegBack = MakeLeg( 1/16f, 5/16f, 5/16f, 9/16f );
if( Fur ) {
FurHead = MakeFurHead();
FurTorso = MakeFurTorso();
FurLeftLegFront = MakeFurLeg( -0.34375f, -0.03125f, -0.46875f, -0.15625f );
FurRightLegFront = MakeFurLeg( 0.03125f, 0.34375f, -0.46875f, -0.15625f );
FurLeftLegBack = MakeFurLeg( -0.34375f, -0.03125f, 0.28125f, 0.59375f );
FurRightLegBack = MakeFurLeg( 0.03125f, 0.34375f, 0.28125f, 0.59375f );
FurLeftLegFront = MakeFurLeg( -5.5f/16f, -0.5f/16f, -7.5f/16f, -2.5f/16f );
FurRightLegFront = MakeFurLeg( 0.5f/16f, 5.5f/16f, -7.5f/16f, -2.5f/16f );
FurLeftLegBack = MakeFurLeg( -5.5f/16f, -0.5f/16f, 4.5f/16f, 9.5f/16f );
FurRightLegBack = MakeFurLeg( 0.5f/16f, 5.5f/16f, 4.5f/16f, 9.5f/16f );
}
}
ModelPart MakeHead() {
return MakePart( 0, 0, 8, 6, 6, 8, 6, 6, -0.1875f, 0.1875f, 1f, 1.375f, -0.875f, -0.375f, false );
return MakePart( 0, 0, 8, 6, 6, 8, 6, 6, -3/16f, 3/16f, 1f, 22/16f, -14/16f, -6/16f, false );
}
ModelPart MakeTorso() {
return MakeRotatedPart( 28, 8, 6, 16, 8, 6, 8, 16, -0.25f, 0.25f, 0.75f, 1.125f, -0.5f, 0.5f, false );
return MakeRotatedPart( 28, 8, 6, 16, 8, 6, 8, 16, -4/16f, 4/16f, 12/16f, 18/16f, -8/16f, 8/16f, false );
}
ModelPart MakeFurHead() {
return MakePart( 0, 0, 6, 6, 6, 6, 6, 6, -0.21875f, 0.21875f, 0.96875f, 1.40625f, -0.78125f, -0.34375f, false );
return MakePart( 0, 0, 6, 6, 6, 6, 6, 6, -3.5f/16f, 3.5f/16f, 15.5f/16f, 1.40625f, -12.5f/16f, -5.5f/16f, false );
}
ModelPart MakeFurTorso() {
return MakeRotatedPart( 28, 8, 6, 16, 8, 6, 8, 16, -0.375f, 0.375f, 0.65625f, 1.21875f, -0.625f, 0.625f, false );
return MakeRotatedPart( 28, 8, 6, 16, 8, 6, 8, 16, -6/16f, 6/16f, 10.5f/16f, 1.21875f, -10/16f, 10/16f, false );
}
ModelPart MakeLeg( float x1, float x2, float z1, float z2 ) {
return MakePart( 0, 16, 4, 12, 4, 4, 4, 12, x1, x2, 0f, 0.75f, z1, z2, false );
return MakePart( 0, 16, 4, 12, 4, 4, 4, 12, x1, x2, 0f, 12/16f, z1, z2, false );
}
ModelPart MakeFurLeg( float x1, float x2, float z1, float z2 ) {
return MakePart( 0, 16, 4, 6, 4, 4, 4, 6, x1, x2, 0.34375f, 0.78125f, z1, z2, false );
return MakePart( 0, 16, 4, 6, 4, 4, 4, 6, x1, x2, 5.5f/16f, 12.5f/16f, z1, z2, false );
}
public override float NameYOffset {
@ -68,12 +68,12 @@ namespace ClassicalSharp.Model {
int texId = p.MobTextureId <= 0 ? cache.SheepTexId : p.MobTextureId;
graphics.BindTexture( texId );
DrawRotate( 0, 1.125f, -0.5f, -p.PitchRadians, 0, 0, Head );
DrawRotate( 0, 18/16f, -8/16f, -p.PitchRadians, 0, 0, Head );
DrawPart( Torso );
DrawRotate( 0, 0.75f, -0.3125f, p.leftLegXRot, 0, 0, LeftLegFront );
DrawRotate( 0, 0.75f, -0.3125f, p.rightLegXRot, 0, 0, RightLegFront );
DrawRotate( 0, 0.75f, 0.4375f, p.rightLegXRot, 0, 0, LeftLegBack );
DrawRotate( 0, 0.75f, 0.4375f, p.leftLegXRot, 0, 0, RightLegBack );
DrawRotate( 0, 12/16f, -5/16f, p.leftLegXRot, 0, 0, LeftLegFront );
DrawRotate( 0, 12/16f, -5/16f, p.rightLegXRot, 0, 0, RightLegFront );
DrawRotate( 0, 12/16f, 7/16f, p.rightLegXRot, 0, 0, LeftLegBack );
DrawRotate( 0, 12/16f, 7/16f, p.leftLegXRot, 0, 0, RightLegBack );
// Need to draw the two parts separately.
graphics.DrawDynamicIndexedVb( DrawMode.Triangles, cache.vb, cache.vertices, index, index * 6 / 4 );
graphics.AlphaTest = true;
@ -82,11 +82,11 @@ namespace ClassicalSharp.Model {
if( Fur ) {
graphics.BindTexture( cache.SheepFurTexId );
DrawPart( FurTorso );
DrawRotate( 0, 1.125f, -0.5f, -p.PitchRadians, 0, 0, FurHead );
DrawRotate( 0, 0.75f, -0.3125f, p.leftLegXRot, 0, 0, FurLeftLegFront );
DrawRotate( 0, 0.75f, -0.3125f, p.rightLegXRot, 0, 0, FurRightLegFront );
DrawRotate( 0, 0.75f, 0.4375f, p.rightLegXRot, 0, 0, FurLeftLegBack );
DrawRotate( 0, 0.75f, 0.4375f, p.leftLegXRot, 0, 0, FurRightLegBack );
DrawRotate( 0, 18/16f, -8/16f, -p.PitchRadians, 0, 0, FurHead );
DrawRotate( 0, 12/16f, -5/16f, p.leftLegXRot, 0, 0, FurLeftLegFront );
DrawRotate( 0, 12/16f, -5/16f, p.rightLegXRot, 0, 0, FurRightLegFront );
DrawRotate( 0, 12/16f, 7/16f, p.rightLegXRot, 0, 0, FurLeftLegBack );
DrawRotate( 0, 12/16f, 7/16f, p.leftLegXRot, 0, 0, FurRightLegBack );
}
}

View File

@ -9,34 +9,34 @@ namespace ClassicalSharp.Model {
vertices = new VertexPos3fTex2fCol4b[partVertices * 6];
Head = MakeHead();
Torso = MakeTorso();
LeftLeg = MakeLeftLeg( 0.1875f, 0.0625f );
RightLeg = MakeRightLeg( 0.0625f, 0.1875f );
LeftArm = MakeLeftArm( 0.375f, 0.25f );
RightArm = MakeRightArm( 0.25f, 0.375f );
LeftLeg = MakeLeftLeg( 3/16f, 1/16f );
RightLeg = MakeRightLeg( 1/16f, 3/16f );
LeftArm = MakeLeftArm( 6/16f, 4/16f );
RightArm = MakeRightArm( 4/16f, 6/16f );
}
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 );
return MakePart( 40, 16, 2, 12, 2, 2, 2, 12, -x2, -x1, 12/16f, 24/16f, -1/16f, 1/16f, 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 );
return MakePart( 40, 16, 2, 12, 2, 2, 2, 12, x1, x2, 12/16f, 24/16f, -1/16f, 1/16f, 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 );
return MakePart( 0, 0, 8, 8, 8, 8, 8, 8, -4/16f, 4/16f, 24/16f, 2f, -4/16f, 4/16f, 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 );
return MakePart( 16, 16, 4, 12, 8, 4, 8, 12, -4/16f, 4/16f, 12/16f, 24/16f, -2/16f, 2/16f, 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 );
return MakePart( 0, 16, 2, 12, 2, 2, 2, 12, -x2, -x1, 0f, 12/16f, -1/16f, 1/16f, 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 );
return MakePart( 0, 16, 2, 12, 2, 2, 2, 12, x1, x2, 0f, 12/16f, -1/16f, 1/16f, false );
}
public override float NameYOffset {
@ -57,12 +57,12 @@ namespace ClassicalSharp.Model {
int texId = p.MobTextureId <= 0 ? cache.SkeletonTexId : p.MobTextureId;
graphics.BindTexture( texId );
DrawRotate( 0, 1.5f, 0, -p.PitchRadians, 0, 0, Head );
DrawRotate( 0, 24/16f, 0, -p.PitchRadians, 0, 0, Head );
DrawPart( Torso );
DrawRotate( 0, 0.75f, 0, p.leftLegXRot, 0, 0, LeftLeg );
DrawRotate( 0, 0.75f, 0, p.rightLegXRot, 0, 0, RightLeg );
DrawRotate( 0, 1.375f, 0, (float)Math.PI / 2, 0, p.leftArmZRot, LeftArm );
DrawRotate( 0, 1.375f, 0, (float)Math.PI / 2, 0, p.rightArmZRot, RightArm );
DrawRotate( 0, 12/16f, 0, p.leftLegXRot, 0, 0, LeftLeg );
DrawRotate( 0, 12/16f, 0, p.rightLegXRot, 0, 0, RightLeg );
DrawRotate( 0, 22/16f, 0, (float)Math.PI / 2, 0, p.leftArmZRot, LeftArm );
DrawRotate( 0, 22/16f, 0, (float)Math.PI / 2, 0, p.rightArmZRot, RightArm );
}
ModelPart Head, Torso, LeftLeg, RightLeg, LeftArm, RightArm;

View File

@ -10,24 +10,24 @@ namespace ClassicalSharp.Model {
Head = MakeHead();
Link = MakeLink();
End = MakeEnd();
LeftLeg = MakeLeg( -1.1875f, -0.1875f );
RightLeg = MakeLeg( 0.1875f, 1.1875f );
LeftLeg = MakeLeg( -19/16f, -3/16f );
RightLeg = MakeLeg( 3/16f, 19/16f );
}
ModelPart MakeHead() {
return MakePart( 32, 4, 8, 8, 8, 8, 8, 8, -0.25f, 0.25f, 0.25f, 0.75f, -0.6875f, -0.1875f, false );
return MakePart( 32, 4, 8, 8, 8, 8, 8, 8, -4/16f, 4/16f, 4/16f, 12/16f, -11/16f, -3/16f, false );
}
ModelPart MakeLink() {
return MakePart( 0, 0, 6, 6, 6, 6, 6, 6, -0.1875f, 0.1875f, 0.3125f, 0.6875f, 0.1875f, -0.1875f, false );
return MakePart( 0, 0, 6, 6, 6, 6, 6, 6, -3/16f, 3/16f, 5/16f, 11/16f, 3/16f, -3/16f, false );
}
ModelPart MakeEnd() {
return MakePart( 0, 12, 12, 8, 10, 12, 10, 8, -0.3125f, 0.3125f, 0.25f, 0.75f, 0.1875f, 0.9375f, false );
return MakePart( 0, 12, 12, 8, 10, 12, 10, 8, -5/16f, 5/16f, 4/16f, 12/16f, 3/16f, 15/16f, false );
}
ModelPart MakeLeg( float x1, float x2 ) {
return MakePart( 18, 0, 2, 2, 16, 2, 16, 2, x1, x2, 0.4375f, 0.5625f, -0.0625f, 0.0625f, false );
return MakePart( 18, 0, 2, 2, 16, 2, 16, 2, x1, x2, 7/16f, 9/16f, -1/16f, 1/16f, false );
}
public override float NameYOffset {
@ -50,18 +50,18 @@ namespace ClassicalSharp.Model {
graphics.BindTexture( texId );
graphics.AlphaTest = true;
DrawRotate( 0, 0.5f, -0.1875f, -p.PitchRadians, 0, 0, Head );
DrawRotate( 0, 8/16f, -3/16f, -p.PitchRadians, 0, 0, Head );
DrawPart( Link );
DrawPart( End );
// TODO: leg animations
DrawRotate( -0.1875f, 0.5f, 0, 0, quarterPi, eighthPi, LeftLeg );
DrawRotate( -0.1875f, 0.5f, 0, 0, eighthPi, eighthPi, LeftLeg );
DrawRotate( -0.1875f, 0.5f, 0, 0, -eighthPi, eighthPi, LeftLeg );
DrawRotate( -0.1875f, 0.5f, 0, 0, -quarterPi, eighthPi, LeftLeg );
DrawRotate( 0.1875f, 0.5f, 0, 0, -quarterPi, -eighthPi, RightLeg );
DrawRotate( 0.1875f, 0.5f, 0, 0, -eighthPi, -eighthPi, RightLeg );
DrawRotate( 0.1875f, 0.5f, 0, 0, eighthPi, -eighthPi, RightLeg );
DrawRotate( 0.1875f, 0.5f, 0, 0, quarterPi, -eighthPi, RightLeg );
DrawRotate( -3/16f, 8/16f, 0, 0, quarterPi, eighthPi, LeftLeg );
DrawRotate( -3/16f, 8/16f, 0, 0, eighthPi, eighthPi, LeftLeg );
DrawRotate( -3/16f, 8/16f, 0, 0, -eighthPi, eighthPi, LeftLeg );
DrawRotate( -3/16f, 8/16f, 0, 0, -quarterPi, eighthPi, LeftLeg );
DrawRotate( 3/16f, 8/16f, 0, 0, -quarterPi, -eighthPi, RightLeg );
DrawRotate( 3/16f, 8/16f, 0, 0, -eighthPi, -eighthPi, RightLeg );
DrawRotate( 3/16f, 8/16f, 0, 0, eighthPi, -eighthPi, RightLeg );
DrawRotate( 3/16f, 8/16f, 0, 0, quarterPi, -eighthPi, RightLeg );
}
ModelPart Head, Link, End, LeftLeg, RightLeg;

View File

@ -10,34 +10,34 @@ namespace ClassicalSharp.Model {
vertices = new VertexPos3fTex2fCol4b[partVertices * 6];
Head = MakeHead();
Torso = MakeTorso();
LeftLeg = MakeLeftLeg( 0.25f, 0f );
RightLeg = MakeRightLeg( 0, 0.25f );
LeftArm = MakeLeftArm( 0.5f, 0.25f );
RightArm = MakeRightArm( 0.25f, 0.5f );
LeftLeg = MakeLeftLeg( 4/16f, 0f );
RightLeg = MakeRightLeg( 0, 4/16f );
LeftArm = MakeLeftArm( 8/16f, 4/16f );
RightArm = MakeRightArm( 4/16f, 8/16f );
}
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 );
return MakePart( 40, 16, 4, 12, 4, 4, 4, 12, -x2, -x1, 12/16f, 24/16f, -2/16f, 2/16f, 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 );
return MakePart( 40, 16, 4, 12, 4, 4, 4, 12, x1, x2, 12/16f, 24/16f, -2/16f, 2/16f, 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 );
return MakePart( 0, 0, 8, 8, 8, 8, 8, 8, -4/16f, 4/16f, 24/16f, 2f, -4/16f, 4/16f, 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 );
return MakePart( 16, 16, 4, 12, 8, 4, 8, 12, -4/16f, 4/16f, 12/16f, 24/16f, -2/16f, 2/16f, 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 );
return MakePart( 0, 16, 4, 12, 4, 4, 4, 12, -x2, -x1, 0f, 12/16f, -2/16f, 2/16f, 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 );
return MakePart( 0, 16, 4, 12, 4, 4, 4, 12, x1, x2, 0f, 12/16f, -2/16f, 2/16f, false );
}
public override float NameYOffset {
@ -57,12 +57,12 @@ namespace ClassicalSharp.Model {
int texId = p.MobTextureId <= 0 ? cache.ZombieTexId : p.MobTextureId;
graphics.BindTexture( texId );
DrawRotate( 0, 1.5f, 0, -p.PitchRadians, 0, 0, Head );
DrawRotate( 0, 24/16f, 0, -p.PitchRadians, 0, 0, Head );
DrawPart( Torso );
DrawRotate( 0, 0.75f, 0, p.leftLegXRot, 0, 0, LeftLeg );
DrawRotate( 0, 0.75f, 0, p.rightLegXRot, 0, 0, RightLeg );
DrawRotate( 0, 1.375f, 0, (float)Math.PI / 2, 0, p.leftArmZRot, LeftArm );
DrawRotate( 0, 1.375f, 0, (float)Math.PI / 2, 0, p.rightArmZRot, RightArm );
DrawRotate( 0, 12/16f, 0, p.leftLegXRot, 0, 0, LeftLeg );
DrawRotate( 0, 12/16f, 0, p.rightLegXRot, 0, 0, RightLeg );
DrawRotate( 0, 22/16f, 0, (float)Math.PI / 2, 0, p.leftArmZRot, LeftArm );
DrawRotate( 0, 22/16f, 0, (float)Math.PI / 2, 0, p.rightArmZRot, RightArm );
graphics.AlphaTest = true;
}

View File

@ -741,8 +741,8 @@ namespace ClassicalSharp {
float x = reader.ReadInt16() / 32f;
float y = ( reader.ReadInt16() - 51 ) / 32f; // We have to do this.
float z = reader.ReadInt16() / 32f;
float yaw = (float)Utils.PackedToDegrees( reader.ReadUInt8() );
float pitch = (float)Utils.PackedToDegrees( reader.ReadUInt8() );
float yaw = (float)Utils.PackedToDegrees( reader.ReadUInt8() ) + 100f;
float pitch = (float)Utils.PackedToDegrees( reader.ReadUInt8() ) + 50f;
if( playerId == 0xFF ) {
receivedFirstPosition = true;
}

View File

@ -31,8 +31,8 @@ namespace ClassicalSharp.Selections {
Min = Vector3I.Min( start, end );
Max = Vector3I.Max( start, end );
int index = 0;
Vector3 p1 = (Vector3)Min + new Vector3( 0.0625f, 0.0625f, 0.0625f );
Vector3 p2 = (Vector3)Max - new Vector3( 0.0625f, 0.0625f, 0.0625f );
Vector3 p1 = (Vector3)Min + new Vector3( 1/16f, 1/16f, 1/16f );
Vector3 p2 = (Vector3)Max - new Vector3( 1/16f, 1/16f, 1/16f );
RenderYPlane( ref index, p1.X, p1.Z, p2.X, p2.Z, p1.Y, col ); // bottom
RenderYPlane( ref index, p1.X, p1.Z, p2.X, p2.Z, p2.Y, col ); // top