assimp and ECS, also renderpass? not really tho

This commit is contained in:
Ben Kyd
2025-06-28 23:11:16 +01:00
parent 0db51249ea
commit 8e713e38e6
26 changed files with 160 additions and 93 deletions

6
.gitmodules vendored
View File

@@ -1,3 +1,9 @@
[submodule "Aeon/ThirdParty/entt"]
path = Aeon/ThirdParty/entt
url = https://github.com/skypjack/entt
[submodule "Aeon/ThirdParty/assimp"]
path = Aeon/ThirdParty/assimp
url = https://github.com/assimp/assimp
[submodule "Aeon/ThirdParty/Yolo"]
path = Aeon/ThirdParty/Yolo
url = git@github.com:benkyd/Yolo

View File

@@ -1,7 +1,6 @@
#include "Aeon.hpp"
#include <Aeon/Includes.hpp>
#include <Aeon/Rendering/ImGui.hpp>
using Core::App;
@@ -11,9 +10,7 @@ using Core::DisplayProperties;
using Input::InputController;
App::App(const AppProperties& props, const DisplayProperties& dispProps)
: mDisplay()
, mInput(InputController::GetInstance())
, mEntityController( )
: mDisplay(), mInput(InputController::GetInstance()), mEntityRegistry()
{
PushThisAsSink("ENGINE_DISPLAY_CORE");
@@ -67,6 +64,11 @@ const Display& App::GetDisplay()
return mDisplay;
}
EC::Registry& App::GetEntityRegistry()
{
return mEntityRegistry;
}
void App::PushLayer(GameLayer* layer)
{
mGameLayers.push_back(layer);
@@ -82,7 +84,6 @@ void App::PushDebugLayer( GameLayer* layer )
mDebugLayers.push_back(layer);
}
bool App::EventRecieved(GenericEvent& e)
{
if (e.Type == "DISPLAY_CLOSED")

View File

@@ -26,7 +26,7 @@ public:
void Run();
const Display& GetDisplay();
const EC::
EC::Registry& GetEntityRegistry();
// Layers, once assigned, until poped are assumed to
// never change their spot in the layer hierarchy
@@ -44,7 +44,7 @@ public:
private:
Display mDisplay;
EC::registry mEntityRegistry;
EC::Registry mEntityRegistry;
Input::InputController& mInput;
// Game layers from z order

0
Aeon/Assets.cpp Normal file
View File

0
Aeon/Assets.hpp Normal file
View File

View File

@@ -1,6 +1,8 @@
#ifndef AEON_CORE_ENGINECONFIG_H_
#define AEON_CORE_ENGINECONFIG_H_
#include <Aeon/Includes.hpp>
namespace Core
{

View File

@@ -0,0 +1,16 @@
#ifndef AEON_ENTITY_CORECOMPONENTS_MESH_H_
#define AEON_ENTITY_CORECOMPONENTS_MESH_H_
#include <Aeon/Rendering/Material.hpp>
namespace EC
{
struct Material
{
MaterialHandle Handle;
};
} // namespace EC
#endif

View File

@@ -0,0 +1,16 @@
#ifndef AEON_ENTITY_CORECOMPONENTS_MESH_H_
#define AEON_ENTITY_CORECOMPONENTS_MESH_H_
#include <Aeon/Rendering/Mesh.hpp>
namespace EC
{
struct Mesh
{
MeshHandle Handle;
};
} // namespace EC
#endif

View File

@@ -9,15 +9,15 @@ namespace EC
struct Transform
{
Transform(glm::vec3 position) : position(position)
Transform(glm::vec3 position) : Position(position)
{
}
glm::vec3 position;
glm::quat rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f);
float scale = 1.0f;
glm::vec3 Position;
glm::quat Rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f);
float Scale = 1.0f;
glm::mat4 model;
glm::mat4 Model;
};
} // namespace EC

View File

@@ -1,6 +1,8 @@
#ifndef AEON_ENTITY_ENTITY_H_
#define AEON_ENTITY_ENTITY_H_
#include <Aeon/Entity/CoreComponents/Material.hpp>
#include <Aeon/Entity/CoreComponents/Mesh.hpp>
#include <Aeon/Entity/CoreComponents/Transform.hpp>
#include <entt/entity/registry.hpp>
#include <entt/entt.hpp>
@@ -14,13 +16,9 @@ using Handle = entt::handle;
template <typename... Components>
using View = entt::basic_view<entt::entity, entt::exclude_t<>, Components...>;
template <typename... Include, typename... Exclude>
using View = entt::basic_view<entt::entity, entt::exclude_t<Exclude...>, Include...>;
using Dispatcher = entt::dispatcher;
static constexpr auto null = entt::null;
} // namespace EC
#endif

View File

@@ -1,14 +1,15 @@
#ifndef AEON_INPUT_INPUT_H_
#define AEON_INPUT_INPUT_H_
#include <Aeon/Includes.hpp>
#include <Aeon/Singleton.hpp>
#include <Aeon/Core/Events.hpp>
#include <Aeon/Includes.hpp>
#include <Aeon/Singleton.hpp>
namespace Input
{
// confusing name, not part of the ecs
// could be tho
class InputController : public Helpers::Singleton<InputController>
{
public:
@@ -37,6 +38,6 @@ private:
Core::EventDispatcher mMouseEventDispatcher;
};
}
} // namespace Input
#endif

View File

@@ -0,0 +1,15 @@
#ifndef AEON_RENDERING_MATERIAL_H_
#define AEON_RENDERING_MATERIAL_H_
#include <Aeon/Includes.hpp>
#include <Aeon/Handle.hpp>
struct Material
{
};
typedef Handle MaterialHandle;
#endif

View File

@@ -0,0 +1,4 @@
#ifndef AEON_RENDERING_MESH_H_
#define AEON_RENDERING_MESH_H_
#endif

1
Aeon/ThirdParty/Yolo vendored Submodule

Submodule Aeon/ThirdParty/Yolo added at 8ea86d52d2

1
Aeon/ThirdParty/assimp vendored Submodule

Submodule Aeon/ThirdParty/assimp added at b447485c06

View File

@@ -15,6 +15,8 @@ set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL REQUIRED)
find_package(SDL2 REQUIRED)
add_subdirectory("Aeon/ThirdParty/assimp")
# Adds RESOURCES constant in C++
add_definitions(-DRESOURCES="${CMAKE_SOURCE_DIR}/resources/")
message(${CMAKE_SOURCE_DIR}/resources)
@@ -45,6 +47,8 @@ include_directories(${Aeon}
"Aeon/ThirdParty/"
"Aeon/ThirdParty/glm/"
"Aeon/ThirdParty/entt/src/"
"Aeon/ThirdParty/assimp/"
"Aeon/ThirdParty/yolo/"
${WinSDK}
${SDL2_INCLUDE_DIRS}
)
@@ -59,4 +63,5 @@ target_link_libraries(${Aeon}
${SDL2_LIBRARIES}
Threads::Threads
OpenGL::GL
assimp
)

View File

@@ -76,16 +76,17 @@ public:
ExampleGame()
: App({"Example"}, {"Game with AEON!"})
{
const auto entity = this->mEntityRegistry.create();
entity.emplace<EC::Transform>();
const auto entity = GetEntityRegistry().create();
GetEntityRegistry().emplace<EC::Transform>(entity, EC::Transform({0.0f, 0.0f, 0.0f}));
Level* level = new Level;
PushLayer((Core::GameLayer*)level);
PushDebugLayer(&debug);
DebugLayer debug;
PushDebugLayer(&debug);
Run();
delete level;
}
~ExampleGame()