pragma once everywhere

This commit is contained in:
Kolyah35
2026-03-28 00:00:19 +03:00
parent a45c01d013
commit 7d3257669a
575 changed files with 37222 additions and 38345 deletions

View File

@@ -1,52 +1,50 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__ChestModel_H__
#define NET_MINECRAFT_CLIENT_MODEL__ChestModel_H__
//package net.minecraft.client.model;
#include "Model.h"
#include "geom/ModelPart.h"
class ChestModel: public Model
{
public:
ChestModel()
: lid(0, 0),
lock(0, 0),
bottom(0, 0)
{
lid.setModel(this);
lid.setTexSize(64, 64);
lid.addBox(0.0f, -5, -14, 14, 5, 14, 0);
lid.x = 1;
lid.y = 7;
lid.z = 15;
lock.setModel(this);
lock.setTexSize(64, 64);
lock.addBox(-1, -2, -15, 2, 4, 1, 0);
lock.x = 8;
lock.y = 7;
lock.z = 15;
bottom.setModel(this);
bottom.setTexSize(64, 64);
bottom.addBox(0.0f, 0, 0, 14, 10, 14, 0);
bottom.x = 1;
bottom.y = 6;
bottom.z = 1;
}
void render() {
lock.xRot = lid.xRot;
lid.render(1 / 16.0f);
lock.render(1 / 16.0f);
bottom.render(1 / 16.0f);
}
ModelPart lid;
ModelPart bottom;
ModelPart lock;
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__ChestModel_H__*/
#pragma once
//package net.minecraft.client.model;
#include "Model.h"
#include "geom/ModelPart.h"
class ChestModel: public Model
{
public:
ChestModel()
: lid(0, 0),
lock(0, 0),
bottom(0, 0)
{
lid.setModel(this);
lid.setTexSize(64, 64);
lid.addBox(0.0f, -5, -14, 14, 5, 14, 0);
lid.x = 1;
lid.y = 7;
lid.z = 15;
lock.setModel(this);
lock.setTexSize(64, 64);
lock.addBox(-1, -2, -15, 2, 4, 1, 0);
lock.x = 8;
lock.y = 7;
lock.z = 15;
bottom.setModel(this);
bottom.setTexSize(64, 64);
bottom.addBox(0.0f, 0, 0, 14, 10, 14, 0);
bottom.x = 1;
bottom.y = 6;
bottom.z = 1;
}
void render() {
lock.xRot = lid.xRot;
lid.render(1 / 16.0f);
lock.render(1 / 16.0f);
bottom.render(1 / 16.0f);
}
ModelPart lid;
ModelPart bottom;
ModelPart lock;
};

View File

@@ -1,23 +1,21 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__ChickenModel_H__
#define NET_MINECRAFT_CLIENT_MODEL__ChickenModel_H__
#include "Model.h"
#include "geom/ModelPart.h"
class Entity;
class ChickenModel: public Model
{
typedef Model super;
public:
ModelPart head, hair, body, leg0, leg1, wing0, wing1, beak, redThing;
ChickenModel();
/*@Override*/
void render(Entity* entity, float time, float r, float bob, float yRot, float xRot, float scale);
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale);
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__ChickenModel_H__*/
#pragma once
#include "Model.h"
#include "geom/ModelPart.h"
class Entity;
class ChickenModel: public Model
{
typedef Model super;
public:
ModelPart head, hair, body, leg0, leg1, wing0, wing1, beak, redThing;
ChickenModel();
/*@Override*/
void render(Entity* entity, float time, float r, float bob, float yRot, float xRot, float scale);
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale);
};

View File

@@ -1,15 +1,13 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__CowModel_H__
#define NET_MINECRAFT_CLIENT_MODEL__CowModel_H__
//package net.minecraft.client.model;
#include "QuadrupedModel.h"
class CowModel: public QuadrupedModel
{
typedef QuadrupedModel super;
public:
CowModel();
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__CowModel_H__*/
#pragma once
//package net.minecraft.client.model;
#include "QuadrupedModel.h"
class CowModel: public QuadrupedModel
{
typedef QuadrupedModel super;
public:
CowModel();
};

View File

@@ -1,82 +1,80 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__CreeperModel_H__
#define NET_MINECRAFT_CLIENT_MODEL__CreeperModel_H__
//package net.minecraft.client.model;
#include "Model.h"
#include "geom/ModelPart.h"
#include "../../world/entity/Entity.h"
class CreeperModel: public Model
{
typedef Model super;
public:
ModelPart head, /*hair,*/ body, leg0, leg1, leg2, leg3;
CreeperModel(float g = 0)
: head(0, 0),
//hair(32, 0),
body(16, 16),
leg0(0, 16),
leg1(0, 16),
leg2(0, 16),
leg3(0, 16)
{
float yo = 4;
head.setModel(this);
//hair.setModel(this);
body.setModel(this);
leg0.setModel(this);
leg1.setModel(this);
leg2.setModel(this);
leg3.setModel(this);
head.addBox(-4, -8, -4, 8, 8, 8, g); // Head
head.setPos(0, yo, 0);
// hair.addBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Head
// hair.setPos(0, yo, 0);
body.addBox(-4, 0, -2, 8, 12, 4, g); // Body
body.setPos(0, yo, 0);
leg0.addBox(-2, 0, -2, 4, 6, 4, g); // Leg0
leg0.setPos(-2, 12 + yo, 4);
leg1.addBox(-2, 0, -2, 4, 6, 4, g); // Leg1
leg1.setPos(2, 12 + yo, 4);
leg2.addBox(-2, 0, -2, 4, 6, 4, g); // Leg2
leg2.setPos(-2, 12 + yo, -4);
leg3.addBox(-2, 0, -2, 4, 6, 4, g); // Leg3
leg3.setPos(2, 12 + yo, -4);
}
/*@Override*/
void render(Entity* entity, float time, float r, float bob, float yRot, float xRot, float scale) {
setupAnim(time, r, bob, yRot, xRot, scale);
head.render(scale);
body.render(scale);
leg0.render(scale);
leg1.render(scale);
leg2.render(scale);
leg3.render(scale);
}
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale) {
head.yRot = yRot / (float) (180 / Mth::PI);
head.xRot = xRot / (float) (180 / Mth::PI);
const float pend = (Mth::cos(time * 0.6662f) * 1.4f) * r;
leg0.xRot = pend;
leg1.xRot = -pend;
leg2.xRot = -pend;
leg3.xRot = pend;
}
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__CreeperModel_H__*/
#pragma once
//package net.minecraft.client.model;
#include "Model.h"
#include "geom/ModelPart.h"
#include "../../world/entity/Entity.h"
class CreeperModel: public Model
{
typedef Model super;
public:
ModelPart head, /*hair,*/ body, leg0, leg1, leg2, leg3;
CreeperModel(float g = 0)
: head(0, 0),
//hair(32, 0),
body(16, 16),
leg0(0, 16),
leg1(0, 16),
leg2(0, 16),
leg3(0, 16)
{
float yo = 4;
head.setModel(this);
//hair.setModel(this);
body.setModel(this);
leg0.setModel(this);
leg1.setModel(this);
leg2.setModel(this);
leg3.setModel(this);
head.addBox(-4, -8, -4, 8, 8, 8, g); // Head
head.setPos(0, yo, 0);
// hair.addBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Head
// hair.setPos(0, yo, 0);
body.addBox(-4, 0, -2, 8, 12, 4, g); // Body
body.setPos(0, yo, 0);
leg0.addBox(-2, 0, -2, 4, 6, 4, g); // Leg0
leg0.setPos(-2, 12 + yo, 4);
leg1.addBox(-2, 0, -2, 4, 6, 4, g); // Leg1
leg1.setPos(2, 12 + yo, 4);
leg2.addBox(-2, 0, -2, 4, 6, 4, g); // Leg2
leg2.setPos(-2, 12 + yo, -4);
leg3.addBox(-2, 0, -2, 4, 6, 4, g); // Leg3
leg3.setPos(2, 12 + yo, -4);
}
/*@Override*/
void render(Entity* entity, float time, float r, float bob, float yRot, float xRot, float scale) {
setupAnim(time, r, bob, yRot, xRot, scale);
head.render(scale);
body.render(scale);
leg0.render(scale);
leg1.render(scale);
leg2.render(scale);
leg3.render(scale);
}
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale) {
head.yRot = yRot / (float) (180 / Mth::PI);
head.xRot = xRot / (float) (180 / Mth::PI);
const float pend = (Mth::cos(time * 0.6662f) * 1.4f) * r;
leg0.xRot = pend;
leg1.xRot = -pend;
leg2.xRot = -pend;
leg3.xRot = pend;
}
};

View File

@@ -1,28 +1,26 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__HumanoidModel_H__
#define NET_MINECRAFT_CLIENT_MODEL__HumanoidModel_H__
//package net.minecraft.client.model;
#include "Model.h"
#include "geom/ModelPart.h"
class ItemInstance;
class HumanoidModel: public Model
{
public:
HumanoidModel(float g = 0, float yOffset = 0, int texW = 64, int texH = 32);
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale);
void render(HumanoidModel* model, float scale);
void render(Entity* e, float time, float r, float bob, float yRot, float xRot, float scale);
void renderHorrible(float time, float r, float bob, float yRot, float xRot, float scale);
void onGraphicsReset();
ModelPart head, hair, body, arm0, arm1, leg0, leg1;//, ear;
bool holdingLeftHand;
bool holdingRightHand;
bool sneaking;
bool bowAndArrow;
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__HumanoidModel_H__*/
#pragma once
//package net.minecraft.client.model;
#include "Model.h"
#include "geom/ModelPart.h"
class ItemInstance;
class HumanoidModel: public Model
{
public:
HumanoidModel(float g = 0, float yOffset = 0, int texW = 64, int texH = 32);
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale);
void render(HumanoidModel* model, float scale);
void render(Entity* e, float time, float r, float bob, float yRot, float xRot, float scale);
void renderHorrible(float time, float r, float bob, float yRot, float xRot, float scale);
void onGraphicsReset();
ModelPart head, hair, body, arm0, arm1, leg0, leg1;//, ear;
bool holdingLeftHand;
bool holdingRightHand;
bool sneaking;
bool bowAndArrow;
};

View File

@@ -1,48 +1,46 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__Model_H__
#define NET_MINECRAFT_CLIENT_MODEL__Model_H__
//package net.minecraft.client.model;
#include <vector>
#include "geom/ModelPart.h"
class Mob;
class Entity;
class Model
{
protected:
Model()
: riding(false),
attackTime(0),
texWidth(64),
texHeight(32),
young(true)
{}
public:
virtual ~Model() {}
virtual void onGraphicsReset() {
for (unsigned int i = 0; i < cubes.size(); ++i)
cubes[i]->onGraphicsReset();
}
virtual void render(Entity* e, float time, float r, float bob, float yRot, float xRot, float scale) {}
virtual void renderHorrible(float time, float r, float bob, float yRot, float xRot, float scale) {}
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale) {}
virtual void prepareMobModel(Mob* mob, float time, float r, float a) {}
float attackTime;
bool riding;
int texWidth;
int texHeight;
std::vector<ModelPart*> cubes;
bool young;
private:
//Map<String, TexOffs> mappedTexOffs = new HashMap<String, TexOffs>();
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__Model_H__*/
#pragma once
//package net.minecraft.client.model;
#include <vector>
#include "geom/ModelPart.h"
class Mob;
class Entity;
class Model
{
protected:
Model()
: riding(false),
attackTime(0),
texWidth(64),
texHeight(32),
young(true)
{}
public:
virtual ~Model() {}
virtual void onGraphicsReset() {
for (unsigned int i = 0; i < cubes.size(); ++i)
cubes[i]->onGraphicsReset();
}
virtual void render(Entity* e, float time, float r, float bob, float yRot, float xRot, float scale) {}
virtual void renderHorrible(float time, float r, float bob, float yRot, float xRot, float scale) {}
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale) {}
virtual void prepareMobModel(Mob* mob, float time, float r, float a) {}
float attackTime;
bool riding;
int texWidth;
int texHeight;
std::vector<ModelPart*> cubes;
bool young;
private:
//Map<String, TexOffs> mappedTexOffs = new HashMap<String, TexOffs>();
};

View File

@@ -1,17 +1,15 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__ModelInclude_H__
#define NET_MINECRAFT_CLIENT_MODEL__ModelInclude_H__
#include "HumanoidModel.h"
#include "ChickenModel.h"
#include "CowModel.h"
#include "PigModel.h"
#include "SheepModel.h"
#include "SheepFurModel.h"
#include "ZombieModel.h"
#include "SkeletonModel.h"
#include "SignModel.h"
#endif /*NET_MINECRAFT_CLIENT_MODEL__ModelInclude_H__*/
#pragma once
#include "HumanoidModel.h"
#include "ChickenModel.h"
#include "CowModel.h"
#include "PigModel.h"
#include "SheepModel.h"
#include "SheepFurModel.h"
#include "ZombieModel.h"
#include "SkeletonModel.h"
#include "SignModel.h"

View File

@@ -1,15 +1,13 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__PigModel_H__
#define NET_MINECRAFT_CLIENT_MODEL__PigModel_H__
//package net.minecraft.client.model;
#include "QuadrupedModel.h"
class PigModel: public QuadrupedModel
{
typedef QuadrupedModel super;
public:
PigModel(float g = 0);
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__PigModel_H__*/
#pragma once
//package net.minecraft.client.model;
#include "QuadrupedModel.h"
class PigModel: public QuadrupedModel
{
typedef QuadrupedModel super;
public:
PigModel(float g = 0);
};

View File

@@ -1,28 +1,26 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__QuadrupedModel_H__
#define NET_MINECRAFT_CLIENT_MODEL__QuadrupedModel_H__
//package net.minecraft.client.model;
#include "Model.h"
#include "geom/ModelPart.h"
class Entity;
class QuadrupedModel: public Model
{
public:
QuadrupedModel(int legSize, float g);
//@Override
void render(QuadrupedModel* model, float scale);
void render(Entity* entity, float time, float r, float bob, float yRot, float xRot, float scale);
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale);
ModelPart head, hair, body, leg0, leg1, leg2, leg3;
protected:
float yHeadOffs;
float zHeadOffs;
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__QuadrupedModel_H__*/
#pragma once
//package net.minecraft.client.model;
#include "Model.h"
#include "geom/ModelPart.h"
class Entity;
class QuadrupedModel: public Model
{
public:
QuadrupedModel(int legSize, float g);
//@Override
void render(QuadrupedModel* model, float scale);
void render(Entity* entity, float time, float r, float bob, float yRot, float xRot, float scale);
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale);
ModelPart head, hair, body, leg0, leg1, leg2, leg3;
protected:
float yHeadOffs;
float zHeadOffs;
};

View File

@@ -1,24 +1,22 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__SheepFurModel_H__
#define NET_MINECRAFT_CLIENT_MODEL__SheepFurModel_H__
//package net.minecraft.client.model;
#include "QuadrupedModel.h"
class SheepFurModel: public QuadrupedModel
{
typedef QuadrupedModel super;
public:
SheepFurModel();
/*@Override*/
void prepareMobModel(Mob* mob, float time, float r, float a);
/*@Override*/
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale);
private:
float headXRot;
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__SheepFurModel_H__*/
#pragma once
//package net.minecraft.client.model;
#include "QuadrupedModel.h"
class SheepFurModel: public QuadrupedModel
{
typedef QuadrupedModel super;
public:
SheepFurModel();
/*@Override*/
void prepareMobModel(Mob* mob, float time, float r, float a);
/*@Override*/
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale);
private:
float headXRot;
};

View File

@@ -1,23 +1,21 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__SheepModel_H__
#define NET_MINECRAFT_CLIENT_MODEL__SheepModel_H__
//package net.minecraft.client.model;
#include "QuadrupedModel.h"
class SheepModel: public QuadrupedModel
{
typedef QuadrupedModel super;
public:
SheepModel();
/*@Override*/
void prepareMobModel(Mob* mob, float time, float r, float a);
/*@Override*/
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale);
private:
float headXRot;
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__SheepModel_H__*/
#pragma once
//package net.minecraft.client.model;
#include "QuadrupedModel.h"
class SheepModel: public QuadrupedModel
{
typedef QuadrupedModel super;
public:
SheepModel();
/*@Override*/
void prepareMobModel(Mob* mob, float time, float r, float a);
/*@Override*/
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale);
private:
float headXRot;
};

View File

@@ -1,32 +1,30 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__SignModel_H__
#define NET_MINECRAFT_CLIENT_MODEL__SignModel_H__
//package net.minecraft.client.model;
#include "Model.h"
#include "geom/ModelPart.h"
class SignModel: public Model
{
public:
SignModel()
: cube(0, 0),
cube2(0, 14)
{
cube.addBox(-12, -14, -1, 24, 12, 2, 0);
cube2.addBox(-1, -2, -1, 2, 14, 2, 0);
cube.setModel(this);
cube2.setModel(this);
}
void render() {
cube.render(1 / 16.0f);
cube2.render(1 / 16.0f);
}
ModelPart cube;
ModelPart cube2;
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__SignModel_H__*/
#pragma once
//package net.minecraft.client.model;
#include "Model.h"
#include "geom/ModelPart.h"
class SignModel: public Model
{
public:
SignModel()
: cube(0, 0),
cube2(0, 14)
{
cube.addBox(-12, -14, -1, 24, 12, 2, 0);
cube2.addBox(-1, -2, -1, 2, 14, 2, 0);
cube.setModel(this);
cube2.setModel(this);
}
void render() {
cube.render(1 / 16.0f);
cube2.render(1 / 16.0f);
}
ModelPart cube;
ModelPart cube2;
};

View File

@@ -1,46 +1,44 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__SkeletonModel_H__
#define NET_MINECRAFT_CLIENT_MODEL__SkeletonModel_H__
//package net.minecraft.client.model;
#include "ZombieModel.h"
#include "geom/ModelPart.h"
class SkeletonModel: public ZombieModel
{
typedef ZombieModel super;
public:
SkeletonModel()
{
float g = 0;
arm0 = ModelPart(24 + 16, 16);
arm0.setModel(this);
arm0.addBox(-1, -2, -1, 2, 12, 2, g); // Arm0
arm0.setPos(-5, 2, 0);
arm1 = ModelPart(24 + 16, 16);
arm1.setModel(this);
arm1.mirror = true;
arm1.addBox(-1, -2, -1, 2, 12, 2, g); // Arm1
arm1.setPos(5, 2, 0);
leg0 = ModelPart(0, 16);
leg0.setModel(this);
leg0.addBox(-1, 0, -1, 2, 12, 2, g); // Leg0
leg0.setPos(-2, 12, 0);
leg1 = ModelPart(0, 16);
leg1.setModel(this);
leg1.mirror = true;
leg1.addBox(-1, 0, -1, 2, 12, 2, g); // Leg1
leg1.setPos(2, 12, 0);
}
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale) {
bowAndArrow = true;
super::setupAnim(time, r, bob, yRot, xRot, scale);
}
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__SkeletonModel_H__*/
#pragma once
//package net.minecraft.client.model;
#include "ZombieModel.h"
#include "geom/ModelPart.h"
class SkeletonModel: public ZombieModel
{
typedef ZombieModel super;
public:
SkeletonModel()
{
float g = 0;
arm0 = ModelPart(24 + 16, 16);
arm0.setModel(this);
arm0.addBox(-1, -2, -1, 2, 12, 2, g); // Arm0
arm0.setPos(-5, 2, 0);
arm1 = ModelPart(24 + 16, 16);
arm1.setModel(this);
arm1.mirror = true;
arm1.addBox(-1, -2, -1, 2, 12, 2, g); // Arm1
arm1.setPos(5, 2, 0);
leg0 = ModelPart(0, 16);
leg0.setModel(this);
leg0.addBox(-1, 0, -1, 2, 12, 2, g); // Leg0
leg0.setPos(-2, 12, 0);
leg1 = ModelPart(0, 16);
leg1.setModel(this);
leg1.mirror = true;
leg1.addBox(-1, 0, -1, 2, 12, 2, g); // Leg1
leg1.setPos(2, 12, 0);
}
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale) {
bowAndArrow = true;
super::setupAnim(time, r, bob, yRot, xRot, scale);
}
};

View File

@@ -1,168 +1,166 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__SpiderModel_H__
#define NET_MINECRAFT_CLIENT_MODEL__SpiderModel_H__
//package net.minecraft.client.model;
#include "Model.h"
#include "geom/ModelPart.h"
#include "../../world/entity/Entity.h"
#include "../../util/Mth.h"
class SpiderModel: public Model
{
typedef Model super;
public:
ModelPart head, body0, body1, leg0, leg1, leg2, leg3, leg4, leg5, leg6, leg7;
SpiderModel()
: head(32, 4),
body0(0, 0),
body1(0, 12),
leg0(18, 0),
leg1(18, 0),
leg2(18, 0),
leg3(18, 0),
leg4(18, 0),
leg5(18, 0),
leg6(18, 0),
leg7(18, 0)
{
float g = 0;
head.setModel(this);
body0.setModel(this);
body0.setModel(this);
leg0.setModel(this);
leg1.setModel(this);
leg2.setModel(this);
leg3.setModel(this);
leg4.setModel(this);
leg5.setModel(this);
leg6.setModel(this);
leg7.setModel(this);
float yo = 18 + 6 - 9;
head.addBox(-4, -4, -8, 8, 8, 8, g); // Head
head.setPos(0, 0 + yo, -3);
body0.addBox(-3, -3, -3, 6, 6, 6, g); // Body
body0.setPos(0, yo, 0);
body1.addBox(-5, -4, -6, 10, 8, 12, g); // Body
body1.setPos(0, 0 + yo, 3 + 6);
leg0.addBox(-15, -1, -1, 16, 2, 2, g); // Leg0
leg0.setPos(-4, 0 + yo, 2);
leg1.addBox(-1, -1, -1, 16, 2, 2, g); // Leg1
leg1.setPos(4, 0 + yo, 2);
leg2.addBox(-15, -1, -1, 16, 2, 2, g); // Leg2
leg2.setPos(-4, 0 + yo, 1);
leg3.addBox(-1, -1, -1, 16, 2, 2, g); // Leg3
leg3.setPos(4, 0 + yo, 1);
leg4.addBox(-15, -1, -1, 16, 2, 2, g); // Leg0
leg4.setPos(-4, 0 + yo, 0);
leg5.addBox(-1, -1, -1, 16, 2, 2, g); // Leg1
leg5.setPos(4, 0 + yo, 0);
leg6.addBox(-15, -1, -1, 16, 2, 2, g); // Leg2
leg6.setPos(-4, 0 + yo, -1);
leg7.addBox(-1, -1, -1, 16, 2, 2, g); // Leg3
leg7.setPos(4, 0 + yo, -1);
}
/*@Override*/
void render(Entity* entity, float time, float r, float bob, float yRot, float xRot, float scale) {
setupAnim(time, r, bob, yRot, xRot, scale);
head.render(scale);
body0.render(scale);
body1.render(scale);
leg0.render(scale);
leg1.render(scale);
leg2.render(scale);
leg3.render(scale);
leg4.render(scale);
leg5.render(scale);
leg6.render(scale);
leg7.render(scale);
}
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale) {
head.yRot = yRot / (float) (180 / Mth::PI);
head.xRot = xRot / (float) (180 / Mth::PI);
const float sr = (float) Mth::PI / 4.0f;
leg0.zRot = -sr;
leg1.zRot = sr;
leg2.zRot = -sr * 0.74f;
leg3.zRot = sr * 0.74f;
leg4.zRot = -sr * 0.74f;
leg5.zRot = sr * 0.74f;
leg6.zRot = -sr;
leg7.zRot = sr;
//float ro = -(float) Mth::PI / 2.0f * 0;
const float ur = (float) Mth::PI / 8.0f;
const float ur2 = sr;
leg0.yRot = ur2;
leg1.yRot = -ur2;
leg2.yRot = ur;
leg3.yRot = -ur;
leg4.yRot = -ur;
leg5.yRot = +ur;
leg6.yRot = -ur2;
leg7.yRot = +ur2;
//static Stopwatch w;
//w.start();
float c0 = -((float) Mth::cos(time * 0.6662f * 2 + Mth::PI * 2 * 0 / 4.0f) * 0.4f) * r;
float c1 = -((float) Mth::cos(time * 0.6662f * 2 + Mth::PI * 2 * 2 / 4.0f) * 0.4f) * r;
float c2 = -((float) Mth::cos(time * 0.6662f * 2 + Mth::PI * 2 * 1 / 4.0f) * 0.4f) * r;
float c3 = -((float) Mth::cos(time * 0.6662f * 2 + Mth::PI * 2 * 3 / 4.0f) * 0.4f) * r;
//LOGI("spider: %f, %f, %f, %f\n", c0, c1, c2, c3);
float s0 = std::abs((float) Mth::sin(time * 0.6662f + Mth::PI * 2 * 0 / 4.0f) * 0.4f) * r;
float s1 = std::abs((float) Mth::sin(time * 0.6662f + Mth::PI * 2 * 2 / 4.0f) * 0.4f) * r;
float s2 = std::abs((float) Mth::sin(time * 0.6662f + Mth::PI * 2 * 1 / 4.0f) * 0.4f) * r;
float s3 = std::abs((float) Mth::sin(time * 0.6662f + Mth::PI * 2 * 3 / 4.0f) * 0.4f) * r;
//w.stop();
//w.printEvery(100);
//LOGI("spiddy: %f, %f, %f, %f\n", s0, s1, s2, s3);
leg0.yRot += c0;
leg1.yRot -= c0;
leg2.yRot += c1;
leg3.yRot -= c1;
leg4.yRot += c2;
leg5.yRot -= c2;
leg6.yRot += c3;
leg7.yRot -= c3;
leg0.zRot += s0;
leg1.zRot -= s0;
leg2.zRot += s1;
leg3.zRot -= s1;
leg4.zRot += s2;
leg5.zRot -= s2;
leg6.zRot += s3;
leg7.zRot -= s3;
}
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__SpiderModel_H__*/
#pragma once
//package net.minecraft.client.model;
#include "Model.h"
#include "geom/ModelPart.h"
#include "../../world/entity/Entity.h"
#include "../../util/Mth.h"
class SpiderModel: public Model
{
typedef Model super;
public:
ModelPart head, body0, body1, leg0, leg1, leg2, leg3, leg4, leg5, leg6, leg7;
SpiderModel()
: head(32, 4),
body0(0, 0),
body1(0, 12),
leg0(18, 0),
leg1(18, 0),
leg2(18, 0),
leg3(18, 0),
leg4(18, 0),
leg5(18, 0),
leg6(18, 0),
leg7(18, 0)
{
float g = 0;
head.setModel(this);
body0.setModel(this);
body0.setModel(this);
leg0.setModel(this);
leg1.setModel(this);
leg2.setModel(this);
leg3.setModel(this);
leg4.setModel(this);
leg5.setModel(this);
leg6.setModel(this);
leg7.setModel(this);
float yo = 18 + 6 - 9;
head.addBox(-4, -4, -8, 8, 8, 8, g); // Head
head.setPos(0, 0 + yo, -3);
body0.addBox(-3, -3, -3, 6, 6, 6, g); // Body
body0.setPos(0, yo, 0);
body1.addBox(-5, -4, -6, 10, 8, 12, g); // Body
body1.setPos(0, 0 + yo, 3 + 6);
leg0.addBox(-15, -1, -1, 16, 2, 2, g); // Leg0
leg0.setPos(-4, 0 + yo, 2);
leg1.addBox(-1, -1, -1, 16, 2, 2, g); // Leg1
leg1.setPos(4, 0 + yo, 2);
leg2.addBox(-15, -1, -1, 16, 2, 2, g); // Leg2
leg2.setPos(-4, 0 + yo, 1);
leg3.addBox(-1, -1, -1, 16, 2, 2, g); // Leg3
leg3.setPos(4, 0 + yo, 1);
leg4.addBox(-15, -1, -1, 16, 2, 2, g); // Leg0
leg4.setPos(-4, 0 + yo, 0);
leg5.addBox(-1, -1, -1, 16, 2, 2, g); // Leg1
leg5.setPos(4, 0 + yo, 0);
leg6.addBox(-15, -1, -1, 16, 2, 2, g); // Leg2
leg6.setPos(-4, 0 + yo, -1);
leg7.addBox(-1, -1, -1, 16, 2, 2, g); // Leg3
leg7.setPos(4, 0 + yo, -1);
}
/*@Override*/
void render(Entity* entity, float time, float r, float bob, float yRot, float xRot, float scale) {
setupAnim(time, r, bob, yRot, xRot, scale);
head.render(scale);
body0.render(scale);
body1.render(scale);
leg0.render(scale);
leg1.render(scale);
leg2.render(scale);
leg3.render(scale);
leg4.render(scale);
leg5.render(scale);
leg6.render(scale);
leg7.render(scale);
}
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale) {
head.yRot = yRot / (float) (180 / Mth::PI);
head.xRot = xRot / (float) (180 / Mth::PI);
const float sr = (float) Mth::PI / 4.0f;
leg0.zRot = -sr;
leg1.zRot = sr;
leg2.zRot = -sr * 0.74f;
leg3.zRot = sr * 0.74f;
leg4.zRot = -sr * 0.74f;
leg5.zRot = sr * 0.74f;
leg6.zRot = -sr;
leg7.zRot = sr;
//float ro = -(float) Mth::PI / 2.0f * 0;
const float ur = (float) Mth::PI / 8.0f;
const float ur2 = sr;
leg0.yRot = ur2;
leg1.yRot = -ur2;
leg2.yRot = ur;
leg3.yRot = -ur;
leg4.yRot = -ur;
leg5.yRot = +ur;
leg6.yRot = -ur2;
leg7.yRot = +ur2;
//static Stopwatch w;
//w.start();
float c0 = -((float) Mth::cos(time * 0.6662f * 2 + Mth::PI * 2 * 0 / 4.0f) * 0.4f) * r;
float c1 = -((float) Mth::cos(time * 0.6662f * 2 + Mth::PI * 2 * 2 / 4.0f) * 0.4f) * r;
float c2 = -((float) Mth::cos(time * 0.6662f * 2 + Mth::PI * 2 * 1 / 4.0f) * 0.4f) * r;
float c3 = -((float) Mth::cos(time * 0.6662f * 2 + Mth::PI * 2 * 3 / 4.0f) * 0.4f) * r;
//LOGI("spider: %f, %f, %f, %f\n", c0, c1, c2, c3);
float s0 = std::abs((float) Mth::sin(time * 0.6662f + Mth::PI * 2 * 0 / 4.0f) * 0.4f) * r;
float s1 = std::abs((float) Mth::sin(time * 0.6662f + Mth::PI * 2 * 2 / 4.0f) * 0.4f) * r;
float s2 = std::abs((float) Mth::sin(time * 0.6662f + Mth::PI * 2 * 1 / 4.0f) * 0.4f) * r;
float s3 = std::abs((float) Mth::sin(time * 0.6662f + Mth::PI * 2 * 3 / 4.0f) * 0.4f) * r;
//w.stop();
//w.printEvery(100);
//LOGI("spiddy: %f, %f, %f, %f\n", s0, s1, s2, s3);
leg0.yRot += c0;
leg1.yRot -= c0;
leg2.yRot += c1;
leg3.yRot -= c1;
leg4.yRot += c2;
leg5.yRot -= c2;
leg6.yRot += c3;
leg7.yRot -= c3;
leg0.zRot += s0;
leg1.zRot -= s0;
leg2.zRot += s1;
leg3.zRot -= s1;
leg4.zRot += s2;
leg5.zRot -= s2;
leg6.zRot += s3;
leg7.zRot -= s3;
}
};

View File

@@ -1,37 +1,35 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__ZombieModel_H__
#define NET_MINECRAFT_CLIENT_MODEL__ZombieModel_H__
//package net.minecraft.client.model;
#include "HumanoidModel.h"
class ZombieModel: public HumanoidModel
{
typedef HumanoidModel super;
public:
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale) {
super::setupAnim(time, r, bob, yRot, xRot, scale);
if(!holdingLeftHand && !holdingRightHand) {
float attack2 = (float) Mth::sin(attackTime * Mth::PI);
float attack = (float) Mth::sin((1 - (1 - attackTime) * (1 - attackTime)) * Mth::PI);
arm0.zRot = 0;// -attack;
arm1.zRot = 0;// +attack;
arm0.yRot = -(0.1f - attack2 * 0.6f);
arm1.yRot = +(0.1f - attack2 * 0.6f);
arm0.xRot = -Mth::PI / 2.0f;
arm1.xRot = -Mth::PI / 2.0f;
arm0.xRot -= attack2 * 1.2f - attack * 0.4f;
arm1.xRot -= attack2 * 1.2f - attack * 0.4f;
// body.yRot = attack;
const float zBob = Mth::cos(bob * 0.09f) * 0.05f + 0.05f;
const float xBob = Mth::sin(bob * 0.067f) * 0.05f;
arm0.zRot += zBob;
arm1.zRot -= zBob;
arm0.xRot += xBob;
arm1.xRot -= xBob;
}
}
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__ZombieModel_H__*/
#pragma once
//package net.minecraft.client.model;
#include "HumanoidModel.h"
class ZombieModel: public HumanoidModel
{
typedef HumanoidModel super;
public:
void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale) {
super::setupAnim(time, r, bob, yRot, xRot, scale);
if(!holdingLeftHand && !holdingRightHand) {
float attack2 = (float) Mth::sin(attackTime * Mth::PI);
float attack = (float) Mth::sin((1 - (1 - attackTime) * (1 - attackTime)) * Mth::PI);
arm0.zRot = 0;// -attack;
arm1.zRot = 0;// +attack;
arm0.yRot = -(0.1f - attack2 * 0.6f);
arm1.yRot = +(0.1f - attack2 * 0.6f);
arm0.xRot = -Mth::PI / 2.0f;
arm1.xRot = -Mth::PI / 2.0f;
arm0.xRot -= attack2 * 1.2f - attack * 0.4f;
arm1.xRot -= attack2 * 1.2f - attack * 0.4f;
// body.yRot = attack;
const float zBob = Mth::cos(bob * 0.09f) * 0.05f + 0.05f;
const float xBob = Mth::sin(bob * 0.067f) * 0.05f;
arm0.zRot += zBob;
arm1.zRot -= zBob;
arm0.xRot += xBob;
arm1.xRot -= xBob;
}
}
};

View File

@@ -1,29 +1,27 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL_GEOM__Cube_H__
#define NET_MINECRAFT_CLIENT_MODEL_GEOM__Cube_H__
//package net.minecraft.client.model;
#include <string>
#include "Polygon.h"
class Tesselator;
class ModelPart;
class Cube
{
public:
Cube(ModelPart* modelPart, int xTexOffs, int yTexOffs, float x0, float y0, float z0, int w, int h, int d, float g);
void compile(Tesselator& t, float scale);
Cube* setId(const std::string& id);
private:
VertexPT vertices[8];
PolygonQuad polygons[6];
std::string id;
const float x0, y0, z0, x1, y1, z1;
friend class ModelPart;
};
#endif /*NET_MINECRAFT_CLIENT_MODEL_GEOM__Cube_H__*/
#pragma once
//package net.minecraft.client.model;
#include <string>
#include "Polygon.h"
class Tesselator;
class ModelPart;
class Cube
{
public:
Cube(ModelPart* modelPart, int xTexOffs, int yTexOffs, float x0, float y0, float z0, int w, int h, int d, float g);
void compile(Tesselator& t, float scale);
Cube* setId(const std::string& id);
private:
VertexPT vertices[8];
PolygonQuad polygons[6];
std::string id;
const float x0, y0, z0, x1, y1, z1;
friend class ModelPart;
};

View File

@@ -1,74 +1,72 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL_GEOM__ModelPart_H__
#define NET_MINECRAFT_CLIENT_MODEL_GEOM__ModelPart_H__
#include "../../renderer/gles.h"
class Model;
class Cube;
class ModelPart
{
public:
ModelPart(const std::string& id);
ModelPart(int xTexOffs = 0, int yTexOffs = 0);
ModelPart(Model* model, int xTexOffs = 0, int yTexOffs = 0);
~ModelPart();
void _init();
void clear();//const ModelPart& rhs);
ModelPart& operator=(const ModelPart& rhs);
void setModel(Model* model);
void setPos( float x, float y, float z );
void translateTo( float scale );
ModelPart& setTexSize(int xs, int ys);
ModelPart& texOffs(int xTexOffs, int yTexOffs);
void mimic(const ModelPart* o);
// Render normally
void render( float scale );
void renderRollable( float scale );
void draw();
// Bad, immediate version... //@fix @todo: remove this
void renderHorrible(float scale);
void drawSlow( float scale );
void onGraphicsReset() { compiled = false; }
void compile( float scale );
void addChild(ModelPart* child);
ModelPart& addBox(const std::string& id, float x0, float y0, float z0, int w, int h, int d);
ModelPart& addBox(float x0, float y0, float z0, int w, int h, int d);
void addBox(float x0, float y0, float z0, int w, int h, int d, float g);
void addTexBox(float x0, float y0, float z0, int w, int h, int d, int tex);
float x, y, z;
float xRot, yRot, zRot;
bool mirror;
bool visible;
std::vector<Cube*> cubes;
std::vector<ModelPart*> children;
std::string id;
float xTexSize;
float yTexSize;
private:
int xTexOffs, yTexOffs;
bool neverRender;
bool compiled;
int list;
GLuint vboId;
Model* model;
};
#endif /*NET_MINECRAFT_CLIENT_MODEL_GEOM__ModelPart_H__*/
#pragma once
#include "../../renderer/gles.h"
class Model;
class Cube;
class ModelPart
{
public:
ModelPart(const std::string& id);
ModelPart(int xTexOffs = 0, int yTexOffs = 0);
ModelPart(Model* model, int xTexOffs = 0, int yTexOffs = 0);
~ModelPart();
void _init();
void clear();//const ModelPart& rhs);
ModelPart& operator=(const ModelPart& rhs);
void setModel(Model* model);
void setPos( float x, float y, float z );
void translateTo( float scale );
ModelPart& setTexSize(int xs, int ys);
ModelPart& texOffs(int xTexOffs, int yTexOffs);
void mimic(const ModelPart* o);
// Render normally
void render( float scale );
void renderRollable( float scale );
void draw();
// Bad, immediate version... //@fix @todo: remove this
void renderHorrible(float scale);
void drawSlow( float scale );
void onGraphicsReset() { compiled = false; }
void compile( float scale );
void addChild(ModelPart* child);
ModelPart& addBox(const std::string& id, float x0, float y0, float z0, int w, int h, int d);
ModelPart& addBox(float x0, float y0, float z0, int w, int h, int d);
void addBox(float x0, float y0, float z0, int w, int h, int d, float g);
void addTexBox(float x0, float y0, float z0, int w, int h, int d, int tex);
float x, y, z;
float xRot, yRot, zRot;
bool mirror;
bool visible;
std::vector<Cube*> cubes;
std::vector<ModelPart*> children;
std::string id;
float xTexSize;
float yTexSize;
private:
int xTexOffs, yTexOffs;
bool neverRender;
bool compiled;
int list;
GLuint vboId;
Model* model;
};

View File

@@ -1,29 +1,27 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__Polygon_H__
#define NET_MINECRAFT_CLIENT_MODEL__Polygon_H__
//package net.minecraft.client.model;
#include "Vertex.h"
class Tesselator;
class PolygonQuad
{
public:
PolygonQuad() {}
PolygonQuad(VertexPT*,VertexPT*,VertexPT*,VertexPT*);
PolygonQuad(VertexPT*,VertexPT*,VertexPT*,VertexPT*, int u0, int v0, int u1, int v1, float texW = 64.0f, float texH = 32.0f);
PolygonQuad(VertexPT*,VertexPT*,VertexPT*,VertexPT*, float u0, float v0, float u1, float v1);
void mirror();
void render(Tesselator& t, float scale, int vboId = -1);
PolygonQuad* flipNormal();
VertexPT vertices[4];
//int vertexCount;
private:
static const int VERTEX_COUNT = 4;
bool _flipNormal;
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__Polygon_H__*/
#pragma once
//package net.minecraft.client.model;
#include "Vertex.h"
class Tesselator;
class PolygonQuad
{
public:
PolygonQuad() {}
PolygonQuad(VertexPT*,VertexPT*,VertexPT*,VertexPT*);
PolygonQuad(VertexPT*,VertexPT*,VertexPT*,VertexPT*, int u0, int v0, int u1, int v1, float texW = 64.0f, float texH = 32.0f);
PolygonQuad(VertexPT*,VertexPT*,VertexPT*,VertexPT*, float u0, float v0, float u1, float v1);
void mirror();
void render(Tesselator& t, float scale, int vboId = -1);
PolygonQuad* flipNormal();
VertexPT vertices[4];
//int vertexCount;
private:
static const int VERTEX_COUNT = 4;
bool _flipNormal;
};

View File

@@ -1,40 +1,38 @@
#ifndef NET_MINECRAFT_CLIENT_MODEL__Vertex_H__
#define NET_MINECRAFT_CLIENT_MODEL__Vertex_H__
//package net.minecraft.client.model;
#include "../../../world/phys/Vec3.h"
class VertexPT
{
public:
Vec3 pos;
float u, v;
VertexPT() {}
VertexPT(float x, float y, float z, float u_, float v_)
: pos(x, y, z),
u(u_),
v(v_)
{}
VertexPT remap(float u, float v) {
return VertexPT(*this, u, v);
}
VertexPT(const VertexPT& vertex, float u_, float v_) {
pos = vertex.pos;
u = u_;
v = v_;
}
VertexPT(const Vec3& pos_, float u_, float v_) {
pos = pos_;
u = u_;
v = v_;
}
};
#endif /*NET_MINECRAFT_CLIENT_MODEL__Vertex_H__*/
#pragma once
//package net.minecraft.client.model;
#include "../../../world/phys/Vec3.h"
class VertexPT
{
public:
Vec3 pos;
float u, v;
VertexPT() {}
VertexPT(float x, float y, float z, float u_, float v_)
: pos(x, y, z),
u(u_),
v(v_)
{}
VertexPT remap(float u, float v) {
return VertexPT(*this, u, v);
}
VertexPT(const VertexPT& vertex, float u_, float v_) {
pos = vertex.pos;
u = u_;
v = v_;
}
VertexPT(const Vec3& pos_, float u_, float v_) {
pos = pos_;
u = u_;
v = v_;
}
};