X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel%2FInstance.hpp;fp=src%2Fmodel%2FInstance.hpp;h=9de1a5db8e3382414131a77f2d4766b881118566;hb=bc2806164f55b7ac48dbb6d224b7d4b55683decf;hp=6c073b8e2a08ceabd48880227fcebda5371a3be3;hpb=cc9dff5e7a6c1c04af1e13fa99d5eb821cabf7ef;p=blank.git diff --git a/src/model/Instance.hpp b/src/model/Instance.hpp index 6c073b8..9de1a5d 100644 --- a/src/model/Instance.hpp +++ b/src/model/Instance.hpp @@ -1,6 +1,8 @@ #ifndef BLANK_MODEL_INSTANCE_HPP_ #define BLANK_MODEL_INSTANCE_HPP_ +#include "Part.hpp" + #include #include #include @@ -11,8 +13,6 @@ namespace blank { class Model; class DirectionalLighting; -// TODO: this doesn't have to be a tree, actually -// linearizing might be a good opportunity to optimize class Instance { friend class Model; @@ -20,34 +20,14 @@ class Instance { public: Instance(); - operator bool() const noexcept { return part_model; } - const Model &GetModel() const noexcept { return *part_model; } - - 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; } - - glm::mat4 LocalTransform() const noexcept; - glm::mat4 GlobalTransform() const noexcept; + operator bool() const noexcept { return model; } + const Model &GetModel() const noexcept { return *model; } void Render(const glm::mat4 &, DirectionalLighting &) const; private: - Instance &AddPart(); - bool HasParent() const noexcept { return parent; } - Instance &Parent() const noexcept { return *parent; } - bool IsRoot() const noexcept { return !HasParent(); } - -private: - const Model *part_model; - Instance *parent; - - glm::vec3 position; - glm::quat orientation; - - std::vector parts; + const Model *model; + std::vector state; };