mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-20 06:49:19 +02:00
reformat: set variables to constexpr where possible
This commit is contained in:
@@ -49,10 +49,10 @@
|
||||
|
||||
namespace ImGuizmo
|
||||
{
|
||||
static const float ZPI = 3.14159265358979323846f;
|
||||
static constexpr float ZPI = 3.14159265358979323846f;
|
||||
static const float RAD2DEG = (180.f / ZPI);
|
||||
static const float DEG2RAD = (ZPI / 180.f);
|
||||
const float screenRotateSize = 0.06f;
|
||||
constexpr float screenRotateSize = 0.06f;
|
||||
|
||||
static OPERATION operator&(OPERATION lhs, OPERATION rhs)
|
||||
{
|
||||
@@ -741,24 +741,24 @@ namespace ImGuizmo
|
||||
static Context gContext;
|
||||
|
||||
static const vec_t directionUnary[3] = { makeVect(1.f, 0.f, 0.f), makeVect(0.f, 1.f, 0.f), makeVect(0.f, 0.f, 1.f) };
|
||||
static const ImU32 directionColor[3] = { IM_COL32(0xAA, 0, 0, 0xFF), IM_COL32(0, 0xAA, 0, 0xFF), IM_COL32(0, 0, 0xAA, 0XFF) };
|
||||
static constexpr ImU32 directionColor[3] = { IM_COL32(0xAA, 0, 0, 0xFF), IM_COL32(0, 0xAA, 0, 0xFF), IM_COL32(0, 0, 0xAA, 0XFF) };
|
||||
|
||||
// Alpha: 100%: FF, 87%: DE, 70%: B3, 54%: 8A, 50%: 80, 38%: 61, 12%: 1F
|
||||
static const ImU32 planeColor[3] = { IM_COL32(0xAA, 0, 0, 0x61), IM_COL32(0, 0xAA, 0, 0x61), IM_COL32(0, 0, 0xAA, 0x61) };
|
||||
static const ImU32 selectionColor = IM_COL32(0xFF, 0x80, 0x10, 0x8A);
|
||||
static const ImU32 inactiveColor = IM_COL32(0x99, 0x99, 0x99, 0x99);
|
||||
static const ImU32 translationLineColor = IM_COL32(0xAA, 0xAA, 0xAA, 0xAA);
|
||||
static constexpr ImU32 planeColor[3] = { IM_COL32(0xAA, 0, 0, 0x61), IM_COL32(0, 0xAA, 0, 0x61), IM_COL32(0, 0, 0xAA, 0x61) };
|
||||
static constexpr ImU32 selectionColor = IM_COL32(0xFF, 0x80, 0x10, 0x8A);
|
||||
static constexpr ImU32 inactiveColor = IM_COL32(0x99, 0x99, 0x99, 0x99);
|
||||
static constexpr ImU32 translationLineColor = IM_COL32(0xAA, 0xAA, 0xAA, 0xAA);
|
||||
static const char* translationInfoMask[] = { "X : %5.3f", "Y : %5.3f", "Z : %5.3f",
|
||||
"Y : %5.3f Z : %5.3f", "X : %5.3f Z : %5.3f", "X : %5.3f Y : %5.3f",
|
||||
"X : %5.3f Y : %5.3f Z : %5.3f" };
|
||||
static const char* scaleInfoMask[] = { "X : %5.2f", "Y : %5.2f", "Z : %5.2f", "XYZ : %5.2f" };
|
||||
static const char* rotationInfoMask[] = { "X : %5.2f deg %5.2f rad", "Y : %5.2f deg %5.2f rad", "Z : %5.2f deg %5.2f rad", "Screen : %5.2f deg %5.2f rad" };
|
||||
static const int translationInfoIndex[] = { 0,0,0, 1,0,0, 2,0,0, 1,2,0, 0,2,0, 0,1,0, 0,1,2 };
|
||||
static const float quadMin = 0.5f;
|
||||
static const float quadMax = 0.8f;
|
||||
static constexpr float quadMin = 0.5f;
|
||||
static constexpr float quadMax = 0.8f;
|
||||
static const float quadUV[8] = { quadMin, quadMin, quadMin, quadMax, quadMax, quadMax, quadMax, quadMin };
|
||||
static const int halfCircleSegmentCount = 64;
|
||||
static const float snapTension = 0.5f;
|
||||
static constexpr int halfCircleSegmentCount = 64;
|
||||
static constexpr float snapTension = 0.5f;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -918,7 +918,7 @@ namespace ImGuizmo
|
||||
|
||||
void BeginFrame()
|
||||
{
|
||||
const ImU32 flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus;
|
||||
constexpr ImU32 flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus;
|
||||
|
||||
#ifdef IMGUI_HAS_VIEWPORT
|
||||
ImGui::SetNextWindowSize(ImGui::GetMainViewport()->Size);
|
||||
@@ -1562,8 +1562,8 @@ namespace ImGuizmo
|
||||
}
|
||||
vec_t midPoint = (aabb[i] + aabb[(i + 1) % 4]) * 0.5f;
|
||||
ImVec2 midBound = worldToPos(midPoint, boundsMVP);
|
||||
static const float AnchorBigRadius = 8.f;
|
||||
static const float AnchorSmallRadius = 6.f;
|
||||
static constexpr float AnchorBigRadius = 8.f;
|
||||
static constexpr float AnchorSmallRadius = 6.f;
|
||||
bool overBigAnchor = ImLengthSqr(worldBound1 - io.MousePos) <= (AnchorBigRadius * AnchorBigRadius);
|
||||
bool overSmallAnchor = ImLengthSqr(midBound - io.MousePos) <= (AnchorBigRadius * AnchorBigRadius);
|
||||
|
||||
@@ -2536,7 +2536,7 @@ namespace ImGuizmo
|
||||
const vec_t camTarget = viewInverse.v.position - viewInverse.v.dir * length;
|
||||
|
||||
// view/projection matrices
|
||||
const float distance = 3.f;
|
||||
constexpr float distance = 3.f;
|
||||
matrix_t cubeProjection, cubeView;
|
||||
float fov = acosf(distance / (sqrtf(distance * distance + 3.f))) * RAD2DEG;
|
||||
Perspective(fov / sqrtf(2.f), size.x / size.y, 0.01f, 1000.f, cubeProjection.m16);
|
||||
|
||||
Reference in New Issue
Block a user