2022-11-17 16:47:42 +01:00
|
|
|
#include "SceneView.h"
|
|
|
|
|
#include "Actor/CameraActor.h"
|
2024-06-09 12:20:04 +02:00
|
|
|
#include "Asset/AssetRegistry.h"
|
|
|
|
|
#include "Asset/MeshAsset.h"
|
2022-11-17 16:47:42 +01:00
|
|
|
#include "Component/Camera.h"
|
2023-11-05 10:36:01 +01:00
|
|
|
#include "Component/Mesh.h"
|
2024-06-09 12:20:04 +02:00
|
|
|
#include "Graphics/Graphics.h"
|
|
|
|
|
#include "Graphics/Mesh.h"
|
|
|
|
|
#include "Scene/Scene.h"
|
|
|
|
|
#include "Window/Window.h"
|
|
|
|
|
|
2022-11-17 16:47:42 +01:00
|
|
|
|
|
|
|
|
using namespace Seele;
|
|
|
|
|
using namespace Seele::Editor;
|
|
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
SceneView::SceneView(Gfx::PGraphics graphics, PWindow owner, const ViewportCreateInfo& createInfo)
|
|
|
|
|
: View(graphics, owner, createInfo, "SceneView"), scene(new Scene(graphics)), cameraSystem(createInfo.dimensions, Vector(0, 0, 10)) {
|
2023-08-26 15:19:12 +02:00
|
|
|
cameraSystem.update(viewportCamera, static_cast<float>(Gfx::getCurrentFrameDelta()));
|
2024-04-05 10:41:59 +02:00
|
|
|
renderGraph.addPass(new DepthPrepass(graphics, scene));
|
|
|
|
|
renderGraph.addPass(new LightCullingPass(graphics, scene));
|
|
|
|
|
renderGraph.addPass(new BasePass(graphics, scene));
|
|
|
|
|
renderGraph.setViewport(viewport);
|
|
|
|
|
renderGraph.createRenderPass();
|
2022-11-17 16:47:42 +01:00
|
|
|
}
|
|
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
SceneView::~SceneView() {}
|
|
|
|
|
|
|
|
|
|
void SceneView::beginUpdate() {
|
|
|
|
|
// co_return;
|
2022-11-17 16:47:42 +01:00
|
|
|
}
|
|
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void SceneView::update() {
|
2023-08-26 15:19:12 +02:00
|
|
|
cameraSystem.update(viewportCamera, static_cast<float>(Gfx::getCurrentFrameDelta()));
|
2024-06-09 12:20:04 +02:00
|
|
|
// co_return;
|
2022-11-17 16:47:42 +01:00
|
|
|
}
|
|
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void SceneView::commitUpdate() {}
|
2022-11-17 16:47:42 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void SceneView::prepareRender() {}
|
2022-11-17 16:47:42 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void SceneView::render() { renderGraph.render(viewportCamera); }
|
2022-11-17 16:47:42 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void SceneView::keyCallback(KeyCode code, InputAction action, KeyModifier) { cameraSystem.keyCallback(code, action); }
|
2022-11-17 16:47:42 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void SceneView::mouseMoveCallback(double xPos, double yPos) { cameraSystem.mouseMoveCallback(xPos, yPos); }
|
2022-11-17 16:47:42 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void SceneView::mouseButtonCallback(MouseButton button, InputAction action, KeyModifier) {
|
2022-11-17 16:47:42 +01:00
|
|
|
cameraSystem.mouseButtonCallback(button, action);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void SceneView::scrollCallback(double, double) {}
|
2022-11-17 16:47:42 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void SceneView::fileCallback(int, const char**) {}
|