Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev-ndy' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Dacquay committed Mar 6, 2024
2 parents 1df2e48 + c5f34ec commit 4d90f67
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion dev/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def requirements(self):
self.requires("sdl/2.28.3")
self.requires("imgui/1.90.1")
self.requires("stb/cci.20220909")
self.requires("entt/3.11.1")
self.requires("entt/3.13.0")
self.requires("pybind11/2.11.1")
self.requires("qt/6.6.1")
self.requires("eigen/3.4.0")
Expand Down
2 changes: 1 addition & 1 deletion lib/app/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def requirements(self):
self.requires("vtx_renderer/1.0")
self.requires("vtx_io/1.0")
self.requires("vtx_core/1.0")
self.requires("entt/3.11.1", transitive_headers=True)
self.requires("entt/3.13.0", transitive_headers=True)

def config_options(self):
if self.settings.os == "Windows":
Expand Down
3 changes: 1 addition & 2 deletions lib/app/include/app/application/ecs/registry_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ namespace VTX::App::Application::ECS
return _registry.hasComponent<C1>( p_component );
}

bool isEmpty() const { return _registry.isEmpty(); }
size_t size() const { return _registry.size(); }
bool isEmpty() const { return _registry.isEmpty(); }

template<Core::ECS::ECS_Component C>
void deleteAll()
Expand Down
5 changes: 2 additions & 3 deletions lib/app/include/app/core/ecs/registry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace VTX::App::Core::ECS
template<ECS_Component C>
inline BaseEntity getEntity( const C & p_component ) const
{
return entt::to_entity( _enttRegistry, p_component );
return entt::to_entity( *_enttRegistry.storage<C>(), p_component );
}

bool isValid( const BaseEntity p_entity ) { return p_entity != INVALID_ENTITY; }
Expand Down Expand Up @@ -96,8 +96,7 @@ namespace VTX::App::Core::ECS
return hasComponent<C1>( entity );
}

bool isEmpty() const { return _enttRegistry.size() == 0; }
size_t size() const { return _enttRegistry.size(); }
bool isEmpty() const { return _enttRegistry.storage().begin() == _enttRegistry.storage().end(); }

// template<ECS_Component C>
// entt::observer & getObservers()
Expand Down
14 changes: 6 additions & 8 deletions lib/app/include/app/core/ecs/view.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#ifndef __VTX_APP_CORE_ECS_VIEW__
#define __VTX_APP_CORE_ECS_VIEW__

#include "app/core/ecs/base_entity.hpp"
#include "app/core/ecs/concepts.hpp"
#include <entt/entity/mixin.hpp>
#include <entt/entity/registry.hpp>
#include <entt/entity/storage.hpp>
#include <entt/entity/view.hpp>
#include <limits>
#include <memory>
Expand All @@ -17,11 +20,10 @@ namespace VTX::App::Core::ECS
{
private:
template<ECS_Component T>
using single_storage = const entt::sigh_storage_mixin<
entt::basic_storage<T, entt::registry::entity_type, std::allocator<T>, void>>;
using single_storage = const entt::basic_sigh_mixin<entt::basic_storage<T>, entt::registry>;

template<ECS_Component... Types>
using internal_view = entt::basic_view<entt::type_list<single_storage<Types>...>, entt::type_list<>, void>;
using internal_view = entt::basic_view<entt::get_t<single_storage<Types>...>, entt::exclude_t<>>;

using view_type = internal_view<Type, Other...>;

Expand All @@ -33,11 +35,7 @@ namespace VTX::App::Core::ECS

const view_type & getView() const { return _view; };

size_t size() const
{
// Template disambiguator necessary in this case because calling a template function
return _view.template storage<0>().size();
}
size_t size() const { return _view.handle()->size(); }
size_t size_hint() const { return _view.size_hint(); }

template<ECS_Component T>
Expand Down

0 comments on commit 4d90f67

Please sign in to comment.