blob: 48e591288cdc59600e4a06fe80e113aaa0765c74 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#ifndef O3D_DERIV_VERTEX_HPP
#define O3D_DERIV_VERTEX_HPP
#include "math/vector.hpp"
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() {}
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 };
}
};
}
#endif // O3D_DERIV_VERTEX_HPP
|