28 #include <engine/config.hpp>
40 template <
class T,
class Generator>
43 std::uniform_real_distribution<T> distribution(T{-1}, T{1});
46 for (std::size_t i = 0;
i < 3; ++
i)
55 const float3 swarm_center = {0, 100, 0};
56 const float swarm_radius = 25.0f;
57 const std::size_t male_count = 50;
58 const std::size_t queen_count = 50;
59 const std::size_t alate_count = male_count + queen_count;
61 const float3 male_scale = {0.5, 0.5, 0.5};
62 const float3 queen_scale = {1, 1, 1};
68 transform.
warp =
true;
73 std::uint32_t male_picking_flags = 0b01;
74 std::uint32_t queen_picking_flags = 0b10;
80 transform.
warp =
true;
86 male_model.instance_count = 0;
87 male_model.layers = 1;
119 queen_caste.
type = ::ant::caste::queen;
123 male_caste.
type = ::ant::caste::male;
126 std::random_device seed;
127 std::mt19937 rng(seed());
130 for (std::size_t i = 0; i < alate_count; ++i)
133 steering.
agent.
position = swarm_center + sphere_random<float>(rng) * swarm_radius;
149 picking.
flags = male_picking_flags;
162 picking.
flags = queen_picking_flags;
std::unique_ptr< resource_manager > resource_manager
std::unique_ptr< entity::registry > entity_registry
void destroy_swarm(::game &ctx, entity::id swarm_eid)
entity::id create_swarm(::game &ctx)
entt::entity id
Entity ID type.
quaternion< T > normalize(const quaternion< T > &q)
Normalizes a quaternion.
constexpr T radians(T degrees) noexcept
Converts an angle given in degrees to radians.
@ position
Vertex position (vec3)
float max_force
Maximum force.
float3 acceleration
Acceleration vector.
float max_speed_squared
Maximum speed squared.
float mass
Mass of the agent.
float3 forward
Orthonormal basis forward direction vector.
float3 velocity
Velocity vector.
float max_speed
Maximum speed.
float3 up
Orthonormal basis up direction vector.
math::quaternion< float > orientation
Orientation quaternion.
float3 position
Cartesian position vector.
::ant::caste type
Caste type.
static constexpr quaternion identity() noexcept
Returns a rotation identity quaternion.
render::model * render_model
geom::primitive::sphere< float > sphere
Picking sphere.
std::uint32_t flags
Picking flags.
float sum_weights
Sum of steering behavior weights.
ai::steering::agent agent
Steering agent.