X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel%2FPart.hpp;fp=src%2Fmodel%2FPart.hpp;h=029442bfabb5646f3dd22c45d5e45c3de80387a6;hb=bc2806164f55b7ac48dbb6d224b7d4b55683decf;hp=0000000000000000000000000000000000000000;hpb=cc9dff5e7a6c1c04af1e13fa99d5eb821cabf7ef;p=blank.git diff --git a/src/model/Part.hpp b/src/model/Part.hpp new file mode 100644 index 0000000..029442b --- /dev/null +++ b/src/model/Part.hpp @@ -0,0 +1,51 @@ +#ifndef BLAMK_MODEL_PART_HPP_ +#define BLAMK_MODEL_PART_HPP_ + +#include "geometry.hpp" + +#include +#include +#include +#include +#include + + +namespace blank { + +class DirectionalLighting; +class EntityMesh; +class Model; + +struct Part { + + std::uint16_t id; + AABB bounds; + struct State { + glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f); + glm::quat orientation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f); + } initial; + const EntityMesh *mesh; + + Part(); + ~Part(); + + Part &AddChild(); + const std::list &Children() const noexcept { return children; } + + std::uint16_t Enumerate(std::uint16_t) noexcept; + void Index(std::vector &) noexcept; + + glm::mat4 LocalTransform(const std::vector &) const noexcept; + glm::mat4 GlobalTransform(const std::vector &) const noexcept; + + void Render(const glm::mat4 &, const std::vector &, DirectionalLighting &) const; + +private: + const Part *parent; + std::list children; + +}; + +} + +#endif