fix last commit with 64x64 skins

This commit is contained in:
UnknownShadow200 2018-07-31 20:29:50 +10:00
parent 0f2327ea8a
commit 7ffef1b67a
5 changed files with 20 additions and 8 deletions

View File

@ -75,6 +75,10 @@ namespace ClassicalSharp.Model {
model.SetupState(p); model.SetupState(p);
model.DrawModel(p); model.DrawModel(p);
} }
public override void DrawArm(Entity p) {
game.ModelCache.Models[0].Instance.DrawArm(p);
}
} }
public class HeadModel : HumanoidModel { public class HeadModel : HumanoidModel {

View File

@ -281,7 +281,7 @@ namespace ClassicalSharp.Model {
Matrix4.Translate(out translate, -armX / 16f + 0.10f, -armY / 16f - 0.26f, 0); 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 m, ref game.Graphics.View);
Matrix4.Mult(out m, ref translate, ref m); Matrix4.Mult(out m, ref translate, ref m);

View File

@ -63,22 +63,25 @@ namespace ClassicalSharp.Renderers {
void RenderModel() { void RenderModel() {
game.Graphics.FaceCulling = true; game.Graphics.FaceCulling = true;
game.Graphics.Texturing = true; game.Graphics.Texturing = true;
game.Graphics.SetupAlphaState(BlockInfo.Draw[block]);
game.Graphics.DepthTest = false; game.Graphics.DepthTest = false;
IModel model; IModel model;
if (BlockInfo.Draw[block] == DrawType.Gas) { if (BlockInfo.Draw[block] == DrawType.Gas) {
model = game.LocalPlayer.Model; model = game.LocalPlayer.Model;
held.ModelScale = new Vector3(1.0f); held.ModelScale = new Vector3(1.0f);
game.Graphics.AlphaTest = true;
model.RenderArm(held); model.RenderArm(held);
game.Graphics.AlphaTest = false;
} else { } else {
model = game.ModelCache.Get("block"); model = game.ModelCache.Get("block");
held.ModelScale = new Vector3(0.4f); held.ModelScale = new Vector3(0.4f);
game.Graphics.SetupAlphaState(BlockInfo.Draw[block]);
model.Render(held); model.Render(held);
game.Graphics.RestoreAlphaState(BlockInfo.Draw[block]);
} }
game.Graphics.Texturing = false; game.Graphics.Texturing = false;
game.Graphics.RestoreAlphaState(BlockInfo.Draw[block]);
game.Graphics.DepthTest = true; game.Graphics.DepthTest = true;
game.Graphics.FaceCulling = false; game.Graphics.FaceCulling = false;
} }

View File

@ -25,22 +25,26 @@ BlockID held_lastBlock;
static void HeldBlockRenderer_RenderModel(void) { static void HeldBlockRenderer_RenderModel(void) {
Gfx_SetFaceCulling(true); Gfx_SetFaceCulling(true);
Gfx_SetTexturing(true); Gfx_SetTexturing(true);
GfxCommon_SetupAlphaState(Block_Draw[held_block]);
Gfx_SetDepthTest(false); Gfx_SetDepthTest(false);
struct IModel* model; struct IModel* model;
if (Block_Draw[held_block] == DRAW_GAS) { if (Block_Draw[held_block] == DRAW_GAS) {
model = LocalPlayer_Instance.Base.Model; model = LocalPlayer_Instance.Base.Model;
held_entity.ModelScale = Vector3_Create1(1.0f); held_entity.ModelScale = Vector3_Create1(1.0f);
Gfx_SetAlphaTest(true);
IModel_RenderArm(model, &held_entity); IModel_RenderArm(model, &held_entity);
Gfx_SetAlphaTest(false);
} else { } else {
String name = String_FromConst("block"); model = ModelCache_Get(&name); String name = String_FromConst("block"); model = ModelCache_Get(&name);
held_entity.ModelScale = Vector3_Create1(0.4f); held_entity.ModelScale = Vector3_Create1(0.4f);
GfxCommon_SetupAlphaState(Block_Draw[held_block]);
IModel_Render(model, &held_entity); IModel_Render(model, &held_entity);
GfxCommon_RestoreAlphaState(Block_Draw[held_block]);
} }
Gfx_SetTexturing(false); Gfx_SetTexturing(false);
GfxCommon_RestoreAlphaState(Block_Draw[held_block]);
Gfx_SetDepthTest(true); Gfx_SetDepthTest(true);
Gfx_SetFaceCulling(false); Gfx_SetFaceCulling(false);
} }

View File

@ -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); 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, &m, &Gfx_View);
Matrix_Mul(&m, &translate, &m); Matrix_Mul(&m, &translate, &m);