X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel%2FModel.hpp;h=c46caf442740cb7efec78a4aad27087339faf705;hb=7e782291e0ce39eb2d4e8c1df28f682c313e6f8d;hp=118ac2e2004d723d0351c9a458a705006a562bcd;hpb=eba29c8ad489194cd1e3cd64b5f23424ad4384ef;p=blank.git diff --git a/src/model/Model.hpp b/src/model/Model.hpp index 118ac2e..c46caf4 100644 --- a/src/model/Model.hpp +++ b/src/model/Model.hpp @@ -1,10 +1,11 @@ #ifndef BLANK_MODEL_MODEL_HPP_ #define BLANK_MODEL_MODEL_HPP_ -#include "geometry.hpp" +#include "Part.hpp" #include #include +#include #include #include @@ -25,42 +26,18 @@ public: std::uint32_t ID() const noexcept { return id; } void ID(std::uint32_t i) noexcept { id = i; } - const AABB &Bounds() const noexcept { return bounds; } - void Bounds(const AABB &b) noexcept { bounds = b; } - - const glm::vec3 &Position() const noexcept { return position; } - void Position(const glm::vec3 &p) noexcept { position = p; } - - const glm::quat &Orientation() const noexcept { return orientation; } - void Orientation(const glm::quat &o) noexcept { orientation = o; } - - bool HasNodeMesh() const noexcept { return node_mesh; } - void SetNodeMesh(const EntityMesh *m) noexcept { node_mesh = m; } - - const EntityMesh &NodeMesh() const noexcept { return *node_mesh; } - - Model &AddPart(); - bool HasParent() const noexcept { return parent; } - Model &Parent() const noexcept { return *parent; } - bool IsRoot() const noexcept { return !HasParent(); } - - glm::mat4 LocalTransform() const noexcept; - glm::mat4 GlobalTransform() const noexcept; + Part &RootPart() noexcept { return root; } + const Part &RootPart() const noexcept { return root; } + Part &GetPart(std::size_t i) noexcept { return *part[i]; } + const Part &GetPart(std::size_t i) const noexcept { return *part[i]; } + void Enumerate(); void Instantiate(Instance &) const; private: - Model *parent; - const EntityMesh *node_mesh; - std::uint32_t id; - - AABB bounds; - - glm::vec3 position; - glm::quat orientation; - - std::list parts; + Part root; + std::vector part; };