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

Related tags

GUI ImGuizmo
Overview

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.

    opened by zcorniere 30
  • 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.

    opened by FSY1901 18
  • 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

    opened by HODAKdev 17
  • 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

    opened by Volta94 15
  • 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.

    opened by DennisWG 14
  • 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?

    opened by rokups 14
  • 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

    opened by Algo-ryth-mix 12
  • 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.

    opened by zarevor 11
  • 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

    opened by benanil 9
  • 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

    opened by Toastmastern87 9
  • 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();
        }
    
    opened by ExQDev 9
  • Issue with ortho projection on Vulkan

    Issue with ortho projection on Vulkan

    I'm sure I'm doing something wrong but I can't figure out what. I have an orthographic projection like this

    m_AspectRatio = (float)width / (float)height;
    float orthoLeft = 0.0f;
    float orthoRight = (float)m_OrthographicHeight * m_AspectRatio * m_Zoom;
    float orthoTop = (float)m_OrthographicHeight * m_Zoom;
    float orthoBottom = 0.0f;
    
    m_Projection = glm::ortho(orthoLeft, orthoRight, orthoBottom, orthoTop, (float)m_OrthographicNear, (float)m_OrthographicFar);
    
    glm::mat4 transformationMatrix = glm::translate(glm::mat4(1.0f), m_Position);
    
    m_View = glm::inverse(transformationMatrix);
    

    The camera doesn't rotate and stays at z = 10 but the y axis for the guizmo is inverted. It is pointing the wrong direction and drags in the wrong direction.

    view

    opened by gamecoder-nz 2
  • Gizmos rendered over ButtonBehavior are not responding to input

    Gizmos rendered over ButtonBehavior are not responding to input

    Hi,

    I encountered a small problem regarding mouse input when rendering manipluate gizmos over other UI elements that react to mouse input.

    Screenshot 2022-12-19 170259

    I am rendering an invisible ButtonBehavior over the scene view to capture mouse inputs for things like object picking and camera movement. The overlay buttons in the top left are still working correctly (due to ImGuiButtonFlags_AllowItemOverlap) but the manipulate gizmos are not. When the ButtonBehavior is present they only react correctly when hovering them but you cannot actually manipulate the object.

    const ImRect textureRect = ImGui::GetCurrentWindow()->InnerClipRect;
    ImGui::GetBackgroundDrawList()->AddImage(textureId, textureRect.Min, textureRect.Max);
    
    const ImRect rect = ImGui::GetCurrentWindow()->InnerClipRect;
    const ImGuiID id = ImGui::GetCurrentWindow()->GetID("SceneViewButton");
    ImGui::ItemAdd(rect, id);
    ImGui::ButtonBehavior(rect, id, nullptr, nullptr, ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_MouseButtonMask_);
    ImGui::SetItemAllowOverlap();
                    
    ImGuizmo::SetDrawlist();
    
    const glm::uvec2 position = EditorGui::GetWindowPosition();
    const glm::uvec2 size = EditorGui::GetWindowSize();
    ImGuizmo::SetRect(static_cast<float>(position.x), static_cast<float>(position.y), 
                        static_cast<float>(size.x), static_cast<float>(size.y));
    
    //ImGuizmo::Manipulate calls follow here
    
    opened by Silveryard 0
  • Div0 in ImGuizmo::ComputeContext

    Div0 in ImGuizmo::ComputeContext

    It's about the orthographic mode and shifting on the x axis

    Thread 1 "vengi-voxedit" received signal SIGFPE, Arithmetic exception.
    ImGuizmo::ComputeContext (view=0x55555859e620, projection=0x55555859e6a0, matrix=0x7fffffffc500, mode=ImGuizmo::LOCAL) at /home/mgerhardy/dev/engine/src/modules/ui/dearimgui/ImGuizmo.cpp:1070
    1070	      gContext.mScreenFactor = gContext.mGizmoSizeClipSpace / (pointRight.x / pointRight.w - gContext.mMVP.v.position.x / gContext.mMVP.v.position.w);
    (gdb) bt
    #0  ImGuizmo::ComputeContext (view=0x55555859e620, projection=0x55555859e6a0, matrix=0x7fffffffc500, mode=ImGuizmo::LOCAL) at /home/mgerhardy/dev/engine/src/modules/ui/dearimgui/ImGuizmo.cpp:1070
    #1  0x00005555558e5205 in ImGuizmo::Manipulate (view=0x55555859e620, projection=0x55555859e6a0, operation=2047, mode=ImGuizmo::LOCAL, matrix=0x7fffffffc500, deltaMatrix=0x7fffffffc540, snap=0x7fffffffc4e8, localBounds=0x55555859b6dc, boundsSnap=0x7fffffffc4f4)
        at /home/mgerhardy/dev/engine/src/modules/ui/dearimgui/ImGuizmo.cpp:2487
    #2  0x00005555555b7fd1 in voxedit::Viewport::renderSceneGuizmo (this=0x55555859b680, camera=...) at /home/mgerhardy/dev/engine/src/tools/voxedit/modules/voxedit-ui/Viewport.cpp:324
    #3  0x00005555555b8760 in voxedit::Viewport::renderGizmo (this=0x55555859b680, camera=..., headerSize=23.8817329, size=...) at /home/mgerhardy/dev/engine/src/tools/voxedit/modules/voxedit-ui/Viewport.cpp:411
    #4  0x00005555555b71f1 in voxedit::Viewport::update (this=0x55555859b680) at /home/mgerhardy/dev/engine/src/tools/voxedit/modules/voxedit-ui/Viewport.cpp:163
    #5  0x00005555555a5122 in voxedit::MainWindow::mainWidget (this=0x555557e73750) at /home/mgerhardy/dev/engine/src/tools/voxedit/modules/voxedit-ui/MainWindow.cpp:198
    #6  0x00005555555a646e in voxedit::MainWindow::update (this=0x555557e73750) at /home/mgerhardy/dev/engine/src/tools/voxedit/modules/voxedit-ui/MainWindow.cpp:448
    #7  0x0000555555599df2 in VoxEdit::onRenderUI (this=0x7fffffffcd70) at /home/mgerhardy/dev/engine/src/tools/voxedit/VoxEdit.cpp:289
    #8  0x00005555557c26e6 in ui::IMGUIApp::onRunning (this=0x7fffffffcd70) at /home/mgerhardy/dev/engine/src/modules/ui/IMGUIApp.cpp:388
    #9  0x0000555555599e0e in VoxEdit::onRunning (this=0x7fffffffcd70) at /home/mgerhardy/dev/engine/src/tools/voxedit/VoxEdit.cpp:293
    #10 0x000055555595f2cf in app::App::onFrame (this=0x7fffffffcd70) at /home/mgerhardy/dev/engine/src/modules/app/App.cpp:165
    #11 0x000055555595eefb in app::App::startMainLoop (this=0x7fffffffcd70, argc=1, argv=0x7fffffffdde8) at /home/mgerhardy/dev/engine/src/modules/app/App.cpp:90
    #12 0x0000555555599f18 in main (argc=1, argv=0x7fffffffdde8) at /home/mgerhardy/dev/engine/src/tools/voxedit/VoxEdit.cpp:314
    (gdb) l
    1065	       gContext.mReversed = (nearPos.z/nearPos.w) > (farPos.z / farPos.w);
    1066	
    1067	      // compute scale from the size of camera right vector projected on screen at the matrix position
    1068	      vec_t pointRight = viewInverse.v.right;
    1069	      pointRight.TransformPoint(gContext.mViewProjection);
    1070	      gContext.mScreenFactor = gContext.mGizmoSizeClipSpace / (pointRight.x / pointRight.w - gContext.mMVP.v.position.x / gContext.mMVP.v.position.w);
    1071	
    1072	      vec_t rightViewInverse = viewInverse.v.right;
    1073	      rightViewInverse.TransformVector(gContext.mModelInverse);
    1074	      float rightLength = GetSegmentLengthClipSpace(makeVect(0.f, 0.f), rightViewInverse);
    (gdb) p pointRight
    $1 = {x = -0.393480003, y = -0.721848011, z = -0.96603936, w = 1}
    (gdb) p gContext.mMVP.v.position.w
    $2 = 1
    (gdb) p gContext.mMVP.v.position.x
    $3 = -0.393480003
    (gdb) p (pointRight.x / pointRight.w - gContext.mMVP.v.position.x / gContext.mMVP.v.position.w)
    $4 = 0
    (gdb) p gContext.mGizmoSizeClipSpace 
    $5 = 0.100000001
    
    opened by mgerhardy 2
  • Consider making a new release

    Consider making a new release

    Hello, the current vcpkg port of ImGuizmo is based on the latest release version (1.83) which date from more that a year. I would like to update it, but the vcpkg team insist on the use of libraries official releases instead of the latest commit. Is it possible to create a new ImGuizmo release so I can update the vcpkg port?

    opened by RT222 2
  • Incorrect scale axis gizmo when moved from 1.62 to 1.89

    Incorrect scale axis gizmo when moved from 1.62 to 1.89

    When i take latest ImGuizmo.cpp from examples in my engine gizmo scale broken.

    Translation and rotation working fine, but when, i use scale mode and scale object, its brokes.

    When I scale an object, the axis along which I scale in ImGuizmo is stretched and it turns out in all modes I have Guizmo rendered incorrectly (stretched), although the area where I can select the gizmo axis for manipulation shows correctly. I haven't changed anything in the Guizmo code and engine, well, except for the style. In version 1.62, I have everything rendered normally with the same code, but in the latest version, this is the problem.

    image

    opened by KennyProgrammer 0
Releases(1.83)
Owner
Cedric Guillemet
Cedric Guillemet
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

null 95 Nov 19, 2022
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

Z Guan 435 Jan 1, 2023
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.

Georgi Gerganov 2.1k Jan 1, 2023
raygui is a simple and easy-to-use immediate-mode-gui library.

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

Ray 2k Dec 30, 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. 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.

Micha Mettke 13.5k Jan 8, 2023
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.

Google 610 Dec 23, 2022
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

Thibault Hennequin 715 Dec 20, 2022
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

Immediate Mode UIs, Nuklear, etc. 6.7k Dec 24, 2022
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

null 2.5k Jan 6, 2023
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

null 133 Dec 12, 2022
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

null 4.8k Jan 7, 2023
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

omar 44.5k Jan 7, 2023
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

Evan Pezent 2.9k Jan 9, 2023
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

null 303 Jan 9, 2023
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

Nick Porcino 1 Dec 5, 2022
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

Feej 7 Oct 29, 2022
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

null 286 Jan 7, 2023
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

Emil Ernerfeldt 214 Dec 22, 2022
Nice things to use along dear imgui

Mini hexadecimal editor! Right-click for option menu. Features: Keyboard controls. Read-only mode. Optional Ascii display. Optional HexII display. Goto address. Highlight range/function. Read/Write handlers.

omar 664 Jan 1, 2023