Game interface changes

This commit is contained in:
Dynamitos
2024-01-05 21:16:36 +01:00
parent 1ff3ddf9a3
commit f17f05433f
6 changed files with 6 additions and 31 deletions
-5
View File
@@ -22,11 +22,6 @@ SceneView::SceneView(Gfx::PGraphics graphics, PWindow owner, const ViewportCreat
)) ))
, cameraSystem(createInfo.dimensions, Vector(0, 0, 10)) , cameraSystem(createInfo.dimensions, Vector(0, 0, 10))
{ {
//AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Ely\\Ely.fbx");
//AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Cube\\cube.obj");
//AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Plane\\plane.fbx");
cameraSystem.update(viewportCamera, static_cast<float>(Gfx::getCurrentFrameDelta())); cameraSystem.update(viewportCamera, static_cast<float>(Gfx::getCurrentFrameDelta()));
renderGraph.updateViewport(viewport); renderGraph.updateViewport(viewport);
+1 -18
View File
@@ -53,24 +53,7 @@ void ViewportControl::update(Component::Camera& camera, float deltaTime)
{ {
moveVector += glm::vec3(0, -cameraMove, 0); moveVector += glm::vec3(0, -cameraMove, 0);
} }
position += moveVector; throw std::logic_error("Not implemented");
static float lastX, lastY;
if(mouse2)
{
float deltaX = mouseX - lastX;
float deltaY = mouseY - lastY;
yaw += deltaX / 500.f;
pitch -= deltaY / 500.f;
}
lastX = mouseX;
lastY = mouseY;
springArm = glm::normalize(
Vector(
cos(yaw) * cos(pitch),
sin(pitch),
sin(yaw) * cos(pitch)));
camera.viewMatrix = glm::lookAt(position, position + springArm, Vector(0, 1, 0));
std::cout << yaw << " " << pitch << std::endl;
} }
void ViewportControl::keyCallback(KeyCode key, InputAction action) void ViewportControl::keyCallback(KeyCode key, InputAction action)
-2
View File
@@ -33,8 +33,6 @@ struct Camera
private: private:
float yaw; float yaw;
float pitch; float pitch;
// Spring arm transform
Math::Transform relativeTransform;
Matrix4 viewMatrix; Matrix4 viewMatrix;
Vector cameraPos; Vector cameraPos;
bool bNeedsViewBuild; bool bNeedsViewBuild;
+1 -2
View File
@@ -1,14 +1,13 @@
#pragma once #pragma once
#include "Scene/Scene.h" #include "Scene/Scene.h"
#include "System/SystemGraph.h" #include "System/SystemGraph.h"
#include "Asset/AssetRegistry.h"
namespace Seele namespace Seele
{ {
class Game class Game
{ {
public: public:
Game(AssetRegistry*) {} Game() {}
virtual ~Game() {} virtual ~Game() {}
virtual void setupScene(PScene scene, PSystemGraph graph) = 0; virtual void setupScene(PScene scene, PSystemGraph graph) = 0;
}; };
@@ -17,7 +17,7 @@ Game* GameInterface::getGame()
return game; return game;
} }
void GameInterface::reload(AssetRegistry* registry) void GameInterface::reload()
{ {
if(lib != NULL) if(lib != NULL)
{ {
@@ -27,5 +27,5 @@ void GameInterface::reload(AssetRegistry* registry)
lib = LoadLibraryA(dllPath.c_str()); lib = LoadLibraryA(dllPath.c_str());
createInstance = (decltype(createInstance))GetProcAddress(lib, "createInstance"); createInstance = (decltype(createInstance))GetProcAddress(lib, "createInstance");
destroyInstance = (decltype(destroyInstance))GetProcAddress(lib, "destroyInstance"); destroyInstance = (decltype(destroyInstance))GetProcAddress(lib, "destroyInstance");
game = createInstance(registry); game = createInstance();
} }
+2 -2
View File
@@ -10,12 +10,12 @@ public:
GameInterface(std::string dllPath); GameInterface(std::string dllPath);
~GameInterface(); ~GameInterface();
Game* getGame(); Game* getGame();
void reload(AssetRegistry* registry); void reload();
private: private:
HMODULE lib = NULL; HMODULE lib = NULL;
std::string dllPath; std::string dllPath;
Game* game; Game* game;
Game* (*createInstance)(AssetRegistry*) = nullptr; Game* (*createInstance)() = nullptr;
void (*destroyInstance)(Game*) = nullptr; void (*destroyInstance)(Game*) = nullptr;
}; };
} // namespace Seele } // namespace Seele