diff options
author | vimene <vincent.menegaux@gmail.com> | 2023-12-09 08:57:38 +0100 |
---|---|---|
committer | vimene <vincent.menegaux@gmail.com> | 2023-12-09 08:57:38 +0100 |
commit | 824aa5562864ca90ea903e2fa7d99459bbdf3a0b (patch) | |
tree | dea0463aed70f2d51723767632fdbba6b89bcedb /src/o3d/vertex_data.cpp | |
parent | bf39fef7eed69e6d5ecfa272607cbf0fcc53b9a6 (diff) | |
download | engine-824aa5562864ca90ea903e2fa7d99459bbdf3a0b.tar.gz |
fixed perspective, added plane
Diffstat (limited to 'src/o3d/vertex_data.cpp')
-rw-r--r-- | src/o3d/vertex_data.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/o3d/vertex_data.cpp b/src/o3d/vertex_data.cpp index ea8c5fd..b05e382 100644 --- a/src/o3d/vertex_data.cpp +++ b/src/o3d/vertex_data.cpp @@ -2,21 +2,19 @@ using namespace engine::o3d; -VertexData VertexData::lerp(const VertexData& vd1, const VertexData& vd2, float s) { - (void) vd1; - (void) vd2; - (void) s; - return {}; +VertexData VertexData::lerp(const VertexData& vd1, const VertexData& vd2, float b0) { + return { + b0 * vd1.tx + (1.f - b0) * vd2.tx, + b0 * vd1.ty + (1.f - b0) * vd2.ty + }; } -VertexData VertexData::bilerp(const VertexData& vd1, const VertexData& vd2, const VertexData& vd3, float s, float t) { - (void) vd1; - (void) vd2; - (void) vd3; - (void) s; - (void) t; - return {}; +VertexData VertexData::bilerp(const VertexData& vd1, const VertexData& vd2, const VertexData& vd3, float b0, float b1) { + return { + b0 * vd1.tx + b1 * vd2.tx + (1.f - b0 - b1) * vd3.tx, + b0 * vd1.ty + b1 * vd2.ty + (1.f - b0 - b1) * vd3.ty + }; } -VertexData::VertexData() { +VertexData::VertexData(float tx, float ty) : tx{tx}, ty{ty} { } |