X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel%2FPart.hpp;h=6499bb7478ed30ec34cd5077e702e34dbfbea85c;hb=d6d568f97e755bf44f048975b375ed8cbcd6ac91;hp=029442bfabb5646f3dd22c45d5e45c3de80387a6;hpb=bc2806164f55b7ac48dbb6d224b7d4b55683decf;p=blank.git diff --git a/src/model/Part.hpp b/src/model/Part.hpp index 029442b..6499bb7 100644 --- a/src/model/Part.hpp +++ b/src/model/Part.hpp @@ -1,48 +1,65 @@ #ifndef BLAMK_MODEL_PART_HPP_ #define BLAMK_MODEL_PART_HPP_ -#include "geometry.hpp" +#include "../graphics/EntityMesh.hpp" +#include "../graphics/glm.hpp" #include #include +#include #include -#include #include 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 EntityMesh *mesh; + }; 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; - glm::mat4 LocalTransform(const std::vector &) const noexcept; - glm::mat4 GlobalTransform(const std::vector &) const noexcept; + std::uint16_t ID() const noexcept { return id; } - void Render(const glm::mat4 &, const std::vector &, DirectionalLighting &) const; + glm::mat4 LocalTransform(const Instance &) const noexcept; + glm::mat4 GlobalTransform(const Instance &) const noexcept; + + void Render( + const glm::mat4 &, + const Instance &, + DirectionalLighting &) const; private: const Part *parent; + const Shape *shape; std::list children; + std::vector tex_map; + mutable std::unique_ptr mesh; + State initial; + EntityMesh::ColorMod hsl_mod; + EntityMesh::ColorMod rgb_mod; + std::uint16_t id; };