mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 10:35:11 -04:00
Last model cleanup.
This commit is contained in:
parent
0a05980ad6
commit
1873fedfb4
@ -19,7 +19,7 @@ namespace ClassicalSharp {
|
||||
this.game = game;
|
||||
StepSize = 0.5f;
|
||||
SkinType = game.DefaultPlayerSkinType;
|
||||
SetModel( "chicken" );
|
||||
SetModel( "humanoid" );
|
||||
}
|
||||
|
||||
/// <summary> Gets the block just underneath the player's feet position. </summary>
|
||||
|
@ -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; }
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/// <summary>Builds a box model assuming the follow texture layout:<br/>
|
||||
/// let sW = sides width, bW = body width, bH = body height<br/>
|
||||
/// ┏━━━━━sW━━━━━┳━━━━━bW━━━━━┳━━━━━bW━━━━━┳━━━━━sW━━━━━┓ <br/>
|
||||
/// ┃s┈┈┈┈┈┈┈┈┈┈┈s┃w┈┈┈┈top┈┈┈┈s┃s┈┈bottom┈┈┈s┃s┈┈┈┈┈┈┈┈┈┈┈s┃ <br/>
|
||||
/// ┃W┈┈┈┈┈┈┈┈┈W┃W┈┈┈┈tex┈┈┈W┃W┈┈┈┈tex┈┈┈W┃W┈┈┈┈┈┈┈┈┈W┃ <br/>
|
||||
/// ┣━━━━━sW━━━━━╋━━━━━bW━━━━━╋━━━━━bW━━━━━╋━━━━━sW━━━━━┃ <br/>
|
||||
/// ┃b┈┈┈left┈┈┈┈┈b┃b┈┈front┈┈┈┈b┃b┈┈right┈┈┈┈b┃b┈┈┈back┈┈┈┈b┃ <br/>
|
||||
/// ┃H┈┈┈tex┈┈┈┈H┃H┈┈tex┈┈┈┈┈┈H┃H┈┈tex┈┈┈┈┈H┃H┈┈┈┈tex┈┈┈┈H┃ <br/>
|
||||
/// ┗━━━━━sW━━━━━┻━━━━━bW━━━━━┻━━━━━bW━━━━━┻━━━━━sW━━━━━┛ </summary>
|
||||
/// let SW = sides width, BW = body width, BH = body height<br/>
|
||||
/// ┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓ <br/>
|
||||
/// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
|
||||
/// ┃S┈┈┈┈┈┈┈┈┈┈┈S┃S┈┈┈┈top┈┈┈┈S┃S┈┈bottom┈┈┈S┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
|
||||
/// ┃W┈┈┈┈┈┈┈┈┈W┃W┈┈┈┈tex┈┈┈W┃W┈┈┈┈tex┈┈┈┈W┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
|
||||
/// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
|
||||
/// ┣━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━━━━━┃ <br/>
|
||||
/// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┃ <br/>
|
||||
/// ┃B┈┈┈left┈┈┈┈┈B┃B┈┈front┈┈┈┈B┃B┈┈┈right┈┈┈┈B┃B┈┈┈back┈┈┈B┃ <br/>
|
||||
/// ┃H┈┈┈tex┈┈┈┈┈H┃H┈┈tex┈┈┈┈┈H┃H┈┈┈tex┈┈┈┈┈H┃H┈┈┈┈tex┈┈┈H┃ <br/>
|
||||
/// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┃ <br/>
|
||||
/// ┗━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━┛ </summary>
|
||||
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 );
|
||||
}
|
||||
|
||||
/// <summary>Builds a box model assuming the follow texture layout:<br/>
|
||||
/// let SW = sides width, BW = body width, BH = body height<br/>
|
||||
/// ┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓ <br/>
|
||||
/// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
|
||||
/// ┃S┈┈┈┈┈┈┈┈┈┈┈S┃S┈┈┈┈front┈┈┈S┃S┈┈┈back┈┈┈┈S┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
|
||||
/// ┃W┈┈┈┈┈┈┈┈┈W┃W┈┈┈┈tex┈┈┈W┃W┈┈┈┈tex┈┈┈┈W┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
|
||||
/// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
|
||||
/// ┣━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━━━━━┃ <br/>
|
||||
/// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┃ <br/>
|
||||
/// ┃B┈┈┈left┈┈┈┈┈B┃B┈┈bottom┈┈B┃B┈┈┈right┈┈┈┈B┃B┈┈┈┈top┈┈┈B┃ <br/>
|
||||
/// ┃H┈┈┈tex┈┈┈┈┈H┃H┈┈tex┈┈┈┈┈H┃H┈┈┈tex┈┈┈┈┈H┃H┈┈┈┈tex┈┈┈H┃ <br/>
|
||||
/// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┃ <br/>
|
||||
/// ┗━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━┛ </summary>
|
||||
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 );
|
||||
|
@ -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; }
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user