Minor UI improvements.

AnimGraphEditor
Martin Felis 2023-03-16 23:51:49 +01:00
parent aa9ab1def1
commit 8a91c7700a
1 changed files with 38 additions and 12 deletions

View File

@ -28,7 +28,9 @@ const int MaxIndices = MaxVertices * 3;
uint64_t last_time = 0;
bool show_imgui_demo_window = false;
bool show_another_window = false;
bool show_graph_editor = true;
bool show_graph_editor = false;
bool show_camera_dialog = false;
bool show_skinned_mesh_dialog = false;
sg_pass_action pass_action;
sg_pipeline pip;
@ -420,27 +422,51 @@ int main() {
}
if (ImGui::BeginMainMenuBar()) {
ImGui::Text("AnimTestbed");
ImGui::Checkbox("Graph Editor", &show_graph_editor);
ImGui::Checkbox("ImGui Demo", &show_imgui_demo_window);
if (ImGui::BeginMenu("File"))
{
if (ImGui::MenuItem("Quit")) {
glfwSetWindowShouldClose(w, true);
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("View"))
{
ImGui::Checkbox("Graph Editor", &show_graph_editor);
ImGui::Checkbox("Camera Settings", &show_camera_dialog);
ImGui::Checkbox("Skinned Mesh", &show_skinned_mesh_dialog);
ImGui::Separator();
ImGui::Checkbox("ImGui Demo", &show_imgui_demo_window);
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();
}
// Animation Runtime
{
ImGui::Begin("Camera");
ImGui::SliderFloat3("pos", state.camera.pos, -100.f, 100.f);
ImGui::SliderFloat("near", &state.camera.near, 0.001f, 10.f);
ImGui::SliderFloat("far", &state.camera.far, 1.0f, 10000.f);
ImGui::SliderFloat("heading", &state.camera.heading, -180.0f, 180.f);
ImGui::SliderFloat("pitch", &state.camera.pitch, -179.0f, 179.f);
ImGui::End();
if (show_camera_dialog) {
ImGui::SetNextWindowPos(ImVec2(600, 30), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(300, 170), ImGuiCond_FirstUseEver);
ImGui::Begin("Camera", &show_camera_dialog);
ImGui::SliderFloat3("pos", state.camera.pos, -100.f, 100.f);
ImGui::SliderFloat("near", &state.camera.near, 0.001f, 10.f);
ImGui::SliderFloat("far", &state.camera.far, 1.0f, 10000.f);
ImGui::SliderFloat("heading", &state.camera.heading, -180.0f, 180.f);
ImGui::SliderFloat("pitch", &state.camera.pitch, -179.0f, 179.f);
ImGui::End();
}
ImGui::SetNextWindowPos(ImVec2(600, 60), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(300, 400), ImGuiCond_FirstUseEver);
draw_grid();
skinned_mesh.DrawDebugUi();
if (show_skinned_mesh_dialog) {
skinned_mesh.DrawDebugUi();
}
// TODO: add AnimGraph to calculate pose
// skinned_mesh.CalcModelMatrices();