diff --git a/CMakeLists.txt b/CMakeLists.txt
index baf682a..03b2f5a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.25)
+
option(APPLICATION_NAME "Application name" "Antkeeper")
option(APPLICATION_VERSION "Application version string" "0.0.0")
option(APPLICATION_AUTHOR "Application author" "C. J. Howard")
@@ -41,15 +42,15 @@ set(SHARED_LIBS
${OPENGL_gl_LIBRARY})
# Generate configuration header file
-configure_file(${PROJECT_SOURCE_DIR}/src/config.hpp.in
- ${PROJECT_BINARY_DIR}/src/config.hpp)
+configure_file(${PROJECT_SOURCE_DIR}/src/engine/config.hpp.in
+ ${PROJECT_BINARY_DIR}/src/engine/config.hpp)
# Collect source files
file(GLOB_RECURSE SOURCE_FILES
${PROJECT_SOURCE_DIR}/src/*.cpp)
# Remove platform-specific source files
-set(EXCLUDE_DIR "${PROJECT_SOURCE_DIR}/src/platform/")
+set(EXCLUDE_DIR "${PROJECT_SOURCE_DIR}/src/game/platform/")
foreach(TMP_PATH ${SOURCE_FILES})
string(FIND ${TMP_PATH} ${EXCLUDE_DIR} EXCLUDE_DIR_FOUND)
if (NOT ${EXCLUDE_DIR_FOUND} EQUAL -1)
@@ -59,21 +60,21 @@ endforeach(TMP_PATH)
if(MSVC)
# Add platform-specific source files
- list(APPEND SOURCE_FILES "${PROJECT_SOURCE_DIR}/src/platform/windows/nvidia.cpp")
+ list(APPEND SOURCE_FILES "${PROJECT_SOURCE_DIR}/src/game/platform/windows/nvidia.cpp")
# Generate Windows icon resource file
set(ICON_FILE "${PROJECT_SOURCE_DIR}/../antkeeper-data/src/icons/antkeeper.ico")
if(EXISTS "${ICON_FILE}")
- configure_file(${PROJECT_SOURCE_DIR}/src/platform/windows/icon.rc.in ${PROJECT_BINARY_DIR}/src/platform/windows/icon.rc)
- list(APPEND SOURCE_FILES "${PROJECT_BINARY_DIR}/src/platform/windows/icon.rc")
+ configure_file(${PROJECT_SOURCE_DIR}/src/game/platform/windows/icon.rc.in ${PROJECT_BINARY_DIR}/src/game/platform/windows/icon.rc)
+ list(APPEND SOURCE_FILES "${PROJECT_BINARY_DIR}/src/game/platform/windows/icon.rc")
endif()
# Generate Windows version-information resource file
- configure_file(${PROJECT_SOURCE_DIR}/src/platform/windows/version.rc.in ${PROJECT_BINARY_DIR}/src/platform/windows/version.rc)
- list(APPEND SOURCE_FILES "${PROJECT_BINARY_DIR}/src/platform/windows/version.rc")
+ configure_file(${PROJECT_SOURCE_DIR}/src/game/platform/windows/version.rc.in ${PROJECT_BINARY_DIR}/src/game/platform/windows/version.rc)
+ list(APPEND SOURCE_FILES "${PROJECT_BINARY_DIR}/src/game/platform/windows/version.rc")
# Make executable DPI-aware on Windows
- list(APPEND SOURCE_FILES "${PROJECT_SOURCE_DIR}/src/platform/windows/dpi-aware.manifest")
+ list(APPEND SOURCE_FILES "${PROJECT_SOURCE_DIR}/src/game/platform/windows/dpi-aware.manifest")
endif()
# Add executable target
diff --git a/src/ai/ai.hpp b/src/ai/ai.hpp
deleted file mode 100644
index c7cacb7..0000000
--- a/src/ai/ai.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2023 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_AI_HPP
-#define ANTKEEPER_AI_HPP
-
-/// Artificial intelligence (AI)
-namespace ai {}
-
-#include "bt/bt.hpp"
-#include "steering/steering.hpp"
-
-#endif // ANTKEEPER_AI_HPP
diff --git a/src/ai/bt/bt.hpp b/src/ai/bt/bt.hpp
deleted file mode 100644
index 3a79b33..0000000
--- a/src/ai/bt/bt.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2023 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_AI_BT_HPP
-#define ANTKEEPER_AI_BT_HPP
-
-#include
-#include
-
-namespace ai {
-
-/// Behavior tree (BT)
-namespace bt {}
-
-} // namespace ai
-
-#include "ai/bt/node.hpp"
-#include "ai/bt/status.hpp"
-
-#endif // ANTKEEPER_AI_BT_HPP
diff --git a/src/ai/bt/node.hpp b/src/ai/bt/node.hpp
deleted file mode 100644
index 6931778..0000000
--- a/src/ai/bt/node.hpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (C) 2023 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_AI_BT_NODE_HPP
-#define ANTKEEPER_AI_BT_NODE_HPP
-
-#include "ai/bt/status.hpp"
-
-namespace ai {
-namespace bt {
-
-/**
- * Abstract base class for behavior tree nodes.
- *
- * @tparam T Data type on which nodes operate.
- */
-template
-struct node
-{
- /// Data type on which nodes operate.
- typedef T context_type;
-
- /**
- * Executes a node's function and returns its status.
- *
- * @param context Context data on which the node will operate.
- */
- virtual status execute(context_type& context) const = 0;
-};
-
-/// Behavior tree node with no children.
-template
-using leaf_node = node;
-
-
-/// A node with exactly one child.
-template
-struct decorator_node: public node
-{
- node* child;
-};
-
-/// A node that can have one or more children.
-template
-struct composite_node: public node
-{
- std::list*> children;
-};
-
-/// Executes a function on a context and returns the status.
-template
-struct action: public leaf_node
-{
- virtual status execute(node::context_type& context) const final;
- typedef std::function::context_type&)> function_type;
- function_type function;
-};
-
-/// Evaluates a boolean condition (predicate) and returns either `status::success` or `status::failure`.
-template
-struct condition: public leaf_node
-{
- virtual status execute(node::context_type& context) const final;
- typedef std::function::context_type&)> predicate_type;
- predicate_type predicate;
-};
-
-/// Executes a child node and returns its inverted status. If the child returns `status::success`, then `status::failure` will be returned. Otherwise if the child returns `status::failure`, then `status::success` will be returned.
-template
-struct inverter: public decorator_node
-{
- virtual status execute(node::context_type& context) const final;
-};
-
-/// Attempts to execute a child node `n` times or until the child fails.
-template
-struct repeater: public decorator_node
-{
- virtual status execute(node::context_type& context) const final;
- int n;
-};
-
-/// Executes a child node and returns `status::success` regardless of the child node status.
-template
-struct succeeder: public decorator_node
-{
- virtual status execute(node::context_type& context) const final;
-};
-
-/// Attempts to execute each child node sequentially until one fails. If all children are executed successfully, `status::success` will be returned. Otherwise if any children fail, `status::failure` will be returned.
-template
-struct sequence: public composite_node
-{
- virtual status execute(node::context_type& context) const final;
-};
-
-/// Attempts to execute each child node sequentially until one succeeds. If a child succeeds, `status::success` will be returned. Otherwise if all children fail, `status::failure` will be returned.
-template
-struct selector: public composite_node
-{
- virtual status execute(node::context_type& context) const final;
-};
-
-template
-status action::execute(node::context_type& context) const
-{
- return function(context);
-}
-
-template
-status condition::execute(node::context_type& context) const
-{
- return (predicate(context)) ? status::success : status::failure;
-}
-
-template
-status inverter::execute(node::context_type& context) const
-{
- status child_status = decorator_node::child->execute(context);
- return (child_status == status::success) ? status::failure : (child_status == status::failure) ? status::success : child_status;
-}
-
-template
-status repeater::execute(node::context_type& context) const
-{
- status child_status;
- for (int i = 0; i < n; ++i)
- {
- child_status = decorator_node::child->execute(context);
- if (child_status == status::failure)
- break;
- }
- return child_status;
-}
-
-template
-status succeeder::execute(node::context_type& context) const
-{
- decorator_node::child->execute(context);
- return status::success;
-}
-
-template
-status sequence::execute(node::context_type& context) const
-{
- for (const node* child: composite_node::children)
- {
- status child_status = child->execute(context);
- if (child_status != status::success)
- return child_status;
- }
- return status::success;
-}
-
-template
-status selector::execute(node::context_type& context) const
-{
- for (const node* child: composite_node::children)
- {
- status child_status = child->execute(context);
- if (child_status != status::failure)
- return child_status;
- }
- return status::failure;
-}
-
-} // namespace bt
-} // namespace ai
-
-#endif // ANTKEEPER_AI_BT_NODE_HPP
diff --git a/src/ai/steering/agent.hpp b/src/ai/steering/agent.hpp
deleted file mode 100644
index 5c4242d..0000000
--- a/src/ai/steering/agent.hpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2023 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_AI_STEERING_AGENT_HPP
-#define ANTKEEPER_AI_STEERING_AGENT_HPP
-
-#include "utility/fundamental-types.hpp"
-#include "math/quaternion.hpp"
-
-namespace ai {
-namespace steering {
-
-/**
- * Autonomous agent governed by steering behaviors.
- */
-struct agent
-{
- /// Mass of the agent.
- float mass;
-
- /// Cartesian position vector.
- float3 position;
-
- /// Velocity vector.
- float3 velocity;
-
- /// Acceleration vector.
- float3 acceleration;
-
- /// Maximum force.
- float max_force;
-
- /// Maximum speed.
- float max_speed;
-
- /// Maximum speed squared.
- float max_speed_squared;
-
- /// Orientation quaternion.
- math::quaternion orientation;
-
- /// Orthonormal basis forward direction vector.
- float3 forward;
-
- /// Orthonormal basis up direction vector.
- float3 up;
-};
-
-} // namespace steering
-} // namespace ai
-
-#endif // ANTKEEPER_AI_STEERING_AGENT_HPP
diff --git a/src/ai/steering/behavior/flee.cpp b/src/ai/steering/behavior/flee.cpp
deleted file mode 100644
index d3ab6ec..0000000
--- a/src/ai/steering/behavior/flee.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2023 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 "ai/steering/behavior/flee.hpp"
-
-namespace ai {
-namespace steering {
-namespace behavior {
-
-float3 flee(const agent& agent, const float3& target)
-{
- float3 force = {0, 0, 0};
- const float3 difference = target - agent.position;
- const float sqr_distance = math::dot(difference, difference);
-
- if (sqr_distance)
- {
- const float inverse_distance = 1.0f / std::sqrt(sqr_distance);
- force = difference * inverse_distance * agent.max_force;
- force = agent.velocity - force;
- }
-
- return force;
-}
-
-} // namespace behavior
-} // namespace steering
-} // namespace ai
diff --git a/src/ai/steering/behavior/flee.hpp b/src/ai/steering/behavior/flee.hpp
deleted file mode 100644
index 9e3a3ba..0000000
--- a/src/ai/steering/behavior/flee.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2023 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_AI_STEERING_BEHAVIOR_FLEE_HPP
-#define ANTKEEPER_AI_STEERING_BEHAVIOR_FLEE_HPP
-
-#include "ai/steering/agent.hpp"
-#include "utility/fundamental-types.hpp"
-
-namespace ai {
-namespace steering {
-namespace behavior {
-
-/**
- * Attempts to steer an agent so that it moves away from a target.
- *
- * @param agent Autonomous agent to steer.
- * @param target Target position.
- * @return Flee force.
- */
-float3 flee(const agent& agent, const float3& target);
-
-} // namespace behavior
-} // namespace steering
-} // namespace ai
-
-#endif // ANTKEEPER_AI_STEERING_BEHAVIOR_FLEE_HPP
diff --git a/src/ai/steering/behavior/seek.cpp b/src/ai/steering/behavior/seek.cpp
deleted file mode 100644
index 7733673..0000000
--- a/src/ai/steering/behavior/seek.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2023 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 "ai/steering/behavior/seek.hpp"
-
-namespace ai {
-namespace steering {
-namespace behavior {
-
-float3 seek(const agent& agent, const float3& target)
-{
- float3 force = {0, 0, 0};
- const float3 difference = target - agent.position;
- const float sqr_distance = math::dot(difference, difference);
-
- if (sqr_distance)
- {
- const float inverse_distance = 1.0f / std::sqrt(sqr_distance);
- force = difference * inverse_distance * agent.max_force;
- force -= agent.velocity;
- }
-
- return force;
-}
-
-} // namespace behavior
-} // namespace steering
-} // namespace ai
diff --git a/src/ai/steering/behavior/seek.hpp b/src/ai/steering/behavior/seek.hpp
deleted file mode 100644
index 3967c85..0000000
--- a/src/ai/steering/behavior/seek.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2023 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_AI_STEERING_BEHAVIOR_SEEK_HPP
-#define ANTKEEPER_AI_STEERING_BEHAVIOR_SEEK_HPP
-
-#include "ai/steering/agent.hpp"
-#include "utility/fundamental-types.hpp"
-
-namespace ai {
-namespace steering {
-namespace behavior {
-
-/**
- * Attempts to steer an agent so that it moves toward a target.
- *
- * @param agent Autonomous agent to steer.
- * @param target Target position.
- * @return Seek force.
- */
-float3 seek(const agent& agent, const float3& target);
-
-} // namespace behavior
-} // namespace steering
-} // namespace ai
-
-#endif // ANTKEEPER_AI_STEERING_BEHAVIOR_SEEK_HPP
diff --git a/src/ai/steering/behavior/wander.cpp b/src/ai/steering/behavior/wander.cpp
deleted file mode 100644
index 0377ad6..0000000
--- a/src/ai/steering/behavior/wander.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2023 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 "ai/steering/behavior/wander.hpp"
-#include "ai/steering/behavior/seek.hpp"
-#include "math/random.hpp"
-#include "math/quaternion.hpp"
-
-namespace ai {
-namespace steering {
-namespace behavior {
-
-float3 wander_2d(const agent& agent, float noise, float distance, float radius, float& angle)
-{
- // Shift wander angle
- angle += math::random(-noise, noise);
-
- // Calculate center of wander circle
- const float3 center = agent.position + agent.forward * distance;
-
- // Decompose orientation into swing and twist rotations
- math::quaternion swing, twist;
- math::swing_twist(agent.orientation, agent.up, swing, twist);
-
- // Calculate offset to point on wander circle
- const float3 offset = math::conjugate(twist) * (math::angle_axis(angle, agent.up) * agent.forward * radius);
-
- // Seek toward point on wander circle
- return seek(agent, center + offset);
-}
-
-float3 wander_3d(const agent& agent, float noise, float distance, float radius, float& theta, float& phi)
-{
- // Shift wander angles
- theta += math::random(-noise, noise);
- phi += math::random(-noise, noise);
-
- // Calculate center of wander sphere
- const float3 center = agent.position + agent.forward * distance;
-
- // Convert spherical coordinates to Cartesian point on wander sphere
- const float r_cos_theta = radius * std::cos(theta);
- const float3 offset =
- {
- r_cos_theta * std::cos(phi),
- r_cos_theta * std::sin(phi),
- radius * std::sin(theta)
- };
-
- // Seek toward point on wander sphere
- return seek(agent, center + offset);
-}
-
-} // namespace behavior
-} // namespace steering
-} // namespace ai
diff --git a/src/ai/steering/behavior/wander.hpp b/src/ai/steering/behavior/wander.hpp
deleted file mode 100644
index 4eeacac..0000000
--- a/src/ai/steering/behavior/wander.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2023 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_AI_STEERING_BEHAVIOR_WANDER_HPP
-#define ANTKEEPER_AI_STEERING_BEHAVIOR_WANDER_HPP
-
-#include "ai/steering/agent.hpp"
-#include "utility/fundamental-types.hpp"
-
-namespace ai {
-namespace steering {
-namespace behavior {
-
-/**
- * Steers an agent in a continuously shifting random direction on the yaw plane.
- *
- * @param agent Autonomous agent to steer.
- * @param distance Distance to the center of the wander circle.
- * @param noise Maximum wander angle shift, in radians.
- * @param radius Radius of the wander circle.
- * @param[in,out] angle Angular coordinate on the wander circle, in radians.
- *
- * @return Wander force.
- */
-float3 wander_2d(const agent& agent, float noise, float distance, float radius, float& angle);
-
-/**
- * Steers an agent in a continuously shifting random direction.
- *
- * @param agent Autonomous agent to steer.
- * @param distance Distance to the wander sphere.
- * @param radius Radius of the wander sphere.
- * @param delta Maximum angle offset.
- * @param[in,out] theta Polar wander angle, in radians.
- * @param[in,out] phi Azimuthal wander angle, in radians.
- *
- * @return Wander force.
- */
-float3 wander_3d(const agent& agent, float noise, float distance, float radius, float& theta, float& phi);
-
-} // namespace behavior
-} // namespace steering
-} // namespace ai
-
-#endif // ANTKEEPER_AI_STEERING_BEHAVIOR_WANDER_HPP
diff --git a/src/ai/steering/steering.hpp b/src/ai/steering/steering.hpp
deleted file mode 100644
index 6f98526..0000000
--- a/src/ai/steering/steering.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2023 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_AI_STEERING_HPP
-#define ANTKEEPER_AI_STEERING_HPP
-
-namespace ai {
-
-/**
- * Autonomous agent steering.
- *
- * @see Reynolds, Craig. (2002). Steering Behaviors For Autonomous Characters.
- */
-namespace steering {}
-
-#include "ai/steering/agent.hpp"
-#include "ai/steering/behavior/flee.hpp"
-#include "ai/steering/behavior/seek.hpp"
-#include "ai/steering/behavior/wander.hpp"
-
-} // namespace ai
-
-#endif // ANTKEEPER_AI_STEERING_HPP
diff --git a/src/animation/animation.cpp b/src/animation/animation.cpp
deleted file mode 100644
index b702642..0000000
--- a/src/animation/animation.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2023 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 "animation.hpp"
-
-animation_base::animation_base():
- looped(false),
- loop_count(0),
- paused(false),
- stopped(true),
- position(0.0),
- speed(1.0),
- start_callback(nullptr),
- end_callback(nullptr),
- loop_callback(nullptr)
-{}
-
-void animation_base::seek(double t)
-{
- position = t;
-}
-
-void animation_base::rewind()
-{
- seek(0.0);
-}
-
-void animation_base::loop(bool enabled)
-{
- looped = enabled;
-}
-
-void animation_base::pause()
-{
- paused = true;
-}
-
-void animation_base::play()
-{
- if (stopped)
- {
- stopped = false;
-
- if (start_callback)
- {
- start_callback();
- }
- }
-
- paused = false;
-}
-
-void animation_base::stop()
-{
- rewind();
- stopped = true;
- paused = false;
- loop_count = 0;
-}
-
-void animation_base::set_speed(double speed)
-{
- this->speed = speed;
-}
-
-void animation_base::set_start_callback(std::function callback)
-{
- start_callback = callback;
-}
-
-void animation_base::set_end_callback(std::function callback)
-{
- end_callback = callback;
-}
-
-void animation_base::set_loop_callback(std::function callback)
-{
- loop_callback = callback;
-}
diff --git a/src/animation/animation.hpp b/src/animation/animation.hpp
deleted file mode 100644
index 3592416..0000000
--- a/src/animation/animation.hpp
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Copyright (C) 2023 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_ANIMATION_HPP
-#define ANTKEEPER_ANIMATION_HPP
-
-#include "animation-channel.hpp"
-#include
-#include
-#include
-#include
-
-/**
- * Abstract base class for keyframe animations.
- */
-class animation_base
-{
-public:
- animation_base();
-
- /**
- * Advances the animation position (t) by @p dt.
- *
- * @param dt Delta time by which the animation position will be advanced.
- */
- virtual void advance(double dt) = 0;
-
- /**
- * Sets the animation position to @p t.
- *
- * @param t Position in time to which the animation position will be set.
- */
- void seek(double t);
-
- /// Sets the animation position to `0.0`.
- void rewind();
-
- /// Enables or disables looping of the animation.
- void loop(bool enabled);
-
- /// Pauses the animation.
- void pause();
-
- /// Plays the animation.
- void play();
-
- /// Stops the animation, rewinds it, and resets the loop count.
- void stop();
-
- /**
- * Sets the speed of the animation.
- *
- * @param speed Speed multiplier.
- */
- void set_speed(double speed);
-
- /// Returns `true` if looping of the animation is enabled, `false` otherwise.
- bool is_looped() const;
-
- /// Returns `true` if the animation is paused, `false` otherwise.
- bool is_paused() const;
-
- /// Returns `true` if the animation is stopped, `false` otherwise.
- bool is_stopped() const;
-
- /// Returns the current position in time of the animation.
- double get_position() const;
-
- /// Returns the current loop count of the animation.
- int get_loop_count() const;
-
- /// Returns the duration of the animation.
- virtual double get_duration() const = 0;
-
- /// Sets the callback that's executed when the animation is started from a stopped state.
- void set_start_callback(std::function callback);
-
- /// Sets the callback that's executed when a non-looped animation has finished.
- void set_end_callback(std::function callback);
-
- /**
- * Sets the callback that's executed when the animation loops.
- *
- * @param callback Loop callback function which is passed the current loop count.
- */
- void set_loop_callback(std::function callback);
-
-protected:
- bool looped;
- int loop_count;
- bool paused;
- bool stopped;
- double position;
- double speed;
-
- std::function start_callback;
- std::function end_callback;
- std::function loop_callback;
-};
-
-inline bool animation_base::is_looped() const
-{
- return looped;
-}
-
-inline bool animation_base::is_paused() const
-{
- return paused;
-}
-
-inline bool animation_base::is_stopped() const
-{
- return stopped;
-}
-
-inline double animation_base::get_position() const
-{
- return position;
-}
-
-inline int animation_base::get_loop_count() const
-{
- return loop_count;
-}
-
-/**
- * Keyframe animation.
- *
- * @tparam T Animated data type.
- */
-template
-class animation: public animation_base
-{
-public:
- /// Channel for this animation type.
- typedef animation_channel channel;
-
- // Keyframe type for this animation.
- typedef typename channel::keyframe keyframe;
-
- /// Interpolator function type.
- typedef typename std::decay>::type interpolator_type;
-
- /// Creates an animation.
- animation();
-
- /// @copydoc animation_base::advance()
- virtual void advance(double dt);
-
- /**
- * Adds a channel to the animation.
- *
- * @param id ID of the channel.
- * @return Added or pre-existing channel.
- */
- channel* add_channel(int id);
-
- /**
- * Removes a channel from the animation.
- *
- * @param id ID of the channel to remove.
- */
- void remove_channel(int id);
-
- /// Removes all channels from the animation.
- void remove_channels();
-
- /**
- * Sets the frame interpolator function object.
- *
- * @param interpolator Frame interpolator function object.
- */
- void set_interpolator(interpolator_type interpolator);
-
- /**
- * Sets the callback that's executed on each frame of animation.
- *
- * @param callback Frame callback which receives the index of an animation channel and value of an interpolated frame.
- */
- void set_frame_callback(std::function callback);
-
- /**
- * Returns the channel with the specified ID.
- *
- * @param id ID of the channel to get.
- */
- const channel* get_channel(int id) const;
-
- /// @copydoc animation::get_channel(int) const
- channel* get_channel(int id);
-
- /// @copydoc animation_base::get_duration() const
- virtual double get_duration() const;
-
-private:
- std::unordered_map channels;
- interpolator_type interpolator;
- std::function frame_callback;
-};
-
-template
-animation::animation():
- interpolator(nullptr),
- frame_callback(nullptr)
-{}
-
-template
-void animation::advance(double dt)
-{
- if (paused || stopped)
- {
- return;
- }
-
- // Advance position by dt
- position += dt * speed;
-
- // Determine duration of the animation
- double duration = get_duration();
-
- if (position < duration)
- {
- if (frame_callback != nullptr && interpolator != nullptr)
- {
- for (std::size_t i = 0; i < channels.size(); ++i)
- {
- auto frames = channels[i].find_keyframes(position);
-
- if (frames[0] != nullptr && frames[1] != nullptr)
- {
- // Calculate interpolated frame
- double t0 = std::get<0>(*frames[0]);
- double t1 = std::get<0>(*frames[1]);
- double alpha = (position - t0) / (t1 - t0);
- T frame = interpolator(std::get<1>(*frames[0]), std::get<1>(*frames[1]), alpha);
-
- // Pass frame to frame callback
- frame_callback(static_cast(i), frame);
- }
- else if (frames[0] != nullptr)
- {
- // Pass frame to frame callback
- frame_callback(static_cast(i), std::get<1>(*frames[0]));
- }
- else if (frames[1] != nullptr)
- {
- // Pass frame to frame callback
- frame_callback(static_cast(i), std::get<1>(*frames[1]));
- }
- }
- }
- }
- else
- {
- if (looped)
- {
- ++loop_count;
-
- // Subtract duration of animation from position
- position -= duration;
-
- // Execute loop callback
- if (loop_callback)
- {
- loop_callback(loop_count);
- }
-
- // Call frame callback on looped frame
- if (frame_callback)
- {
- advance(0.0);
- }
- }
- else
- {
- // Call frame callback for end frame
- if (frame_callback != nullptr)
- {
- for (std::size_t i = 0; i < channels.size(); ++i)
- {
- auto frames = channels[i].find_keyframes(channels[i].get_duration());
- if (frames[0] != nullptr)
- {
- frame_callback(static_cast(i), std::get<1>(*frames[0]));
- }
- }
- }
-
- stopped = true;
-
- // Call end callback
- if (end_callback)
- {
- end_callback();
- }
- }
- }
-}
-
-template
-typename animation::channel* animation::add_channel(int id)
-{
- return &(*channels.emplace(id, id).first).second;
-}
-
-template
-void animation::remove_channel(int id)
-{
- auto it = channels.find(id);
- if (it != channels.end())
- {
- channels.erase(it);
- }
-}
-
-template
-void animation::remove_channels()
-{
- channels.clear();
-}
-
-template
-void animation::set_interpolator(interpolator_type interpolator)
-{
- this->interpolator = interpolator;
-}
-
-template
-void animation::set_frame_callback(std::function callback)
-{
- this->frame_callback = callback;
-}
-
-template
-const typename animation::channel* animation::get_channel(int id) const
-{
- auto it = channels.find(id);
- if (it != channels.end())
- {
- return &it->second;
- }
-
- return nullptr;
-}
-
-template
-typename animation::channel* animation::get_channel(int id)
-{
- auto it = channels.find(id);
- if (it != channels.end())
- {
- return &it->second;
- }
-
- return nullptr;
-}
-
-template
-double animation::get_duration() const
-{
- double duration = 0.0;
-
- for (auto it = channels.begin(); it != channels.end(); ++it)
- {
- duration = std::max(duration, it->second.get_duration());
- }
-
- return duration;
-}
-
-#endif // ANTKEEPER_ANIMATION_HPP
diff --git a/src/animation/animator.cpp b/src/animation/animator.cpp
deleted file mode 100644
index b78b861..0000000
--- a/src/animation/animator.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2023 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 "animator.hpp"
-#include "animation/animation.hpp"
-#include
-
-animator::animator():
- animating(0)
-{}
-
-void animator::animate(double dt)
-{
- // Advance animations
- ++animating;
- for (animation_base* animation: animations)
- {
- animation->advance(dt);
- }
- --animating;
-}
-
-void animator::add_animation(animation_base* animation)
-{
- if (animating)
- throw std::runtime_error("Attempting to add animation to animator while animating");
-
- animations.emplace(animation);
-}
-
-void animator::remove_animation(animation_base* animation)
-{
- if (animating)
- throw std::runtime_error("Attempting to remove animation from animator while animating");
-
- auto it = animations.find(animation);
- if (it != animations.end())
- {
- animations.erase(it);
- }
-}
-
-void animator::remove_animations()
-{
- if (animating)
- throw std::runtime_error("Attempting to remove animations from animator while animating");
-
- animations.clear();
-}
diff --git a/src/animation/ease.hpp b/src/animation/ease.hpp
deleted file mode 100644
index 13ecbf4..0000000
--- a/src/animation/ease.hpp
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * Copyright (C) 2023 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 .
- */
-
-/*
- * Easing Functions (Equations)
- *
- * Copyright (C) 2001 Robert Penner
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * * Neither the name of the author nor the names of contributors may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
-
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ANTKEEPER_EASE_HPP
-#define ANTKEEPER_EASE_HPP
-
-#include "math/interpolation.hpp"
-#include
-
-/**
- * Container for templated easing functions.
- *
- * All easing functions require the following operators to be defined:
- *
- * value_type operator+(const value_type&, const value_type&);
- * value_type operator-(const value_type&, const value_type&);
- * value_type operator*(const value_type&, scalar_type);
- *
- * @tparam T Value type.
- * @tparam S Scalar type.
- */
-template
-struct ease
-{
- typedef T value_type;
- typedef S scalar_type;
-
- static T in_sine(const T& x, const T& y, S a);
- static T out_sine(const T& x, const T& y, S a);
- static T in_out_sine(const T& x, const T& y, S a);
-
- static T in_quad(const T& x, const T& y, S a);
- static T out_quad(const T& x, const T& y, S a);
- static T in_out_quad(const T& x, const T& y, S a);
-
- static T in_cubic(const T& x, const T& y, S a);
- static T out_cubic(const T& x, const T& y, S a);
- static T in_out_cubic(const T& x, const T& y, S a);
-
- static T in_quart(const T& x, const T& y, S a);
- static T out_quart(const T& x, const T& y, S a);
- static T in_out_quart(const T& x, const T& y, S a);
-
- static T in_quint(const T& x, const T& y, S a);
- static T out_quint(const T& x, const T& y, S a);
- static T in_out_quint(const T& x, const T& y, S a);
-
- static T in_expo(const T& x, const T& y, S a);
- static T out_expo(const T& x, const T& y, S a);
- static T in_out_expo(const T& x, const T& y, S a);
-
- static T in_circ(const T& x, const T& y, S a);
- static T out_circ(const T& x, const T& y, S a);
- static T in_out_circ(const T& x, const T& y, S a);
-
- static T in_back(const T& x, const T& y, S a);
- static T out_back(const T& x, const T& y, S a);
- static T in_out_back(const T& x, const T& y, S a);
-
- static T in_elastic(const T& x, const T& y, S a);
- static T out_elastic(const T& x, const T& y, S a);
- static T in_out_elastic(const T& x, const T& y, S a);
-
- static T in_bounce(const T& x, const T& y, S a);
- static T out_bounce(const T& x, const T& y, S a);
- static T in_out_bounce(const T& x, const T& y, S a);
-};
-
-template
-T ease::in_sine(const T& x, const T& y, S a)
-{
- return math::lerp(y, x, std::cos(a * math::half_pi));
-}
-
-template
-T ease::out_sine(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, std::sin(a * math::half_pi));
-}
-
-template
-T ease::in_out_sine(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, -(std::cos(a * math::pi) - S(1)) * S(0.5));
-}
-
-template
-T ease::in_quad(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, a * a);
-}
-
-template
-T ease::out_quad(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, (S(2) - a) * a);
-}
-
-template
-T ease::in_out_quad(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, (a < S(0.5)) ? S(2) * a * a : -(S(2) * a * a - S(4) * a + S(1)));
-}
-
-template
-T ease::in_cubic(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, a * a * a);
-}
-
-template
-T ease::out_cubic(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, a * ((a - S(3)) * a + S(3)));
-}
-
-template
-T ease::in_out_cubic(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, (a < S(0.5)) ? S(4) * a * a * a : S(4) * a * a * a - S(12) * a * a + S(12) * a - 3);
-}
-
-template
-T ease::in_quart(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, a * a * a * a);
-}
-
-template
-T ease::out_quart(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, a * (a * ((S(4) - a) * a - S(6)) + S(4)));
-}
-
-template
-T ease::in_out_quart(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, (a < S(0.5)) ? S(8) * a * a * a * a : a * (a * ((S(32) - S(8) * a) * a - S(48)) + S(32)) - S(7));
-}
-
-template
-T ease::in_quint(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, a * a * a * a * a);
-}
-
-template
-T ease::out_quint(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, a * (a * (a * ((a - S(5)) * a + S(10)) - S(10)) + S(5)));
-}
-
-template
-T ease::in_out_quint(const T& x, const T& y, S a)
-{
- if (a < S(0.5))
- {
- return math::lerp(x, y, S(16) * a * a * a * a * a);
- }
- else
- {
- a = S(2) * (S(1) - a);
- return math::lerp(x, y, S(0.5) * (S(2) - a * a * a * a * a));
- }
-}
-
-template
-T ease::in_expo(const T& x, const T& y, S a)
-{
- return (a == S(0)) ? x : math::lerp(x, y, std::pow(S(1024), a - S(1)));
-}
-
-template
-T ease::out_expo(const T& x, const T& y, S a)
-{
- return (a == S(1)) ? y : math::lerp(y, x, std::pow(S(2), S(-10) * a));
-}
-
-template
-T ease::in_out_expo(const T& x, const T& y, S a)
-{
- if (a == S(0))
- {
- return x;
- }
- else if (a == S(1))
- {
- return y;
- }
-
- return math::lerp(x, y, (a < S(0.5)) ? std::pow(S(2), S(20) * a - S(11)) : S(1) - std::pow(S(2), S(9) - S(20) * a));
-}
-
-template
-T ease::in_circ(const T& x, const T& y, S a)
-{
- return math::lerp(y, x, std::sqrt(S(1) - a * a));
-}
-
-template
-T ease::out_circ(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, std::sqrt(-(a - S(2)) * a));
-}
-
-template
-T ease::in_out_circ(const T& x, const T& y, S a)
-{
- if (a < S(0.5))
- {
- return math::lerp(x, y, S(0.5) - S(0.5) * std::sqrt(S(1) - S(4) * a * a));
- }
- else
- {
- return math::lerp(x, y, S(0.5) * (std::sqrt(S(-4) * (a - S(2)) * a - S(3)) + S(1)));
- }
-}
-
-template
-T ease::in_back(const T& x, const T& y, S a)
-{
- const S c = S(1.70158);
- return math::lerp(x, y, a * a * (a * c + a - c));
-}
-
-template
-T ease::out_back(const T& x, const T& y, S a)
-{
- const S c = S(1.70158);
- a -= S(1);
- return math::lerp(x, y, a * a * (a * c + a + c) + S(1));
-}
-
-template
-T ease::in_out_back(const T& x, const T& y, S a)
-{
- const S c = S(1.70158) * S(1.525f);
-
- if (a < S(0.5))
- {
- return math::lerp(x, y, a * a * (a * (S(4) * c + S(4)) - S(2) * c));
- }
- else
- {
- S b = S(1) - S(2) * a;
- return math::lerp(x, y, b * b * (a * c + a - c * S(0.5) - S(1)) + S(1));
- }
-}
-
-template
-T ease::in_elastic(const T& x, const T& y, S a)
-{
- if (a == S(0))
- {
- return x;
- }
- else if (a == S(1))
- {
- return y;
- }
-
- return math::lerp(x, y, -std::pow(S(1024), a - S(1)) * std::sin(S(20.944) * (a - S(1.075))));
-}
-
-template
-T ease::out_elastic(const T& x, const T& y, S a)
-{
- if (a == S(0))
- {
- return x;
- }
- else if (a == S(1))
- {
- return y;
- }
-
- return math::lerp(x, y, std::pow(S(2), S(-10) * a) * std::sin(S(20.944) * (a - S(0.075))) + S(1));
-}
-
-template
-T ease::in_out_elastic(const T& x, const T& y, S a)
-{
- if (a == S(0))
- {
- return x;
- }
- else if (a == S(1))
- {
- return y;
- }
-
- if (a < S(0.5))
- {
- return math::lerp(x, y, std::pow(S(2), S(20) * a - S(11)) * std::sin(S(15.5334) - S(27.5293) * a));
- }
- else
- {
- return math::lerp(y, x, std::pow(2, S(9) - S(20) * a) * std::sin(S(15.5334) - S(27.5293) * a));
- }
-}
-
-template
-T ease::in_bounce(const T& x, const T& y, S a)
-{
- return math::lerp(x, y, S(1) - ease::out_bounce(S(0), S(1), S(1) - a));
-}
-
-template
-T ease::out_bounce(const T& x, const T& y, S a)
-{
- const S n = S(7.5625);
- const S d = S(2.75);
-
- if (a < S(1) / d)
- {
- a = n * a * a;
- }
- else if (a < S(2) / d)
- {
- a -= S(1.5) / d;
- a = n * a * a + S(0.75);
- }
- else if (a < S(2.5) / d)
- {
- a -= S(2.25) / d;
- a = n * a * a + S(0.9375);
- }
- else
- {
- a -= S(2.625) / d;
- a = n * a * a + S(0.984375);
- }
-
- return math::lerp(x, y, a);
-}
-
-template
-T ease::in_out_bounce(const T& x, const T& y, S a)
-{
- if (a < S(0.5))
- {
- return math::lerp(x, y, (S(1) - ease::out_bounce(S(0), S(1), S(1) - S(2) * a)) * S(0.5));
- }
- else
- {
- return math::lerp(x, y, (S(1) + ease::out_bounce(S(0), S(1), S(2) * a - S(1))) * S(0.5));
- }
-}
-
-#endif // ANTKEEPER_EASE_HPP
diff --git a/src/animation/pose.cpp b/src/animation/pose.cpp
deleted file mode 100644
index e01ec0f..0000000
--- a/src/animation/pose.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2023 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 "animation/pose.hpp"
-#include "math/transform-operators.hpp"
-#include "math/transform-functions.hpp"
-
-void concatenate(const pose& bone_space, pose& skeleton_space)
-{
- for (auto&& [bone, transform]: bone_space)
- {
- auto parent_index = bone_parent_index(bone);
-
- if (parent_index != bone_index(bone))
- {
- auto parent = skeleton_space.find(parent_index);
- skeleton_space[bone] = (parent != skeleton_space.end()) ? parent->second * transform : transform;
- }
- else
- {
- skeleton_space[bone] = transform;
- }
- }
-}
-
-void inverse(const pose& x, pose& y)
-{
- for (auto&& [bone, transform]: x)
- {
- y[bone] = math::inverse(transform);
- }
-}
-
-void matrix_palette(const pose& inverse_bind_pose, const pose& pose, float4x4* palette)
-{
- for (auto&& [bone, transform]: pose)
- {
- auto index = ::bone_index(bone);
- palette[index] = math::matrix_cast(inverse_bind_pose.at(bone) * transform);
- }
-}
diff --git a/src/animation/pose.hpp b/src/animation/pose.hpp
deleted file mode 100644
index c285e8c..0000000
--- a/src/animation/pose.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2023 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_ANIMATION_POSE_HPP
-#define ANTKEEPER_ANIMATION_POSE_HPP
-
-#include "animation/bone.hpp"
-#include "math/transform-type.hpp"
-#include "utility/fundamental-types.hpp"
-#include