chore: fmt

This commit is contained in:
orng 2026-03-29 18:40:55 -05:00
parent b630ec8800
commit 7062ef7564
4 changed files with 14 additions and 25 deletions

View file

@ -21,7 +21,7 @@ Cube::Cube(ModelPart* modelPart, int xTexOffs, int yTexOffs, float x0, float y0,
Vertex{0, 0, 0, 0, 0}, Vertex{0, 0, 0, 0, 0},
Vertex{0, 0, 0, 0, 0}, Vertex{0, 0, 0, 0, 0},
Vertex{0, 0, 0, 0, 0}, Vertex{0, 0, 0, 0, 0}}),
polygons({}) {
polygons({}) {
float x1 = x0 + w;
float y1 = y0 + h;
float z1 = z0 + d;
@ -89,10 +89,10 @@ Cube::Cube(ModelPart* modelPart, int xTexOffs, int yTexOffs, float x0, float y0,
modelPart->xTexSize, modelPart->yTexSize); // Down
}
if (faceMask & 16)
polygons[faceCount++] = _Polygon(
std::array<const Vertex, 4>{u1, u0, u3, u2}, xTexOffs + d,
yTexOffs + d, xTexOffs + d + w, yTexOffs + d + h,
modelPart->xTexSize, modelPart->yTexSize); // Front
polygons[faceCount++] =
_Polygon(std::array<const Vertex, 4>{u1, u0, u3, u2}, xTexOffs + d,
yTexOffs + d, xTexOffs + d + w, yTexOffs + d + h,
modelPart->xTexSize, modelPart->yTexSize); // Front
if (faceMask & 32)
polygons[faceCount++] = _Polygon(
std::array<const Vertex, 4>{l0, l1, l2, l3}, xTexOffs + d + w + d,
@ -101,8 +101,7 @@ Cube::Cube(ModelPart* modelPart, int xTexOffs, int yTexOffs, float x0, float y0,
modelPart->yTexSize); // Back
if (modelPart->bMirror) {
for (unsigned int i = 0; i < polygons.size(); i++)
polygons[i].mirror();
for (unsigned int i = 0; i < polygons.size(); i++) polygons[i].mirror();
}
}

View file

@ -5,7 +5,8 @@
#include <vector>
_Polygon::_Polygon(const std::span<const Vertex> vertices)
: vertexCount(vertices.size()), vertices(vertices.begin(), vertices.end()) {}
: vertexCount(vertices.size()),
vertices(vertices.begin(), vertices.end()) {}
_Polygon::_Polygon(const std::span<const Vertex, 4> vertices, int u0, int v0,
int u1, int v1, float xTexSize, float yTexSize)
@ -32,9 +33,7 @@ _Polygon::_Polygon(const std::span<const Vertex, 4> vertices, float u0,
vertices[3].remap(u1, v1),
}) {}
void _Polygon::mirror() {
std::reverse(vertices.begin(), vertices.end());
}
void _Polygon::mirror() { std::reverse(vertices.begin(), vertices.end()); }
void _Polygon::render(Tesselator* t, float scale) {
Vec3 v0 = vertices[1].pos.vectorTo(vertices[0].pos);

View file

@ -19,7 +19,8 @@ public:
_Polygon(std::span<const Vertex> vertices);
_Polygon(std::span<const Vertex, 4> vertices, int u0, int v0, int u1,
int v1, float xTexSize, float yTexSize);
_Polygon(std::span<const Vertex, 4> vertices, float u0, float v0, float u1, float v1);
_Polygon(std::span<const Vertex, 4> vertices, float u0, float v0, float u1,
float v1);
void mirror();
void render(Tesselator* t, float scale);
_Polygon* flipNormal();

View file

@ -8,22 +8,12 @@ public:
public:
constexpr Vertex(float x, float y, float z, float u, float v)
: pos({x, y, z})
, u(u)
, v(v)
{}
: pos({x, y, z}), u(u), v(v) {}
constexpr Vertex(Vertex* vertex, float u, float v)
: pos(vertex->pos)
, u(u)
, v(v)
{}
: pos(vertex->pos), u(u), v(v) {}
constexpr Vertex(Vec3* pos, float u, float v)
: pos(*pos)
, u(u)
, v(v)
{}
constexpr Vertex(Vec3* pos, float u, float v) : pos(*pos), u(u), v(v) {}
Vertex remap(float u, float v) const;
};