chore: format Minecraft.Client

This commit is contained in:
Tropical
2026-03-13 17:10:10 -05:00
parent 33d0737d1d
commit e8424f2000
531 changed files with 67709 additions and 62690 deletions

View File

@@ -2,8 +2,7 @@
#include "Polygon.h"
// 4J added for common init code
void _Polygon::_init(VertexArray vertices)
{
void _Polygon::_init(VertexArray vertices) {
vertexCount = 0;
_flipNormal = false;
@@ -11,18 +10,15 @@ void _Polygon::_init(VertexArray vertices)
vertexCount = vertices.length;
}
_Polygon::_Polygon(VertexArray vertices)
{
_init(vertices);
}
_Polygon::_Polygon(VertexArray vertices) { _init(vertices); }
_Polygon::_Polygon(VertexArray vertices, int u0, int v0, int u1, int v1, float xTexSize, float yTexSize)
{
_init(vertices);
_Polygon::_Polygon(VertexArray vertices, int u0, int v0, int u1, int v1,
float xTexSize, float yTexSize) {
_init(vertices);
// 4J - added - don't assume that u1 > u0, v1 > v0
float us = ( u1 > u0 ) ? ( 0.1f / xTexSize ) : ( -0.1f / xTexSize );
float vs = ( v1 > v0 ) ? ( 0.1f / yTexSize ) : ( -0.1f / yTexSize );
// 4J - added - don't assume that u1 > u0, v1 > v0
float us = (u1 > u0) ? (0.1f / xTexSize) : (-0.1f / xTexSize);
float vs = (v1 > v0) ? (0.1f / yTexSize) : (-0.1f / yTexSize);
vertices[0] = vertices[0]->remap(u1 / xTexSize - us, v0 / yTexSize + vs);
vertices[1] = vertices[1]->remap(u0 / xTexSize + us, v0 / yTexSize + vs);
@@ -30,8 +26,8 @@ _Polygon::_Polygon(VertexArray vertices, int u0, int v0, int u1, int v1, float x
vertices[3] = vertices[3]->remap(u1 / xTexSize - us, v1 / yTexSize - vs);
}
_Polygon::_Polygon(VertexArray vertices, float u0, float v0, float u1, float v1)
{
_Polygon::_Polygon(VertexArray vertices, float u0, float v0, float u1,
float v1) {
_init(vertices);
vertices[0] = vertices[0]->remap(u1, v0);
@@ -40,41 +36,35 @@ _Polygon::_Polygon(VertexArray vertices, float u0, float v0, float u1, float v1)
vertices[3] = vertices[3]->remap(u1, v1);
}
void _Polygon::mirror()
{
void _Polygon::mirror() {
VertexArray newVertices = VertexArray(vertices.length);
for (unsigned int i = 0; i < vertices.length; i++)
newVertices[i] = vertices[vertices.length - i - 1];
delete [] vertices.data;
delete[] vertices.data;
vertices = newVertices;
}
void _Polygon::render(Tesselator *t, float scale)
{
Vec3 *v0 = vertices[1]->pos->vectorTo(vertices[0]->pos);
Vec3 *v1 = vertices[1]->pos->vectorTo(vertices[2]->pos);
Vec3 *n = v1->cross(v0)->normalize();
void _Polygon::render(Tesselator* t, float scale) {
Vec3* v0 = vertices[1]->pos->vectorTo(vertices[0]->pos);
Vec3* v1 = vertices[1]->pos->vectorTo(vertices[2]->pos);
Vec3* n = v1->cross(v0)->normalize();
t->begin();
if (_flipNormal)
{
if (_flipNormal) {
t->normal(-(float)n->x, -(float)n->y, -(float)n->z);
}
else
{
} else {
t->normal((float)n->x, (float)n->y, (float)n->z);
}
for (int i = 0; i < 4; i++)
{
Vertex *v = vertices[i];
t->vertexUV((float)(v->pos->x * scale), (float)( v->pos->y * scale), (float)( v->pos->z * scale), (float)( v->u), (float)( v->v));
for (int i = 0; i < 4; i++) {
Vertex* v = vertices[i];
t->vertexUV((float)(v->pos->x * scale), (float)(v->pos->y * scale),
(float)(v->pos->z * scale), (float)(v->u), (float)(v->v));
}
t->end();
}
_Polygon *_Polygon::flipNormal()
{
_Polygon* _Polygon::flipNormal() {
_flipNormal = true;
return this;
}