assimp and ECS, also renderpass? not really tho
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6
.gitmodules
vendored
6
.gitmodules
vendored
@@ -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
|
||||
|
||||
113
Aeon/Aeon.cpp
113
Aeon/Aeon.cpp
@@ -1,7 +1,6 @@
|
||||
#include "Aeon.hpp"
|
||||
|
||||
#include <Aeon/Includes.hpp>
|
||||
|
||||
#include <Aeon/Rendering/ImGui.hpp>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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
0
Aeon/Assets.cpp
Normal file
0
Aeon/Assets.hpp
Normal file
0
Aeon/Assets.hpp
Normal file
@@ -1,6 +1,8 @@
|
||||
#ifndef AEON_CORE_ENGINECONFIG_H_
|
||||
#define AEON_CORE_ENGINECONFIG_H_
|
||||
|
||||
#include <Aeon/Includes.hpp>
|
||||
|
||||
namespace Core
|
||||
{
|
||||
|
||||
|
||||
16
Aeon/Entity/CoreComponents/Material.hpp
Normal file
16
Aeon/Entity/CoreComponents/Material.hpp
Normal 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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,42 +1,43 @@
|
||||
#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
|
||||
namespace Input
|
||||
{
|
||||
|
||||
// confusing name, not part of the ecs
|
||||
// could be tho
|
||||
class InputController : public Helpers::Singleton<InputController>
|
||||
{
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#ifndef AEON_RENDERING_MESH_H_
|
||||
#define AEON_RENDERING_MESH_H_
|
||||
|
||||
#endif
|
||||
|
||||
1
Aeon/ThirdParty/Yolo
vendored
Submodule
1
Aeon/ThirdParty/Yolo
vendored
Submodule
Submodule Aeon/ThirdParty/Yolo added at 8ea86d52d2
1
Aeon/ThirdParty/assimp
vendored
Submodule
1
Aeon/ThirdParty/assimp
vendored
Submodule
Submodule Aeon/ThirdParty/assimp added at b447485c06
@@ -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
|
||||
)
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user