Rework EnTT integration
- Update EnTT to 3.11.1 - Moved EnTT wrapper to EnTTWorld, inheriting EntityWorld - AppEntitySystemComponent can now handles multiple EntityWorld - Headers relying on EnTT are now automatically included if NAZARA_ENTT is defined - Renamed SystemGraph to EnttSystemGraph (as it depends on it for now)
This commit is contained in:
parent
d5f281a768
commit
97fa4d98be
|
|
@ -3,7 +3,6 @@
|
||||||
#include <Nazara/Graphics.hpp>
|
#include <Nazara/Graphics.hpp>
|
||||||
#include <Nazara/Renderer.hpp>
|
#include <Nazara/Renderer.hpp>
|
||||||
#include <Nazara/Utility.hpp>
|
#include <Nazara/Utility.hpp>
|
||||||
#include <array>
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,10 @@
|
||||||
#include <Nazara/Core.hpp>
|
#include <Nazara/Core.hpp>
|
||||||
#include <Nazara/Core/AppEntitySystemComponent.hpp>
|
|
||||||
#include <Nazara/Core/Systems.hpp>
|
|
||||||
#include <Nazara/Platform.hpp>
|
#include <Nazara/Platform.hpp>
|
||||||
#include <Nazara/Graphics.hpp>
|
#include <Nazara/Graphics.hpp>
|
||||||
#include <Nazara/Graphics/Components.hpp>
|
|
||||||
#include <Nazara/Graphics/Systems.hpp>
|
|
||||||
#include <Nazara/Math/PidController.hpp>
|
#include <Nazara/Math/PidController.hpp>
|
||||||
#include <Nazara/Physics2D.hpp>
|
#include <Nazara/Physics2D.hpp>
|
||||||
#include <Nazara/Physics2D/Components.hpp>
|
|
||||||
#include <Nazara/Physics2D/Systems.hpp>
|
|
||||||
#include <Nazara/Renderer.hpp>
|
#include <Nazara/Renderer.hpp>
|
||||||
#include <Nazara/Utility.hpp>
|
#include <Nazara/Utility.hpp>
|
||||||
#include <Nazara/Utility/Components.hpp>
|
|
||||||
#include <Nazara/Widgets.hpp>
|
#include <Nazara/Widgets.hpp>
|
||||||
#include <entt/entt.hpp>
|
#include <entt/entt.hpp>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
@ -42,8 +35,10 @@ int main()
|
||||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||||
|
|
||||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||||
Nz::Physics2DSystem& physSytem = ecs.AddSystem<Nz::Physics2DSystem>();
|
|
||||||
Nz::RenderSystem& renderSystem = ecs.AddSystem<Nz::RenderSystem>();
|
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||||
|
Nz::Physics2DSystem& physSytem = world.AddSystem<Nz::Physics2DSystem>();
|
||||||
|
Nz::RenderSystem& renderSystem = world.AddSystem<Nz::RenderSystem>();
|
||||||
|
|
||||||
std::string windowTitle = "Physics 2D";
|
std::string windowTitle = "Physics 2D";
|
||||||
Nz::Window& window = windowing.CreateWindow(Nz::VideoMode(1920, 1080, 32), windowTitle);
|
Nz::Window& window = windowing.CreateWindow(Nz::VideoMode(1920, 1080, 32), windowTitle);
|
||||||
|
|
@ -55,7 +50,7 @@ int main()
|
||||||
|
|
||||||
physSytem.GetPhysWorld().SetGravity({ 0.f, -98.1f });
|
physSytem.GetPhysWorld().SetGravity({ 0.f, -98.1f });
|
||||||
|
|
||||||
entt::handle viewer = ecs.CreateEntity();
|
entt::handle viewer = world.CreateEntity();
|
||||||
{
|
{
|
||||||
viewer.emplace<Nz::NodeComponent>();
|
viewer.emplace<Nz::NodeComponent>();
|
||||||
auto& cameraComponent = viewer.emplace<Nz::CameraComponent>(&windowSwapchain.GetSwapchain(), Nz::ProjectionType::Orthographic);
|
auto& cameraComponent = viewer.emplace<Nz::CameraComponent>(&windowSwapchain.GetSwapchain(), Nz::ProjectionType::Orthographic);
|
||||||
|
|
@ -77,7 +72,7 @@ int main()
|
||||||
{
|
{
|
||||||
for (std::size_t x = 0; x < 30; ++x)
|
for (std::size_t x = 0; x < 30; ++x)
|
||||||
{
|
{
|
||||||
entt::handle spriteEntity = ecs.CreateEntity();
|
entt::handle spriteEntity = world.CreateEntity();
|
||||||
{
|
{
|
||||||
std::shared_ptr<Nz::Sprite> sprite = std::make_shared<Nz::Sprite>(spriteMaterial);
|
std::shared_ptr<Nz::Sprite> sprite = std::make_shared<Nz::Sprite>(spriteMaterial);
|
||||||
sprite->SetSize({ 32.f, 32.f });
|
sprite->SetSize({ 32.f, 32.f });
|
||||||
|
|
@ -93,7 +88,7 @@ int main()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entt::handle groundEntity = ecs.CreateEntity();
|
entt::handle groundEntity = world.CreateEntity();
|
||||||
{
|
{
|
||||||
std::shared_ptr<Nz::Tilemap> tilemap = std::make_shared<Nz::Tilemap>(Nz::Vector2ui(40, 20), Nz::Vector2f(64.f, 64.f), 18);
|
std::shared_ptr<Nz::Tilemap> tilemap = std::make_shared<Nz::Tilemap>(Nz::Vector2ui(40, 20), Nz::Vector2f(64.f, 64.f), 18);
|
||||||
tilemap->SetOrigin({ 0.5f, 0.5f });
|
tilemap->SetOrigin({ 0.5f, 0.5f });
|
||||||
|
|
@ -138,7 +133,7 @@ int main()
|
||||||
|
|
||||||
if (secondClock.RestartIfOver(Nz::Time::Second()))
|
if (secondClock.RestartIfOver(Nz::Time::Second()))
|
||||||
{
|
{
|
||||||
window.SetTitle(windowTitle + " - " + Nz::NumberToString(fps) + " FPS" + " - " + Nz::NumberToString(ecs.GetRegistry().alive()) + " entities");
|
window.SetTitle(windowTitle + " - " + Nz::NumberToString(fps) + " FPS" + " - " + Nz::NumberToString(world.GetRegistry().alive()) + " entities");
|
||||||
fps = 0;
|
fps = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@ target("Physics2DDemo")
|
||||||
add_deps("NazaraGraphics", "NazaraPhysics2D")
|
add_deps("NazaraGraphics", "NazaraPhysics2D")
|
||||||
add_packages("entt")
|
add_packages("entt")
|
||||||
add_files("main.cpp")
|
add_files("main.cpp")
|
||||||
|
add_defines("NAZARA_ENTT")
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,10 @@
|
||||||
#include <Nazara/Core.hpp>
|
#include <Nazara/Core.hpp>
|
||||||
#include <Nazara/Core/AppEntitySystemComponent.hpp>
|
|
||||||
#include <Nazara/Core/Systems.hpp>
|
|
||||||
#include <Nazara/Platform.hpp>
|
#include <Nazara/Platform.hpp>
|
||||||
#include <Nazara/Graphics.hpp>
|
#include <Nazara/Graphics.hpp>
|
||||||
#include <Nazara/Graphics/Components.hpp>
|
|
||||||
#include <Nazara/Graphics/Systems.hpp>
|
|
||||||
#include <Nazara/Graphics/TextSprite.hpp>
|
|
||||||
#include <Nazara/Math/PidController.hpp>
|
#include <Nazara/Math/PidController.hpp>
|
||||||
#include <Nazara/Physics3D.hpp>
|
#include <Nazara/Physics3D.hpp>
|
||||||
#include <Nazara/Physics3D/Components.hpp>
|
|
||||||
#include <Nazara/Physics3D/Systems.hpp>
|
|
||||||
#include <Nazara/Renderer.hpp>
|
#include <Nazara/Renderer.hpp>
|
||||||
#include <Nazara/Utility.hpp>
|
#include <Nazara/Utility.hpp>
|
||||||
#include <Nazara/Utility/Components.hpp>
|
|
||||||
#include <entt/entt.hpp>
|
#include <entt/entt.hpp>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
@ -42,8 +34,10 @@ int main()
|
||||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||||
|
|
||||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||||
Nz::Physics3DSystem& physSytem = ecs.AddSystem<Nz::Physics3DSystem>();
|
|
||||||
Nz::RenderSystem& renderSystem = ecs.AddSystem<Nz::RenderSystem>();
|
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||||
|
Nz::Physics3DSystem& physSytem = world.AddSystem<Nz::Physics3DSystem>();
|
||||||
|
Nz::RenderSystem& renderSystem = world.AddSystem<Nz::RenderSystem>();
|
||||||
|
|
||||||
std::string windowTitle = "Physics 3D";
|
std::string windowTitle = "Physics 3D";
|
||||||
Nz::Window& window = windowing.CreateWindow(Nz::VideoMode(1920, 1080, 32), windowTitle);
|
Nz::Window& window = windowing.CreateWindow(Nz::VideoMode(1920, 1080, 32), windowTitle);
|
||||||
|
|
@ -107,7 +101,7 @@ int main()
|
||||||
|
|
||||||
Nz::Vector2ui windowSize = window.GetSize();
|
Nz::Vector2ui windowSize = window.GetSize();
|
||||||
|
|
||||||
entt::handle viewer = ecs.CreateEntity();
|
entt::handle viewer = world.CreateEntity();
|
||||||
{
|
{
|
||||||
viewer.emplace<Nz::NodeComponent>();
|
viewer.emplace<Nz::NodeComponent>();
|
||||||
auto& cameraComponent = viewer.emplace<Nz::CameraComponent>(&windowSwapchain.GetSwapchain());
|
auto& cameraComponent = viewer.emplace<Nz::CameraComponent>(&windowSwapchain.GetSwapchain());
|
||||||
|
|
@ -138,7 +132,7 @@ int main()
|
||||||
colliderModel->SetMaterial(i, colliderMat);
|
colliderModel->SetMaterial(i, colliderMat);
|
||||||
}
|
}
|
||||||
|
|
||||||
entt::handle textEntity = ecs.CreateEntity();
|
entt::handle textEntity = world.CreateEntity();
|
||||||
{
|
{
|
||||||
auto& entityGfx = textEntity.emplace<Nz::GraphicsComponent>();
|
auto& entityGfx = textEntity.emplace<Nz::GraphicsComponent>();
|
||||||
entityGfx.AttachRenderable(sprite, 1);
|
entityGfx.AttachRenderable(sprite, 1);
|
||||||
|
|
@ -146,9 +140,9 @@ int main()
|
||||||
auto& entityNode = textEntity.emplace<Nz::NodeComponent>();
|
auto& entityNode = textEntity.emplace<Nz::NodeComponent>();
|
||||||
entityNode.SetPosition(0.f, 5.f, 0.f);
|
entityNode.SetPosition(0.f, 5.f, 0.f);
|
||||||
}
|
}
|
||||||
entt::handle playerEntity = ecs.CreateEntity();
|
entt::handle playerEntity = world.CreateEntity();
|
||||||
|
|
||||||
entt::handle headingEntity = ecs.CreateEntity();
|
entt::handle headingEntity = world.CreateEntity();
|
||||||
{
|
{
|
||||||
auto& entityLight = playerEntity.emplace<Nz::LightComponent>();
|
auto& entityLight = playerEntity.emplace<Nz::LightComponent>();
|
||||||
auto& spotLight = entityLight.AddLight<Nz::SpotLight>(1);
|
auto& spotLight = entityLight.AddLight<Nz::SpotLight>(1);
|
||||||
|
|
@ -179,7 +173,7 @@ int main()
|
||||||
{
|
{
|
||||||
for (std::size_t z = 0; z < 3; ++z)
|
for (std::size_t z = 0; z < 3; ++z)
|
||||||
{
|
{
|
||||||
entt::handle entity = ecs.CreateEntity();
|
entt::handle entity = world.CreateEntity();
|
||||||
auto& entityGfx = entity.emplace<Nz::GraphicsComponent>();
|
auto& entityGfx = entity.emplace<Nz::GraphicsComponent>();
|
||||||
entityGfx.AttachRenderable(model, 1);
|
entityGfx.AttachRenderable(model, 1);
|
||||||
|
|
||||||
|
|
@ -222,20 +216,20 @@ int main()
|
||||||
showColliders = !showColliders;
|
showColliders = !showColliders;
|
||||||
if (showColliders)
|
if (showColliders)
|
||||||
{
|
{
|
||||||
auto view = ecs.GetRegistry().view<Nz::GraphicsComponent, Nz::RigidBody3DComponent>();
|
auto view = world.GetRegistry().view<Nz::GraphicsComponent, Nz::RigidBody3DComponent>();
|
||||||
for (auto [entity, gfxComponent, _] : view.each())
|
for (auto [entity, gfxComponent, _] : view.each())
|
||||||
gfxComponent.AttachRenderable(colliderModel, 1);
|
gfxComponent.AttachRenderable(colliderModel, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto view = ecs.GetRegistry().view<Nz::GraphicsComponent, Nz::RigidBody3DComponent>();
|
auto view = world.GetRegistry().view<Nz::GraphicsComponent, Nz::RigidBody3DComponent>();
|
||||||
for (auto [entity, gfxComponent, _] : view.each())
|
for (auto [entity, gfxComponent, _] : view.each())
|
||||||
gfxComponent.DetachRenderable(colliderModel);
|
gfxComponent.DetachRenderable(colliderModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event.virtualKey == Nz::Keyboard::VKey::Space)
|
else if (event.virtualKey == Nz::Keyboard::VKey::Space)
|
||||||
{
|
{
|
||||||
entt::handle entity = ecs.CreateEntity();
|
entt::handle entity = world.CreateEntity();
|
||||||
auto& entityGfx = entity.emplace<Nz::GraphicsComponent>();
|
auto& entityGfx = entity.emplace<Nz::GraphicsComponent>();
|
||||||
entityGfx.AttachRenderable(model, 1);
|
entityGfx.AttachRenderable(model, 1);
|
||||||
if (showColliders)
|
if (showColliders)
|
||||||
|
|
@ -270,7 +264,7 @@ int main()
|
||||||
{
|
{
|
||||||
float elapsedTime = deltaTime->AsSeconds();
|
float elapsedTime = deltaTime->AsSeconds();
|
||||||
|
|
||||||
auto spaceshipView = ecs.GetRegistry().view<Nz::NodeComponent, Nz::RigidBody3DComponent>();
|
auto spaceshipView = world.GetRegistry().view<Nz::NodeComponent, Nz::RigidBody3DComponent>();
|
||||||
for (auto&& [entity, node, _] : spaceshipView.each())
|
for (auto&& [entity, node, _] : spaceshipView.each())
|
||||||
{
|
{
|
||||||
if (entity == playerEntity)
|
if (entity == playerEntity)
|
||||||
|
|
@ -278,7 +272,7 @@ int main()
|
||||||
|
|
||||||
Nz::Vector3f spaceshipPos = node.GetPosition(Nz::CoordSys::Global);
|
Nz::Vector3f spaceshipPos = node.GetPosition(Nz::CoordSys::Global);
|
||||||
if (spaceshipPos.GetSquaredLength() > Nz::IntegralPow(20.f, 2))
|
if (spaceshipPos.GetSquaredLength() > Nz::IntegralPow(20.f, 2))
|
||||||
ecs.GetRegistry().destroy(entity);
|
world.GetRegistry().destroy(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
Nz::RigidBody3DComponent& playerShipBody = playerEntity.get<Nz::RigidBody3DComponent>();
|
Nz::RigidBody3DComponent& playerShipBody = playerEntity.get<Nz::RigidBody3DComponent>();
|
||||||
|
|
@ -320,7 +314,7 @@ int main()
|
||||||
|
|
||||||
if (fpsClock.RestartIfOver(Nz::Time::Second()))
|
if (fpsClock.RestartIfOver(Nz::Time::Second()))
|
||||||
{
|
{
|
||||||
window.SetTitle(windowTitle + " - " + Nz::NumberToString(fps) + " FPS" + " - " + Nz::NumberToString(ecs.GetRegistry().alive()) + " entities");
|
window.SetTitle(windowTitle + " - " + Nz::NumberToString(fps) + " FPS" + " - " + Nz::NumberToString(world.GetRegistry().alive()) + " entities");
|
||||||
fps = 0;
|
fps = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@ target("PhysicsDemo")
|
||||||
add_deps("NazaraGraphics", "NazaraPhysics3D")
|
add_deps("NazaraGraphics", "NazaraPhysics3D")
|
||||||
add_packages("entt")
|
add_packages("entt")
|
||||||
add_files("main.cpp")
|
add_files("main.cpp")
|
||||||
|
add_defines("NAZARA_ENTT")
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,10 @@
|
||||||
#include <Nazara/Core.hpp>
|
#include <Nazara/Core.hpp>
|
||||||
#include <Nazara/Core/AppEntitySystemComponent.hpp>
|
|
||||||
#include <Nazara/Core/Systems.hpp>
|
|
||||||
#include <Nazara/Platform.hpp>
|
#include <Nazara/Platform.hpp>
|
||||||
#include <Nazara/Graphics.hpp>
|
#include <Nazara/Graphics.hpp>
|
||||||
#include <Nazara/Graphics/TextSprite.hpp>
|
|
||||||
#include <Nazara/Graphics/Components.hpp>
|
|
||||||
#include <Nazara/Graphics/Systems.hpp>
|
|
||||||
#include <Nazara/Math/PidController.hpp>
|
#include <Nazara/Math/PidController.hpp>
|
||||||
#include <Nazara/Physics3D.hpp>
|
#include <Nazara/Physics3D.hpp>
|
||||||
#include <Nazara/Physics3D/Components.hpp>
|
|
||||||
#include <Nazara/Physics3D/Systems.hpp>
|
|
||||||
#include <Nazara/Renderer.hpp>
|
#include <Nazara/Renderer.hpp>
|
||||||
#include <Nazara/Utility.hpp>
|
#include <Nazara/Utility.hpp>
|
||||||
#include <Nazara/Utility/Components.hpp>
|
|
||||||
#include <Nazara/Utility/Systems.hpp>
|
|
||||||
#include <Nazara/Utility/Plugins/AssimpPlugin.hpp>
|
#include <Nazara/Utility/Plugins/AssimpPlugin.hpp>
|
||||||
#include <Nazara/Utils/CallOnExit.hpp>
|
#include <Nazara/Utils/CallOnExit.hpp>
|
||||||
#include <NZSL/Math/FieldOffsets.hpp>
|
#include <NZSL/Math/FieldOffsets.hpp>
|
||||||
|
|
@ -46,10 +37,12 @@ int main()
|
||||||
std::shared_ptr<Nz::RenderDevice> device = Nz::Graphics::Instance()->GetRenderDevice();
|
std::shared_ptr<Nz::RenderDevice> device = Nz::Graphics::Instance()->GetRenderDevice();
|
||||||
|
|
||||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||||
ecs.AddSystem<Nz::SkeletonSystem>();
|
|
||||||
|
|
||||||
Nz::Physics3DSystem& physSytem = ecs.AddSystem<Nz::Physics3DSystem>();
|
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||||
Nz::RenderSystem& renderSystem = ecs.AddSystem<Nz::RenderSystem>();
|
world.AddSystem<Nz::SkeletonSystem>();
|
||||||
|
|
||||||
|
Nz::Physics3DSystem& physSytem = world.AddSystem<Nz::Physics3DSystem>();
|
||||||
|
Nz::RenderSystem& renderSystem = world.AddSystem<Nz::RenderSystem>();
|
||||||
|
|
||||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||||
|
|
||||||
|
|
@ -62,9 +55,9 @@ int main()
|
||||||
Nz::TextureParams texParams;
|
Nz::TextureParams texParams;
|
||||||
texParams.renderDevice = device;
|
texParams.renderDevice = device;
|
||||||
|
|
||||||
entt::handle playerEntity = ecs.CreateEntity();
|
entt::handle playerEntity = world.CreateEntity();
|
||||||
entt::handle playerRotation = ecs.CreateEntity();
|
entt::handle playerRotation = world.CreateEntity();
|
||||||
entt::handle playerCamera = ecs.CreateEntity();
|
entt::handle playerCamera = world.CreateEntity();
|
||||||
{
|
{
|
||||||
auto& playerNode = playerEntity.emplace<Nz::NodeComponent>();
|
auto& playerNode = playerEntity.emplace<Nz::NodeComponent>();
|
||||||
playerNode.SetPosition(0.f, 1.8f, 1.f);
|
playerNode.SetPosition(0.f, 1.8f, 1.f);
|
||||||
|
|
@ -166,8 +159,8 @@ int main()
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
entt::handle bobEntity = ecs.CreateEntity();
|
entt::handle bobEntity = world.CreateEntity();
|
||||||
entt::handle lightEntity1 = ecs.CreateEntity();
|
entt::handle lightEntity1 = world.CreateEntity();
|
||||||
{
|
{
|
||||||
auto& lightNode = lightEntity1.emplace<Nz::NodeComponent>();
|
auto& lightNode = lightEntity1.emplace<Nz::NodeComponent>();
|
||||||
lightNode.SetPosition(Nz::Vector3f::Up() * 3.f + Nz::Vector3f::Backward() * 1.f);
|
lightNode.SetPosition(Nz::Vector3f::Up() * 3.f + Nz::Vector3f::Backward() * 1.f);
|
||||||
|
|
@ -182,7 +175,7 @@ int main()
|
||||||
spotLight.EnableShadowCasting(true);
|
spotLight.EnableShadowCasting(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
entt::handle lightEntity2 = ecs.CreateEntity();
|
entt::handle lightEntity2 = world.CreateEntity();
|
||||||
{
|
{
|
||||||
auto& lightNode = lightEntity2.emplace<Nz::NodeComponent>();
|
auto& lightNode = lightEntity2.emplace<Nz::NodeComponent>();
|
||||||
lightNode.SetPosition(Nz::Vector3f::Up() * 3.5f + Nz::Vector3f::Right() * 1.5f);
|
lightNode.SetPosition(Nz::Vector3f::Up() * 3.5f + Nz::Vector3f::Right() * 1.5f);
|
||||||
|
|
@ -196,7 +189,7 @@ int main()
|
||||||
spotLight.UpdateShadowMapSize(1024);
|
spotLight.UpdateShadowMapSize(1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
entt::handle lightEntity3 = ecs.CreateEntity();
|
entt::handle lightEntity3 = world.CreateEntity();
|
||||||
|
|
||||||
{
|
{
|
||||||
auto& bobNode = bobEntity.emplace<Nz::NodeComponent>();
|
auto& bobNode = bobEntity.emplace<Nz::NodeComponent>();
|
||||||
|
|
@ -209,7 +202,7 @@ int main()
|
||||||
|
|
||||||
auto& sharedSkeleton = bobEntity.emplace<Nz::SharedSkeletonComponent>(skeleton);
|
auto& sharedSkeleton = bobEntity.emplace<Nz::SharedSkeletonComponent>(skeleton);
|
||||||
|
|
||||||
entt::handle sphereEntity = ecs.CreateEntity();
|
entt::handle sphereEntity = world.CreateEntity();
|
||||||
{
|
{
|
||||||
std::shared_ptr<Nz::Mesh> sphereMesh = std::make_shared<Nz::Mesh>();
|
std::shared_ptr<Nz::Mesh> sphereMesh = std::make_shared<Nz::Mesh>();
|
||||||
sphereMesh->CreateStatic();
|
sphereMesh->CreateStatic();
|
||||||
|
|
@ -242,7 +235,7 @@ int main()
|
||||||
sphereGfx.AttachRenderable(sphereModel, 0xFFFFFFFF);
|
sphereGfx.AttachRenderable(sphereModel, 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
entt::handle smallBobEntity = ecs.CreateEntity();
|
entt::handle smallBobEntity = world.CreateEntity();
|
||||||
auto& smallBobNode = smallBobEntity.emplace<Nz::NodeComponent>();
|
auto& smallBobNode = smallBobEntity.emplace<Nz::NodeComponent>();
|
||||||
smallBobNode.SetParentJoint(bobEntity, "LeftHand");
|
smallBobNode.SetParentJoint(bobEntity, "LeftHand");
|
||||||
|
|
||||||
|
|
@ -297,7 +290,7 @@ int main()
|
||||||
sprite->UpdateRenderLayer(1);
|
sprite->UpdateRenderLayer(1);
|
||||||
sprite->Update(Nz::SimpleTextDrawer::Draw("Shadow-mapping !", 72), 0.002f);
|
sprite->Update(Nz::SimpleTextDrawer::Draw("Shadow-mapping !", 72), 0.002f);
|
||||||
|
|
||||||
entt::handle textEntity = ecs.CreateEntity();
|
entt::handle textEntity = world.CreateEntity();
|
||||||
{
|
{
|
||||||
auto& entityGfx = textEntity.emplace<Nz::GraphicsComponent>();
|
auto& entityGfx = textEntity.emplace<Nz::GraphicsComponent>();
|
||||||
entityGfx.AttachRenderable(sprite, 1);
|
entityGfx.AttachRenderable(sprite, 1);
|
||||||
|
|
@ -307,7 +300,7 @@ int main()
|
||||||
entityNode.SetRotation(Nz::EulerAnglesf(-45.f, 0.f, 0.f));
|
entityNode.SetRotation(Nz::EulerAnglesf(-45.f, 0.f, 0.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
entt::handle planeEntity = ecs.CreateEntity();
|
entt::handle planeEntity = world.CreateEntity();
|
||||||
Nz::Boxf floorBox;
|
Nz::Boxf floorBox;
|
||||||
{
|
{
|
||||||
Nz::MeshParams meshPrimitiveParams;
|
Nz::MeshParams meshPrimitiveParams;
|
||||||
|
|
@ -353,7 +346,7 @@ int main()
|
||||||
std::shared_ptr<Nz::Model> boxModel = std::make_shared<Nz::Model>(std::move(boxMeshGfx), boxMesh.GetAABB());
|
std::shared_ptr<Nz::Model> boxModel = std::make_shared<Nz::Model>(std::move(boxMeshGfx), boxMesh.GetAABB());
|
||||||
boxModel->SetMaterial(0, planeMat);
|
boxModel->SetMaterial(0, planeMat);
|
||||||
|
|
||||||
entt::handle boxEntity = ecs.CreateEntity();
|
entt::handle boxEntity = world.CreateEntity();
|
||||||
boxEntity.emplace<Nz::NodeComponent>().SetPosition(Nz::Vector3f(0.f, 0.25f, -0.5f));
|
boxEntity.emplace<Nz::NodeComponent>().SetPosition(Nz::Vector3f(0.f, 0.25f, -0.5f));
|
||||||
boxEntity.emplace<Nz::GraphicsComponent>().AttachRenderable(boxModel, 0xFFFFFFFF);
|
boxEntity.emplace<Nz::GraphicsComponent>().AttachRenderable(boxModel, 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
@ -517,7 +510,7 @@ int main()
|
||||||
|
|
||||||
if (fpsClock.RestartIfOver(Nz::Time::Second()))
|
if (fpsClock.RestartIfOver(Nz::Time::Second()))
|
||||||
{
|
{
|
||||||
mainWindow.SetTitle(windowTitle + " - " + Nz::NumberToString(fps) + " FPS" + " - " + Nz::NumberToString(ecs.GetRegistry().alive()) + " entities");
|
mainWindow.SetTitle(windowTitle + " - " + Nz::NumberToString(fps) + " FPS" + " - " + Nz::NumberToString(world.GetRegistry().alive()) + " entities");
|
||||||
fps = 0;
|
fps = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,4 @@ target("Showcase")
|
||||||
add_deps("PluginAssimp", { links = {} })
|
add_deps("PluginAssimp", { links = {} })
|
||||||
add_packages("entt")
|
add_packages("entt")
|
||||||
add_files("main.cpp")
|
add_files("main.cpp")
|
||||||
|
add_defines("NAZARA_ENTT")
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,10 @@
|
||||||
// Sources pour https://github.com/NazaraEngine/NazaraEngine/wiki/(FR)-Tutoriel:-%5B01%5D-Hello-World
|
// Sources pour https://github.com/NazaraEngine/NazaraEngine/wiki/(FR)-Tutoriel:-%5B01%5D-Hello-World
|
||||||
|
|
||||||
#include <Nazara/Core/Application.hpp>
|
#include <Nazara/Core.hpp>
|
||||||
#include <Nazara/Core/AppEntitySystemComponent.hpp>
|
|
||||||
#include <Nazara/Core/Systems.hpp>
|
|
||||||
#include <Nazara/Graphics.hpp>
|
#include <Nazara/Graphics.hpp>
|
||||||
#include <Nazara/Graphics/Components.hpp>
|
|
||||||
#include <Nazara/Graphics/Systems.hpp>
|
|
||||||
#include <Nazara/Platform/AppWindowingComponent.hpp>
|
#include <Nazara/Platform/AppWindowingComponent.hpp>
|
||||||
#include <Nazara/Renderer.hpp>
|
#include <Nazara/Renderer.hpp>
|
||||||
#include <Nazara/Utility.hpp>
|
#include <Nazara/Utility.hpp>
|
||||||
#include <Nazara/Utility/Components.hpp>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
@ -20,11 +15,12 @@ int main()
|
||||||
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1280, 720), "Tut01 - Hello world");
|
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1280, 720), "Tut01 - Hello world");
|
||||||
|
|
||||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||||
|
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||||
|
|
||||||
Nz::RenderSystem& renderSystem = ecs.AddSystem<Nz::RenderSystem>();
|
Nz::RenderSystem& renderSystem = world.AddSystem<Nz::RenderSystem>();
|
||||||
auto& windowSwapchain = renderSystem.CreateSwapchain(mainWindow);
|
auto& windowSwapchain = renderSystem.CreateSwapchain(mainWindow);
|
||||||
|
|
||||||
entt::handle cameraEntity = ecs.CreateEntity();
|
entt::handle cameraEntity = world.CreateEntity();
|
||||||
{
|
{
|
||||||
cameraEntity.emplace<Nz::NodeComponent>();
|
cameraEntity.emplace<Nz::NodeComponent>();
|
||||||
|
|
||||||
|
|
@ -40,7 +36,7 @@ int main()
|
||||||
std::shared_ptr<Nz::TextSprite> textSprite = std::make_shared<Nz::TextSprite>();
|
std::shared_ptr<Nz::TextSprite> textSprite = std::make_shared<Nz::TextSprite>();
|
||||||
textSprite->Update(textDrawer);
|
textSprite->Update(textDrawer);
|
||||||
|
|
||||||
entt::handle textEntity = ecs.CreateEntity();
|
entt::handle textEntity = world.CreateEntity();
|
||||||
{
|
{
|
||||||
auto& nodeComponent = textEntity.emplace<Nz::NodeComponent>();
|
auto& nodeComponent = textEntity.emplace<Nz::NodeComponent>();
|
||||||
auto& gfxComponent = textEntity.emplace<Nz::GraphicsComponent>();
|
auto& gfxComponent = textEntity.emplace<Nz::GraphicsComponent>();
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@ target("Tut01_HelloWorld")
|
||||||
add_deps("NazaraGraphics")
|
add_deps("NazaraGraphics")
|
||||||
add_packages("entt")
|
add_packages("entt")
|
||||||
add_files("main.cpp")
|
add_files("main.cpp")
|
||||||
|
add_defines("NAZARA_ENTT")
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,10 @@
|
||||||
// Sources pour https://github.com/NazaraEngine/NazaraEngine/wiki/(FR)-Tutoriel:-%5B02%5D-Gestion-des-événements
|
// Sources pour https://github.com/NazaraEngine/NazaraEngine/wiki/(FR)-Tutoriel:-%5B02%5D-Gestion-des-événements
|
||||||
|
|
||||||
#include <Nazara/Core/Application.hpp>
|
#include <Nazara/Core.hpp>
|
||||||
#include <Nazara/Core/AppEntitySystemComponent.hpp>
|
|
||||||
#include <Nazara/Core/Systems.hpp>
|
|
||||||
#include <Nazara/Graphics.hpp>
|
#include <Nazara/Graphics.hpp>
|
||||||
#include <Nazara/Graphics/Components.hpp>
|
|
||||||
#include <Nazara/Graphics/Systems.hpp>
|
|
||||||
#include <Nazara/Platform/AppWindowingComponent.hpp>
|
#include <Nazara/Platform/AppWindowingComponent.hpp>
|
||||||
#include <Nazara/Renderer.hpp>
|
#include <Nazara/Renderer.hpp>
|
||||||
#include <Nazara/Utility.hpp>
|
#include <Nazara/Utility.hpp>
|
||||||
#include <Nazara/Utility/Components.hpp>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
@ -20,11 +15,12 @@ int main()
|
||||||
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1280, 720), "Tut02 - Hello world");
|
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1280, 720), "Tut02 - Hello world");
|
||||||
|
|
||||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||||
|
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||||
|
|
||||||
Nz::RenderSystem& renderSystem = ecs.AddSystem<Nz::RenderSystem>();
|
Nz::RenderSystem& renderSystem = world.AddSystem<Nz::RenderSystem>();
|
||||||
auto& windowSwapchain = renderSystem.CreateSwapchain(mainWindow);
|
auto& windowSwapchain = renderSystem.CreateSwapchain(mainWindow);
|
||||||
|
|
||||||
entt::handle cameraEntity = ecs.CreateEntity();
|
entt::handle cameraEntity = world.CreateEntity();
|
||||||
{
|
{
|
||||||
cameraEntity.emplace<Nz::NodeComponent>();
|
cameraEntity.emplace<Nz::NodeComponent>();
|
||||||
|
|
||||||
|
|
@ -40,7 +36,7 @@ int main()
|
||||||
std::shared_ptr<Nz::TextSprite> textSprite = std::make_shared<Nz::TextSprite>();
|
std::shared_ptr<Nz::TextSprite> textSprite = std::make_shared<Nz::TextSprite>();
|
||||||
textSprite->Update(textDrawer);
|
textSprite->Update(textDrawer);
|
||||||
|
|
||||||
entt::handle textEntity = ecs.CreateEntity();
|
entt::handle textEntity = world.CreateEntity();
|
||||||
{
|
{
|
||||||
auto& nodeComponent = textEntity.emplace<Nz::NodeComponent>();
|
auto& nodeComponent = textEntity.emplace<Nz::NodeComponent>();
|
||||||
auto& gfxComponent = textEntity.emplace<Nz::GraphicsComponent>();
|
auto& gfxComponent = textEntity.emplace<Nz::GraphicsComponent>();
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@ target("Tut02_Events")
|
||||||
add_deps("NazaraGraphics")
|
add_deps("NazaraGraphics")
|
||||||
add_packages("entt")
|
add_packages("entt")
|
||||||
add_files("main.cpp")
|
add_files("main.cpp")
|
||||||
|
add_defines("NAZARA_ENTT")
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,11 @@
|
||||||
#include <Nazara/Core.hpp>
|
#include <Nazara/Core.hpp>
|
||||||
#include <Nazara/Core/AppEntitySystemComponent.hpp>
|
|
||||||
#include <Nazara/Core/Systems.hpp>
|
|
||||||
#include <Nazara/Platform.hpp>
|
#include <Nazara/Platform.hpp>
|
||||||
#include <Nazara/Graphics.hpp>
|
#include <Nazara/Graphics.hpp>
|
||||||
#include <Nazara/Graphics/TextSprite.hpp>
|
|
||||||
#include <Nazara/Graphics/Components.hpp>
|
|
||||||
#include <Nazara/Graphics/Systems.hpp>
|
|
||||||
#include <Nazara/Math/PidController.hpp>
|
#include <Nazara/Math/PidController.hpp>
|
||||||
#include <Nazara/Physics3D.hpp>
|
#include <Nazara/Physics3D.hpp>
|
||||||
#include <Nazara/Physics3D/Components.hpp>
|
|
||||||
#include <Nazara/Physics3D/Systems.hpp>
|
|
||||||
#include <Nazara/Renderer.hpp>
|
#include <Nazara/Renderer.hpp>
|
||||||
#include <Nazara/Utility.hpp>
|
#include <Nazara/Utility.hpp>
|
||||||
#include <Nazara/Utility/Components.hpp>
|
|
||||||
#include <Nazara/Widgets.hpp>
|
#include <Nazara/Widgets.hpp>
|
||||||
#include <Nazara/Widgets/ImageButtonWidget.hpp>
|
|
||||||
#include <Nazara/Widgets/ScrollAreaWidget.hpp>
|
|
||||||
#include <entt/entt.hpp>
|
#include <entt/entt.hpp>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
@ -40,6 +30,7 @@ int main()
|
||||||
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1920, 1080), "Widget demo");
|
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1920, 1080), "Widget demo");
|
||||||
|
|
||||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||||
|
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||||
|
|
||||||
auto& fs = app.AddComponent<Nz::AppFilesystemComponent>();
|
auto& fs = app.AddComponent<Nz::AppFilesystemComponent>();
|
||||||
{
|
{
|
||||||
|
|
@ -50,10 +41,10 @@ int main()
|
||||||
fs.Mount("assets", resourceDir);
|
fs.Mount("assets", resourceDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
Nz::RenderSystem& renderSystem = ecs.AddSystem<Nz::RenderSystem>();
|
Nz::RenderSystem& renderSystem = world.AddSystem<Nz::RenderSystem>();
|
||||||
auto& windowSwapchain = renderSystem.CreateSwapchain(mainWindow);
|
auto& windowSwapchain = renderSystem.CreateSwapchain(mainWindow);
|
||||||
|
|
||||||
Nz::Canvas canvas2D(ecs.GetRegistry(), mainWindow.GetEventHandler(), mainWindow.GetCursorController().CreateHandle(), 0xFFFFFFFF);
|
Nz::Canvas canvas2D(world, mainWindow.GetEventHandler(), mainWindow.GetCursorController().CreateHandle(), 0xFFFFFFFF);
|
||||||
canvas2D.Resize(Nz::Vector2f(mainWindow.GetSize()));
|
canvas2D.Resize(Nz::Vector2f(mainWindow.GetSize()));
|
||||||
|
|
||||||
Nz::LabelWidget* labelWidget = canvas2D.Add<Nz::LabelWidget>();
|
Nz::LabelWidget* labelWidget = canvas2D.Add<Nz::LabelWidget>();
|
||||||
|
|
@ -119,7 +110,7 @@ int main()
|
||||||
textAreaWidget2->SetBackgroundColor(Nz::Color::White());
|
textAreaWidget2->SetBackgroundColor(Nz::Color::White());
|
||||||
textAreaWidget2->SetTextColor(Nz::Color::Black());*/
|
textAreaWidget2->SetTextColor(Nz::Color::Black());*/
|
||||||
|
|
||||||
entt::handle viewer2D = ecs.CreateEntity();
|
entt::handle viewer2D = world.CreateEntity();
|
||||||
{
|
{
|
||||||
viewer2D.emplace<Nz::NodeComponent>();
|
viewer2D.emplace<Nz::NodeComponent>();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@ target("WidgetDemo")
|
||||||
add_deps("NazaraGraphics", "NazaraPhysics3D", "NazaraWidgets")
|
add_deps("NazaraGraphics", "NazaraPhysics3D", "NazaraWidgets")
|
||||||
add_packages("entt")
|
add_packages("entt")
|
||||||
add_files("main.cpp")
|
add_files("main.cpp")
|
||||||
|
add_defines("NAZARA_ENTT")
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Audio module
|
Nazara Engine - Audio module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Core module
|
Nazara Engine - Core module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
@ -47,6 +47,7 @@
|
||||||
#include <Nazara/Core/Core.hpp>
|
#include <Nazara/Core/Core.hpp>
|
||||||
#include <Nazara/Core/DynLib.hpp>
|
#include <Nazara/Core/DynLib.hpp>
|
||||||
#include <Nazara/Core/EmptyStream.hpp>
|
#include <Nazara/Core/EmptyStream.hpp>
|
||||||
|
#include <Nazara/Core/EntityWorld.hpp>
|
||||||
#include <Nazara/Core/Enums.hpp>
|
#include <Nazara/Core/Enums.hpp>
|
||||||
#include <Nazara/Core/Error.hpp>
|
#include <Nazara/Core/Error.hpp>
|
||||||
#include <Nazara/Core/ErrorFlags.hpp>
|
#include <Nazara/Core/ErrorFlags.hpp>
|
||||||
|
|
@ -77,6 +78,7 @@
|
||||||
#include <Nazara/Core/ResourceLoader.hpp>
|
#include <Nazara/Core/ResourceLoader.hpp>
|
||||||
#include <Nazara/Core/ResourceManager.hpp>
|
#include <Nazara/Core/ResourceManager.hpp>
|
||||||
#include <Nazara/Core/ResourceParameters.hpp>
|
#include <Nazara/Core/ResourceParameters.hpp>
|
||||||
|
#include <Nazara/Core/ResourceRegistry.hpp>
|
||||||
#include <Nazara/Core/ResourceSaver.hpp>
|
#include <Nazara/Core/ResourceSaver.hpp>
|
||||||
#include <Nazara/Core/SerializationContext.hpp>
|
#include <Nazara/Core/SerializationContext.hpp>
|
||||||
#include <Nazara/Core/StdLogger.hpp>
|
#include <Nazara/Core/StdLogger.hpp>
|
||||||
|
|
@ -89,4 +91,14 @@
|
||||||
#include <Nazara/Core/Uuid.hpp>
|
#include <Nazara/Core/Uuid.hpp>
|
||||||
#include <Nazara/Core/VirtualDirectory.hpp>
|
#include <Nazara/Core/VirtualDirectory.hpp>
|
||||||
|
|
||||||
|
#ifdef NAZARA_ENTT
|
||||||
|
|
||||||
|
#include <Nazara/Core/AppEntitySystemComponent.hpp>
|
||||||
|
#include <Nazara/Core/Components.hpp>
|
||||||
|
#include <Nazara/Core/EnttSystemGraph.hpp>
|
||||||
|
#include <Nazara/Core/EnttWorld.hpp>
|
||||||
|
#include <Nazara/Core/Systems.hpp>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // NAZARA_GLOBAL_CORE_HPP
|
#endif // NAZARA_GLOBAL_CORE_HPP
|
||||||
|
|
|
||||||
|
|
@ -10,25 +10,19 @@
|
||||||
#include <Nazara/Prerequisites.hpp>
|
#include <Nazara/Prerequisites.hpp>
|
||||||
#include <Nazara/Core/ApplicationComponent.hpp>
|
#include <Nazara/Core/ApplicationComponent.hpp>
|
||||||
#include <Nazara/Core/Config.hpp>
|
#include <Nazara/Core/Config.hpp>
|
||||||
#include <Nazara/Core/Systems/SystemGraph.hpp>
|
#include <Nazara/Core/EntityWorld.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
class NAZARA_CORE_API AppEntitySystemComponent : public ApplicationComponent
|
class NAZARA_CORE_API AppEntitySystemComponent : public ApplicationComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline AppEntitySystemComponent(ApplicationBase& app);
|
using ApplicationComponent::ApplicationComponent;
|
||||||
AppEntitySystemComponent(const AppEntitySystemComponent&) = delete;
|
AppEntitySystemComponent(const AppEntitySystemComponent&) = delete;
|
||||||
AppEntitySystemComponent(AppEntitySystemComponent&&) = delete;
|
AppEntitySystemComponent(AppEntitySystemComponent&&) = delete;
|
||||||
~AppEntitySystemComponent() = default;
|
~AppEntitySystemComponent() = default;
|
||||||
|
|
||||||
template<typename T, typename... Args> T& AddSystem(Args&&... args);
|
template<typename T, typename... Args> T& AddWorld(Args&&... args);
|
||||||
|
|
||||||
entt::handle CreateEntity();
|
|
||||||
|
|
||||||
entt::registry& GetRegistry();
|
|
||||||
const entt::registry& GetRegistry() const;
|
|
||||||
template<typename T> T& GetSystem() const;
|
|
||||||
|
|
||||||
void Update(Time elapsedTime) override;
|
void Update(Time elapsedTime) override;
|
||||||
|
|
||||||
|
|
@ -36,8 +30,7 @@ namespace Nz
|
||||||
AppEntitySystemComponent& operator=(AppEntitySystemComponent&&) = delete;
|
AppEntitySystemComponent& operator=(AppEntitySystemComponent&&) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
entt::registry m_registry;
|
std::vector<std::unique_ptr<EntityWorld>> m_worlds;
|
||||||
SystemGraph m_systemGraph;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,37 +7,10 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
inline AppEntitySystemComponent::AppEntitySystemComponent(ApplicationBase& app) :
|
|
||||||
ApplicationComponent(app),
|
|
||||||
m_systemGraph(m_registry)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, typename... Args>
|
template<typename T, typename... Args>
|
||||||
T& AppEntitySystemComponent::AddSystem(Args&&... args)
|
T& AppEntitySystemComponent::AddWorld(Args&&... args)
|
||||||
{
|
{
|
||||||
return m_systemGraph.AddSystem<T>(std::forward<Args>(args)...);
|
return static_cast<T&>(*m_worlds.emplace_back(std::make_unique<T>(std::forward<Args>(args)...)));
|
||||||
}
|
|
||||||
|
|
||||||
inline entt::handle AppEntitySystemComponent::CreateEntity()
|
|
||||||
{
|
|
||||||
return entt::handle(m_registry, m_registry.create());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline entt::registry& AppEntitySystemComponent::GetRegistry()
|
|
||||||
{
|
|
||||||
return m_registry;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const entt::registry& AppEntitySystemComponent::GetRegistry() const
|
|
||||||
{
|
|
||||||
return m_registry;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T& AppEntitySystemComponent::GetSystem() const
|
|
||||||
{
|
|
||||||
return m_systemGraph.GetSystem<T>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Core module
|
Nazara Engine - Core module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CORE_ENTITYWORLD_HPP
|
||||||
|
#define NAZARA_CORE_ENTITYWORLD_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequisites.hpp>
|
||||||
|
#include <Nazara/Core/Config.hpp>
|
||||||
|
#include <Nazara/Core/Time.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
class NAZARA_CORE_API EntityWorld
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EntityWorld() = default;
|
||||||
|
EntityWorld(const EntityWorld&) = default;
|
||||||
|
EntityWorld(EntityWorld&&) = default;
|
||||||
|
virtual ~EntityWorld();
|
||||||
|
|
||||||
|
virtual void Update(Time elapsedTime) = 0;
|
||||||
|
|
||||||
|
EntityWorld& operator=(const EntityWorld&) = default;
|
||||||
|
EntityWorld& operator=(EntityWorld&&) = default;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <Nazara/Core/EntityWorld.inl>
|
||||||
|
|
||||||
|
#endif // NAZARA_CORE_ENTITYWORLD_HPP
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#include <Nazara/Core/EntityWorld.hpp>
|
||||||
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <Nazara/Core/DebugOff.hpp>
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef NAZARA_CORE_SYSTEMS_SYSTEMGRAPH_HPP
|
#ifndef NAZARA_CORE_ENTTSYSTEMGRAPH_HPP
|
||||||
#define NAZARA_CORE_SYSTEMS_SYSTEMGRAPH_HPP
|
#define NAZARA_CORE_ENTTSYSTEMGRAPH_HPP
|
||||||
|
|
||||||
#include <Nazara/Prerequisites.hpp>
|
#include <Nazara/Prerequisites.hpp>
|
||||||
#include <Nazara/Core/Clock.hpp>
|
#include <Nazara/Core/Clock.hpp>
|
||||||
|
|
@ -18,13 +18,13 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
class NAZARA_CORE_API SystemGraph
|
class NAZARA_CORE_API EnttSystemGraph
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline SystemGraph(entt::registry& registry);
|
inline EnttSystemGraph(entt::registry& registry);
|
||||||
SystemGraph(const SystemGraph&) = delete;
|
EnttSystemGraph(const EnttSystemGraph&) = delete;
|
||||||
SystemGraph(SystemGraph&&) = delete;
|
EnttSystemGraph(EnttSystemGraph&&) = delete;
|
||||||
~SystemGraph() = default;
|
~EnttSystemGraph() = default;
|
||||||
|
|
||||||
template<typename T, typename... Args> T& AddSystem(Args&&... args);
|
template<typename T, typename... Args> T& AddSystem(Args&&... args);
|
||||||
|
|
||||||
|
|
@ -33,8 +33,8 @@ namespace Nz
|
||||||
void Update();
|
void Update();
|
||||||
void Update(Time elapsedTime);
|
void Update(Time elapsedTime);
|
||||||
|
|
||||||
SystemGraph& operator=(const SystemGraph&) = delete;
|
EnttSystemGraph& operator=(const EnttSystemGraph&) = delete;
|
||||||
SystemGraph& operator=(SystemGraph&&) = delete;
|
EnttSystemGraph& operator=(EnttSystemGraph&&) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct NAZARA_CORE_API NodeBase
|
struct NAZARA_CORE_API NodeBase
|
||||||
|
|
@ -65,6 +65,6 @@ namespace Nz
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <Nazara/Core/Systems/SystemGraph.inl>
|
#include <Nazara/Core/EnttSystemGraph.inl>
|
||||||
|
|
||||||
#endif // NAZARA_CORE_SYSTEMS_SYSTEMGRAPH_HPP
|
#endif // NAZARA_CORE_ENTTSYSTEMGRAPH_HPP
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Core/Systems/SystemGraph.hpp>
|
#include <Nazara/Core/EnttSystemGraph.hpp>
|
||||||
#include <Nazara/Core/Error.hpp>
|
#include <Nazara/Core/Error.hpp>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <Nazara/Core/Debug.hpp>
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
@ -12,44 +12,44 @@ namespace Nz
|
||||||
namespace Detail
|
namespace Detail
|
||||||
{
|
{
|
||||||
template<typename, typename = void>
|
template<typename, typename = void>
|
||||||
struct SystemGraphAllowConcurrent : std::bool_constant<true> {};
|
struct EnttSystemGraphAllowConcurrent : std::bool_constant<true> {};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct SystemGraphAllowConcurrent<T, std::void_t<decltype(T::AllowConcurrent)>> : std::bool_constant<T::AllowConcurrent> {};
|
struct EnttSystemGraphAllowConcurrent<T, std::void_t<decltype(T::AllowConcurrent)>> : std::bool_constant<T::AllowConcurrent> {};
|
||||||
|
|
||||||
template<typename, typename = void>
|
template<typename, typename = void>
|
||||||
struct SystemGraphExecutionOrder : std::integral_constant<Int64, 0> {};
|
struct EnttSystemGraphExecutionOrder : std::integral_constant<Int64, 0> {};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct SystemGraphExecutionOrder<T, std::void_t<decltype(T::ExecutionOrder)>> : std::integral_constant<Int64, T::ExecutionOrder> {};
|
struct EnttSystemGraphExecutionOrder<T, std::void_t<decltype(T::ExecutionOrder)>> : std::integral_constant<Int64, T::ExecutionOrder> {};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
SystemGraph::Node<T>::Node(Args&&... args) :
|
EnttSystemGraph::Node<T>::Node(Args&&... args) :
|
||||||
system(std::forward<Args>(args)...)
|
system(std::forward<Args>(args)...)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void SystemGraph::Node<T>::Update(Time elapsedTime)
|
void EnttSystemGraph::Node<T>::Update(Time elapsedTime)
|
||||||
{
|
{
|
||||||
system.Update(elapsedTime);
|
system.Update(elapsedTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline SystemGraph::SystemGraph(entt::registry& registry) :
|
inline EnttSystemGraph::EnttSystemGraph(entt::registry& registry) :
|
||||||
m_registry(registry),
|
m_registry(registry),
|
||||||
m_systemOrderUpdated(true)
|
m_systemOrderUpdated(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename... Args>
|
template<typename T, typename... Args>
|
||||||
T& SystemGraph::AddSystem(Args&&... args)
|
T& EnttSystemGraph::AddSystem(Args&&... args)
|
||||||
{
|
{
|
||||||
NazaraAssert(m_systemToNodes.find(entt::type_hash<T>()) == m_systemToNodes.end(), "this system already exists");
|
NazaraAssert(m_systemToNodes.find(entt::type_hash<T>()) == m_systemToNodes.end(), "this system already exists");
|
||||||
|
|
||||||
auto nodePtr = std::make_unique<Node<T>>(m_registry, std::forward<Args>(args)...);
|
auto nodePtr = std::make_unique<Node<T>>(m_registry, std::forward<Args>(args)...);
|
||||||
nodePtr->executionOrder = Detail::SystemGraphExecutionOrder<T>();
|
nodePtr->executionOrder = Detail::EnttSystemGraphExecutionOrder<T>();
|
||||||
|
|
||||||
T& system = nodePtr->system;
|
T& system = nodePtr->system;
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T& SystemGraph::GetSystem() const
|
T& EnttSystemGraph::GetSystem() const
|
||||||
{
|
{
|
||||||
auto it = m_systemToNodes.find(entt::type_hash<T>());
|
auto it = m_systemToNodes.find(entt::type_hash<T>());
|
||||||
if (it == m_systemToNodes.end())
|
if (it == m_systemToNodes.end())
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CORE_ENTTWORLD_HPP
|
||||||
|
#define NAZARA_CORE_ENTTWORLD_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequisites.hpp>
|
||||||
|
#include <Nazara/Core/ApplicationComponent.hpp>
|
||||||
|
#include <Nazara/Core/EntityWorld.hpp>
|
||||||
|
#include <Nazara/Core/EnttSystemGraph.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
class NAZARA_CORE_API EnttWorld : public EntityWorld
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EnttWorld();
|
||||||
|
EnttWorld(const EnttWorld&) = default;
|
||||||
|
EnttWorld(EnttWorld&&) = default;
|
||||||
|
~EnttWorld() = default;
|
||||||
|
|
||||||
|
template<typename T, typename... Args> T& AddSystem(Args&&... args);
|
||||||
|
|
||||||
|
entt::handle CreateEntity();
|
||||||
|
|
||||||
|
entt::registry& GetRegistry();
|
||||||
|
const entt::registry& GetRegistry() const;
|
||||||
|
template<typename T> T& GetSystem() const;
|
||||||
|
|
||||||
|
void Update(Time elapsedTime) override;
|
||||||
|
|
||||||
|
operator entt::registry&();
|
||||||
|
operator const entt::registry&() const;
|
||||||
|
|
||||||
|
EnttWorld& operator=(const EnttWorld&) = delete;
|
||||||
|
EnttWorld& operator=(EnttWorld&&) = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
entt::registry m_registry;
|
||||||
|
EnttSystemGraph m_systemGraph;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <Nazara/Core/EnttWorld.inl>
|
||||||
|
|
||||||
|
#endif // NAZARA_CORE_ENTTWORLD_HPP
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#include <Nazara/Core/EnttWorld.hpp>
|
||||||
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
inline EnttWorld::EnttWorld() :
|
||||||
|
m_systemGraph(m_registry)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T, typename... Args>
|
||||||
|
T& EnttWorld::AddSystem(Args&&... args)
|
||||||
|
{
|
||||||
|
return m_systemGraph.AddSystem<T>(std::forward<Args>(args)...);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline entt::handle EnttWorld::CreateEntity()
|
||||||
|
{
|
||||||
|
return entt::handle(m_registry, m_registry.create());
|
||||||
|
}
|
||||||
|
|
||||||
|
inline entt::registry& EnttWorld::GetRegistry()
|
||||||
|
{
|
||||||
|
return m_registry;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const entt::registry& EnttWorld::GetRegistry() const
|
||||||
|
{
|
||||||
|
return m_registry;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
T& EnttWorld::GetSystem() const
|
||||||
|
{
|
||||||
|
return m_systemGraph.GetSystem<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline EnttWorld::operator entt::registry&()
|
||||||
|
{
|
||||||
|
return m_registry;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline EnttWorld::operator const entt::registry&() const
|
||||||
|
{
|
||||||
|
return m_registry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <Nazara/Core/DebugOff.hpp>
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Core module
|
Nazara Engine - Core module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
@ -30,6 +30,5 @@
|
||||||
#define NAZARA_CORE_SYSTEMS_HPP
|
#define NAZARA_CORE_SYSTEMS_HPP
|
||||||
|
|
||||||
#include <Nazara/Core/Systems/LifetimeSystem.hpp>
|
#include <Nazara/Core/Systems/LifetimeSystem.hpp>
|
||||||
#include <Nazara/Core/Systems/SystemGraph.hpp>
|
|
||||||
|
|
||||||
#endif // NAZARA_CORE_SYSTEMS_HPP
|
#endif // NAZARA_CORE_SYSTEMS_HPP
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Graphics module
|
Nazara Engine - Graphics module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
@ -91,4 +91,11 @@
|
||||||
#include <Nazara/Graphics/ViewerInstance.hpp>
|
#include <Nazara/Graphics/ViewerInstance.hpp>
|
||||||
#include <Nazara/Graphics/WorldInstance.hpp>
|
#include <Nazara/Graphics/WorldInstance.hpp>
|
||||||
|
|
||||||
|
#ifdef NAZARA_ENTT
|
||||||
|
|
||||||
|
#include <Nazara/Graphics/Components.hpp>
|
||||||
|
#include <Nazara/Graphics/Systems.hpp>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // NAZARA_GLOBAL_GRAPHICS_HPP
|
#endif // NAZARA_GLOBAL_GRAPHICS_HPP
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Graphics module
|
Nazara Engine - Graphics module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Graphics module
|
Nazara Engine - Graphics module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Math module
|
Nazara Engine - Math module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
||||||
Rémi "overdrivr" Bèges (remi.beges@laposte.net)
|
Rémi "overdrivr" Bèges (remi.beges@laposte.net)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Network module
|
Nazara Engine - Network module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - OpenGL renderer
|
Nazara Engine - OpenGL renderer
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - OpenGL renderer
|
Nazara Engine - OpenGL renderer
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Physics2D module
|
Nazara Engine - Physics2D module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
@ -38,4 +38,11 @@
|
||||||
#include <Nazara/Physics2D/PhysWorld2D.hpp>
|
#include <Nazara/Physics2D/PhysWorld2D.hpp>
|
||||||
#include <Nazara/Physics2D/RigidBody2D.hpp>
|
#include <Nazara/Physics2D/RigidBody2D.hpp>
|
||||||
|
|
||||||
|
#ifdef NAZARA_ENTT
|
||||||
|
|
||||||
|
#include <Nazara/Physics2D/Components.hpp>
|
||||||
|
#include <Nazara/Physics2D/Systems.hpp>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // NAZARA_GLOBAL_PHYSICS2D_HPP
|
#endif // NAZARA_GLOBAL_PHYSICS2D_HPP
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Physics2D module
|
Nazara Engine - Physics2D module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Physics2D module
|
Nazara Engine - Physics2D module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Physics3D module
|
Nazara Engine - Physics3D module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
@ -36,4 +36,11 @@
|
||||||
#include <Nazara/Physics3D/PhysWorld3D.hpp>
|
#include <Nazara/Physics3D/PhysWorld3D.hpp>
|
||||||
#include <Nazara/Physics3D/RigidBody3D.hpp>
|
#include <Nazara/Physics3D/RigidBody3D.hpp>
|
||||||
|
|
||||||
|
#ifdef NAZARA_ENTT
|
||||||
|
|
||||||
|
#include <Nazara/Physics3D/Components.hpp>
|
||||||
|
#include <Nazara/Physics3D/Systems.hpp>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // NAZARA_GLOBAL_PHYSICS3D_HPP
|
#endif // NAZARA_GLOBAL_PHYSICS3D_HPP
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Physics3D module
|
Nazara Engine - Physics3D module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Physics3D module
|
Nazara Engine - Physics3D module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Platform module
|
Nazara Engine - Platform module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Renderer module
|
Nazara Engine - Renderer module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Utility module
|
Nazara Engine - Utility module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
@ -70,4 +70,11 @@
|
||||||
#include <Nazara/Utility/VertexMapper.hpp>
|
#include <Nazara/Utility/VertexMapper.hpp>
|
||||||
#include <Nazara/Utility/VertexStruct.hpp>
|
#include <Nazara/Utility/VertexStruct.hpp>
|
||||||
|
|
||||||
|
#ifdef NAZARA_ENTT
|
||||||
|
|
||||||
|
#include <Nazara/Utility/Components.hpp>
|
||||||
|
#include <Nazara/Utility/Systems.hpp>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // NAZARA_GLOBAL_UTILITY_HPP
|
#endif // NAZARA_GLOBAL_UTILITY_HPP
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Utility module
|
Nazara Engine - Utility module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Utility module
|
Nazara Engine - Utility module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Vulkan renderer
|
Nazara Engine - Vulkan renderer
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Vulkan renderer
|
Nazara Engine - Vulkan renderer
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Widgets module
|
Nazara Engine - Widgets module
|
||||||
|
|
||||||
Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
void AppEntitySystemComponent::Update(Time elapsedTime)
|
void AppEntitySystemComponent::Update(Time elapsedTime)
|
||||||
{
|
{
|
||||||
m_systemGraph.Update(elapsedTime);
|
for (auto& worldPtr : m_worlds)
|
||||||
|
worldPtr->Update(elapsedTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#include <Nazara/Core/EntityWorld.hpp>
|
||||||
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
EntityWorld::~EntityWorld() = default;
|
||||||
|
}
|
||||||
|
|
@ -2,19 +2,19 @@
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Core/Systems/SystemGraph.hpp>
|
#include <Nazara/Core/EnttSystemGraph.hpp>
|
||||||
#include <Nazara/Core/Debug.hpp>
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
SystemGraph::NodeBase::~NodeBase() = default;
|
EnttSystemGraph::NodeBase::~NodeBase() = default;
|
||||||
|
|
||||||
void SystemGraph::Update()
|
void EnttSystemGraph::Update()
|
||||||
{
|
{
|
||||||
return Update(m_clock.Restart());
|
return Update(m_clock.Restart());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemGraph::Update(Time elapsedTime)
|
void EnttSystemGraph::Update(Time elapsedTime)
|
||||||
{
|
{
|
||||||
if (!m_systemOrderUpdated)
|
if (!m_systemOrderUpdated)
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#include <Nazara/Core/EnttWorld.hpp>
|
||||||
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
void EnttWorld::Update(Time elapsedTime)
|
||||||
|
{
|
||||||
|
m_systemGraph.Update(elapsedTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -170,7 +170,7 @@ option("unitybuild", { description = "Build the engine using unity build", defau
|
||||||
set_project("NazaraEngine")
|
set_project("NazaraEngine")
|
||||||
set_xmakever("2.7.3")
|
set_xmakever("2.7.3")
|
||||||
|
|
||||||
add_requires("chipmunk2d", "dr_wav", "efsw", "entt 3.10.1", "fmt", "frozen", "kiwisolver", "libflac", "libsdl", "minimp3", "ordered_map", "stb")
|
add_requires("chipmunk2d", "dr_wav", "efsw", "entt v3.11.1", "fmt", "frozen", "kiwisolver", "libflac", "libsdl", "minimp3", "ordered_map", "stb")
|
||||||
add_requires("freetype", { configs = { bzip2 = true, png = true, woff2 = true, zlib = true, debug = is_mode("debug") } })
|
add_requires("freetype", { configs = { bzip2 = true, png = true, woff2 = true, zlib = true, debug = is_mode("debug") } })
|
||||||
add_requires("libvorbis", { configs = { with_vorbisenc = false } })
|
add_requires("libvorbis", { configs = { with_vorbisenc = false } })
|
||||||
add_requires("openal-soft", { configs = { shared = true }})
|
add_requires("openal-soft", { configs = { shared = true }})
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ on_run(function ()
|
||||||
local paths = {}
|
local paths = {}
|
||||||
|
|
||||||
local excludedFiles = {
|
local excludedFiles = {
|
||||||
["Components.hpp"] = true,
|
["Components.hpp"] = { Define = "NAZARA_ENTT" },
|
||||||
["ConfigCheck.hpp"] = true,
|
["ConfigCheck.hpp"] = true,
|
||||||
["Debug.hpp"] = true,
|
["Debug.hpp"] = true,
|
||||||
["DebugOff.hpp"] = true,
|
["DebugOff.hpp"] = true,
|
||||||
["Systems.hpp"] = true,
|
["Systems.hpp"] = { Define = "NAZARA_ENTT" },
|
||||||
["ThreadSafety.hpp"] = true,
|
["ThreadSafety.hpp"] = true,
|
||||||
["ThreadSafetyOff.hpp"] = true
|
["ThreadSafetyOff.hpp"] = true
|
||||||
}
|
}
|
||||||
|
|
@ -73,7 +73,9 @@ on_run(function ()
|
||||||
end
|
end
|
||||||
|
|
||||||
paths["Audio"].Excludes["OpenALFunctions.hpp"] = true
|
paths["Audio"].Excludes["OpenALFunctions.hpp"] = true
|
||||||
paths["Core"].Excludes["AppEntitySystemComponent.hpp"] = true
|
paths["Core"].Excludes["AppEntitySystemComponent.hpp"] = { Define = "NAZARA_ENTT" }
|
||||||
|
paths["Core"].Excludes["EnttSystemGraph.hpp"] = { Define = "NAZARA_ENTT" }
|
||||||
|
paths["Core"].Excludes["EnttWorld.hpp"] = { Define = "NAZARA_ENTT" }
|
||||||
paths["OpenGLRenderer"].Excludes["Wrapper.hpp"] = true
|
paths["OpenGLRenderer"].Excludes["Wrapper.hpp"] = true
|
||||||
paths["VulkanRenderer"].Excludes["Wrapper.hpp"] = true
|
paths["VulkanRenderer"].Excludes["Wrapper.hpp"] = true
|
||||||
|
|
||||||
|
|
@ -127,6 +129,8 @@ on_run(function ()
|
||||||
header:write("#ifndef " .. v.HeaderGuard .. "\n")
|
header:write("#ifndef " .. v.HeaderGuard .. "\n")
|
||||||
header:write("#define " .. v.HeaderGuard .. "\n\n")
|
header:write("#define " .. v.HeaderGuard .. "\n\n")
|
||||||
|
|
||||||
|
local gatedIncludes = {}
|
||||||
|
|
||||||
local count = 0
|
local count = 0
|
||||||
for _, filePath in pairs(files) do
|
for _, filePath in pairs(files) do
|
||||||
local pathParts = path.split(filePath)
|
local pathParts = path.split(filePath)
|
||||||
|
|
@ -136,13 +140,31 @@ on_run(function ()
|
||||||
|
|
||||||
local include = table.concat(pathParts, "/")
|
local include = table.concat(pathParts, "/")
|
||||||
local fileName = path.filename(filePath)
|
local fileName = path.filename(filePath)
|
||||||
if (not v.Excludes[fileName]) then
|
|
||||||
|
local exclusion = v.Excludes[fileName]
|
||||||
|
if (not exclusion) then
|
||||||
header:write("#include <" .. include .. ">\n")
|
header:write("#include <" .. include .. ">\n")
|
||||||
count = count + 1
|
count = count + 1
|
||||||
|
elseif (type(exclusion) == "table" and exclusion.Define) then
|
||||||
|
local gatedFiles = gatedIncludes[exclusion.Define]
|
||||||
|
if not gatedFiles then
|
||||||
|
gatedFiles = {}
|
||||||
|
gatedIncludes[exclusion.Define] = gatedFiles
|
||||||
|
end
|
||||||
|
table.insert(gatedFiles, include)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
header:write("\n")
|
||||||
|
|
||||||
header:write("\n#endif // " .. v.HeaderGuard .. "\n")
|
for _, gatedDefine in ipairs(table.orderkeys(gatedIncludes)) do
|
||||||
|
header:write("#ifdef " .. gatedDefine .. "\n\n")
|
||||||
|
for _, include in ipairs(gatedIncludes[gatedDefine]) do
|
||||||
|
header:write("#include <" .. include .. ">\n")
|
||||||
|
end
|
||||||
|
header:write("\n#endif\n\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
header:write("#endif // " .. v.HeaderGuard .. "\n")
|
||||||
header:close()
|
header:close()
|
||||||
|
|
||||||
print(string.format("-#include count: %d", count))
|
print(string.format("-#include count: %d", count))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue