PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
morph_mesh.h
1#pragma once
2
3#include "pixelbullet/assets/static_mesh.h"
4#include "pixelbullet/filesystem/virtual_path.h"
5
6#include <glm/glm.hpp>
7
8#include <cstdint>
9#include <vector>
10
11namespace pixelbullet
12{
13class Filesystem;
14
15class MorphMesh
16{
17public:
18 using Vertex = StaticMesh::Vertex;
19 using Bounds = StaticMesh::Bounds;
20
21 struct Target
22 {
23 std::vector<glm::vec3> position_deltas;
24 std::vector<glm::vec3> normal_deltas;
25 };
26
27 MorphMesh() = default;
28 MorphMesh(const Filesystem& filesystem, const VirtualPath& asset_path)
29 {
30 Load(filesystem, asset_path);
31 }
32
33 bool Load(const Filesystem& filesystem, const VirtualPath& asset_path);
34
35 explicit operator bool() const noexcept
36 {
37 return !vertices_.empty() && !indices_.empty() && !targets_.empty();
38 }
39
40 const VirtualPath& GetFilename() const
41 {
42 return filename_;
43 }
44 const std::vector<Vertex>& GetVertices() const
45 {
46 return vertices_;
47 }
48 const std::vector<uint32_t>& GetIndices() const
49 {
50 return indices_;
51 }
52 const std::vector<Target>& GetTargets() const
53 {
54 return targets_;
55 }
56 const Bounds& GetBounds() const
57 {
58 return bounds_;
59 }
60
61private:
62 void Clear();
63
64private:
65 VirtualPath filename_;
66 std::vector<Vertex> vertices_;
67 std::vector<uint32_t> indices_;
68 std::vector<Target> targets_;
69 Bounds bounds_{};
70};
71} // namespace pixelbullet
Definition filesystem.h:16
Definition virtual_path.h:10
Definition morph_mesh.h:22
Definition static_mesh.h:27
Definition static_mesh.h:18