1 #ifndef BLANK_MODEL_COMPOSITEMODEL_HPP_
2 #define BLANK_MODEL_COMPOSITEMODEL_HPP_
4 #include "geometry.hpp"
8 #include <glm/gtc/quaternion.hpp>
13 class CompositeInstance;
16 class CompositeModel {
21 CompositeModel(const CompositeModel &) = delete;
22 CompositeModel &operator =(const CompositeModel &) = delete;
24 const AABB &Bounds() const noexcept { return bounds; }
25 void Bounds(const AABB &b) noexcept { bounds = b; }
27 const glm::vec3 &Position() const noexcept { return position; }
28 void Position(const glm::vec3 &p) noexcept { position = p; }
30 const glm::quat &Orientation() const noexcept { return orientation; }
31 void Orientation(const glm::quat &o) noexcept { orientation = o; }
33 bool HasNodeModel() const noexcept { return node_model; }
34 void SetNodeModel(const EntityModel *m) noexcept { node_model = m; }
36 const EntityModel &NodeModel() const noexcept { return *node_model; }
38 CompositeModel &AddPart();
39 bool HasParent() const noexcept { return parent; }
40 CompositeModel &Parent() const noexcept { return *parent; }
41 bool IsRoot() const noexcept { return !HasParent(); }
43 glm::mat4 LocalTransform() const noexcept;
44 glm::mat4 GlobalTransform() const noexcept;
46 void Instantiate(CompositeInstance &) const;
49 CompositeModel *parent;
50 const EntityModel *node_model;
55 glm::quat orientation;
57 std::list<CompositeModel> parts;