diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/BlazeModel.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/BlazeModel.cpp')
| -rw-r--r-- | Minecraft.Client/BlazeModel.cpp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/Minecraft.Client/BlazeModel.cpp b/Minecraft.Client/BlazeModel.cpp new file mode 100644 index 00000000..5af894ac --- /dev/null +++ b/Minecraft.Client/BlazeModel.cpp @@ -0,0 +1,76 @@ +#include "stdafx.h" +#include "..\Minecraft.World\Mth.h" +#include "BlazeModel.h" +#include "ModelPart.h" + +BlazeModel::BlazeModel() : Model() +{ + upperBodyParts = ModelPartArray(12); + + for (unsigned int i = 0; i < upperBodyParts.length; i++) + { + upperBodyParts[i] = new ModelPart(this, 0, 16); + upperBodyParts[i]->addBox(0, 0, 0, 2, 8, 2); + } + + head = new ModelPart(this, 0, 0); + head->addBox(-4, -4, -4, 8, 8, 8); + + // 4J added - compile now to avoid random performance hit first time cubes are rendered + // 4J Stu - Not just performance, but alpha+depth tests don't work right unless we compile here + for (unsigned int i = 0; i < upperBodyParts.length; i++) + { + upperBodyParts[i]->compile(1.0f/16.0f); + } + head->compile(1.0f/16.0f); +} + +int BlazeModel::modelVersion() +{ + return 8; +} + +void BlazeModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +{ + setupAnim(time, r, bob, yRot, xRot, scale); + + head->render(scale,usecompiled); + for (unsigned int i = 0; i < upperBodyParts.length; i++) + { + upperBodyParts[i]->render(scale, usecompiled); + } +} + +void BlazeModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim) +{ + + float angle = bob * PI * -.1f; + for (int i = 0; i < 4; i++) + { + upperBodyParts[i]->y = -2 + Mth::cos((i * 2 + bob) * .25f); + upperBodyParts[i]->x = Mth::cos(angle) * 9.0f; + upperBodyParts[i]->z = Mth::sin(angle) * 9.0f; + angle += PI * 0.5f; + } + angle = .25f * PI + bob * PI * .03f; + for (int i = 4; i < 8; i++) + { + upperBodyParts[i]->y = 2 + Mth::cos((i * 2 + bob) * .25f); + upperBodyParts[i]->x = Mth::cos(angle) * 7.0f; + upperBodyParts[i]->z = Mth::sin(angle) * 7.0f; + angle += PI * 0.5f; + } + + angle = .15f * PI + bob * PI * -.05f; + for (int i = 8; i < 12; i++) + { + upperBodyParts[i]->y = 11 + Mth::cos((i * 1.5f + bob) * .5f); + upperBodyParts[i]->x = Mth::cos(angle) * 5.0f; + upperBodyParts[i]->z = Mth::sin(angle) * 5.0f; + angle += PI * 0.5f; + } + + head->yRot = yRot / (float) (180 / PI); + head->xRot = xRot / (float) (180 / PI); +} + |
