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.DrawModel(p);
}
public override void DrawArm(Entity p) {
game.ModelCache.Models[0].Instance.DrawArm(p);
}
}
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 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);

View File

@ -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;
}

View File

@ -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);
}

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);
}
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);