mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-30 20:13:31 +00:00
the whole game
This commit is contained in:
75
src/client/model/geom/Cube.cpp
Executable file
75
src/client/model/geom/Cube.cpp
Executable file
@@ -0,0 +1,75 @@
|
||||
#include "Cube.h"
|
||||
#include "ModelPart.h"
|
||||
#include "../../renderer/Tesselator.h"
|
||||
#include "../../renderer/gles.h"
|
||||
#include "../../../util/Mth.h"
|
||||
|
||||
Cube::Cube(ModelPart* modelPart, int xTexOffs, int yTexOffs, float x0, float y0, float z0, int w, int h, int d, float g)
|
||||
: x0(x0),
|
||||
y0(y0),
|
||||
z0(z0),
|
||||
x1(x0 + w),
|
||||
y1(y0 + h),
|
||||
z1(z0 + d)
|
||||
{
|
||||
float x1 = this->x1;
|
||||
float y1 = this->y1;
|
||||
float z1 = this->z1;
|
||||
|
||||
x0 -= g;
|
||||
y0 -= g;
|
||||
z0 -= g;
|
||||
x1 += g;
|
||||
y1 += g;
|
||||
z1 += g;
|
||||
|
||||
if (modelPart->mirror) {
|
||||
float tmp = x1;
|
||||
x1 = x0;
|
||||
x0 = tmp;
|
||||
}
|
||||
|
||||
vertices[0] = VertexPT(x0, y0, z0, 0, 0);
|
||||
vertices[1] = VertexPT(x1, y0, z0, 0, 8);
|
||||
vertices[2] = VertexPT(x1, y1, z0, 8, 8);
|
||||
vertices[3] = VertexPT(x0, y1, z0, 8, 0);
|
||||
|
||||
vertices[4] = VertexPT(x0, y0, z1, 0, 0);
|
||||
vertices[5] = VertexPT(x1, y0, z1, 0, 8);
|
||||
vertices[6] = VertexPT(x1, y1, z1, 8, 8);
|
||||
vertices[7] = VertexPT(x0, y1, z1, 8, 0);
|
||||
|
||||
VertexPT* ptr = vertices - 1;
|
||||
VertexPT* u0 = ++ptr;
|
||||
VertexPT* u1 = ++ptr;
|
||||
VertexPT* u2 = ++ptr;
|
||||
VertexPT* u3 = ++ptr;
|
||||
|
||||
VertexPT* l0 = ++ptr;
|
||||
VertexPT* l1 = ++ptr;
|
||||
VertexPT* l2 = ++ptr;
|
||||
VertexPT* l3 = ++ptr;
|
||||
|
||||
polygons[0] = PolygonQuad(l1, u1, u2, l2, xTexOffs + d + w, yTexOffs + d, xTexOffs + d + w + d, yTexOffs + d + h); // Right
|
||||
polygons[1] = PolygonQuad(u0, l0, l3, u3, xTexOffs + 0, yTexOffs + d, xTexOffs + d, yTexOffs + d + h); // Left
|
||||
polygons[2] = PolygonQuad(l1, l0, u0, u1, xTexOffs + d, yTexOffs + 0, xTexOffs + d + w, yTexOffs + d); // Up
|
||||
polygons[3] = PolygonQuad(u2, u3, l3, l2, xTexOffs + d + w, yTexOffs + d, xTexOffs + d + w + w, yTexOffs); // Down
|
||||
polygons[4] = PolygonQuad(u1, u0, u3, u2, xTexOffs + d, yTexOffs + d, xTexOffs + d + w, yTexOffs + d + h); // Front
|
||||
polygons[5] = PolygonQuad(l0, l1, l2, l3, xTexOffs + d + w + d, yTexOffs + d, xTexOffs + d + w + d + w, yTexOffs + d + h); // Back
|
||||
|
||||
if (modelPart->mirror) {
|
||||
for (int i = 0; i < 6; i++)
|
||||
polygons[i].mirror();
|
||||
}
|
||||
}
|
||||
|
||||
void Cube::compile(Tesselator& t, float scale) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
polygons[i].render(t, scale);
|
||||
}
|
||||
}
|
||||
|
||||
Cube* Cube::setId(const std::string& id) {
|
||||
this->id = id;
|
||||
return this;
|
||||
}
|
||||
29
src/client/model/geom/Cube.h
Executable file
29
src/client/model/geom/Cube.h
Executable file
@@ -0,0 +1,29 @@
|
||||
#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__*/
|
||||
303
src/client/model/geom/ModelPart.cpp
Executable file
303
src/client/model/geom/ModelPart.cpp
Executable file
@@ -0,0 +1,303 @@
|
||||
#include "ModelPart.h"
|
||||
#include "Cube.h"
|
||||
#include "../Model.h"
|
||||
#include "../../renderer/Tesselator.h"
|
||||
#include "../../../util/Mth.h"
|
||||
|
||||
|
||||
ModelPart::ModelPart( const std::string& id )
|
||||
: id(id),
|
||||
model(NULL),
|
||||
xTexOffs(0),
|
||||
yTexOffs(0)
|
||||
{
|
||||
_init();
|
||||
}
|
||||
|
||||
ModelPart::ModelPart( int xTexOffs /*= 0*/, int yTexOffs /*= 0*/ )
|
||||
: xTexOffs(xTexOffs),
|
||||
yTexOffs(yTexOffs),
|
||||
model(NULL)
|
||||
{
|
||||
_init();
|
||||
}
|
||||
|
||||
ModelPart::ModelPart( Model* model, int xTexOffs /*= 0*/, int yTexOffs /*= 0*/ )
|
||||
: model(model),
|
||||
xTexOffs(xTexOffs),
|
||||
yTexOffs(yTexOffs)
|
||||
{
|
||||
_init();
|
||||
}
|
||||
|
||||
ModelPart::~ModelPart() {
|
||||
clear();
|
||||
}
|
||||
|
||||
void ModelPart::_init() {
|
||||
x = y = z = 0;
|
||||
xRot = yRot = zRot = 0;
|
||||
list = 0;
|
||||
mirror = false;
|
||||
visible = true;
|
||||
neverRender = false;
|
||||
compiled = false;
|
||||
xTexSize = 64;
|
||||
yTexSize = 32;
|
||||
|
||||
vboId = 0;
|
||||
glGenBuffers2(1, &vboId);
|
||||
}
|
||||
|
||||
void ModelPart::setModel(Model* model) {
|
||||
if (this->model) {
|
||||
Util::remove(this->model->cubes, this);
|
||||
}
|
||||
if (model) {
|
||||
model->cubes.push_back(this);
|
||||
setTexSize(model->texWidth, model->texHeight);
|
||||
}
|
||||
this->model = model;
|
||||
}
|
||||
|
||||
void ModelPart::addChild(ModelPart* child) {
|
||||
children.push_back(child);
|
||||
}
|
||||
|
||||
ModelPart& ModelPart::addBox(const std::string& id, float x0, float y0, float z0, int w, int h, int d) {
|
||||
std::string newid = this->id + "." + id;
|
||||
//TexOffs offs = model.getMapTex(id); //@todo @diff
|
||||
//texOffs(offs.x, offs.y);
|
||||
cubes.push_back((new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, 0))->setId(newid));
|
||||
return *this;
|
||||
}
|
||||
|
||||
ModelPart& ModelPart::addBox(float x0, float y0, float z0, int w, int h, int d) {
|
||||
cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, 0));
|
||||
return *this;
|
||||
}
|
||||
|
||||
void ModelPart::addBox(float x0, float y0, float z0, int w, int h, int d, float g) {
|
||||
cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, g));
|
||||
}
|
||||
|
||||
//This Cube constructor is commented out
|
||||
//void ModelPart::addTexBox(float x0, float y0, float z0, int w, int h, int d, int tex) {
|
||||
// cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, tex));
|
||||
//}
|
||||
|
||||
|
||||
void ModelPart::setPos( float x, float y, float z )
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
}
|
||||
|
||||
void ModelPart::render( float scale )
|
||||
{
|
||||
if (neverRender) return;
|
||||
if (!visible) return;
|
||||
if (!compiled) compile(scale);
|
||||
|
||||
if (xRot != 0 || yRot != 0 || zRot != 0) {
|
||||
glPushMatrix2();
|
||||
glTranslatef2(x * scale, y * scale, z * scale);
|
||||
|
||||
const float c = Mth::RADDEG;
|
||||
if (zRot != 0) glRotatef2(zRot * c, 0.0f, 0.0f, 1.0f);
|
||||
if (yRot != 0) glRotatef2(yRot * c, 0.0f, 1.0f, 0.0f);
|
||||
if (xRot != 0) glRotatef2(xRot * c, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
//LOGI("A");
|
||||
draw();
|
||||
if (!children.empty()) {
|
||||
for (unsigned int i = 0; i < children.size(); i++) {
|
||||
children[i]->render(scale);
|
||||
}
|
||||
}
|
||||
|
||||
glPopMatrix2();
|
||||
} else if (x != 0 || y != 0 || z != 0) {
|
||||
glTranslatef2(x * scale, y * scale, z * scale);
|
||||
//LOGI("B");
|
||||
draw();
|
||||
if (!children.empty()) {
|
||||
for (unsigned int i = 0; i < children.size(); i++) {
|
||||
children[i]->render(scale);
|
||||
}
|
||||
}
|
||||
|
||||
glTranslatef2(-x * scale, -y * scale, -z * scale);
|
||||
} else {
|
||||
//LOGI("C");
|
||||
draw();
|
||||
if (!children.empty()) {
|
||||
for (unsigned int i = 0; i < children.size(); i++) {
|
||||
children[i]->render(scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ModelPart::renderRollable( float scale )
|
||||
{
|
||||
if (neverRender) return;
|
||||
if (!visible) return;
|
||||
if (!compiled) compile(scale);
|
||||
|
||||
glPushMatrix2();
|
||||
glTranslatef2(x * scale, y * scale, z * scale);
|
||||
|
||||
const float c = Mth::RADDEG;
|
||||
if (yRot != 0) glRotatef2(yRot * c, 0.0f, 1.0f, 0.0f);
|
||||
if (xRot != 0) glRotatef2(xRot * c, 1.0f, 0.0f, 0.0f);
|
||||
if (zRot != 0) glRotatef2(zRot * c, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
draw();
|
||||
glPopMatrix2();
|
||||
}
|
||||
|
||||
|
||||
void ModelPart::translateTo( float scale )
|
||||
{
|
||||
if (neverRender) return;
|
||||
if (!visible) return;
|
||||
if (!compiled) compile(scale);
|
||||
|
||||
if (xRot != 0 || yRot != 0 || zRot != 0) {
|
||||
const float c = Mth::RADDEG;
|
||||
glTranslatef2(x * scale, y * scale, z * scale);
|
||||
if (zRot != 0) glRotatef2(zRot * c, 0.0f, 0.0f, 1.0f);
|
||||
if (yRot != 0) glRotatef2(yRot * c, 0.0f, 1.0f, 0.0f);
|
||||
if (xRot != 0) glRotatef2(xRot * c, 1.0f, 0.0f, 0.0f);
|
||||
} else if (x != 0 || y != 0 || z != 0) {
|
||||
glTranslatef2(x * scale, y * scale, z * scale);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ModelPart::compile( float scale )
|
||||
{
|
||||
#ifndef OPENGL_ES
|
||||
list = glGenLists(1);
|
||||
// FIX NORMAL BUG HERE
|
||||
glNewList(list, GL_COMPILE);
|
||||
#endif
|
||||
Tesselator& t = Tesselator::instance;
|
||||
t.begin();
|
||||
t.color(255, 255, 255, 255);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (unsigned int i = 0; i < cubes.size(); ++i)
|
||||
cubes[i]->compile(t, scale);
|
||||
}
|
||||
t.end(true, vboId);
|
||||
#ifndef OPENGL_ES
|
||||
glEndList();
|
||||
#endif
|
||||
compiled = true;
|
||||
}
|
||||
|
||||
void ModelPart::draw()
|
||||
{
|
||||
#ifdef OPENGL_ES
|
||||
drawArrayVT_NoState(vboId, cubes.size() * 2 * 3 * 6, 24);
|
||||
#else
|
||||
glCallList(list);
|
||||
#endif
|
||||
}
|
||||
|
||||
ModelPart& ModelPart::setTexSize(int xs, int ys) {
|
||||
xTexSize = (float)xs;
|
||||
yTexSize = (float)ys;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ModelPart& ModelPart::texOffs(int xTexOffs, int yTexOffs) {
|
||||
this->xTexOffs = xTexOffs;
|
||||
this->yTexOffs = yTexOffs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void ModelPart::mimic(const ModelPart* o) {
|
||||
x = o->x;
|
||||
y = o->y;
|
||||
z = o->z;
|
||||
|
||||
xRot = o->xRot;
|
||||
yRot = o->yRot;
|
||||
zRot = o->zRot;
|
||||
}
|
||||
|
||||
void ModelPart::renderHorrible( float scale )
|
||||
{
|
||||
if (neverRender) {
|
||||
return;
|
||||
}
|
||||
if (!visible) {
|
||||
return;
|
||||
}
|
||||
//if (!compiled) compile(scale);
|
||||
|
||||
if (xRot != 0 || yRot != 0 || zRot != 0) {
|
||||
glPushMatrix2();
|
||||
glTranslatef2(x * scale, y * scale, z * scale);
|
||||
if (zRot != 0) glRotatef2(zRot * Mth::RADDEG, 0.0f, 0.0f, 1.0f);
|
||||
if (yRot != 0) glRotatef2(yRot * Mth::RADDEG, 0.0f, 1.0f, 0.0f);
|
||||
if (xRot != 0) glRotatef2(xRot * Mth::RADDEG, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
drawSlow(scale);
|
||||
glPopMatrix2();
|
||||
} else if (x != 0 || y != 0 || z != 0) {
|
||||
glTranslatef2(x * scale, y * scale, z * scale);
|
||||
drawSlow(scale);
|
||||
glTranslatef2(-x * scale, -y * scale, -z * scale);
|
||||
} else {
|
||||
drawSlow(scale);
|
||||
}
|
||||
}
|
||||
|
||||
void ModelPart::drawSlow( float scale )
|
||||
{
|
||||
Tesselator& t = Tesselator::instance;
|
||||
t.begin();
|
||||
for (int j = 0; j < (int)cubes.size(); ++j) {
|
||||
Cube* c = cubes[j];
|
||||
for (int i = 0; i < 6; i++) {
|
||||
c->polygons[i].render(t, scale, vboId);
|
||||
}
|
||||
}
|
||||
t.draw();
|
||||
}
|
||||
|
||||
void ModelPart::clear()
|
||||
{
|
||||
for (unsigned int i = 0; i < cubes.size(); ++i)
|
||||
delete cubes[i];
|
||||
cubes.clear();
|
||||
|
||||
setModel(NULL);
|
||||
}
|
||||
|
||||
ModelPart& ModelPart::operator=( const ModelPart& rhs )
|
||||
{
|
||||
clear();
|
||||
|
||||
if (!id.empty() || !rhs.id.empty()) {
|
||||
id = rhs.id;
|
||||
}
|
||||
xTexOffs = rhs.xTexOffs;
|
||||
yTexOffs = rhs.yTexOffs;
|
||||
|
||||
compiled = false;
|
||||
mirror = rhs.mirror;
|
||||
|
||||
setModel(rhs.model);
|
||||
cubes.assign(rhs.cubes.begin(), rhs.cubes.end());
|
||||
|
||||
mimic(&rhs);
|
||||
|
||||
return *this;
|
||||
}
|
||||
74
src/client/model/geom/ModelPart.h
Executable file
74
src/client/model/geom/ModelPart.h
Executable file
@@ -0,0 +1,74 @@
|
||||
#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__*/
|
||||
55
src/client/model/geom/Polygon.cpp
Executable file
55
src/client/model/geom/Polygon.cpp
Executable file
@@ -0,0 +1,55 @@
|
||||
#include "Polygon.h"
|
||||
#include "../../renderer/Tesselator.h"
|
||||
#include "../../../world/phys/Vec3.h"
|
||||
|
||||
PolygonQuad::PolygonQuad(VertexPT* v0, VertexPT* v1, VertexPT* v2, VertexPT* v3)
|
||||
: _flipNormal(false)
|
||||
{
|
||||
vertices[0] = *v0;
|
||||
vertices[1] = *v1;
|
||||
vertices[2] = *v2;
|
||||
vertices[3] = *v3;
|
||||
}
|
||||
|
||||
PolygonQuad::PolygonQuad( VertexPT* v0, VertexPT* v1, VertexPT* v2, VertexPT* v3,
|
||||
int uu0, int vv0, int uu1, int vv1)
|
||||
: _flipNormal(false)
|
||||
{
|
||||
const float us = -0.002f / 64.0f;//0.1f / 64.0f;
|
||||
const float vs = -0.002f / 32.0f;//0.1f / 32.0f;
|
||||
vertices[0] = v0->remap(uu1 / 64.0f - us, vv0 / 32.0f + vs);
|
||||
vertices[1] = v1->remap(uu0 / 64.0f + us, vv0 / 32.0f + vs);
|
||||
vertices[2] = v2->remap(uu0 / 64.0f + us, vv1 / 32.0f - vs);
|
||||
vertices[3] = v3->remap(uu1 / 64.0f - us, vv1 / 32.0f - vs);
|
||||
}
|
||||
|
||||
PolygonQuad::PolygonQuad( VertexPT* v0, VertexPT* v1, VertexPT* v2, VertexPT* v3,
|
||||
float uu0, float vv0, float uu1, float vv1)
|
||||
: _flipNormal(false)
|
||||
{
|
||||
vertices[0] = v0->remap(uu1, vv0);
|
||||
vertices[1] = v1->remap(uu0, vv0);
|
||||
vertices[2] = v2->remap(uu0, vv1);
|
||||
vertices[3] = v3->remap(uu1, vv1);
|
||||
}
|
||||
|
||||
void PolygonQuad::mirror() {
|
||||
for (int i = 0; i < VERTEX_COUNT / 2; ++i) {
|
||||
const int j = VERTEX_COUNT - i - 1;
|
||||
VertexPT tmp = vertices[i];
|
||||
vertices[i] = vertices[j];
|
||||
vertices[j] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
void PolygonQuad::render(Tesselator& t, float scale, int vboId /* = -1 */) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
VertexPT& v = vertices[i];
|
||||
t.vertexUV(v.pos.x * scale, v.pos.y * scale, v.pos.z * scale, v.u, v.v);
|
||||
}
|
||||
}
|
||||
|
||||
PolygonQuad* PolygonQuad::flipNormal() {
|
||||
_flipNormal = true;
|
||||
return this;
|
||||
}
|
||||
29
src/client/model/geom/Polygon.h
Executable file
29
src/client/model/geom/Polygon.h
Executable file
@@ -0,0 +1,29 @@
|
||||
#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);
|
||||
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__*/
|
||||
40
src/client/model/geom/Vertex.h
Executable file
40
src/client/model/geom/Vertex.h
Executable file
@@ -0,0 +1,40 @@
|
||||
#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__*/
|
||||
Reference in New Issue
Block a user