mirror of
https://github.com/ReMinecraftPE/mcpe.git
synced 2025-01-22 17:23:32 -05:00
* Add CreeperModel
This commit is contained in:
parent
3c433c2858
commit
52c9140b82
7 changed files with 152 additions and 5 deletions
|
@ -89,17 +89,17 @@ void ChickenModel::render(float a, float b, float c, float d, float e, float f)
|
|||
void ChickenModel::setupAnim(float a, float b, float c, float d, float e, float f)
|
||||
{
|
||||
// TODO: Why do I need to invert the rotation again?
|
||||
float rotX = e / (float)(-180.0f / 3.1416f);
|
||||
float rotX = e / (-180.0f / 3.1416f);
|
||||
m_head.m_rotX = -rotX;
|
||||
m_beak.m_rotX = -rotX;
|
||||
m_wattle.m_rotX = -rotX;
|
||||
|
||||
float rotY = d / (float)(180.0f / 3.1416f);
|
||||
float rotY = d / (180.0f / 3.1416f);
|
||||
m_head.m_rotY = rotY;
|
||||
m_beak.m_rotY = rotY;
|
||||
m_wattle.m_rotY = rotY;
|
||||
|
||||
m_body.m_rotX = 90.0f / (float)(180.0f / 3.1416f);
|
||||
m_body.m_rotX = 90.0f / (180.0f / 3.1416f);
|
||||
m_wing1.m_rotZ = c;
|
||||
m_wing2.m_rotZ = -c;
|
||||
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/********************************************************************
|
||||
Minecraft: Pocket Edition - Decompilation Project
|
||||
Copyright (C) 2023 iProgramInCpp
|
||||
|
||||
The following code is licensed under the BSD 1 clause license.
|
||||
SPDX-License-Identifier: BSD-1-Clause
|
||||
********************************************************************/
|
||||
#include "CreeperModel.hpp"
|
||||
#include "common/Mth.hpp"
|
||||
|
||||
CreeperModel::CreeperModel() :
|
||||
Model(64, 32),
|
||||
m_head(0, 0),
|
||||
m_body(16, 16),
|
||||
m_leg1(0, 16),
|
||||
m_leg2(0, 16),
|
||||
m_leg3(0, 16),
|
||||
m_leg4(0, 16)
|
||||
{
|
||||
m_head.setModel(this);
|
||||
m_body.setModel(this);
|
||||
m_leg1.setModel(this);
|
||||
m_leg2.setModel(this);
|
||||
m_leg3.setModel(this);
|
||||
m_leg4.setModel(this);
|
||||
|
||||
m_head.addBox(-4, -8, -4, 8, 8, 8);
|
||||
m_head.setPos(0, 4, 0);
|
||||
m_body.addBox(-4, 0, -2, 8, 12, 4);
|
||||
m_body.setPos(0, 4, 0);
|
||||
m_leg1.addBox(-2, 0, -2, 4, 6, 4);
|
||||
m_leg1.setPos(-2, 16, 4);
|
||||
m_leg2.addBox(-2, 0, -2, 4, 6, 4);
|
||||
m_leg2.setPos(2, 16, 4);
|
||||
m_leg3.addBox(-2, 0, -2, 4, 6, 4);
|
||||
m_leg3.setPos(-2, 16, -4);
|
||||
m_leg4.addBox(-2, 0, -2, 4, 6, 4);
|
||||
m_leg4.setPos(2, 16, -4);
|
||||
}
|
||||
|
||||
CreeperModel::~CreeperModel()
|
||||
{
|
||||
}
|
||||
|
||||
void CreeperModel::render(float a, float b, float c, float d, float e, float f)
|
||||
{
|
||||
setupAnim(a, b, c, d, e, f);
|
||||
|
||||
m_head.render(f);
|
||||
m_body.render(f);
|
||||
m_leg1.render(f);
|
||||
m_leg2.render(f);
|
||||
m_leg3.render(f);
|
||||
m_leg4.render(f);
|
||||
}
|
||||
|
||||
void CreeperModel::setupAnim(float a, float b, float c, float d, float e, float f)
|
||||
{
|
||||
m_head.m_rotY = d / (180.0f / 3.1416f);
|
||||
m_head.m_rotX = e / (180.0f / 3.1416f);
|
||||
|
||||
float footAng = (Mth::cos(a * 0.6662f) * 1.4f) * b;
|
||||
m_leg1.m_rotX = footAng;
|
||||
m_leg4.m_rotX = footAng;
|
||||
m_leg2.m_rotX = -footAng;
|
||||
m_leg3.m_rotX = -footAng;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/********************************************************************
|
||||
Minecraft: Pocket Edition - Decompilation Project
|
||||
Copyright (C) 2023 iProgramInCpp
|
||||
|
||||
The following code is licensed under the BSD 1 clause license.
|
||||
SPDX-License-Identifier: BSD-1-Clause
|
||||
********************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "Model.hpp"
|
||||
|
||||
class CreeperModel : public Model
|
||||
{
|
||||
public:
|
||||
CreeperModel();
|
||||
~CreeperModel();
|
||||
void render(float, float, float, float, float, float) override;
|
||||
void setupAnim(float, float, float, float, float, float) override;
|
||||
|
||||
private:
|
||||
ModelPart m_head;
|
||||
ModelPart m_body;
|
||||
ModelPart m_leg1;
|
||||
ModelPart m_leg2;
|
||||
ModelPart m_leg3;
|
||||
ModelPart m_leg4;
|
||||
};
|
|
@ -0,0 +1,27 @@
|
|||
/********************************************************************
|
||||
Minecraft: Pocket Edition - Decompilation Project
|
||||
Copyright (C) 2023 iProgramInCpp
|
||||
|
||||
The following code is licensed under the BSD 1 clause license.
|
||||
SPDX-License-Identifier: BSD-1-Clause
|
||||
********************************************************************/
|
||||
#include "CreeperRenderer.hpp"
|
||||
|
||||
CreeperRenderer::CreeperRenderer(Model* pModel, float f) : MobRenderer(pModel, f)
|
||||
{
|
||||
}
|
||||
|
||||
CreeperRenderer::~CreeperRenderer()
|
||||
{
|
||||
}
|
||||
|
||||
int CreeperRenderer::getOverlayColor(Mob* pMob, float a, float b)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CreeperRenderer::scale(Mob* pMob, float f)
|
||||
{
|
||||
// TODO
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/********************************************************************
|
||||
Minecraft: Pocket Edition - Decompilation Project
|
||||
Copyright (C) 2023 iProgramInCpp
|
||||
|
||||
The following code is licensed under the BSD 1 clause license.
|
||||
SPDX-License-Identifier: BSD-1-Clause
|
||||
********************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "MobRenderer.hpp"
|
||||
|
||||
class CreeperRenderer : public MobRenderer
|
||||
{
|
||||
public:
|
||||
CreeperRenderer(Model*, float);
|
||||
~CreeperRenderer();
|
||||
|
||||
int getOverlayColor(Mob*, float, float) override;
|
||||
void scale(Mob*, float) override;
|
||||
};
|
|
@ -13,6 +13,7 @@
|
|||
#include "client/model/PigModel.hpp"
|
||||
#include "client/model/CowModel.hpp"
|
||||
#include "client/model/ChickenModel.hpp"
|
||||
#include "client/model/CreeperModel.hpp"
|
||||
|
||||
EntityRenderDispatcher* EntityRenderDispatcher::instance;
|
||||
float EntityRenderDispatcher::xOff, EntityRenderDispatcher::yOff, EntityRenderDispatcher::zOff;
|
||||
|
@ -21,7 +22,8 @@ EntityRenderDispatcher::EntityRenderDispatcher() :
|
|||
m_HumanoidMobRenderer(new HumanoidModel(0.0f, 0.0f), 0.0f),
|
||||
m_PigRenderer(new PigModel(0.0f), 0.0f),
|
||||
m_CowRenderer(new CowModel, 0.0f),
|
||||
m_ChickenRenderer(new ChickenModel, 0.0f)
|
||||
m_ChickenRenderer(new ChickenModel, 0.0f),
|
||||
m_CreeperRenderer(new CreeperModel, 0.5f)
|
||||
{
|
||||
m_pItemInHandRenderer = nullptr;
|
||||
m_pTextures = nullptr;
|
||||
|
@ -37,6 +39,7 @@ EntityRenderDispatcher::EntityRenderDispatcher() :
|
|||
m_PigRenderer.init(this);
|
||||
m_CowRenderer.init(this);
|
||||
m_ChickenRenderer.init(this);
|
||||
m_CreeperRenderer.init(this);
|
||||
|
||||
// TODO
|
||||
|
||||
|
@ -89,6 +92,8 @@ EntityRenderer* EntityRenderDispatcher::getRenderer(int renderType)
|
|||
return &m_CowRenderer;
|
||||
case RENDER_PIG:
|
||||
return &m_PigRenderer;
|
||||
case RENDER_CREEPER:
|
||||
return &m_CreeperRenderer;
|
||||
// TODO
|
||||
#ifdef ENH_ALLOW_SAND_GRAVITY
|
||||
case RENDER_FALLING_TILE:
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "PigRenderer.hpp"
|
||||
#include "CowRenderer.hpp"
|
||||
#include "ChickenRenderer.hpp"
|
||||
#include "CreeperRenderer.hpp"
|
||||
|
||||
class Minecraft;
|
||||
class Font;
|
||||
|
@ -51,7 +52,7 @@ public:
|
|||
TntRenderer m_TntRenderer;
|
||||
//padding??
|
||||
ItemRenderer m_ItemRenderer;
|
||||
//CreeperRenderer m_CreeperRenderer;
|
||||
CreeperRenderer m_CreeperRenderer;
|
||||
//SpiderRenderer m_SpiderRenderer;
|
||||
//SkeletonRenderer m_SkeletonRenderer;
|
||||
//ZombieRenderer m_ZombieRenderer;
|
||||
|
|
Loading…
Reference in a new issue