1 #ifndef BLANK_MODEL_COMPOSITEMODEL_HPP_
2 #define BLANK_MODEL_COMPOSITEMODEL_HPP_
4 #include "geometry.hpp"
9 #include <glm/gtc/quaternion.hpp>
14 class CompositeInstance;
17 class CompositeModel {
22 CompositeModel(const CompositeModel &) = delete;
23 CompositeModel &operator =(const CompositeModel &) = delete;
25 std::uint32_t ID() const noexcept { return id; }
26 void ID(std::uint32_t i) noexcept { id = i; }
28 const AABB &Bounds() const noexcept { return bounds; }
29 void Bounds(const AABB &b) noexcept { bounds = b; }
31 const glm::vec3 &Position() const noexcept { return position; }
32 void Position(const glm::vec3 &p) noexcept { position = p; }
34 const glm::quat &Orientation() const noexcept { return orientation; }
35 void Orientation(const glm::quat &o) noexcept { orientation = o; }
37 bool HasNodeModel() const noexcept { return node_model; }
38 void SetNodeModel(const EntityModel *m) noexcept { node_model = m; }
40 const EntityModel &NodeModel() const noexcept { return *node_model; }
42 CompositeModel &AddPart();
43 bool HasParent() const noexcept { return parent; }
44 CompositeModel &Parent() const noexcept { return *parent; }
45 bool IsRoot() const noexcept { return !HasParent(); }
47 glm::mat4 LocalTransform() const noexcept;
48 glm::mat4 GlobalTransform() const noexcept;
50 void Instantiate(CompositeInstance &) const;
53 CompositeModel *parent;
54 const EntityModel *node_model;
61 glm::quat orientation;
63 std::list<CompositeModel> parts;