Files
minecraft-pe-0.6.1/src/client/model/geom/Polygon.cpp
Shredder aa9fa659df Extremely Big Update - fileshredder
(MAJOR)Added Java Beta/Normal Shading, toggleble in settings

Fixed and restored the unused Item Switching Animation, toggleble in tweaks too

Added Dynamic Texture for Lava

Added option to use Block Outline Selection which was unused normally

Added Split Touch Controls into Options

Mobs will now drop cooked variants of their meat if they died by fire

Fixed Untranslated Strings in Settings

(MAJOR) Ravines and Lava/Water pools have been fixed and renabled

Tweaked BasicTree to hopefully speed up generation a bit, might disable them temporarily if they keep being slow

You can now grow Fancy Oak Trees using saplings.
2026-04-11 14:45:47 +05:00

68 lines
1.8 KiB
C++
Executable File

#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, float texW, float texH)
: _flipNormal(false)
{
const float us = -0.002f / texW;
const float vs = -0.002f / texH;
vertices[0] = v0->remap(uu1 / texW - us, vv0 / texH + vs);
vertices[1] = v1->remap(uu0 / texW + us, vv0 / texH + vs);
vertices[2] = v2->remap(uu0 / texW + us, vv1 / texH - vs);
vertices[3] = v3->remap(uu1 / texW - us, vv1 / texH - 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 */) {
Vec3 v0 = vertices[0].pos - vertices[1].pos;
Vec3 v1 = vertices[2].pos - vertices[1].pos;
Vec3 n = v1.cross(v0).normalized();
if (_flipNormal == true)
{
t.normal(-n.x , -n.y , -n.z );
}
else
{
t.normal(n.x , n.y , n.z );
}
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;
}