Polyphase Game Engine
Loading...
Searching...
No Matches
ViewportModule.h
Go to the documentation of this file.
1#pragma once
2
3#if EDITOR
4
5#include "../../PreferencesModule.h"
6#include "Maths.h"
7
8class ViewportModule : public PreferencesModule
9{
10public:
11 DECLARE_PREFERENCES_MODULE(ViewportModule)
12
13 ViewportModule();
14 virtual ~ViewportModule();
15
16 virtual const char* GetName() const override { return GetStaticName(); }
17 virtual const char* GetParentPath() const override { return GetStaticParentPath(); }
18 virtual void Render() override;
19 virtual void LoadSettings(const rapidjson::Document& doc) override;
20 virtual void SaveSettings(rapidjson::Document& doc) override;
21
22 // Settings accessors
23 glm::vec4 GetBackgroundColor() const { return mBackgroundColor; }
24 bool GetShowGrid() const { return mShowGrid; }
25 glm::vec4 GetGridColor() const { return mGridColor; }
26 float GetGridSize() const { return mGridSize; }
27 glm::vec4 GetSelectedColor() const { return mSelectedColor; }
28 float GetSelectedCheckerSize() const { return mSelectedCheckerSize; }
29 float GetMenuBarPadding() const { return mMenuBarPadding; }
30 bool GetShowGizmosInPreview() const { return mShowGizmosInPreview; }
31 void SetShowGizmosInPreview(bool show);
32
33 static ViewportModule* Get();
34 static void HandleExternalGridToggle(bool enabled);
35
36private:
37 void ApplyBackgroundColorToRenderer() const;
38 void ApplyGridVisibility();
39 void ApplySelectedOverlay() const;
40
41 glm::vec4 mBackgroundColor = glm::vec4(0.1f, 0.1f, 0.1f, 1.0f);
42 bool mShowGrid = true;
43 glm::vec4 mGridColor = glm::vec4(0.3f, 0.3f, 0.3f, 1.0f);
44 float mGridSize = 1.0f;
45 glm::vec4 mSelectedColor = glm::vec4(0.2f, 0.1f, 1.0f, 0.6f);
46 float mSelectedCheckerSize = 8.0f;
47 float mMenuBarPadding = 8.0f;
48 bool mShowGizmosInPreview = false;
49
50 static ViewportModule* sInstance;
51 static bool sSyncingGridState;
52};
53
54#endif
glm::vec4 GetGridColor()
Definition JsonHelpers.h:15