Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
d8b08a3
[iceshard] Fixing issues with webasm platform.
Dandielo Oct 1, 2024
d1b20a6
Feature devui widgets (#180)
Dandielo Nov 4, 2024
eeddc9b
Merge branch 'master' of https://github.com/iceshard-engine/engine in…
Dandielo Feb 6, 2025
7a01cc2
[iceshard] New log macros that are also defining profiling zones.
Dandielo Feb 4, 2025
15b10f9
[iceshard] Refactored resource handles and creation of resource objects.
Dandielo Feb 4, 2025
b42cab2
[iceshard] Updated parts of the engine after the resource handle refa…
Dandielo Feb 4, 2025
e99095c
[iceshard] Working proof-of-concept for writing resource files.
Dandielo Feb 4, 2025
0fcf7cf
[iceshard] Continued work on resource writing.
Dandielo Feb 6, 2025
1c1a323
[iceshard] Small fixes and improvements.
Dandielo Feb 6, 2025
65cc86d
[iceshard] Refactored how Trait method bindings are made.
Dandielo Feb 6, 2025
bb64540
[iceshard] Refactored how events are handled in the engine.
Dandielo Feb 6, 2025
2861c33
[iceshard] Introduced a few ProxyAllocators for better tracking.
Dandielo Feb 6, 2025
320619a
Merge branch 'master' of https://github.com/iceshard-engine/engine in…
Dandielo Feb 6, 2025
14062b4
Merge branch 'public' of https://github.com/iceshard-engine/game-cher…
Dandielo Feb 6, 2025
61b9fcd
[iceshard] Improvements to the engine.
Dandielo Feb 11, 2025
0f72b58
Merge branch 'master' of https://github.com/iceshard-engine/engine in…
Dandielo Feb 11, 2025
27636d4
[iceshard] Added new decution guide for Span for Container types.
Dandielo Feb 13, 2025
91dee26
[iceshard] Refactored ECS EntityStorage and TraitArchive types.
Dandielo Feb 13, 2025
6b8f3b8
[iceshard] Expanded Trait task binding API.
Dandielo Feb 13, 2025
001c9a3
Merge branch 'master' of https://github.com/iceshard-engine/engine in…
Dandielo Feb 13, 2025
9d4115d
[iceshard] Small changes.
Dandielo Feb 27, 2025
e690f2b
[iceshard] ECS ArchetypeIndex can now be queried for Archetypes by name.
Dandielo Feb 27, 2025
8f87437
[iceshard] Continued changes to trait bindings. Small refactor on the…
Dandielo Feb 27, 2025
098ec2f
[iceshard] Added support for function variables in .asl shaders.
Dandielo Feb 27, 2025
6a7a628
[iceshard] The 'RenderDevice::destroy_buffer' function can now handle…
Dandielo Feb 27, 2025
429eb6d
[iceshard] Camera Trait now also provides 'ice::render::Buffer' objec…
Dandielo Feb 27, 2025
93e5909
[iceshard][shaders] .asl parser seems to have a bug when the first li…
Dandielo Feb 27, 2025
8422670
[iceshard] Update hailstorm to v0.3.0.
Dandielo Apr 28, 2025
995d684
[iceshard] Minor improvements to VarString API
Dandielo Apr 28, 2025
953e394
[iceshard] Update hailstorm to v0.4.0.
Dandielo May 3, 2025
5ef4acb
[iceshard] Fixed generation of expressions and array variables.
Dandielo May 5, 2025
f1b4659
[iceshard] Refactored how various ECS objects are interacting and acc…
Dandielo May 5, 2025
7efadc9
[iceshard] Various build-fixes for Webassembly and Android
Dandielo May 5, 2025
15ed75b
[iceshard] Update configurations.
Dandielo May 5, 2025
14035c1
[iceshard] Removed all references to no longer used 'EntityHandle'
Dandielo May 5, 2025
416ba84
[iceshard] Simplifying query definitions.
Dandielo May 6, 2025
25713c8
[iceshard] WIP: Refactored the Query type.
Dandielo May 7, 2025
d53ce09
[iceshard] Expanded query features.
Dandielo May 8, 2025
adc8014
[iceshard] Implemented additional tools for operations on tupe types.
Dandielo May 11, 2025
34df8b6
[iceshard] More changes to how queries are defined, used and synchron…
Dandielo May 11, 2025
25a3adc
[iceshard] Fixed small bug where a synchronized query would release a…
Dandielo May 11, 2025
9cdab98
[iceshard] Updated licenses
Dandielo May 11, 2025
08ae3e7
[iceshard] Updating all file license headers.
Dandielo May 12, 2025
64b37a3
[iceshard] Cleaning up Entity and Archertype implementations.
Dandielo May 12, 2025
a2cb144
[iceshard] Cleaned up 'DataBlock' and 'DataBlockPool' types.
Dandielo May 12, 2025
ea1cb40
[iceshard] Cleaning up documentation and reviving an old Doxygen conf…
Dandielo May 12, 2025
cff2c93
[iceshard] Some fixes in the documentation.
Dandielo May 12, 2025
63e4469
[iceshard] Small improvements in the 'doxy' subcommand.
Dandielo May 12, 2025
638b4c8
[iceshard] Added new utility method to register archetypes.
Dandielo May 12, 2025
5c1d9a3
[iceshard] Remove old unused code.
Dandielo May 12, 2025
fa5d0dc
[iceshard] Fixed compilation error on clang.
Dandielo May 12, 2025
a82043b
Merge remote-tracking branch 'origin/public' into public
Dandielo May 12, 2025
5197fc2
Merge remote-tracking branch 'public/master' into public
Dandielo May 19, 2025
09d82ee
Merge branch 'master' of https://github.com/iceshard-engine/engine in…
Dandielo Jun 7, 2025
5858e4c
[iceshard][hotfix] Don't set vulkan allocation callbacks, the code ne…
Dandielo Jun 7, 2025
7a67058
Merge branch 'master' of https://github.com/iceshard-engine/engine in…
Dandielo Jun 10, 2025
b7f0a23
Merge branch 'master' of https://github.com/iceshard-engine/engine in…
Dandielo Jun 16, 2025
b47b493
[iceshard] Add new functions for 2d vector math.
Dandielo Jun 10, 2025
7374c91
[icehsard] Renamed 'DevUIWidget::info' member to 'widget_info'
Dandielo Jun 10, 2025
6cf5ea6
[iceshard] Add utility function 'recreate' to 'EntityIndex' type.
Dandielo Jun 11, 2025
3efef2e
[iceshard] Implemented 'ice::accumulate' based on 'std' version.
Dandielo Jun 12, 2025
24f2812
[iceshard] Implemented a 'filtering' feature for queries.
Dandielo Jun 12, 2025
362d977
[iceshard] More changes to EntityOperations type.
Dandielo Jun 12, 2025
8a2ac6a
[iceshard] Fixed crash due to multiple threads accessing the same ass…
Dandielo Jun 13, 2025
ed077e6
[iceshard] Improved API for entity operations.
Dandielo Jun 13, 2025
d37ec07
[iceshard] Introduced 'search_with' function, which passes all additi…
Dandielo Jun 13, 2025
9994a9a
[iceshard] Fixed clocks being out-of-whack due to update issues.
Dandielo Jun 16, 2025
be8974c
[iceshard] Introduced 'destructor' feature for ecs storage.
Dandielo Jun 23, 2025
c7fafd7
Fixed missing changes to Query awaitables after implementing runtime …
Dandielo Jun 23, 2025
d750a11
Fixed Queries not returning results if only tags are used.
Dandielo Jun 23, 2025
41bfd91
Fix build issues on Emscripten.
Dandielo Jun 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions source/code/core/collections/public/ice/sort.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,20 @@ namespace ice
return false;
}

template<typename T, typename Comp, typename... U>
constexpr bool search_with(ice::Span<T> values, Comp&& comp, ice::ucount& out_index, U const&... params) noexcept
{
for (ice::u32 idx = 0; idx < ice::span::count(values); ++idx)
{
if (ice::forward<Comp>(comp)(values[idx], idx, params...))
{
out_index = idx;
return true;
}
}
return false;
}

namespace detail
{

Expand Down
4 changes: 2 additions & 2 deletions source/code/core/devui/private/devui_widget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ namespace ice
{

DevUIWidget::DevUIWidget(ice::DevUIWidgetInfo const& info) noexcept
: info{ info }
: widget_info{ info }
{
}

void DevUIWidget::build_widget(ice::DevUIFrame& frame, ice::DevUIWidgetState& state) noexcept
{
if (frame.begin(info, state))
if (frame.begin(widget_info, state))
{
this->build_menu();
this->build_content();
Expand Down
2 changes: 1 addition & 1 deletion source/code/core/devui/public/ice/devui_widget.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace ice

virtual bool build_mainmenu(ice::DevUIWidgetState& state) noexcept;

ice::DevUIWidgetInfo const info;
ice::DevUIWidgetInfo const widget_info;
};

} // namespace ice
29 changes: 27 additions & 2 deletions source/code/core/math/public/ice/math/matrix.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,25 @@ namespace ice::math
struct mat
{
using value_type = T;
static constexpr auto count_rows = Rows;
static constexpr auto count_columns = Cols;
static constexpr u32 count_rows = Rows;
static constexpr u32 count_columns = Cols;

T v[count_columns][count_rows];
};

template<typename T>
struct mat<2, 2, T>
{
using value_type = T;
static constexpr u32 count_rows = 3;
static constexpr u32 count_columns = 3;

T v[count_columns][count_rows];

template<typename U>
constexpr operator mat<3, 3, U>() noexcept;
};


template<typename Mat>
constexpr auto identity() noexcept;
Expand All @@ -31,6 +44,18 @@ namespace ice::math
using mat4x4 = mat<4, 4, f32>;
using mat4 = mat4x4;

template<typename T>
template<typename U>
constexpr mat<2, 2, T>::operator mat<3, 3, U>() noexcept
{
mat<3, 3, U> result;
result.v[0][0] = v[0][0];
result.v[0][1] = v[0][1];
result.v[1][0] = v[1][0];
result.v[1][1] = v[1][1];
result.v[2][2] = 1;
return result;
}

template<typename Mat>
constexpr auto identity() noexcept
Expand Down
20 changes: 20 additions & 0 deletions source/code/core/math/public/ice/math/rotate.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,38 @@
namespace ice::math
{

inline auto rotate2d(rad rad) noexcept -> mat<2, 2, f32>;
inline auto rotate(rad rad, vec<3, f32> v) noexcept -> mat<4, 4, f32>;

inline auto rotate2d(mat<2, 2, f32> left, rad rad) noexcept -> mat<2, 2, f32>;
inline auto rotate(mat<4, 4, f32> left, rad rad, vec<3, f32> v) noexcept -> mat<4, 4, f32>;

inline auto rotation(mat<4, 4, f32> const& matrix) noexcept -> vec<3, rad>;


inline auto rotate2d(rad rad) noexcept -> mat<2, 2, f32>
{
return rotate2d(mat2x2_identity, rad);
}

inline auto rotate(rad rad, vec<3, f32> v) noexcept -> mat<4, 4, f32>
{
return rotate(mat4x4_identity, rad, v);
}

inline auto rotate2d(mat<2, 2, f32> left, rad rad) noexcept -> mat<2, 2, f32>
{
f32 const cosv = cos(rad);
f32 const sinv = sin(rad);

mat<2, 2, f32> rm = mat2x2_identity;
rm.v[0][0] = cosv;
rm.v[0][1] = sinv;
rm.v[1][0] = -sinv;
rm.v[1][1] = cosv;
return mul(left, rm);
}

inline auto rotate(mat<4, 4, f32> left, rad rad, vec<3, f32> v) noexcept -> mat<4, 4, f32>
{
f32 const cosv = cos(rad);
Expand Down
15 changes: 15 additions & 0 deletions source/code/core/math/public/ice/math/scale.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,33 @@
namespace ice::math
{

constexpr auto scale2d(vec<2, f32> v) noexcept -> mat<2, 2, f32>;
constexpr auto scale(vec<3, f32> v) noexcept -> mat<4, 4, f32>;

constexpr auto scale2d(mat<2, 2, f32> left, vec<2, f32> right) noexcept -> mat<2, 2, f32>;
constexpr auto scale(mat<4, 4, f32> left, vec<3, f32> right) noexcept -> mat<4, 4, f32>;

constexpr auto scale(mat<4, 4, f32> const& matrix) noexcept -> vec<3, f32>;


constexpr auto scale2d(vec<2, f32> v) noexcept -> mat<2, 2, f32>
{
return scale2d(mat2x2_identity, v);
}

constexpr auto scale(vec<3, f32> v) noexcept -> mat<4, 4, f32>
{
return scale(mat4x4_identity, v);
}

constexpr auto scale2d(mat<2, 2, f32> left, vec<2, f32> right) noexcept -> mat<2, 2, f32>
{
mat<2, 2, f32> temp{ };
temp.v[0][0] = right.v[0][0];
temp.v[1][1] = right.v[0][1];
return mul(left, temp);
}

constexpr auto scale(mat<4, 4, f32> left, vec<3, f32> right) noexcept -> mat<4, 4, f32>
{
mat<4, 4, f32> temp{ };
Expand Down
20 changes: 20 additions & 0 deletions source/code/core/math/public/ice/math/translate.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,33 @@
namespace ice::math
{

constexpr auto translate(vec<2, f32> displacement) noexcept -> mat<3, 3, f32>;
constexpr auto translate(vec<3, f32> displacement) noexcept -> mat<4, 4, f32>;

constexpr auto translate(mat<3, 3, f32> left, vec<2, f32> right) noexcept -> mat<3, 3, f32>;
constexpr auto translate(mat<4, 4, f32> left, vec<3, f32> right) noexcept -> mat<4, 4, f32>;

constexpr auto translation(mat<3, 3, f32> const& matrix) noexcept -> vec<2, f32>;
constexpr auto translation(mat<4, 4, f32> const& matrix) noexcept -> vec<3, f32>;


constexpr auto translate(vec<2, f32> displacement) noexcept -> mat<3, 3, f32>
{
return translate(mat3x3_identity, displacement);
}

constexpr auto translate(vec<3, f32> displacement) noexcept -> mat<4, 4, f32>
{
return translate(mat4x4_identity, displacement);
}

constexpr auto translate(mat<3, 3, f32> left, vec<2, f32> right) noexcept -> mat<3, 3, f32>
{
left.v[2][0] += right.v[0][0];
left.v[2][1] += right.v[0][1];
return left;
}

constexpr auto translate(mat<4, 4, f32> left, vec<3, f32> right) noexcept -> mat<4, 4, f32>
{
left.v[3][0] += right.v[0][0];
Expand All @@ -27,6 +42,11 @@ namespace ice::math
return left;
}

constexpr auto translation(mat<3, 3, f32> const& matrix) noexcept -> vec<2, f32>
{
return { matrix.v[2][0], matrix.v[2][1] };
}

constexpr auto translation(mat<4, 4, f32> const& matrix) noexcept -> vec<3, f32>
{
return { matrix.v[3][0], matrix.v[3][1], matrix.v[3][2] };
Expand Down
4 changes: 4 additions & 0 deletions source/code/core/math/public/ice/math/vector.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ namespace ice::math
: v{ { static_cast<T>(other.x), static_cast<T>(other.y) } }
{ }

constexpr explicit mat(T const(&array)[3]) noexcept
: v{ { array[0] / array[2], array[1] / array[2] } }
{ }

union
{
T v[count_columns][count_rows];
Expand Down
17 changes: 17 additions & 0 deletions source/code/core/utils/public/ice/algorithm.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/// Copyright 2025 - 2025, Dandielo <[email protected]>
/// SPDX-License-Identifier: MIT

#pragma once
#include <algorithm>
#include <numeric>

namespace ice
{

template<typename T, typename U = T>
constexpr auto accumulate(ice::Span<T const> range, U val) noexcept
{
return ::std::accumulate(ice::begin(range), ice::end(range), val);
}

} // namespace ice
9 changes: 3 additions & 6 deletions source/code/example/webasm/private/example_webasm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ struct TestTrait : public ice::Trait
ice::Timer timer;

using TestArchetype = ice::ecs::ArchetypeDefinition<C1, C2>;
static constexpr ice::ecs::ArchetypeDefinition Archetype_TestArchetype = TestArchetype{};
static constexpr ice::ecs::ArchetypeDefinition Archetype_TestArchetype = TestArchetype{ "test-arch" };

ice::ecs::EntityOperations* _ops;
ice::ecs::Entity _my_entity[10000];
Expand All @@ -123,8 +123,7 @@ struct TestTrait : public ice::Trait

update.engine.entity_index().create_many(_my_entity);
_ops = ice::addressof(update.world.entity_operations());

ice::ecs::queue_set_archetype(*_ops, _my_entity, Archetype_TestArchetype);
_ops->set("test-arch", _my_entity);

ICE_LOG(LogSeverity::Retail, LogTag::Game, "Test Activated!");
timer = ice::timer::create_timer(update.clock, 100_Tms);
Expand All @@ -138,7 +137,7 @@ struct TestTrait : public ice::Trait
query<ice::ecs::Entity>().tags<C1, C2>().for_each_block(
[&](ice::ucount count, ice::ecs::Entity const* entities) noexcept
{
ice::ecs::queue_batch_remove_entities(*_ops, { entities, count });
_ops->destroy({ entities, count });
}
);

Expand Down Expand Up @@ -187,9 +186,7 @@ struct TestTrait : public ice::Trait
ICE_LOG(LogSeverity::Info, LogTag::Game, "TestTrait::logic {}", x.load());
}

ICE_LOG(LogSeverity::Debug, LogTag::Game, "{}", std::hash<std::thread::id>{}(std::this_thread::get_id()));
co_await ice::await_scheduled_on(tasks, update.thread.tasks, update.thread.main);
ICE_LOG(LogSeverity::Debug, LogTag::Game, "{}", std::hash<std::thread::id>{}(std::this_thread::get_id()));
co_return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,8 @@ auto ice_game_frame(
state.platform.core->refresh_events();
ice::ShardContainer const& system_events = state.platform.core->system_events();

// Update the system clock
ice::clock::update(runtime.clock);
ice::clock::update(runtime.game_clock);

ice::UniquePtr<ice::EngineFrame> new_frame = co_await logic.aquire_frame();
Expand Down Expand Up @@ -636,9 +638,6 @@ auto ice_update(
ice::app::Runtime& runtime
) noexcept -> ice::Result
{
// Update the system clock
ice::clock::update(runtime.clock);

// Process any awaiting main thread tasks.
runtime.main_queue.process_all();

Expand Down
33 changes: 12 additions & 21 deletions source/code/iceshard/engine/private/ecs/ecs_archetype_index.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ namespace ice::ecs
return base_offset;
}

auto contains_required_components(
bool contains_required_components(
ice::Span<ice::ecs::detail::QueryTypeInfo const> in_conditions,
ice::Span<ice::StringID const> in_required_tags,
ice::Span<ice::StringID const> checked_identifiers
) noexcept -> ice::u32
) noexcept
{
using QueryTypeInfo = ice::ecs::detail::QueryTypeInfo;

Expand Down Expand Up @@ -65,6 +65,7 @@ namespace ice::ecs
}

// As long as we have something to check and we did not fail search for the next ID
[[maybe_unused]]
ice::u32 matched_components = 0;

// Reset for checking the remaining conditions
Expand Down Expand Up @@ -93,7 +94,7 @@ namespace ice::ecs
matched_components += (identifier_hash == condition_hash);
}

return result ? matched_components : 0;
return result;
}

} // namespace detail
Expand Down Expand Up @@ -171,6 +172,7 @@ namespace ice::ecs

auto ArchetypeIndex::register_archetype(
ice::ecs::ArchetypeInfo const& archetype_info,
ice::ecs::detail::DataBlockFilter data_block_filter,
ice::ecs::detail::DataBlockPool* data_block_pool
) noexcept -> ice::ecs::Archetype
{
Expand Down Expand Up @@ -255,6 +257,7 @@ namespace ice::ecs

data_header->archetype_name = ice::String{ (char const*) mem_archetype_name.location, ice::size(archetype_info.name) };
data_header->archetype_identifier = archetype_info.identifier;
data_header->archetype_info.data_block_filter = data_block_filter;
data_header->archetype_info.component_identifiers = ice::Span<ice::StringID const>{ component_identifiers, component_count };
data_header->archetype_info.component_sizes = ice::Span<ice::u32 const>{ component_sizes, component_count };
data_header->archetype_info.component_alignments = ice::Span<ice::u32 const>{ component_alignments, component_count };
Expand All @@ -264,23 +267,11 @@ namespace ice::ecs
// We need now to calculate the number of entities that we can store in the remaining memory.
// Additionally calculate the offets each component array will be located at.
{
ice::u32 const component_size_sum = std::accumulate(
component_sizes,
component_sizes + component_count,
0
);

ice::u32 const component_alignment_sum = std::accumulate(
component_alignments,
component_alignments + component_count,
0
ice::ucount const component_entity_count_max = ice::ecs::detail::calculate_entity_count_for_space(
data_header->archetype_info,
data_block_pool->provided_block_size()
);

ice::usize const block_size = data_block_pool->provided_block_size();
ice::usize const available_block_size = { block_size.value - component_alignment_sum };

data_header->archetype_info.component_entity_count_max = ice::ucount(available_block_size.value / component_size_sum);

ice::u32 next_component_offset = 0;
for (ice::u32 idx = 0; idx < component_count; ++idx)
{
Expand All @@ -300,7 +291,7 @@ namespace ice::ecs
next_component_offset = ice::ecs::detail::align_forward_u32(next_component_offset, component_alignments[idx]);
component_offsets[idx] = next_component_offset;

next_component_offset += component_sizes[idx] * data_header->archetype_info.component_entity_count_max;
next_component_offset += component_sizes[idx] * component_entity_count_max;
}
}
}
Expand Down Expand Up @@ -377,15 +368,15 @@ namespace ice::ecs
continue;
}

ice::u32 const matched_components = ice::ecs::detail::contains_required_components(
bool const was_matched = ice::ecs::detail::contains_required_components(
query_info,
query_tags,
archetype_info.component_identifiers
);

// If we don't match any component in a full optional query, we still skip this archetype.
// #todo: we should probably also check for the existance of the EntityHandle in the query. Then the check should be `> 1`
if (matched_components > 0)
if (was_matched)
{
ice::array::push_back(out_archetypes, entry->archetype_identifier);
}
Expand Down
Loading
Loading