diff --git a/BarinkEngine/Include/BarinkEngine.h b/BarinkEngine/Include/BarinkEngine.h index 6471ec1..d5e15c7 100644 --- a/BarinkEngine/Include/BarinkEngine.h +++ b/BarinkEngine/Include/BarinkEngine.h @@ -15,10 +15,7 @@ #include "Scene.h" #include "PerfCounter.h" - extern void Start(); extern void Update(); extern void ImmediateGraphicsDraw(); extern void Stop(); - -extern BarinkEngine::InputManager InputSystem; \ No newline at end of file diff --git a/BarinkEngine/Include/EventSystem/EventListener.cpp b/BarinkEngine/Include/EventSystem/EventListener.cpp deleted file mode 100644 index 8e3a1ad..0000000 --- a/BarinkEngine/Include/EventSystem/EventListener.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "EventListener.h" - -void EventListener::ReceiveEvent(Event& incident) -{ -} diff --git a/BarinkEngine/Include/EventSystem/EventListener.h b/BarinkEngine/Include/EventSystem/EventListener.h index 520a564..eb23e72 100644 --- a/BarinkEngine/Include/EventSystem/EventListener.h +++ b/BarinkEngine/Include/EventSystem/EventListener.h @@ -1,8 +1,12 @@ #pragma once -#include "Event.h" #include +#include + +#include "spdlog/spdlog.h" +#include "Event.h" + class EventListener{ public: - virtual void ReceiveEvent(Event& incident); + virtual void ReceiveEvent(Event& incident) = 0 ; }; \ No newline at end of file diff --git a/BarinkEngine/Include/Graphics/Window.h b/BarinkEngine/Include/Graphics/Window.h index 9951952..5bf41ec 100644 --- a/BarinkEngine/Include/Graphics/Window.h +++ b/BarinkEngine/Include/Graphics/Window.h @@ -2,12 +2,15 @@ #define GLFW_STATIC #include +#include +#include +#include + #include -#include "../Include/EventSystem/EventListener.h" - - - +#include +#include "EventSystem/Event.h" +#include "EventSystem/EventListener.h" class BarinkWindow : EventListener { private: @@ -18,16 +21,13 @@ class BarinkWindow : EventListener { static bool InitGLFW(); - - - public: BarinkWindow(const int width, const int height); ~BarinkWindow(); GLFWwindow* windowptr(); - void ReceiveEvent(Event& incident) override; + void ReceiveEvent(Event& incident) override ; bool WindowShouldClose(); void Poll(); diff --git a/BarinkEngine/Include/Input/InputManager.h b/BarinkEngine/Include/Input/InputManager.h index 5a9e2c0..c446c45 100644 --- a/BarinkEngine/Include/Input/InputManager.h +++ b/BarinkEngine/Include/Input/InputManager.h @@ -1,7 +1,11 @@ #pragma once #include -#include "Graphics/Window.h" +#include + +#include "spdlog/spdlog.h" #include "EventSystem/EventEmitter.h" +#include "EventSystem/EventListener.h" +#include "Graphics/Window.h" namespace BarinkEngine { @@ -12,8 +16,6 @@ namespace BarinkEngine { void PollEvents(); void attach(BarinkWindow* window); - - // GLFW Handlers static void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); static void CursorPositionCallback(GLFWwindow* window, double x, double y); @@ -25,3 +27,5 @@ namespace BarinkEngine { }; } + +extern BarinkEngine::InputManager InputSystem; \ No newline at end of file diff --git a/BarinkEngine/premake5.lua b/BarinkEngine/premake5.lua index a919578..93a79fc 100644 --- a/BarinkEngine/premake5.lua +++ b/BarinkEngine/premake5.lua @@ -63,10 +63,10 @@ project "BarinkEngine" filter { "system:windows"} prebuildcommands { -- Copy shaders - "copy graphics\\shaders\\fragment.shader ..\\build\\SandboxApplication\\Debug\\test.fs", - "copy graphics\\shaders\\vertex.shader ..\\build\\SandboxApplication\\Debug\\test.vs", - "copy graphics\\shaders\\RenderSurfaceFrag.shader ..\\build\\SandboxApplication\\Debug\\RenderSurface.fs", - "copy graphics\\shaders\\RenderSurfaceVert.shader ..\\build\\SandboxApplication\\Debug\\RenderSurface.vs" + "copy src\\graphics\\shaders\\fragment.shader ..\\build\\SandboxApplication\\Debug\\test.fs", + "copy src\\graphics\\shaders\\vertex.shader ..\\build\\SandboxApplication\\Debug\\test.vs", + "copy src\\graphics\\shaders\\RenderSurfaceFrag.shader ..\\build\\SandboxApplication\\Debug\\RenderSurface.fs", + "copy src\\graphics\\shaders\\RenderSurfaceVert.shader ..\\build\\SandboxApplication\\Debug\\RenderSurface.vs" } @@ -74,10 +74,10 @@ project "BarinkEngine" filter { "system:linux" } prebuildcommands { -- Copy shaders - "cp graphics/shaders/fragment.shader ../build/SandboxApplication/Debug/test.fs", - "cp graphics/shaders/vertex.shader ../build/SandboxApplication/Debug/test.vs", - "cp graphics/shaders/RenderSurfaceFrag.shader ../build/SandboxApplication/Debug/RenderSurface.fs", - "cp graphics/shaders/RenderSurfaceVert.shader ../build/SandboxApplication/Debug/RenderSurface.vs" + "cp src/graphics/shaders/fragment.shader ../build/SandboxApplication/Debug/test.fs", + "cp src/graphics/shaders/vertex.shader ../build/SandboxApplication/Debug/test.vs", + "cp src/graphics/shaders/RenderSurfaceFrag.shader ../build/SandboxApplication/Debug/RenderSurface.fs", + "cp src/graphics/shaders/RenderSurfaceVert.shader ../build/SandboxApplication/Debug/RenderSurface.vs" } include('../ImGui') diff --git a/BarinkEngine/src/BarinkEngine.cpp b/BarinkEngine/src/BarinkEngine.cpp index a49800d..f9b5580 100644 --- a/BarinkEngine/src/BarinkEngine.cpp +++ b/BarinkEngine/src/BarinkEngine.cpp @@ -1,8 +1,6 @@ #include "BarinkEngine.h" -#include EngineStatistics* ES; -BarinkEngine::InputManager InputSystem; int main(int argc, char* argv[]) { // Setup performance sampler diff --git a/BarinkEngine/src/Graphics/ModelImporter.cpp b/BarinkEngine/src/Graphics/ModelImporter.cpp index d353059..5206439 100644 --- a/BarinkEngine/src/Graphics/ModelImporter.cpp +++ b/BarinkEngine/src/Graphics/ModelImporter.cpp @@ -13,6 +13,7 @@ BarinkEngine::SceneObject* BarinkEngine::ModelImporter::Import(const std::string std::vector meshes = processNode(currentNode, scene); + return root; } diff --git a/BarinkEngine/src/Graphics/window.cpp b/BarinkEngine/src/Graphics/window.cpp index d61153c..8460601 100644 --- a/BarinkEngine/src/Graphics/window.cpp +++ b/BarinkEngine/src/Graphics/window.cpp @@ -1,10 +1,4 @@ #include "Graphics/Window.h" -#include -#include -#include -#include -#include -#include "../Include/EventSystem/Event.h" bool BarinkWindow::InitGLFW(){ if(!glfwInit()) @@ -76,9 +70,8 @@ void BarinkWindow::SwapBuffers() glfwSwapBuffers(window); } - void BarinkWindow::ReceiveEvent(Event& incident) { std::cout << "EVENT RECEIVED: " << incident.name << std::endl; +} -} \ No newline at end of file diff --git a/BarinkEngine/src/Input/InputManager.cpp b/BarinkEngine/src/Input/InputManager.cpp index ba0f8b2..477fb1f 100644 --- a/BarinkEngine/src/Input/InputManager.cpp +++ b/BarinkEngine/src/Input/InputManager.cpp @@ -1,12 +1,12 @@ -#include "BarinkEngine.h" #include "Input/InputManager.h" -#include "GLFW/glfw3.h" -#include "spdlog/spdlog.h" -#include +BarinkEngine::InputManager InputSystem; + void BarinkEngine::InputManager::PollEvents() { for (auto it = windows.begin(); it != windows.end(); ++it) { - (*it)->Poll(); + auto window = *it; + window->Poll(); + } } diff --git a/SandboxApplication/Sandbox.cpp b/SandboxApplication/Sandbox.cpp index a031cdc..a0c66ad 100644 --- a/SandboxApplication/Sandbox.cpp +++ b/SandboxApplication/Sandbox.cpp @@ -21,7 +21,7 @@ const std::string fragmentShaderSource = "build/SandboxApplication/Debug/test.fs BarinkEngine::ModelImporter* MI = new BarinkEngine::ModelImporter(); Scene* Level1; - +// BarinkEngine::SceneObject* cube; /* * Runs once at startup * - USe to initialize the game/sandbox/demo @@ -38,8 +38,10 @@ void Start() { // Create a cube node // Load a model - // *(MI->Import("build/SandboxApplication/Debug/Models/Cube.obj")) - + //cube = MI->Import("build/SandboxApplication/Debug/Models/Cube.obj"); + + //Level1->GetRoot().addChild(*cube); + std::string groupName("Nested-Group"); auto testGroup = new Group(groupName); Level1->GetRoot().addChild( *testGroup); @@ -89,23 +91,22 @@ void Update() * NOTE: this needs to move to the renderer * Render code should not appear in the sandbox file */ - glm::mat4 projection = glm::perspective(glm::radians(cam->Zoom), (800.0f / 600.0f), 0.001f, 100.0f); + //glm::mat4 projection = glm::perspective(glm::radians(cam->Zoom), (800.0f / 600.0f), 0.001f, 100.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); shader->Use(); - shader->setUniformMat4("P", projection); - //shader->setUniformMat4("M", CalculateModelMat(Cube->transform)); + //shader->setUniformMat4("P", projection); + //shader->setUniformMat4("M", CalculateModelMat(cube->transform)); + shader->setUniformMat4("V", cam->GetViewMatrix()); - //matCube->Apply(); + + //cube->renderable->material->Apply(); + //Cube->Draw(); - //shader->setUniformMat4("M", CalculateModelMat(Cube2->transform)); - // matCube2->Apply(); - - //Cube2->Draw(); - + } /*