diff options
author | vimene <vincent.menegaux@gmail.com> | 2025-01-02 13:25:14 +0100 |
---|---|---|
committer | vimene <vincent.menegaux@gmail.com> | 2025-01-02 13:25:14 +0100 |
commit | 26b4b82a7be2c029491f3009b66b3cbf8db5d93c (patch) | |
tree | ddc247a0600b5933185677212f158ebea5a87530 /src/o3d/vertex_data.h | |
parent | 9fdb5881d46f5d80626f961f9c9f133cc25dab70 (diff) | |
download | engine-26b4b82a7be2c029491f3009b66b3cbf8db5d93c.tar.gz |
various improvements
- cleaned up the computation of the camera's matrix
- changed VertexData to being a struct which transmit data between the "vertex shader" and the "fragment shader"
- started working on keyboard and mouse controls
- added fov (field of view)
- changed quaternion to euler angles conversion, from zyx to zxy
- fixed computations of z coordinates in triangle rendering
- improved naming in the triangle rasterizer
Diffstat (limited to 'src/o3d/vertex_data.h')
-rw-r--r-- | src/o3d/vertex_data.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/o3d/vertex_data.h b/src/o3d/vertex_data.h index 71f42cd..22fa76b 100644 --- a/src/o3d/vertex_data.h +++ b/src/o3d/vertex_data.h @@ -1,24 +1,27 @@ #ifndef O3D_VERTEX_DATA_H #define O3D_VERTEX_DATA_H +#include "math/vector.h" + +using + engine::math::Vector3; + namespace engine::o3d { struct VertexData { static constexpr 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 + 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.tx + b1 * vd2.tx + (1.f - b0 - b1) * vd3.tx, - b0 * vd1.ty + b1 * vd2.ty + (1.f - b0 - b1) * vd3.ty + b0 * vd1.world_loc + b1 * vd2.world_loc + (1.f - b0 - b1) * vd3.world_loc, }; } - float tx, ty; + Vector3 world_loc; }; } |