mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 12:35:52 -04:00
Add giant model. (Thanks tornato)
This commit is contained in:
parent
95447bbe25
commit
4e9f92d378
@ -169,8 +169,8 @@
|
||||
<Compile Include="Generator\NotchyGenerator.Utils.cs" />
|
||||
<Compile Include="GraphicsAPI\OpenGLESApi.cs" />
|
||||
<Compile Include="Map\Formats\MapCw.Nbt.cs" />
|
||||
<Compile Include="Model\ChibiModel.cs" />
|
||||
<Compile Include="Model\CustomModel.cs" />
|
||||
<Compile Include="Model\HumanModels.cs" />
|
||||
<Compile Include="Network\NetworkProcessor.CPECustom.cs" />
|
||||
<Compile Include="Particles\CollidableParticle.cs" />
|
||||
<Compile Include="Particles\Particle.cs" />
|
||||
|
@ -58,7 +58,7 @@ namespace ClassicalSharp {
|
||||
|
||||
bobYOffset = (float)(Math.Abs( Math.Cos( walkTime ) ) * swing * (2.5f/16f));
|
||||
tilt = (float)Math.Cos( walkTime ) * swing * (0.15f * Utils.Deg2Rad);
|
||||
if( entity.Model is HumanoidModel || entity.Model is ChibiModel )
|
||||
if( entity.Model is HumanoidModel )
|
||||
CalcHumanAnim( idleXRot, idleZRot );
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ namespace ClassicalSharp {
|
||||
|
||||
try {
|
||||
SkinType = Utils.GetSkinType( bmp );
|
||||
if( Model is HumanoidModel || Model is ChibiModel )
|
||||
if( Model is HumanoidModel )
|
||||
ClearHat( bmp, SkinType );
|
||||
PlayerTextureId = game.Graphics.CreateTexture( bmp );
|
||||
MobTextureId = -1;
|
||||
|
@ -30,6 +30,12 @@ namespace ClassicalSharp {
|
||||
public BoundingBox Expand( Vector3 amount ) {
|
||||
return new BoundingBox( Min - amount, Max + amount );
|
||||
}
|
||||
|
||||
/// <summary> Returns a new bounding box, with the minimum and maximum coordinates
|
||||
/// of the original bounding box scaled away from origin the given value. </summary>
|
||||
public BoundingBox Scale( float scale ) {
|
||||
return new BoundingBox( Min * scale, Max * scale );
|
||||
}
|
||||
|
||||
/// <summary> Determines whether this bounding box intersects
|
||||
/// the given bounding box on any axes. </summary>
|
||||
|
@ -23,19 +23,44 @@ namespace ClassicalSharp.Model {
|
||||
.SetModelBounds( 2, 6, -1, 4, 12, 1 );
|
||||
offset = 0.25f;
|
||||
}
|
||||
|
||||
public override bool Bobbing { get { return true; } }
|
||||
|
||||
public override float NameYOffset { get { return 1.3875f; } }
|
||||
|
||||
public override float GetEyeY( Entity entity ) { return 14/16f; }
|
||||
|
||||
public override Vector3 CollisionSize {
|
||||
get { return new Vector3( 8/16f + 0.6f/16f, 20.1f/16f, 8/16f + 0.6f/16f ); }
|
||||
get { return new Vector3( 4/16f + 0.6f/16f, 20.1f/16f, 4/16f + 0.6f/16f ); }
|
||||
}
|
||||
|
||||
public override BoundingBox PickingBounds {
|
||||
get { return new BoundingBox( -4/16f, 0, -4/16f, 4/16f, 16/16f, 4/16f ); }
|
||||
}
|
||||
}
|
||||
|
||||
public class GiantModel : HumanoidModel {
|
||||
|
||||
const float scale = 2f;
|
||||
public GiantModel( Game window ) : base( window ) { }
|
||||
|
||||
protected override void MakeDescriptions() {
|
||||
base.MakeDescriptions();
|
||||
head = head.Scale( scale ); torso = torso.Scale( scale );
|
||||
lLeg = lLeg.Scale( scale ); rLeg = rLeg.Scale( scale );
|
||||
lArm = lArm.Scale( scale ); rArm = rArm.Scale( scale );
|
||||
offset = 0.5f;
|
||||
}
|
||||
|
||||
public override float NameYOffset { get { return 2 * scale + 0.1375f; } }
|
||||
|
||||
public override float GetEyeY( Entity entity ) { return base.GetEyeY( entity ) * scale; }
|
||||
|
||||
public override Vector3 CollisionSize {
|
||||
get { return new Vector3( 8/16f * scale + 0.6f/16f,
|
||||
28.1f/16f * scale, 8/16f * scale + 0.6f/16f ); }
|
||||
}
|
||||
|
||||
public override BoundingBox PickingBounds {
|
||||
get { return base.PickingBounds.Scale( scale ); }
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ namespace ClassicalSharp.Model {
|
||||
protected BoxDesc head, torso, lLeg, rLeg, lArm, rArm;
|
||||
protected float offset = 0.5f;
|
||||
internal override void CreateParts() {
|
||||
vertices = new ModelVertex[boxVertices * (7 + 12 + 4)];
|
||||
vertices = new ModelVertex[boxVertices * (7 + 7 + 4)];
|
||||
Set = new ModelSet();
|
||||
MakeDescriptions();
|
||||
|
||||
@ -25,17 +25,16 @@ namespace ClassicalSharp.Model {
|
||||
Set.Hat = BuildBox( head.TexOrigin( 32, 0 ).Expand( offset ) );
|
||||
Set.LeftArm = BuildBox( lArm.MirrorX().TexOrigin( 40, 16 ) );
|
||||
Set.RightArm = BuildBox( rArm.TexOrigin( 40, 16 ) );
|
||||
lArm = lArm.MirrorX(); lLeg = lLeg.MirrorX();
|
||||
flipBottomY = true;
|
||||
lArm = lArm.MirrorX(); lLeg = lLeg.MirrorX();
|
||||
|
||||
Set64 = new ModelSet();
|
||||
Set64.Head = BuildBox( head.TexOrigin( 0, 0 ) );
|
||||
Set64.Torso = BuildBox( torso.TexOrigin( 16, 16 ) );
|
||||
Set64.Head = Set.Head;
|
||||
Set64.Torso = Set.Torso;
|
||||
Set64.LeftLeg = BuildBox( lLeg.TexOrigin( 16, 48 ) );
|
||||
Set64.RightLeg = BuildBox( rLeg.TexOrigin( 0, 16 ) );
|
||||
Set64.Hat = BuildBox( head.TexOrigin( 32, 0 ).Expand( offset ) );
|
||||
Set64.RightLeg = Set.RightLeg;
|
||||
Set64.Hat = Set.Hat;
|
||||
Set64.LeftArm = BuildBox( lArm.TexOrigin( 32, 48 ) );
|
||||
Set64.RightArm = BuildBox( rArm.TexOrigin( 40, 16 ) );
|
||||
Set64.RightArm = Set.RightArm;
|
||||
|
||||
Set64.TorsoLayer = BuildBox( torso.TexOrigin( 16, 32 ).Expand( offset ) );
|
||||
Set64.LeftLegLayer = BuildBox( lLeg.TexOrigin( 0, 48 ).Expand( offset ) );
|
||||
|
@ -17,7 +17,6 @@ namespace ClassicalSharp.Model {
|
||||
protected const int quadVertices = 4;
|
||||
protected const int boxVertices = 6 * quadVertices;
|
||||
protected RotateOrder Rotate = RotateOrder.ZYX;
|
||||
protected bool flipBottomY; // for modern 1.8 skins
|
||||
|
||||
public IModel( Game game ) {
|
||||
this.game = game;
|
||||
@ -94,7 +93,7 @@ namespace ClassicalSharp.Model {
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary> Expands the corners of this box outwards by the given amount in pixel unis. </summary>
|
||||
/// <summary> Expands the corners of this box outwards by the given amount in pixel units. </summary>
|
||||
public BoxDesc Expand( float amount ) {
|
||||
X1 -= amount / 16f; X2 += amount / 16f;
|
||||
Y1 -= amount / 16f; Y2 += amount / 16f;
|
||||
@ -102,6 +101,14 @@ namespace ClassicalSharp.Model {
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary> Scales the corners of this box outwards by the given amounts. </summary>
|
||||
public BoxDesc Scale( float scale ) {
|
||||
X1 *= scale; Y1 *= scale; Z1 *= scale;
|
||||
X2 *= scale; Y2 *= scale; Z2 *= scale;
|
||||
RotX *= scale; RotY *= scale; RotZ *= scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary> Sets the point that this box is rotated around, in pixel coordinates. </summary>
|
||||
public BoxDesc RotOrigin( sbyte x, sbyte y, sbyte z ) {
|
||||
RotX = x / 16f; RotY = y / 16f; RotZ = z / 16f;
|
||||
@ -155,8 +162,7 @@ namespace ClassicalSharp.Model {
|
||||
int x = desc.TexX, y = desc.TexY;
|
||||
|
||||
YQuad( x + sidesW, y, bodyW, sidesW, x2, x1, z2, z1, y2 ); // top
|
||||
if( flipBottomY ) YQuad( x + sidesW + bodyW, y, bodyW, sidesW, x2, x1, z2, z1, y1 );
|
||||
else YQuad( x + sidesW + bodyW, y, bodyW, sidesW, x2, x1, z1, z2, y1 ); // bottom
|
||||
YQuad( x + sidesW + bodyW, y, bodyW, sidesW, x2, x1, z2, z1, y1 ); // bottom
|
||||
ZQuad( x + sidesW, y + sidesW, bodyW, bodyH, x2, x1, y1, y2, z1 ); // front
|
||||
ZQuad( x + sidesW + bodyW + sidesW, y + sidesW, bodyW, bodyH, x1, x2, y1, y2, z2 ); // back
|
||||
XQuad( x, y + sidesW, sidesW, bodyH, z2, z1, y1, y2, x2 ); // left
|
||||
|
@ -56,7 +56,8 @@ namespace ClassicalSharp.Model {
|
||||
else if( modelName == "spider" ) return new SpiderModel( game );
|
||||
else if( modelName == "zombie" ) return new ZombieModel( game );
|
||||
else if( modelName == "block" ) return new BlockModel( game );
|
||||
else if( modelName == "chibi" ) return new ChibiModel( game );
|
||||
else if( modelName == "chibi" ) return new ChibiModel( game );
|
||||
else if( modelName == "giant" ) return new GiantModel( game );
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user