* Add Base QuadrupedModel

This commit is contained in:
iProgramInCpp 2023-12-05 19:08:11 +02:00
parent 3fb4014dd9
commit 166bcf708e
2 changed files with 100 additions and 4 deletions

View file

@ -6,5 +6,88 @@
SPDX-License-Identifier: BSD-1-Clause SPDX-License-Identifier: BSD-1-Clause
********************************************************************/ ********************************************************************/
#include "QuadrupedModel.hpp" #include "QuadrupedModel.hpp"
#include "common/Mth.hpp"
QuadrupedModel::QuadrupedModel(int i, float f) :
Model(64, 32),
m_bIsBaby(true), // @HUH: Why is this true?
m_head(0, 0),
m_unknown(0, 0),
m_body(28, 8),
m_leg1(0, 16),
m_leg2(0, 16),
m_leg3(0, 16),
m_leg4(0, 16)
{
field_28C = 8.0f;
field_290 = 4.0f;
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, -4, -8, 8, 8, 8, f);
m_head.setPos(0, 18 - float(i), -6);
m_body.addBox(-5, -10, -7, 10, 16, 8, f);
m_body.setPos(0, 17 - float(i), 2);
m_leg1.addBox(-2, 0, -2, 4, i, 4, f);
m_leg1.setPos(-3, 24 - float(i), 7);
m_leg2.addBox(-2, 0, -2, 4, i, 4, f);
m_leg2.setPos(3, 24 - float(i), 7);
m_leg3.addBox(-2, 0, -2, 4, i, 4, f);
m_leg3.setPos(-3, 24 - float(i), -5);
m_leg4.addBox(-2, 0, -2, 4, i, 4, f);
m_leg4.setPos(3, 24 - float(i), -5);
}
QuadrupedModel::~QuadrupedModel()
{
}
// NOTE: Model::render now takes an Entity pointer... It's unused, though...
void QuadrupedModel::render(float a, float b, float c, float d, float e, float f)
{
setupAnim(a, b, c, d, e, f);
if (m_bIsBaby)
{
glPushMatrix();
glTranslatef(0.0f, f * field_28C, f * field_290);
m_head.render(f);
glPopMatrix();
glPushMatrix();
glScalef(0.5f, 0.5f, 0.5f);
glTranslatef(0.0f, f * 24.0f, 0.0f);
m_body.render(f);
m_leg1.render(f);
m_leg2.render(f);
m_leg3.render(f);
m_leg4.render(f);
glPopMatrix();
}
else
{
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 QuadrupedModel::setupAnim(float a2, float a3, float a4, float a5, float a6, float a7)
{
m_head.m_rotX = a6 / (float)(180.0f / 3.1416f);
m_head.m_rotY = a5 / (float)(180.0f / 3.1416f);
m_body.m_rotX = 90.0f / (float)(180.0f / 3.1416f);
float footAng = (Mth::cos(a2 * 0.6662f) * 1.4f) * a3;
m_leg1.m_rotX = footAng;
m_leg4.m_rotX = footAng;
m_leg2.m_rotX = -footAng;
m_leg3.m_rotX = -footAng;
}

View file

@ -9,11 +9,24 @@
#include "Model.hpp" #include "Model.hpp"
/*
class QuadrupedModel : public Model class QuadrupedModel : public Model
{ {
public:
QuadrupedModel(int, float);
~QuadrupedModel();
void render(float, float, float, float, float, float) override;
void setupAnim(float, float, float, float, float, float) override;
private:
bool m_bIsBaby;
ModelPart m_head;
ModelPart m_unknown;
ModelPart m_body;
ModelPart m_leg1;
ModelPart m_leg2;
ModelPart m_leg3;
ModelPart m_leg4;
float field_28C;
float field_290;
}; };
*/