diff --git a/CMakeLists.txt b/CMakeLists.txt
index d4aa351..af368e1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.7)
+
option(VERSION_STRING "Project version string" "0.0.0")
project(antkeeper VERSION ${VERSION_STRING} LANGUAGES CXX)
diff --git a/src/entity/systems/nest.cpp b/src/entity/systems/nest.cpp
deleted file mode 100644
index b725d91..0000000
--- a/src/entity/systems/nest.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2021 Christopher J. Howard
- *
- * This file is part of Antkeeper source code.
- *
- * Antkeeper source code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Antkeeper source code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Antkeeper source code. If not, see .
- */
-
-#include "nest.hpp"
-#include "../../nest.hpp"
-#include "math/math.hpp"
-
-namespace entity {
-namespace system {
-
-nest::nest(entity::registry& registry, ::resource_manager* resource_manager):
- updatable(registry),
- resource_manager(resource_manager)
-{
- registry.on_construct().connect<&nest::on_nest_construct>(this);
- registry.on_destroy().connect<&nest::on_nest_destroy>(this);
-}
-
-nest::~nest()
-{}
-
-void nest::update(double t, double dt)
-{}
-
-void nest::on_nest_construct(entity::registry& registry, entity::id entity_id, component::nest& component)
-{
- /*
- // Allocate a nest
- ::nest* nest = new ::nest();
-
- // Setup initial nest parameters
- nest->set_tunnel_radius(1.15f);
- nest::shaft* central_shaft = nest->get_central_shaft();
- central_shaft->chirality = -1.0f;
- central_shaft->rotation = math::radians(0.0f);
- central_shaft->depth = {0.0f, 100.0f};
- central_shaft->current_depth = 0.0f;
- central_shaft->radius = {0.0f, 5.0f};
- central_shaft->pitch = {4.0f, 8.0f};
- central_shaft->translation = {{{0.0f, 0.0f}, {20.0f, 11.0f}}};
- for (std::size_t i = 0; i < 4; ++i)
- {
- nest::chamber chamber;
- chamber.shaft = central_shaft;
- chamber.depth = (i + 1) * 23.0f;
- chamber.rotation = math::radians(0.0f);
- chamber.inner_radius = 4.0f;
- chamber.outer_radius = 10.0f;
- central_shaft->chambers.push_back(chamber);
- }
- */
-}
-
-void nest::on_nest_destroy(entity::registry& registry, entity::id entity_id)
-{}
-
-} // namespace system
-} // namespace entity
diff --git a/src/entity/systems/nest.hpp b/src/entity/systems/nest.hpp
deleted file mode 100644
index 2ae843c..0000000
--- a/src/entity/systems/nest.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2021 Christopher J. Howard
- *
- * This file is part of Antkeeper source code.
- *
- * Antkeeper source code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Antkeeper source code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Antkeeper source code. If not, see .
- */
-
-#ifndef ANTKEEPER_ENTITY_SYSTEM_NEST_HPP
-#define ANTKEEPER_ENTITY_SYSTEM_NEST_HPP
-
-#include "entity/systems/updatable.hpp"
-#include "entity/components/nest.hpp"
-
-class nest;
-class resource_manager;
-
-namespace entity {
-namespace system {
-
-class nest: public updatable
-{
-public:
- nest(entity::registry& registry, ::resource_manager* resource_manager);
- ~nest();
- virtual void update(double t, double dt);
-
-private:
- resource_manager* resource_manager;
-
- void on_nest_construct(entity::registry& registry, entity::id entity_id, entity::component::nest& component);
- void on_nest_destroy(entity::registry& registry, entity::id entity_id);
-};
-
-} // namespace system
-} // namespace entity
-
-#endif // ANTKEEPER_ENTITY_SYSTEM_NEST_HPP
-
diff --git a/src/game/bootloader.cpp b/src/game/bootloader.cpp
index 83c05bb..1e1178b 100644
--- a/src/game/bootloader.cpp
+++ b/src/game/bootloader.cpp
@@ -60,7 +60,6 @@
#include "entity/systems/collision.hpp"
#include "entity/systems/constraint.hpp"
#include "entity/systems/locomotion.hpp"
-#include "entity/systems/nest.hpp"
#include "entity/systems/snapping.hpp"
#include "entity/systems/render.hpp"
#include "entity/systems/samara.hpp"
@@ -87,7 +86,6 @@
#include "input/game-controller.hpp"
#include "input/mouse.hpp"
#include "input/keyboard.hpp"
-#include "pheromone-matrix.hpp"
#include "configuration.hpp"
#include "input/scancode.hpp"
#include
@@ -825,9 +823,6 @@ void setup_systems(game::context* ctx)
ctx->subterrain_system = new entity::system::subterrain(*ctx->entity_registry, ctx->resource_manager);
ctx->subterrain_system->set_scene(ctx->underground_scene);
- // Setup nest system
- ctx->nest_system = new entity::system::nest(*ctx->entity_registry, ctx->resource_manager);
-
// Setup collision system
ctx->collision_system = new entity::system::collision(*ctx->entity_registry);
@@ -843,16 +838,6 @@ void setup_systems(game::context* ctx)
// Setup locomotion system
ctx->locomotion_system = new entity::system::locomotion(*ctx->entity_registry);
- // Setup pheromone system
- ctx->pheromones = new pheromone_matrix();
- ctx->pheromones->rows = 256;
- ctx->pheromones->columns = 256;
- ctx->pheromones->buffers = new float*[2];
- ctx->pheromones->buffers[0] = new float[ctx->pheromones->rows * ctx->pheromones->columns];
- ctx->pheromones->buffers[1] = new float[ctx->pheromones->rows * ctx->pheromones->columns];
- ctx->pheromones->current = 0;
- //diffuse(ctx->pheromones);
-
// Setup spatial system
ctx->spatial_system = new entity::system::spatial(*ctx->entity_registry);
@@ -979,7 +964,8 @@ void setup_controls(game::context* ctx)
ctx->menu_controls->add_control(ctx->menu_select_control);
// Create camera controls
- ctx->camera_control_modifier = new input::control();
+ ctx->camera_control_slow_modifier = new input::control();
+ ctx->camera_control_fast_modifier = new input::control();
ctx->camera_control_mouse_rotate = new input::control();
ctx->camera_control_mouse_left = new input::control();
ctx->camera_control_mouse_right = new input::control();
@@ -1001,10 +987,13 @@ void setup_controls(game::context* ctx)
ctx->input_event_router->add_mapping(input::key_mapping(ctx->toggle_fullscreen_control, nullptr, input::scancode::f11));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->screenshot_control, nullptr, input::scancode::f12));
- /*
- // Add menu control mappings
+ // UI controls
ctx->input_event_router->add_mapping(input::key_mapping(ctx->menu_back_control, nullptr, input::scancode::escape));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->menu_back_control, nullptr, input::scancode::backspace));
+
+ /*
+ // Add menu control mappings
+
ctx->input_event_router->add_mapping(input::game_controller_button_mapping(ctx->menu_back_control, nullptr, input::game_controller_button::b));
//ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_tool_menu_control(), nullptr, input::scancode::left_shift));
ctx->input_event_router->add_mapping(input::game_controller_button_mapping(ctx->control_system->get_tool_menu_control(), nullptr, input::game_controller_button::x));
@@ -1119,7 +1108,8 @@ void setup_controls(game::context* ctx)
);
*/
- ctx->input_event_router->add_mapping(input::key_mapping(ctx->camera_control_modifier, nullptr, input::scancode::left_shift));
+ ctx->input_event_router->add_mapping(input::key_mapping(ctx->camera_control_slow_modifier, nullptr, input::scancode::left_ctrl));
+ ctx->input_event_router->add_mapping(input::key_mapping(ctx->camera_control_fast_modifier, nullptr, input::scancode::left_shift));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->camera_control_dolly_forward, nullptr, input::scancode::w));
ctx->input_event_router->add_mapping(input::game_controller_axis_mapping(ctx->camera_control_dolly_forward, nullptr, input::game_controller_axis::left_y, true));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->camera_control_dolly_backward, nullptr, input::scancode::s));
@@ -1170,7 +1160,8 @@ void setup_callbacks(game::context* ctx)
// Update controls
ctx->application_controls->update();
ctx->menu_controls->update();
- ctx->camera_control_modifier->update();
+ ctx->camera_control_slow_modifier->update();
+ ctx->camera_control_fast_modifier->update();
ctx->camera_control_mouse_rotate->update();
ctx->camera_control_mouse_left->update();
ctx->camera_control_mouse_right->update();
@@ -1207,7 +1198,6 @@ void setup_callbacks(game::context* ctx)
ctx->terrain_system->update(t, dt);
//ctx->vegetation_system->update(t, dt);
ctx->snapping_system->update(t, dt);
- ctx->nest_system->update(t, dt);
ctx->subterrain_system->update(t, dt);
ctx->collision_system->update(t, dt);
ctx->samara_system->update(t, dt);
diff --git a/src/game/context.hpp b/src/game/context.hpp
index d07cb69..cd95b3f 100644
--- a/src/game/context.hpp
+++ b/src/game/context.hpp
@@ -53,7 +53,6 @@ class config_file;
class final_pass;
class material;
class material_pass;
-class pheromone_matrix;
class resource_manager;
class screen_transition;
class shadow_map_pass;
@@ -242,7 +241,8 @@ struct context
input::control* camera_control_pan_right;
input::control* camera_control_tilt_up;
input::control* camera_control_tilt_down;
- input::control* camera_control_modifier;
+ input::control* camera_control_slow_modifier;
+ input::control* camera_control_fast_modifier;
// Entities
entity::registry* entity_registry;
@@ -261,7 +261,6 @@ struct context
entity::system::collision* collision_system;
entity::system::constraint* constraint_system;
entity::system::locomotion* locomotion_system;
- entity::system::nest* nest_system;
entity::system::snapping* snapping_system;
entity::system::render* render_system;
entity::system::samara* samara_system;
@@ -284,9 +283,6 @@ struct context
// Debug
debug::cli* cli;
-
- // Misc
- pheromone_matrix* pheromones;
};
} // namespace game
diff --git a/src/game/states/brood.cpp b/src/game/states/brood.cpp
index bab8e95..435b4ea 100644
--- a/src/game/states/brood.cpp
+++ b/src/game/states/brood.cpp
@@ -233,7 +233,7 @@ void setup_controls(game::context* ctx)
entity::id target_eid = entity::command::find(*ctx->entity_registry, "underground_cam_target");
entity::id three_dof_eid = entity::command::find(*ctx->entity_registry, "underground_cam_3dof");
- const float dolly_speed = 10.0f;
+ const float dolly_speed = 20.0f;
const float truck_speed = dolly_speed;
const float pedestal_speed = 30.0f;
const float pan_speed = math::radians(8.0f);
@@ -244,6 +244,11 @@ void setup_controls(game::context* ctx)
(
[ctx, target_eid, three_dof_eid, truck_speed](float value)
{
+ if (ctx->camera_control_slow_modifier->is_active())
+ value *= 0.5f;
+ if (ctx->camera_control_fast_modifier->is_active())
+ value *= 2.0f;
+
auto& three_dof = ctx->entity_registry->get(three_dof_eid);
const math::quaternion yaw = math::angle_axis(three_dof.yaw, {0.0f, 1.0f, 0.0f});
@@ -257,6 +262,11 @@ void setup_controls(game::context* ctx)
(
[ctx, target_eid, three_dof_eid, truck_speed](float value)
{
+ if (ctx->camera_control_slow_modifier->is_active())
+ value *= 0.5f;
+ if (ctx->camera_control_fast_modifier->is_active())
+ value *= 2.0f;
+
auto& three_dof = ctx->entity_registry->get(three_dof_eid);
const math::quaternion yaw = math::angle_axis(three_dof.yaw, {0.0f, 1.0f, 0.0f});
@@ -270,6 +280,11 @@ void setup_controls(game::context* ctx)
(
[ctx, target_eid, three_dof_eid, truck_speed](float value)
{
+ if (ctx->camera_control_slow_modifier->is_active())
+ value *= 0.5f;
+ if (ctx->camera_control_fast_modifier->is_active())
+ value *= 2.0f;
+
auto& three_dof = ctx->entity_registry->get(three_dof_eid);
const math::quaternion yaw = math::angle_axis(three_dof.yaw, {0.0f, 1.0f, 0.0f});
@@ -283,6 +298,11 @@ void setup_controls(game::context* ctx)
(
[ctx, target_eid, three_dof_eid, truck_speed](float value)
{
+ if (ctx->camera_control_slow_modifier->is_active())
+ value *= 0.5f;
+ if (ctx->camera_control_fast_modifier->is_active())
+ value *= 2.0f;
+
auto& three_dof = ctx->entity_registry->get(three_dof_eid);
const math::quaternion yaw = math::angle_axis(three_dof.yaw, {0.0f, 1.0f, 0.0f});
@@ -292,48 +312,32 @@ void setup_controls(game::context* ctx)
);
// Pedestal up
- ctx->camera_control_pedestal_up->set_activated_callback
- (
- [ctx, target_eid]()
- {
- if (ctx->camera_control_modifier->is_active())
- {
- // Snap to chamber
-
- // Find closest chamber
- // Pedestal to chamber + offset
- }
- }
- );
ctx->camera_control_pedestal_up->set_active_callback
(
[ctx, target_eid, pedestal_speed](float value)
{
- if (!ctx->camera_control_modifier->is_active())
- {
- const float3 movement = {0.0f, pedestal_speed * value * (1.0f / 60.0f), 0.0f};
- entity::command::translate(*ctx->entity_registry, target_eid, movement);
- }
+ if (ctx->camera_control_slow_modifier->is_active())
+ value *= 0.5f;
+ if (ctx->camera_control_fast_modifier->is_active())
+ value *= 2.0f;
+
+ const float3 movement = {0.0f, pedestal_speed * value * (1.0f / 60.0f), 0.0f};
+ entity::command::translate(*ctx->entity_registry, target_eid, movement);
}
);
// Pedestal down
- ctx->camera_control_pedestal_down->set_activated_callback
- (
- [ctx, target_eid]()
- {
- //...
- }
- );
ctx->camera_control_pedestal_down->set_active_callback
(
[ctx, target_eid, pedestal_speed](float value)
{
- if (!ctx->camera_control_modifier->is_active())
- {
- const float3 movement = {0.0f, -pedestal_speed * value * (1.0f / 60.0f), 0.0f};
- entity::command::translate(*ctx->entity_registry, target_eid, movement);
- }
+ if (ctx->camera_control_slow_modifier->is_active())
+ value *= 0.5f;
+ if (ctx->camera_control_fast_modifier->is_active())
+ value *= 2.0f;
+
+ const float3 movement = {0.0f, -pedestal_speed * value * (1.0f / 60.0f), 0.0f};
+ entity::command::translate(*ctx->entity_registry, target_eid, movement);
}
);
diff --git a/src/nest.cpp b/src/nest.cpp
deleted file mode 100644
index 47e1e7b..0000000
--- a/src/nest.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2021 Christopher J. Howard
- *
- * This file is part of Antkeeper source code.
- *
- * Antkeeper source code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Antkeeper source code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Antkeeper source code. If not, see .
- */
-
-#include "nest.hpp"
-#include "math/math.hpp"
-
-nest::nest()
-{
- dig_radius = 1.25f;
-}
-
-float3 nest::extend_shaft(shaft& shaft)
-{
- float3 dig_position = get_shaft_position(shaft, shaft.current_depth);
-
- float dr = math::random(dig_radius * 0.75f, dig_radius * 1.25f);
-
- shaft.current_depth += dr * 0.1f;
-
- return dig_position;
-}
-
-float3 nest::expand_chamber(chamber& chamber)
-{
- float dig_angle = math::random(0.0f, math::two_pi);
- float2 dig_direction = math::normalize(float2{std::cos(dig_angle), std::sin(dig_angle)});
-
- float3 chamber_center = get_shaft_position(*chamber.shaft, chamber.depth);
- float3 dig_position = chamber_center;
-
- float dr = math::random(dig_radius * 0.75f, dig_radius * 1.25f);
-
- float t = math::random(0.0f, 1.0f);
- dig_position.x += dig_direction.x * (chamber.outer_radius - dr) * t;
- dig_position.z += dig_direction.y * (chamber.outer_radius - dr) * t;
-
- return dig_position;
-}
-
-void nest::set_tunnel_radius(float radius)
-{
- tunnel_radius = radius;
-}
-
-float nest::get_shaft_angle(const shaft& shaft, float depth) const
-{
- float shaft_length = shaft.depth[1] - shaft.depth[0];
- float depth_factor = (depth - shaft.depth[0]) / shaft_length;
- float pitch = math::lerp(shaft.pitch[0], shaft.pitch[1], depth_factor);
- return shaft.rotation + (depth / pitch) * shaft.chirality * math::two_pi;
-}
-
-float nest::get_shaft_depth(const shaft& shaft, float turns) const
-{
- return shaft.pitch[0] * turns;
-}
-
-float3 nest::get_shaft_position(const shaft& shaft, float depth) const
-{
- float shaft_length = shaft.depth[1] - shaft.depth[0];
- float depth_factor = (depth - shaft.depth[0]) / shaft_length;
-
- float pitch = math::lerp(shaft.pitch[0], shaft.pitch[1], depth_factor);
- float radius = math::lerp(shaft.radius[0], shaft.radius[1], depth_factor);
- float translation_x = math::lerp(shaft.translation[0][0], shaft.translation[1][0], depth_factor);
- float translation_z = math::lerp(shaft.translation[0][1], shaft.translation[1][1], depth_factor);
- float angle = shaft.rotation + (depth / pitch) * shaft.chirality * math::two_pi;
-
- float3 position;
- position[0] = std::cos(angle) * radius + translation_x;
- position[1] = -std::max(shaft.depth[0], std::min(shaft.depth[1], depth));
- position[2] = std::sin(angle) * radius + translation_z;
-
- return position;
-
-}
-
diff --git a/src/nest.hpp b/src/nest.hpp
deleted file mode 100644
index 1c8ba16..0000000
--- a/src/nest.hpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2021 Christopher J. Howard
- *
- * This file is part of Antkeeper source code.
- *
- * Antkeeper source code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Antkeeper source code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Antkeeper source code. If not, see .
- */
-
-#ifndef ANTKEEPER_NEST_HPP
-#define ANTKEEPER_NEST_HPP
-
-#include "geom/mesh.hpp"
-#include "utility/fundamental-types.hpp"
-#include
-#include
-
-class nest
-{
-public:
- struct chamber;
-
- struct shaft
- {
- std::array depth; ///< start and end shaft depth
- float chirality; ///< 1 = right-handed, -1 = left-handed
- float rotation; ///< starting helix angle, in radians
- std::array radius; ///< start and end helix radius
- std::array pitch; ///< start and end helix pitch
- std::array translation; ///< start and end helix translation
- std::vector chambers;
- float current_depth;
- };
-
- struct chamber
- {
- shaft* shaft; ///< parent shaft
- float depth; ///< chamber depth, relative to parent shaft
- float rotation; ///< chamber rotation, relative to helix angle
- float sector_angle; ///<
- float inner_radius;
- float outer_radius;
- };
-
- /**
- * Creates a nest.
- */
- nest();
-
- float3 extend_shaft(shaft& shaft);
- float3 expand_chamber(chamber& chamber);
-
- void regenerate();
-
- void set_tunnel_radius(float radius);
-
- shaft* get_central_shaft();
-
- /**
- * Calculates the position on a shaft at the specified depth.
- */
- float3 get_shaft_position(const shaft& shaft, float depth) const;
-
- float get_shaft_angle(const shaft& shaft, float depth) const;
-
- float get_shaft_depth(const shaft& shaft, float turns) const;
-
-private:
- float tunnel_radius;
- shaft central_shaft;
- float dig_radius;
-};
-
-inline nest::shaft* nest::get_central_shaft()
-{
- return ¢ral_shaft;
-}
-
-#endif // ANTKEEPER_NEST_HPP
diff --git a/src/pheromone-matrix.cpp b/src/pheromone-matrix.cpp
deleted file mode 100644
index dab4b9f..0000000
--- a/src/pheromone-matrix.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2021 Christopher J. Howard
- *
- * This file is part of Antkeeper source code.
- *
- * Antkeeper source code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Antkeeper source code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Antkeeper source code. If not, see .
- */
-
-#include "pheromone-matrix.hpp"
-#include "math/math.hpp"
-
-void convolve(pheromone_matrix* matrix, const float* kernel, int kernel_size)
-{
- float* front = matrix->buffers[matrix->current];
- float* back = matrix->buffers[(matrix->current + 1) % 2];
- const int kernel_radius = kernel_size << 1;
-
- // For each pheromone matrix row
- for (int i = 0; i < matrix->rows; ++i)
- {
- // For each pheromone in the row
- for (int j = 0; j < matrix->columns; ++j)
- {
- // Reset accumulator
- float accumulator = 0.0f;
-
- // For each kernel row
- for (int k = -kernel_radius; k <= kernel_radius; ++k)
- {
- // For each kernel element
- for (int l = -kernel_radius; l <= kernel_radius; ++l)
- {
- // Determine row and column of pheromone corresponding to the kernel element.
- int m = i + k;
- int n = j + l;
-
- // If the row and column indices are within the matrix
- if (m >= 0 && m < matrix->rows && n >= 0 && n < matrix->columns)
- {
- // Multiply pheromone strength in the front buffer by the kernel value and add it to the accumulator.
- accumulator += front[m * matrix->columns + n] * kernel[(k + kernel_radius) * kernel_size + l + kernel_radius];
- }
- }
- }
-
- // Set pheromone strength in the back buffer equal to the accumulator value
- back[i * matrix->columns + j] = accumulator;
- }
- }
-
- // Swap buffers
- matrix->current = (matrix->current + 1) % 2;
-}
-
-void evaporate(pheromone_matrix* matrix, float factor)
-{
- const int size = matrix->columns * matrix->rows;
-
- for (int i = 0; i < size; ++i)
- {
- matrix->buffers[matrix->current][i] *= factor;
- }
-}
-
-void diffuse(pheromone_matrix* matrix)
-{
- const math::matrix diffusion_kernel =
- math::mul(
- math::matrix
- {{
- {1, 2, 1},
- {2, 4, 2},
- {1, 2, 1}
- }},
- 1.0f / 16.0f);
-
- convolve(matrix, &diffusion_kernel[0][0], 3);
-}
-
diff --git a/src/pheromone-matrix.hpp b/src/pheromone-matrix.hpp
deleted file mode 100644
index ed90504..0000000
--- a/src/pheromone-matrix.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2021 Christopher J. Howard
- *
- * This file is part of Antkeeper source code.
- *
- * Antkeeper source code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Antkeeper source code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Antkeeper source code. If not, see .
- */
-
-#ifndef ANTKEEPER_PHEROMONE_MATRIX_HPP
-#define ANTKEEPER_PHEROMONE_MATRIX_HPP
-
-/**
- * A double-buffered matrix containing floating point pheromone strengths.
- */
-struct pheromone_matrix
-{
- /// Number of columns in the matrix.
- int columns;
-
- /// Number of rows in the matrix.
- int rows;
-
- /// Two buffers containing pheromone strengths
- float** buffers;
-
- /// Index of the current buffer
- int current;
-};
-
-/**
- * Performs a convolution on a pheromone matrix.
- *
- * @param matrix Pointer to a pheromone matrix.
- * @param kernel Convolution kernel.
- * @param kernel_size Size of the kernel.
- */
-void convolve(pheromone_matrix* matrix, const float* kernel, int kernel_size);
-
-/**
- * Causes all pheromones in a pheromone matrix to decrease in strength according to the specified evaporation rate.
- *
- * @param matrix Pointer to the pheromone matrix.
- * @param factor Evaporation factor by which each pheromone strength will be multiplied.
- */
-void evaporate(pheromone_matrix* matrix, float rate);
-
-/**
- * Causes all pheromones in a pheromone matrix to diffuse.
- */
-void diffuse(pheromone_matrix* matrix);
-
-#endif // ANTKEEPER_PHEROMONE_MATRIX_HPP
-