imguizmo,渲染了小部件,但赢得了回应
我正在尝试将Imguizmo整合到一个项目中。我能够像这样渲染guizmo:
但是,当我悬停在箭头上时,它们不会突出显示,我没有得到任何类型的响应,我尝试了所有列出的方法在诸如isover
和iSusing
之类的读书中,无论光标的位置如何,它总是返回false。我还在打印传递到操纵
的矩阵的值,它永远不会更改(它始终是身份矩阵)。
这是我的IMGUI调用:
bool show_demo_window = true;
bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
int selected_vertex = 0;
bool hovering_imgui = false;
static ImGuiWindowFlags gizmoWindowFlags = 0;
static ImGuizmo::MODE mCurrentGizmoMode(ImGuizmo::LOCAL);
static ImGuizmo::OPERATION mCurrentGizmoOperation(ImGuizmo::TRANSLATE);
static bool useSnap = true;
static float snap[3] = { 1.f, 1.f, 1.f };
static float bounds[] = { -0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f };
static float boundsSnap[] = { 0.1f, 0.1f, 0.1f };
static bool boundSizing = false;
static bool boundSizingSnap = false;
float camDistance = 8.f;
Eigen::Matrix4f model = Eigen::Matrix4f::Identity();
void Demo_GUI(NECamera::ArcballCamera& camera)
{
mCurrentGizmoOperation = ImGuizmo::TRANSLATE;
// Start the Dear ImGui frame
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
ImGuizmo::BeginFrame();
ImGuiIO& io = ImGui::GetIO();
float viewManipulateRight = io.DisplaySize.x;
float viewManipulateTop = 0;
static ImGuiWindowFlags gizmoWindowFlags = 0;
ImGuizmo::SetRect(0, 0, io.DisplaySize.x, io.DisplaySize.y);
Eigen::Matrix4f view = camera.GetViewMatrix();
Eigen::Matrix4f proj = camera.GetProjectionMatrix();
proj(1, 1) *= -1;
ImGuizmo::Enable(true);
ImGuizmo::Manipulate(view.data(), proj.data(), mCurrentGizmoOperation, mCurrentGizmoMode, model.data(), NULL, useSnap ? &snap[0] : NULL, boundSizing ? bounds : NULL, boundSizingSnap ? boundsSnap : NULL);
ImGui::InputFloat3("Snap", &snap[0]);
std::cout << model << std::endl;
// Rendering
ImGui::Render();
}
Imgui本身可以使用,屏幕截图中的调试窗口正常,我可以将其拖动并调整大小。因此,iMgui已正确配置了它,只是行为奇怪的Imguizmo。
我不确定我缺少什么。为什么Guizmo不回应?
我正在使用Vulkan作为渲染后端。
I am trying to integrate imguizmo into a project. I am able to render the guizmo like this:
However when I hover over the arrows, they don;t get highlighted and I don't get any type of response, I have tried all the methods listed in the readme such as IsOver
and IsUsing
which always return false regardless of the position of the cursor. I am also printing the values of the matrix passed into Manipulate
, it never changes (it;s always the identity matrix).
This is my imgui call:
bool show_demo_window = true;
bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
int selected_vertex = 0;
bool hovering_imgui = false;
static ImGuiWindowFlags gizmoWindowFlags = 0;
static ImGuizmo::MODE mCurrentGizmoMode(ImGuizmo::LOCAL);
static ImGuizmo::OPERATION mCurrentGizmoOperation(ImGuizmo::TRANSLATE);
static bool useSnap = true;
static float snap[3] = { 1.f, 1.f, 1.f };
static float bounds[] = { -0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f };
static float boundsSnap[] = { 0.1f, 0.1f, 0.1f };
static bool boundSizing = false;
static bool boundSizingSnap = false;
float camDistance = 8.f;
Eigen::Matrix4f model = Eigen::Matrix4f::Identity();
void Demo_GUI(NECamera::ArcballCamera& camera)
{
mCurrentGizmoOperation = ImGuizmo::TRANSLATE;
// Start the Dear ImGui frame
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
ImGuizmo::BeginFrame();
ImGuiIO& io = ImGui::GetIO();
float viewManipulateRight = io.DisplaySize.x;
float viewManipulateTop = 0;
static ImGuiWindowFlags gizmoWindowFlags = 0;
ImGuizmo::SetRect(0, 0, io.DisplaySize.x, io.DisplaySize.y);
Eigen::Matrix4f view = camera.GetViewMatrix();
Eigen::Matrix4f proj = camera.GetProjectionMatrix();
proj(1, 1) *= -1;
ImGuizmo::Enable(true);
ImGuizmo::Manipulate(view.data(), proj.data(), mCurrentGizmoOperation, mCurrentGizmoMode, model.data(), NULL, useSnap ? &snap[0] : NULL, boundSizing ? bounds : NULL, boundSizingSnap ? boundsSnap : NULL);
ImGui::InputFloat3("Snap", &snap[0]);
std::cout << model << std::endl;
// Rendering
ImGui::Render();
}
Imgui itself works, the debug window in the screenshot behaves normally, I can drag it and resize it. So Imgui has been properly configured it;s just ImGuizmo that behaves oddly.
I am not sure what I am missing. Why is the guizmo not responding?
I am using vulkan as the rendering backend.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论