Browse Source

Move game-related components and systems out of entity namespace and into game namespace

master
C. J. Howard 2 years ago
parent
commit
96c678e5fc
92 changed files with 729 additions and 729 deletions
  1. +0
    -1
      CMakeLists.txt
  2. +1
    -1
      src/color/cct.hpp
  3. +34
    -34
      src/entity/commands.cpp
  4. +2
    -2
      src/entity/ebt.cpp
  5. +13
    -13
      src/game/ant/swarm.cpp
  6. +5
    -5
      src/game/component/atmosphere.hpp
  7. +6
    -6
      src/game/component/behavior.hpp
  8. +5
    -5
      src/game/component/blackbody.hpp
  9. +5
    -5
      src/game/component/brush.hpp
  10. +5
    -5
      src/game/component/camera.hpp
  11. +5
    -5
      src/game/component/cavity.hpp
  12. +5
    -5
      src/game/component/celestial-body.hpp
  13. +5
    -5
      src/game/component/chamber.hpp
  14. +5
    -5
      src/game/component/collision.hpp
  15. +9
    -9
      src/game/component/constraint-stack.hpp
  16. +5
    -5
      src/game/component/constraints/constraints.hpp
  17. +5
    -5
      src/game/component/constraints/copy-rotation.hpp
  18. +5
    -5
      src/game/component/constraints/copy-scale.hpp
  19. +5
    -5
      src/game/component/constraints/copy-transform.hpp
  20. +5
    -5
      src/game/component/constraints/copy-translation.hpp
  21. +5
    -5
      src/game/component/constraints/spring-to.hpp
  22. +5
    -5
      src/game/component/constraints/three-dof.hpp
  23. +5
    -5
      src/game/component/constraints/track-to.hpp
  24. +5
    -5
      src/game/component/diffuse-reflector.hpp
  25. +5
    -5
      src/game/component/genome.hpp
  26. +5
    -5
      src/game/component/light.hpp
  27. +5
    -5
      src/game/component/locomotion.hpp
  28. +5
    -5
      src/game/component/model.hpp
  29. +5
    -5
      src/game/component/nest.hpp
  30. +5
    -5
      src/game/component/observer.hpp
  31. +5
    -5
      src/game/component/orbit.hpp
  32. +5
    -5
      src/game/component/parent.hpp
  33. +5
    -5
      src/game/component/proteome.hpp
  34. +5
    -5
      src/game/component/samara.hpp
  35. +5
    -5
      src/game/component/select.hpp
  36. +5
    -5
      src/game/component/snap.hpp
  37. +5
    -5
      src/game/component/steering.hpp
  38. +5
    -5
      src/game/component/terrain.hpp
  39. +5
    -5
      src/game/component/tool.hpp
  40. +5
    -5
      src/game/component/trackable.hpp
  41. +5
    -5
      src/game/component/transform.hpp
  42. +20
    -20
      src/game/context.hpp
  43. +1
    -1
      src/game/load.cpp
  44. +38
    -38
      src/game/state/boot.cpp
  45. +3
    -3
      src/game/state/main-menu.cpp
  46. +52
    -52
      src/game/state/nuptial-flight.cpp
  47. +3
    -2
      src/game/state/splash.cpp
  48. +37
    -37
      src/game/system/astronomy.cpp
  49. +17
    -17
      src/game/system/astronomy.hpp
  50. +10
    -10
      src/game/system/atmosphere.cpp
  51. +10
    -10
      src/game/system/atmosphere.hpp
  52. +5
    -5
      src/game/system/behavior.cpp
  53. +6
    -6
      src/game/system/behavior.hpp
  54. +11
    -11
      src/game/system/blackbody.cpp
  55. +12
    -12
      src/game/system/blackbody.hpp
  56. +2
    -2
      src/game/system/camera.cpp
  57. +6
    -6
      src/game/system/camera.hpp
  58. +3
    -3
      src/game/system/collision.cpp
  59. +9
    -9
      src/game/system/collision.hpp
  60. +5
    -5
      src/game/system/constraint.cpp
  61. +10
    -10
      src/game/system/constraint.hpp
  62. +5
    -5
      src/game/system/locomotion.cpp
  63. +6
    -6
      src/game/system/locomotion.hpp
  64. +3
    -3
      src/game/system/morphogenesis.cpp
  65. +6
    -6
      src/game/system/morphogenesis.hpp
  66. +9
    -9
      src/game/system/orbit.cpp
  67. +9
    -9
      src/game/system/orbit.hpp
  68. +7
    -7
      src/game/system/painting.cpp
  69. +6
    -6
      src/game/system/painting.hpp
  70. +10
    -10
      src/game/system/proteome.cpp
  71. +9
    -9
      src/game/system/proteome.hpp
  72. +5
    -5
      src/game/system/render.cpp
  73. +14
    -14
      src/game/system/render.hpp
  74. +4
    -4
      src/game/system/samara.cpp
  75. +6
    -6
      src/game/system/samara.hpp
  76. +5
    -5
      src/game/system/snapping.cpp
  77. +6
    -6
      src/game/system/snapping.hpp
  78. +4
    -4
      src/game/system/spatial.cpp
  79. +6
    -6
      src/game/system/spatial.hpp
  80. +5
    -5
      src/game/system/steering.cpp
  81. +6
    -6
      src/game/system/steering.hpp
  82. +9
    -9
      src/game/system/subterrain.cpp
  83. +6
    -6
      src/game/system/subterrain.hpp
  84. +6
    -6
      src/game/system/terrain.cpp
  85. +8
    -8
      src/game/system/terrain.hpp
  86. +2
    -2
      src/game/system/updatable.cpp
  87. +5
    -5
      src/game/system/updatable.hpp
  88. +4
    -4
      src/game/system/vegetation.cpp
  89. +8
    -8
      src/game/system/vegetation.hpp
  90. +8
    -8
      src/game/tools.cpp
  91. +19
    -19
      src/game/world.cpp
  92. +28
    -28
      src/resources/entity-archetype-loader.cpp

+ 0
- 1
CMakeLists.txt View File

@ -1,6 +1,5 @@
cmake_minimum_required(VERSION 3.7)
option(VERSION_STRING "Project version string" "0.0.0")
project(antkeeper VERSION ${VERSION_STRING} LANGUAGES CXX)

+ 1
- 1
src/color/cct.hpp View File

@ -26,7 +26,7 @@
namespace color {
/// Functions which operate on correlated color temperature (CCT).
/// Correlated color temperature (CCT).
namespace cct {
/**

+ 34
- 34
src/entity/commands.cpp View File

@ -18,12 +18,12 @@
*/
#include "entity/commands.hpp"
#include "entity/components/model.hpp"
#include "entity/components/transform.hpp"
#include "entity/components/snap.hpp"
#include "entity/components/parent.hpp"
#include "entity/components/celestial-body.hpp"
#include "entity/components/terrain.hpp"
#include "game/component/model.hpp"
#include "game/component/transform.hpp"
#include "game/component/snap.hpp"
#include "game/component/parent.hpp"
#include "game/component/celestial-body.hpp"
#include "game/component/terrain.hpp"
#include <limits>
namespace entity {
@ -31,36 +31,36 @@ namespace command {
void translate(entity::registry& registry, entity::id eid, const float3& translation)
{
if (registry.has<component::transform>(eid))
if (registry.has<game::component::transform>(eid))
{
component::transform& transform = registry.get<component::transform>(eid);
game::component::transform& transform = registry.get<game::component::transform>(eid);
transform.local.translation += translation;
}
}
void rotate(entity::registry& registry, entity::id eid, float angle, const float3& axis)
{
if (registry.has<component::transform>(eid))
if (registry.has<game::component::transform>(eid))
{
component::transform& transform = registry.get<component::transform>(eid);
game::component::transform& transform = registry.get<game::component::transform>(eid);
transform.local.rotation = math::angle_axis(angle, axis) * transform.local.rotation;
}
}
void move_to(entity::registry& registry, entity::id eid, const float3& position)
{
if (registry.has<component::transform>(eid))
if (registry.has<game::component::transform>(eid))
{
component::transform& transform = registry.get<component::transform>(eid);
game::component::transform& transform = registry.get<game::component::transform>(eid);
transform.local.translation = position;
}
}
void warp_to(entity::registry& registry, entity::id eid, const float3& position)
{
if (registry.has<component::transform>(eid))
if (registry.has<game::component::transform>(eid))
{
component::transform& transform = registry.get<component::transform>(eid);
game::component::transform& transform = registry.get<game::component::transform>(eid);
transform.local.translation = position;
transform.warp = true;
}
@ -68,18 +68,18 @@ void warp_to(entity::registry& registry, entity::id eid, const float3& position)
void set_scale(entity::registry& registry, entity::id eid, const float3& scale)
{
if (registry.has<component::transform>(eid))
if (registry.has<game::component::transform>(eid))
{
component::transform& transform = registry.get<component::transform>(eid);
game::component::transform& transform = registry.get<game::component::transform>(eid);
transform.local.scale = scale;
}
}
void set_transform(entity::registry& registry, entity::id eid, const math::transform<float>& transform, bool warp)
{
if (registry.has<component::transform>(eid))
if (registry.has<game::component::transform>(eid))
{
component::transform& component = registry.get<component::transform>(eid);
game::component::transform& component = registry.get<game::component::transform>(eid);
component.local = transform;
component.warp = warp;
}
@ -87,22 +87,22 @@ void set_transform(entity::registry& registry, entity::id eid, const math::trans
void place(entity::registry& registry, entity::id eid, entity::id celestial_body_id, double altitude, double latitude, double longitude)
{
if (registry.has<component::transform>(eid))
if (registry.has<game::component::transform>(eid))
{
double x = 0.0;
double y = altitude;
double z = 0.0;
if (registry.has<component::celestial_body>(celestial_body_id))
if (registry.has<game::component::celestial_body>(celestial_body_id))
{
const component::celestial_body& celestial_body = registry.get<component::celestial_body>(celestial_body_id);
const game::component::celestial_body& celestial_body = registry.get<game::component::celestial_body>(celestial_body_id);
x = longitude * math::two_pi<double> * celestial_body.radius;
z = -latitude * math::two_pi<double> * celestial_body.radius;
if (registry.has<component::terrain>(celestial_body_id))
if (registry.has<game::component::terrain>(celestial_body_id))
{
const component::terrain& terrain = registry.get<component::terrain>(celestial_body_id);
const game::component::terrain& terrain = registry.get<game::component::terrain>(celestial_body_id);
if (terrain.elevation != nullptr)
{
@ -111,7 +111,7 @@ void place(entity::registry& registry, entity::id eid, entity::id celestial_body
}
}
component::transform& transform = registry.get<component::transform>(eid);
game::component::transform& transform = registry.get<game::component::transform>(eid);
transform.local.translation = math::type_cast<float>(double3{x, y, z});
transform.warp = true;
}
@ -119,14 +119,14 @@ void place(entity::registry& registry, entity::id eid, entity::id celestial_body
void assign_render_layers(entity::registry& registry, entity::id eid, unsigned int layers)
{
if (registry.has<component::model>(eid))
if (registry.has<game::component::model>(eid))
{
component::model model = registry.get<component::model>(eid);
game::component::model model = registry.get<game::component::model>(eid);
model.layers = layers;
registry.replace<component::model>(eid, model);
registry.replace<game::component::model>(eid, model);
// Apply to child layers
registry.view<component::parent>().each(
registry.view<game::component::parent>().each(
[&](entity::id eid, auto& component)
{
if (component.parent == eid)
@ -137,9 +137,9 @@ void assign_render_layers(entity::registry& registry, entity::id eid, unsigned i
math::transform<float> get_local_transform(entity::registry& registry, entity::id eid)
{
if (registry.has<component::transform>(eid))
if (registry.has<game::component::transform>(eid))
{
const component::transform& component = registry.get<component::transform>(eid);
const game::component::transform& component = registry.get<game::component::transform>(eid);
return component.local;
}
@ -148,9 +148,9 @@ math::transform get_local_transform(entity::registry& registry, entity::i
math::transform<float> get_world_transform(entity::registry& registry, entity::id eid)
{
if (registry.has<component::transform>(eid))
if (registry.has<game::component::transform>(eid))
{
const component::transform& component = registry.get<component::transform>(eid);
const game::component::transform& component = registry.get<game::component::transform>(eid);
return component.world;
}
@ -159,9 +159,9 @@ math::transform get_world_transform(entity::registry& registry, entity::i
void parent(entity::registry& registry, entity::id child, entity::id parent)
{
component::parent component;
game::component::parent component;
component.parent = parent;
registry.assign_or_replace<component::parent>(child, component);
registry.assign_or_replace<game::component::parent>(child, component);
}
} // namespace command

+ 2
- 2
src/entity/ebt.cpp View File

@ -18,7 +18,7 @@
*/
#include "entity/ebt.hpp"
#include "entity/components/transform.hpp"
#include "game/component/transform.hpp"
#include <iostream>
namespace entity {
@ -38,7 +38,7 @@ status print_eid(context& context)
status warp_to(context& context, float x, float y, float z)
{
auto& transform = context.registry->get<component::transform>(context.entity_id);
auto& transform = context.registry->get<game::component::transform>(context.entity_id);
transform.local.translation = {x, y, z};
transform.warp = true;
return status::success;

+ 13
- 13
src/game/ant/swarm.cpp View File

@ -18,9 +18,9 @@
*/
#include "game/ant/swarm.hpp"
#include "entity/components/transform.hpp"
#include "entity/components/steering.hpp"
#include "entity/components/model.hpp"
#include "game/component/transform.hpp"
#include "game/component/steering.hpp"
#include "game/component/model.hpp"
#include "resources/resource-manager.hpp"
#include "config.hpp"
#include <cmath>
@ -63,25 +63,25 @@ void create_swarm(game::context& ctx)
const float3 queen_scale = {1, 1, 1};
// Init male model component
entity::component::model male_model;
game::component::model male_model;
male_model.render_model = ctx.resource_manager->load<render::model>("male-boid.mdl");
male_model.instance_count = 0;
male_model.layers = 1;
// Init queen model component
entity::component::model queen_model;
game::component::model queen_model;
queen_model.render_model = ctx.resource_manager->load<render::model>("queen-boid.mdl");
queen_model.instance_count = 0;
queen_model.layers = 1;
// Init transform component
entity::component::transform transform;
game::component::transform transform;
transform.local = math::transform<float>::identity;
transform.world = transform.local;
transform.warp = true;
// Init steering component
entity::component::steering steering;
game::component::steering steering;
steering.agent.mass = 1.0f;
steering.agent.velocity = {0, 0, 0};
steering.agent.acceleration = {0, 0, 0};
@ -114,32 +114,32 @@ void create_swarm(game::context& ctx)
transform.local.translation = steering.agent.position;
entity::id alate_eid = ctx.entity_registry->create();
ctx.entity_registry->assign<entity::component::steering>(alate_eid, steering);
ctx.entity_registry->assign<game::component::steering>(alate_eid, steering);
if (i < male_count)
{
// Create male
ctx.entity_registry->assign<entity::component::model>(alate_eid, male_model);
ctx.entity_registry->assign<game::component::model>(alate_eid, male_model);
transform.local.scale = male_scale;
transform.world = transform.local;
ctx.entity_registry->assign<entity::component::transform>(alate_eid, transform);
ctx.entity_registry->assign<game::component::transform>(alate_eid, transform);
}
else
{
// Create queen
ctx.entity_registry->assign<entity::component::model>(alate_eid, queen_model);
ctx.entity_registry->assign<game::component::model>(alate_eid, queen_model);
transform.local.scale = queen_scale;
transform.world = transform.local;
ctx.entity_registry->assign<entity::component::transform>(alate_eid, transform);
ctx.entity_registry->assign<game::component::transform>(alate_eid, transform);
}
}
}
void destroy_swarm(game::context& ctx)
{
auto view = ctx.entity_registry->view<entity::component::steering>();
auto view = ctx.entity_registry->view<game::component::steering>();
ctx.entity_registry->destroy(view.begin(), view.end());
}

src/entity/components/atmosphere.hpp → src/game/component/atmosphere.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_ATMOSPHERE_HPP
#define ANTKEEPER_ENTITY_COMPONENT_ATMOSPHERE_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_ATMOSPHERE_HPP
#define ANTKEEPER_GAME_COMPONENT_ATMOSPHERE_HPP
#include "utility/fundamental-types.hpp"
namespace entity {
namespace game {
namespace component {
/// Atmosphere
@ -81,6 +81,6 @@ struct atmosphere
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_ATMOSPHERE_HPP
#endif // ANTKEEPER_GAME_COMPONENT_ATMOSPHERE_HPP

src/entity/components/behavior.hpp → src/game/component/behavior.hpp View File

@ -17,21 +17,21 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_BEHAVIOR_HPP
#define ANTKEEPER_ENTITY_COMPONENT_BEHAVIOR_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_BEHAVIOR_HPP
#define ANTKEEPER_GAME_COMPONENT_BEHAVIOR_HPP
#include "entity/ebt.hpp"
namespace entity {
namespace game {
namespace component {
struct behavior
{
const ebt::node* behavior_tree;
const entity::ebt::node* behavior_tree;
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_BEHAVIOR_HPP
#endif // ANTKEEPER_GAME_COMPONENT_BEHAVIOR_HPP

src/entity/components/blackbody.hpp → src/game/component/blackbody.hpp View File

@ -17,10 +17,10 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_BLACKBODY_HPP
#define ANTKEEPER_ENTITY_COMPONENT_BLACKBODY_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_BLACKBODY_HPP
#define ANTKEEPER_GAME_COMPONENT_BLACKBODY_HPP
namespace entity {
namespace game {
namespace component {
/// Blackbody radiator
@ -34,6 +34,6 @@ struct blackbody
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_BLACKBODY_HPP
#endif // ANTKEEPER_GAME_COMPONENT_BLACKBODY_HPP

src/entity/components/brush.hpp → src/game/component/brush.hpp View File

@ -17,10 +17,10 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_BRUSH_HPP
#define ANTKEEPER_ENTITY_COMPONENT_BRUSH_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_BRUSH_HPP
#define ANTKEEPER_GAME_COMPONENT_BRUSH_HPP
namespace entity {
namespace game {
namespace component {
struct brush
@ -29,6 +29,6 @@ struct brush
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_BRUSH_HPP
#endif // ANTKEEPER_GAME_COMPONENT_BRUSH_HPP

src/entity/components/camera.hpp → src/game/component/camera.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_CAMERA_HPP
#define ANTKEEPER_ENTITY_COMPONENT_CAMERA_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_CAMERA_HPP
#define ANTKEEPER_GAME_COMPONENT_CAMERA_HPP
#include "scene/camera.hpp"
namespace entity {
namespace game {
namespace component {
/// Camera scene object component.
@ -33,7 +33,7 @@ struct camera
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_CAMERA_HPP
#endif // ANTKEEPER_GAME_COMPONENT_CAMERA_HPP

src/entity/components/cavity.hpp → src/game/component/cavity.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_CAVITY_HPP
#define ANTKEEPER_ENTITY_COMPONENT_CAVITY_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_CAVITY_HPP
#define ANTKEEPER_GAME_COMPONENT_CAVITY_HPP
#include "math/math.hpp"
namespace entity {
namespace game {
namespace component {
struct cavity
@ -32,7 +32,7 @@ struct cavity
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_CAVITY_HPP
#endif // ANTKEEPER_GAME_COMPONENT_CAVITY_HPP

src/entity/components/celestial-body.hpp → src/game/component/celestial-body.hpp View File

@ -17,10 +17,10 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_CELESTIAL_BODY_HPP
#define ANTKEEPER_ENTITY_COMPONENT_CELESTIAL_BODY_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_CELESTIAL_BODY_HPP
#define ANTKEEPER_GAME_COMPONENT_CELESTIAL_BODY_HPP
namespace entity {
namespace game {
namespace component {
/// A simple celestial body.
@ -60,6 +60,6 @@ struct celestial_body
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_CELESTIAL_BODY_HPP
#endif // ANTKEEPER_GAME_COMPONENT_CELESTIAL_BODY_HPP

src/entity/components/chamber.hpp → src/game/component/chamber.hpp View File

@ -17,14 +17,14 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_CHAMBER_HPP
#define ANTKEEPER_ENTITY_COMPONENT_CHAMBER_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_CHAMBER_HPP
#define ANTKEEPER_GAME_COMPONENT_CHAMBER_HPP
#include <array>
#include <unordered_set>
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace component {
/// Ant nest chamber.
@ -50,6 +50,6 @@ struct chamber
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_CHAMBER_HPP
#endif // ANTKEEPER_GAME_COMPONENT_CHAMBER_HPP

src/entity/components/collision.hpp → src/game/component/collision.hpp View File

@ -17,14 +17,14 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_COLLISION_HPP
#define ANTKEEPER_ENTITY_COMPONENT_COLLISION_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_COLLISION_HPP
#define ANTKEEPER_GAME_COMPONENT_COLLISION_HPP
#include "geom/aabb.hpp"
#include "geom/mesh.hpp"
#include "geom/mesh-accelerator.hpp"
namespace entity {
namespace game {
namespace component {
struct collision
@ -35,7 +35,7 @@ struct collision
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_COLLISION_HPP
#endif // ANTKEEPER_GAME_COMPONENT_COLLISION_HPP

src/entity/components/constraint-stack.hpp → src/game/component/constraint-stack.hpp View File

@ -17,19 +17,19 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_STACK_HPP
#define ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_STACK_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_CONSTRAINT_STACK_HPP
#define ANTKEEPER_GAME_COMPONENT_CONSTRAINT_STACK_HPP
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace component {
/**
* Causes an ordered stack of constraints to be applied to an entity.
*
* @see entity::component::constraint_stack_node
* @see entity::component::constraint
* @see game::component::constraint_stack_node
* @see game::component::constraint
*/
struct constraint_stack
{
@ -40,8 +40,8 @@ struct constraint_stack
/**
* Single node in a constraint stack. Allows toggling and weighing of constraints and links to the following constraint stack node (if any).
*
* @see entity::component::constraint_stack
* @see entity::component::constraint
* @see game::component::constraint_stack
* @see game::component::constraint
*/
struct constraint_stack_node
{
@ -56,6 +56,6 @@ struct constraint_stack_node
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_STACK_HPP
#endif // ANTKEEPER_GAME_COMPONENT_CONSTRAINT_STACK_HPP

src/entity/components/constraints/constraints.hpp → src/game/component/constraints/constraints.hpp View File

@ -17,17 +17,17 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_CONSTRAINTS_HPP
#define ANTKEEPER_ENTITY_COMPONENT_CONSTRAINTS_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_CONSTRAINTS_HPP
#define ANTKEEPER_GAME_COMPONENT_CONSTRAINTS_HPP
namespace entity {
namespace game {
namespace component {
/// Transform constraint components
namespace constraint {}
} // namespace component
} // namespace entity
} // namespace game
#include "copy-translation.hpp"
#include "copy-rotation.hpp"
@ -37,4 +37,4 @@ namespace constraint {}
#include "spring-to.hpp"
#include "three-dof.hpp"
#endif // ANTKEEPER_ENTITY_COMPONENT_CONSTRAINTS_HPP
#endif // ANTKEEPER_GAME_COMPONENT_CONSTRAINTS_HPP

src/entity/components/constraints/copy-rotation.hpp → src/game/component/constraints/copy-rotation.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_COPY_ROTATION_HPP
#define ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_COPY_ROTATION_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_CONSTRAINT_COPY_ROTATION_HPP
#define ANTKEEPER_GAME_COMPONENT_CONSTRAINT_COPY_ROTATION_HPP
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace component {
namespace constraint {
@ -37,6 +37,6 @@ struct copy_rotation
} // namespace constraint
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_COPY_ROTATION_HPP
#endif // ANTKEEPER_GAME_COMPONENT_CONSTRAINT_COPY_ROTATION_HPP

src/entity/components/constraints/copy-scale.hpp → src/game/component/constraints/copy-scale.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_COPY_SCALE_HPP
#define ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_COPY_SCALE_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_CONSTRAINT_COPY_SCALE_HPP
#define ANTKEEPER_GAME_COMPONENT_CONSTRAINT_COPY_SCALE_HPP
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace component {
namespace constraint {
@ -46,6 +46,6 @@ struct copy_scale
} // namespace constraint
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_COPY_SCALE_HPP
#endif // ANTKEEPER_GAME_COMPONENT_CONSTRAINT_COPY_SCALE_HPP

src/entity/components/constraints/copy-transform.hpp → src/game/component/constraints/copy-transform.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_COPY_TRANSFORM_HPP
#define ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_COPY_TRANSFORM_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_CONSTRAINT_COPY_TRANSFORM_HPP
#define ANTKEEPER_GAME_COMPONENT_CONSTRAINT_COPY_TRANSFORM_HPP
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace component {
namespace constraint {
@ -37,6 +37,6 @@ struct copy_transform
} // namespace constraint
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_COPY_TRANSFORM_HPP
#endif // ANTKEEPER_GAME_COMPONENT_CONSTRAINT_COPY_TRANSFORM_HPP

src/entity/components/constraints/copy-translation.hpp → src/game/component/constraints/copy-translation.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_COPY_TRANSLATION_HPP
#define ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_COPY_TRANSLATION_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_CONSTRAINT_COPY_TRANSLATION_HPP
#define ANTKEEPER_GAME_COMPONENT_CONSTRAINT_COPY_TRANSLATION_HPP
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace component {
namespace constraint {
@ -58,6 +58,6 @@ struct copy_translation
} // namespace constraint
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_COPY_TRANSLATION_HPP
#endif // ANTKEEPER_GAME_COMPONENT_CONSTRAINT_COPY_TRANSLATION_HPP

src/entity/components/constraints/spring-to.hpp → src/game/component/constraints/spring-to.hpp View File

@ -17,14 +17,14 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_SPRING_TO_HPP
#define ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_SPRING_TO_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_CONSTRAINT_SPRING_TO_HPP
#define ANTKEEPER_GAME_COMPONENT_CONSTRAINT_SPRING_TO_HPP
#include "entity/id.hpp"
#include "animation/spring.hpp"
#include "utility/fundamental-types.hpp"
namespace entity {
namespace game {
namespace component {
namespace constraint {
@ -51,6 +51,6 @@ struct spring_to
} // namespace constraint
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_SPRING_TO_HPP
#endif // ANTKEEPER_GAME_COMPONENT_CONSTRAINT_SPRING_TO_HPP

src/entity/components/constraints/three-dof.hpp → src/game/component/constraints/three-dof.hpp View File

@ -17,10 +17,10 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_THREE_DOF_HPP
#define ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_THREE_DOF_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_CONSTRAINT_THREE_DOF_HPP
#define ANTKEEPER_GAME_COMPONENT_CONSTRAINT_THREE_DOF_HPP
namespace entity {
namespace game {
namespace component {
namespace constraint {
@ -41,6 +41,6 @@ struct three_dof
} // namespace constraint
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_THREE_DOF_HPP
#endif // ANTKEEPER_GAME_COMPONENT_CONSTRAINT_THREE_DOF_HPP

src/entity/components/constraints/track-to.hpp → src/game/component/constraints/track-to.hpp View File

@ -17,13 +17,13 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_TRACK_TO_HPP
#define ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_TRACK_TO_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_CONSTRAINT_TRACK_TO_HPP
#define ANTKEEPER_GAME_COMPONENT_CONSTRAINT_TRACK_TO_HPP
#include "entity/id.hpp"
#include "utility/fundamental-types.hpp"
namespace entity {
namespace game {
namespace component {
namespace constraint {
@ -41,6 +41,6 @@ struct track_to
} // namespace constraint
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_CONSTRAINT_TRACK_TO_HPP
#endif // ANTKEEPER_GAME_COMPONENT_CONSTRAINT_TRACK_TO_HPP

src/entity/components/diffuse-reflector.hpp → src/game/component/diffuse-reflector.hpp View File

@ -17,10 +17,10 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_DIFFUSE_REFLECTOR_HPP
#define ANTKEEPER_ENTITY_COMPONENT_DIFFUSE_REFLECTOR_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_DIFFUSE_REFLECTOR_HPP
#define ANTKEEPER_GAME_COMPONENT_DIFFUSE_REFLECTOR_HPP
namespace entity {
namespace game {
namespace component {
struct diffuse_reflector
@ -29,6 +29,6 @@ struct diffuse_reflector
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_DIFFUSE_REFLECTOR_HPP
#endif // ANTKEEPER_GAME_COMPONENT_DIFFUSE_REFLECTOR_HPP

src/entity/components/genome.hpp → src/game/component/genome.hpp View File

@ -17,13 +17,13 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_GENOME_HPP
#define ANTKEEPER_ENTITY_COMPONENT_GENOME_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_GENOME_HPP
#define ANTKEEPER_GAME_COMPONENT_GENOME_HPP
#include <string>
#include <vector>
namespace entity {
namespace game {
namespace component {
/// Complete set of genetic material in an organism.
@ -45,6 +45,6 @@ struct genome
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_GENOME_HPP
#endif // ANTKEEPER_GAME_COMPONENT_GENOME_HPP

src/entity/components/light.hpp → src/game/component/light.hpp View File

@ -17,13 +17,13 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_LIGHT_HPP
#define ANTKEEPER_ENTITY_COMPONENT_LIGHT_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_LIGHT_HPP
#define ANTKEEPER_GAME_COMPONENT_LIGHT_HPP
#include "utility/fundamental-types.hpp"
#include "scene/light.hpp"
namespace entity {
namespace game {
namespace component {
struct light
@ -36,7 +36,7 @@ struct light
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_LIGHT_HPP
#endif // ANTKEEPER_GAME_COMPONENT_LIGHT_HPP

src/entity/components/locomotion.hpp → src/game/component/locomotion.hpp View File

@ -17,13 +17,13 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_PLACEMENT_HPP
#define ANTKEEPER_ENTITY_COMPONENT_PLACEMENT_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_PLACEMENT_HPP
#define ANTKEEPER_GAME_COMPONENT_PLACEMENT_HPP
#include "geom/mesh.hpp"
#include "utility/fundamental-types.hpp"
namespace entity {
namespace game {
namespace component {
struct locomotion
@ -35,7 +35,7 @@ struct locomotion
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_PLACEMENT_HPP
#endif // ANTKEEPER_GAME_COMPONENT_PLACEMENT_HPP

src/entity/components/model.hpp → src/game/component/model.hpp View File

@ -17,13 +17,13 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_MODEL_HPP
#define ANTKEEPER_ENTITY_COMPONENT_MODEL_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_MODEL_HPP
#define ANTKEEPER_GAME_COMPONENT_MODEL_HPP
#include "render/model.hpp"
#include <unordered_map>
namespace entity {
namespace game {
namespace component {
struct model
@ -35,6 +35,6 @@ struct model
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_MODEL_HPP
#endif // ANTKEEPER_GAME_COMPONENT_MODEL_HPP

src/entity/components/nest.hpp → src/game/component/nest.hpp View File

@ -17,13 +17,13 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_NEST_HPP
#define ANTKEEPER_ENTITY_COMPONENT_NEST_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_NEST_HPP
#define ANTKEEPER_GAME_COMPONENT_NEST_HPP
#include <vector>
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace component {
struct nest
@ -36,6 +36,6 @@ struct nest
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_NEST_HPP
#endif // ANTKEEPER_GAME_COMPONENT_NEST_HPP

src/entity/components/observer.hpp → src/game/component/observer.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_OBSERVER_HPP
#define ANTKEEPER_ENTITY_COMPONENT_OBSERVER_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_OBSERVER_HPP
#define ANTKEEPER_GAME_COMPONENT_OBSERVER_HPP
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace component {
/**
@ -44,6 +44,6 @@ struct observer
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_OBSERVER_HPP
#endif // ANTKEEPER_GAME_COMPONENT_OBSERVER_HPP

src/entity/components/orbit.hpp → src/game/component/orbit.hpp View File

@ -17,13 +17,13 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_ORBIT_HPP
#define ANTKEEPER_ENTITY_COMPONENT_ORBIT_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_ORBIT_HPP
#define ANTKEEPER_GAME_COMPONENT_ORBIT_HPP
#include "entity/id.hpp"
#include "math/vector-type.hpp"
namespace entity {
namespace game {
namespace component {
struct orbit
@ -42,6 +42,6 @@ struct orbit
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_ORBIT_HPP
#endif // ANTKEEPER_GAME_COMPONENT_ORBIT_HPP

src/entity/components/parent.hpp → src/game/component/parent.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_PARENT_HPP
#define ANTKEEPER_ENTITY_COMPONENT_PARENT_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_PARENT_HPP
#define ANTKEEPER_GAME_COMPONENT_PARENT_HPP
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace component {
struct parent
@ -31,6 +31,6 @@ struct parent
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_PARENT_HPP
#endif // ANTKEEPER_GAME_COMPONENT_PARENT_HPP

src/entity/components/proteome.hpp → src/game/component/proteome.hpp View File

@ -17,13 +17,13 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_PROTEOME_HPP
#define ANTKEEPER_ENTITY_COMPONENT_PROTEOME_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_PROTEOME_HPP
#define ANTKEEPER_GAME_COMPONENT_PROTEOME_HPP
#include <string>
#include <vector>
namespace entity {
namespace game {
namespace component {
/// Set of all proteins that can be expressed by an organism.
@ -34,6 +34,6 @@ struct proteome
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_PROTEOME_HPP
#endif // ANTKEEPER_GAME_COMPONENT_PROTEOME_HPP

src/entity/components/samara.hpp → src/game/component/samara.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_SAMARA_HPP
#define ANTKEEPER_ENTITY_COMPONENT_SAMARA_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_SAMARA_HPP
#define ANTKEEPER_GAME_COMPONENT_SAMARA_HPP
#include "utility/fundamental-types.hpp"
namespace entity {
namespace game {
namespace component {
struct samara
@ -33,7 +33,7 @@ struct samara
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_SAMARA_HPP
#endif // ANTKEEPER_GAME_COMPONENT_SAMARA_HPP

src/entity/components/select.hpp → src/game/component/select.hpp View File

@ -17,10 +17,10 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_SELECT_HPP
#define ANTKEEPER_ENTITY_COMPONENT_SELECT_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_SELECT_HPP
#define ANTKEEPER_GAME_COMPONENT_SELECT_HPP
namespace entity {
namespace game {
namespace component {
/// Allows an entity to be selected.
@ -31,6 +31,6 @@ struct select
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_SELECT_HPP
#endif // ANTKEEPER_GAME_COMPONENT_SELECT_HPP

src/entity/components/snap.hpp → src/game/component/snap.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_SNAP_HPP
#define ANTKEEPER_ENTITY_COMPONENT_SNAP_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_SNAP_HPP
#define ANTKEEPER_GAME_COMPONENT_SNAP_HPP
#include "geom/ray.hpp"
namespace entity {
namespace game {
namespace component {
struct snap
@ -34,7 +34,7 @@ struct snap
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_SNAP_HPP
#endif // ANTKEEPER_GAME_COMPONENT_SNAP_HPP

src/entity/components/steering.hpp → src/game/component/steering.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_STEERING_HPP
#define ANTKEEPER_ENTITY_COMPONENT_STEERING_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_STEERING_HPP
#define ANTKEEPER_GAME_COMPONENT_STEERING_HPP
#include "ai/steering/agent.hpp"
namespace entity {
namespace game {
namespace component {
struct steering
@ -50,6 +50,6 @@ struct steering
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_STEERING_HPP
#endif // ANTKEEPER_GAME_COMPONENT_STEERING_HPP

src/entity/components/terrain.hpp → src/game/component/terrain.hpp View File

@ -17,13 +17,13 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_TERRAIN_HPP
#define ANTKEEPER_ENTITY_COMPONENT_TERRAIN_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_TERRAIN_HPP
#define ANTKEEPER_GAME_COMPONENT_TERRAIN_HPP
#include "render/material.hpp"
#include <functional>
namespace entity {
namespace game {
namespace component {
struct terrain
@ -39,6 +39,6 @@ struct terrain
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_TERRAIN_HPP
#endif // ANTKEEPER_GAME_COMPONENT_TERRAIN_HPP

src/entity/components/tool.hpp → src/game/component/tool.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_TOOL_HPP
#define ANTKEEPER_ENTITY_COMPONENT_TOOL_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_TOOL_HPP
#define ANTKEEPER_GAME_COMPONENT_TOOL_HPP
#include <functional>
namespace entity {
namespace game {
namespace component {
struct tool
@ -33,7 +33,7 @@ struct tool
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_TOOL_HPP
#endif // ANTKEEPER_GAME_COMPONENT_TOOL_HPP

src/entity/components/trackable.hpp → src/game/component/trackable.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_TRACKABLE_HPP
#define ANTKEEPER_ENTITY_COMPONENT_TRACKABLE_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_TRACKABLE_HPP
#define ANTKEEPER_GAME_COMPONENT_TRACKABLE_HPP
#include "utility/fundamental-types.hpp"
namespace entity {
namespace game {
namespace component {
struct trackable
@ -31,6 +31,6 @@ struct trackable
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_TRACKABLE_HPP
#endif // ANTKEEPER_GAME_COMPONENT_TRACKABLE_HPP

src/entity/components/transform.hpp → src/game/component/transform.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_COMPONENT_TRANSFORM_HPP
#define ANTKEEPER_ENTITY_COMPONENT_TRANSFORM_HPP
#ifndef ANTKEEPER_GAME_COMPONENT_TRANSFORM_HPP
#define ANTKEEPER_GAME_COMPONENT_TRANSFORM_HPP
#include "math/math.hpp"
namespace entity {
namespace game {
namespace component {
struct transform
@ -33,7 +33,7 @@ struct transform
};
} // namespace component
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_COMPONENT_TRANSFORM_HPP
#endif // ANTKEEPER_GAME_COMPONENT_TRANSFORM_HPP

+ 20
- 20
src/game/context.hpp View File

@ -74,7 +74,7 @@ namespace debug
class logger;
}
namespace entity
namespace game
{
namespace system
{
@ -275,25 +275,25 @@ struct context
std::unordered_map<std::string, entity::id> entities;
// Systems
entity::system::behavior* behavior_system;
entity::system::camera* camera_system;
entity::system::collision* collision_system;
entity::system::constraint* constraint_system;
entity::system::locomotion* locomotion_system;
entity::system::steering* steering_system;
entity::system::snapping* snapping_system;
entity::system::render* render_system;
entity::system::samara* samara_system;
entity::system::subterrain* subterrain_system;
entity::system::terrain* terrain_system;
entity::system::vegetation* vegetation_system;
entity::system::spatial* spatial_system;
entity::system::painting* painting_system;
entity::system::blackbody* blackbody_system;
entity::system::atmosphere* atmosphere_system;
entity::system::astronomy* astronomy_system;
entity::system::orbit* orbit_system;
entity::system::proteome* proteome_system;
game::system::behavior* behavior_system;
game::system::camera* camera_system;
game::system::collision* collision_system;
game::system::constraint* constraint_system;
game::system::locomotion* locomotion_system;
game::system::steering* steering_system;
game::system::snapping* snapping_system;
game::system::render* render_system;
game::system::samara* samara_system;
game::system::subterrain* subterrain_system;
game::system::terrain* terrain_system;
game::system::vegetation* vegetation_system;
game::system::spatial* spatial_system;
game::system::painting* painting_system;
game::system::blackbody* blackbody_system;
game::system::atmosphere* atmosphere_system;
game::system::astronomy* astronomy_system;
game::system::orbit* orbit_system;
game::system::proteome* proteome_system;
double3 rgb_wavelengths;
};

+ 1
- 1
src/game/load.cpp View File

@ -27,7 +27,7 @@
#include "render/material.hpp"
#include "render/passes/sky-pass.hpp"
#include "render/passes/ground-pass.hpp"
#include "entity/systems/astronomy.hpp"
#include "game/system/astronomy.hpp"
#include <fstream>
namespace game {

+ 38
- 38
src/game/state/boot.cpp View File

@ -56,25 +56,25 @@
#include "resources/file-buffer.hpp"
#include "scene/scene.hpp"
#include "game/state/splash.hpp"
#include "entity/systems/behavior.hpp"
#include "entity/systems/camera.hpp"
#include "entity/systems/collision.hpp"
#include "entity/systems/constraint.hpp"
#include "entity/systems/locomotion.hpp"
#include "entity/systems/snapping.hpp"
#include "entity/systems/render.hpp"
#include "entity/systems/samara.hpp"
#include "entity/systems/subterrain.hpp"
#include "entity/systems/terrain.hpp"
#include "entity/systems/vegetation.hpp"
#include "entity/systems/spatial.hpp"
#include "entity/systems/painting.hpp"
#include "entity/systems/astronomy.hpp"
#include "entity/systems/blackbody.hpp"
#include "entity/systems/atmosphere.hpp"
#include "entity/systems/orbit.hpp"
#include "entity/systems/proteome.hpp"
#include "entity/systems/steering.hpp"
#include "game/system/behavior.hpp"
#include "game/system/camera.hpp"
#include "game/system/collision.hpp"
#include "game/system/constraint.hpp"
#include "game/system/locomotion.hpp"
#include "game/system/snapping.hpp"
#include "game/system/render.hpp"
#include "game/system/samara.hpp"
#include "game/system/subterrain.hpp"
#include "game/system/terrain.hpp"
#include "game/system/vegetation.hpp"
#include "game/system/spatial.hpp"
#include "game/system/painting.hpp"
#include "game/system/astronomy.hpp"
#include "game/system/blackbody.hpp"
#include "game/system/atmosphere.hpp"
#include "game/system/orbit.hpp"
#include "game/system/proteome.hpp"
#include "game/system/steering.hpp"
#include "entity/commands.hpp"
#include "utility/paths.hpp"
#include "event/event-dispatcher.hpp"
@ -834,13 +834,13 @@ void boot::setup_systems()
float4 viewport = {0.0f, 0.0f, static_cast<float>(viewport_dimensions[0]), static_cast<float>(viewport_dimensions[1])};
// Setup terrain system
ctx.terrain_system = new entity::system::terrain(*ctx.entity_registry);
ctx.terrain_system = new game::system::terrain(*ctx.entity_registry);
ctx.terrain_system->set_patch_subdivisions(30);
ctx.terrain_system->set_patch_scene_collection(ctx.surface_scene);
ctx.terrain_system->set_max_error(200.0);
// Setup vegetation system
//ctx.vegetation_system = new entity::system::vegetation(*ctx.entity_registry);
//ctx.vegetation_system = new game::system::vegetation(*ctx.entity_registry);
//ctx.vegetation_system->set_terrain_patch_size(TERRAIN_PATCH_SIZE);
//ctx.vegetation_system->set_vegetation_patch_resolution(VEGETATION_PATCH_RESOLUTION);
//ctx.vegetation_system->set_vegetation_density(1.0f);
@ -848,67 +848,67 @@ void boot::setup_systems()
//ctx.vegetation_system->set_scene(ctx.surface_scene);
// Setup camera system
ctx.camera_system = new entity::system::camera(*ctx.entity_registry);
ctx.camera_system = new game::system::camera(*ctx.entity_registry);
ctx.camera_system->set_viewport(viewport);
event_dispatcher->subscribe<window_resized_event>(ctx.camera_system);
// Setup subterrain system
ctx.subterrain_system = new entity::system::subterrain(*ctx.entity_registry, ctx.resource_manager);
ctx.subterrain_system = new game::system::subterrain(*ctx.entity_registry, ctx.resource_manager);
ctx.subterrain_system->set_scene(ctx.underground_scene);
// Setup collision system
ctx.collision_system = new entity::system::collision(*ctx.entity_registry);
ctx.collision_system = new game::system::collision(*ctx.entity_registry);
// Setup samara system
ctx.samara_system = new entity::system::samara(*ctx.entity_registry);
ctx.samara_system = new game::system::samara(*ctx.entity_registry);
// Setup snapping system
ctx.snapping_system = new entity::system::snapping(*ctx.entity_registry);
ctx.snapping_system = new game::system::snapping(*ctx.entity_registry);
// Setup behavior system
ctx.behavior_system = new entity::system::behavior(*ctx.entity_registry);
ctx.behavior_system = new game::system::behavior(*ctx.entity_registry);
// Setup locomotion system
ctx.locomotion_system = new entity::system::locomotion(*ctx.entity_registry);
ctx.locomotion_system = new game::system::locomotion(*ctx.entity_registry);
// Setup steering system
ctx.steering_system = new entity::system::steering(*ctx.entity_registry);
ctx.steering_system = new game::system::steering(*ctx.entity_registry);
// Setup spatial system
ctx.spatial_system = new entity::system::spatial(*ctx.entity_registry);
ctx.spatial_system = new game::system::spatial(*ctx.entity_registry);
// Setup constraint system
ctx.constraint_system = new entity::system::constraint(*ctx.entity_registry);
ctx.constraint_system = new game::system::constraint(*ctx.entity_registry);
// Setup painting system
ctx.painting_system = new entity::system::painting(*ctx.entity_registry, event_dispatcher, ctx.resource_manager);
ctx.painting_system = new game::system::painting(*ctx.entity_registry, event_dispatcher, ctx.resource_manager);
ctx.painting_system->set_scene(ctx.surface_scene);
// Setup orbit system
ctx.orbit_system = new entity::system::orbit(*ctx.entity_registry);
ctx.orbit_system = new game::system::orbit(*ctx.entity_registry);
// Setup blackbody system
ctx.blackbody_system = new entity::system::blackbody(*ctx.entity_registry);
ctx.blackbody_system = new game::system::blackbody(*ctx.entity_registry);
ctx.blackbody_system->set_illuminant(color::illuminant::deg2::d55<double>);
// RGB wavelengths for atmospheric scatteering
ctx.rgb_wavelengths = {645, 575, 440};
// Setup atmosphere system
ctx.atmosphere_system = new entity::system::atmosphere(*ctx.entity_registry);
ctx.atmosphere_system = new game::system::atmosphere(*ctx.entity_registry);
ctx.atmosphere_system->set_rgb_wavelengths(ctx.rgb_wavelengths * 1e-9);
ctx.atmosphere_system->set_sky_pass(ctx.sky_pass);
// Setup astronomy system
ctx.astronomy_system = new entity::system::astronomy(*ctx.entity_registry);
ctx.astronomy_system = new game::system::astronomy(*ctx.entity_registry);
ctx.astronomy_system->set_transmittance_samples(16);
ctx.astronomy_system->set_sky_pass(ctx.sky_pass);
// Setup proteome system
ctx.proteome_system = new entity::system::proteome(*ctx.entity_registry);
ctx.proteome_system = new game::system::proteome(*ctx.entity_registry);
// Setup render system
ctx.render_system = new entity::system::render(*ctx.entity_registry);
ctx.render_system = new game::system::render(*ctx.entity_registry);
//ctx.render_system->add_layer(ctx.underground_scene);
ctx.render_system->add_layer(ctx.surface_scene);
ctx.render_system->add_layer(ctx.ui_scene);

+ 3
- 3
src/game/state/main-menu.cpp View File

@ -37,9 +37,9 @@
#include "application.hpp"
#include "config.hpp"
#include "physics/light/exposure.hpp"
#include "entity/components/model.hpp"
#include "entity/components/steering.hpp"
#include "entity/components/transform.hpp"
#include "game/component/model.hpp"
#include "game/component/steering.hpp"
#include "game/component/transform.hpp"
#include <limits>
namespace game {

+ 52
- 52
src/game/state/nuptial-flight.cpp View File

@ -21,18 +21,18 @@
#include "game/state/pause-menu.hpp"
#include "game/ant/swarm.hpp"
#include "entity/archetype.hpp"
#include "entity/systems/camera.hpp"
#include "entity/systems/astronomy.hpp"
#include "entity/systems/atmosphere.hpp"
#include "entity/components/locomotion.hpp"
#include "entity/components/transform.hpp"
#include "entity/components/terrain.hpp"
#include "entity/components/camera.hpp"
#include "entity/components/model.hpp"
#include "entity/components/constraints/spring-to.hpp"
#include "entity/components/constraints/three-dof.hpp"
#include "entity/components/constraint-stack.hpp"
#include "entity/components/steering.hpp"
#include "game/system/camera.hpp"
#include "game/system/astronomy.hpp"
#include "game/system/atmosphere.hpp"
#include "game/component/locomotion.hpp"
#include "game/component/transform.hpp"
#include "game/component/terrain.hpp"
#include "game/component/camera.hpp"
#include "game/component/model.hpp"
#include "game/component/constraints/spring-to.hpp"
#include "game/component/constraints/three-dof.hpp"
#include "game/component/constraint-stack.hpp"
#include "game/component/steering.hpp"
#include "entity/commands.hpp"
#include "animation/screen-transition.hpp"
#include "animation/ease.hpp"
@ -183,11 +183,11 @@ void nuptial_flight::setup_camera()
ctx.entities["surface_cam_target"] = target_eid;
{
// Transform
entity::component::transform target_transform;
game::component::transform target_transform;
target_transform.local = math::transform<float>::identity;
target_transform.world = target_transform.local;
target_transform.warp = true;
ctx.entity_registry->assign<entity::component::transform>(target_eid, target_transform);
ctx.entity_registry->assign<game::component::transform>(target_eid, target_transform);
}
// Create camera entity
@ -195,61 +195,61 @@ void nuptial_flight::setup_camera()
ctx.entities["surface_cam"] = camera_eid;
// Create camera transform component
entity::component::transform transform;
game::component::transform transform;
transform.local = math::transform<float>::identity;
transform.world = transform.local;
transform.warp = true;
ctx.entity_registry->assign<entity::component::transform>(camera_eid, transform);
ctx.entity_registry->assign<game::component::transform>(camera_eid, transform);
// Create camera camera component
entity::component::camera camera;
game::component::camera camera;
camera.object = ctx.surface_camera;
ctx.entity_registry->assign<entity::component::camera>(camera_eid, camera);
ctx.entity_registry->assign<game::component::camera>(camera_eid, camera);
// Create camera 3DOF constraint entity
entity::id three_dof_constraint_eid = ctx.entity_registry->create();
ctx.entities["surface_cam_3dof"] = three_dof_constraint_eid;
{
// Create 3DOF to constraint
entity::component::constraint::three_dof three_dof;
game::component::constraint::three_dof three_dof;
three_dof.yaw = 0.0f;
three_dof.pitch = 0.0f;
three_dof.roll = 0.0f;
ctx.entity_registry->assign<entity::component::constraint::three_dof>(three_dof_constraint_eid, three_dof);
ctx.entity_registry->assign<game::component::constraint::three_dof>(three_dof_constraint_eid, three_dof);
// Create constraint stack node component
entity::component::constraint_stack_node node;
game::component::constraint_stack_node node;
node.active = true;
node.weight = 1.0f;
node.next = entt::null;
ctx.entity_registry->assign<entity::component::constraint_stack_node>(three_dof_constraint_eid, node);
ctx.entity_registry->assign<game::component::constraint_stack_node>(three_dof_constraint_eid, node);
}
// Create camera spring to constraint entity
entity::id spring_constraint_eid = ctx.entity_registry->create();
{
// Create spring to constraint
entity::component::constraint::spring_to spring;
game::component::constraint::spring_to spring;
spring.target = target_eid;
spring.translation = {{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, 1.0f, math::two_pi<float>};
spring.translation.w = hz_to_rads(8.0f);
spring.spring_translation = true;
spring.spring_rotation = false;
ctx.entity_registry->assign<entity::component::constraint::spring_to>(spring_constraint_eid, spring);
ctx.entity_registry->assign<game::component::constraint::spring_to>(spring_constraint_eid, spring);
// Create constraint stack node component
entity::component::constraint_stack_node node;
game::component::constraint_stack_node node;
node.active = true;
node.weight = 1.0f;
node.next = three_dof_constraint_eid;
ctx.entity_registry->assign<entity::component::constraint_stack_node>(spring_constraint_eid, node);
ctx.entity_registry->assign<game::component::constraint_stack_node>(spring_constraint_eid, node);
}
// Create camera constraint stack component
entity::component::constraint_stack constraint_stack;
game::component::constraint_stack constraint_stack;
constraint_stack.head = spring_constraint_eid;
ctx.entity_registry->assign<entity::component::constraint_stack>(camera_eid, constraint_stack);
ctx.entity_registry->assign<game::component::constraint_stack>(camera_eid, constraint_stack);
}
game::ant::create_swarm(ctx);
@ -324,7 +324,7 @@ void nuptial_flight::enable_keeper_controls()
if (move_fast->is_active())
value *= fast_modifier;
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
const math::quaternion<float> yaw = math::angle_axis(three_dof.yaw, {0.0f, 1.0f, 0.0f});
const float3 movement = {0.0f, 0.0f, -dolly_speed * value * (1.0f / 60.0f)};
@ -342,7 +342,7 @@ void nuptial_flight::enable_keeper_controls()
if (move_fast->is_active())
value *= fast_modifier;
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
const math::quaternion<float> yaw = math::angle_axis(three_dof.yaw, {0.0f, 1.0f, 0.0f});
const float3 movement = {0.0f, 0.0f, dolly_speed * value * (1.0f / 60.0f)};
@ -360,7 +360,7 @@ void nuptial_flight::enable_keeper_controls()
if (move_fast->is_active())
value *= fast_modifier;
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
const math::quaternion<float> yaw = math::angle_axis(three_dof.yaw, {0.0f, 1.0f, 0.0f});
const float3 movement = {truck_speed * value * (1.0f / 60.0f), 0.0f, 0.0f};
@ -378,7 +378,7 @@ void nuptial_flight::enable_keeper_controls()
if (move_fast->is_active())
value *= fast_modifier;
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
const math::quaternion<float> yaw = math::angle_axis(three_dof.yaw, {0.0f, 1.0f, 0.0f});
const float3 movement = {-truck_speed * value * (1.0f / 60.0f), 0.0f, 0.0f};
@ -452,7 +452,7 @@ void nuptial_flight::enable_keeper_controls()
(
[&ctx = this->ctx, three_dof_eid, gamepad_pan_factor](float value)
{
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.yaw += gamepad_pan_factor * value * (1.0f / 60.0f);
}
);
@ -463,7 +463,7 @@ void nuptial_flight::enable_keeper_controls()
if (!ctx.mouse_look)
return;
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.yaw += mouse_pan_factor * value * (1.0f / 60.0f);
}
);
@ -473,7 +473,7 @@ void nuptial_flight::enable_keeper_controls()
(
[&ctx = this->ctx, three_dof_eid, gamepad_pan_factor](float value)
{
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.yaw -= gamepad_pan_factor * value * (1.0f / 60.0f);
}
);
@ -484,7 +484,7 @@ void nuptial_flight::enable_keeper_controls()
if (!ctx.mouse_look)
return;
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.yaw -= mouse_pan_factor * value * (1.0f / 60.0f);
}
);
@ -493,7 +493,7 @@ void nuptial_flight::enable_keeper_controls()
(
[&ctx = this->ctx, three_dof_eid, gamepad_tilt_factor](float value)
{
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.pitch -= gamepad_tilt_factor * value * (1.0f / 60.0f);
three_dof.pitch = std::max<float>(math::radians(-90.0f), three_dof.pitch);
}
@ -505,7 +505,7 @@ void nuptial_flight::enable_keeper_controls()
if (!ctx.mouse_look)
return;
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.pitch -= mouse_tilt_factor * value * (1.0f / 60.0f);
three_dof.pitch = std::max<float>(math::radians(-90.0f), three_dof.pitch);
}
@ -515,7 +515,7 @@ void nuptial_flight::enable_keeper_controls()
(
[&ctx = this->ctx, three_dof_eid, gamepad_tilt_factor](float value)
{
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.pitch += gamepad_tilt_factor * value * (1.0f / 60.0f);
three_dof.pitch = std::min<float>(math::radians(90.0f), three_dof.pitch);
}
@ -527,7 +527,7 @@ void nuptial_flight::enable_keeper_controls()
if (!ctx.mouse_look)
return;
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.pitch += mouse_tilt_factor * value * (1.0f / 60.0f);
three_dof.pitch = std::min<float>(math::radians(90.0f), three_dof.pitch);
}
@ -775,7 +775,7 @@ void nuptial_flight::enable_ant_controls()
if (move_fast->is_active())
value *= fast_modifier;
auto& locomotion = ctx.entity_registry->get<entity::component::locomotion>(ant_eid);
auto& locomotion = ctx.entity_registry->get<game::component::locomotion>(ant_eid);
const math::quaternion<float> yaw = math::angle_axis(locomotion.yaw, {0.0f, 1.0f, 0.0f});
const float3 movement = {0.0f, 0.0f, move_forward_speed * value * (1.0f / 60.0f)};
@ -793,7 +793,7 @@ void nuptial_flight::enable_ant_controls()
if (move_fast->is_active())
value *= fast_modifier;
auto& locomotion = ctx.entity_registry->get<entity::component::locomotion>(ant_eid);
auto& locomotion = ctx.entity_registry->get<game::component::locomotion>(ant_eid);
const math::quaternion<float> yaw = math::angle_axis(locomotion.yaw, {0.0f, 1.0f, 0.0f});
const float3 movement = {0.0f, 0.0f, -move_back_speed * value * (1.0f / 60.0f)};
@ -811,7 +811,7 @@ void nuptial_flight::enable_ant_controls()
if (move_fast->is_active())
value *= fast_modifier;
auto& locomotion = ctx.entity_registry->get<entity::component::locomotion>(ant_eid);
auto& locomotion = ctx.entity_registry->get<game::component::locomotion>(ant_eid);
float delta_yaw = -turn_speed * value * (1.0f / 60.0f);
locomotion.yaw += delta_yaw;
@ -829,7 +829,7 @@ void nuptial_flight::enable_ant_controls()
if (move_fast->is_active())
value *= fast_modifier;
auto& locomotion = ctx.entity_registry->get<entity::component::locomotion>(ant_eid);
auto& locomotion = ctx.entity_registry->get<game::component::locomotion>(ant_eid);
float delta_yaw = turn_speed * value * (1.0f / 60.0f);
locomotion.yaw += delta_yaw;
@ -843,7 +843,7 @@ void nuptial_flight::enable_ant_controls()
(
[&ctx = this->ctx, three_dof_eid, gamepad_pan_factor](float value)
{
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.yaw += gamepad_pan_factor * value * (1.0f / 60.0f);
}
);
@ -854,7 +854,7 @@ void nuptial_flight::enable_ant_controls()
if (!ctx.mouse_look)
return;
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.yaw += mouse_pan_factor * value * (1.0f / 60.0f);
}
);
@ -864,7 +864,7 @@ void nuptial_flight::enable_ant_controls()
(
[&ctx = this->ctx, three_dof_eid, gamepad_pan_factor](float value)
{
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.yaw -= gamepad_pan_factor * value * (1.0f / 60.0f);
}
);
@ -875,7 +875,7 @@ void nuptial_flight::enable_ant_controls()
if (!ctx.mouse_look)
return;
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.yaw -= mouse_pan_factor * value * (1.0f / 60.0f);
}
);
@ -884,7 +884,7 @@ void nuptial_flight::enable_ant_controls()
(
[&ctx = this->ctx, three_dof_eid, gamepad_tilt_factor](float value)
{
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.pitch -= gamepad_tilt_factor * value * (1.0f / 60.0f);
three_dof.pitch = std::max<float>(math::radians(-90.0f), three_dof.pitch);
}
@ -896,7 +896,7 @@ void nuptial_flight::enable_ant_controls()
if (!ctx.mouse_look)
return;
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.pitch -= mouse_tilt_factor * value * (1.0f / 60.0f);
three_dof.pitch = std::max<float>(math::radians(-90.0f), three_dof.pitch);
}
@ -906,7 +906,7 @@ void nuptial_flight::enable_ant_controls()
(
[&ctx = this->ctx, three_dof_eid, gamepad_tilt_factor](float value)
{
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.pitch += gamepad_tilt_factor * value * (1.0f / 60.0f);
three_dof.pitch = std::min<float>(math::radians(90.0f), three_dof.pitch);
}
@ -918,7 +918,7 @@ void nuptial_flight::enable_ant_controls()
if (!ctx.mouse_look)
return;
auto& three_dof = ctx.entity_registry->get<entity::component::constraint::three_dof>(three_dof_eid);
auto& three_dof = ctx.entity_registry->get<game::component::constraint::three_dof>(three_dof_eid);
three_dof.pitch += mouse_tilt_factor * value * (1.0f / 60.0f);
three_dof.pitch = std::min<float>(math::radians(90.0f), three_dof.pitch);
}

+ 3
- 2
src/game/state/splash.cpp View File

@ -19,6 +19,7 @@
#include "game/state/splash.hpp"
#include "game/state/main-menu.hpp"
#include "game/state/nuptial-flight.hpp"
#include "animation/screen-transition.hpp"
#include "animation/animation.hpp"
#include "animation/animator.hpp"
@ -116,7 +117,7 @@ splash::splash(game::context& ctx):
[&ctx]()
{
ctx.state_machine.pop();
ctx.state_machine.emplace(new game::state::main_menu(ctx, true));
ctx.state_machine.emplace(new game::state::nuptial_flight(ctx));
}
);
}
@ -144,7 +145,7 @@ splash::splash(game::context& ctx):
// Change to main menu state
ctx.state_machine.pop();
ctx.state_machine.emplace(new game::state::main_menu(ctx, true));
ctx.state_machine.emplace(new game::state::nuptial_flight(ctx));
}
}
);

src/entity/systems/astronomy.cpp → src/game/system/astronomy.cpp View File

@ -17,11 +17,11 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#include "entity/systems/astronomy.hpp"
#include "game/system/astronomy.hpp"
#include "astro/apparent-size.hpp"
#include "entity/components/blackbody.hpp"
#include "entity/components/transform.hpp"
#include "entity/components/diffuse-reflector.hpp"
#include "game/component/blackbody.hpp"
#include "game/component/transform.hpp"
#include "game/component/diffuse-reflector.hpp"
#include "geom/intersection.hpp"
#include "geom/cartesian.hpp"
#include "color/color.hpp"
@ -38,7 +38,7 @@
#include "math/polynomial.hpp"
#include <iostream>
namespace entity {
namespace game {
namespace system {
astronomy::astronomy(entity::registry& registry):
@ -64,34 +64,34 @@ astronomy::astronomy(entity::registry& registry):
math::quaternion<double>::rotate_x(-math::half_pi<double>)
};
registry.on_construct<entity::component::observer>().connect<&astronomy::on_observer_modified>(this);
registry.on_replace<entity::component::observer>().connect<&astronomy::on_observer_modified>(this);
registry.on_destroy<entity::component::observer>().connect<&astronomy::on_observer_destroyed>(this);
registry.on_construct<entity::component::celestial_body>().connect<&astronomy::on_celestial_body_modified>(this);
registry.on_replace<entity::component::celestial_body>().connect<&astronomy::on_celestial_body_modified>(this);
registry.on_destroy<entity::component::celestial_body>().connect<&astronomy::on_celestial_body_destroyed>(this);
registry.on_construct<entity::component::orbit>().connect<&astronomy::on_orbit_modified>(this);
registry.on_replace<entity::component::orbit>().connect<&astronomy::on_orbit_modified>(this);
registry.on_destroy<entity::component::orbit>().connect<&astronomy::on_orbit_destroyed>(this);
registry.on_construct<entity::component::atmosphere>().connect<&astronomy::on_atmosphere_modified>(this);
registry.on_replace<entity::component::atmosphere>().connect<&astronomy::on_atmosphere_modified>(this);
registry.on_destroy<entity::component::atmosphere>().connect<&astronomy::on_atmosphere_destroyed>(this);
registry.on_construct<game::component::observer>().connect<&astronomy::on_observer_modified>(this);
registry.on_replace<game::component::observer>().connect<&astronomy::on_observer_modified>(this);
registry.on_destroy<game::component::observer>().connect<&astronomy::on_observer_destroyed>(this);
registry.on_construct<game::component::celestial_body>().connect<&astronomy::on_celestial_body_modified>(this);
registry.on_replace<game::component::celestial_body>().connect<&astronomy::on_celestial_body_modified>(this);
registry.on_destroy<game::component::celestial_body>().connect<&astronomy::on_celestial_body_destroyed>(this);
registry.on_construct<game::component::orbit>().connect<&astronomy::on_orbit_modified>(this);
registry.on_replace<game::component::orbit>().connect<&astronomy::on_orbit_modified>(this);
registry.on_destroy<game::component::orbit>().connect<&astronomy::on_orbit_destroyed>(this);
registry.on_construct<game::component::atmosphere>().connect<&astronomy::on_atmosphere_modified>(this);
registry.on_replace<game::component::atmosphere>().connect<&astronomy::on_atmosphere_modified>(this);
registry.on_destroy<game::component::atmosphere>().connect<&astronomy::on_atmosphere_destroyed>(this);
}
astronomy::~astronomy()
{
registry.on_construct<entity::component::observer>().disconnect<&astronomy::on_observer_modified>(this);
registry.on_replace<entity::component::observer>().disconnect<&astronomy::on_observer_modified>(this);
registry.on_destroy<entity::component::observer>().disconnect<&astronomy::on_observer_destroyed>(this);
registry.on_construct<entity::component::celestial_body>().disconnect<&astronomy::on_celestial_body_modified>(this);
registry.on_replace<entity::component::celestial_body>().disconnect<&astronomy::on_celestial_body_modified>(this);
registry.on_destroy<entity::component::celestial_body>().disconnect<&astronomy::on_celestial_body_destroyed>(this);
registry.on_construct<entity::component::orbit>().disconnect<&astronomy::on_orbit_modified>(this);
registry.on_replace<entity::component::orbit>().disconnect<&astronomy::on_orbit_modified>(this);
registry.on_destroy<entity::component::orbit>().disconnect<&astronomy::on_orbit_destroyed>(this);
registry.on_construct<entity::component::atmosphere>().disconnect<&astronomy::on_atmosphere_modified>(this);
registry.on_replace<entity::component::atmosphere>().disconnect<&astronomy::on_atmosphere_modified>(this);
registry.on_destroy<entity::component::atmosphere>().disconnect<&astronomy::on_atmosphere_destroyed>(this);
registry.on_construct<game::component::observer>().disconnect<&astronomy::on_observer_modified>(this);
registry.on_replace<game::component::observer>().disconnect<&astronomy::on_observer_modified>(this);
registry.on_destroy<game::component::observer>().disconnect<&astronomy::on_observer_destroyed>(this);
registry.on_construct<game::component::celestial_body>().disconnect<&astronomy::on_celestial_body_modified>(this);
registry.on_replace<game::component::celestial_body>().disconnect<&astronomy::on_celestial_body_modified>(this);
registry.on_destroy<game::component::celestial_body>().disconnect<&astronomy::on_celestial_body_destroyed>(this);
registry.on_construct<game::component::orbit>().disconnect<&astronomy::on_orbit_modified>(this);
registry.on_replace<game::component::orbit>().disconnect<&astronomy::on_orbit_modified>(this);
registry.on_destroy<game::component::orbit>().disconnect<&astronomy::on_orbit_destroyed>(this);
registry.on_construct<game::component::atmosphere>().disconnect<&astronomy::on_atmosphere_modified>(this);
registry.on_replace<game::component::atmosphere>().disconnect<&astronomy::on_atmosphere_modified>(this);
registry.on_destroy<game::component::atmosphere>().disconnect<&astronomy::on_atmosphere_destroyed>(this);
}
void astronomy::update(double t, double dt)
@ -427,7 +427,7 @@ void astronomy::set_sky_pass(::render::sky_pass* pass)
}
}
void astronomy::on_observer_modified(entity::registry& registry, entity::id entity_id, entity::component::observer& component)
void astronomy::on_observer_modified(entity::registry& registry, entity::id entity_id, game::component::observer& component)
{
if (entity_id == observer_eid)
observer_modified();
@ -439,7 +439,7 @@ void astronomy::on_observer_destroyed(entity::registry& registry, entity::id ent
observer_modified();
}
void astronomy::on_celestial_body_modified(entity::registry& registry, entity::id entity_id, entity::component::celestial_body& component)
void astronomy::on_celestial_body_modified(entity::registry& registry, entity::id entity_id, game::component::celestial_body& component)
{
if (entity_id == reference_body_eid)
reference_body_modified();
@ -451,7 +451,7 @@ void astronomy::on_celestial_body_destroyed(entity::registry& registry, entity::
reference_body_modified();
}
void astronomy::on_orbit_modified(entity::registry& registry, entity::id entity_id, entity::component::orbit& component)
void astronomy::on_orbit_modified(entity::registry& registry, entity::id entity_id, game::component::orbit& component)
{
if (entity_id == reference_body_eid)
reference_orbit_modified();
@ -463,7 +463,7 @@ void astronomy::on_orbit_destroyed(entity::registry& registry, entity::id entity
reference_orbit_modified();
}
void astronomy::on_atmosphere_modified(entity::registry& registry, entity::id entity_id, entity::component::atmosphere& component)
void astronomy::on_atmosphere_modified(entity::registry& registry, entity::id entity_id, game::component::atmosphere& component)
{
if (entity_id == reference_body_eid)
reference_atmosphere_modified();
@ -542,7 +542,7 @@ void astronomy::reference_atmosphere_modified()
}
void astronomy::update_bcbf_to_eus(const entity::component::observer& observer, const entity::component::celestial_body& body)
void astronomy::update_bcbf_to_eus(const game::component::observer& observer, const game::component::celestial_body& body)
{
// Construct BCBF to EUS transformation
bcbf_to_eus = physics::orbit::frame::bcbf::to_enu
@ -553,7 +553,7 @@ void astronomy::update_bcbf_to_eus(const entity::component::observer& observer,
) * enu_to_eus;
}
void astronomy::update_icrf_to_eus(const entity::component::celestial_body& body, const entity::component::orbit& orbit)
void astronomy::update_icrf_to_eus(const game::component::celestial_body& body, const game::component::orbit& orbit)
{
// Evaluate reference body orientation polynomials
const double body_pole_ra = math::polynomial::horner(body.pole_ra.begin(), body.pole_ra.end(), time_centuries);
@ -587,7 +587,7 @@ void astronomy::update_icrf_to_eus(const entity::component::celestial_body& body
}
}
double3 astronomy::integrate_transmittance(const entity::component::observer& observer, const entity::component::celestial_body& body, const entity::component::atmosphere& atmosphere, geom::ray<double> ray) const
double3 astronomy::integrate_transmittance(const game::component::observer& observer, const game::component::celestial_body& body, const game::component::atmosphere& atmosphere, geom::ray<double> ray) const
{
double3 transmittance = {1, 1, 1};
@ -625,4 +625,4 @@ double3 astronomy::integrate_transmittance(const entity::component::observer& ob
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/astronomy.hpp → src/game/system/astronomy.hpp View File

@ -17,23 +17,23 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_ASTRONOMY_HPP
#define ANTKEEPER_ENTITY_SYSTEM_ASTRONOMY_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_ASTRONOMY_HPP
#define ANTKEEPER_GAME_SYSTEM_ASTRONOMY_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
#include "entity/id.hpp"
#include "scene/directional-light.hpp"
#include "scene/ambient-light.hpp"
#include "utility/fundamental-types.hpp"
#include "math/se3.hpp"
#include "render/passes/sky-pass.hpp"
#include "entity/components/observer.hpp"
#include "entity/components/atmosphere.hpp"
#include "entity/components/celestial-body.hpp"
#include "entity/components/orbit.hpp"
#include "game/component/observer.hpp"
#include "game/component/atmosphere.hpp"
#include "game/component/celestial-body.hpp"
#include "game/component/orbit.hpp"
#include "geom/ray.hpp"
namespace entity {
namespace game {
namespace system {
/**
@ -91,13 +91,13 @@ public:
void set_sky_pass(::render::sky_pass* pass);
private:
void on_observer_modified(entity::registry& registry, entity::id entity_id, entity::component::observer& component);
void on_observer_modified(entity::registry& registry, entity::id entity_id, game::component::observer& component);
void on_observer_destroyed(entity::registry& registry, entity::id entity_id);
void on_celestial_body_modified(entity::registry& registry, entity::id entity_id, entity::component::celestial_body& component);
void on_celestial_body_modified(entity::registry& registry, entity::id entity_id, game::component::celestial_body& component);
void on_celestial_body_destroyed(entity::registry& registry, entity::id entity_id);
void on_orbit_modified(entity::registry& registry, entity::id entity_id, entity::component::orbit& component);
void on_orbit_modified(entity::registry& registry, entity::id entity_id, game::component::orbit& component);
void on_orbit_destroyed(entity::registry& registry, entity::id entity_id);
void on_atmosphere_modified(entity::registry& registry, entity::id entity_id, entity::component::atmosphere& component);
void on_atmosphere_modified(entity::registry& registry, entity::id entity_id, game::component::atmosphere& component);
void on_atmosphere_destroyed(entity::registry& registry, entity::id entity_id);
/// Called each time the observer is modified.
@ -113,10 +113,10 @@ private:
void reference_atmosphere_modified();
/// Updates the BCBF to EUS transformation.
void update_bcbf_to_eus(const entity::component::observer& observer, const entity::component::celestial_body& body);
void update_bcbf_to_eus(const game::component::observer& observer, const game::component::celestial_body& body);
/// Updates the ICRF to EUS transformation.
void update_icrf_to_eus(const entity::component::celestial_body& body, const entity::component::orbit& orbit);
void update_icrf_to_eus(const game::component::celestial_body& body, const game::component::orbit& orbit);
/**
* Integrates a transmittance factor due to atmospheric extinction along a ray.
@ -126,7 +126,7 @@ private:
*
* @return Spectral transmittance factor.
*/
double3 integrate_transmittance(const entity::component::observer& observer, const entity::component::celestial_body& body, const entity::component::atmosphere& atmosphere, geom::ray<double> ray) const;
double3 integrate_transmittance(const game::component::observer& observer, const game::component::celestial_body& body, const game::component::atmosphere& atmosphere, geom::ray<double> ray) const;
/// Time since epoch, in days.
double time_days;
@ -165,6 +165,6 @@ private:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_ASTRONOMY_HPP
#endif // ANTKEEPER_GAME_SYSTEM_ASTRONOMY_HPP

src/entity/systems/atmosphere.cpp → src/game/system/atmosphere.cpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#include "entity/systems/atmosphere.hpp"
#include "game/system/atmosphere.hpp"
#include "physics/gas/atmosphere.hpp"
#include "physics/gas/ozone.hpp"
#include "physics/number-density.hpp"
namespace entity {
namespace game {
namespace system {
atmosphere::atmosphere(entity::registry& registry):
@ -32,9 +32,9 @@ atmosphere::atmosphere(entity::registry& registry):
atmosphere_component(nullptr),
sky_pass(nullptr)
{
registry.on_construct<entity::component::atmosphere>().connect<&atmosphere::on_atmosphere_construct>(this);
registry.on_replace<entity::component::atmosphere>().connect<&atmosphere::on_atmosphere_replace>(this);
registry.on_destroy<entity::component::atmosphere>().connect<&atmosphere::on_atmosphere_destroy>(this);
registry.on_construct<game::component::atmosphere>().connect<&atmosphere::on_atmosphere_construct>(this);
registry.on_replace<game::component::atmosphere>().connect<&atmosphere::on_atmosphere_replace>(this);
registry.on_destroy<game::component::atmosphere>().connect<&atmosphere::on_atmosphere_destroy>(this);
}
void atmosphere::update(double t, double dt)
@ -67,7 +67,7 @@ void atmosphere::atmosphere_modified()
return;
// Get atmosphere component of the entity
entity::component::atmosphere& component = *atmosphere_component;
game::component::atmosphere& component = *atmosphere_component;
// Calculate Rayleigh scattering coefficients
const double rayleigh_density = physics::number_density(component.rayleigh_concentration);
@ -103,7 +103,7 @@ void atmosphere::update_sky_pass()
if (!sky_pass || !atmosphere_component)
return;
const entity::component::atmosphere& component = *atmosphere_component;
const game::component::atmosphere& component = *atmosphere_component;
sky_pass->set_atmosphere_upper_limit(static_cast<float>(component.upper_limit));
sky_pass->set_rayleigh_parameters(static_cast<float>(component.rayleigh_scale_height), math::type_cast<float>(component.rayleigh_scattering));
@ -112,13 +112,13 @@ void atmosphere::update_sky_pass()
sky_pass->set_airglow_illuminance(math::type_cast<float>(component.airglow_illuminance));
}
void atmosphere::on_atmosphere_construct(entity::registry& registry, entity::id entity_id, entity::component::atmosphere& component)
void atmosphere::on_atmosphere_construct(entity::registry& registry, entity::id entity_id, game::component::atmosphere& component)
{
atmosphere_component = &component;
atmosphere_modified();
}
void atmosphere::on_atmosphere_replace(entity::registry& registry, entity::id entity_id, entity::component::atmosphere& component)
void atmosphere::on_atmosphere_replace(entity::registry& registry, entity::id entity_id, game::component::atmosphere& component)
{
atmosphere_component = &component;
atmosphere_modified();
@ -130,4 +130,4 @@ void atmosphere::on_atmosphere_destroy(entity::registry& registry, entity::id en
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/atmosphere.hpp → src/game/system/atmosphere.hpp View File

@ -17,16 +17,16 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_ATMOSPHERE_HPP
#define ANTKEEPER_ENTITY_SYSTEM_ATMOSPHERE_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_ATMOSPHERE_HPP
#define ANTKEEPER_GAME_SYSTEM_ATMOSPHERE_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
#include "entity/id.hpp"
#include "utility/fundamental-types.hpp"
#include "entity/components/atmosphere.hpp"
#include "game/component/atmosphere.hpp"
#include "render/passes/sky-pass.hpp"
namespace entity {
namespace game {
namespace system {
/**
@ -53,17 +53,17 @@ private:
void atmosphere_modified();
void update_sky_pass();
void on_atmosphere_construct(entity::registry& registry, entity::id entity_id, entity::component::atmosphere& component);
void on_atmosphere_replace(entity::registry& registry, entity::id entity_id, entity::component::atmosphere& component);
void on_atmosphere_construct(entity::registry& registry, entity::id entity_id, game::component::atmosphere& component);
void on_atmosphere_replace(entity::registry& registry, entity::id entity_id, game::component::atmosphere& component);
void on_atmosphere_destroy(entity::registry& registry, entity::id entity_id);
double3 rgb_wavelengths;
double3 rgb_ozone_cross_sections;
entity::component::atmosphere* atmosphere_component;
game::component::atmosphere* atmosphere_component;
::render::sky_pass* sky_pass;
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_ATMOSPHERE_HPP
#endif // ANTKEEPER_GAME_SYSTEM_ATMOSPHERE_HPP

src/entity/systems/behavior.cpp → src/game/system/behavior.cpp View File

@ -17,11 +17,11 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#include "entity/systems/behavior.hpp"
#include "entity/components/behavior.hpp"
#include "game/system/behavior.hpp"
#include "game/component/behavior.hpp"
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace system {
behavior::behavior(entity::registry& registry):
@ -30,7 +30,7 @@ behavior::behavior(entity::registry& registry):
void behavior::update(double t, double dt)
{
ebt::context context;
entity::ebt::context context;
context.registry = &registry;
registry.view<component::behavior>().each(
@ -45,4 +45,4 @@ void behavior::update(double t, double dt)
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/behavior.hpp → src/game/system/behavior.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_BEHAVIOR_HPP
#define ANTKEEPER_ENTITY_SYSTEM_BEHAVIOR_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_BEHAVIOR_HPP
#define ANTKEEPER_GAME_SYSTEM_BEHAVIOR_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
namespace entity {
namespace game {
namespace system {
class behavior:
@ -34,7 +34,7 @@ public:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_BEHAVIOR_HPP
#endif // ANTKEEPER_GAME_SYSTEM_BEHAVIOR_HPP

src/entity/systems/blackbody.cpp → src/game/system/blackbody.cpp View File

@ -17,13 +17,13 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#include "entity/systems/blackbody.hpp"
#include "game/system/blackbody.hpp"
#include "color/color.hpp"
#include "physics/light/blackbody.hpp"
#include "physics/light/photometry.hpp"
#include "math/quadrature.hpp"
namespace entity {
namespace game {
namespace system {
blackbody::blackbody(entity::registry& registry):
@ -34,11 +34,11 @@ blackbody::blackbody(entity::registry& registry):
visible_wavelengths_nm.resize(780 - 280);
std::iota(visible_wavelengths_nm.begin(), visible_wavelengths_nm.end(), 280);
registry.on_construct<entity::component::blackbody>().connect<&blackbody::on_blackbody_construct>(this);
registry.on_replace<entity::component::blackbody>().connect<&blackbody::on_blackbody_replace>(this);
registry.on_construct<game::component::blackbody>().connect<&blackbody::on_blackbody_construct>(this);
registry.on_replace<game::component::blackbody>().connect<&blackbody::on_blackbody_replace>(this);
registry.on_construct<entity::component::celestial_body>().connect<&blackbody::on_celestial_body_construct>(this);
registry.on_replace<entity::component::celestial_body>().connect<&blackbody::on_celestial_body_replace>(this);
registry.on_construct<game::component::celestial_body>().connect<&blackbody::on_celestial_body_construct>(this);
registry.on_replace<game::component::celestial_body>().connect<&blackbody::on_celestial_body_replace>(this);
}
void blackbody::update(double t, double dt)
@ -92,25 +92,25 @@ void blackbody::update_luminance(entity::id entity_id)
blackbody.luminance = math::quadrature::simpson(rgb_luminance, visible_wavelengths_nm.begin(), visible_wavelengths_nm.end());
}
void blackbody::on_blackbody_construct(entity::registry& registry, entity::id entity_id, entity::component::blackbody& blackbody)
void blackbody::on_blackbody_construct(entity::registry& registry, entity::id entity_id, game::component::blackbody& blackbody)
{
update_luminance(entity_id);
}
void blackbody::on_blackbody_replace(entity::registry& registry, entity::id entity_id, entity::component::blackbody& blackbody)
void blackbody::on_blackbody_replace(entity::registry& registry, entity::id entity_id, game::component::blackbody& blackbody)
{
update_luminance(entity_id);
}
void blackbody::on_celestial_body_construct(entity::registry& registry, entity::id entity_id, entity::component::celestial_body& celestial_body)
void blackbody::on_celestial_body_construct(entity::registry& registry, entity::id entity_id, game::component::celestial_body& celestial_body)
{
update_luminance(entity_id);
}
void blackbody::on_celestial_body_replace(entity::registry& registry, entity::id entity_id, entity::component::celestial_body& celestial_body)
void blackbody::on_celestial_body_replace(entity::registry& registry, entity::id entity_id, game::component::celestial_body& celestial_body)
{
update_luminance(entity_id);
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/blackbody.hpp → src/game/system/blackbody.hpp View File

@ -17,17 +17,17 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_BLACKBODY_HPP
#define ANTKEEPER_ENTITY_SYSTEM_BLACKBODY_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_BLACKBODY_HPP
#define ANTKEEPER_GAME_SYSTEM_BLACKBODY_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
#include "entity/id.hpp"
#include "utility/fundamental-types.hpp"
#include "entity/components/blackbody.hpp"
#include "entity/components/celestial-body.hpp"
#include "game/component/blackbody.hpp"
#include "game/component/celestial-body.hpp"
#include <vector>
namespace entity {
namespace game {
namespace system {
/**
@ -51,17 +51,17 @@ public:
private:
void update_luminance(entity::id entity_id);
void on_blackbody_construct(entity::registry& registry, entity::id entity_id, entity::component::blackbody& blackbody);
void on_blackbody_replace(entity::registry& registry, entity::id entity_id, entity::component::blackbody& blackbody);
void on_blackbody_construct(entity::registry& registry, entity::id entity_id, game::component::blackbody& blackbody);
void on_blackbody_replace(entity::registry& registry, entity::id entity_id, game::component::blackbody& blackbody);
void on_celestial_body_construct(entity::registry& registry, entity::id entity_id, entity::component::celestial_body& celestial_body);
void on_celestial_body_replace(entity::registry& registry, entity::id entity_id, entity::component::celestial_body& celestial_body);
void on_celestial_body_construct(entity::registry& registry, entity::id entity_id, game::component::celestial_body& celestial_body);
void on_celestial_body_replace(entity::registry& registry, entity::id entity_id, game::component::celestial_body& celestial_body);
math::vector2<double> illuminant;
std::vector<double> visible_wavelengths_nm;
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_BLACKBODY_HPP
#endif // ANTKEEPER_GAME_SYSTEM_BLACKBODY_HPP

src/entity/systems/camera.cpp → src/game/system/camera.cpp View File

@ -19,7 +19,7 @@
#include "camera.hpp"
namespace entity {
namespace game {
namespace system {
camera::camera(entity::registry& registry):
@ -43,4 +43,4 @@ void camera::handle_event(const window_resized_event& event)
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/camera.hpp → src/game/system/camera.hpp View File

@ -17,16 +17,16 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_CAMERA_HPP
#define ANTKEEPER_ENTITY_SYSTEM_CAMERA_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_CAMERA_HPP
#define ANTKEEPER_GAME_SYSTEM_CAMERA_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
#include "event/event-handler.hpp"
#include "event/input-events.hpp"
#include "event/window-events.hpp"
#include "utility/fundamental-types.hpp"
namespace entity {
namespace game {
namespace system {
class camera:
@ -46,7 +46,7 @@ private:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_CAMERA_HPP
#endif // ANTKEEPER_GAME_SYSTEM_CAMERA_HPP

src/entity/systems/collision.cpp → src/game/system/collision.cpp View File

@ -18,9 +18,9 @@
*/
#include "collision.hpp"
#include "entity/components/transform.hpp"
#include "game/component/transform.hpp"
namespace entity {
namespace game {
namespace system {
collision::collision(entity::registry& registry):
@ -44,4 +44,4 @@ void collision::on_collision_destroy(entity::registry& registry, entity::id enti
{}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/collision.hpp → src/game/system/collision.hpp View File

@ -17,14 +17,14 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_COLLISION_HPP
#define ANTKEEPER_ENTITY_SYSTEM_COLLISION_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_COLLISION_HPP
#define ANTKEEPER_GAME_SYSTEM_COLLISION_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
#include "entity/id.hpp"
#include "entity/components/collision.hpp"
#include "game/component/collision.hpp"
namespace entity {
namespace game {
namespace system {
/**
@ -37,13 +37,13 @@ public:
virtual void update(double t, double dt);
private:
void on_collision_construct(entity::registry& registry, entity::id entity_id, entity::component::collision& collision);
void on_collision_replace(entity::registry& registry, entity::id entity_id, entity::component::collision& collision);
void on_collision_construct(entity::registry& registry, entity::id entity_id, game::component::collision& collision);
void on_collision_replace(entity::registry& registry, entity::id entity_id, game::component::collision& collision);
void on_collision_destroy(entity::registry& registry, entity::id entity_id);
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_COLLISION_HPP
#endif // ANTKEEPER_GAME_SYSTEM_COLLISION_HPP

src/entity/systems/constraint.cpp → src/game/system/constraint.cpp View File

@ -18,11 +18,11 @@
*/
#include "constraint.hpp"
#include "entity/components/constraint-stack.hpp"
#include "entity/components/constraints/constraints.hpp"
#include "entity/components/transform.hpp"
#include "game/component/constraint-stack.hpp"
#include "game/component/constraints/constraints.hpp"
#include "game/component/transform.hpp"
namespace entity {
namespace game {
namespace system {
constraint::constraint(entity::registry& registry):
@ -204,4 +204,4 @@ void constraint::handle_spring_to_constraint(component::transform& transform, en
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/constraint.hpp → src/game/system/constraint.hpp View File

@ -17,22 +17,22 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_CONSTRAINT_HPP
#define ANTKEEPER_ENTITY_SYSTEM_CONSTRAINT_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_CONSTRAINT_HPP
#define ANTKEEPER_GAME_SYSTEM_CONSTRAINT_HPP
#include "entity/systems/updatable.hpp"
#include "entity/components/transform.hpp"
#include "game/system/updatable.hpp"
#include "game/component/transform.hpp"
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace system {
/**
* Applies constraint stacks to transform components.
*
* @see entity::component::constraint_stack
* @see entity::component::constraint_stack_node
* @see entity::component::constraint
* @see game::component::constraint_stack
* @see game::component::constraint_stack_node
* @see game::component::constraint
*/
class constraint:
public updatable
@ -54,6 +54,6 @@ private:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_CONSTRAINT_HPP
#endif // ANTKEEPER_GAME_SYSTEM_CONSTRAINT_HPP

src/entity/systems/locomotion.cpp → src/game/system/locomotion.cpp View File

@ -18,12 +18,12 @@
*/
#include "locomotion.hpp"
#include "entity/components/collision.hpp"
#include "entity/components/locomotion.hpp"
#include "entity/components/transform.hpp"
#include "game/component/collision.hpp"
#include "game/component/locomotion.hpp"
#include "game/component/transform.hpp"
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace system {
locomotion::locomotion(entity::registry& registry):
@ -39,4 +39,4 @@ void locomotion::update(double t, double dt)
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/locomotion.hpp → src/game/system/locomotion.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_LOCOMOTION_HPP
#define ANTKEEPER_ENTITY_SYSTEM_LOCOMOTION_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_LOCOMOTION_HPP
#define ANTKEEPER_GAME_SYSTEM_LOCOMOTION_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
namespace entity {
namespace game {
namespace system {
class locomotion:
@ -34,6 +34,6 @@ public:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_LOCOMOTION_HPP
#endif // ANTKEEPER_GAME_SYSTEM_LOCOMOTION_HPP

src/entity/systems/morphogenesis.cpp → src/game/system/morphogenesis.cpp View File

@ -17,10 +17,10 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#include "entity/systems/morphogenesis.hpp"
#include "game/system/morphogenesis.hpp"
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace system {
morphogenesis::morphogenesis(entity::registry& registry):
@ -31,4 +31,4 @@ void morphogenesis::update(double t, double dt)
{}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/morphogenesis.hpp → src/game/system/morphogenesis.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_MORPHOGENESIS_HPP
#define ANTKEEPER_ENTITY_SYSTEM_MORPHOGENESIS_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_MORPHOGENESIS_HPP
#define ANTKEEPER_GAME_SYSTEM_MORPHOGENESIS_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
namespace entity {
namespace game {
namespace system {
/**
@ -55,6 +55,6 @@ private:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_MORPHOGENESIS_HPP
#endif // ANTKEEPER_GAME_SYSTEM_MORPHOGENESIS_HPP

src/entity/systems/orbit.cpp → src/game/system/orbit.cpp View File

@ -17,11 +17,11 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#include "entity/systems/orbit.hpp"
#include "game/system/orbit.hpp"
#include "physics/orbit/orbit.hpp"
#include <iostream>
namespace entity {
namespace game {
namespace system {
orbit::orbit(entity::registry& registry):
@ -30,14 +30,14 @@ orbit::orbit(entity::registry& registry):
time(0.0),
time_scale(1.0)
{
registry.on_construct<entity::component::orbit>().connect<&orbit::on_orbit_construct>(this);
registry.on_replace<entity::component::orbit>().connect<&orbit::on_orbit_replace>(this);
registry.on_construct<game::component::orbit>().connect<&orbit::on_orbit_construct>(this);
registry.on_replace<game::component::orbit>().connect<&orbit::on_orbit_replace>(this);
}
orbit::~orbit()
{
registry.on_construct<entity::component::orbit>().disconnect<&orbit::on_orbit_construct>(this);
registry.on_replace<entity::component::orbit>().disconnect<&orbit::on_orbit_replace>(this);
registry.on_construct<game::component::orbit>().disconnect<&orbit::on_orbit_construct>(this);
registry.on_replace<game::component::orbit>().disconnect<&orbit::on_orbit_replace>(this);
}
void orbit::update(double t, double dt)
@ -84,15 +84,15 @@ void orbit::set_time_scale(double scale)
time_scale = scale;
}
void orbit::on_orbit_construct(entity::registry& registry, entity::id entity_id, entity::component::orbit& component)
void orbit::on_orbit_construct(entity::registry& registry, entity::id entity_id, game::component::orbit& component)
{
ephemeris_indices.insert(component.ephemeris_index);
}
void orbit::on_orbit_replace(entity::registry& registry, entity::id entity_id, entity::component::orbit& component)
void orbit::on_orbit_replace(entity::registry& registry, entity::id entity_id, game::component::orbit& component)
{
ephemeris_indices.insert(component.ephemeris_index);
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/orbit.hpp → src/game/system/orbit.hpp View File

@ -17,17 +17,17 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_SOLAR_HPP
#define ANTKEEPER_ENTITY_SYSTEM_SOLAR_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_SOLAR_HPP
#define ANTKEEPER_GAME_SYSTEM_SOLAR_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
#include "utility/fundamental-types.hpp"
#include "entity/id.hpp"
#include "entity/components/orbit.hpp"
#include "game/component/orbit.hpp"
#include "physics/orbit/ephemeris.hpp"
#include <unordered_set>
namespace entity {
namespace game {
namespace system {
/**
@ -70,8 +70,8 @@ public:
void set_ephemeris(const physics::orbit::ephemeris<double>* ephemeris);
private:
void on_orbit_construct(entity::registry& registry, entity::id entity_id, entity::component::orbit& component);
void on_orbit_replace(entity::registry& registry, entity::id entity_id, entity::component::orbit& component);
void on_orbit_construct(entity::registry& registry, entity::id entity_id, game::component::orbit& component);
void on_orbit_replace(entity::registry& registry, entity::id entity_id, game::component::orbit& component);
const physics::orbit::ephemeris<double>* ephemeris;
double time;
@ -81,6 +81,6 @@ private:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_SOLAR_HPP
#endif // ANTKEEPER_GAME_SYSTEM_SOLAR_HPP

src/entity/systems/painting.cpp → src/game/system/painting.cpp View File

@ -18,9 +18,9 @@
*/
#include "painting.hpp"
#include "entity/components/transform.hpp"
#include "entity/components/brush.hpp"
#include "entity/components/tool.hpp"
#include "game/component/transform.hpp"
#include "game/component/brush.hpp"
#include "game/component/tool.hpp"
#include "event/event-dispatcher.hpp"
#include "resources/resource-manager.hpp"
#include "math/math.hpp"
@ -28,14 +28,14 @@
#include "render/model.hpp"
#include "utility/fundamental-types.hpp"
#include "entity/commands.hpp"
#include "entity/components/collision.hpp"
#include "entity/components/transform.hpp"
#include "game/component/collision.hpp"
#include "game/component/transform.hpp"
#include "gl/vertex-buffer.hpp"
#include "render/vertex-attribute.hpp"
#include "geom/mesh-functions.hpp"
#include <limits>
namespace entity {
namespace game {
namespace system {
painting::painting(entity::registry& registry, ::event_dispatcher* event_dispatcher, ::resource_manager* resource_manager):
@ -370,4 +370,4 @@ std::optional> painting::cast_ray(const float3& posit
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/painting.hpp → src/game/system/painting.hpp View File

@ -17,10 +17,10 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_PAINTING_HPP
#define ANTKEEPER_ENTITY_SYSTEM_PAINTING_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_PAINTING_HPP
#define ANTKEEPER_GAME_SYSTEM_PAINTING_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
#include "entity/id.hpp"
#include "event/event-handler.hpp"
#include "game/events/tool-events.hpp"
@ -35,7 +35,7 @@
class event_dispatcher;
class resource_manager;
namespace entity {
namespace game {
namespace system {
class painting: public updatable,
@ -89,6 +89,6 @@ private:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_PAINTING_HPP
#endif // ANTKEEPER_GAME_SYSTEM_PAINTING_HPP

src/entity/systems/proteome.cpp → src/game/system/proteome.cpp View File

@ -17,33 +17,33 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#include "entity/systems/proteome.hpp"
#include "entity/components/proteome.hpp"
#include "game/system/proteome.hpp"
#include "game/component/proteome.hpp"
#include "genetics/sequence.hpp"
#include "genetics/standard-code.hpp"
namespace entity {
namespace game {
namespace system {
proteome::proteome(entity::registry& registry):
updatable(registry)
{
registry.on_construct<entity::component::genome>().connect<&proteome::on_genome_construct>(this);
registry.on_replace<entity::component::genome>().connect<&proteome::on_genome_replace>(this);
registry.on_construct<game::component::genome>().connect<&proteome::on_genome_construct>(this);
registry.on_replace<game::component::genome>().connect<&proteome::on_genome_replace>(this);
}
void proteome::update(double t, double dt)
{}
void proteome::on_genome_construct(entity::registry& registry, entity::id entity_id, entity::component::genome& genome)
void proteome::on_genome_construct(entity::registry& registry, entity::id entity_id, game::component::genome& genome)
{
on_genome_replace(registry, entity_id, genome);
}
void proteome::on_genome_replace(entity::registry& registry, entity::id entity_id, entity::component::genome& genome)
void proteome::on_genome_replace(entity::registry& registry, entity::id entity_id, game::component::genome& genome)
{
// Allocate a proteome component
entity::component::proteome proteome_component;
game::component::proteome proteome_component;
// For each chromosome in the genome
for (const std::string& chromosome: genome.chromosomes)
@ -67,8 +67,8 @@ void proteome::on_genome_replace(entity::registry& registry, entity::id entity_i
}
// Assign or replace the entity's proteome component
registry.assign_or_replace<entity::component::proteome>(entity_id, proteome_component);
registry.assign_or_replace<game::component::proteome>(entity_id, proteome_component);
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/proteome.hpp → src/game/system/proteome.hpp View File

@ -17,14 +17,14 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_PROTEOME_HPP
#define ANTKEEPER_ENTITY_SYSTEM_PROTEOME_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_PROTEOME_HPP
#define ANTKEEPER_GAME_SYSTEM_PROTEOME_HPP
#include "entity/systems/updatable.hpp"
#include "entity/components/genome.hpp"
#include "game/system/updatable.hpp"
#include "game/component/genome.hpp"
#include "entity/id.hpp"
namespace entity {
namespace game {
namespace system {
/**
@ -45,11 +45,11 @@ public:
virtual void update(double t, double dt);
private:
void on_genome_construct(entity::registry& registry, entity::id entity_id, entity::component::genome& genome);
void on_genome_replace(entity::registry& registry, entity::id entity_id, entity::component::genome& genome);
void on_genome_construct(entity::registry& registry, entity::id entity_id, game::component::genome& genome);
void on_genome_replace(entity::registry& registry, entity::id entity_id, game::component::genome& genome);
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_PROTEOME_HPP
#endif // ANTKEEPER_GAME_SYSTEM_PROTEOME_HPP

src/entity/systems/render.cpp → src/game/system/render.cpp View File

@ -18,15 +18,15 @@
*/
#include "render.hpp"
#include "entity/components/transform.hpp"
#include "entity/components/camera.hpp"
#include "game/component/transform.hpp"
#include "game/component/camera.hpp"
#include "scene/point-light.hpp"
#include "scene/directional-light.hpp"
#include "scene/ambient-light.hpp"
#include "scene/spot-light.hpp"
#include <iostream>
namespace entity {
namespace game {
namespace system {
render::render(entity::registry& registry):
@ -164,7 +164,7 @@ void render::update_model_and_materials(entity::id entity_id, component::model&
}
}
void render::update_light(entity::id entity_id, entity::component::light& component)
void render::update_light(entity::id entity_id, game::component::light& component)
{
if (auto light_it = lights.find(entity_id); light_it != lights.end())
{
@ -279,4 +279,4 @@ void render::on_light_destroy(entity::registry& registry, entity::id entity_id)
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/render.hpp → src/game/system/render.hpp View File

@ -17,21 +17,21 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_RENDER_HPP
#define ANTKEEPER_ENTITY_SYSTEM_RENDER_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_RENDER_HPP
#define ANTKEEPER_GAME_SYSTEM_RENDER_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
#include "scene/collection.hpp"
#include "scene/model-instance.hpp"
#include "scene/light.hpp"
#include "entity/components/model.hpp"
#include "entity/components/light.hpp"
#include "game/component/model.hpp"
#include "game/component/light.hpp"
#include "entity/id.hpp"
#include "render/renderer.hpp"
#include <unordered_map>
#include <vector>
namespace entity {
namespace game {
namespace system {
class render: public updatable
@ -52,15 +52,15 @@ public:
scene::light* get_light(entity::id entity_id);
private:
void update_model_and_materials(entity::id entity_id, entity::component::model& model);
void update_light(entity::id entity_id, entity::component::light& component);
void update_model_and_materials(entity::id entity_id, game::component::model& model);
void update_light(entity::id entity_id, game::component::light& component);
void on_model_construct(entity::registry& registry, entity::id entity_id, entity::component::model& model);
void on_model_replace(entity::registry& registry, entity::id entity_id, entity::component::model& model);
void on_model_construct(entity::registry& registry, entity::id entity_id, game::component::model& model);
void on_model_replace(entity::registry& registry, entity::id entity_id, game::component::model& model);
void on_model_destroy(entity::registry& registry, entity::id entity_id);
void on_light_construct(entity::registry& registry, entity::id entity_id, entity::component::light& light);
void on_light_replace(entity::registry& registry, entity::id entity_id, entity::component::light& light);
void on_light_construct(entity::registry& registry, entity::id entity_id, game::component::light& light);
void on_light_replace(entity::registry& registry, entity::id entity_id, game::component::light& light);
void on_light_destroy(entity::registry& registry, entity::id entity_id);
double t;
@ -72,7 +72,7 @@ private:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_RENDER_HPP
#endif // ANTKEEPER_GAME_SYSTEM_RENDER_HPP

src/entity/systems/samara.cpp → src/game/system/samara.cpp View File

@ -18,13 +18,13 @@
*/
#include "samara.hpp"
#include "entity/components/transform.hpp"
#include "entity/components/samara.hpp"
#include "game/component/transform.hpp"
#include "game/component/samara.hpp"
#include "entity/id.hpp"
#include "math/math.hpp"
#include "utility/fundamental-types.hpp"
namespace entity {
namespace game {
namespace system {
samara::samara(entity::registry& registry):
@ -58,4 +58,4 @@ void samara::update(double t, double dt)
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/samara.hpp → src/game/system/samara.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_SAMARA_HPP
#define ANTKEEPER_ENTITY_SYSTEM_SAMARA_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_SAMARA_HPP
#define ANTKEEPER_GAME_SYSTEM_SAMARA_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
namespace entity {
namespace game {
namespace system {
class samara: public updatable
@ -33,7 +33,7 @@ public:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_SAMARA_HPP
#endif // ANTKEEPER_GAME_SYSTEM_SAMARA_HPP

src/entity/systems/snapping.cpp → src/game/system/snapping.cpp View File

@ -18,13 +18,13 @@
*/
#include "snapping.hpp"
#include "entity/components/collision.hpp"
#include "entity/components/snap.hpp"
#include "entity/components/transform.hpp"
#include "game/component/collision.hpp"
#include "game/component/snap.hpp"
#include "game/component/transform.hpp"
#include "entity/id.hpp"
#include "utility/fundamental-types.hpp"
namespace entity {
namespace game {
namespace system {
snapping::snapping(entity::registry& registry):
@ -90,4 +90,4 @@ void snapping::update(double t, double dt)
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/snapping.hpp → src/game/system/snapping.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_SNAPPING_HPP
#define ANTKEEPER_ENTITY_SYSTEM_SNAPPING_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_SNAPPING_HPP
#define ANTKEEPER_GAME_SYSTEM_SNAPPING_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
namespace entity {
namespace game {
namespace system {
class snapping:
@ -34,7 +34,7 @@ public:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_SNAPPING_HPP
#endif // ANTKEEPER_GAME_SYSTEM_SNAPPING_HPP

src/entity/systems/spatial.cpp → src/game/system/spatial.cpp View File

@ -18,10 +18,10 @@
*/
#include "spatial.hpp"
#include "entity/components/parent.hpp"
#include "entity/components/transform.hpp"
#include "game/component/parent.hpp"
#include "game/component/transform.hpp"
namespace entity {
namespace game {
namespace system {
spatial::spatial(entity::registry& registry):
@ -57,4 +57,4 @@ void spatial::update(double t, double dt)
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/spatial.hpp → src/game/system/spatial.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_SPATIAL_HPP
#define ANTKEEPER_ENTITY_SYSTEM_SPATIAL_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_SPATIAL_HPP
#define ANTKEEPER_GAME_SYSTEM_SPATIAL_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
namespace entity {
namespace game {
namespace system {
class spatial:
@ -34,6 +34,6 @@ public:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_SPATIAL_HPP
#endif // ANTKEEPER_GAME_SYSTEM_SPATIAL_HPP

src/entity/systems/steering.cpp → src/game/system/steering.cpp View File

@ -17,15 +17,15 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#include "entity/systems/steering.hpp"
#include "entity/components/steering.hpp"
#include "entity/components/transform.hpp"
#include "game/system/steering.hpp"
#include "game/component/steering.hpp"
#include "game/component/transform.hpp"
#include "entity/id.hpp"
#include "ai/steering/behavior/wander.hpp"
#include "ai/steering/behavior/seek.hpp"
#include "config.hpp"
namespace entity {
namespace game {
namespace system {
steering::steering(entity::registry& registry):
@ -90,4 +90,4 @@ void steering::update(double t, double dt)
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/steering.hpp → src/game/system/steering.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_STEERING_HPP
#define ANTKEEPER_ENTITY_SYSTEM_STEERING_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_STEERING_HPP
#define ANTKEEPER_GAME_SYSTEM_STEERING_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
namespace entity {
namespace game {
namespace system {
class steering:
@ -34,6 +34,6 @@ public:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_STEERING_HPP
#endif // ANTKEEPER_GAME_SYSTEM_STEERING_HPP

src/entity/systems/subterrain.cpp → src/game/system/subterrain.cpp View File

@ -18,8 +18,8 @@
*/
#include "subterrain.hpp"
#include "entity/components/model.hpp"
#include "entity/components/cavity.hpp"
#include "game/component/model.hpp"
#include "game/component/cavity.hpp"
#include "entity/id.hpp"
#include "render/model.hpp"
#include "render/material.hpp"
@ -35,7 +35,7 @@
#include <array>
#include <limits>
namespace entity {
namespace game {
namespace system {
/**
@ -272,7 +272,7 @@ subterrain::subterrain(entity::registry& registry, ::resource_manager* resource_
subterrain_model->set_bounds(subterrain_bounds);
// Allocate cube tree
cube_tree = new entity::system::cube_tree(subterrain_bounds, octree_depth);
cube_tree = new game::system::cube_tree(subterrain_bounds, octree_depth);
// Allocate mesh
subterrain_mesh = new geom::mesh();
@ -349,11 +349,11 @@ void subterrain::regenerate_subterrain_mesh()
//std::cout << "creating mesh... done\n";
}
void subterrain::march(entity::system::cube_tree* node)
void subterrain::march(game::system::cube_tree* node)
{
if (!node->is_leaf())
{
for (entity::system::cube_tree* child: node->children)
for (game::system::cube_tree* child: node->children)
march(child);
return;
}
@ -492,9 +492,9 @@ void subterrain::dig(const float3& position, float radius)
cube_tree->subdivide_max(region);
// Query all octree leaf nodes within the region
std::list<entity::system::cube_tree*> nodes;
std::list<game::system::cube_tree*> nodes;
cube_tree->visit_leaves(region,
[&position, radius](entity::system::cube_tree& node)
[&position, radius](game::system::cube_tree& node)
{
for (int i = 0; i < 8; ++i)
{
@ -510,4 +510,4 @@ void subterrain::dig(const float3& position, float radius)
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/subterrain.hpp → src/game/system/subterrain.hpp View File

@ -17,10 +17,10 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_SUBTERRAIN_HPP
#define ANTKEEPER_ENTITY_SYSTEM_SUBTERRAIN_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_SUBTERRAIN_HPP
#define ANTKEEPER_GAME_SYSTEM_SUBTERRAIN_HPP
#include "entity/systems/updatable.hpp"
#include "game/system/updatable.hpp"
#include "geom/mesh.hpp"
#include "geom/aabb.hpp"
#include "scene/collection.hpp"
@ -31,7 +31,7 @@
class resource_manager;
namespace entity {
namespace game {
namespace system {
struct cube_tree;
@ -128,7 +128,7 @@ private:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_SUBTERRAIN_HPP
#endif // ANTKEEPER_GAME_SYSTEM_SUBTERRAIN_HPP

src/entity/systems/terrain.cpp → src/game/system/terrain.cpp View File

@ -17,10 +17,10 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#include "entity/systems/terrain.hpp"
#include "entity/components/celestial-body.hpp"
#include "entity/components/observer.hpp"
#include "entity/components/terrain.hpp"
#include "game/system/terrain.hpp"
#include "game/component/celestial-body.hpp"
#include "game/component/observer.hpp"
#include "game/component/terrain.hpp"
#include "geom/meshes/grid.hpp"
#include "geom/mesh-functions.hpp"
#include "geom/morton.hpp"
@ -34,7 +34,7 @@
#include <functional>
#include <iostream>
namespace entity {
namespace game {
namespace system {
terrain::terrain(entity::registry& registry):
@ -568,4 +568,4 @@ double terrain::screen_space_error(double horizontal_fov, double horizontal_reso
}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/terrain.hpp → src/game/system/terrain.hpp View File

@ -17,11 +17,11 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_TERRAIN_HPP
#define ANTKEEPER_ENTITY_SYSTEM_TERRAIN_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_TERRAIN_HPP
#define ANTKEEPER_GAME_SYSTEM_TERRAIN_HPP
#include "entity/systems/updatable.hpp"
#include "entity/components/terrain.hpp"
#include "game/system/updatable.hpp"
#include "game/component/terrain.hpp"
#include "entity/id.hpp"
#include "math/quaternion-type.hpp"
#include "geom/quadtree.hpp"
@ -33,7 +33,7 @@
#include "scene/collection.hpp"
#include <unordered_map>
namespace entity {
namespace game {
namespace system {
/**
@ -101,7 +101,7 @@ private:
static double screen_space_error(double horizontal_fov, double horizontal_resolution, double distance, double geometric_error);
void on_terrain_construct(entity::registry& registry, entity::id entity_id, entity::component::terrain& component);
void on_terrain_construct(entity::registry& registry, entity::id entity_id, game::component::terrain& component);
void on_terrain_destroy(entity::registry& registry, entity::id entity_id);
/**
@ -132,6 +132,6 @@ private:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_TERRAIN_HPP
#endif // ANTKEEPER_GAME_SYSTEM_TERRAIN_HPP

src/entity/systems/updatable.cpp → src/game/system/updatable.cpp View File

@ -19,7 +19,7 @@
#include "updatable.hpp"
namespace entity {
namespace game {
namespace system {
updatable::updatable(entity::registry& registry):
@ -27,4 +27,4 @@ updatable::updatable(entity::registry& registry):
{}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/updatable.hpp → src/game/system/updatable.hpp View File

@ -17,12 +17,12 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_UPDATABLE_HPP
#define ANTKEEPER_ENTITY_SYSTEM_UPDATABLE_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_UPDATABLE_HPP
#define ANTKEEPER_GAME_SYSTEM_UPDATABLE_HPP
#include "entity/registry.hpp"
namespace entity {
namespace game {
namespace system {
/**
@ -53,6 +53,6 @@ protected:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_UPDATABLE_HPP
#endif // ANTKEEPER_GAME_SYSTEM_UPDATABLE_HPP

src/entity/systems/vegetation.cpp → src/game/system/vegetation.cpp View File

@ -18,8 +18,8 @@
*/
#include "vegetation.hpp"
#include "entity/components/model.hpp"
#include "entity/components/transform.hpp"
#include "game/component/model.hpp"
#include "game/component/transform.hpp"
#include "scene/model-instance.hpp"
#include "scene/lod-group.hpp"
#include "scene/collection.hpp"
@ -28,7 +28,7 @@
#include "utility/fundamental-types.hpp"
#include <cmath>
namespace entity {
namespace game {
namespace system {
vegetation::vegetation(entity::registry& registry):
@ -86,4 +86,4 @@ void vegetation::on_terrain_destroy(entity::registry& registry, entity::id entit
{}
} // namespace system
} // namespace entity
} // namespace game

src/entity/systems/vegetation.hpp → src/game/system/vegetation.hpp View File

@ -17,17 +17,17 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_ENTITY_SYSTEM_VEGETATION_HPP
#define ANTKEEPER_ENTITY_SYSTEM_VEGETATION_HPP
#ifndef ANTKEEPER_GAME_SYSTEM_VEGETATION_HPP
#define ANTKEEPER_GAME_SYSTEM_VEGETATION_HPP
#include "entity/systems/updatable.hpp"
#include "entity/components/terrain.hpp"
#include "game/system/updatable.hpp"
#include "game/component/terrain.hpp"
#include "entity/id.hpp"
#include "scene/collection.hpp"
class model;
namespace entity {
namespace game {
namespace system {
/**
@ -61,7 +61,7 @@ public:
void set_scene(scene::collection* collection);
private:
void on_terrain_construct(entity::registry& registry, entity::id entity_id, entity::component::terrain& component);
void on_terrain_construct(entity::registry& registry, entity::id entity_id, game::component::terrain& component);
void on_terrain_destroy(entity::registry& registry, entity::id entity_id);
float terrain_patch_size;
@ -74,7 +74,7 @@ private:
};
} // namespace system
} // namespace entity
} // namespace game
#endif // ANTKEEPER_ENTITY_SYSTEM_VEGETATION_HPP
#endif // ANTKEEPER_GAME_SYSTEM_VEGETATION_HPP

+ 8
- 8
src/game/tools.cpp View File

@ -21,8 +21,8 @@
#include "application.hpp"
#include "animation/animator.hpp"
#include "animation/animation.hpp"
#include "entity/components/tool.hpp"
#include "entity/components/celestial-body.hpp"
#include "game/component/tool.hpp"
#include "game/component/celestial-body.hpp"
#include "utility/timestamp.hpp"
#include "render/material.hpp"
#include "game/graphics.hpp"
@ -35,7 +35,7 @@ entity::id build_camera_tool(game::context& ctx)
entity::id tool_eid = ctx.entity_registry->create();
// Create tool component
entity::component::tool tool;
game::component::tool tool;
// Setup tool activated callback
tool.activated = [&ctx]()
@ -74,7 +74,7 @@ entity::id build_camera_tool(game::context& ctx)
};
// Add tool component to camera tool entity
ctx.entity_registry->assign<entity::component::tool>(tool_eid, tool);
ctx.entity_registry->assign<game::component::tool>(tool_eid, tool);
return tool_eid;
}
@ -85,7 +85,7 @@ entity::id build_time_tool(game::context& ctx)
entity::id tool_eid = ctx.entity_registry->create();
// Create tool component
entity::component::tool tool;
game::component::tool tool;
// Setup tool active calback
tool.active = [&ctx]()
@ -94,13 +94,13 @@ entity::id build_time_tool(game::context& ctx)
//auto window = ctx.app->get_viewport_dimensions();
entity::id planet_eid = ctx.entities["planet"];
entity::component::celestial_body body = ctx.entity_registry->get<entity::component::celestial_body>(planet_eid);
game::component::celestial_body body = ctx.entity_registry->get<game::component::celestial_body>(planet_eid);
//body.axial_rotation = math::radians(360.0f) * ((float)mouse_x / (float)window_w);
ctx.entity_registry->replace<entity::component::celestial_body>(planet_eid, body);
ctx.entity_registry->replace<game::component::celestial_body>(planet_eid, body);
};
// Add tool component to time tool entity
ctx.entity_registry->assign<entity::component::tool>(tool_eid, tool);
ctx.entity_registry->assign<game::component::tool>(tool_eid, tool);
return tool_eid;
}

+ 19
- 19
src/game/world.cpp View File

@ -21,15 +21,15 @@
#include "scene/text.hpp"
#include "physics/light/vmag.hpp"
#include "color/color.hpp"
#include "entity/components/atmosphere.hpp"
#include "entity/components/blackbody.hpp"
#include "entity/components/celestial-body.hpp"
#include "entity/components/orbit.hpp"
#include "entity/components/terrain.hpp"
#include "entity/components/transform.hpp"
#include "entity/components/observer.hpp"
#include "entity/systems/astronomy.hpp"
#include "entity/systems/orbit.hpp"
#include "game/component/atmosphere.hpp"
#include "game/component/blackbody.hpp"
#include "game/component/celestial-body.hpp"
#include "game/component/orbit.hpp"
#include "game/component/terrain.hpp"
#include "game/component/transform.hpp"
#include "game/component/observer.hpp"
#include "game/system/astronomy.hpp"
#include "game/system/orbit.hpp"
#include "entity/commands.hpp"
#include "entity/archetype.hpp"
#include "geom/spherical.hpp"
@ -101,7 +101,7 @@ void create_observer(game::context& ctx)
ctx.entities["observer"] = observer_eid;
// Construct observer component
entity::component::observer observer;
game::component::observer observer;
// Set observer reference body
if (auto it = ctx.entities.find("earth"); it != ctx.entities.end())
@ -115,7 +115,7 @@ void create_observer(game::context& ctx)
observer.longitude = 0.0;
// Assign observer component to observer entity
ctx.entity_registry->assign<entity::component::observer>(observer_eid, observer);
ctx.entity_registry->assign<game::component::observer>(observer_eid, observer);
// Set astronomy system observer
ctx.astronomy_system->set_observer(observer_eid);
@ -138,7 +138,7 @@ void set_location(game::context& ctx, double elevation, double latitude, double
if (observer_eid != entt::null)
{
// Get pointer to observer component
const auto observer = ctx.entity_registry->try_get<entity::component::observer>(observer_eid);
const auto observer = ctx.entity_registry->try_get<game::component::observer>(observer_eid);
// Set observer location
if (observer)
@ -146,11 +146,11 @@ void set_location(game::context& ctx, double elevation, double latitude, double
observer->elevation = elevation;
observer->latitude = latitude;
observer->longitude = longitude;
ctx.entity_registry->replace<entity::component::observer>(observer_eid, *observer);
ctx.entity_registry->replace<game::component::observer>(observer_eid, *observer);
}
/*
ctx.entity_registry->patch<entity::component::observer>
ctx.entity_registry->patch<game::component::observer>
(
observer_eid,
[&](auto& component)
@ -191,7 +191,7 @@ void set_time(game::context& ctx, int year, int month, int day, int hour, int mi
entity::id observer_eid = it->second;
if (observer_eid != entt::null)
{
const auto observer = ctx.entity_registry->try_get<entity::component::observer>(observer_eid);
const auto observer = ctx.entity_registry->try_get<game::component::observer>(observer_eid);
if (observer)
longitude = observer->longitude;
}
@ -485,10 +485,10 @@ void create_earth(game::context& ctx)
ctx.entities["earth"] = earth_eid;
// Assign orbital parent
ctx.entity_registry->get<entity::component::orbit>(earth_eid).parent = ctx.entities["em_bary"];
ctx.entity_registry->get<game::component::orbit>(earth_eid).parent = ctx.entities["em_bary"];
// Assign earth terrain component
entity::component::terrain terrain;
game::component::terrain terrain;
terrain.elevation = [](double, double) -> double
{
//return math::random<double>(0.0, 1.0);
@ -496,7 +496,7 @@ void create_earth(game::context& ctx)
};
terrain.max_lod = 0;
terrain.patch_material = nullptr;
//ctx.entity_registry->assign<entity::component::terrain>(earth_eid, terrain);
//ctx.entity_registry->assign<game::component::terrain>(earth_eid, terrain);
}
catch (const std::exception&)
{
@ -519,7 +519,7 @@ void create_moon(game::context& ctx)
ctx.entities["moon"] = moon_eid;
// Assign orbital parent
ctx.entity_registry->get<entity::component::orbit>(moon_eid).parent = ctx.entities["em_bary"];
ctx.entity_registry->get<game::component::orbit>(moon_eid).parent = ctx.entities["em_bary"];
// Pass moon model to sky pass
ctx.sky_pass->set_moon_model(ctx.resource_manager->load<render::model>("moon.mdl"));

+ 28
- 28
src/resources/entity-archetype-loader.cpp View File

@ -20,16 +20,16 @@
#include "resource-loader.hpp"
#include "resource-manager.hpp"
#include "render/model.hpp"
#include "entity/components/atmosphere.hpp"
#include "entity/components/behavior.hpp"
#include "entity/components/collision.hpp"
#include "entity/components/diffuse-reflector.hpp"
#include "entity/components/terrain.hpp"
#include "entity/components/transform.hpp"
#include "entity/components/model.hpp"
#include "entity/components/orbit.hpp"
#include "entity/components/blackbody.hpp"
#include "entity/components/celestial-body.hpp"
#include "game/component/atmosphere.hpp"
#include "game/component/behavior.hpp"
#include "game/component/collision.hpp"
#include "game/component/diffuse-reflector.hpp"
#include "game/component/terrain.hpp"
#include "game/component/transform.hpp"
#include "game/component/model.hpp"
#include "game/component/orbit.hpp"
#include "game/component/blackbody.hpp"
#include "game/component/celestial-body.hpp"
#include "entity/archetype.hpp"
#include "entity/ebt.hpp"
#include "physics/orbit/elements.hpp"
@ -38,7 +38,7 @@
static bool load_component_atmosphere(entity::archetype& archetype, const json& element)
{
entity::component::atmosphere component;
game::component::atmosphere component;
if (element.contains("upper_limit"))
component.upper_limit = element["upper_limit"].get<double>();
@ -76,14 +76,14 @@ static bool load_component_atmosphere(entity::archetype& archetype, const json&
component.airglow_illuminance.z = airglow_illuminance[2].get<double>();
}
archetype.set<entity::component::atmosphere>(component);
archetype.set<game::component::atmosphere>(component);
return true;
}
static bool load_component_behavior(entity::archetype& archetype, resource_manager& resource_manager, const json& element)
{
entity::component::behavior component;
game::component::behavior component;
component.behavior_tree = nullptr;
if (element.contains("file"))
@ -91,27 +91,27 @@ static bool load_component_behavior(entity::archetype& archetype, resource_manag
component.behavior_tree = resource_manager.load<entity::ebt::node>(element["file"].get<std::string>());
}
archetype.set<entity::component::behavior>(component);
archetype.set<game::component::behavior>(component);
return (component.behavior_tree != nullptr);
}
static bool load_component_blackbody(entity::archetype& archetype, const json& element)
{
entity::component::blackbody component;
game::component::blackbody component;
component.temperature = 0.0;
if (element.contains("temperature"))
component.temperature = element["temperature"].get<double>();
archetype.set<entity::component::blackbody>(component);
archetype.set<game::component::blackbody>(component);
return true;
}
static bool load_component_celestial_body(entity::archetype& archetype, const json& element)
{
entity::component::celestial_body component;
game::component::celestial_body component;
if (element.contains("radius"))
component.radius = element["radius"].get<double>();
@ -141,14 +141,14 @@ static bool load_component_celestial_body(entity::archetype& archetype, const js
if (element.contains("albedo"))
component.albedo = element["albedo"].get<double>();
archetype.set<entity::component::celestial_body>(component);
archetype.set<game::component::celestial_body>(component);
return true;
}
static bool load_component_collision(entity::archetype& archetype, resource_manager& resource_manager, const json& element)
{
entity::component::collision component;
game::component::collision component;
component.mesh = nullptr;
if (element.contains("file"))
@ -156,27 +156,27 @@ static bool load_component_collision(entity::archetype& archetype, resource_mana
component.mesh = resource_manager.load<geom::mesh>(element["file"].get<std::string>());
}
archetype.set<entity::component::collision>(component);
archetype.set<game::component::collision>(component);
return (component.mesh != nullptr);
}
static bool load_component_diffuse_reflector(entity::archetype& archetype, const json& element)
{
entity::component::diffuse_reflector component;
game::component::diffuse_reflector component;
component.albedo = 0.0;
if (element.contains("albedo"))
component.albedo = element["albedo"].get<double>();
archetype.set<entity::component::diffuse_reflector>(component);
archetype.set<game::component::diffuse_reflector>(component);
return true;
}
static bool load_component_model(entity::archetype& archetype, resource_manager& resource_manager, const json& element)
{
entity::component::model component;
game::component::model component;
component.instance_count = 0;
//component.layers = ~0;
component.layers = 1;
@ -186,14 +186,14 @@ static bool load_component_model(entity::archetype& archetype, resource_manager&
component.render_model = resource_manager.load<render::model>(element["file"].get<std::string>());
}
archetype.set<entity::component::model>(component);
archetype.set<game::component::model>(component);
return true;
}
static bool load_component_orbit(entity::archetype& archetype, const json& element)
{
entity::component::orbit component;
game::component::orbit component;
component.parent = entt::null;
component.ephemeris_index = -1;
@ -205,14 +205,14 @@ static bool load_component_orbit(entity::archetype& archetype, const json& eleme
if (element.contains("scale"))
component.scale = element["scale"].get<double>();
archetype.set<entity::component::orbit>(component);
archetype.set<game::component::orbit>(component);
return true;
}
static bool load_component_transform(entity::archetype& archetype, const json& element)
{
entity::component::transform component;
game::component::transform component;
component.local = math::transform<float>::identity;
component.warp = true;
@ -242,7 +242,7 @@ static bool load_component_transform(entity::archetype& archetype, const json& e
}
component.world = component.local;
archetype.set<entity::component::transform>(component);
archetype.set<game::component::transform>(component);
return true;
}

Loading…
Cancel
Save