diff options
| author | vimene <vincent.menegaux@gmail.com> | 2025-12-29 21:21:09 +0100 |
|---|---|---|
| committer | vimene <vincent.menegaux@gmail.com> | 2025-12-29 21:21:09 +0100 |
| commit | 8ab4780f134c33a9e11ac0fe0bd866e17d3ee650 (patch) | |
| tree | e59efd8a466312b790a2d68e679700b47e748c75 /src/o3d/mesh.hpp | |
| parent | dd187445972989dc44428e8cf185964da9e5c0c4 (diff) | |
| download | engine-8ab4780f134c33a9e11ac0fe0bd866e17d3ee650.tar.gz | |
starting to merge vulkan with the engine
- refactored scene_main to be able to share code between software and
hardware renderers, while still sharing code between terminal software
renderer and graphical software renderer
- made the hardware renderer use scene objects vertices and transforms,
instead of hardcoded ones
- made the hardware renderer use the scene's camera
- made .obj parser create Vector3 instead of Vector4, which didn't made
sense
- removed unnecessary std::
- lots of small changes
Diffstat (limited to 'src/o3d/mesh.hpp')
| -rw-r--r-- | src/o3d/mesh.hpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/o3d/mesh.hpp b/src/o3d/mesh.hpp index 2c3a065..525d9bd 100644 --- a/src/o3d/mesh.hpp +++ b/src/o3d/mesh.hpp @@ -1,24 +1,29 @@ -#ifndef O3D_MESH_H -#define O3D_MESH_H +#ifndef O3D_MESH_HPP +#define O3D_MESH_HPP #include <vector> #include <array> #include <iterator> +#include <cstdint> #include <cstddef> +#include <tuple> #include "math/vector.hpp" +#include "vulkan_utils.hpp" namespace engine::o3d { -using engine::math::Vector3, engine::math::Vector4; - struct Mesh { static Mesh plane(float width, float height); - std::vector<Vector4> vertices; - std::vector<Vector3> normals; - std::vector<std::array<std::array<std::size_t, 2>, 3>> indices; + std::vector<engine::math::Vector3> vertices; + std::vector<engine::math::Vector3> normals; + std::vector<std::array<std::array<size_t, 2>, 3>> indices; + + // TODO: find a better way to do this. This workaround is due to the fact that vulkan only + // accepts a single index, not an index for each attributes + std::tuple<std::vector<engine::vk::Vertex>, std::vector<uint16_t>> linearize_indices() const &; }; } -#endif // O3D_MESH_H +#endif // O3D_MESH_HPP |
