aboutsummaryrefslogtreecommitdiff
path: root/src/o3d/deriv_vertex.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/o3d/deriv_vertex.hpp')
-rw-r--r--src/o3d/deriv_vertex.hpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/o3d/deriv_vertex.hpp b/src/o3d/deriv_vertex.hpp
index 5e8dc22..48e5912 100644
--- a/src/o3d/deriv_vertex.hpp
+++ b/src/o3d/deriv_vertex.hpp
@@ -5,12 +5,27 @@
namespace engine::o3d {
+template<engine::math::VectorTypeConcept VectorType>
struct DerivedVertex {
+ VectorType vertex;
+ float b0, b1;
+
+ constexpr DerivedVertex() {}
+
+ constexpr DerivedVertex(const VectorType& vertex, float b0, float b1) : vertex { vertex }, b0 { b0 }, b1 { b1 } {}
+};
+
+template<>
+struct DerivedVertex<engine::math::Vector4> {
engine::math::Vector4 vertex;
float b0, b1;
- constexpr DerivedVertex div_by_w() const & {
- return {vertex.div_by_w(), b0, b1};
+ constexpr DerivedVertex() {}
+
+ constexpr DerivedVertex(const engine::math::Vector4& vertex, float b0, float b1) : vertex { vertex }, b0 { b0 }, b1 { b1 } {}
+
+ constexpr DerivedVertex<engine::math::Vector3> div_by_w() const & {
+ return { vertex.div_by_w(), b0, b1 };
}
};