LkEngine 0.1.2
 
Loading...
Searching...
No Matches
Slider.h
Go to the documentation of this file.
1
5#pragma once
6
7#include "LkEngine/Core/LObject/Enum.h"
8#include "LkEngine/Core/Delegate/Delegate.h"
10
11#include "LkEngine/Editor/EditorCore.h" /* UI::Debug */
12
13#include <imgui/imgui.h>
14#include <imgui/imgui_internal.h>
15
16namespace LkEngine::UI {
17
28 enum class EVectorSemantic
29 {
30 XYZ,
31 RGB,
32 XYZW,
33 RGBA,
34 };
35 LK_ENUM_CLASS(EVectorSemantic);
36
37 namespace Slider {
38 inline static constexpr float TablePaddingX = 17.0f; /* DragFloat X-padding. */
39 }
40
41 namespace Draw
42 {
43 inline static constexpr int LABEL_BUFSIZE = 72;
44
45 FORCEINLINE bool DragFloat(const char* Label,
46 float* Value,
47 float ValueSpeed = 1.0f,
48 float ValueMin = 0.0f,
49 float ValueMax = 0.0f,
50 const char* Format = "%.3f",
51 ImGuiSliderFlags Flags = 0)
52 {
53 const int LabelSize = std::strlen(Label);
54
55 std::array<char, LABEL_BUFSIZE> LabelBuf{};
56 std::snprintf(LabelBuf.data(), LabelBuf.size(), "##%s", Label);
57
58 if (InTable())
59 {
60 if ((LabelSize > 0) && (Label[0] != '#'))
61 {
62 ImGui::TableSetColumnIndex(0);
63 UI::ShiftCursor(Slider::TablePaddingX, 7.0f);
64
65 ImGui::Text(Label);
66 UI::Draw::Underline(false, 0.0f, 2.0f);
67
68 }
69
70 ImGui::TableSetColumnIndex(1);
71 UI::ShiftCursor(7.0f, 0.0f);
72 }
73 else
74 {
75 if ((LabelSize > 0) && (Label[0] != '#'))
76 {
77 ImGui::Text(Label);
78 /* TODO: Do PushStyle here instead. */
79 ImGui::SameLine();
80 }
81 }
82
83 const bool Dragged = ImGui::DragScalar(LabelBuf.data(), ImGuiDataType_Float, Value, ValueSpeed, &ValueMin, &ValueMax, Format, Flags);
84
85 if (InTable())
86 {
87 ImGui::TableNextRow();
88 }
89
90 return Dragged;
91 }
92
93 FORCEINLINE bool DragFloat3(const char* Label,
94 float Vec[3],
95 float VecSpeed = 1.0f,
96 float VecMin = 0.0f,
97 float VecMax = 0.0f,
98 const char* Format = "%.3f",
99 ImGuiSliderFlags Flags = 0)
100 {
101 ImGuiTable* CurrentTable = ImGui::GetCurrentTable();
102 const bool IsInTable = (CurrentTable != nullptr);
103 if (IsInTable)
104 {
105 ImGui::TableSetColumnIndex(0);
106 }
107
108 const bool Changed = ImGui::DragFloat3(Label, Vec, VecSpeed, VecMin, VecMax, Format, Flags);
109 DrawItemActivityOutline();
110
111 return Changed;
112 }
113
114 FORCEINLINE bool DragFloat4(const char* Label,
115 float Vec[4],
116 float VecSpeed = 1.0f,
117 float VecMin = 0.0f,
118 float VecMax = 0.0f,
119 const char* Format = "%.3f",
120 ImGuiSliderFlags Flags = 0)
121 {
122 ImGuiTable* CurrentTable = ImGui::GetCurrentTable();
123 const bool IsInTable = (CurrentTable != nullptr);
124 if (IsInTable)
125 {
126 ImGui::TableSetColumnIndex(0);
127 }
128
129 const bool Changed = ImGui::DragFloat4(Label, Vec, VecSpeed, VecMin, VecMax, Format, Flags);
130 DrawItemActivityOutline();
131
132 return Changed;
133 }
134
135
136 FORCEINLINE bool SliderFloat3(const char* Label,
137 float Vec[3],
138 float VecMin,
139 float VecMax,
140 const char* Format = "%.3f",
141 ImGuiSliderFlags Flags = 0)
142 {
143 const bool Changed = ImGui::SliderFloat3(Label, Vec, VecMin, VecMax, Format, Flags);
144 DrawItemActivityOutline();
145 return Changed;
146 }
147
164 template<EVectorSemantic VecSemantic = EVectorSemantic::XYZW, typename VectorType = glm::vec3>
165 FORCEINLINE bool Vec3Control(const std::string& Label,
166 VectorType& Values,
167 const float ResetValue = 0.0f,
168 const float ValueSpeed = 0.10f,
169 const float ValueMin = 0.0f,
170 const float ValueMax = 0.0f,
171 const float ColumnWidth = 100.0f,
172 uint32_t RenderMultiSelectAxes = 0,
173 const char* Format = "%.2f")
174 {
175 static constexpr const char* V1 = (VecSemantic == EVectorSemantic::XYZW) ? "X" : "R";
176 static constexpr const char* V2 = (VecSemantic == EVectorSemantic::XYZW) ? "Y" : "G";
177 static constexpr const char* V3 = (VecSemantic == EVectorSemantic::XYZW) ? "Z" : "B";
178
179 bool Modified = false;
180 bool ManuallyEdited = false; /* @todo: Currently unused. */
181
182 ImGui::TableSetColumnIndex(0);
183 UI::ShiftCursor(17.0f, 7.0f);
184
185 ImGui::Text(Label.c_str());
186 UI::Draw::Underline(false, 0.0f, 2.0f);
187
188 ImGui::TableSetColumnIndex(1);
189 UI::ShiftCursor(7.0f, 0.0f);
190 {
191 static constexpr float SpacingX = 8.0f;
192 UI::FScopedStyle ItemSpacing(ImGuiStyleVar_ItemSpacing, ImVec2(SpacingX, 0.0f));
193 UI::FScopedStyle Padding(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 2.0f));
194 {
195 UI::FScopedColor Padding(ImGuiCol_Border, IM_COL32(0, 0, 0, 0));
196 UI::FScopedColor Frame(ImGuiCol_FrameBg, IM_COL32(0, 0, 0, 0));
197
198 ImGui::BeginChild(
199 ImGui::GetID((Label + "Subwindow").c_str()),
200 ImVec2((ImGui::GetContentRegionAvail().x - SpacingX), ImGui::GetFrameHeightWithSpacing() + 8.0f),
201 ImGuiChildFlags_None,
202 ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse /* Window Flags. */
203 );
204 }
205
206 static constexpr float FramePadding = 4.0f;
207 static constexpr float OutlineSpacing = 1.0f;
208 const float LineHeight = GImGui->Font->FontSize + FramePadding * 2.0f;
209 const ImVec2 ButtonSize = { LineHeight + 2.0f, LineHeight };
210 const float InputItemWidth = (ImGui::GetContentRegionAvail().x - SpacingX) / 3.0f - ButtonSize.x;
211
212 UI::ShiftCursor(0.0f, FramePadding);
213
214 auto DrawControl = [&](const std::string& InLabel,
215 float& InValue,
216 const ImVec4& InColorNormal,
217 const ImVec4& InColorHover,
218 const ImVec4& InColorPressed,
219 bool RenderMultiSelect)
220 {
221 {
222 UI::FScopedStyle ButtonFrame(ImGuiStyleVar_FramePadding, ImVec2(FramePadding, 0.0f));
223 UI::FScopedStyle ButtonRounding(ImGuiStyleVar_FrameRounding, 1.0f);
224 UI::FScopedColorStack ButtonColours(
225 ImGuiCol_Button, InColorNormal,
226 ImGuiCol_ButtonHovered, InColorHover,
227 ImGuiCol_ButtonActive, InColorPressed
228 );
229
230 if (ImGui::Button(InLabel.c_str(), ButtonSize))
231 {
232 InValue = ResetValue;
233 Modified = true;
234 LK_CORE_DEBUG("Pressed Button: {}", InLabel.c_str());
235 }
236 }
237
238 ImGui::SameLine(0.0f, OutlineSpacing);
239 ImGui::SetNextItemWidth(InputItemWidth);
240
241 ImGui::PushItemFlag(ImGuiItemFlags_MixedValue, RenderMultiSelect);
242 const ImGuiID InputID = ImGui::GetID(("##" + InLabel).c_str());
243 const bool WasTempInputActive = ImGui::TempInputIsActive(InputID);
244 Modified |= ImGui::DragFloat(("##" + InLabel).c_str(), &InValue, ValueSpeed, ValueMin, ValueMax, Format, 0);
245
246 if (ImGui::TempInputIsActive(InputID))
247 {
248 Modified = false;
249 }
250
251 ImGui::PopItemFlag();
252
253 if (WasTempInputActive)
254 {
255 ManuallyEdited |= ImGui::IsItemDeactivatedAfterEdit();
256 }
257 };
258
259 ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f);
260
261 /* Draw: V1 (First Vector Component). */
262 DrawControl(
263 V1,
264 Values.x,
265 ImVec4(0.80f, 0.10f, 0.15f, 1.0f), /* Normal */
266 ImVec4(0.90f, 0.20f, 0.20f, 1.0f), /* Hover */
267 ImVec4(0.80f, 0.10f, 0.15f, 1.0f), /* Pressed */
268 (RenderMultiSelectAxes & EVectorAxis::X)
269 );
270
271 /* Draw: V2 (Second Vector Component). */
272 ImGui::SameLine(0.0f, OutlineSpacing);
273 DrawControl(
274 V2,
275 Values.y,
276 ImVec4(0.20f, 0.70f, 0.20f, 1.0f),
277 ImVec4(0.30f, 0.80f, 0.30f, 1.0f),
278 ImVec4(0.20f, 0.70f, 0.20f, 1.0f),
279 (RenderMultiSelectAxes & EVectorAxis::Y)
280 );
281
282 /* Draw: V3 (Third Vector Component). */
283 ImGui::SameLine(0.0f, OutlineSpacing);
284 DrawControl(
285 V3,
286 Values.z,
287 ImVec4(0.10f, 0.25f, 0.80f, 1.0f),
288 ImVec4(0.20f, 0.35f, 0.90f, 1.0f),
289 ImVec4(0.10f, 0.25f, 0.80f, 1.0f),
290 (RenderMultiSelectAxes & EVectorAxis::Z)
291 );
292
293 ImGui::PopStyleVar(1); /* FrameRounding */
294
295 ImGui::EndChild();
296 }
297
298 /* TODO: Check if we are in a table before calling this. */
299 if (InTable())
300 {
301 ImGui::TableNextRow();
302 }
303
304 //return Modified || ManuallyEdited;
306 return Modified;
307 }
308
314 template<EVectorSemantic VecSemantic = EVectorSemantic::XYZW, typename VectorType = ImVec4>
315 FORCEINLINE bool Vec4Control(const std::string& Label,
316 VectorType& Values,
317 const float ValueSpeed = 0.10f,
318 const float ResetValue = 0.0f,
319 const float ValueMin = 0.0f,
320 const float ValueMax = 0.0f,
321 const float ColumnWidth = 100.0f,
322 const char* Format = "%.2f",
323 uint32_t RenderMultiSelectAxes = 0)
324 {
325 static_assert((VecSemantic == EVectorSemantic::XYZW) || (VecSemantic == EVectorSemantic::RGBA),
326 "Invalid type of vector semantic, only vectors with 4 elements are allowed");
327 static_assert(std::disjunction_v<
328 std::is_same<VectorType, ImVec4>,
329 std::is_same<VectorType, glm::vec4>>,
330 "Invalid vector type");
331
332 static constexpr const char* V1 = (VecSemantic == EVectorSemantic::XYZW) ? "X" : "R";
333 static constexpr const char* V2 = (VecSemantic == EVectorSemantic::XYZW) ? "Y" : "G";
334 static constexpr const char* V3 = (VecSemantic == EVectorSemantic::XYZW) ? "Z" : "B";
335 static constexpr const char* V4 = (VecSemantic == EVectorSemantic::XYZW) ? "W" : "A";
336
337 bool Modified = false;
338 bool ManuallyEdited = false;
339
340 ImGuiTable* CurrentTable = ImGui::GetCurrentTable();
341 const bool IsInTable = (CurrentTable != nullptr);
342
343 if (UIContext.bInGrid)
344 {
345 ImGui::TableSetColumnIndex(0);
346 if (!Label.empty() && Label.at(0) != '#')
347 {
348 ImGui::Text(Label.c_str());
349 /* TODO: Do PushStyle here instead. */
350 }
351 }
352 else if (IsInTable)
353 {
354 ImGui::TableSetColumnIndex(0);
355 UI::ShiftCursor(Slider::TablePaddingX, 7.0f);
356
357 ImGui::Text(Label.c_str());
358 UI::Draw::Underline(false, 0.0f, 2.0f);
359
360 ImGui::TableSetColumnIndex(1);
361 UI::ShiftCursor(7.0f, 0.0f);
362 }
363 else
364 {
365 if (!Label.empty() && Label.at(0) != '#')
366 {
367 ImGui::Text(Label.c_str());
368 /* TODO: Do PushStyle here instead. */
369 ImGui::SameLine();
370 }
371 }
372
373 {
374 static constexpr float SpacingX = 8.0f;
375 UI::FScopedStyle ItemSpacing(ImGuiStyleVar_ItemSpacing, ImVec2(SpacingX, 0.0f));
376 UI::FScopedStyle WindowPadding(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 2.0f));
377 {
378 UI::FScopedColor BorderColor(ImGuiCol_Border, IM_COL32(0, 0, 0, 0));
379 UI::FScopedColor FrameBg(ImGuiCol_FrameBg, IM_COL32(0, 0, 0, 0));
380
381 static constexpr float FrameHeightPadding = 4.0f;
382
383 ImGui::BeginChild(
384 ImGui::GetID((Label + "Subwindow").c_str()),
385 ImVec2((ImGui::GetContentRegionAvail().x - SpacingX), ImGui::GetFrameHeightWithSpacing() + FrameHeightPadding),
386 (UI::Debug::GridBorders == (int)EBorder::None) ? ImGuiChildFlags_None : ImGuiChildFlags_Border,
387 ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse /* Window Flags. */
388 );
389 }
390
391 static constexpr float FramePadding = 4.0f;
392 static constexpr float OutlineSpacing = 1.0f;
393
394 const float LineHeight = GImGui->Font->FontSize + FramePadding * 2.0f;
395 const ImVec2 ButtonSize = { LineHeight + 2.0f, LineHeight };
396 const float InputItemWidth = (ImGui::GetContentRegionAvail().x - SpacingX) / 4.0f - ButtonSize.x;
397
398 UI::ShiftCursor(0.0f, FramePadding);
399
400 auto DrawControl = [&](const char* InLabel,
401 float& InValue,
402 const VectorType& InColorNormal,
403 const VectorType& InColorHover,
404 const VectorType& InColorPressed,
405 bool RenderMultiSelect)
406 {
407 const std::string LabelStr = LK_FMT_LIB::format("##{}", InLabel);
408 {
409 static constexpr ImVec2 ButtonFrameSize(2.0f * FramePadding, 0.0f);
410 //UI::FScopedStyle ButtonFramePadding(ImGuiStyleVar_FramePadding, ImVec2(FramePadding * 2.0f, 0.0f));
411 UI::FScopedStyle ButtonFramePadding(ImGuiStyleVar_FramePadding, ButtonFrameSize);
412 UI::FScopedStyle ButtonRounding(ImGuiStyleVar_FrameRounding, 1.0f);
413 UI::FScopedColorStack ButtonColours(
414 ImGuiCol_Button, InColorNormal,
415 ImGuiCol_ButtonHovered, InColorHover,
416 ImGuiCol_ButtonActive, InColorPressed
417 );
418
419 if (ImGui::Button(InLabel, ButtonSize))
420 {
421 InValue = ResetValue;
422 Modified = true;
423 LK_CORE_DEBUG("Pressed slider button: {}", InLabel);
424 }
425 }
426
427 ImGui::SameLine(0.0f, OutlineSpacing);
428 ImGui::SetNextItemWidth(InputItemWidth);
429
430 ImGui::PushItemFlag(ImGuiItemFlags_MixedValue, RenderMultiSelect);
431 const ImGuiID InputID = ImGui::GetID(LabelStr.c_str());
432 const bool WasTempInputActive = ImGui::TempInputIsActive(InputID);
433 Modified |= ImGui::DragFloat(LabelStr.c_str(), &InValue, ValueSpeed, ValueMin, ValueMax, Format, 0);
434
435 if (ImGui::TempInputIsActive(InputID))
436 {
437 Modified = false;
438 }
439
440 ImGui::PopItemFlag();
441
442 if (WasTempInputActive)
443 {
444 ManuallyEdited |= ImGui::IsItemDeactivatedAfterEdit();
445 }
446 };
447
448 if (UIContext.bInGrid || IsInTable)
449 {
450 ImGui::TableSetColumnIndex(1);
451 }
452
453 ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f);
454
455 /* Draw: V1 (First Vector Component). */
456 DrawControl(
457 V1,
458 Values.x,
459 ImVec4(0.80f, 0.10f, 0.15f, 1.0f), /* Normal */
460 ImVec4(0.90f, 0.20f, 0.20f, 1.0f), /* Hover */
461 ImVec4(0.80f, 0.10f, 0.15f, 1.0f), /* Pressed */
462 (RenderMultiSelectAxes & EVectorAxis::X)
463 );
464
465 /* Draw: V2 (Second Vector Component). */
466 ImGui::SameLine(0.0f, OutlineSpacing);
467 DrawControl(
468 V2,
469 Values.y,
470 ImVec4(0.20f, 0.70f, 0.20f, 1.0f),
471 ImVec4(0.30f, 0.80f, 0.30f, 1.0f),
472 ImVec4(0.20f, 0.70f, 0.20f, 1.0f),
473 (RenderMultiSelectAxes & EVectorAxis::Y)
474 );
475
476 /* Draw: V3 (Third Vector Component). */
477 ImGui::SameLine(0.0f, OutlineSpacing);
478 DrawControl(
479 V3,
480 Values.z,
481 ImVec4(0.10f, 0.25f, 0.80f, 1.0f),
482 ImVec4(0.20f, 0.35f, 0.90f, 1.0f),
483 ImVec4(0.10f, 0.25f, 0.80f, 1.0f),
484 (RenderMultiSelectAxes & EVectorAxis::Z)
485 );
486
487 /* Draw: V4 (Fourth Vector Component). */
488 ImGui::SameLine(0.0f, OutlineSpacing);
489 DrawControl(
490 V4,
491 Values.w,
492 VectorType(0.50f, 0.40f, 0.70f, 1.0f),
493 VectorType(0.55f, 0.40f, 0.60f, 1.0f),
494 VectorType(0.50f, 0.40f, 0.70f, 1.0f),
495 (RenderMultiSelectAxes & EVectorAxis::Z)
496 );
497
498 ImGui::PopStyleVar(1); /* FrameRounding */
499 ImGui::EndChild();
500 }
501
502 if (UIContext.bInGrid)
503 {
504 ImGui::TableNextRow();
505 }
506 else if (IsInTable)
507 {
508 ImGui::TableNextRow();
509 }
510
511 return (Modified || ManuallyEdited);
512 }
513
514 #if 0
520 FORCEINLINE bool Vec4Control(const std::string& Label,
521 ImVec4& Values,
522 const float ValueSpeed = 0.10f,
523 const float ResetValue = 0.0f,
524 const float ValueMin = 0.0f,
525 const float ValueMax = 0.0f,
526 const float ColumnWidth = 100.0f,
527 const char* Format = "%.2f",
528 uint32_t RenderMultiSelectAxes = 0)
529 {
530 bool Modified = false;
531 bool ManuallyEdited = false;
532
533 ImGuiTable* CurrentTable = ImGui::GetCurrentTable();
534 const bool IsInTable = (CurrentTable != nullptr);
535
536 if (UIContext.bInGrid)
537 {
538 ImGui::TableSetColumnIndex(0);
539 if (!Label.empty() && Label.at(0) != '#')
540 {
541 ImGui::Text(Label.c_str());
542 /* TODO: Do PushStyle here instead. */
543 }
544 }
545 else if (IsInTable)
546 {
547 ImGui::TableSetColumnIndex(0);
548 UI::ShiftCursor(Slider::TablePaddingX, 7.0f);
549
550 ImGui::Text(Label.c_str());
551 UI::Draw::Underline(false, 0.0f, 2.0f);
552
553 ImGui::TableSetColumnIndex(1);
554 UI::ShiftCursor(7.0f, 0.0f);
555 }
556 else
557 {
558 if (!Label.empty() && Label.at(0) != '#')
559 {
560 ImGui::Text(Label.c_str());
561 /* TODO: Do PushStyle here instead. */
562 ImGui::SameLine();
563 }
564 }
565
566 {
567 static constexpr float SpacingX = 8.0f;
568 UI::FScopedStyle ItemSpacing(ImGuiStyleVar_ItemSpacing, ImVec2(SpacingX, 0.0f));
569 UI::FScopedStyle Padding(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 2.0f));
570 {
571 UI::FScopedColor Padding(ImGuiCol_Border, IM_COL32(0, 0, 0, 0));
572 UI::FScopedColor Frame(ImGuiCol_FrameBg, IM_COL32(0, 0, 0, 0));
573
574 ImGui::BeginChild(
575 ImGui::GetID((Label + "Subwindow").c_str()),
576 ImVec2((ImGui::GetContentRegionAvail().x - SpacingX), ImGui::GetFrameHeightWithSpacing() + 8.0f),
577 ImGuiChildFlags_None,
578 ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse /* Window Flags. */
579 );
580 }
581
582 static constexpr float FramePadding = 4.0f;
583 static constexpr float OutlineSpacing = 1.0f;
584 const float LineHeight = GImGui->Font->FontSize + FramePadding * 2.0f;
585 const ImVec2 ButtonSize = { LineHeight + 2.0f, LineHeight };
586 const float InputItemWidth = (ImGui::GetContentRegionAvail().x - SpacingX) / 4.0f - ButtonSize.x;
587
588 UI::ShiftCursor(0.0f, FramePadding);
589
590 auto DrawControl = [&](const std::string& InLabel,
591 float& InValue,
592 const ImVec4& InColorNormal,
593 const ImVec4& InColorHover,
594 const ImVec4& InColorPressed,
595 bool RenderMultiSelect)
596 {
597 {
598 UI::FScopedStyle ButtonFrame(ImGuiStyleVar_FramePadding, ImVec2(FramePadding, 0.0f));
599 UI::FScopedStyle ButtonRounding(ImGuiStyleVar_FrameRounding, 1.0f);
600 UI::FScopedColorStack ButtonColours(
601 ImGuiCol_Button, InColorNormal,
602 ImGuiCol_ButtonHovered, InColorHover,
603 ImGuiCol_ButtonActive, InColorPressed
604 );
605
606 if (ImGui::Button(InLabel.c_str(), ButtonSize))
607 {
608 InValue = ResetValue;
609 Modified = true;
610 LK_CORE_DEBUG("Pressed Button: {}", InLabel.c_str());
611 }
612 }
613
614 ImGui::SameLine(0.0f, OutlineSpacing);
615 ImGui::SetNextItemWidth(InputItemWidth);
616
617 ImGui::PushItemFlag(ImGuiItemFlags_MixedValue, RenderMultiSelect);
618 const ImGuiID InputID = ImGui::GetID(("##" + InLabel).c_str());
619 const bool WasTempInputActive = ImGui::TempInputIsActive(InputID);
620 Modified |= ImGui::DragFloat(("##" + InLabel).c_str(), &InValue, ValueSpeed, ValueMin, ValueMax, Format, 0);
621
622 if (ImGui::TempInputIsActive(InputID))
623 {
624 Modified = false;
625 }
626
627 ImGui::PopItemFlag();
628
629 if (WasTempInputActive)
630 {
631 ManuallyEdited |= ImGui::IsItemDeactivatedAfterEdit();
632 }
633 };
634
635 if (IsInTable)
636 {
637 ImGui::TableSetColumnIndex(1);
638 //UI::ShiftCursor(Slider::TablePaddingX, 7.0f);
639 }
640
641 /* Draw R. */
642 DrawControl(
643 "R",
644 Values.x,
645 ImVec4(0.80f, 0.10f, 0.15f, 1.0f), /* Normal */
646 ImVec4(0.90f, 0.20f, 0.20f, 1.0f), /* Hover */
647 ImVec4(0.80f, 0.10f, 0.15f, 1.0f), /* Pressed */
648 (RenderMultiSelectAxes & EVectorAxis::X)
649 );
650
651 /* Draw G. */
652 ImGui::SameLine(0.0f, OutlineSpacing);
653 DrawControl(
654 "G",
655 Values.y,
656 ImVec4(0.20f, 0.70f, 0.20f, 1.0f),
657 ImVec4(0.30f, 0.80f, 0.30f, 1.0f),
658 ImVec4(0.20f, 0.70f, 0.20f, 1.0f),
659 (RenderMultiSelectAxes & EVectorAxis::Y)
660 );
661
662 /* Draw B. */
663 ImGui::SameLine(0.0f, OutlineSpacing);
664 DrawControl(
665 "B",
666 Values.z,
667 ImVec4(0.10f, 0.25f, 0.80f, 1.0f),
668 ImVec4(0.20f, 0.35f, 0.90f, 1.0f),
669 ImVec4(0.10f, 0.25f, 0.80f, 1.0f),
670 (RenderMultiSelectAxes & EVectorAxis::Z)
671 );
672
673 /* Draw A. */
674 ImGui::SameLine(0.0f, OutlineSpacing);
675 DrawControl(
676 "A",
677 Values.w,
678 ImVec4(0.50f, 0.40f, 0.70f, 1.0f),
679 ImVec4(0.55f, 0.40f, 0.60f, 1.0f),
680 ImVec4(0.50f, 0.40f, 0.70f, 1.0f),
681 (RenderMultiSelectAxes & EVectorAxis::W)
682 );
683
684 ImGui::EndChild();
685 }
686
687 if (UIContext.bInGrid)
688 {
689 ImGui::TableNextRow();
690 }
691 else if (IsInTable)
692 {
693 ImGui::TableNextRow();
694 }
695
696 return (Modified || ManuallyEdited);
697 }
698 #endif
699 }
700
703}
Editor core.
FORCEINLINE bool Vec4Control(const std::string &Label, VectorType &Values, const float ValueSpeed=0.10f, const float ResetValue=0.0f, const float ValueMin=0.0f, const float ValueMax=0.0f, const float ColumnWidth=100.0f, const char *Format="%.2f", uint32_t RenderMultiSelectAxes=0)
Definition Slider.h:315
FORCEINLINE bool Vec3Control(const std::string &Label, VectorType &Values, const float ResetValue=0.0f, const float ValueSpeed=0.10f, const float ValueMin=0.0f, const float ValueMax=0.0f, const float ColumnWidth=100.0f, uint32_t RenderMultiSelectAxes=0, const char *Format="%.2f")
Slider widget for three-component vectors.
Definition Slider.h:165
Core UI.
Definition Style.h:52
Definition Style.h:32
Definition Style.h:22
EVectorSemantic
Definition Slider.h:29