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/SkeletonHeadModel.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/SkeletonHeadModel.cpp')
| -rw-r--r-- | Minecraft.Client/SkeletonHeadModel.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Minecraft.Client/SkeletonHeadModel.cpp b/Minecraft.Client/SkeletonHeadModel.cpp new file mode 100644 index 00000000..340047fe --- /dev/null +++ b/Minecraft.Client/SkeletonHeadModel.cpp @@ -0,0 +1,43 @@ +#include "stdafx.h" +#include "ModelPart.h" +#include "SkeletonHeadModel.h" + +void SkeletonHeadModel::_init(int u, int v, int tw, int th) +{ + texWidth = tw; + texHeight = th; + head = new ModelPart(this, u, v); + + // 4J Stu - Set "g" param to 0.1 to fix z-fighting issues (hair has this set to 0.5, so need to be less that that) + // Fix for #101501 - TU12: Content: Art: Z-Fighting occurs on the bottom side of a character's head when a Mob Head is equipped. + head->addBox(-4, -8, -4, 8, 8, 8, 0.1); // Head + head->setPos(0, 0, 0); + + // 4J added - compile now to avoid random performance hit first time cubes are rendered + head->compile(1.0f/16.0f); +} + +SkeletonHeadModel::SkeletonHeadModel() +{ + _init(0, 35, 64, 64); +} + +SkeletonHeadModel::SkeletonHeadModel(int u, int v, int tw, int th) +{ + _init(u,v,tw,th); +} + +void SkeletonHeadModel::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); +} + +void SkeletonHeadModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim) +{ + Model::setupAnim(time, r, bob, yRot, xRot, scale, uiBitmaskOverrideAnim); + + head->yRot = yRot / (180 / PI); + head->xRot = xRot / (180 / PI); +}
\ No newline at end of file |
