Immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui

ImGuizmo

Latest stable tagged version is 1.83. Current master version is 1.84 WIP.

What started with the gizmo is now a collection of dear imgui widgets and more advanced controls.

Guizmos

ImViewGizmo

Manipulate view orientation with 1 single line of code

Image of ImViewGizmo

ImGuizmo

ImGizmo is a small (.h and .cpp) library built ontop of Dear ImGui that allow you to manipulate(Rotate & translate at the moment) 4x4 float matrices. No other dependancies. Coded with Immediate Mode (IM) philosophy in mind.

Built against DearImgui 1.53WIP

Image of Rotation Image of Translation Image of Bounds

There is now a sample for Win32/OpenGL ! With a binary in bin directory. Image of Sample

ImSequencer

A WIP little sequencer used to edit frame start/end for different events in a timeline. Image of Rotation Check the sample for the documentation. More to come...

Graph Editor

Nodes + connections. Custom draw inside nodes is possible with the delegate system in place. Image of GraphEditor

API doc

Call BeginFrame right after ImGui_XXXX_NewFrame();

void BeginFrame();

return true if mouse cursor is over any gizmo control (axis, plan or screen component)

bool IsOver();**

return true if mouse IsOver or if the gizmo is in moving state

bool IsUsing();**

enable/disable the gizmo. Stay in the state until next call to Enable. gizmo is rendered with gray half transparent color when disabled

void Enable(bool enable);**

helper functions for manualy editing translation/rotation/scale with an input float translation, rotation and scale float points to 3 floats each Angles are in degrees (more suitable for human editing) example:

 float matrixTranslation[3], matrixRotation[3], matrixScale[3];
 ImGuizmo::DecomposeMatrixToComponents(gizmoMatrix.m16, matrixTranslation, matrixRotation, matrixScale);
 ImGui::InputFloat3("Tr", matrixTranslation, 3);
 ImGui::InputFloat3("Rt", matrixRotation, 3);
 ImGui::InputFloat3("Sc", matrixScale, 3);
 ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, gizmoMatrix.m16);

These functions have some numerical stability issues for now. Use with caution.

void DecomposeMatrixToComponents(const float *matrix, float *translation, float *rotation, float *scale);
void RecomposeMatrixFromComponents(const float *translation, const float *rotation, const float *scale, float *matrix);**

Render a cube with face color corresponding to face normal. Usefull for debug/test

void DrawCube(const float *view, const float *projection, float *matrix);**

Call it when you want a gizmo Needs view and projection matrices. Matrix parameter is the source matrix (where will be gizmo be drawn) and might be transformed by the function. Return deltaMatrix is optional. snap points to a float[3] for translation and to a single float for scale or rotation. Snap angle is in Euler Degrees.

    enum OPERATION
    {
        TRANSLATE,
        ROTATE,
        SCALE
    };

    enum MODE
    {
        LOCAL,
        WORLD
    };

void Manipulate(const float *view, const float *projection, OPERATION operation, MODE mode, float *matrix, float *deltaMatrix = 0, float *snap = 0);**

ImGui Example

Code for :

Image of dialog

void EditTransform(const Camera& camera, matrix_t& matrix)
{
    static ImGuizmo::OPERATION mCurrentGizmoOperation(ImGuizmo::ROTATE);
    static ImGuizmo::MODE mCurrentGizmoMode(ImGuizmo::WORLD);
    if (ImGui::IsKeyPressed(90))
        mCurrentGizmoOperation = ImGuizmo::TRANSLATE;
    if (ImGui::IsKeyPressed(69))
        mCurrentGizmoOperation = ImGuizmo::ROTATE;
    if (ImGui::IsKeyPressed(82)) // r Key
        mCurrentGizmoOperation = ImGuizmo::SCALE;
    if (ImGui::RadioButton("Translate", mCurrentGizmoOperation == ImGuizmo::TRANSLATE))
        mCurrentGizmoOperation = ImGuizmo::TRANSLATE;
    ImGui::SameLine();
    if (ImGui::RadioButton("Rotate", mCurrentGizmoOperation == ImGuizmo::ROTATE))
        mCurrentGizmoOperation = ImGuizmo::ROTATE;
    ImGui::SameLine();
    if (ImGui::RadioButton("Scale", mCurrentGizmoOperation == ImGuizmo::SCALE))
        mCurrentGizmoOperation = ImGuizmo::SCALE;
    float matrixTranslation[3], matrixRotation[3], matrixScale[3];
    ImGuizmo::DecomposeMatrixToComponents(matrix.m16, matrixTranslation, matrixRotation, matrixScale);
    ImGui::InputFloat3("Tr", matrixTranslation, 3);
    ImGui::InputFloat3("Rt", matrixRotation, 3);
    ImGui::InputFloat3("Sc", matrixScale, 3);
    ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, matrix.m16);

    if (mCurrentGizmoOperation != ImGuizmo::SCALE)
    {
        if (ImGui::RadioButton("Local", mCurrentGizmoMode == ImGuizmo::LOCAL))
            mCurrentGizmoMode = ImGuizmo::LOCAL;
        ImGui::SameLine();
        if (ImGui::RadioButton("World", mCurrentGizmoMode == ImGuizmo::WORLD))
            mCurrentGizmoMode = ImGuizmo::WORLD;
    }
    static bool useSnap(false);
    if (ImGui::IsKeyPressed(83))
        useSnap = !useSnap;
    ImGui::Checkbox("", &useSnap);
    ImGui::SameLine();
    vec_t snap;
    switch (mCurrentGizmoOperation)
    {
    case ImGuizmo::TRANSLATE:
        snap = config.mSnapTranslation;
        ImGui::InputFloat3("Snap", &snap.x);
        break;
    case ImGuizmo::ROTATE:
        snap = config.mSnapRotation;
        ImGui::InputFloat("Angle Snap", &snap.x);
        break;
    case ImGuizmo::SCALE:
        snap = config.mSnapScale;
        ImGui::InputFloat("Scale Snap", &snap.x);
        break;
    }
    ImGuiIO& io = ImGui::GetIO();
    ImGuizmo::SetRect(0, 0, io.DisplaySize.x, io.DisplaySize.y);
    ImGuizmo::Manipulate(camera.mView.m16, camera.mProjection.m16, mCurrentGizmoOperation, mCurrentGizmoMode, matrix.m16, NULL, useSnap ? &snap.x : NULL);
}

Install

ImGuizmo can be installed via vcpkg and used cmake

vcpkg install vcpkg

See the vcpkg example for more details

License

ImGuizmo is licensed under the MIT License, see LICENSE for more information.

Comments
  • ImGuizmo::Manipulate return nan matrix on linux

    ImGuizmo::Manipulate return nan matrix on linux

    Hello ! I'm using ImGuizmo with GLFW and Vulkan. The code is working flawlessly on Windows, but not on Linux. The Guizmo is wrongly positioned (I'm currently selecting the white plane);

    Screenshot_20211014_105115

    The model matrix :

    (1.000000, 0.000000, 0.000000, 0.000000), 
    (0.000000, 1.000000, 0.000000, 0.000000),
    (0.000000, 0.000000, 1.000000, 0.000000),
    (0.000000, 0.000000, 0.000000, 1.000000)
    
    ImGuizmo::Manipulate(glm::value_ptr(cameraView), glm::value_ptr(cameraProjection), ImGuizmo::TRANSLATE , ImGuizmo::LOCAL, glm::value_ptr(object.getModelMatrix());
    

    object.getModelMatrix() return a reference to the model matrix. The object transform is stored has the model matrix directly. cameraProjection is created with glm::projection cameraView is created with glm::lookAt

    After the call to manipulate, the model matrix is set to NaN most of the time.

  • Orientation of Rotation Gizmo is flipped

    Orientation of Rotation Gizmo is flipped

    My Translation and Scaling Gizmos work fine and are oriented in the right way. My Rotation Gizmo works more or less but the orientation is messed up, as you can see below:

    Screenshot (23) Screenshot (24)

    I have no idea what might be wrong because the other two gizmos are displayed correctly(I use OpenGL's right handed coordinate system): Screenshot (25)

    What might be the Issue? Thanks in advance.

  • guizmo is out of the box if I'm far away

    guizmo is out of the box if I'm far away

    Hi, the closer I am to the object, the more guizmo is centered and the further I go backwards, the more it bends, it is normal? https://user-images.githubusercontent.com/82084934/129267758-0bd2f7b1-8049-43bb-9cab-d2ba7d119795.mp4

  • Rotation does not work very well

    Rotation does not work very well

    Hello, I have difficulties with the rotation guizmo, when I get the matrix from the manipulate function, I get results which vary from frame to frame, and which do not rotate the object correctly, sometimes even do not rotate the object at all. The translation and scale works good. Can you help me ? Thank you

  • Gizmo behaving weirdly

    Gizmo behaving weirdly

    Hey,

    I've tried implementing this wonderful little library but for reasons I don't understand the gizmo behaves not the way I'd expect it to. Instead of sticking to the object that I want to manipulate, it seems to incorporate the distance to the camera giving it a weird offset to the object from greater distances. Here's what I mean:

    illustration

    I've looked into other issues that seemed to be related to this one and the common fix is to properly call ImGuizmo::SetRect but no matter what I try the behaviour doesn't change.

    Here's my code:

            void draw_gizmo(scene::scene& scene, ImVec2 const& panel_size)
            {
                auto selected_entity = scene.selected_entity();
                if (selected_entity)
                {
                    return;
                }
    
                ImGuizmo::SetOrthographic(false);
                ImGuizmo::SetDrawlist();
    
                auto viewportMinRegion = ImGui::GetWindowContentRegionMin();
                auto viewportMaxRegion = ImGui::GetWindowContentRegionMax();
                auto viewportOffset = ImGui::GetWindowPos();
                auto size = ImGui::GetWindowSize();
                auto min = glm::vec2{viewportMinRegion.x + viewportOffset.x, viewportMinRegion.y + viewportOffset.y};
                auto max =
                    glm::vec2{viewportMaxRegion.x + viewportOffset.x, viewportMaxRegion.y - viewportOffset.y / 2};
                ImGuizmo::SetRect(min.x, min.y, max.x, max.y);
    
                glm::ivec2 isize;
                glfwGetWindowSize(glfwGetCurrentContext(), &isize.x, &isize.y);
                // ImGuizmo::SetRect(viewportOffset.x, viewportOffset.y, isize.x, isize.y);
    
                ImVec2 windowSize = ImGui::GetWindowSize();
                // ImGuizmo::SetRect(viewportOffset.x, viewportOffset.y, windowSize.x, windowSize.y);
                // ImGuizmo::SetRect(viewportOffset.x, viewportOffset.y, panel_size.x, panel_size.y);
    
                auto camera_entity = scene.active_camera();
                auto const& camera_component = camera_entity.get_component<scene::camera_component>();
    
                auto projection = camera_component.projection();
                auto view = camera_component.view();
                auto& transform_component = selected_entity->get_component<scene::transform_component>();
                auto& transform = transform_component.transform();
    
                float snap[3] = {0.5f, 0.5f, 0.5f};
    
                if (ImGuizmo::Manipulate(glm::value_ptr(view), glm::value_ptr(projection), ImGuizmo::TRANSLATE,
                                         ImGuizmo::LOCAL, glm::value_ptr(transform), nullptr, snap))
                {
                    glm::vec3 scale;
                    glm::quat rotation;
                    glm::vec3 translation;
                    glm::vec3 skew;
                    glm::vec4 perspective;
    
                    if (glm::decompose(transform, scale, rotation, translation, skew, perspective))
                    {
                        rotation = glm::conjugate(rotation);
    
                        transform_component.translation() = translation;
                        transform_component.rotation() = glm::radians(glm::eulerAngles(rotation));
                        transform_component.scale() = scale;
                        transform_component.recalculate_transform();
                    }
                }
            }
        }
    

    As you can see from the commented-out lines I've tried a number of different versions of ImGuizmo::SetRect (and pretty much any thinkable permutation).

    Some more info:

    • I'm using the docking branch of imgui
    • I'm using glm as my math library

    I'm at a total loss and this is a last ditch effort before I have to implement my own gizmos.

  • ViewManipulate() behaves not as intended

    ViewManipulate() behaves not as intended

    So far i am unable to get ViewManipulate() to orbit object.

    Code im using:

    Camera* camera = GetCamera();
    Node* cameraNode = camera->GetNode();
    float length = 10;
    Matrix4 view = camera->GetView().ToMatrix4().Transpose();
    ImGuizmo::ViewManipulate(&view.m00_, length, pos, size, 0);
    cameraNode->SetWorldTransform(Matrix3x4(view.Transpose().Inverse()));
    

    Conventions of the engine: Left-handed coordinates. Positive X, Y & Z axes point to the right, up, and forward, and positive rotation is clockwise, column-major matrices.

    It seems as if camera is rotating a point behind it..? Here is a video: ViewManipulate-rotation.zip

    Do you think this could be a mismatch between conventions that engine uses and conventions that ViewManipulate() expects?

  • Rotation Gizmo Input Bug

    Rotation Gizmo Input Bug

    Me and @GlynLeine discovered a little issue with the Rotation Gizmo that struck us as rather odd This is the issue we encountered: backside-issue As you can see we are only able to use the gizmo from the parts we cannot actually see. We made an adjusment to line number 1661 of ImGuizmo.cpp which seems to fix this issue:

    //was
    if (Dot(Normalized(localPos), gContext.mRayVector) > FLT_EPSILON)
    //now
    if (Dot(Normalized(localPos), gContext.mRayVector) < -FLT_EPSILON)
    

    As demonstrated here: backside-fixed

  • Translation axis isnt responding

    Translation axis isnt responding

    Hello, translation axis isnt responding, highlighted, when cursor is over, scale and rotation axis work fine though. There is no issue when i apply SetRect func position to zero. Probably i'm missing something, thanks.

  • ImGui::Image Blocking ImGuizmo

    ImGui::Image Blocking ImGuizmo

    ImGui::Image(SCENE_RENDER_TEXTURE, data.WindowScale);
    
    ImVec2 panelSize = ImGui::GetContentRegionAvail();
    ImGuizmo::Enable(true);
    ImGuizmo::SetOrthographic(false);
    ImGuizmo::SetDrawlist();
    ImGuizmo::SetRect(ImGui::GetWindowPos().x, ImGui::GetWindowPos().y, panelSize.x, panelSize.y);
    
    ImGuizmo::Manipulate(data.view, data.projection, operation, ImGuizmo::MODE::LOCAL, data.matrix);
    
    

    I'm working with DIRECTX11 and docking, if I remove first line of this code, I can see gizmo but, somehow my scene render texture is blocking imguizmo this is with scene render texture image this is without scene render texture image

  • Rotation not working when using DirectXMath

    Rotation not working when using DirectXMath

    I have an issue with my rotation, the translation and scale is working with issues but when I'm trying the rotation the object seems "stuck". Here is how it looks: https://gyazo.com/dd412eb7bcbd282f4fb6f97bb0d9b1c9

    I tried to using the ImGuizmos built in RecomposeMatrixFromComponents and then DecomposeMatrixToComponents before loading it back into my transformation component. The issue I got then were that the rotation seemed to be giving me values between 0 to 20000. Here is the relevant code:

    // Editor Camera
    DirectX::XMFLOAT4X4 cameraProjection;
    DirectX::XMStoreFloat4x4(&cameraProjection, mEditorCamera->GetProjection());
    DirectX::XMFLOAT4X4 cameraView;
    DirectX::XMStoreFloat4x4(&cameraView, mEditorCamera->GetViewMatrix());
    
    // Entity transform
    auto& tc = selectedEntity.GetComponent<TransformComponent>();
    DirectX::XMFLOAT4X4 transform;
    DirectX::XMStoreFloat4x4(&transform, tc.GetTransform());
    //float Ftranslation[3] = { tc.Translation.x, tc.Translation.y, tc.Translation.z };
    //float Frotation[3] = { tc.Rotation.x, tc.Rotation.y, tc.Rotation.z };
    //float Fscale[3] = { tc.Scale.x, tc.Scale.y, tc.Scale.z };
    //ImGuizmo::RecomposeMatrixFromComponents(Ftranslation, Frotation, Fscale, *transform.m);
    
    ImGuizmo::Manipulate(*cameraView.m, *cameraProjection.m, (ImGuizmo::OPERATION)mGizmoType, ImGuizmo::LOCAL, *transform.m);
    if (ImGuizmo::IsUsing())
    {
    	TOAST_CORE_INFO("tc.Rotation.x: {0}", tc.Rotation.x);
    	TOAST_CORE_INFO("tc.Rotation.y: {0}", tc.Rotation.y);
    	TOAST_CORE_INFO("tc.Rotation.z: {0}\n", tc.Rotation.z);
    
    	DirectX::XMMATRIX test = DirectX::XMLoadFloat4x4(&transform);
    
    	DirectX::XMVECTOR translation, rotation, scale;
    	DirectX::XMMatrixDecompose(&scale, &rotation, &translation, test);
    	float F2translation[3] = { 0.0f, 0.0f, 0.0f };
    	float F2rotation[3] = { 0.0f, 0.0f, 0.0f };
    	float F2scale[3] = { 0.0f, 0.0f, 0.0f };
    	ImGuizmo::DecomposeMatrixToComponents(*transform.m, F2translation, F2rotation, F2scale);
    
    	DirectX::XMFLOAT3 xmfTranslation = DirectX::XMFLOAT3(F2translation);
    	DirectX::XMFLOAT3 xmfScale = DirectX::XMFLOAT3(F2scale);
    	DirectX::XMFLOAT3 xmfRotation = DirectX::XMFLOAT3(F2rotation);
    
    	//tc.Translation = xmfTranslation;
    	//tc.Rotation = xmfRotation;
    	//tc.Scale = xmfScale;
    
    	DirectX::XMStoreFloat3(&tc.Translation, translation);
    	DirectX::XMStoreFloat3(&tc.Rotation, rotation);
    	DirectX::XMStoreFloat3(&tc.Scale, scale);
    }
    

    I have issue finding examples of people that tried to do the same so I have little to go on

  • Some troubles with integration

    Some troubles with integration

    I'm trying to use your library for my engine, but I can't properly integrate it. I have that rendering model: Scene -> Hierarchy -> GameObject -> Transform { position, rotation, scale } + EditorCamera as a GameObject When I select a GameObject in hierarchy, I expect to edit its transform, but:

    1. I cannot properly build matrices for ImGuizmo (Maybe I'm so stupid, but nothing I tried helps me)
    2. It render grid and maybe something else orthographically
    3. Even if I get some success, ImGuizmo renders on the background(behind all windows, but I need to render it over the render window only)

    Screenshots: image image image

    Code of transform editing function:

    void EditTransform(Transform* t)
        {
            auto cam = EditorInstance::GetSingleton()->currentScene->Get("Editor Camera");
            auto camCmp = cam->GetComponent<Camera>();
    
            ImGuizmo::SetOrthographic(false);
            ImGuizmo::BeginFrame();
            ImGuizmo::Enable(true);
    
    
            ImGuiIO& io = ImGui::GetIO();
            ImGuizmo::SetRect(0, 0, io.DisplaySize.x, io.DisplaySize.y);
    
            float* _view = new float[16];
            glm::mat4 mmat = glm::mat4();
            glm::translate(mmat, glm::vec3{t->globalPosition().x, t->globalPosition().y, t->globalPosition().z});
            glm::scale(mmat, glm::vec3{t->scale.x, t->scale.y, t->scale.z});
            glm::rotate(mmat, (float)t->rotation.x , glm::vec3{1, 0, 0});
            glm::rotate(mmat, (float)t->rotation.y , glm::vec3{0, 1, 0});
            glm::rotate(mmat, (float)t->rotation.z , glm::vec3{0, 0, 1});
            
            // ==> WHAT AM I DOING WRONG? NOTHING OF NEXT WORKS PROPERLY.
            //_view =(float*)glm::value_ptr(mmat);
            glGetFloatv(GL_MODELVIEW_MATRIX, _view);
            glm::fmat4 view = glm::mat4(*_view);
    
            float* _proj = new float[16];
            glm::mat4 pmat = glm::perspectiveFov(camCmp->fov, io.DisplaySize.x, io.DisplaySize.y, camCmp->_near, camCmp->_far);
    
    //  ==> AND HERE TOO
    //        _proj = (float*)glm::value_ptr(pmat);
    //        glGetFloatv(GL_PROJECTION_MATRIX, _proj);
            glm::fmat4 projection = pmat; //(*_proj);
    
    
            auto matrix = glm::lookAt(
                glm::vec3{ cam->transform.globalPosition().x, cam->transform.globalPosition().y, cam->transform.globalPosition().z },
    //            { t->globalPosition().x, t->globalPosition().y, t->globalPosition().z },
                { cam->transform.globalPosition().x + cam->transform.direction().x, cam->transform.globalPosition().y + cam->transform.direction().y, cam->transform.globalPosition().z + cam->transform.direction().z },
                { 0, 1, 0});
    
            ImGuizmo::DrawGrid(&view[0][0], &projection[0][0], &matrix[0][0], 200.0f);
            ImGuizmo::Manipulate(&view[0][0], &projection[0][0], ImGuizmo::TRANSLATE, ImGuizmo::WORLD, &matrix[0][0], NULL, NULL);
        }
    

    Code of render window function:

     void winRender(){
            ImGui::Begin("Render", &win->render, window_flags);
            ImVec2 pos = ImGui::GetWindowPos();
            auto tex = dynamic_cast<NukeOGL*>(EditorInstance::GetSingleton()->render)->getRenderTexture();
            ImVec2 maxPos = ImVec2(pos.x + ImGui::GetWindowSize().x, pos.y + ImGui::GetWindowSize().y + 2);
            ImGui::GetWindowDrawList()->AddImage((void *)tex,
                                                 ImVec2(ImGui::GetItemRectMin().x + 0,
                                                ImGui::GetItemRectMin().y - 2),
                                                 maxPos, ImVec2(0,1), ImVec2(1,0));
            if(EditorInstance::GetSingleton()->selectedInHieararchy){
               EditTransform(&EditorInstance::GetSingleton()->selectedInHieararchy->transform);
            }
    
            ImGui::End();
        }
    
  • Add style/color override options for #147

    Add style/color override options for #147

    Couldn't resolve the conflicts through GitHub so I've recreated the PR with my branch up to date

    Initial work on adding style/color override options for the gizmos. This is a PR for https://github.com/CedricGuillemet/ImGuizmo/issues/147.

    I've tried to keep the API as close to ImGui's style API as possible, there's no support for push/popping styles/colors as I personally didn't find any need for it in my own project. You setup the style once just like you would with ImGui themes.

    Not only does this support changing colors but I've also exposed a few float values to control thicknesses of the lines in some gizmos.

    I haven't provided any demos but can if needed, basic setup looks something like this (taken from my own project running this PR)

    ImGuizmo::Style* style  = &ImGuizmo::GetStyle(); // get a pointer to the global style context
    ImVec4*          colors = style->Colors;         // get access to the colors array
    

    after we have those pointers, we can edit the style of the gizmos:

    // make the translation lines smaller, but have a bigger arrow head
    style->TranslationLineThickness = 2.0f;
    style->TranslationLineArrowSize = 10.0f;
    
    // lighter r/g/b colours
    colors[ImGuizmo::DIRECTION_X] = ImVec4(0.858f, 0.243f, 0.113f, 0.929f);
    colors[ImGuizmo::DIRECTION_Y] = ImVec4(0.603f, 0.952f, 0.282f, 0.929f);
    colors[ImGuizmo::DIRECTION_Z] = ImVec4(0.227f, 0.478f, 0.972f, 0.929f);
    

    Feedback is welcome, if you have any issues with the API or the naming of things, I'm happy to edit.

    Thanks.

  • Option to rotate proportionally to mouse delta x/y

    Option to rotate proportionally to mouse delta x/y

    I think most of the tools (Unity, 3ds Max, Blender?) rotate with fixed speed, e.g. 5 degrees per mouse delta x. While ImGuizmo rotates based on cursor position, therefore it's nearly impossible to precisely rotate object if rotation axis is almost parallel to the screen. Example:

    image

    How can I implement this feature, so I can maybe make a PR, or, at least, have it for myself?

    PS: I genuinelly don't understand how that's not a feature after all these years.

  • Option for ignoring projection matrix width & height

    Option for ignoring projection matrix width & height

    Is there a built-in way of disabling the gizmo scaling based on projection matrix size (ie. screen size)? I can see that the mScreenFactor variable controls the overall scale of everything, but I wasn't able to find a simple way to just have a set value for it & have it stay the same size depending on how far the camera is from the transform. Thanks in advance 😄.

  • Clipping bug in grid-drawing?

    Clipping bug in grid-drawing?

    https://github.com/CedricGuillemet/ImGuizmo/blob/551bf0e7d36323d3df1e6c089dd08d3b2715d01a/ImGuizmo.cpp#L2632-L2633

    I notice that the clipping assumes that the grid is where the camera is and doesn't at all factor in the grid's location based on matrix since it's only clipping against a frustum that is built only on view and projection. As a result, lines are culled out or clipped based on not where it actually is, so I see some strange results as I move the camera around. Later on, matrix is factored into the final screen positions, but that's after culling/clipping.

  • Singularity in DecomposeMatrixToComponents

    Singularity in DecomposeMatrixToComponents

    All axes are fine, but when you rotate the Y axis on the -90 and 90 edges the angle is inverted and does not behave correctly. (In the video Y axis is Z, as I have a different stored rotation)

            ...
    	std::array rot = { -rotates[1], rotates[2], -rotates[0] };
    	std::array<float, 16> matrix{};
    	ImGuizmo::RecomposeMatrixFromComponents(pos.data(), rot.data(), scaleVec.data(), matrix.data());
    
    	Perspective(TheCamera.FindCamFOV() / 2.0f, ImGui::GetIO().DisplaySize.x / ImGui::GetIO().DisplaySize.y, 0.1f, 100.f, cameraProjection);
    
    	ImGuizmo::SetOrthographic(false);
    	ImGuizmo::BeginFrame();
    
    	EditTransform(cameraView, cameraProjection, matrix.data(), true);
    
    	if (ImGuizmo::IsUsing()) {
    		float newScale[3];
    		float newRot[3];
    		float newPos[3];
    		ImGuizmo::DecomposeMatrixToComponents(matrix.data(), newPos, newRot, newScale);
    		rotates[0] = -newRot[2];
    		rotates[1] = -newRot[0];
    		rotates[2] =  newRot[1];
             ...
    

    https://user-images.githubusercontent.com/20752579/169524827-671b3085-a3b5-4ab8-90a3-af6a5088e27d.mp4

  • isUsing equivalent for ViewManipulate?

    isUsing equivalent for ViewManipulate?

    Currently isUsing and friends tell you whether you are using the Manipulate gizmos (translate, rotate, scale), but there doesn't seem to be any way to query whether you are using the ViewManipulate gizmo.

    I think this could be achieved by moving some of the static state in ViewManipulate into global state and repeating what is done for isUsing.

    Or am I missing some function of how to query this state?

Related tags
This is a collection of widgets and utilities for the immediate mode GUI (imgui) that I am developing for the critic2 GUI
This is a collection of widgets and utilities for the immediate mode GUI (imgui) that I am developing for the critic2 GUI

ImGui Goodies This is a collection of widgets and utilities for the immediate mode GUI (imgui) that I am developing for the critic2 GUI. Currently, th

Jun 22, 2022
imgui-filebrowser is a header-only file browser implementation for dear-imgui. C++ 17 is required.
imgui-filebrowser is a header-only file browser implementation for dear-imgui. C++ 17 is required.

imgui-filebrowser imgui-filebrowser is a header-only file browser implementation for dear-imgui. C++ 17 is required. Getting Started imfilebrowser.h s

Aug 15, 2022
ImTui: Immediate Mode Text-based User Interface C++ Library
ImTui: Immediate Mode Text-based User Interface C++ Library

ImTui is an immediate mode text-based user interface library. Supports 256 ANSI colors and mouse/keyboard input.

Aug 9, 2022
wxWidgets is a free and open source cross-platform C++ framework for writing advanced GUI applications using native controls.
wxWidgets is a free and open source cross-platform C++ framework for writing advanced GUI applications using native controls.

About wxWidgets is a free and open source cross-platform C++ framework for writing advanced GUI applications using native controls. wxWidgets allows y

Aug 11, 2022
raygui is a simple and easy-to-use immediate-mode-gui library.
raygui is a simple and easy-to-use immediate-mode-gui library.

raygui is a simple and easy-to-use immediate-mode-gui library.

Aug 13, 2022
This is a minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain
This is a minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain

This is a minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain. It was designed as a simple embeddable user interface for application and does not have any dependencies, a default render backend or OS window and input handling but instead provides a very modular library approach by using simple input state for input and draw commands describing primitive shapes as output.

Aug 16, 2022
FlatUI is a immediate mode C++ GUI library for games and graphical applications.

FlatUI is a immediate mode C++ GUI library for games and graphical applications. Go to our landing page to browse our documentation.

Aug 5, 2022
A single-header ANSI C immediate mode cross-platform GUI library
A single-header ANSI C immediate mode cross-platform GUI library

Nuklear This is a minimal-state, immediate-mode graphical user interface toolkit written in ANSI C and licensed under public domain. It was designed a

Aug 14, 2022
The HorusUI library allows you to quickly develop GUIs for your applications by leveraging the ease of use provided by immediate mode GUI concepts.
The HorusUI library allows you to quickly develop GUIs for your applications by leveraging the ease of use provided by immediate mode GUI concepts.

Immediate Mode Graphical User Interface for Tools OVERVIEW The HorusUI library allows you to quickly develop GUIs for your applications by leveraging

Jul 13, 2022
A tiny, portable, immediate-mode UI library written in ANSI C
A tiny, portable, immediate-mode UI library written in ANSI C

A tiny, portable, immediate-mode UI library written in ANSI C Features Tiny: around 1100 sloc of ANSI C Works within a fixed-sized memory region: no a

Aug 8, 2022
Window and GUI system based on Dear ImGui from OCornut
Window and GUI system based on Dear ImGui from OCornut

ImWindow Window and GUI system based on ImGui from OCornut. Include docking/floating window, multi window and multi render support. Platform Actually

Aug 2, 2022
This project aims to simplify creation of basic Arduino programs by just editing a UI on Android.
This project aims to simplify creation of basic Arduino programs by just editing a UI on Android.

ArdUI A video explanation If you are more a fun of video explanation go to this youtube video Project aim This project aims to simplify creation of ba

Feb 23, 2022
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies

Dear ImGui (This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addit

Aug 16, 2022
Advanced 2D Plotting for Dear ImGui
Advanced 2D Plotting for Dear ImGui

ImPlot ImPlot is an immediate mode, GPU accelerated plotting library for Dear ImGui. It aims to provide a first-class API that ImGui fans will love. I

Aug 8, 2022
Real-time GUI layout creator/editor for Dear ImGui
Real-time GUI layout creator/editor for Dear ImGui

ImStudio Real-time GUI layout creator/editor for Dear ImGui Inspired by Code-Building/ImGuiBuilder Features Drag edit Property edit Covers most of the

Aug 15, 2022
Dear ImGui prototyping wrapper.

LabImGui Prototyping framework LabImGui wraps up creating a window, GL bindings, and a full screen docking set up with ImGui so that all of the boiler

Dec 2, 2021
An integrated information center created with dear ImGui using modern C++ design / coding style.

ImGui info-center Introduction An integrated notification and information center created with dear ImGui. Interfaces and variables are designed under

Jul 20, 2022
Addon widgets for GUI library Dear ImGui.
Addon widgets for GUI library Dear ImGui.

ImGui-Addons Addon widgets for GUI library Dear ImGui. File Dialog A simple cross-platform file dialog that uses dirent interface for reading director

Aug 8, 2022
This is a software renderer for Dear ImGui. I built it not out of a specific need, but because it was fun
This is a software renderer for Dear ImGui. I built it not out of a specific need, but because it was fun

Dear ImGui software renderer This is a software renderer for Dear ImGui. I built it not out of a specific need, but because it was fun. The goal was t

Jul 2, 2022