diff options
author | vimene <vincent.menegaux@gmail.com> | 2024-12-31 03:40:14 +0100 |
---|---|---|
committer | vimene <vincent.menegaux@gmail.com> | 2024-12-31 03:40:14 +0100 |
commit | cc6fb8c33637566a7b116d46440e6063f016deea (patch) | |
tree | 5cc83f84525507994add57df7dd974e6611d675a /src/o3d/tri_deriv.h | |
parent | 6b765a85cf81bf4b7162e4c9280dd4054581c611 (diff) | |
download | engine-cc6fb8c33637566a7b116d46440e6063f016deea.tar.gz |
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
Diffstat (limited to 'src/o3d/tri_deriv.h')
-rw-r--r-- | src/o3d/tri_deriv.h | 19 |
1 files changed, 10 insertions, 9 deletions
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<TriangleDerived> perspective_crop_xy_out(float x1, float x2, float y1, float y2) const; - std::vector<TriangleDerived> crop_z_out(float z1, float z2) const; - TriangleDerived div_by_w() const; + std::vector<TriangleDerived> perspective_crop_xy_out(float x1, float x2, float y1, float y2) const; + std::vector<TriangleDerived> 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()}; + } }; } |