14#include <imgui_internal.h>
15#include <IconsForkAwesome.h>
39 if (ImGui::IsItemHovered())
41 ImGui::SetTooltip(
"Toggle scene playback");
45 const bool enableStepButtons = !play;
46 if (
button(enableStepButtons,
48 "When playback is paused, advanced the simulation by 1 full frame"))
55 if (
button(enableStepButtons,
62 bool readOnly =
false;
67 const F32 ItemSpacing = ImGui::GetStyle().ItemSpacing.x;
68 static F32 TButtonWidth = 10.0f;
69 static F32 RButtonWidth = 10.0f;
70 static F32 SButtonWidth = 10.0f;
71 static F32 NButtonWidth = 10.0f;
73 ImGuiWindow* window = ImGui::GetCurrentWindow();
74 ImGui::SameLine(window->Size.x * 0.49f);
81 if (
button(
true, ICON_FK_CAMERA_RETRO,
"Copy the player's camera snapshot to the editor camera"))
87 if (
button(
true, ICON_FK_HOME,
"Set the editor's camera's position to (0, 0, 0) and view direction to (0, -1, 0)"))
92 F32 pos = (2*SButtonWidth) + ItemSpacing + 25;
93 ImGui::SameLine( window->Size.x - pos);
107 SButtonWidth = ImGui::GetItemRectSize().x;
109 pos += RButtonWidth + ItemSpacing + 1;
110 ImGui::SameLine( window->Size.x - pos);
124 RButtonWidth = ImGui::GetItemRectSize().x;
126 pos += TButtonWidth + ItemSpacing + 1;
127 ImGui::SameLine( window->Size.x - pos);
141 TButtonWidth = ImGui::GetItemRectSize().x;
143 pos += NButtonWidth + ItemSpacing + 1;
144 ImGui::SameLine( window->Size.x - pos);
145 if (
button(enableGizmo, ICON_FK_MOUSE_POINTER,
"Select",
true))
151 NButtonWidth = ImGui::GetItemRectSize().x;
164 if (play || !enableGizmo)
169 if (ImGui::RadioButton(
"Local", settings.
currentGizmoMode == ImGuizmo::LOCAL))
175 if (ImGui::RadioButton(
"World", settings.
currentGizmoMode == ImGuizmo::WORLD))
181 ImGui::Text(
"Gizmo Axis [ ");
190 case ImGuizmo::TRANSLATE:
191 case ImGuizmo::TRANSLATE_X:
192 case ImGuizmo::TRANSLATE_Y:
193 case ImGuizmo::TRANSLATE_Z:
197 case ImGuizmo::ROTATE:
198 case ImGuizmo::ROTATE_X:
199 case ImGuizmo::ROTATE_Y:
200 case ImGuizmo::ROTATE_Z:
204 case ImGuizmo::SCALE:
205 case ImGuizmo::SCALE_X:
206 case ImGuizmo::SCALE_Y:
207 case ImGuizmo::SCALE_Z:
212 case ImGuizmo::ROTATE_SCREEN:
213 case ImGuizmo::BOUNDS:
226 case ImGuizmo::TRANSLATE:
227 case ImGuizmo::TRANSLATE_X:
228 case ImGuizmo::TRANSLATE_Y:
229 case ImGuizmo::TRANSLATE_Z:
233 case ImGuizmo::ROTATE:
234 case ImGuizmo::ROTATE_X:
235 case ImGuizmo::ROTATE_Y:
236 case ImGuizmo::ROTATE_Z:
240 case ImGuizmo::SCALE:
241 case ImGuizmo::SCALE_X:
242 case ImGuizmo::SCALE_Y:
243 case ImGuizmo::SCALE_Z:
247 case ImGuizmo::ROTATE_SCREEN:
248 case ImGuizmo::BOUNDS:
261 case ImGuizmo::TRANSLATE:
262 case ImGuizmo::TRANSLATE_X:
263 case ImGuizmo::TRANSLATE_Y:
264 case ImGuizmo::TRANSLATE_Z:
268 case ImGuizmo::ROTATE:
269 case ImGuizmo::ROTATE_X:
270 case ImGuizmo::ROTATE_Y:
271 case ImGuizmo::ROTATE_Z:
275 case ImGuizmo::SCALE:
276 case ImGuizmo::SCALE_X:
277 case ImGuizmo::SCALE_Y:
278 case ImGuizmo::SCALE_Z:
282 case ImGuizmo::ROTATE_SCREEN:
283 case ImGuizmo::BOUNDS:
297 case ImGuizmo::TRANSLATE:
298 case ImGuizmo::TRANSLATE_X:
299 case ImGuizmo::TRANSLATE_Y:
300 case ImGuizmo::TRANSLATE_Z:
304 case ImGuizmo::ROTATE:
305 case ImGuizmo::ROTATE_X:
306 case ImGuizmo::ROTATE_Y:
307 case ImGuizmo::ROTATE_Z:
311 case ImGuizmo::SCALE:
312 case ImGuizmo::SCALE_X:
313 case ImGuizmo::SCALE_Y:
314 case ImGuizmo::SCALE_Z:
318 case ImGuizmo::ROTATE_SCREEN:
319 case ImGuizmo::BOUNDS:
328 ImGui::SameLine(0.f, 25.0f);
329 ImGui::Checkbox(
"Snap", &settings.
useSnap);
335 ImGui::Text(
"Step:");
337 ImGui::PushItemWidth(150);
343 case ImGuizmo::TRANSLATE:
344 for (
size_t i = 0; i < 3; ++i)
346 Util::DrawVecComponent<F32, false>(ImGuiDataType_Float,
360 ImGui::Dummy(ImVec2(0, 0));
362 case ImGuizmo::TRANSLATE_X:
363 Util::DrawVecComponent<F32, false>(ImGuiDataType_Float,
376 case ImGuizmo::TRANSLATE_Y:
377 Util::DrawVecComponent<F32, false>(ImGuiDataType_Float,
390 case ImGuizmo::TRANSLATE_Z:
391 Util::DrawVecComponent<F32, false>(ImGuiDataType_Float,
411 case ImGuizmo::ROTATE:
412 for (
size_t i = 0; i < 3; ++i)
414 Util::DrawVecComponent<F32, false>(ImGuiDataType_Float,
428 ImGui::Dummy(ImVec2(0, 0));
430 case ImGuizmo::ROTATE_X:
431 Util::DrawVecComponent<F32, false>(ImGuiDataType_Float,
444 case ImGuizmo::ROTATE_Y:
445 Util::DrawVecComponent<F32, false>(ImGuiDataType_Float,
458 case ImGuizmo::ROTATE_Z:
459 Util::DrawVecComponent<F32, false>(ImGuiDataType_Float,
479 case ImGuizmo::SCALE:
480 for (
size_t i = 0; i < 3; ++i)
482 Util::DrawVecComponent<F32, false>(ImGuiDataType_Float,
496 ImGui::Dummy(ImVec2(0, 0));
498 case ImGuizmo::SCALE_X:
499 Util::DrawVecComponent<F32, false>(ImGuiDataType_Float,
512 case ImGuizmo::SCALE_Y:
513 Util::DrawVecComponent<F32, false>(ImGuiDataType_Float,
526 case ImGuizmo::SCALE_Z:
527 Util::DrawVecComponent<F32, false>(ImGuiDataType_Float,
544 ImGui::PopItemWidth();
548 if (play || !enableGizmo)
554 ImGui::SameLine( window->Size.x * 0.95f);
556 bool enableGrid =
_parent.infiniteGridEnabledScene();
557 if (ImGui::Checkbox(ICON_FK_PLUS_SQUARE_O
" Infinite Grid", &enableGrid))
559 _parent.infiniteGridEnabledScene(enableGrid);
561 if (ImGui::IsItemHovered())
563 ImGui::SetTooltip(
"Toggle the editor XZ grid on/off.\nGrid sizing is controlled in the \"Editor options\" window (under \"File\" in the menu bar)");
#define PROFILE_SCOPE_AUTO(CATEGORY)
static void editorEnableGizmo(const Editor &editor, const bool state) noexcept
static void copyPlayerCamToEditorCam(Editor &editor) noexcept
static bool editorEnabledGizmo(const Editor &editor) noexcept
static void simulationPaused(Editor &editor, const bool state) noexcept
static void editorStepQueue(Editor &editor, const U32 steps) noexcept
static void setEditorCamLookAt(Editor &editor, const vec3< F32 > &eye, const vec3< F32 > &fwd, const vec3< F32 > &up) noexcept
const Descriptor & descriptor() const noexcept
void setTransformSettings(const TransformSettings &settings) const noexcept
const TransformSettings & getTransformSettings() const noexcept
bool simulationPaused() const noexcept
GFXRTPool & renderTargetPool() noexcept
RenderTarget * getRenderTarget(const RenderTargetID target) const
bool button(bool enabled, const char *label, const char *tooltip, bool small=false)
void drawInternal() override
PlatformContext & context() noexcept
GFXDevice & gfx() noexcept
Handle< Texture > texture() const
RTAttachment * getAttachment(RTAttachmentType type, RTColourAttachmentSlot slot=RTColourAttachmentSlot::SLOT_0) const
SceneViewWindow(Editor &parent, const Descriptor &descriptor)
void drawInternal() override
constexpr U16 TARGET_FRAME_RATE
Application desired framerate for physics and input simulations.
constexpr Optick::Category::Type GUI
Str StringFormat(const char *fmt, Args &&...args)
static const ImVec4 Colours[]
static const ImVec4 ColoursHovered[]
void PushButtonStyle(bool bold, ImVec4 buttonColour, ImVec4 buttonColourHovered, ImVec4 buttonColourActive)
ImGuiInputTextFlags GetDefaultFlagsForSettings(bool readOnly, bool hex)
constexpr const char * FieldLabels[]
Handle console commands that start with a forward slash.
FORCE_INLINE bool IsRotationOperation(const TransformSettings &settings)
void PushReadOnly(const bool fade)
FORCE_INLINE bool IsTranslationOperation(const TransformSettings &settings)
FORCE_INLINE bool IsScaleOperation(const TransformSettings &settings)
static const vec3< F32 > WORLD_Z_NEG_AXIS
static const vec3< F32 > VECTOR3_ZERO
static const vec3< F32 > WORLD_Y_AXIS
bool ToggleButton(const char *str_id, bool *v)
static RenderTargetID BACK_BUFFER