diff --git a/.cache/clangd/index/Aeon.hpp.A53F5D75FC880F09.idx b/.cache/clangd/index/Aeon.hpp.A53F5D75FC880F09.idx index 91d318a..a91c8a5 100644 Binary files a/.cache/clangd/index/Aeon.hpp.A53F5D75FC880F09.idx and b/.cache/clangd/index/Aeon.hpp.A53F5D75FC880F09.idx differ diff --git a/.cache/clangd/index/Display.cpp.D92635EEBD4AE5E7.idx b/.cache/clangd/index/Display.cpp.D92635EEBD4AE5E7.idx index cab95d2..33ac161 100644 Binary files a/.cache/clangd/index/Display.cpp.D92635EEBD4AE5E7.idx and b/.cache/clangd/index/Display.cpp.D92635EEBD4AE5E7.idx differ diff --git a/.cache/clangd/index/Display.hpp.1F2BECCAA6FFFC93.idx b/.cache/clangd/index/Display.hpp.1F2BECCAA6FFFC93.idx index 1a0d251..c1afff5 100644 Binary files a/.cache/clangd/index/Display.hpp.1F2BECCAA6FFFC93.idx and b/.cache/clangd/index/Display.hpp.1F2BECCAA6FFFC93.idx differ diff --git a/.cache/clangd/index/Entity.hpp.755C0D6DF9F32090.idx b/.cache/clangd/index/Entity.hpp.755C0D6DF9F32090.idx index 43e6d18..b52b2c4 100644 Binary files a/.cache/clangd/index/Entity.hpp.755C0D6DF9F32090.idx and b/.cache/clangd/index/Entity.hpp.755C0D6DF9F32090.idx differ diff --git a/.cache/clangd/index/Events.cpp.B4EE623917FA0DA2.idx b/.cache/clangd/index/Events.cpp.B4EE623917FA0DA2.idx index 7f82dd6..616fc41 100644 Binary files a/.cache/clangd/index/Events.cpp.B4EE623917FA0DA2.idx and b/.cache/clangd/index/Events.cpp.B4EE623917FA0DA2.idx differ diff --git a/.cache/clangd/index/Events.hpp.A496277A6267D622.idx b/.cache/clangd/index/Events.hpp.A496277A6267D622.idx index 87d8b06..4ba45d3 100644 Binary files a/.cache/clangd/index/Events.hpp.A496277A6267D622.idx and b/.cache/clangd/index/Events.hpp.A496277A6267D622.idx differ diff --git a/.cache/clangd/index/ExampleGame.cpp.9EC42D6E840C2507.idx b/.cache/clangd/index/ExampleGame.cpp.9EC42D6E840C2507.idx index 6eac052..09993e3 100644 Binary files a/.cache/clangd/index/ExampleGame.cpp.9EC42D6E840C2507.idx and b/.cache/clangd/index/ExampleGame.cpp.9EC42D6E840C2507.idx differ diff --git a/.cache/clangd/index/GameLayer.hpp.2FD71740EFD654A2.idx b/.cache/clangd/index/GameLayer.hpp.2FD71740EFD654A2.idx index 4302a26..8ec0a62 100644 Binary files a/.cache/clangd/index/GameLayer.hpp.2FD71740EFD654A2.idx and b/.cache/clangd/index/GameLayer.hpp.2FD71740EFD654A2.idx differ diff --git a/.cache/clangd/index/Input.cpp.43A863BDFFD32619.idx b/.cache/clangd/index/Input.cpp.43A863BDFFD32619.idx index b1cedce..78e6df6 100644 Binary files a/.cache/clangd/index/Input.cpp.43A863BDFFD32619.idx and b/.cache/clangd/index/Input.cpp.43A863BDFFD32619.idx differ diff --git a/.gitmodules b/.gitmodules index c94900b..decf143 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/Aeon/Aeon.cpp b/Aeon/Aeon.cpp index eb77cb9..1cf9bbe 100644 --- a/Aeon/Aeon.cpp +++ b/Aeon/Aeon.cpp @@ -1,7 +1,6 @@ #include "Aeon.hpp" #include - #include using Core::App; @@ -10,85 +9,87 @@ using Core::DisplayProperties; using Input::InputController; -App::App( const AppProperties& props, const DisplayProperties& dispProps ) - : mDisplay() - , mInput(InputController::GetInstance()) - , mEntityController( ) +App::App(const AppProperties& props, const DisplayProperties& dispProps) + : mDisplay(), mInput(InputController::GetInstance()), mEntityRegistry() { - PushThisAsSink( "ENGINE_DISPLAY_CORE" ); + PushThisAsSink("ENGINE_DISPLAY_CORE"); - mDisplay.Create( dispProps ); + mDisplay.Create(dispProps); } void App::Run() { - while ( !mSIGTERM ) - { - // Should do this ONLY on update (but needs to be on main thread) - mInput.PollInput(); + while (!mSIGTERM) + { + // Should do this ONLY on update (but needs to be on main thread) + mInput.PollInput(); - // tick through game layers - for ( const auto& layer : mGameLayers ) - { - layer->FrameTick(); - } - for ( const auto& layer : mTopLayers ) - { - layer->FrameTick(); - } - for ( const auto& layer : mDebugLayers ) - { - layer->FrameTick(); - } + // tick through game layers + for (const auto& layer : mGameLayers) + { + layer->FrameTick(); + } + for (const auto& layer : mTopLayers) + { + layer->FrameTick(); + } + for (const auto& layer : mDebugLayers) + { + layer->FrameTick(); + } - // tick through game layers *but timed* - // TODO: Timed event thread (won't allow rendering) - for ( const auto& layer : mGameLayers ) - { - layer->TimeTick(); - } - for ( const auto& layer : mTopLayers ) - { - layer->TimeTick(); - } - for ( const auto& layer : mDebugLayers ) - { - layer->TimeTick(); - } + // tick through game layers *but timed* + // TODO: Timed event thread (won't allow rendering) + for (const auto& layer : mGameLayers) + { + layer->TimeTick(); + } + for (const auto& layer : mTopLayers) + { + layer->TimeTick(); + } + for (const auto& layer : mDebugLayers) + { + layer->TimeTick(); + } - mDisplay.EndFrame(); - } + mDisplay.EndFrame(); + } - mDisplay.Destroy(); + mDisplay.Destroy(); } const Display& App::GetDisplay() { - return mDisplay; + return mDisplay; } -void App::PushLayer( GameLayer* layer ) +EC::Registry& App::GetEntityRegistry() { - mGameLayers.push_back( layer ); + return mEntityRegistry; } -void App::PushTopLayer( GameLayer* layer ) +void App::PushLayer(GameLayer* layer) { - mTopLayers.push_back( layer ); + mGameLayers.push_back(layer); } -void App::PushDebugLayer( GameLayer* layer ) +void App::PushTopLayer(GameLayer* layer) { - mDebugLayers.push_back( layer ); + mTopLayers.push_back(layer); } - -bool App::EventRecieved( GenericEvent& e ) +void App::PushDebugLayer(GameLayer* layer) { - if ( e.Type == "DISPLAY_CLOSED" ) - { - mSIGTERM = true; - } - - return false; + mDebugLayers.push_back(layer); +} + +bool App::EventRecieved(GenericEvent& e) +{ + if (e.Type == "DISPLAY_CLOSED") + { + mSIGTERM = true; + } + + return false; } diff --git a/Aeon/Aeon.hpp b/Aeon/Aeon.hpp index 39150d9..cf41a29 100644 --- a/Aeon/Aeon.hpp +++ b/Aeon/Aeon.hpp @@ -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 diff --git a/Aeon/Assets.cpp b/Aeon/Assets.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Aeon/Assets.hpp b/Aeon/Assets.hpp new file mode 100644 index 0000000..e69de29 diff --git a/Aeon/Core/EngineConfig.hpp b/Aeon/Core/EngineConfig.hpp index b29c005..1ee037c 100644 --- a/Aeon/Core/EngineConfig.hpp +++ b/Aeon/Core/EngineConfig.hpp @@ -1,6 +1,8 @@ #ifndef AEON_CORE_ENGINECONFIG_H_ #define AEON_CORE_ENGINECONFIG_H_ +#include + namespace Core { diff --git a/Aeon/Entity/CoreComponents/Material.hpp b/Aeon/Entity/CoreComponents/Material.hpp new file mode 100644 index 0000000..331a6cc --- /dev/null +++ b/Aeon/Entity/CoreComponents/Material.hpp @@ -0,0 +1,16 @@ +#ifndef AEON_ENTITY_CORECOMPONENTS_MESH_H_ +#define AEON_ENTITY_CORECOMPONENTS_MESH_H_ + +#include + +namespace EC +{ + +struct Material +{ + MaterialHandle Handle; +}; + +} // namespace EC + +#endif diff --git a/Aeon/Entity/CoreComponents/Mesh.hpp b/Aeon/Entity/CoreComponents/Mesh.hpp index e69de29..2509a60 100644 --- a/Aeon/Entity/CoreComponents/Mesh.hpp +++ b/Aeon/Entity/CoreComponents/Mesh.hpp @@ -0,0 +1,16 @@ +#ifndef AEON_ENTITY_CORECOMPONENTS_MESH_H_ +#define AEON_ENTITY_CORECOMPONENTS_MESH_H_ + +#include + +namespace EC +{ + +struct Mesh +{ + MeshHandle Handle; +}; + +} // namespace EC + +#endif diff --git a/Aeon/Entity/CoreComponents/Transform.hpp b/Aeon/Entity/CoreComponents/Transform.hpp index 434a56c..eead67e 100644 --- a/Aeon/Entity/CoreComponents/Transform.hpp +++ b/Aeon/Entity/CoreComponents/Transform.hpp @@ -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 diff --git a/Aeon/Entity/Entity.hpp b/Aeon/Entity/Entity.hpp index 08ef8a8..cb50e46 100644 --- a/Aeon/Entity/Entity.hpp +++ b/Aeon/Entity/Entity.hpp @@ -1,6 +1,8 @@ #ifndef AEON_ENTITY_ENTITY_H_ #define AEON_ENTITY_ENTITY_H_ +#include +#include #include #include #include @@ -14,13 +16,9 @@ using Handle = entt::handle; template using View = entt::basic_view, Components...>; -template -using View = entt::basic_view, Include...>; - using Dispatcher = entt::dispatcher; static constexpr auto null = entt::null; - } // namespace EC #endif diff --git a/Aeon/Input/Input.hpp b/Aeon/Input/Input.hpp index fe6dec7..ec6b3c6 100644 --- a/Aeon/Input/Input.hpp +++ b/Aeon/Input/Input.hpp @@ -1,42 +1,43 @@ #ifndef AEON_INPUT_INPUT_H_ #define AEON_INPUT_INPUT_H_ -#include - -#include #include +#include +#include -namespace Input +namespace Input { +// confusing name, not part of the ecs +// could be tho class InputController : public Helpers::Singleton { public: - InputController(); - ~InputController(); + InputController(); + ~InputController(); - void PollInput(); + void PollInput(); private: - void mPollDisplay(); - void mPollMouse(); - void mPollScroll(); - void mPollClick(); - void mPollKeyboard(); - void mPollScanKeyboard(); + void mPollDisplay(); + void mPollMouse(); + void mPollScroll(); + void mPollClick(); + void mPollKeyboard(); + void mPollScanKeyboard(); private: - SDL_Event mEvent; + SDL_Event mEvent; - int mNumScancodes = 242; - const uint8_t* mKbdState; - uint16_t mModKeyState = 0x0; + int mNumScancodes = 242; + const uint8_t* mKbdState; + uint16_t mModKeyState = 0x0; - Core::EventDispatcher mDisplayEventDispatcher; - Core::EventDispatcher mKeyboardEventDispatcher; - Core::EventDispatcher mMouseEventDispatcher; + Core::EventDispatcher mDisplayEventDispatcher; + Core::EventDispatcher mKeyboardEventDispatcher; + Core::EventDispatcher mMouseEventDispatcher; }; -} +} // namespace Input #endif diff --git a/Aeon/Rendering/Material.hpp b/Aeon/Rendering/Material.hpp index e69de29..9456848 100644 --- a/Aeon/Rendering/Material.hpp +++ b/Aeon/Rendering/Material.hpp @@ -0,0 +1,15 @@ +#ifndef AEON_RENDERING_MATERIAL_H_ +#define AEON_RENDERING_MATERIAL_H_ + +#include +#include + +struct Material +{ + +}; + +typedef Handle MaterialHandle; + +#endif + diff --git a/Aeon/Rendering/RenderBackend.hpp b/Aeon/Rendering/RenderBackend.hpp index e69de29..ef9a33c 100644 --- a/Aeon/Rendering/RenderBackend.hpp +++ b/Aeon/Rendering/RenderBackend.hpp @@ -0,0 +1,4 @@ +#ifndef AEON_RENDERING_MESH_H_ +#define AEON_RENDERING_MESH_H_ + +#endif diff --git a/Aeon/ThirdParty/Yolo b/Aeon/ThirdParty/Yolo new file mode 160000 index 0000000..8ea86d5 --- /dev/null +++ b/Aeon/ThirdParty/Yolo @@ -0,0 +1 @@ +Subproject commit 8ea86d52d2b2ec2edd655ad135de56e34fd17a05 diff --git a/Aeon/ThirdParty/assimp b/Aeon/ThirdParty/assimp new file mode 160000 index 0000000..b447485 --- /dev/null +++ b/Aeon/ThirdParty/assimp @@ -0,0 +1 @@ +Subproject commit b447485c064ec79329275cbc7b10a08787032a23 diff --git a/CMakeLists.txt b/CMakeLists.txt index 04045d7..b47a2ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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,12 +47,14 @@ include_directories(${Aeon} "Aeon/ThirdParty/" "Aeon/ThirdParty/glm/" "Aeon/ThirdParty/entt/src/" + "Aeon/ThirdParty/assimp/" + "Aeon/ThirdParty/yolo/" ${WinSDK} ${SDL2_INCLUDE_DIRS} ) add_executable(${Aeon} - ${EngineSource} + ${EngineSource} ${GameSource} ) @@ -59,4 +63,5 @@ target_link_libraries(${Aeon} ${SDL2_LIBRARIES} Threads::Threads OpenGL::GL + assimp ) diff --git a/Game/ExampleGame.cpp b/Game/ExampleGame.cpp index f884f89..2490180 100644 --- a/Game/ExampleGame.cpp +++ b/Game/ExampleGame.cpp @@ -76,16 +76,17 @@ public: ExampleGame() : App({"Example"}, {"Game with AEON!"}) { - const auto entity = this->mEntityRegistry.create(); - entity.emplace(); + const auto entity = GetEntityRegistry().create(); + GetEntityRegistry().emplace(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()