refactor: extract ecs out of engine
This commit is contained in:
		
							parent
							
								
									9706ff96e1
								
							
						
					
					
						commit
						03e8e11111
					
				
					 28 changed files with 38 additions and 46 deletions
				
			
		| 
						 | 
					@ -11,6 +11,7 @@ add_subdirectory(./input)
 | 
				
			||||||
add_subdirectory(./ui)
 | 
					add_subdirectory(./ui)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_subdirectory(./renderer)
 | 
					add_subdirectory(./renderer)
 | 
				
			||||||
 | 
					add_subdirectory(./ecs)
 | 
				
			||||||
add_subdirectory(./engine)
 | 
					add_subdirectory(./engine)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_subdirectory(./mirror)
 | 
					add_subdirectory(./mirror)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								modules/ecs/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								modules/ecs/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					add_library_module(ecs entity.cpp scene.cpp uuid.cpp)
 | 
				
			||||||
 | 
					target_link_libraries(ecs PUBLIC logger lt_debug EnTT::EnTT renderer input camera)
 | 
				
			||||||
							
								
								
									
										6
									
								
								modules/ecs/include/ecs/components.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								modules/ecs/include/ecs/components.hpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,6 @@
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <ecs/components/native_script.hpp>
 | 
				
			||||||
 | 
					#include <ecs/components/sprite_renderer.hpp>
 | 
				
			||||||
 | 
					#include <ecs/components/tag.hpp>
 | 
				
			||||||
 | 
					#include <ecs/components/transform.hpp>
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <ecs/components/scriptable_entity.hpp>
 | 
				
			||||||
#include <engine/scene/components/scriptable_entity.hpp>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <ecs/entity.hpp>
 | 
				
			||||||
#include <engine/scene/entity.hpp>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,5 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <glm/glm.hpp>
 | 
					#include <glm/glm.hpp>
 | 
				
			||||||
#include <utility>
 | 
					#include <utility>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,5 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <utility>
 | 
					#include <utility>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define GLM_ENABLE_EXPERIMENTAL
 | 
					#define GLM_ENABLE_EXPERIMENTAL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <glm/glm.hpp>
 | 
					#include <glm/glm.hpp>
 | 
				
			||||||
#include <glm/gtc/matrix_transform.hpp>
 | 
					#include <glm/gtc/matrix_transform.hpp>
 | 
				
			||||||
#include <glm/gtx/transform.hpp>
 | 
					#include <glm/gtx/transform.hpp>
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <ecs/uuid.hpp>
 | 
				
			||||||
#include <engine/core/uuid.hpp>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,7 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <ecs/components/uuid.hpp>
 | 
				
			||||||
#include <engine/scene/components/uuid.hpp>
 | 
					#include <ecs/scene.hpp>
 | 
				
			||||||
#include <engine/scene/scene.hpp>
 | 
					 | 
				
			||||||
#include <entt/entt.hpp>
 | 
					#include <entt/entt.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,7 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <ecs/components/transform.hpp>
 | 
				
			||||||
#include <engine/core/uuid.hpp>
 | 
					#include <ecs/uuid.hpp>
 | 
				
			||||||
#include <engine/scene/components/transform.hpp>
 | 
					 | 
				
			||||||
#include <entt/entt.hpp>
 | 
					#include <entt/entt.hpp>
 | 
				
			||||||
#include <glm/glm.hpp>
 | 
					#include <glm/glm.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
#include <engine/scene/entity.hpp>
 | 
					#include <ecs/entity.hpp>
 | 
				
			||||||
#include <engine/scene/scene.hpp>
 | 
					#include <ecs/scene.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
#include <camera/component.hpp>
 | 
					#include <camera/component.hpp>
 | 
				
			||||||
#include <engine/scene/components.hpp>
 | 
					#include <ecs/components.hpp>
 | 
				
			||||||
#include <engine/scene/entity.hpp>
 | 
					#include <ecs/entity.hpp>
 | 
				
			||||||
#include <engine/scene/scene.hpp>
 | 
					#include <ecs/scene.hpp>
 | 
				
			||||||
#include <glm/glm.hpp>
 | 
					#include <glm/glm.hpp>
 | 
				
			||||||
#include <renderer/renderer.hpp>
 | 
					#include <renderer/renderer.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
#include <engine/core/uuid.hpp>
 | 
					#include <ecs/uuid.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,28 +1,22 @@
 | 
				
			||||||
if(NOT WIN32)
 | 
					if(NOT WIN32)
 | 
				
			||||||
    add_library_module(engine 
 | 
					    add_library_module(engine 
 | 
				
			||||||
        core/application.cpp
 | 
					        core/application.cpp
 | 
				
			||||||
        core/uuid.cpp
 | 
					 | 
				
			||||||
        debug/exceptions.cpp
 | 
					        debug/exceptions.cpp
 | 
				
			||||||
        debug/instrumentor.cpp
 | 
					        debug/instrumentor.cpp
 | 
				
			||||||
        layer/layer.cpp
 | 
					        layer/layer.cpp
 | 
				
			||||||
        layer/layer_stack.cpp
 | 
					        layer/layer_stack.cpp
 | 
				
			||||||
        os/linux/l_window.cpp
 | 
					        os/linux/l_window.cpp
 | 
				
			||||||
        scene/entity.cpp
 | 
					 | 
				
			||||||
        scene/scene.cpp
 | 
					 | 
				
			||||||
        time/timer.cpp
 | 
					        time/timer.cpp
 | 
				
			||||||
        utils/serializer.cpp
 | 
					        utils/serializer.cpp
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
else()
 | 
					else()
 | 
				
			||||||
    add_library_module(engine 
 | 
					    add_library_module(engine 
 | 
				
			||||||
        core/application.cpp
 | 
					        core/application.cpp
 | 
				
			||||||
        core/uuid.cpp
 | 
					 | 
				
			||||||
        debug/exceptions.cpp
 | 
					        debug/exceptions.cpp
 | 
				
			||||||
        debug/instrumentor.cpp
 | 
					        debug/instrumentor.cpp
 | 
				
			||||||
        layer/layer.cpp
 | 
					        layer/layer.cpp
 | 
				
			||||||
        layer/layer_stack.cpp
 | 
					        layer/layer_stack.cpp
 | 
				
			||||||
        os/windows/w_window.cpp
 | 
					        os/windows/w_window.cpp
 | 
				
			||||||
        scene/entity.cpp
 | 
					 | 
				
			||||||
        scene/scene.cpp
 | 
					 | 
				
			||||||
        time/timer.cpp
 | 
					        time/timer.cpp
 | 
				
			||||||
        utils/serializer.cpp
 | 
					        utils/serializer.cpp
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
| 
						 | 
					@ -41,4 +35,5 @@ target_link_libraries(
 | 
				
			||||||
  PUBLIC yaml-cpp::yaml-cpp
 | 
					  PUBLIC yaml-cpp::yaml-cpp
 | 
				
			||||||
  PUBLIC EnTT::EnTT
 | 
					  PUBLIC EnTT::EnTT
 | 
				
			||||||
  PUBLIC lt_debug 
 | 
					  PUBLIC lt_debug 
 | 
				
			||||||
 | 
					  PUBLIC ecs 
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,11 +26,6 @@
 | 
				
			||||||
// third party
 | 
					// third party
 | 
				
			||||||
#include <imgui.h>
 | 
					#include <imgui.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// scene
 | 
					 | 
				
			||||||
#include <engine/scene/components.hpp>
 | 
					 | 
				
			||||||
#include <engine/scene/entity.hpp>
 | 
					 | 
				
			||||||
#include <engine/scene/scene.hpp>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// entry point
 | 
					// entry point
 | 
				
			||||||
#ifdef LIGHT_ENTRY_POINT
 | 
					#ifdef LIGHT_ENTRY_POINT
 | 
				
			||||||
	#include <engine/core/entrypoint.hpp>
 | 
						#include <engine/core/entrypoint.hpp>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +0,0 @@
 | 
				
			||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <engine/scene/components/native_script.hpp>
 | 
					 | 
				
			||||||
#include <engine/scene/components/sprite_renderer.hpp>
 | 
					 | 
				
			||||||
#include <engine/scene/components/tag.hpp>
 | 
					 | 
				
			||||||
#include <engine/scene/components/transform.hpp>
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,8 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <engine/scene/entity.hpp>
 | 
					#include <ecs/entity.hpp>
 | 
				
			||||||
#include <engine/scene/scene.hpp>
 | 
					#include <ecs/scene.hpp>
 | 
				
			||||||
#include <yaml-cpp/yaml.h>
 | 
					#include <yaml-cpp/yaml.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
#include <asset_manager/asset_manager.hpp>
 | 
					#include <asset_manager/asset_manager.hpp>
 | 
				
			||||||
#include <camera/component.hpp>
 | 
					#include <camera/component.hpp>
 | 
				
			||||||
#include <engine/scene/components.hpp>
 | 
					#include <ecs/components.hpp>
 | 
				
			||||||
#include <engine/utils/serializer.hpp>
 | 
					#include <engine/utils/serializer.hpp>
 | 
				
			||||||
#include <renderer/texture.hpp>
 | 
					#include <renderer/texture.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Scene;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class EditorLayer: public Layer
 | 
					class EditorLayer: public Layer
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,6 +6,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Scene;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class AssetBrowserPanel: public Panel
 | 
					class AssetBrowserPanel: public Panel
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <engine/scene/entity.hpp>
 | 
					#include <ecs/entity.hpp>
 | 
				
			||||||
#include <mirror/panel/panel.hpp>
 | 
					#include <mirror/panel/panel.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,8 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <engine/scene/entity.hpp>
 | 
					#include <ecs/entity.hpp>
 | 
				
			||||||
#include <engine/scene/scene.hpp>
 | 
					#include <ecs/scene.hpp>
 | 
				
			||||||
#include <mirror/panel/panel.hpp>
 | 
					#include <mirror/panel/panel.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,7 @@
 | 
				
			||||||
#include <asset_manager/asset_manager.hpp>
 | 
					#include <asset_manager/asset_manager.hpp>
 | 
				
			||||||
#include <camera/component.hpp>
 | 
					#include <camera/component.hpp>
 | 
				
			||||||
 | 
					#include <ecs/components.hpp>
 | 
				
			||||||
 | 
					#include <ecs/scene.hpp>
 | 
				
			||||||
#include <engine/utils/serializer.hpp>
 | 
					#include <engine/utils/serializer.hpp>
 | 
				
			||||||
#include <input/key_codes.hpp>
 | 
					#include <input/key_codes.hpp>
 | 
				
			||||||
#include <mirror/editor_layer.hpp>
 | 
					#include <mirror/editor_layer.hpp>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
#include <asset_manager/asset_manager.hpp>
 | 
					#include <asset_manager/asset_manager.hpp>
 | 
				
			||||||
 | 
					#include <ecs/scene.hpp>
 | 
				
			||||||
#include <engine/engine.hpp>
 | 
					#include <engine/engine.hpp>
 | 
				
			||||||
#include <engine/utils/serializer.hpp>
 | 
					#include <engine/utils/serializer.hpp>
 | 
				
			||||||
#include <imgui.h>
 | 
					#include <imgui.h>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
#include <asset_manager/asset_manager.hpp>
 | 
					#include <asset_manager/asset_manager.hpp>
 | 
				
			||||||
#include <camera/component.hpp>
 | 
					#include <camera/component.hpp>
 | 
				
			||||||
#include <engine/scene/components.hpp>
 | 
					#include <ecs/components.hpp>
 | 
				
			||||||
#include <glm/glm.hpp>
 | 
					#include <glm/glm.hpp>
 | 
				
			||||||
#include <glm/gtc/type_ptr.hpp>
 | 
					#include <glm/gtc/type_ptr.hpp>
 | 
				
			||||||
#include <imgui.h>
 | 
					#include <imgui.h>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
#include <engine/scene/components.hpp>
 | 
					#include <ecs/components.hpp>
 | 
				
			||||||
#include <entt/entt.hpp>
 | 
					#include <entt/entt.hpp>
 | 
				
			||||||
#include <imgui.h>
 | 
					#include <imgui.h>
 | 
				
			||||||
#include <mirror/panel/properties.hpp>
 | 
					#include <mirror/panel/properties.hpp>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue