Add fractal.hpp with POD structure definitions
This commit is contained in:
parent
a002ea7b94
commit
017487a18d
82
include/fractal.hpp
Normal file
82
include/fractal.hpp
Normal file
@ -0,0 +1,82 @@
|
||||
#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 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<variable_id_t, g_max_group_size> 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<weighted_leaf_t, g_max_child_leafs> m_child_leafs;
|
||||
etl::vector<mtl::vec2, g_max_group_points> m_points;
|
||||
};
|
||||
|
||||
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 {
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user