wip: removing vec3 tls

This commit is contained in:
orng
2026-03-26 01:10:27 -05:00
parent c18e86944f
commit 7b021bc99d
62 changed files with 1070 additions and 1045 deletions

View File

@@ -45,15 +45,15 @@ void _Polygon::mirror() {
}
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();
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) {
t->normal(-(float)n->x, -(float)n->y, -(float)n->z);
t->normal(-(float)n.x, -(float)n.y, -(float)n.z);
} else {
t->normal((float)n->x, (float)n->y, (float)n->z);
t->normal((float)n.x, (float)n.y, (float)n.z);
}
for (int i = 0; i < 4; i++) {
@@ -67,4 +67,4 @@ void _Polygon::render(Tesselator* t, float scale) {
_Polygon* _Polygon::flipNormal() {
_flipNormal = true;
return this;
}
}