From 017487a18d9bb6e037a70b74d47b488dd1a30c26 Mon Sep 17 00:00:00 2001 From: Myles Busig Date: Mon, 17 Feb 2025 03:44:00 -0800 Subject: [PATCH] Add fractal.hpp with POD structure definitions --- include/fractal.hpp | 82 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 include/fractal.hpp diff --git a/include/fractal.hpp b/include/fractal.hpp new file mode 100644 index 0000000..774e5e5 --- /dev/null +++ b/include/fractal.hpp @@ -0,0 +1,82 @@ +#pragma once + +#include + +#include +#include +#include +#include + +namespace fractal { + +constexpr size_t g_max_groups = 32; +constexpr size_t g_max_weighted_groups = 32; +constexpr size_t g_max_variables = 32; +constexpr size_t g_max_concurrent_leafs = 1024; + +constexpr size_t g_max_rules_basic = 16; +constexpr size_t g_max_rules_marking = 4; + +using variable_id_t = uint32_t; +using group_id_t = uint32_t; +using weighted_group_id_t = uint32_t; + +enum class token_type_e { + none, + walk, + rotate, + generate, +}; + +struct variable_t { + token_type_e m_token = token_type_e::none; + mtl::fixed m_value; +}; + +struct group_characteristic_t { + static constexpr size_t g_max_group_size = 32; + + uint32_t m_factor; // Number of groups generated in succession + etl::vector m_variable_ids; +}; + +struct leaf_t { + group_id_t m_group_id; + mtl::vec2 m_position; + mtl::mat<2, 2> m_orientation; +}; + +struct weighted_leaf_t { + weighted_group_id_t m_weighed_group_id; + mtl::vec2 m_position; + mtl::mat<2, 2> m_orientation; +}; + +struct group_t { + static constexpr size_t g_max_child_leafs = 16; + static constexpr size_t g_max_group_points = 8; + + etl::vector m_child_leafs; + etl::vector m_points; +}; + +struct weighted_group_t { + static constexpr size_t g_max_group_weights = 8; + + etl::vector m_groups; + etl::vector m_weights; + uint32_t m_weight_total; +}; + +struct branch_rule_basic_t { + variable_id_t m_match; + weighted_group_id_t m_weighted_group; +}; + +struct branch_rule_marking_t { + variable_id_t m_match; + uint32_t m_point_id; +}; + +} // namespace fractal +