forked from Dynamitos/Seele
Fix miscellaneus errors
This commit is contained in:
1 parent
c5c66f8cf3
commit
803531c608
17 files changed
+146
-88
No files matched your search
@@ -1,12 +1,13 @@
|
||||
#include "PlayView.h"
|
||||
#include "Scene/Scene.h"
|
||||
#include "Window/Window.h"
|
||||
#include <fmt/format.h>
|
||||
#include <fstream>
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::string dllPath, bool useMeshCulling)
|
||||
: GameView(graphics, window, createInfo, dllPath) {
|
||||
PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, PScene scene, const ViewportCreateInfo& createInfo, bool useMeshCulling)
|
||||
: GameView(graphics, window, scene, createInfo) {
|
||||
getGlobals().useDepthCulling = useMeshCulling;
|
||||
renderTimestamp = graphics->createTimestampQuery(2, "RenderTimestamp");
|
||||
queryThread = std::thread([&]() {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
namespace Seele {
|
||||
class PlayView : public GameView {
|
||||
public:
|
||||
PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::string dllPath, bool useMeshCulling);
|
||||
PlayView(Gfx::PGraphics graphics, PWindow window, PScene scene, const ViewportCreateInfo& createInfo, bool useMeshCulling);
|
||||
virtual ~PlayView();
|
||||
virtual void beginUpdate() override;
|
||||
virtual void update() override;
|
||||
|
||||
@@ -49,7 +49,7 @@ int main(int argc, char** argv) {
|
||||
.offset = {0, 0},
|
||||
},
|
||||
};
|
||||
OGameView sceneView = new PlayView(graphics, window, sceneViewInfo, binaryPath.generic_string(), useDepthCulling);
|
||||
OGameView sceneView = new PlayView(graphics, window, new Scene(graphics), sceneViewInfo, useDepthCulling);
|
||||
sceneView->setFocused();
|
||||
|
||||
while (windowManager->isActive()) {
|
||||
|
||||
@@ -3,4 +3,6 @@ add_subdirectory(Window/)
|
||||
|
||||
target_sources(Editor
|
||||
PRIVATE
|
||||
main.cpp)
|
||||
main.cpp
|
||||
ComponentRegistry.h
|
||||
ComponentRegistry.cpp)
|
||||
@@ -7,8 +7,8 @@
|
||||
using namespace Seele;
|
||||
using namespace Seele::Editor;
|
||||
|
||||
PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::filesystem::path dllPath)
|
||||
: GameView(graphics, window, createInfo, dllPath) {}
|
||||
PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, PScene scene, const ViewportCreateInfo& createInfo)
|
||||
: GameView(graphics, window, scene, createInfo) {}
|
||||
|
||||
PlayView::~PlayView() {}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Seele {
|
||||
namespace Editor {
|
||||
class PlayView : public GameView {
|
||||
public:
|
||||
PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::filesystem::path dllPath);
|
||||
PlayView(Gfx::PGraphics graphics, PWindow window, PScene scene, const ViewportCreateInfo& createInfo);
|
||||
virtual ~PlayView();
|
||||
virtual void beginUpdate() override;
|
||||
virtual void update() override;
|
||||
|
||||
+26
-13
@@ -10,7 +10,12 @@
|
||||
#include "Material/Material.h"
|
||||
#include "Graphics/Vulkan/Graphics.h"
|
||||
#include "Graphics/StaticMeshVertexData.h"
|
||||
#include "System/SystemGraph.h"
|
||||
#include "Window/PlayView.h"
|
||||
#include "System/CameraUpdater.h"
|
||||
#include "System/FluidUpdater.h"
|
||||
#include "System/LightGather.h"
|
||||
#include "System/MeshUpdater.h"
|
||||
#include "Window/WindowManager.h"
|
||||
#include "Window/InspectorView.h"
|
||||
#include "Scene/Scene.h" // OScene/Scene - the InspectorView's entity pane needs a live scene
|
||||
@@ -136,7 +141,18 @@ int main(int argc, char** argv) {
|
||||
StaticMeshVertexData* vd = StaticMeshVertexData::getInstance();
|
||||
vd->init(graphics);
|
||||
|
||||
OWindowManager windowManager = new WindowManager();
|
||||
GameInterface gameInterface(binaryPath);
|
||||
OScene scene = new Scene(graphics);
|
||||
gameInterface.reload();
|
||||
|
||||
OSystemGraph systemGraph = new SystemGraph();
|
||||
gameInterface.getGame()->setupScene(scene, systemGraph);
|
||||
systemGraph->addSystem(new System::KeyboardInput(scene));
|
||||
systemGraph->addSystem(new System::FluidUpdater(scene));
|
||||
systemGraph->addSystem(new System::LightGather(scene));
|
||||
systemGraph->addSystem(new System::MeshUpdater(scene));
|
||||
systemGraph->addSystem(new System::CameraUpdater(scene));
|
||||
OWindowManager windowManager = new WindowManager(systemGraph);
|
||||
AssetRegistry::init(sourcePath / "Assets", graphics);
|
||||
AssetImporter::init(graphics);
|
||||
AssetImporter::importFont(FontImportArgs{
|
||||
@@ -172,18 +188,15 @@ int main(int argc, char** argv) {
|
||||
.preferredFormat = Gfx::SE_FORMAT_B8G8R8A8_SRGB,
|
||||
};
|
||||
auto window = windowManager->addWindow(graphics, mainWindowInfo);
|
||||
// ViewportCreateInfo sceneViewInfo = {
|
||||
// .dimensions =
|
||||
// {
|
||||
// .size = {1920, 1080},
|
||||
// .offset = {0, 0},
|
||||
// },
|
||||
// };
|
||||
// OGameView sceneView = new Editor::PlayView(graphics, window, sceneViewInfo, binaryPath);
|
||||
// sceneView->setFocused();
|
||||
// The windowed editor path has no pre-existing scene; the InspectorView's entity
|
||||
// pane needs one to enumerate. Create a fresh Scene on the live (windowed) device.
|
||||
OScene scene = new Scene(graphics);
|
||||
ViewportCreateInfo sceneViewInfo = {
|
||||
.dimensions =
|
||||
{
|
||||
.size = {1920, 1080},
|
||||
.offset = {0, 0},
|
||||
},
|
||||
};
|
||||
OGameView sceneView = new Editor::PlayView(graphics, window, scene, sceneViewInfo);
|
||||
sceneView->setFocused();
|
||||
OInspectorView inspectorView = new Editor::InspectorView(graphics, window,
|
||||
ViewportCreateInfo{
|
||||
.dimensions =
|
||||
|
||||
@@ -142,6 +142,10 @@ void UIPass::createRenderPass() {
|
||||
passSize = UVector2(viewport->getWidth(), viewport->getHeight());
|
||||
createRenderPass();
|
||||
}
|
||||
Gfx::RenderTargetLayout layout = Gfx::RenderTargetLayout{
|
||||
.colorAttachments = {colorAttachment},
|
||||
.depthAttachment = depthAttachment,
|
||||
};
|
||||
Array<Gfx::SubPassDependency> dependency = {
|
||||
{
|
||||
.srcSubpass = ~0U,
|
||||
|
||||
@@ -1009,7 +1009,7 @@ void Graphics::pickPhysicalDevice() {
|
||||
shaderFloatControls = true;
|
||||
}
|
||||
}
|
||||
rayTracingEnabled = rayTracingPipelineSupport && accelerationStructureSupport && hostOperationsSupport && deviceAddressSupport &&
|
||||
rayTracingEnabled = false && rayTracingPipelineSupport && accelerationStructureSupport && hostOperationsSupport && deviceAddressSupport &&
|
||||
descriptorIndexingSupport && spirv14Support && shaderFloatControls;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,25 +4,18 @@
|
||||
#include "Graphics/RenderPass/BasePass.h"
|
||||
#include "Graphics/RenderPass/CachedDepthPass.h"
|
||||
#include "Graphics/RenderPass/DepthCullingPass.h"
|
||||
#include "Graphics/RenderPass/FluidRenderPass.h"
|
||||
#include "Graphics/RenderPass/LightCullingPass.h"
|
||||
#include "Graphics/RenderPass/RayTracingPass.h"
|
||||
#include "Graphics/RenderPass/ShadowPass.h"
|
||||
#include "Graphics/RenderPass/SimulationComputePass.h"
|
||||
#include "Graphics/RenderPass/SurfaceExtractPass.h"
|
||||
#include "Graphics/RenderPass/ToneMappingPass.h"
|
||||
#include "Graphics/RenderPass/VisibilityPass.h"
|
||||
#include "System/CameraUpdater.h"
|
||||
#include "System/FluidUpdater.h"
|
||||
#include "System/LightGather.h"
|
||||
#include "System/MeshUpdater.h"
|
||||
#include "Window/Window.h"
|
||||
#include "Scene/LightEnvironment.h"
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
GameView::GameView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::filesystem::path dllPath)
|
||||
: View(graphics, window, createInfo, "Game"), graphics(graphics), scene(new Scene(graphics)), gameInterface(dllPath) {
|
||||
GameView::GameView(Gfx::PGraphics graphics, PWindow window, PScene scene, const ViewportCreateInfo& createInfo)
|
||||
: View(graphics, window, createInfo, "Game"), graphics(graphics), scene(scene) {
|
||||
reloadGame();
|
||||
renderGraph.addPass(new CachedDepthPass(graphics, scene));
|
||||
renderGraph.addPass(new DepthCullingPass(graphics, scene));
|
||||
@@ -56,7 +49,6 @@ void GameView::update() {
|
||||
for (VertexData* vd : VertexData::getList()) {
|
||||
vd->resetMeshData();
|
||||
}
|
||||
systemGraph->run(updateTime);
|
||||
scene->update(updateTime);
|
||||
for (VertexData* vd : VertexData::getList()) {
|
||||
vd->createDescriptors();
|
||||
@@ -94,29 +86,16 @@ void GameView::applyArea(URect) {
|
||||
}
|
||||
|
||||
void GameView::reloadGame() {
|
||||
gameInterface.reload();
|
||||
|
||||
systemGraph = new SystemGraph();
|
||||
gameInterface.getGame()->setupScene(scene, systemGraph);
|
||||
System::OKeyboardInput keyInput = new System::KeyboardInput(scene);
|
||||
keyboardSystem = keyInput;
|
||||
systemGraph->addSystem(std::move(keyInput));
|
||||
systemGraph->addSystem(new System::FluidUpdater(scene));
|
||||
systemGraph->addSystem(new System::LightGather(scene));
|
||||
systemGraph->addSystem(new System::MeshUpdater(scene));
|
||||
systemGraph->addSystem(new System::CameraUpdater(scene));
|
||||
}
|
||||
|
||||
void GameView::keyCallback(KeyCode code, InputAction action, KeyModifierFlags modifier) {
|
||||
keyboardSystem->keyCallback(code, action, modifier);
|
||||
}
|
||||
|
||||
void GameView::mouseMoveCallback(double xPos, double yPos) { keyboardSystem->mouseCallback(xPos, yPos); }
|
||||
void GameView::mouseMoveCallback(double xPos, double yPos) { }
|
||||
|
||||
void GameView::mouseButtonCallback(MouseButton button, InputAction action, KeyModifierFlags modifier) {
|
||||
keyboardSystem->mouseButtonCallback(button, action, modifier);
|
||||
}
|
||||
|
||||
void GameView::scrollCallback(double xScroll, double yScroll) { keyboardSystem->scrollCallback(xScroll, yScroll); }
|
||||
void GameView::scrollCallback(double xScroll, double yScroll) { }
|
||||
|
||||
void GameView::fileCallback(int, const char**) {}
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace Seele {
|
||||
class GameView : public View {
|
||||
public:
|
||||
GameView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::filesystem::path dllPath);
|
||||
GameView(Gfx::PGraphics graphics, PWindow window, PScene scene, const ViewportCreateInfo& createInfo);
|
||||
virtual ~GameView();
|
||||
virtual void beginUpdate() override;
|
||||
virtual void update() override;
|
||||
@@ -26,12 +26,10 @@ class GameView : public View {
|
||||
protected:
|
||||
virtual void applyArea(URect rect) override;
|
||||
Gfx::PGraphics graphics;
|
||||
OScene scene;
|
||||
GameInterface gameInterface;
|
||||
PScene scene;
|
||||
RenderGraph renderGraph;
|
||||
RenderGraph rayTracingGraph;
|
||||
|
||||
OSystemGraph systemGraph;
|
||||
System::PKeyboardInput keyboardSystem;
|
||||
float updateTime = 0;
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include "WindowManager.h"
|
||||
#include "Graphics/Enums.h"
|
||||
#include "Graphics/Graphics.h"
|
||||
#include "System/SystemGraph.h"
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
WindowManager::WindowManager() {}
|
||||
WindowManager::WindowManager(PSystemGraph systemGraph) : systemGraph(systemGraph) {}
|
||||
|
||||
WindowManager::~WindowManager() {}
|
||||
|
||||
@@ -18,6 +20,7 @@ void WindowManager::render() {
|
||||
window->pollInputs();
|
||||
if (window->isPaused())
|
||||
continue;
|
||||
systemGraph->run(Gfx::getCurrentFrameDelta());
|
||||
window->render();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#pragma once
|
||||
#include "Containers/Array.h"
|
||||
#include "System/SystemGraph.h"
|
||||
#include "Window.h"
|
||||
|
||||
namespace Seele {
|
||||
DECLARE_NAME_REF(Gfx, Graphics)
|
||||
class WindowManager {
|
||||
public:
|
||||
WindowManager();
|
||||
WindowManager(PSystemGraph systemGraph);
|
||||
~WindowManager();
|
||||
OWindow addWindow(Gfx::PGraphics graphics, const WindowCreateInfo& createInfo);
|
||||
void render();
|
||||
@@ -15,6 +16,7 @@ class WindowManager {
|
||||
|
||||
private:
|
||||
Array<PWindow> windows;
|
||||
PSystemGraph systemGraph;
|
||||
};
|
||||
DEFINE_REF(WindowManager)
|
||||
} // namespace Seele
|
||||
Reference in new issue
Block a user