aboutsummaryrefslogtreecommitdiff
path: root/src/o3d/vertex_data.hpp
diff options
context:
space:
mode:
authorvimene <vincent.menegaux@gmail.com>2025-12-10 20:40:42 +0100
committervimene <vincent.menegaux@gmail.com>2025-12-10 20:40:42 +0100
commit761604f9e4815e8f4355637ebb46052314cbed86 (patch)
treeb9cd6dde75ebf5897f8e67835522c6411d6ab7cb /src/o3d/vertex_data.hpp
parentc666035bc6a51e4dd76daebefffaf8bbc951977c (diff)
downloadengine-761604f9e4815e8f4355637ebb46052314cbed86.tar.gz
renamed .h to .hpp
Diffstat (limited to 'src/o3d/vertex_data.hpp')
-rw-r--r--src/o3d/vertex_data.hpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/o3d/vertex_data.hpp b/src/o3d/vertex_data.hpp
new file mode 100644
index 0000000..0ebc6c9
--- /dev/null
+++ b/src/o3d/vertex_data.hpp
@@ -0,0 +1,29 @@
+#ifndef O3D_VERTEX_DATA_H
+#define O3D_VERTEX_DATA_H
+
+#include "math/vector.hpp"
+
+using
+ engine::math::Vector3;
+
+namespace engine::o3d {
+
+struct VertexData {
+ static constexpr VertexData lerp(const VertexData& vd1, const VertexData& vd2, float b0) {
+ return {
+ b0 * vd1.world_loc + (1.f - b0) * vd2.world_loc,
+ };
+ }
+
+ static constexpr VertexData bilerp(const VertexData& vd1, const VertexData& vd2, const VertexData& vd3, float b0, float b1) {
+ return {
+ b0 * vd1.world_loc + b1 * vd2.world_loc + (1.f - b0 - b1) * vd3.world_loc,
+ };
+ }
+
+ Vector3 world_loc;
+};
+
+}
+
+#endif // O3D_VERTEX_DATA_H