]> git.localhorst.tv Git - blank.git/blobdiff - src/world/Entity.hpp
better control over entity update transmission
[blank.git] / src / world / Entity.hpp
index ef5e4e32eb92ce4667e233d85f3b485a3aeffcf6..c0d9a0bd858159bbd969f225d15abf16f689fa92 100644 (file)
@@ -2,9 +2,10 @@
 #define BLANK_WORLD_ENTITY_HPP_
 
 #include "Chunk.hpp"
-#include "../model/CompositeModel.hpp"
+#include "../model/CompositeInstance.hpp"
 #include "../model/geometry.hpp"
 
+#include <cstdint>
 #include <string>
 #include <glm/glm.hpp>
 #include <glm/gtc/quaternion.hpp>
@@ -20,8 +21,11 @@ class Entity {
 public:
        Entity() noexcept;
 
-       CompositeModel &GetModel() noexcept { return model; }
-       const CompositeModel &GetModel() const noexcept { return model; }
+       CompositeInstance &GetModel() noexcept { return model; }
+       const CompositeInstance &GetModel() const noexcept { return model; }
+
+       std::uint32_t ID() const noexcept { return id; }
+       void ID(std::uint32_t i) noexcept { id = i; }
 
        const std::string &Name() const noexcept { return name; }
        void Name(const std::string &n) { name = n; }
@@ -71,12 +75,13 @@ public:
        void Update(int dt) noexcept;
 
        void Render(const glm::mat4 &M, DirectionalLighting &prog) noexcept {
-               model.Render(M, prog);
+               if (model) model.Render(M, prog);
        }
 
 private:
-       CompositeModel model;
+       CompositeInstance model;
 
+       std::uint32_t id;
        std::string name;
 
        AABB bounds;