15#include "../../Scene/Materials/Material.h"
16#include "../../Utils/Math/Transform.h"
17#include "../../Utils/Math/Vector2D.h"
18#include "../../Physics/Utils/BoundingBox2D.h"
107 bool DidIntersect(
const float& x,
const float& y,
float& u,
float& v,
float& w);
Defines the Triangle3D class for representing and manipulating 3D triangles.
Represents a 2D axis-aligned bounding box.
Abstract base class for rendering materials.
A mathematical construct representing a rotation in 3D space.
Represents a 2D triangle with support for UV mapping, depth, and intersection testing.
String ToString()
Converts the triangle's data to a string representation.
float v2Y
Edge vectors for barycentric coordinate calculations.
bool DidIntersectSAT(BoundingBox2D *bbox)
Checks if the triangle intersects a bounding box using the Separating Axis Theorem (SAT).
Vector3D * normal
Normal vector of the triangle (if available).
Material * GetMaterial()
Gets the material assigned to the triangle.
const Vector2D * p2UV
UV coordinates of the second vertex.
Vector2D GetP2()
Gets the second vertex as a 2D point.
Vector3D * t3p1
Pointer to the first vertex in 3D space.
Triangle2D()
Default constructor.
Vector2D max
Minimum and maximum bounds of the triangle.
bool hasUV
Indicates whether the triangle has UV mapping.
bool DidIntersect(const float &x, const float &y, float &u, float &v, float &w)
Checks if a point intersects the triangle using barycentric coordinates.
float averageDepth
Average depth of the triangle for rendering.
float denominator
Precomputed denominator for barycentric coordinate calculations.
Vector3D * t3p3
Pointer to the third vertex in 3D space.
Vector2D GetP1()
Gets the first vertex as a 2D point.
const Vector2D * p3UV
UV coordinates of the third vertex.
Vector2D GetP3()
Gets the third vertex as a 2D point.
Vector3D * t3p2
Pointer to the second vertex in 3D space.
const Vector2D * p1UV
UV coordinates of the first vertex.
Material * material
Material assigned to the triangle.
float p3Y
Coordinates of the triangle's vertices.
Represents a 3D triangle with support for UV mapping and ray intersection testing.
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.