X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel%2FPart.hpp;h=97743469a85aba210d12d9048a650e2ed6d39f86;hb=e4a1425dccd0ba9b106e415dd02809f4308a85ee;hp=f3d78e26f610e8c124d1047a89ddf26a4646b422;hpb=a26ca06878d45d3ce77cbc28b574f2553e121944;p=blank.git diff --git a/src/model/Part.hpp b/src/model/Part.hpp index f3d78e2..9774346 100644 --- a/src/model/Part.hpp +++ b/src/model/Part.hpp @@ -1,10 +1,9 @@ #ifndef BLAMK_MODEL_PART_HPP_ #define BLAMK_MODEL_PART_HPP_ -#include "geometry.hpp" - #include #include +#include #include #include #include @@ -13,33 +12,38 @@ namespace blank { class DirectionalLighting; +class EntityMesh; class Instance; class Model; +class ResourceIndex; class Shape; +class ShapeRegistry; +class TokenStreamReader; struct Part { - std::uint16_t id; - AABB bounds; +public: 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 Shape *shape; + }; Part(); ~Part(); + void Read(TokenStreamReader &, ResourceIndex &, const ShapeRegistry &); + Part &AddChild(); const std::list &Children() const noexcept { return children; } std::uint16_t Enumerate(std::uint16_t) noexcept; void Index(std::vector &) noexcept; + std::uint16_t ID() const noexcept { return id; } + glm::mat4 LocalTransform(const Instance &) const noexcept; glm::mat4 GlobalTransform(const Instance &) const noexcept; - void LoadMeshes(Instance &) const; void Render( const glm::mat4 &, const Instance &, @@ -47,7 +51,14 @@ struct Part { private: const Part *parent; + const Shape *shape; std::list children; + std::vector tex_map; + mutable std::unique_ptr mesh; + State initial; + glm::vec3 hsl_mod; + glm::vec3 rgb_mod; + std::uint16_t id; };