CedricGuillemet / ImGuizmo

Immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui
MIT License
3.2k stars 902 forks source link

signal SIGFPE, Arithmetic exception in worldToPos #288

Open mgerhardy opened 1 year ago

mgerhardy commented 1 year ago
0x00005555559ae89f in ImGuizmo::worldToPos (worldPos=..., mat=..., position=..., size=...) at /home/mgerhardy/dev/engine/src/modules/ui/dearimgui/ImGuizmo.cpp:799
799       trans *= 0.5f / trans.w;
(gdb) bt
#0  0x00005555559ae89f in ImGuizmo::worldToPos (worldPos=..., mat=..., position=..., size=...) at /home/mgerhardy/dev/engine/src/modules/ui/dearimgui/ImGuizmo.cpp:799
#1  0x00005555559b5733 in ImGuizmo::GetScaleType (op=2047) at /home/mgerhardy/dev/engine/src/modules/ui/dearimgui/ImGuizmo.cpp:1908
#2  0x00005555559b7505 in ImGuizmo::HandleScale (matrix=0x7fffffffc580, deltaMatrix=0x7fffffffc5c0, op=2047, type=@0x7fffffffc410: 0, snap=0x7fffffffc568) at /home/mgerhardy/dev/engine/src/modules/ui/dearimgui/ImGuizmo.cpp:2207
#3  0x00005555559b8c99 in ImGuizmo::Manipulate (view=0x55555856ca58, projection=0x55555856cad8, operation=2047, mode=ImGuizmo::LOCAL, matrix=0x7fffffffc580, deltaMatrix=0x7fffffffc5c0, snap=0x7fffffffc568, localBounds=0x0, boundsSnap=0x7fffffffc574)
    at /home/mgerhardy/dev/engine/src/modules/ui/dearimgui/ImGuizmo.cpp:2511

[...]

#0  0x00005555559ae89f in ImGuizmo::worldToPos (worldPos=..., mat=..., position=..., size=...) at /home/mgerhardy/dev/engine/src/modules/ui/dearimgui/ImGuizmo.cpp:799
799       trans *= 0.5f / trans.w;
(gdb) p trans
$4 = {x = -0.000328332157, y = 0.000147351893, z = -0.200004578, w = 0}
(gdb) p worldPos
$5 = (const ImGuizmo::vec_t &) @0x7fffffffc1a0: {x = -0.000244140625, y = 6.10351562e-05, z = 100, w = 1}
(gdb) p mat
$6 = (const ImGuizmo::matrix_t &) @0x555555d7177c: {{m = {{1.34484851, 0, 0, 0}, {0, 2.41421342, 0, 0}, {0, 0, -1.00004005, -1}, {0, 0, 99.8040009, 100}}, m16 = {1.34484851, 0, 0, 0, 0, 2.41421342, 0, 0, 0, 0, -1.00004005, -1, 0, 0, 99.8040009, 100}, v = {right = {x = 1.34484851, 
        y = 0, z = 0, w = 0}, up = {x = 0, y = 2.41421342, z = 0, w = 0}, dir = {x = 0, y = 0, z = -1.00004005, w = -1}, position = {x = 0, y = 0, z = 99.8040009, w = 100}}, component = {{x = 1.34484851, y = 0, z = 0, w = 0}, {x = 0, y = 2.41421342, z = 0, w = 0}, {x = 0, y = 0, 
        z = -1.00004005, w = -1}, {x = 0, y = 0, z = 99.8040009, w = 100}}}}
(gdb) 
$7 = (const ImGuizmo::matrix_t &) @0x555555d7177c: {{m = {{1.34484851, 0, 0, 0}, {0, 2.41421342, 0, 0}, {0, 0, -1.00004005, -1}, {0, 0, 99.8040009, 100}}, m16 = {1.34484851, 0, 0, 0, 0, 2.41421342, 0, 0, 0, 0, -1.00004005, -1, 0, 0, 99.8040009, 100}, v = {right = {x = 1.34484851, 
        y = 0, z = 0, w = 0}, up = {x = 0, y = 2.41421342, z = 0, w = 0}, dir = {x = 0, y = 0, z = -1.00004005, w = -1}, position = {x = 0, y = 0, z = 99.8040009, w = 100}}, component = {{x = 1.34484851, y = 0, z = 0, w = 0}, {x = 0, y = 2.41421342, z = 0, w = 0}, {x = 0, y = 0, 
        z = -1.00004005, w = -1}, {x = 0, y = 0, z = 99.8040009, w = 100}}}}
(gdb) 
mgerhardy commented 1 year ago

this is related: https://github.com/CedricGuillemet/ImGuizmo/pull/170 - but the patch to fix it doesn't work for me - it makes the scale handle unusable.