entity:
* small changes to the entt_traits class * natvis snippets for basic_sparse_set and basic_storage (with tombstone detection)
This commit is contained in:
@@ -1,3 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||
<Type Name="entt::basic_sparse_set<*>">
|
||||
<DisplayString>{{ size={ packed.size() } }}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[capacity]">packed.capacity()</Item>
|
||||
<IndexListItems Optional="true" Condition="packed.size() != 0">
|
||||
<Size>packed.size()</Size>
|
||||
<ValueNode Condition="packed[$i] < (entity_traits::reserved & ~entity_traits::entity_mask)">packed[$i]</ValueNode>
|
||||
<ValueNode>tombstone</ValueNode>
|
||||
</IndexListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
<Type Name="entt::basic_storage<*>">
|
||||
<DisplayString>{{ size={ base_type::packed.size() } }}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[capacity]" Optional="true">packed.first_base::value.capacity() * packed_page_v</Item>
|
||||
<Item Name="[page size]" Optional="true">packed_page_v</Item>
|
||||
<Item Name="[entities]">(base_type*)this,nd</Item>
|
||||
<IndexListItems Optional="true" Condition="base_type::packed.size() != 0">
|
||||
<Size>base_type::packed.size()</Size>
|
||||
<ValueNode Condition="base_type::packed[$i] < (entity_traits::reserved & ~entity_traits::entity_mask)">packed.first_base::value[$i / packed_page_v][$i & (packed_page_v - 1)]</ValueNode>
|
||||
<ValueNode>tombstone</ValueNode>
|
||||
</IndexListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
</AutoVisualizer>
|
||||
|
||||
@@ -59,18 +59,18 @@ struct entt_traits<std::uint64_t> {
|
||||
* @tparam Type Type of identifier.
|
||||
*/
|
||||
template<typename Type>
|
||||
class entt_traits {
|
||||
using entity_traits = internal::entt_traits<Type>;
|
||||
class entt_traits: private internal::entt_traits<Type> {
|
||||
using base_type = internal::entt_traits<Type>;
|
||||
|
||||
public:
|
||||
/*! @brief Value type. */
|
||||
using value_type = Type;
|
||||
/*! @brief Underlying entity type. */
|
||||
using entity_type = typename entity_traits::entity_type;
|
||||
using entity_type = typename base_type::entity_type;
|
||||
/*! @brief Underlying version type. */
|
||||
using version_type = typename entity_traits::version_type;
|
||||
using version_type = typename base_type::version_type;
|
||||
/*! @brief Reserved identifier. */
|
||||
static constexpr entity_type reserved = entity_traits::entity_mask | (entity_traits::version_mask << entity_traits::entity_shift);
|
||||
static constexpr entity_type reserved = base_type::entity_mask | (base_type::version_mask << base_type::entity_shift);
|
||||
|
||||
/**
|
||||
* @brief Converts an entity to its underlying type.
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
* @return The integral representation of the entity part.
|
||||
*/
|
||||
[[nodiscard]] static constexpr entity_type to_entity(const value_type value) ENTT_NOEXCEPT {
|
||||
return (to_integral(value) & entity_traits::entity_mask);
|
||||
return (to_integral(value) & base_type::entity_mask);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,8 +96,8 @@ public:
|
||||
* @return The integral representation of the version part.
|
||||
*/
|
||||
[[nodiscard]] static constexpr version_type to_version(const value_type value) ENTT_NOEXCEPT {
|
||||
constexpr auto version_mask = (entity_traits::version_mask << entity_traits::entity_shift);
|
||||
return ((to_integral(value) & version_mask) >> entity_traits::entity_shift);
|
||||
constexpr auto version_mask = (base_type::version_mask << base_type::entity_shift);
|
||||
return ((to_integral(value) & version_mask) >> base_type::entity_shift);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
* @return A properly constructed identifier.
|
||||
*/
|
||||
[[nodiscard]] static constexpr value_type construct(const entity_type entity, const version_type version) ENTT_NOEXCEPT {
|
||||
return value_type{(entity & entity_traits::entity_mask) | (static_cast<entity_type>(version) << entity_traits::entity_shift)};
|
||||
return value_type{(entity & base_type::entity_mask) | (static_cast<entity_type>(version) << base_type::entity_shift)};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,8 +125,8 @@ public:
|
||||
* @return A properly constructed identifier.
|
||||
*/
|
||||
[[nodiscard]] static constexpr value_type combine(const entity_type lhs, const entity_type rhs) ENTT_NOEXCEPT {
|
||||
constexpr auto version_mask = (entity_traits::version_mask << entity_traits::entity_shift);
|
||||
return value_type{(lhs & entity_traits::entity_mask) | (rhs & version_mask)};
|
||||
constexpr auto version_mask = (base_type::version_mask << base_type::entity_shift);
|
||||
return value_type{(lhs & base_type::entity_mask) | (rhs & version_mask)};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user