From cc6fb8c33637566a7b116d46440e6063f016deea Mon Sep 17 00:00:00 2001 From: vimene Date: Tue, 31 Dec 2024 03:40:14 +0100 Subject: various improvements - added quaternions and rewrote all rotations to use them - added transforms to put all object transforms in a single place - added Wavefront .obj file parser - removed frame buffer's abstract class - improved vectors, matrices, triangles, vertices and vertices data by putting all code in header file - added vector's operations - changed from NULL to nullptr - miscellaneous improvements --- src/o3d/tri_deriv.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/o3d/tri_deriv.h') diff --git a/src/o3d/tri_deriv.h b/src/o3d/tri_deriv.h index 201539b..16a21f8 100644 --- a/src/o3d/tri_deriv.h +++ b/src/o3d/tri_deriv.h @@ -7,16 +7,17 @@ namespace engine::o3d { -class TriangleDerived { - public: - DerivedVertex derived_vertex1; - DerivedVertex derived_vertex2; - DerivedVertex derived_vertex3; +struct TriangleDerived { + DerivedVertex derived_vertex1; + DerivedVertex derived_vertex2; + DerivedVertex derived_vertex3; - TriangleDerived(DerivedVertex derived_vertex1, DerivedVertex derived_vertex2, DerivedVertex derived_vertex3); - std::vector perspective_crop_xy_out(float x1, float x2, float y1, float y2) const; - std::vector crop_z_out(float z1, float z2) const; - TriangleDerived div_by_w() const; + std::vector perspective_crop_xy_out(float x1, float x2, float y1, float y2) const; + std::vector crop_z_out(float z1, float z2) const; + + constexpr TriangleDerived div_by_w() const & { + return {derived_vertex1.div_by_w(), derived_vertex2.div_by_w(), derived_vertex3.div_by_w()}; + } }; } -- cgit v1.2.3