Formatted EVERYTHING
This commit is contained in:
@@ -1,74 +1,49 @@
|
||||
#include "InspectorView.h"
|
||||
#include "Graphics/Graphics.h"
|
||||
#include "Actor/Actor.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include "Asset/FontLoader.h"
|
||||
#include "Graphics/Graphics.h"
|
||||
#include "UI/System.h"
|
||||
#include "Window/Window.h"
|
||||
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::Editor;
|
||||
|
||||
InspectorView::InspectorView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &createInfo)
|
||||
InspectorView::InspectorView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo)
|
||||
: View(graphics, std::move(window), std::move(createInfo), "InspectorView")
|
||||
//, renderGraph(RenderGraphBuilder::build(
|
||||
// UIPass(graphics),
|
||||
// TextPass(graphics)
|
||||
//))
|
||||
, uiSystem(new UI::System())
|
||||
{
|
||||
//renderGraph.updateViewport(viewport);
|
||||
//, renderGraph(RenderGraphBuilder::build(
|
||||
// UIPass(graphics),
|
||||
// TextPass(graphics)
|
||||
//))
|
||||
,
|
||||
uiSystem(new UI::System()) {
|
||||
// renderGraph.updateViewport(viewport);
|
||||
uiSystem->updateViewport(viewport);
|
||||
}
|
||||
|
||||
InspectorView::~InspectorView()
|
||||
{
|
||||
InspectorView::~InspectorView() {}
|
||||
|
||||
void InspectorView::beginUpdate() {
|
||||
// co_return;
|
||||
}
|
||||
|
||||
void InspectorView::beginUpdate()
|
||||
{
|
||||
//co_return;
|
||||
void InspectorView::update() {
|
||||
// co_return;
|
||||
}
|
||||
|
||||
void InspectorView::update()
|
||||
{
|
||||
//co_return;
|
||||
}
|
||||
void InspectorView::commitUpdate() {}
|
||||
|
||||
void InspectorView::commitUpdate()
|
||||
{
|
||||
}
|
||||
void InspectorView::prepareRender() {}
|
||||
|
||||
void InspectorView::prepareRender()
|
||||
{
|
||||
|
||||
}
|
||||
void InspectorView::render() {}
|
||||
|
||||
void InspectorView::render()
|
||||
{
|
||||
}
|
||||
void InspectorView::keyCallback(KeyCode, InputAction, KeyModifier) {}
|
||||
|
||||
void InspectorView::keyCallback(KeyCode, InputAction, KeyModifier)
|
||||
{
|
||||
|
||||
}
|
||||
void InspectorView::mouseMoveCallback(double, double) {}
|
||||
|
||||
void InspectorView::mouseMoveCallback(double, double)
|
||||
{
|
||||
|
||||
}
|
||||
void InspectorView::mouseButtonCallback(MouseButton, InputAction, KeyModifier) {}
|
||||
|
||||
void InspectorView::mouseButtonCallback(MouseButton, InputAction, KeyModifier)
|
||||
{
|
||||
|
||||
}
|
||||
void InspectorView::scrollCallback(double, double) {}
|
||||
|
||||
void InspectorView::scrollCallback(double, double)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void InspectorView::fileCallback(int, const char**)
|
||||
{
|
||||
|
||||
}
|
||||
void InspectorView::fileCallback(int, const char**) {}
|
||||
|
||||
@@ -1,38 +1,36 @@
|
||||
#pragma once
|
||||
#include "Window/View.h"
|
||||
#include "Graphics/RenderPass/RenderGraph.h"
|
||||
#include "Graphics/RenderPass/UIPass.h"
|
||||
#include "Graphics/RenderPass/TextPass.h"
|
||||
#include "Graphics/RenderPass/UIPass.h"
|
||||
#include "UI/Elements/Panel.h"
|
||||
#include "Window/View.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
|
||||
namespace Seele {
|
||||
DECLARE_REF(Actor)
|
||||
namespace Editor
|
||||
{
|
||||
class InspectorView : public View
|
||||
{
|
||||
public:
|
||||
InspectorView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &createInfo);
|
||||
namespace Editor {
|
||||
class InspectorView : public View {
|
||||
public:
|
||||
InspectorView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo);
|
||||
virtual ~InspectorView();
|
||||
|
||||
virtual void beginUpdate() override;
|
||||
virtual void update() override;
|
||||
virtual void commitUpdate() override;
|
||||
|
||||
virtual void update() override;
|
||||
virtual void commitUpdate() override;
|
||||
|
||||
virtual void prepareRender() override;
|
||||
virtual void render() override;
|
||||
void selectActor();
|
||||
protected:
|
||||
|
||||
protected:
|
||||
UI::PSystem uiSystem;
|
||||
PActor selectedActor;
|
||||
|
||||
virtual void keyCallback(KeyCode code, InputAction action, KeyModifier modifier) override;
|
||||
virtual void mouseMoveCallback(double xPos, double yPos) override;
|
||||
virtual void mouseButtonCallback(MouseButton button, InputAction action, KeyModifier modifier) override;
|
||||
virtual void scrollCallback(double xOffset, double yOffset) override;
|
||||
virtual void fileCallback(int count, const char** paths) override;
|
||||
|
||||
virtual void keyCallback(KeyCode code, InputAction action, KeyModifier modifier) override;
|
||||
virtual void mouseMoveCallback(double xPos, double yPos) override;
|
||||
virtual void mouseButtonCallback(MouseButton button, InputAction action, KeyModifier modifier) override;
|
||||
virtual void scrollCallback(double xOffset, double yOffset) override;
|
||||
virtual void fileCallback(int count, const char** paths) override;
|
||||
};
|
||||
DEFINE_REF(InspectorView)
|
||||
} // namespace Editor
|
||||
|
||||
@@ -5,35 +5,16 @@ using namespace Seele;
|
||||
using namespace Seele::Editor;
|
||||
|
||||
PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::string dllPath)
|
||||
: GameView(graphics, window, createInfo, dllPath)
|
||||
{
|
||||
}
|
||||
: GameView(graphics, window, createInfo, dllPath) {}
|
||||
|
||||
PlayView::~PlayView()
|
||||
{
|
||||
}
|
||||
PlayView::~PlayView() {}
|
||||
|
||||
void PlayView::beginUpdate()
|
||||
{
|
||||
GameView::beginUpdate();
|
||||
}
|
||||
void PlayView::beginUpdate() { GameView::beginUpdate(); }
|
||||
|
||||
void PlayView::update()
|
||||
{
|
||||
GameView::update();
|
||||
}
|
||||
void PlayView::update() { GameView::update(); }
|
||||
|
||||
void PlayView::commitUpdate()
|
||||
{
|
||||
GameView::commitUpdate();
|
||||
}
|
||||
void PlayView::commitUpdate() { GameView::commitUpdate(); }
|
||||
|
||||
void PlayView::prepareRender()
|
||||
{
|
||||
GameView::prepareRender();
|
||||
}
|
||||
void PlayView::prepareRender() { GameView::prepareRender(); }
|
||||
|
||||
void PlayView::render()
|
||||
{
|
||||
GameView::render();
|
||||
}
|
||||
void PlayView::render() { GameView::render(); }
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
#pragma once
|
||||
#include "Window/GameView.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
namespace Editor
|
||||
{
|
||||
class PlayView : public GameView
|
||||
{
|
||||
public:
|
||||
namespace Seele {
|
||||
namespace Editor {
|
||||
class PlayView : public GameView {
|
||||
public:
|
||||
PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::string dllPath);
|
||||
virtual ~PlayView();
|
||||
virtual void beginUpdate() override;
|
||||
virtual void update() override;
|
||||
virtual void commitUpdate() override;
|
||||
virtual void beginUpdate() override;
|
||||
virtual void update() override;
|
||||
virtual void commitUpdate() override;
|
||||
|
||||
virtual void prepareRender() override;
|
||||
virtual void render() override;
|
||||
private:
|
||||
virtual void prepareRender() override;
|
||||
virtual void render() override;
|
||||
|
||||
private:
|
||||
};
|
||||
DECLARE_REF(PlayView)
|
||||
} // namespace Editor
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
#include "SceneView.h"
|
||||
#include "Scene/Scene.h"
|
||||
#include "Window/Window.h"
|
||||
#include "Graphics/Mesh.h"
|
||||
#include "Graphics/Graphics.h"
|
||||
#include "Asset/MeshAsset.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include "Actor/CameraActor.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include "Asset/MeshAsset.h"
|
||||
#include "Component/Camera.h"
|
||||
#include "Component/Mesh.h"
|
||||
#include "Graphics/Graphics.h"
|
||||
#include "Graphics/Mesh.h"
|
||||
#include "Scene/Scene.h"
|
||||
#include "Window/Window.h"
|
||||
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::Editor;
|
||||
|
||||
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))
|
||||
{
|
||||
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)) {
|
||||
cameraSystem.update(viewportCamera, static_cast<float>(Gfx::getCurrentFrameDelta()));
|
||||
renderGraph.addPass(new DepthPrepass(graphics, scene));
|
||||
renderGraph.addPass(new LightCullingPass(graphics, scene));
|
||||
@@ -25,54 +23,31 @@ SceneView::SceneView(Gfx::PGraphics graphics, PWindow owner, const ViewportCreat
|
||||
renderGraph.createRenderPass();
|
||||
}
|
||||
|
||||
SceneView::~SceneView()
|
||||
{
|
||||
SceneView::~SceneView() {}
|
||||
|
||||
void SceneView::beginUpdate() {
|
||||
// co_return;
|
||||
}
|
||||
|
||||
void SceneView::beginUpdate()
|
||||
{
|
||||
//co_return;
|
||||
}
|
||||
|
||||
void SceneView::update()
|
||||
{
|
||||
void SceneView::update() {
|
||||
cameraSystem.update(viewportCamera, static_cast<float>(Gfx::getCurrentFrameDelta()));
|
||||
//co_return;
|
||||
// co_return;
|
||||
}
|
||||
|
||||
void SceneView::commitUpdate()
|
||||
{
|
||||
}
|
||||
void SceneView::commitUpdate() {}
|
||||
|
||||
void SceneView::prepareRender()
|
||||
{
|
||||
}
|
||||
void SceneView::prepareRender() {}
|
||||
|
||||
void SceneView::render()
|
||||
{
|
||||
renderGraph.render(viewportCamera);
|
||||
}
|
||||
void SceneView::render() { renderGraph.render(viewportCamera); }
|
||||
|
||||
void SceneView::keyCallback(KeyCode code, InputAction action, KeyModifier)
|
||||
{
|
||||
cameraSystem.keyCallback(code, action);
|
||||
}
|
||||
void SceneView::keyCallback(KeyCode code, InputAction action, KeyModifier) { cameraSystem.keyCallback(code, action); }
|
||||
|
||||
void SceneView::mouseMoveCallback(double xPos, double yPos)
|
||||
{
|
||||
cameraSystem.mouseMoveCallback(xPos, yPos);
|
||||
}
|
||||
void SceneView::mouseMoveCallback(double xPos, double yPos) { cameraSystem.mouseMoveCallback(xPos, yPos); }
|
||||
|
||||
void SceneView::mouseButtonCallback(MouseButton button, InputAction action, KeyModifier)
|
||||
{
|
||||
void SceneView::mouseButtonCallback(MouseButton button, InputAction action, KeyModifier) {
|
||||
cameraSystem.mouseButtonCallback(button, action);
|
||||
}
|
||||
|
||||
void SceneView::scrollCallback(double, double)
|
||||
{
|
||||
}
|
||||
void SceneView::scrollCallback(double, double) {}
|
||||
|
||||
void SceneView::fileCallback(int, const char**)
|
||||
{
|
||||
|
||||
}
|
||||
void SceneView::fileCallback(int, const char**) {}
|
||||
|
||||
@@ -1,43 +1,42 @@
|
||||
#pragma once
|
||||
#include "ThreadPool.h"
|
||||
#include "Window/View.h"
|
||||
#include "Graphics/RenderPass/BasePass.h"
|
||||
#include "Graphics/RenderPass/DepthPrepass.h"
|
||||
#include "Graphics/RenderPass/LightCullingPass.h"
|
||||
#include "Graphics/RenderPass/BasePass.h"
|
||||
#include "ThreadPool.h"
|
||||
#include "ViewportControl.h"
|
||||
#include "Window/View.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
|
||||
namespace Seele {
|
||||
DECLARE_REF(Scene)
|
||||
namespace Editor
|
||||
{
|
||||
class SceneView : public View
|
||||
{
|
||||
public:
|
||||
SceneView(Gfx::PGraphics graphics, PWindow owner, const ViewportCreateInfo &createInfo);
|
||||
~SceneView();
|
||||
namespace Editor {
|
||||
class SceneView : public View {
|
||||
public:
|
||||
SceneView(Gfx::PGraphics graphics, PWindow owner, const ViewportCreateInfo& createInfo);
|
||||
~SceneView();
|
||||
|
||||
virtual void beginUpdate() override;
|
||||
virtual void update() override;
|
||||
virtual void commitUpdate() override;
|
||||
virtual void beginUpdate() override;
|
||||
virtual void update() override;
|
||||
virtual void commitUpdate() override;
|
||||
|
||||
virtual void prepareRender() override;
|
||||
virtual void render() override;
|
||||
virtual void prepareRender() override;
|
||||
virtual void render() override;
|
||||
|
||||
PScene getScene() const { return scene; }
|
||||
private:
|
||||
OScene scene;
|
||||
Component::Camera viewportCamera;
|
||||
|
||||
RenderGraph renderGraph;
|
||||
PScene getScene() const { return scene; }
|
||||
|
||||
ViewportControl cameraSystem;
|
||||
private:
|
||||
OScene scene;
|
||||
Component::Camera viewportCamera;
|
||||
|
||||
virtual void keyCallback(KeyCode code, InputAction action, KeyModifier modifier) override;
|
||||
virtual void mouseMoveCallback(double xPos, double yPos) override;
|
||||
virtual void mouseButtonCallback(MouseButton button, InputAction action, KeyModifier modifier) override;
|
||||
virtual void scrollCallback(double xOffset, double yOffset) override;
|
||||
virtual void fileCallback(int count, const char** paths) override;
|
||||
RenderGraph renderGraph;
|
||||
|
||||
ViewportControl cameraSystem;
|
||||
|
||||
virtual void keyCallback(KeyCode code, InputAction action, KeyModifier modifier) override;
|
||||
virtual void mouseMoveCallback(double xPos, double yPos) override;
|
||||
virtual void mouseButtonCallback(MouseButton button, InputAction action, KeyModifier modifier) override;
|
||||
virtual void scrollCallback(double xOffset, double yOffset) override;
|
||||
virtual void fileCallback(int count, const char** paths) override;
|
||||
};
|
||||
DEFINE_REF(SceneView)
|
||||
} // namespace Editor
|
||||
|
||||
@@ -6,81 +6,56 @@ using namespace Seele;
|
||||
using namespace Seele::Editor;
|
||||
|
||||
ViewportControl::ViewportControl(const URect& viewportDimensions, Vector initialPos)
|
||||
: position(initialPos)
|
||||
, fieldOfView(glm::radians(70.f))
|
||||
, aspectRatio(static_cast<float>(viewportDimensions.size.x) / viewportDimensions.size.y)
|
||||
, pitch(0)
|
||||
, yaw(glm::pi<float>()/-2.0f)
|
||||
{
|
||||
: position(initialPos), fieldOfView(glm::radians(70.f)),
|
||||
aspectRatio(static_cast<float>(viewportDimensions.size.x) / viewportDimensions.size.y), pitch(0), yaw(glm::pi<float>() / -2.0f) {
|
||||
std::cout << yaw << " " << pitch << std::endl;
|
||||
}
|
||||
|
||||
ViewportControl::~ViewportControl()
|
||||
{
|
||||
|
||||
}
|
||||
ViewportControl::~ViewportControl() {}
|
||||
|
||||
void ViewportControl::update(Component::Camera& camera, float deltaTime)
|
||||
{
|
||||
void ViewportControl::update(Component::Camera& camera, float deltaTime) {
|
||||
float cameraMove = deltaTime * 20;
|
||||
if(keys[KeyCode::KEY_LEFT_SHIFT])
|
||||
{
|
||||
if (keys[KeyCode::KEY_LEFT_SHIFT]) {
|
||||
cameraMove *= 4;
|
||||
}
|
||||
Vector moveVector = Vector();
|
||||
Vector forward = glm::normalize(springArm);
|
||||
Vector side = glm::cross(Vector(0, 1, 0), forward);
|
||||
if(keys[KeyCode::KEY_W])
|
||||
{
|
||||
if (keys[KeyCode::KEY_W]) {
|
||||
moveVector += forward * cameraMove;
|
||||
}
|
||||
if(keys[KeyCode::KEY_S])
|
||||
{
|
||||
if (keys[KeyCode::KEY_S]) {
|
||||
moveVector += forward * -cameraMove;
|
||||
}
|
||||
if(keys[KeyCode::KEY_A])
|
||||
{
|
||||
if (keys[KeyCode::KEY_A]) {
|
||||
moveVector += side * cameraMove;
|
||||
}
|
||||
if(keys[KeyCode::KEY_D])
|
||||
{
|
||||
if (keys[KeyCode::KEY_D]) {
|
||||
moveVector += side * -cameraMove;
|
||||
}
|
||||
if(keys[KeyCode::KEY_E])
|
||||
{
|
||||
if (keys[KeyCode::KEY_E]) {
|
||||
moveVector += glm::vec3(0, cameraMove, 0);
|
||||
}
|
||||
if(keys[KeyCode::KEY_Q])
|
||||
{
|
||||
}
|
||||
if (keys[KeyCode::KEY_Q]) {
|
||||
moveVector += glm::vec3(0, -cameraMove, 0);
|
||||
}
|
||||
throw std::logic_error("Not implemented");
|
||||
}
|
||||
|
||||
void ViewportControl::keyCallback(KeyCode key, InputAction action)
|
||||
{
|
||||
keys[static_cast<size_t>(key)] = action != InputAction::RELEASE;
|
||||
}
|
||||
void ViewportControl::keyCallback(KeyCode key, InputAction action) { keys[static_cast<size_t>(key)] = action != InputAction::RELEASE; }
|
||||
|
||||
void ViewportControl::mouseMoveCallback(double xPos, double yPos)
|
||||
{
|
||||
void ViewportControl::mouseMoveCallback(double xPos, double yPos) {
|
||||
mouseX = static_cast<float>(xPos);
|
||||
mouseY = static_cast<float>(yPos);
|
||||
}
|
||||
|
||||
void ViewportControl::mouseButtonCallback(MouseButton button, InputAction action)
|
||||
{
|
||||
if(button == MouseButton::MOUSE_BUTTON_1)
|
||||
{
|
||||
void ViewportControl::mouseButtonCallback(MouseButton button, InputAction action) {
|
||||
if (button == MouseButton::MOUSE_BUTTON_1) {
|
||||
mouse1 = action != InputAction::RELEASE;
|
||||
}
|
||||
if(button == MouseButton::MOUSE_BUTTON_2)
|
||||
{
|
||||
if (button == MouseButton::MOUSE_BUTTON_2) {
|
||||
mouse2 = action != InputAction::RELEASE;
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportControl::viewportResize(URect dimensions)
|
||||
{
|
||||
aspectRatio = static_cast<float>(dimensions.size.x) / dimensions.size.y;
|
||||
}
|
||||
void ViewportControl::viewportResize(URect dimensions) { aspectRatio = static_cast<float>(dimensions.size.x) / dimensions.size.y; }
|
||||
|
||||
@@ -1,37 +1,36 @@
|
||||
#pragma once
|
||||
#include "MinimalEngine.h"
|
||||
#include "Math/Vector.h"
|
||||
#include "Component/Camera.h"
|
||||
#include "Math/Math.h"
|
||||
#include "Graphics/Enums.h"
|
||||
#include "Containers/Array.h"
|
||||
#include "Graphics/Enums.h"
|
||||
#include "Math/Math.h"
|
||||
#include "Math/Vector.h"
|
||||
#include "MinimalEngine.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
namespace Editor
|
||||
{
|
||||
class ViewportControl
|
||||
{
|
||||
public:
|
||||
ViewportControl(const URect& viewportDimensions, Vector initialPos /*TODO: configurable initial rotations*/);
|
||||
~ViewportControl();
|
||||
void update(Component::Camera& camera, float deltaTime);
|
||||
void keyCallback(KeyCode key, InputAction action);
|
||||
void mouseMoveCallback(double xPos, double yPos);
|
||||
void mouseButtonCallback(MouseButton button, InputAction action);
|
||||
void viewportResize(URect dimensions);
|
||||
private:
|
||||
Vector position;
|
||||
Vector springArm;
|
||||
float fieldOfView;
|
||||
float aspectRatio;
|
||||
StaticArray<bool, static_cast<size_t>(KeyCode::KEY_LAST)> keys;
|
||||
bool mouse1 = false;
|
||||
bool mouse2 = false;
|
||||
float mouseX;
|
||||
float mouseY;
|
||||
float pitch;
|
||||
float yaw;
|
||||
};
|
||||
|
||||
namespace Seele {
|
||||
namespace Editor {
|
||||
class ViewportControl {
|
||||
public:
|
||||
ViewportControl(const URect& viewportDimensions, Vector initialPos /*TODO: configurable initial rotations*/);
|
||||
~ViewportControl();
|
||||
void update(Component::Camera& camera, float deltaTime);
|
||||
void keyCallback(KeyCode key, InputAction action);
|
||||
void mouseMoveCallback(double xPos, double yPos);
|
||||
void mouseButtonCallback(MouseButton button, InputAction action);
|
||||
void viewportResize(URect dimensions);
|
||||
|
||||
private:
|
||||
Vector position;
|
||||
Vector springArm;
|
||||
float fieldOfView;
|
||||
float aspectRatio;
|
||||
StaticArray<bool, static_cast<size_t>(KeyCode::KEY_LAST)> keys;
|
||||
bool mouse1 = false;
|
||||
bool mouse2 = false;
|
||||
float mouseX;
|
||||
float mouseY;
|
||||
float pitch;
|
||||
float yaw;
|
||||
};
|
||||
} // namespace Editor
|
||||
} // namespace Seele
|
||||
|
||||
Reference in New Issue
Block a user