#include "client/rendering/Triangle.h" Triangle::Triangle() { } Triangle::Triangle(const Vertex& a, const Vertex& b, const Vertex& c) : a(a), b(b), c(c) { Vector3 ab = b.position - a.position; Vector3 ac = c.position - a.position; normalA = ab.cross(ac); normalB = normalA; normalC = normalA; Vector2 abt = b.texture - a.texture; Vector2 act = c.texture - a.texture; float f = 1.0f / (abt[0] * act[1] - act[0] * abt[1]); tangentA = f * (act[1] * ab - abt[1] * ac); tangentA.normalize(); tangentB = tangentA; tangentC = tangentA; }