diff --git a/ClassicalSharp/Entities/Model/HumanModels.cs b/ClassicalSharp/Entities/Model/HumanModels.cs index 7f1bb1322..19c12a3fb 100644 --- a/ClassicalSharp/Entities/Model/HumanModels.cs +++ b/ClassicalSharp/Entities/Model/HumanModels.cs @@ -75,6 +75,10 @@ namespace ClassicalSharp.Model { model.SetupState(p); model.DrawModel(p); } + + public override void DrawArm(Entity p) { + game.ModelCache.Models[0].Instance.DrawArm(p); + } } public class HeadModel : HumanoidModel { diff --git a/ClassicalSharp/Entities/Model/IModel.cs b/ClassicalSharp/Entities/Model/IModel.cs index c1e1bcff5..46690a11b 100644 --- a/ClassicalSharp/Entities/Model/IModel.cs +++ b/ClassicalSharp/Entities/Model/IModel.cs @@ -281,7 +281,7 @@ namespace ClassicalSharp.Model { Matrix4.Translate(out translate, -armX / 16f + 0.10f, -armY / 16f - 0.26f, 0); } - Matrix4 m = TransformMatrix(p, pos); + Matrix4 m = p.TransformMatrix(p.ModelScale, pos); Matrix4.Mult(out m, ref m, ref game.Graphics.View); Matrix4.Mult(out m, ref translate, ref m); diff --git a/ClassicalSharp/Rendering/HeldBlockRenderer.cs b/ClassicalSharp/Rendering/HeldBlockRenderer.cs index a2039656b..21030a6d0 100644 --- a/ClassicalSharp/Rendering/HeldBlockRenderer.cs +++ b/ClassicalSharp/Rendering/HeldBlockRenderer.cs @@ -62,23 +62,26 @@ namespace ClassicalSharp.Renderers { void RenderModel() { game.Graphics.FaceCulling = true; - game.Graphics.Texturing = true; - game.Graphics.SetupAlphaState(BlockInfo.Draw[block]); + game.Graphics.Texturing = true; game.Graphics.DepthTest = false; IModel model; if (BlockInfo.Draw[block] == DrawType.Gas) { model = game.LocalPlayer.Model; held.ModelScale = new Vector3(1.0f); + + game.Graphics.AlphaTest = true; model.RenderArm(held); + game.Graphics.AlphaTest = false; } else { model = game.ModelCache.Get("block"); held.ModelScale = new Vector3(0.4f); + game.Graphics.SetupAlphaState(BlockInfo.Draw[block]); model.Render(held); + game.Graphics.RestoreAlphaState(BlockInfo.Draw[block]); } - game.Graphics.Texturing = false; - game.Graphics.RestoreAlphaState(BlockInfo.Draw[block]); + game.Graphics.Texturing = false; game.Graphics.DepthTest = true; game.Graphics.FaceCulling = false; } diff --git a/src/Client/HeldBlockRenderer.c b/src/Client/HeldBlockRenderer.c index 847461ec6..3a44719c4 100644 --- a/src/Client/HeldBlockRenderer.c +++ b/src/Client/HeldBlockRenderer.c @@ -25,22 +25,26 @@ BlockID held_lastBlock; static void HeldBlockRenderer_RenderModel(void) { Gfx_SetFaceCulling(true); Gfx_SetTexturing(true); - GfxCommon_SetupAlphaState(Block_Draw[held_block]); Gfx_SetDepthTest(false); struct IModel* model; if (Block_Draw[held_block] == DRAW_GAS) { model = LocalPlayer_Instance.Base.Model; held_entity.ModelScale = Vector3_Create1(1.0f); + + Gfx_SetAlphaTest(true); IModel_RenderArm(model, &held_entity); + Gfx_SetAlphaTest(false); } else { String name = String_FromConst("block"); model = ModelCache_Get(&name); held_entity.ModelScale = Vector3_Create1(0.4f); + + GfxCommon_SetupAlphaState(Block_Draw[held_block]); IModel_Render(model, &held_entity); + GfxCommon_RestoreAlphaState(Block_Draw[held_block]); } Gfx_SetTexturing(false); - GfxCommon_RestoreAlphaState(Block_Draw[held_block]); Gfx_SetDepthTest(true); Gfx_SetFaceCulling(false); } diff --git a/src/Client/IModel.c b/src/Client/IModel.c index 0b76a058e..9d8d087ed 100644 --- a/src/Client/IModel.c +++ b/src/Client/IModel.c @@ -225,7 +225,8 @@ void IModel_RenderArm(struct IModel* model, struct Entity* entity) { Matrix_Translate(&translate, -model->armX / 16.0f + 0.10f, -model->armY / 16.0f - 0.26f, 0); } - struct Matrix m; model->GetTransform(entity, pos, &m); + struct Matrix m; + Entity_GetTransform(entity, pos, entity->ModelScale, &m); Matrix_Mul(&m, &m, &Gfx_View); Matrix_Mul(&m, &translate, &m);