diff --git a/src/core/include/pw/core/geometry.hpp b/src/core/include/pw/core/primitives.hpp similarity index 97% rename from src/core/include/pw/core/geometry.hpp rename to src/core/include/pw/core/primitives.hpp index eafacfb..d497043 100644 --- a/src/core/include/pw/core/geometry.hpp +++ b/src/core/include/pw/core/primitives.hpp @@ -20,8 +20,8 @@ * SOFTWARE. * */ -#ifndef PW_CORE_GEOMETRY_HPP -#define PW_CORE_GEOMETRY_HPP +#ifndef PW_CORE_PRIMITIVES_HPP +#define PW_CORE_PRIMITIVES_HPP #include #include @@ -31,13 +31,13 @@ namespace pw { -struct geometry { +struct primitives { enum struct topology_type { point_list, line_list, line_strip, - triange_list, + triangle_list, triangle_strip, triangle_fan, line_list_with_adjacency, diff --git a/src/core/tests/pwcore_test_mesh.cpp b/src/core/tests/pwcore_test_mesh.cpp index b48acbe..0e19c12 100644 --- a/src/core/tests/pwcore_test_mesh.cpp +++ b/src/core/tests/pwcore_test_mesh.cpp @@ -1,7 +1,6 @@ -#include #include -#include #include +#include #include #include @@ -29,21 +28,32 @@ struct attribute final { texture_coordinates, }; - using data_type = std::tuple; + attribute_type type{}; + attribute_data data{}; }; struct mesh_n { - geometry data{}; + primitives geometry{}; + std::vector attributes; }; } // namespace pw auto main() -> int { - auto geom = pw::geometry{.vertices = {{1.2f, 2.4f, 4.8f}, - {2.4f, 1.2f, 4.8f}, - {1.2f, 4.8f, 2.4f}}, - .indices = {0, 1, 2}}; + auto geom = pw::primitives{ + .vertices = {{1.2f, 2.4f, 4.8f}, + {2.4f, 1.2f, 4.8f}, + {1.2f, 4.8f, 2.4f}}, + .indices = {0, 1, 2}, + .topology = pw::primitives::topology_type::triangle_list}; + + auto mesh = pw::mesh_n{.geometry = geom}; + + mesh.attributes.emplace_back( + pw::attribute{.type = pw::attribute::normals, + .data = std::vector{ + pw::vector{1.2f, 2.4f, 4.8f}}}); for (auto i : geom.indices) { std::print("({}) ", pw::serialize::to_string(geom.vertices[i]));