(final ImBoolean showImGuizmoWindow)
| 84 | private static boolean firstFrame = true; |
| 85 | |
| 86 | public static void show(final ImBoolean showImGuizmoWindow) { |
| 87 | ImGuizmo.beginFrame(); |
| 88 | |
| 89 | if (ImGui.begin("ImGuizmo Demo", showImGuizmoWindow)) { |
| 90 | ImGui.text("This a demo for ImGuizmo"); |
| 91 | |
| 92 | ImGui.alignTextToFramePadding(); |
| 93 | ImGui.text("Repo:"); |
| 94 | ImGui.sameLine(); |
| 95 | if (ImGui.button(URL)) { |
| 96 | try { |
| 97 | Desktop.getDesktop().browse(new URI(URL)); |
| 98 | } catch (Exception e) { |
| 99 | e.printStackTrace(); |
| 100 | } |
| 101 | } |
| 102 | ImGui.separator(); |
| 103 | |
| 104 | if (firstFrame) { |
| 105 | float[] eye = new float[]{ |
| 106 | (float) (Math.cos(CAM_Y_ANGLE) * Math.cos(CAM_X_ANGLE) * CAM_DISTANCE), |
| 107 | (float) (Math.sin(CAM_X_ANGLE) * CAM_DISTANCE), |
| 108 | (float) (Math.sin(CAM_Y_ANGLE) * Math.cos(CAM_X_ANGLE) * CAM_DISTANCE) |
| 109 | }; |
| 110 | float[] at = new float[]{0.f, 0.f, 0.f}; |
| 111 | float[] up = new float[]{0.f, 1.f, 0.f}; |
| 112 | lookAt(eye, at, up, INPUT_CAMERA_VIEW); |
| 113 | firstFrame = false; |
| 114 | } |
| 115 | |
| 116 | ImGui.text("Keybindings:"); |
| 117 | ImGui.text("T - Translate"); |
| 118 | ImGui.text("R - Rotate"); |
| 119 | ImGui.text("S - Scale"); |
| 120 | ImGui.separator(); |
| 121 | |
| 122 | if (ImGuizmo.isUsing()) { |
| 123 | ImGui.text("Using gizmo"); |
| 124 | if (ImGuizmo.isOver()) { |
| 125 | ImGui.text("Over a gizmo"); |
| 126 | } |
| 127 | if (ImGuizmo.isOver(Operation.TRANSLATE)) { |
| 128 | ImGui.text("Over translate gizmo"); |
| 129 | } else if (ImGuizmo.isOver(Operation.ROTATE)) { |
| 130 | ImGui.text("Over rotate gizmo"); |
| 131 | } else if (ImGuizmo.isOver(Operation.SCALE)) { |
| 132 | ImGui.text("Over scale gizmo"); |
| 133 | } |
| 134 | } else { |
| 135 | ImGui.text("Not using gizmo"); |
| 136 | } |
| 137 | |
| 138 | editTransform(showImGuizmoWindow); |
| 139 | ImGui.end(); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | private static void editTransform(final ImBoolean showImGuizmoWindow) { |
no test coverage detected