Pioneer
Loading...
Searching...
No Matches
ModelViewer.h
Go to the documentation of this file.
1// Copyright © 2008-2024 Pioneer Developers. See AUTHORS.txt for details
2// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
3
4#pragma once
5
6#include "Input.h"
7#include "Shields.h"
9#include "graphics/Renderer.h"
10#include "graphics/Texture.h"
11#include "pigui/PiGui.h"
12
13#include <memory>
14
15class LuaManager;
16
17namespace PiGui {
18 class Instance;
19}
20
21namespace SceneGraph {
22 class Model;
23 class Tag;
24}
25
26namespace Editor {
27
28class EditorApp;
29class ModelViewerWidget;
30
32public:
33 enum class CameraPreset : uint8_t {
34 Front,
35 Back,
36 Left,
37 Right,
38 Top,
39 Bottom
40 };
41
44
45 void SetModel(const std::string &modelName);
46
47protected:
48 void Start() override;
49 void Update(float deltaTime) override;
50 void End() override;
51 void HandleInput();
52
53private:
54 void AddLog(Time::DateTime, Log::Severity, std::string_view line);
55
56 void UpdateModelList();
57 void UpdateDecalList();
58 void UpdateShield();
59
60 void ReloadModel();
61 void ClearModel();
62 void OnModelLoaded();
63
64 void ToggleGuns();
65 void HitIt();
66
67 void CreateTestResources();
68
69 void ResetThrusters();
70 void Screenshot();
71 void SaveModelToBinary();
72
73 void SetupLayout(ImGuiID dockspaceID);
74 void DrawModelSelector();
75 void DrawModelTags();
76 void DrawTagNames();
77 void DrawModelHierarchy();
78 void DrawShipControls();
79 void DrawLog();
80 void DrawPiGui();
81
82private:
83 EditorApp *m_app;
84 Input::Manager *m_input;
85 PiGui::Instance *m_pigui;
86 Graphics::Renderer *m_renderer;
87
88 std::vector<std::string> m_log;
89 bool m_resetLogScroll = false;
90
91 vector3f m_linearThrust = {};
92 vector3f m_angularThrust = {};
93
94 std::unique_ptr<ModelViewerWidget> m_modelWindow;
95
96 std::vector<std::string> m_fileNames;
97 std::string m_modelName;
98 std::string m_requestedModelName;
99
100 SceneGraph::Tag *m_selectedTag = nullptr;
101
102 bool m_modelSupportsDecals = false;
103 std::vector<std::string> m_decals;
104 uint32_t m_currentDecal = 0;
105 Graphics::Texture *m_decalTexture;
106
107 bool m_modelIsShip = false;
108 bool m_modelHasShields = false;
109
110 std::unique_ptr<Shields> m_shields;
111 std::unique_ptr<SceneGraph::Model> m_gunModel;
112
113 bool m_screenshotQueued = false;
114 bool m_shieldIsHit = false;
115 float m_shieldHitPan;
116
117 bool m_attachGuns = false;
118 bool m_showShields = false;
119 bool m_showUI = true;
120 bool m_metricsWindow = false;
121};
122
123} // namespace Editor
unsigned int ImGuiID
Definition: Modal.h:9
Definition: Application.h:21
Definition: EditorApp.h:20
Definition: ModelViewer.h:31
void SetModel(const std::string &modelName)
Definition: ModelViewer.cpp:365
CameraPreset
Definition: ModelViewer.h:33
void HandleInput()
Definition: ModelViewer.cpp:229
~ModelViewer()
Definition: ModelViewer.cpp:54
void End() override
Definition: ModelViewer.cpp:71
void Start() override
Definition: ModelViewer.cpp:58
void Update(float deltaTime) override
Definition: ModelViewer.cpp:207
Definition: Renderer.h:45
Definition: Texture.h:103
Definition: Input.h:124
Definition: LuaManager.h:9
Definition: PiGui.h:140
Definition: Tag.h:18
Definition: DateTime.h:84
Definition: ActionBinder.h:14
Severity
Definition: Log.h:13
Definition: GuiApplication.h:18
Definition: CityOnPlanet.h:32