2020-02-25 00:44:40 +01:00
|
|
|
#pragma once
|
2021-09-29 22:12:56 +02:00
|
|
|
#include "Graphics/RenderPass/RenderGraph.h"
|
2021-11-24 12:10:23 +01:00
|
|
|
#include "ThreadPool.h"
|
2021-09-29 22:12:56 +02:00
|
|
|
|
2020-03-02 19:07:49 +01:00
|
|
|
namespace Seele
|
2020-02-25 00:44:40 +01:00
|
|
|
{
|
2021-04-01 16:40:14 +02:00
|
|
|
DECLARE_REF(Window)
|
2021-09-29 22:12:56 +02:00
|
|
|
// A view is a part of the window, which can be anything from a scene viewport to an inspector
|
2020-04-12 15:47:19 +02:00
|
|
|
class View
|
|
|
|
|
{
|
|
|
|
|
public:
|
2021-11-13 19:28:18 +01:00
|
|
|
View(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &createInfo, std::string name);
|
2020-04-12 15:47:19 +02:00
|
|
|
virtual ~View();
|
2021-10-01 19:55:04 +02:00
|
|
|
|
|
|
|
|
// These are called from the view thread, and handle updating game data
|
2022-01-12 14:40:26 +01:00
|
|
|
virtual Job beginUpdate() = 0;
|
|
|
|
|
virtual Job update() = 0;
|
2021-10-01 19:55:04 +02:00
|
|
|
// End frame is called with a lock, so it is safe to write to shared memory
|
2021-12-02 13:00:03 +01:00
|
|
|
virtual void commitUpdate() = 0;
|
2021-10-01 19:55:04 +02:00
|
|
|
|
|
|
|
|
// These are called from the render thread
|
|
|
|
|
// prepare render is also locked, so reading from shared memory is also safe
|
2021-12-02 13:00:03 +01:00
|
|
|
virtual void prepareRender() = 0;
|
|
|
|
|
virtual MainJob render() = 0;
|
2020-05-05 01:51:13 +02:00
|
|
|
void applyArea(URect area);
|
2020-10-29 02:22:01 +01:00
|
|
|
void setFocused();
|
2020-03-02 19:07:49 +01:00
|
|
|
|
2020-04-12 15:47:19 +02:00
|
|
|
protected:
|
|
|
|
|
Gfx::PGraphics graphics;
|
2020-04-15 02:03:56 +02:00
|
|
|
Gfx::PViewport viewport;
|
|
|
|
|
PWindow owner;
|
2021-11-13 19:28:18 +01:00
|
|
|
std::string name;
|
2021-10-01 19:55:04 +02:00
|
|
|
|
2020-11-03 01:18:30 +01:00
|
|
|
virtual void keyCallback(KeyCode code, InputAction action, KeyModifier modifier) = 0;
|
|
|
|
|
virtual void mouseMoveCallback(double xPos, double yPos) = 0;
|
|
|
|
|
virtual void mouseButtonCallback(MouseButton button, InputAction action, KeyModifier modifier) = 0;
|
2021-01-19 15:30:00 +01:00
|
|
|
virtual void scrollCallback(double xOffset, double yOffset) = 0;
|
|
|
|
|
virtual void fileCallback(int count, const char** paths) = 0;
|
2020-10-29 02:22:01 +01:00
|
|
|
friend class Window;
|
2020-04-12 15:47:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DEFINE_REF(View)
|
|
|
|
|
} // namespace Seele
|