X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodel%2FCompositeInstance.hpp;fp=src%2Fmodel%2FCompositeInstance.hpp;h=0000000000000000000000000000000000000000;hb=eba29c8ad489194cd1e3cd64b5f23424ad4384ef;hp=4b6cfb520aaeb52d450087a7fd0374d5b22636a9;hpb=3542823a1af7f5063d7cc8da84efa248eb889b8a;p=blank.git diff --git a/src/model/CompositeInstance.hpp b/src/model/CompositeInstance.hpp deleted file mode 100644 index 4b6cfb5..0000000 --- a/src/model/CompositeInstance.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef BLANK_MODEL_COMPOSITEINSTANCE_HPP_ -#define BLANK_MODEL_COMPOSITEINSTANCE_HPP_ - -#include -#include -#include - - -namespace blank { - -class CompositeModel; -class DirectionalLighting; - -// TODO: this doesn't have to be a tree, actually -// linearizing might be a good opportunity to optimize -class CompositeInstance { - - friend class CompositeModel; - -public: - CompositeInstance(); - - operator bool() const noexcept { return part_model; } - const CompositeModel &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; - - void Render(const glm::mat4 &, DirectionalLighting &) const; - -private: - CompositeInstance &AddPart(); - bool HasParent() const noexcept { return parent; } - CompositeInstance &Parent() const noexcept { return *parent; } - bool IsRoot() const noexcept { return !HasParent(); } - -private: - const CompositeModel *part_model; - CompositeInstance *parent; - - glm::vec3 position; - glm::quat orientation; - - std::vector parts; - -}; - -} - -#endif