TazGraph Project v0.1.0
Loading...
Searching...
No Matches
Graph.h
1#ifndef GRAPH_H
2#define GRAPH_H
3
4#include <AppScene/IScene.h>
5#include <SDL2/SDL.h>
6#include <SDL2/SDL_image.h>
7#include <GL/glew.h>
8#include <GLSLProgram.h>
9#include <ResourceManager/ResourceManager.h>
10#undef main
11#include <iostream>
12#include <vector>
13#include "Camera2.5D/PerspectiveCamera.h"
14#include <Renderers/FrameBuffer/Framebuffer.h>
15#include <Renderers/PlaneRenderers/PlaneModelRenderer/PlaneModelRenderer.h>
16#include <InputManager/InputManager.h>
17#include <BaseFPSLimiter/BaseFPSLimiter.h>
18//#include "SpriteFont/SpriteFont.h"
19#include "Window/Window.h"
20#include "TextureManager/TextureManager.h"
21
22
23#include "AppScene/ScreenIndices.h"
24
25#include <ImGuiInterface/ImGuiInterface.h>
26
27#include <chrono>
28#include <thread>
29#include "../../EditorIMGUI/Components/MenuDropdown/MenuDropdown.h"
30#include "../../EditorIMGUI/Components/FPSCounter.h"
31#include "../../EditorIMGUI/Components/GraphTopBar/GraphTopBar.h"
32#include "../../EditorIMGUI/Components/GraphLeftPanel/GraphLeftPanel.h"
33#include "../../EditorIMGUI/Components/ViewportPanel/ViewportPanel.h"
34#include "../../EditorIMGUI/Components/GraphRightPanel/GraphRightPanel.h"
35#include "../../AssetManager/AssetManager.h"
36#include "../../EditorIMGUI/Components/SceneControl/SceneControl.h"
37#include "../../EditorIMGUI/Components/EntityComponentsControl/EntityComponentsControl.h"
38#include "../../EditorIMGUI/Components/HoverEntityPanel/HoverEntityPanel.h"
39
40class Map;
41class SceneManager;
44
45
46
47#define ON_HOVER 0
48#define CTRLD_LEFT_CLICK -1
49
50class Graph : public IScene {
51
52public:
54 ~Graph();
55
56
57 virtual int getNextSceneIndex() const override;
58
59 virtual int getPreviousSceneIndex() const override;
60
61 virtual void build() override;
62
63 virtual void destroy() override;
64
65 virtual void onEntry() override;
66
67 virtual void onExit() override;
68
69 virtual void update(float deltaTime) override;
70
71 virtual void draw() override;
72
73 virtual void BeginRender() override;
74 virtual void updateUI(float deltaTime) override;
75 virtual void drawUI() override;
76 virtual void EndRender() override;
77
78
80 void renderBatch(const std::vector<LinkEntity*>& entities, LineRenderer& batch);
81 void renderBatch(const std::vector<EmptyEntity*>& entities, PlaneColorRenderer& batch);
82 void renderBatch(const std::vector<NodeEntity*>& entities, PlaneColorRenderer& batch);
83 void renderBatch(const std::vector<EmptyEntity*>& entities, PlaneModelRenderer& batch);
84 void renderBatch(const std::vector<NodeEntity*>& entities, PlaneModelRenderer& batch);
85 void renderBatch(const std::vector<EmptyEntity*>& entities, LightRenderer& batch);
86 void drawHUD(const std::vector<NodeEntity*>& entities);
87
89
90 Map* map = nullptr;
91 //std::unique_ptr<Grid> grid;
92
93 static TazGraphEngine::Window* _window;
94
95
96private:
97 float _backgroundColor[4] = { 0.407f,0.384f,0.356f, 1.0f };
98 float _minimap_backgroundColor[4] = { 1.f,0.f,0.f, 1.0f };
99
100 std::vector<Cell*> traversedCellsFromRay(glm::vec3 rayOrigin,
101 glm::vec3 rayDirection,
102 float maxDistance);
103
104 void selectEntityFromRay(glm::vec3 rayOrigin, glm::vec3 rayDirection, int activateMode);
105
106 bool setManager(std::string m_managerName);
107
108 void checkInput();
109 bool onPauseGraph();
110
111 PlaneModelRenderer _PlaneModelRenderer;
112 PlaneModelRenderer _hudPlaneModelRenderer;
113 PlaneColorRenderer _PlaneColorRenderer;
114 LineRenderer _LineRenderer;
115 LightRenderer _LightRenderer;
116
117 ResourceManager _resourceManager;
118
119 std::vector<std::pair<Entity*, glm::vec3>> _selectedEntities;
120 Entity* _displayedEntity = nullptr;
121 bool _sceneManagerActive = false;
122 Entity* _onHoverEntity = nullptr;
123
124 int _nextSceneIndex = SCENE_INDEX_GRAPHPLAY;
125 int _prevSceneIndex = SCENE_INDEX_MAIN_MENU;
126
127 const float SCALE_SPEED = 0.1f;
128 bool _firstLoop = true;
129
130 MenuDropdownPanel _menuDropdown;
131 FPSCounter _fpsCounter;
132 GraphTopBar _topBar;
133 GraphLeftPanel _graphLeftPanel;
134 ViewportPanel _viewportPanel;
135 GraphRightPanel _graphRightPanel;
136 SceneControlPanel _sceneControl;
137 EntityComponentsControlPanel _entityComponentController;
138 HoverEntityPanel _hoverEntityPanel;
139
140 Framebuffer _framebuffer;
141 Framebuffer _minimapFramebuffer;
142
143 ImVec2 _windowPos;
144 ImVec2 _windowSize;
145
146 glm::vec2 _sceneMousePosition = {0.f,0.f};
147 glm::vec2 _savedMainViewportMousePosition = { 0.f,0.f };
148
149};
150
151
152#endif
Definition ColliderComponent.h:12
Definition EntityComponentsControl.h:12
Definition GECS.h:152
Definition FPSCounter.h:5
Definition Framebuffer.h:8
Definition GraphLeftPanel.h:16
Definition GraphRightPanel.h:16
Definition GraphTopBar.h:15
Definition Graph.h:50
virtual void draw() override
Definition GraphDraw.cpp:69
void renderBatch(const std::vector< LinkEntity * > &entities, LineRenderer &batch)
Definition GraphDraw.cpp:4
Definition HoverEntityPanel.h:16
Definition IScene.h:21
Definition LightRenderer.h:20
Definition LineRenderer.h:131
Definition Map.h:29
Definition MenuDropdown.h:14
Definition PlaneColorRenderer.h:19
Definition PlaneModelRenderer.h:21
Definition ResourceManager.h:12
Definition SceneControl.h:12
Definition Window.h:18
Definition TransformComponent.h:6
Definition ViewportPanel.h:18