6 #include <initializer_list> 11 #include <mos/core/tracked_container.hpp> 12 #include <mos/gfx/shape.hpp> 13 #include <mos/gfx/vertex.hpp> 18 using Shared_mesh = std::shared_ptr<Mesh>;
19 using Triangle_indices = std::array<int, 3>;
24 using Positions = std::vector<glm::vec3>;
25 using Time_point = std::chrono::time_point<std::chrono::system_clock,
26 std::chrono::nanoseconds>;
28 template <
class Tv,
class Te>
29 explicit Mesh(
const Tv vertices_begin,
const Tv vertices_end,
30 Te indices_begin, Te indices_end)
31 : vertices(vertices_begin, vertices_end),
32 indices(indices_begin, indices_end) {
36 explicit Mesh(
const std::initializer_list<Vertex> &vertices,
37 const std::initializer_list<Triangle_indices> &triangles);
42 static auto load(
const std::string &path) ->
Mesh;
50 auto mix(
const Mesh &mesh1,
const Mesh &mesh2,
float amount) -> void;
52 auto apply_transform(
const glm::mat4 &transform) -> void;
54 auto calculate_normals() -> void;
56 auto calculate_flat_normals() -> void;
58 auto calculate_tangents() -> void;
60 auto calculate_sphere() -> void;
62 auto centroid()
const -> glm::vec3;
64 auto radius()
const -> float;
74 auto normal()
const -> glm::vec3;
78 void for_each_triangle(
79 const std::function<
void(
const Triangle &triangle)> &callback);
81 glm::vec3 centroid_{0.0f};
auto clear() -> void
Erease all vertices and indices.
Base class for geometric shapes.
Definition: shape.hpp:8
Definition: assets.hpp:17
auto positions() const -> Positions
Get only positions from vertices.
Geometric data description, vertices and indices.
Definition: mesh.hpp:22
Container with modified time stamp.
Definition: container.hpp:9
static auto load(const std::string &path) -> Mesh
Load from *.mesh file.
Vertex structure, supported by the renderer.
Definition: vertex.hpp:7