1 #ifndef BLANK_MODEL_INSTANCE_HPP_
2 #define BLANK_MODEL_INSTANCE_HPP_
6 #include <glm/gtc/quaternion.hpp>
12 class DirectionalLighting;
14 // TODO: this doesn't have to be a tree, actually
15 // linearizing might be a good opportunity to optimize
23 operator bool() const noexcept { return part_model; }
24 const Model &GetModel() const noexcept { return *part_model; }
26 const glm::vec3 &Position() const noexcept { return position; }
27 void Position(const glm::vec3 &p) noexcept { position = p; }
29 const glm::quat &Orientation() const noexcept { return orientation; }
30 void Orientation(const glm::quat &o) noexcept { orientation = o; }
32 glm::mat4 LocalTransform() const noexcept;
33 glm::mat4 GlobalTransform() const noexcept;
35 void Render(const glm::mat4 &, DirectionalLighting &) const;
39 bool HasParent() const noexcept { return parent; }
40 Instance &Parent() const noexcept { return *parent; }
41 bool IsRoot() const noexcept { return !HasParent(); }
44 const Model *part_model;
48 glm::quat orientation;
50 std::vector<Instance> parts;