X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel%2FInstance.hpp;h=80c8f710fd14e7a0f60988a2fc6b0b73122a1110;hb=e4a1425dccd0ba9b106e415dd02809f4308a85ee;hp=6c073b8e2a08ceabd48880227fcebda5371a3be3;hpb=eba29c8ad489194cd1e3cd64b5f23424ad4384ef;p=blank.git diff --git a/src/model/Instance.hpp b/src/model/Instance.hpp index 6c073b8..80c8f71 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 @@ -8,46 +10,33 @@ namespace blank { -class Model; class DirectionalLighting; +class Model; +class Part; -// TODO: this doesn't have to be a tree, actually -// linearizing might be a good opportunity to optimize class Instance { friend class Model; + friend class Part; public: Instance(); + ~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; } + operator bool() const noexcept { return model; } + const Model &GetModel() const noexcept { return *model; } - const glm::quat &Orientation() const noexcept { return orientation; } - void Orientation(const glm::quat &o) noexcept { orientation = o; } + glm::mat4 BodyTransform() const noexcept; + Part::State &BodyState() noexcept; - glm::mat4 LocalTransform() const noexcept; - glm::mat4 GlobalTransform() const noexcept; + glm::mat4 EyesTransform() const noexcept; + Part::State &EyesState() noexcept; - void Render(const glm::mat4 &, DirectionalLighting &) const; + void Render(const glm::mat4 &, DirectionalLighting &); 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; };