diff --git a/ImGuizmo.cpp b/ImGuizmo.cpp index 4ec3b85d..e9dd5b53 100644 --- a/ImGuizmo.cpp +++ b/ImGuizmo.cpp @@ -61,11 +61,6 @@ namespace IMGUIZMO_NAMESPACE return static_cast(lhs) != rhs; } - static bool operator==(OPERATION lhs, int rhs) - { - return static_cast(lhs) == rhs; - } - static bool Intersects(OPERATION lhs, OPERATION rhs) { return (lhs & rhs) != 0; @@ -323,9 +318,6 @@ namespace IMGUIZMO_NAMESPACE vec_t component[4]; }; - matrix_t(const matrix_t& other) { memcpy(&m16[0], &other.m16[0], sizeof(float) * 16); } - matrix_t() {} - operator float* () { return m16; } operator const float* () const { return m16; } void Translation(float _x, float _y, float _z) { this->Translation(makeVect(_x, _y, _z)); } @@ -1229,14 +1221,14 @@ namespace IMGUIZMO_NAMESPACE } const bool usingAxis = (gContext.mbUsing && type == MT_ROTATE_Z - axis); const int circleMul = (hasRSC && !usingAxis ) ? 1 : 2; - + ImVec2* circlePos = (ImVec2*)alloca(sizeof(ImVec2) * (circleMul * halfCircleSegmentCount + 1)); float angleStart = atan2f(cameraToModelNormalized[(4 - axis) % 3], cameraToModelNormalized[(3 - axis) % 3]) + ZPI * 0.5f; for (int i = 0; i < circleMul * halfCircleSegmentCount + 1; i++) { - float ng = angleStart + circleMul * ZPI * ((float)i / (float)halfCircleSegmentCount); + float ng = angleStart + (float)circleMul * ZPI * ((float)i / (float)halfCircleSegmentCount); vec_t axisPos = makeVect(cosf(ng), sinf(ng), 0.f); vec_t pos = makeVect(axisPos[axis], axisPos[(axis + 1) % 3], axisPos[(axis + 2) % 3]) * gContext.mScreenFactor * rotationDisplayFactor; circlePos[i] = worldToPos(pos, gContext.mMVP); @@ -1314,7 +1306,7 @@ namespace IMGUIZMO_NAMESPACE scaleDisplay = gContext.mScale; } - for (unsigned int i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { if(!Intersects(op, static_cast(SCALE_X << i))) { @@ -1401,7 +1393,7 @@ namespace IMGUIZMO_NAMESPACE scaleDisplay = gContext.mScale; } - for (unsigned int i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { if (!Intersects(op, static_cast(SCALE_XU << i))) { @@ -1419,11 +1411,12 @@ namespace IMGUIZMO_NAMESPACE { bool hasTranslateOnAxis = Contains(op, static_cast(TRANSLATE_X << i)); float markerScale = hasTranslateOnAxis ? 1.4f : 1.0f; - ImVec2 baseSSpace = worldToPos(dirAxis * 0.1f * gContext.mScreenFactor, gContext.mMVPLocal); + //ImVec2 baseSSpace = worldToPos(dirAxis * 0.1f * gContext.mScreenFactor, gContext.mMVPLocal); //ImVec2 worldDirSSpaceNoScale = worldToPos(dirAxis * markerScale * gContext.mScreenFactor, gContext.mMVP); ImVec2 worldDirSSpace = worldToPos((dirAxis * markerScale * scaleDisplay[i]) * gContext.mScreenFactor, gContext.mMVPLocal); - /*if (gContext.mbUsing && (gContext.mActualID == -1 || gContext.mActualID == gContext.mEditingID)) +#if 0 + if (gContext.mbUsing && (gContext.mActualID == -1 || gContext.mActualID == gContext.mEditingID)) { drawList->AddLine(baseSSpace, worldDirSSpaceNoScale, IM_COL32(0x40, 0x40, 0x40, 0xFF), 3.f); drawList->AddCircleFilled(worldDirSSpaceNoScale, 6.f, IM_COL32(0x40, 0x40, 0x40, 0xFF)); @@ -1434,6 +1427,7 @@ namespace IMGUIZMO_NAMESPACE drawList->AddLine(baseSSpace, worldDirSSpace, colors[i + 1], 3.f); } */ +#endif drawList->AddCircleFilled(worldDirSSpace, 12.f, colors[i + 1]); } } @@ -1484,7 +1478,7 @@ namespace IMGUIZMO_NAMESPACE // draw bool belowAxisLimit = false; bool belowPlaneLimit = false; - for (unsigned int i = 0; i < 3; ++i) + for (int i = 0; i < 3; ++i) { vec_t dirPlaneX, dirPlaneY, dirAxis; ComputeTripodAxisAndVisibility(i, dirAxis, dirPlaneX, dirPlaneY, belowAxisLimit, belowPlaneLimit); @@ -1581,7 +1575,7 @@ namespace IMGUIZMO_NAMESPACE { numAxes = 0; float bestDot = 0.f; - for (unsigned int i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { vec_t dirPlaneNormalWorld; dirPlaneNormalWorld.TransformVector(directionUnary[i], gContext.mModelSource); @@ -1845,7 +1839,7 @@ namespace IMGUIZMO_NAMESPACE } // compute - for (unsigned int i = 0; i < 3 && type == MT_NONE; i++) + for (int i = 0; i < 3 && type == MT_NONE; i++) { if(!Intersects(op, static_cast(SCALE_X << i))) { @@ -1884,7 +1878,7 @@ namespace IMGUIZMO_NAMESPACE type = MT_SCALE_XYZ; } - for (unsigned int i = 0; i < 3 && type == MT_NONE; i++) + for (int i = 0; i < 3 && type == MT_NONE; i++) { if (!Intersects(op, static_cast(SCALE_XU << i))) { @@ -1900,7 +1894,7 @@ namespace IMGUIZMO_NAMESPACE { bool hasTranslateOnAxis = Contains(op, static_cast(TRANSLATE_X << i)); float markerScale = hasTranslateOnAxis ? 1.4f : 1.0f; - ImVec2 baseSSpace = worldToPos(dirAxis * 0.1f * gContext.mScreenFactor, gContext.mMVPLocal); + //ImVec2 baseSSpace = worldToPos(dirAxis * 0.1f * gContext.mScreenFactor, gContext.mMVPLocal); //ImVec2 worldDirSSpaceNoScale = worldToPos(dirAxis * markerScale * gContext.mScreenFactor, gContext.mMVP); ImVec2 worldDirSSpace = worldToPos((dirAxis * markerScale) * gContext.mScreenFactor, gContext.mMVPLocal); @@ -1935,7 +1929,7 @@ namespace IMGUIZMO_NAMESPACE vec_t modelViewPos; modelViewPos.TransformPoint(gContext.mModel.v.position, gContext.mViewMat); - for (unsigned int i = 0; i < 3 && type == MT_NONE; i++) + for (int i = 0; i < 3 && type == MT_NONE; i++) { if(!Intersects(op, static_cast(ROTATE_X << i))) { @@ -1992,7 +1986,7 @@ namespace IMGUIZMO_NAMESPACE const vec_t screenCoord = makeVect(io.MousePos - ImVec2(gContext.mX, gContext.mY)); // compute - for (unsigned int i = 0; i < 3 && type == MT_NONE; i++) + for (int i = 0; i < 3 && type == MT_NONE; i++) { vec_t dirPlaneX, dirPlaneY, dirAxis; bool belowAxisLimit, belowPlaneLimit; @@ -2782,7 +2776,7 @@ namespace IMGUIZMO_NAMESPACE } const ImVec2 panelCorners[2] = { panelPosition[iPanel], panelPosition[iPanel] + panelSize[iPanel] }; - bool insidePanel = localx > panelCorners[0].x && localx < panelCorners[1].x&& localy > panelCorners[0].y && localy < panelCorners[1].y; + bool insidePanel = localx > panelCorners[0].x && localx < panelCorners[1].x && localy > panelCorners[0].y && localy < panelCorners[1].y; int boxCoordInt = int(boxCoord.x * 9.f + boxCoord.y * 3.f + boxCoord.z); IM_ASSERT(boxCoordInt < 27); boxes[boxCoordInt] |= insidePanel && (!isDraging) && gContext.mbMouseOver; @@ -2801,7 +2795,7 @@ namespace IMGUIZMO_NAMESPACE int cx = boxCoordInt / 9; int cy = (boxCoordInt - cx * 9) / 3; int cz = boxCoordInt % 3; - interpolationDir = makeVect(1.f - cx, 1.f - cy, 1.f - cz); + interpolationDir = makeVect(1.f - (float)cx, 1.f - (float)cy, 1.f - (float)cz); interpolationDir.Normalize(); if (fabsf(Dot(interpolationDir, referenceUp)) > 1.0f - 0.01f)