mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-08 06:47:23 -04:00
Rewritten player model creation to be 99% more sane.
This commit is contained in:
parent
f920e05495
commit
adc784d2e7
@ -7,284 +7,95 @@ namespace ClassicalSharp.Entities {
|
||||
|
||||
public ModelSet Set64x32, Set64x64, Set64x64Slim;
|
||||
static readonly FastColour col = new FastColour( 178, 178, 178 );
|
||||
IGraphicsApi graphics;
|
||||
VertexPos3fTex2fCol4b[] vertices;
|
||||
int index = 0;
|
||||
|
||||
public PlayerModel( IGraphicsApi graphics ) {
|
||||
VertexPos3fTex2fCol4b[] buffer = new VertexPos3fTex2fCol4b[6 * 6];
|
||||
int index = 0;
|
||||
this.graphics = graphics;
|
||||
vertices = new VertexPos3fTex2fCol4b[6 * 6];
|
||||
Set64x32 = new ModelSet();
|
||||
Make64x32Parts( ref index, buffer, graphics );
|
||||
index = 0;
|
||||
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.Hat = MakeHat( false );
|
||||
|
||||
Set64x64 = new ModelSet();
|
||||
Make64x64Parts( ref index, buffer, graphics );
|
||||
index = 0;
|
||||
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.Hat = MakeHat( true );
|
||||
|
||||
Set64x64Slim = new ModelSet();
|
||||
Make64x64SlimParts( ref index, buffer, graphics );
|
||||
}
|
||||
|
||||
void Make64x32Parts( ref int index, VertexPos3fTex2fCol4b[] buffer, IGraphicsApi graphics ) {
|
||||
// Head
|
||||
YPlane64x32( 8, 0, 8, 8, 0.25f, -0.25f, 0.25f, -0.25f, 2.125f, ref index, buffer ); // head top
|
||||
YPlane64x32( 16, 0, 8, 8, 0.25f, -0.25f, -0.25f, 0.25f, 1.625f, ref index, buffer ); // head bottom
|
||||
ZPlane64x32( 8, 8, 8, 8, 0.25f, -0.25f, 1.625f, 2.125f, -0.25f, ref index, buffer ); // head front
|
||||
ZPlane64x32( 24, 8, 8, 8, -0.25f, 0.25f, 1.625f, 2.125f, 0.25f, ref index, buffer ); // head back
|
||||
XPlane64x32( 16, 8, 8, 8, -0.25f, 0.25f, 1.625f, 2.125f, -0.25f, ref index, buffer ); // head left
|
||||
XPlane64x32( 0, 8, 8, 8, 0.25f, -0.25f, 1.625f, 2.125f, 0.25f, ref index, buffer ); // head right
|
||||
Set64x32.Head = new ModelPart( buffer, graphics );
|
||||
// Torso
|
||||
index = 0;
|
||||
YPlane64x32( 20, 16, 8, 4, 0.25f, -0.25f, 0.125f, -0.125f, 1.625f, ref index, buffer ); // torso top
|
||||
YPlane64x32( 28, 16, 8, 4, 0.25f, -0.25f, -0.125f, 0.125f, 0.875f, ref index, buffer ); // torso bottom
|
||||
ZPlane64x32( 20, 20, 8, 12, 0.25f, -0.25f, 0.875f, 1.625f, -0.125f, ref index, buffer ); // torso front
|
||||
ZPlane64x32( 32, 20, 8, 12, -0.25f, 0.25f, 0.875f, 1.625f, 0.125f, ref index, buffer ); // torso back
|
||||
XPlane64x32( 28, 20, 4, 12, -0.125f, 0.125f, 0.875f, 1.625f, -0.25f, ref index, buffer ); // torso left
|
||||
XPlane64x32( 16, 20, 4, 12, 0.125f, -0.125f, 0.875f, 1.625f, 0.25f, ref index, buffer ); // torso right
|
||||
Set64x32.Torso = new ModelPart( buffer, graphics );
|
||||
// Left leg
|
||||
index = 0;
|
||||
YPlane64x32( 4, 16, 4, 4, -0.25f, 0f, 0.125f, -0.125f, 0.875f, ref index, buffer ); // left leg top
|
||||
YPlane64x32( 8, 16, 4, 4, -0.25f, 0f, -0.125f, 0.125f, 0f, ref index, buffer ); // left leg bottom
|
||||
ZPlane64x32( 4, 20, 4, 12, -0.25f, 0f, 0f, 0.875f, -0.125f, ref index, buffer ); // left leg front
|
||||
ZPlane64x32( 12, 20, 4, 12, 0f, -0.25f, 0f, 0.875f, 0.125f, ref index, buffer ); // left leg back
|
||||
XPlane64x32( 0, 20, 4, 12, 0.125f, -0.125f, 0f, 0.875f, -0.25f, ref index, buffer ); // left leg left
|
||||
XPlane64x32( 8, 20, 4, 12, -0.125f, 0.125f, 0f, 0.875f, 0f, ref index, buffer ); // left leg right
|
||||
Set64x32.LeftLeg = new ModelPart( buffer, graphics );
|
||||
// Right leg
|
||||
index = 0;
|
||||
YPlane64x32( 4, 16, 4, 4, 0.25f, 0f, 0.125f, -0.125f, 0.875f, ref index, buffer ); // right leg top
|
||||
YPlane64x32( 8, 16, 4, 4, 0.25f, 0f, -0.125f, 0.125f, 0f, ref index, buffer ); // right leg bottom
|
||||
ZPlane64x32( 4, 20, 4, 12, 0.25f, 0f, 0f, 0.875f, -0.125f, ref index, buffer ); // right leg front
|
||||
ZPlane64x32( 12, 20, 4, 12, 0f, 0.25f, 0f, 0.875f, 0.125f, ref index, buffer ); // right leg back
|
||||
XPlane64x32( 8, 20, 4, 12, -0.125f, 0.125f, 0f, 0.875f, 0f, ref index, buffer ); // right leg left
|
||||
XPlane64x32( 0, 20, 4, 12, 0.125f, -0.125f, 0f, 0.875f, 0.25f, ref index, buffer ); // right leg right
|
||||
Set64x32.RightLeg = new ModelPart( buffer, graphics );
|
||||
// Left arm
|
||||
index = 0;
|
||||
YPlane64x32( 44, 16, 4, 4, -0.5f, -0.25f, 0.125f, -0.125f, 1.625f, ref index, buffer ); // left arm top
|
||||
YPlane64x32( 48, 16, 4, 4, -0.5f, -0.25f, -0.125f, 0.125f, 0.875f, ref index, buffer ); // left arm bottom
|
||||
ZPlane64x32( 44, 20, 4, 12, -0.5f, -0.25f, 0.875f, 1.625f, -0.125f, ref index, buffer ); // left arm front
|
||||
ZPlane64x32( 52, 20, 4, 12, -0.25f, -0.5f, 0.875f, 1.625f, 0.125f, ref index, buffer ); // left arm back
|
||||
XPlane64x32( 40, 20, 4, 12, 0.125f, -0.125f, 0.875f, 1.625f, -0.5f, ref index, buffer ); // left arm left
|
||||
XPlane64x32( 48, 20, 4, 12, -0.125f, 0.125f, 0.875f, 1.625f, -0.25f, ref index, buffer ); // left arm right
|
||||
Set64x32.LeftArm = new ModelPart( buffer, graphics );
|
||||
// Right arm
|
||||
index = 0;
|
||||
YPlane64x32( 44, 16, 4, 4, 0.5f, 0.25f, 0.125f, -0.125f, 1.625f, ref index, buffer ); // right arm top
|
||||
YPlane64x32( 48, 16, 4, 4, 0.5f, 0.25f, -0.125f, 0.125f, 0.875f, ref index, buffer ); // right arm bottom
|
||||
ZPlane64x32( 44, 20, 4, 12, 0.5f, 0.25f, 0.875f, 1.625f, -0.125f, ref index, buffer ); // right arm front
|
||||
ZPlane64x32( 52, 20, 4, 12, 0.25f, 0.5f, 0.875f, 1.625f, 0.125f, ref index, buffer ); // right arm back
|
||||
XPlane64x32( 48, 20, 4, 12, -0.125f, 0.125f, 0.875f, 1.625f, 0.25f, ref index, buffer ); // right arm left
|
||||
XPlane64x32( 40, 20, 4, 12, 0.125f, -0.125f, 0.875f, 1.625f, 0.5f, ref index, buffer ); // right arm right
|
||||
Set64x32.RightArm = new ModelPart( buffer, graphics );
|
||||
// Hat
|
||||
index = 0;
|
||||
YPlane64x32( 40, 0, 8, 8, 0.3125f, -0.3125f, 0.3125f, -0.3125f, 2.1875f, ref index, buffer ); // hat top
|
||||
YPlane64x32( 48, 0, 8, 8, 0.3125f, -0.3125f, -0.3125f, 0.3125f, 1.5625f, ref index, buffer ); // hat bottom
|
||||
ZPlane64x32( 40, 8, 8, 8, 0.3125f, -0.3125f, 1.5625f, 2.1875f, -0.3125f, ref index, buffer ); // hat front
|
||||
ZPlane64x32( 56, 8, 8, 8, -0.3125f, 0.3125f, 1.5625f, 2.1875f, 0.3125f, ref index, buffer ); // hat back
|
||||
XPlane64x32( 48, 8, 8, 8, -0.3125f, 0.3125f, 1.5625f, 2.1875f, -0.3125f, ref index, buffer ); // hat left
|
||||
XPlane64x32( 32, 8, 8, 8, 0.3125f, -0.3125f, 1.5625f, 2.1875f, 0.3125f, ref index, buffer ); // hat right
|
||||
Set64x32.Hat = new ModelPart( buffer, graphics );
|
||||
}
|
||||
|
||||
void Make64x64Parts( ref int index, VertexPos3fTex2fCol4b[] buffer, IGraphicsApi graphics ) {
|
||||
// Head
|
||||
YPlane64x64( 8, 0, 8, 8, 0.25f, -0.25f, 0.25f, -0.25f, 2.125f, ref index, buffer ); // head top
|
||||
YPlane64x64( 16, 0, 8, 8, 0.25f, -0.25f, 00.25f, 0.25f, 1.625f, ref index, buffer ); // head bottom
|
||||
ZPlane64x64( 8, 8, 8, 8, 0.25f, -0.25f, 1.625f, 2.125f, -0.25f, ref index, buffer ); // head front
|
||||
ZPlane64x64( 24, 8, 8, 8, -0.25f, 0.25f, 1.625f, 2.125f, 0.25f, ref index, buffer ); // head back
|
||||
XPlane64x64( 16, 8, 8, 8, -0.25f, 0.25f, 1.625f, 2.125f, -0.25f, ref index, buffer ); // head left
|
||||
XPlane64x64( 0, 8, 8, 8, 0.25f, -0.25f, 1.625f, 2.125f, 0.25f, ref index, buffer ); // head right
|
||||
Set64x64.Head = new ModelPart( buffer, graphics );
|
||||
// Torso
|
||||
index = 0;
|
||||
YPlane64x64( 20, 16, 8, 4, 0.25f, -0.25f, 0.125f, -0.125f, 1.625f, ref index, buffer ); // torso top
|
||||
YPlane64x64( 28, 16, 8, 4, 0.25f, -0.25f, -0.125f, 0.125f, 0.875f, ref index, buffer ); // torso bottom
|
||||
ZPlane64x64( 20, 20, 8, 12, 0.25f, -0.25f, 0.875f, 1.625f, -0.125f, ref index, buffer ); // torso front
|
||||
ZPlane64x64( 32, 20, 8, 12, -0.25f, 0.25f, 0.875f, 1.625f, 0.125f, ref index, buffer ); // torso back
|
||||
XPlane64x64( 28, 20, 4, 12, -0.125f, 0.125f, 0.875f, 1.625f, -0.25f, ref index, buffer ); // torso left
|
||||
XPlane64x64( 16, 20, 4, 12, 0.125f, -0.125f, 0.875f, 1.625f, 0.25f, ref index, buffer ); // torso right
|
||||
Set64x64.Torso = new ModelPart( buffer, graphics );
|
||||
// Left leg
|
||||
index = 0;
|
||||
YPlane64x64( 20, 48, 4, 4, 0f, -0.25f, 0.125f, -0.125f, 0.875f, ref index, buffer ); // left leg top
|
||||
YPlane64x64( 24, 48, 4, 4, 0f, -0.25f, -0.125f, 0.125f, 0f, ref index, buffer ); // left leg bottom
|
||||
ZPlane64x64( 20, 52, 4, 12, 0f, -0.25f, 0f, 0.875f, -0.125f, ref index, buffer ); // left leg front
|
||||
ZPlane64x64( 28, 52, 4, 12, -0.25f, 0f, 0f, 0.875f, 0.125f, ref index, buffer ); // left leg back
|
||||
XPlane64x64( 24, 52, 4, 12, -0.125f, 0.125f, 0f, 0.875f, -0.25f, ref index, buffer ); // left leg left
|
||||
XPlane64x64( 16, 52, 4, 12, 0.125f, -0.125f, 0f, 0.875f, 0f, ref index, buffer ); // left leg right
|
||||
Set64x64.LeftLeg = new ModelPart( buffer, graphics );
|
||||
// Right leg
|
||||
index = 0;
|
||||
YPlane64x64( 4, 16, 4, 4, 0.25f, 0f, 0.125f, -0.125f, 0.875f, ref index, buffer ); // right leg top
|
||||
YPlane64x64( 8, 16, 4, 4, 0.25f, 0f, -0.125f, 0.125f, 0f, ref index, buffer ); // right leg bottom
|
||||
ZPlane64x64( 4, 20, 4, 12, 0.25f, 0f, 0f, 0.875f, -0.125f, ref index, buffer ); // right leg front
|
||||
ZPlane64x64( 12, 20, 4, 12, 0f, 0.25f, 0f, 0.875f, 0.125f, ref index, buffer ); // right leg back
|
||||
XPlane64x64( 8, 20, 4, 12, -0.125f, 0.125f, 0f, 0.875f, 0f, ref index, buffer ); // right leg left
|
||||
XPlane64x64( 0, 20, 4, 12, 0.125f, -0.125f, 0f, 0.875f, 0.25f, ref index, buffer ); // right leg right
|
||||
Set64x64.RightLeg = new ModelPart( buffer, graphics );
|
||||
// Left arm
|
||||
index = 0;
|
||||
YPlane64x64( 36, 48, 4, 4, -0.25f, -0.5f, 0.125f, -0.125f, 1.625f, ref index, buffer ); // left arm top
|
||||
YPlane64x64( 40, 48, 4, 4, -0.25f, -0.5f, -0.125f, 0.125f, 0.875f, ref index, buffer ); // left arm bottom
|
||||
ZPlane64x64( 36, 52, 4, 12, -0.25f, -0.5f, 0.875f, 1.625f, -0.125f, ref index, buffer ); // left arm front
|
||||
ZPlane64x64( 44, 52, 4, 12, -0.5f, -0.25f, 0.875f, 1.625f, 0.125f, ref index, buffer ); // left arm back
|
||||
XPlane64x64( 40, 52, 4, 12, -0.125f, 0.125f, 0.875f, 1.625f, -0.5f, ref index, buffer ); // left arm left
|
||||
XPlane64x64( 32, 52, 4, 12, 0.125f, -0.125f, 0.875f, 1.625f, -0.25f, ref index, buffer ); // left arm right
|
||||
Set64x64.LeftArm = new ModelPart( buffer, graphics );
|
||||
// Right arm
|
||||
index = 0;
|
||||
YPlane64x64( 44, 16, 4, 4, 0.5f, 0.25f, 0.125f, -0.125f, 1.625f, ref index, buffer ); // right arm top
|
||||
YPlane64x64( 48, 16, 4, 4, 0.5f, 0.25f, -0.125f, 0.125f, 0.875f, ref index, buffer ); // right arm bottom
|
||||
ZPlane64x64( 44, 20, 4, 12, 0.5f, 0.25f, 0.875f, 1.625f, -0.125f, ref index, buffer ); // right arm front
|
||||
ZPlane64x64( 52, 20, 4, 12, 0.25f, 0.5f, 0.875f, 1.625f, 0.125f, ref index, buffer ); // right arm back
|
||||
XPlane64x64( 48, 20, 4, 12, -0.125f, 0.125f, 0.875f, 1.625f, 0.25f, ref index, buffer ); // right arm left
|
||||
XPlane64x64( 40, 20, 4, 12, 0.125f, -0.125f, 0.875f, 1.625f, 0.5f, ref index, buffer ); // right arm right
|
||||
Set64x64.RightArm = new ModelPart( buffer, graphics );
|
||||
// Hat
|
||||
index = 0;
|
||||
YPlane64x64( 40, 0, 8, 8, 0.3125f, -0.3125f, 0.3125f, -0.3125f, 2.1875f, ref index, buffer ); // hat top
|
||||
YPlane64x64( 48, 0, 8, 8, 0.3125f, -0.3125f, -0.3125f, 0.3125f, 1.5625f, ref index, buffer ); // hat bottom
|
||||
ZPlane64x64( 40, 8, 8, 8, 0.3125f, -0.3125f, 1.5625f, 2.1875f, -0.3125f, ref index, buffer ); // hat front
|
||||
ZPlane64x64( 56, 8, 8, 8, -0.3125f, 0.3125f, 1.5625f, 2.1875f, 0.3125f, ref index, buffer ); // hat back
|
||||
XPlane64x64( 48, 8, 8, 8, -0.3125f, 0.3125f, 1.5625f, 2.1875f, -0.3125f, ref index, buffer ); // hat left
|
||||
XPlane64x64( 32, 8, 8, 8, 0.3125f, -0.3125f, 1.5625f, 2.1875f, 0.3125f, ref index, buffer ); // hat right
|
||||
Set64x64.Hat = new ModelPart( buffer, graphics );
|
||||
}
|
||||
|
||||
void Make64x64SlimParts( ref int index, VertexPos3fTex2fCol4b[] buffer, IGraphicsApi graphics ) {
|
||||
// Head
|
||||
YPlane64x64( 8, 0, 8, 8, 0.25f, -0.25f, 0.25f, -0.25f, 2.125f, ref index, buffer ); // head top
|
||||
YPlane64x64( 16, 0, 8, 8, 0.25f, -0.25f, -0.25f, 0.25f, 1.625f, ref index, buffer ); // head bottom
|
||||
ZPlane64x64( 8, 8, 8, 8, 0.25f, -0.25f, 1.625f, 2.125f, -0.25f, ref index, buffer ); // head front
|
||||
ZPlane64x64( 24, 8, 8, 8, -0.25f, 0.25f, 1.625f, 2.125f, 0.25f, ref index, buffer ); // head back
|
||||
XPlane64x64( 16, 8, 8, 8, -0.25f, 0.25f, 1.625f, 2.125f, -0.25f, ref index, buffer ); // head left
|
||||
XPlane64x64( 0, 8, 8, 8, 0.25f, -0.25f, 1.625f, 2.125f, 0.25f, ref index, buffer ); // head right
|
||||
Set64x64Slim.Head = new ModelPart( buffer, graphics );
|
||||
// Torso
|
||||
index = 0;
|
||||
YPlane64x64( 20, 16, 8, 4, 0.25f, -0.25f, 0.125f, -0.125f, 1.625f, ref index, buffer ); // torso top
|
||||
YPlane64x64( 28, 16, 8, 4, 0.25f, -0.25f, -0.125f, 0.125f, 0.875f, ref index, buffer ); // torso bottom
|
||||
ZPlane64x64( 20, 20, 8, 12, 0.25f, -0.25f, 0.875f, 1.625f, -0.125f, ref index, buffer ); // torso front
|
||||
ZPlane64x64( 32, 20, 8, 12, -0.25f, 0.25f, 0.875f, 1.625f, 0.125f, ref index, buffer ); // torso back
|
||||
XPlane64x64( 28, 20, 4, 12, -0.125f, 0.125f, 0.875f, 1.625f, -0.25f, ref index, buffer ); // torso left
|
||||
XPlane64x64( 16, 20, 4, 12, 0.125f, -0.125f, 0.875f, 1.625f, 0.25f, ref index, buffer ); // torso right
|
||||
Set64x64Slim.Torso = new ModelPart( buffer, graphics );
|
||||
// Left leg
|
||||
index = 0;
|
||||
YPlane64x64( 20, 48, 4, 4, 0f, -0.25f, 0.125f, -0.125f, 0.875f, ref index, buffer ); // left leg top
|
||||
YPlane64x64( 24, 48, 4, 4, 0f, -0.25f, -0.125f, 0.125f, 0f, ref index, buffer ); // left leg bottom
|
||||
ZPlane64x64( 20, 52, 4, 12, 0f, -0.25f, 0f, 0.875f, -0.125f, ref index, buffer ); // left leg front
|
||||
ZPlane64x64( 28, 52, 4, 12, -0.25f, 0f, 0f, 0.875f, 0.125f, ref index, buffer ); // left leg back
|
||||
XPlane64x64( 24, 52, 4, 12, -0.125f, 0.125f, 0f, 0.875f, -0.25f, ref index, buffer ); // left leg left
|
||||
XPlane64x64( 16, 52, 4, 12, 0.125f, -0.125f, 0f, 0.875f, 0f, ref index, buffer ); // left leg right
|
||||
Set64x64Slim.LeftLeg = new ModelPart( buffer, graphics );
|
||||
// Right leg
|
||||
index = 0;
|
||||
YPlane64x64( 4, 16, 4, 4, 0.25f, 0f, 0.125f, -0.125f, 0.875f, ref index, buffer ); // right leg top
|
||||
YPlane64x64( 8, 16, 4, 4, 0.25f, 0f, -0.125f, 0.125f, 0f, ref index, buffer ); // right leg bottom
|
||||
ZPlane64x64( 4, 20, 4, 12, 0.25f, 0f, 0f, 0.875f, -0.125f, ref index, buffer ); // right leg front
|
||||
ZPlane64x64( 12, 20, 4, 12, 0f, 0.25f, 0f, 0.875f, 0.125f, ref index, buffer ); // right leg back
|
||||
XPlane64x64( 8, 20, 4, 12, -0.125f, 0.125f, 0f, 0.875f, 0f, ref index, buffer ); // right leg left
|
||||
XPlane64x64( 0, 20, 4, 12, 0.125f, -0.125f, 0f, 0.875f, 0.25f, ref index, buffer ); // right leg right
|
||||
Set64x64Slim.RightLeg = new ModelPart( buffer, graphics );
|
||||
// Left arm
|
||||
index = 0;
|
||||
YPlane64x64( 36, 48, 3, 4, -0.25f, -0.4375f, 0.125f, -0.125f, 1.625f, ref index, buffer ); // left arm top
|
||||
YPlane64x64( 39, 48, 3, 4, -0.25f, -0.4375f, -0.125f, 0.125f, 0.875f, ref index, buffer ); // left arm bottom
|
||||
ZPlane64x64( 36, 52, 3, 12, -0.25f, -0.4375f, 0.875f, 1.625f, -0.125f, ref index, buffer ); // left arm front
|
||||
ZPlane64x64( 43, 52, 3, 12, -0.4375f, -0.25f, 0.875f, 1.625f, 0.125f, ref index, buffer ); // left arm back
|
||||
XPlane64x64( 39, 52, 4, 12, -0.125f, 0.125f, 0.875f, 1.625f, -0.4375f, ref index, buffer ); // left arm left
|
||||
XPlane64x64( 32, 52, 4, 12, 0.125f, -0.125f, 0.875f, 1.625f, -0.25f, ref index, buffer ); // left arm right
|
||||
Set64x64Slim.LeftArm = new ModelPart( buffer, graphics );
|
||||
// Right arm
|
||||
index = 0;
|
||||
YPlane64x64( 44, 16, 3, 4, 0.4375f, 0.25f, 0.125f, -0.125f, 1.625f, ref index, buffer ); // right arm top
|
||||
YPlane64x64( 47, 16, 3, 4, 0.4375f, 0.25f, -0.125f, 0.125f, 0.875f, ref index, buffer ); // right arm bottom
|
||||
ZPlane64x64( 44, 20, 3, 12, 0.4375f, 0.25f, 0.875f, 1.625f, -0.125f, ref index, buffer ); // right arm front
|
||||
ZPlane64x64( 51, 20, 3, 12, 0.25f, 0.4375f, 0.875f, 1.625f, 0.125f, ref index, buffer ); // right arm back
|
||||
XPlane64x64( 47, 20, 4, 12, -0.125f, 0.125f, 0.875f, 1.625f, 0.25f, ref index, buffer ); // right arm left
|
||||
XPlane64x64( 40, 20, 4, 12, 0.125f, -0.125f, 0.875f, 1.625f, 0.4375f, ref index, buffer ); // right arm right
|
||||
Set64x64Slim.RightArm = new ModelPart( buffer, graphics );
|
||||
// Hat
|
||||
index = 0;
|
||||
YPlane64x64( 40, 0, 8, 8, 0.3125f, -0.3125f, 0.3125f, -0.3125f, 2.1875f, ref index, buffer ); // hat top
|
||||
YPlane64x64( 48, 0, 8, 8, 0.3125f, -0.3125f, -0.3125f, 0.3125f, 1.5625f, ref index, buffer ); // hat bottom
|
||||
ZPlane64x64( 40, 8, 8, 8, 0.3125f, -0.3125f, 1.5625f, 2.1875f, -0.3125f, ref index, buffer ); // hat front
|
||||
ZPlane64x64( 56, 8, 8, 8, -0.3125f, 0.3125f, 1.5625f, 2.1875f, 0.3125f, ref index, buffer ); // hat back
|
||||
XPlane64x64( 48, 8, 8, 8, -0.3125f, 0.3125f, 1.5625f, 2.1875f, -0.3125f, ref index, buffer ); // hat left
|
||||
XPlane64x64( 32, 8, 8, 8, 0.3125f, -0.3125f, 1.5625f, 2.1875f, 0.3125f, ref index, buffer ); // hat right
|
||||
Set64x64Slim.Hat = new ModelPart( buffer, graphics );
|
||||
Set64x64Slim.Head = MakeHead( true );
|
||||
Set64x64Slim.Torso = MakeTorso( true );
|
||||
Set64x64Slim.LeftLeg = MakeLeftLeg( 16, 48, 0, 0.25f, true );
|
||||
Set64x64Slim.RightLeg = MakeRightLeg( 0, 16, 0, 0.25f, true );
|
||||
Set64x64Slim.LeftArm = MakeLeftArm( 32, 48, 0.25f, 0.4375f, 3, true );
|
||||
Set64x64Slim.RightArm = MakeRightArm( 40, 16, 0.25f, 0.4375f, 3, true );
|
||||
Set64x64Slim.Hat = MakeHat( true );
|
||||
vertices = null;
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
Set64x32.Dispose();
|
||||
Set64x64.Dispose();
|
||||
Set64x64Slim.Dispose();
|
||||
}
|
||||
|
||||
ModelPart MakeLeftArm( int x, int y, float x1, float x2, int width, bool _64x64 ) {
|
||||
return MakePart( x, y, 4, 12, width, 4, width, 12, -x2, -x1, 0.875f, 1.625f, -0.125f, 0.125f, _64x64 );
|
||||
}
|
||||
|
||||
ModelPart MakeRightArm( int x, int y, float x1, float x2, int width, bool _64x64 ) {
|
||||
return MakePart( x, y, 4, 12, width, 4, width, 12, x1, x2, 0.875f, 1.625f, -0.125f, 0.125f, _64x64 );
|
||||
}
|
||||
|
||||
ModelPart MakeHead( bool _64x64 ) {
|
||||
return MakePart( 0, 0, 8, 8, 8, 8, 8, 8, -0.25f, 0.25f, 1.625f, 2.125f, -0.25f, 0.25f, _64x64 );
|
||||
}
|
||||
|
||||
ModelPart MakeTorso( bool _64x64 ) {
|
||||
return MakePart( 16, 16, 4, 12, 8, 4, 8, 12, -0.25f, 0.25f, 0.875f, 1.625f, -0.125f, 0.125f, _64x64 );
|
||||
}
|
||||
|
||||
ModelPart MakeHat( bool _64x64 ) {
|
||||
return MakePart( 32, 0, 8, 8, 8, 8, 8, 8, -0.3125f, 0.3125f, 1.5625f, 2.18775f, -0.3125f, 0.3125f, _64x64 );
|
||||
}
|
||||
|
||||
static TextureRectangle GetSkinTexCoords64x32( int x, int y, int width, int height ) {
|
||||
TextureRectangle rec;
|
||||
rec.U1 = x / 64f;
|
||||
rec.U2 = ( x + width ) / 64f;
|
||||
rec.V1 = y / 32f;
|
||||
rec.V2 = ( y + height ) / 32f;
|
||||
return rec;
|
||||
ModelPart MakeLeftLeg( int x, int y, float x1, float x2, bool _64x64 ) {
|
||||
return MakePart( x, y, 4, 12, 4, 4, 4, 12, -x2, -x1, 0f, 0.875f, -0.125f, 0.125f, _64x64 );
|
||||
}
|
||||
|
||||
static TextureRectangle GetSkinTexCoords64x64( int x, int y, int width, int height ) {
|
||||
TextureRectangle rec;
|
||||
rec.U1 = x / 64f;
|
||||
rec.U2 = ( x + width ) / 64f;
|
||||
rec.V1 = y / 64f;
|
||||
rec.V2 = ( y + height ) / 64f;
|
||||
return rec;
|
||||
ModelPart MakeRightLeg( int x, int y, float x1, float x2, bool _64x64 ) {
|
||||
return MakePart( x, y, 4, 12, 4, 4, 4, 12, x1, x2, 0f, 0.875f, -0.125f, 0.125f, _64x64 );
|
||||
}
|
||||
|
||||
static void XPlane64x32( int texX, int texY, int texWidth, int texHeight,
|
||||
float z1, float z2, float y1, float y2, float x,
|
||||
ref int index, VertexPos3fTex2fCol4b[] vertices ) {
|
||||
TextureRectangle rec = GetSkinTexCoords64x32( texX, texY, texWidth, texHeight );
|
||||
XPlane( rec, z1, z2, y1, y2, x, ref index, vertices );
|
||||
ModelPart MakePart( int x, int y, int sidesW, int sidesH, int endsW, int endsH, int bodyW, int bodyH,
|
||||
float x1, float x2, float y1, float y2, float z1, float z2, bool _64x64 ) {
|
||||
index = 0;
|
||||
YPlane( x + sidesW, y, endsW, endsH, x2, x1, z2, z1, y2, _64x64 ); // top
|
||||
YPlane( x + sidesW + bodyW, y, endsW, endsH, x2, x1, z1, z2, y1, _64x64 ); // bottom
|
||||
ZPlane( x + sidesW, y + endsH, bodyW, bodyH, x2, x1, y1, y2, z1, _64x64 ); // front
|
||||
ZPlane( x + sidesW + bodyW + sidesW, y + endsH, bodyW, bodyH, x1, x2, y1, y2, z2, _64x64 ); // back
|
||||
XPlane( x + sidesW + bodyW, y + endsH, sidesW, sidesH, z1, z2, y1, y2, x1, _64x64 ); // left
|
||||
XPlane( x, y + endsH, sidesW, sidesH, z2, z1, y1, y2, x2, _64x64 ); // right
|
||||
return new ModelPart( vertices, graphics );
|
||||
}
|
||||
|
||||
static void YPlane64x32( int texX, int texY, int texWidth, int texHeight,
|
||||
float x1, float x2, float z1, float z2, float y,
|
||||
ref int index, VertexPos3fTex2fCol4b[] vertices ) {
|
||||
TextureRectangle rec = GetSkinTexCoords64x32( texX, texY, texWidth, texHeight );
|
||||
YPlane( rec, x1, x2, z1, z2, y, ref index, vertices );
|
||||
static TextureRectangle SkinTexCoords( int x, int y, int width, int height, float skinWidth, float skinHeight ) {
|
||||
return new TextureRectangle( x / skinWidth, y / skinHeight, width / skinWidth, height / skinHeight );
|
||||
}
|
||||
|
||||
static void ZPlane64x32( int texX, int texY, int texWidth, int texHeight,
|
||||
float x1, float x2, float y1, float y2, float z,
|
||||
ref int index, VertexPos3fTex2fCol4b[] vertices ) {
|
||||
TextureRectangle rec = GetSkinTexCoords64x32( texX, texY, texWidth, texHeight );
|
||||
ZPlane( rec, x1, x2, y1, y2, z, ref index, vertices );
|
||||
}
|
||||
|
||||
static void XPlane64x64( int texX, int texY, int texWidth, int texHeight,
|
||||
float z1, float z2, float y1, float y2, float x,
|
||||
ref int index, VertexPos3fTex2fCol4b[] vertices ) {
|
||||
TextureRectangle rec = GetSkinTexCoords64x64( texX, texY, texWidth, texHeight );
|
||||
XPlane( rec, z1, z2, y1, y2, x, ref index, vertices );
|
||||
}
|
||||
|
||||
static void YPlane64x64( int texX, int texY, int texWidth, int texHeight,
|
||||
float x1, float x2, float z1, float z2, float y,
|
||||
ref int index, VertexPos3fTex2fCol4b[] vertices ) {
|
||||
TextureRectangle rec = GetSkinTexCoords64x64( texX, texY, texWidth, texHeight );
|
||||
YPlane( rec, x1, x2, z1, z2, y, ref index, vertices );
|
||||
}
|
||||
|
||||
static void ZPlane64x64( int texX, int texY, int texWidth, int texHeight,
|
||||
float x1, float x2, float y1, float y2, float z,
|
||||
ref int index, VertexPos3fTex2fCol4b[] vertices ) {
|
||||
TextureRectangle rec = GetSkinTexCoords64x64( texX, texY, texWidth, texHeight );
|
||||
ZPlane( rec, x1, x2, y1, y2, z, ref index, vertices );
|
||||
}
|
||||
|
||||
static void XPlane( TextureRectangle rec,
|
||||
float z1, float z2, float y1, float y2, float x,
|
||||
ref int index, VertexPos3fTex2fCol4b[] vertices ) {
|
||||
void XPlane( int texX, int texY, int texWidth, int texHeight,
|
||||
float z1, float z2, float y1, float y2, float x, bool _64x64 ) {
|
||||
TextureRectangle rec = SkinTexCoords( texX, texY, texWidth, texHeight, 64, _64x64 ? 64 : 32 );
|
||||
vertices[index++] = new VertexPos3fTex2fCol4b( x, y1, z1, rec.U1, rec.V2, col );
|
||||
vertices[index++] = new VertexPos3fTex2fCol4b( x, y2, z1, rec.U1, rec.V1, col );
|
||||
vertices[index++] = new VertexPos3fTex2fCol4b( x, y2, z2, rec.U2, rec.V1, col );
|
||||
@ -294,9 +105,9 @@ namespace ClassicalSharp.Entities {
|
||||
vertices[index++] = new VertexPos3fTex2fCol4b( x, y1, z1, rec.U1, rec.V2, col );
|
||||
}
|
||||
|
||||
static void YPlane( TextureRectangle rec,
|
||||
float x1, float x2, float z1, float z2, float y,
|
||||
ref int index, VertexPos3fTex2fCol4b[] vertices ) {
|
||||
void YPlane( int texX, int texY, int texWidth, int texHeight,
|
||||
float x1, float x2, float z1, float z2, float y, bool _64x64 ) {
|
||||
TextureRectangle rec = SkinTexCoords( texX, texY, texWidth, texHeight, 64, _64x64 ? 64 : 32 );
|
||||
vertices[index++] = new VertexPos3fTex2fCol4b( x1, y, z1, rec.U1, rec.V1, col );
|
||||
vertices[index++] = new VertexPos3fTex2fCol4b( x2, y, z1, rec.U2, rec.V1, col );
|
||||
vertices[index++] = new VertexPos3fTex2fCol4b( x2, y, z2, rec.U2, rec.V2, col );
|
||||
@ -306,9 +117,9 @@ namespace ClassicalSharp.Entities {
|
||||
vertices[index++] = new VertexPos3fTex2fCol4b( x1, y, z1, rec.U1, rec.V1, col );
|
||||
}
|
||||
|
||||
static void ZPlane( TextureRectangle rec,
|
||||
float x1, float x2, float y1, float y2, float z,
|
||||
ref int index, VertexPos3fTex2fCol4b[] vertices ) {
|
||||
void ZPlane( int texX, int texY, int texWidth, int texHeight,
|
||||
float x1, float x2, float y1, float y2, float z, bool _64x64 ) {
|
||||
TextureRectangle rec = SkinTexCoords( texX, texY, texWidth, texHeight, 64, _64x64 ? 64 : 32 );
|
||||
vertices[index++] = new VertexPos3fTex2fCol4b( x1, y1, z, rec.U1, rec.V2, col );
|
||||
vertices[index++] = new VertexPos3fTex2fCol4b( x2, y1, z, rec.U2, rec.V2, col );
|
||||
vertices[index++] = new VertexPos3fTex2fCol4b( x2, y2, z, rec.U2, rec.V1, col );
|
||||
|
Loading…
x
Reference in New Issue
Block a user