Kaynağa Gözat

group: pass filter storage to groups (in-between change for full storage access)

Michele Caini 3 yıl önce
ebeveyn
işleme
b6724b0283
2 değiştirilmiş dosya ile 14 ekleme ve 8 silme
  1. 12 6
      src/entt/entity/group.hpp
  2. 2 2
      src/entt/entity/registry.hpp

+ 12 - 6
src/entt/entity/group.hpp

@@ -153,11 +153,13 @@ public:
     /**
      * @brief Constructs a group from a set of storage classes.
      * @param ref The actual entities to iterate.
-     * @param gpool Storage types to iterate _observed_ by the group.
+     * @param gpool The storage for the _observed_ types to iterate.
+     * @param epool The storage for the types used to filter the group.
      */
-    basic_group(basic_common_type &ref, Get &...gpool) noexcept
+    basic_group(basic_common_type &ref, Get &...gpool, Exclude &...epool) noexcept
         : handler{&ref},
-          pools{&gpool...} {}
+          pools{&gpool...},
+          filter{&epool...} {}
 
     /**
      * @brief Returns a const reference to the underlying handler.
@@ -487,6 +489,7 @@ public:
 private:
     base_type *handler;
     std::tuple<Get *...> pools;
+    std::tuple<Exclude *...> filter;
 };
 
 /**
@@ -549,11 +552,13 @@ public:
     /**
      * @brief Constructs a group from a set of storage classes.
      * @param extent The actual number of entities to iterate.
-     * @param opool Storage types to iterate _owned_ by the group.
-     * @param gpool Storage types to iterate _observed_ by the group.
+     * @param opool The storage for the _owned_ types to iterate.
+     * @param gpool The storage for the _observed_ types to iterate.
+     * @param epool The storage for the types used to filter the group.
      */
-    basic_group(const std::size_t &extent, Owned &...opool, Get &...gpool) noexcept
+    basic_group(const std::size_t &extent, Owned &...opool, Get &...gpool, Exclude &...epool) noexcept
         : pools{&opool..., &gpool...},
+          filter{&epool...},
           length{&extent} {}
 
     /**
@@ -844,6 +849,7 @@ public:
 
 private:
     std::tuple<Owned *..., Get *...> pools;
+    std::tuple<Exclude *...> filter;
     const size_type *length;
 };
 

+ 2 - 2
src/entt/entity/registry.hpp

@@ -1383,7 +1383,7 @@ public:
             }
         }
 
-        return {handler->current, std::get<storage_for_type<std::remove_const_t<Owned>> &>(cpools)..., std::get<storage_for_type<std::remove_const_t<Get>> &>(cpools)...};
+        return {handler->current, std::get<storage_for_type<std::remove_const_t<Owned>> &>(cpools)..., std::get<storage_for_type<std::remove_const_t<Get>> &>(cpools)..., assure<std::remove_const_t<Exclude>>()...};
     }
 
     /*! @copydoc group */
@@ -1401,7 +1401,7 @@ public:
             return {};
         } else {
             using handler_type = group_handler<exclude_t<std::remove_const_t<Exclude>...>, get_t<std::remove_const_t<Get>...>, std::remove_const_t<Owned>...>;
-            return {static_cast<handler_type *>(it->group.get())->current, assure<std::remove_const_t<Owned>>()..., assure<std::remove_const_t<Get>>()...};
+            return {static_cast<handler_type *>(it->group.get())->current, assure<std::remove_const_t<Owned>>()..., assure<std::remove_const_t<Get>>()..., assure<std::remove_const_t<Exclude>>()...};
         }
     }