-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathFEngine.h
96 lines (69 loc) · 2.75 KB
/
FEngine.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#pragma once
#include "Renderer\FERenderer.h"
#include "..\SubSystems\FEOpenXR\FEOpenXR.h"
namespace FocalEngine
{
class FOCAL_ENGINE_API FEngine
{
public:
SINGLETON_PUBLIC_PART(FEngine)
std::string GetEngineBuildVersion();
void InitWindow(int Width = 1920 * 2, int Height = 1080 * 2, std::string WindowTitle = "FEWindow");
void BeginFrame(bool InternalCall = false);
void EndFrame(bool InternalCall = false);
void Render(bool InternalCall = false);
bool IsNotTerminated();
void Terminate();
void SetWindowCaption(std::string NewCaption);
void AddWindowResizeCallback(void(*Func)(int, int));
void AddWindowCloseCallback(void(*Func)());
void AddDropCallback(void(*Func)(int, const char**));
void RenderTo(FEFramebuffer* RenderTo);
double GetCpuTime();
double GetGpuTime();
FEPostProcess* CreatePostProcess(std::string Name, int ScreenWidth = -1, int ScreenHeight = -1);
void SaveScreenshot(std::string FileName, FEScene* SceneToWorkWith);
FEViewport* GetDefaultViewport();
FEViewport* GetViewport(std::string ViewportID);
bool IsVsyncEnabled();
void SetVsyncEnabled(bool NewValue);
void DisableVR();
bool EnableVR();
bool IsVRInitializedCorrectly();
bool IsVREnabled();
void AddOnAfterUpdateCallback(std::function<void()> Callback);
// Returns Viewport ID
std::string CreateViewport(ImGuiWindow* ImGuiWindowPointer);
// Returns Viewport ID
std::string CreateViewport(FEWindow* FEWindowPointer);
void AddOnViewportMovedCallback(std::function<void(std::string)> Callback);
void AddOnViewportResizeCallback(std::function<void(std::string)> Callback);
unsigned long long GetCurrentFrameIndex();
private:
SINGLETON_PRIVATE_PART(FEngine)
double CPUTime = 0.0, GPUTime = 0.0;
double CurrentDeltaTime = 0.0;
bool bSimplifiedRendering = false;
bool bVsyncEnabled = true;
bool bVRInitializedCorrectly = false;
bool bVRActive = false;
static void WindowResizeCallback(int Width, int Height);
std::vector<void(*)(int, int)> ClientWindowResizeCallbacks;
static void DropCallback(int Count, const char** Paths);
std::vector<void(*)(int, const char**)> ClientDropCallbacks;
void InternalUpdate();
std::vector<std::function<void()>> OnAfterUpdateCallbacks;
std::vector<FEViewport*> Viewports;
std::vector<std::function<void(std::string)>> OnViewportMovedCallbacks;
std::vector<std::function<void(std::string)>> OnViewportResizeCallbacks;
void ViewportCheckForModification();
void ViewportCheckForModificationIndividual(FEViewport* ViewPort, bool& bMoved, bool& bResize);
unsigned long long CurentFrameIndex = 0;
};
#ifdef FOCAL_ENGINE_SHARED
extern "C" __declspec(dllexport) void* GetEngine();
#define ENGINE (*static_cast<FEngine*>(GetEngine()))
#else
#define ENGINE FEngine::GetInstance()
#endif
}