]> git.localhorst.tv Git - blank.git/blobdiff - src/model/Part.hpp
load models from assets
[blank.git] / src / model / Part.hpp
index f3d78e26f610e8c124d1047a89ddf26a4646b422..f71efc5425a1580a992ba1b857e38e8ef9797a44 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <cstdint>
 #include <list>
+#include <memory>
 #include <vector>
 #include <glm/glm.hpp>
 #include <glm/gtc/quaternion.hpp>
 namespace blank {
 
 class DirectionalLighting;
+class EntityMesh;
 class Instance;
 class Model;
 class Shape;
+class ShapeRegistry;
+class TextureIndex;
+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 &, TextureIndex &, const ShapeRegistry &);
+
        Part &AddChild();
        const std::list<Part> &Children() const noexcept { return children; }
 
@@ -39,7 +44,6 @@ struct Part {
        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<Part> children;
+       std::vector<float> tex_map;
+       mutable std::unique_ptr<EntityMesh> mesh;
+       State initial;
+       glm::vec3 hsl_mod;
+       glm::vec3 rgb_mod;
+       std::uint16_t id;
 
 };