90 lines
1.8 KiB
C++
90 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
#include <etl/vector.h>
|
|
#include <mtl/fixed.hpp>
|
|
#include <mtl/vec.hpp>
|
|
#include <mtl/mat.hpp>
|
|
|
|
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 token_id_t = uint32_t;
|
|
using group_id_t = uint32_t;
|
|
using weighted_group_id_t = uint32_t;
|
|
using branch_rule_basic_id_t = uint32_t;
|
|
using branch_rule_marking_id_t = uint32_t;
|
|
|
|
enum class token_type_e {
|
|
none,
|
|
walk,
|
|
rotate,
|
|
generate,
|
|
};
|
|
|
|
struct token_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<token_id_t, g_max_group_size> m_token_ids;
|
|
};
|
|
|
|
struct marker_t {
|
|
mtl::vec2 m_pos;
|
|
uint32_t m_id;
|
|
};
|
|
|
|
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_child_markers = 8;
|
|
|
|
etl::vector<weighted_leaf_t, g_max_child_leafs> m_child_leafs;
|
|
etl::vector<marker_t, g_max_child_markers> m_child_markers;
|
|
};
|
|
|
|
struct weighted_group_t {
|
|
static constexpr size_t g_max_group_weights = 8;
|
|
|
|
etl::vector<group_id_t, g_max_group_weights> m_groups;
|
|
etl::vector<uint32_t, g_max_group_weights> m_weights;
|
|
uint32_t m_weight_total;
|
|
};
|
|
|
|
struct branch_rule_basic_t {
|
|
token_id_t m_match;
|
|
weighted_group_id_t m_weighted_group;
|
|
};
|
|
|
|
struct branch_rule_marking_t {
|
|
token_id_t m_match;
|
|
uint32_t m_marker_id;
|
|
};
|
|
|
|
} // namespace fractal
|
|
|