Better separated 3D view and graph editor navigation.
parent
dc958dcabd
commit
8388fbfe3e
21
src/main.cc
21
src/main.cc
|
@ -669,6 +669,7 @@ int main() {
|
|||
|
||||
// Graph Editor
|
||||
gApplicationConfig.graph_editor.config.SettingsFile = "graph_editor.json";
|
||||
gApplicationConfig.graph_editor.config.NavigateButtonIndex = 2;
|
||||
gApplicationConfig.graph_editor.context = ax::NodeEditor::CreateEditor(&gApplicationConfig.graph_editor.config);
|
||||
|
||||
// draw loop
|
||||
|
@ -711,13 +712,7 @@ int main() {
|
|||
// handle input
|
||||
handle_mouse(w, &gGuiInputState);
|
||||
|
||||
if (glfwGetMouseButton(w, GLFW_MOUSE_BUTTON_RIGHT)) {
|
||||
if (gControlMode == ControlMode::ControlModeNone) {
|
||||
gControlMode = ControlMode::ControlModeFPS;
|
||||
Camera_CalcFromMatrix(&state.camera, &state.camera.mtxView[0]);
|
||||
glfwSetInputMode(w, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||
}
|
||||
} else {
|
||||
if (!glfwGetMouseButton(w, GLFW_MOUSE_BUTTON_RIGHT)) {
|
||||
gControlMode = ControlMode::ControlModeNone;
|
||||
glfwSetInputMode(w, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
Camera_Update(
|
||||
|
@ -761,8 +756,8 @@ int main() {
|
|||
|
||||
Camera_Update(
|
||||
&state.camera,
|
||||
cur_width,
|
||||
cur_height,
|
||||
offscreen_viewport.size[0],
|
||||
offscreen_viewport.size[1],
|
||||
static_cast<float>(state.time.frame),
|
||||
static_cast<float>(gGuiInputState.mousedX),
|
||||
static_cast<float>(gGuiInputState.mousedY),
|
||||
|
@ -847,6 +842,14 @@ int main() {
|
|||
|
||||
ImGui::Begin("Viewport", &gApplicationConfig.viewport_widget.visible);
|
||||
|
||||
if (ImGui::IsWindowHovered() && ImGui::IsMouseDown(ImGuiMouseButton_Right)) {
|
||||
if (gControlMode == ControlMode::ControlModeNone) {
|
||||
gControlMode = ControlMode::ControlModeFPS;
|
||||
Camera_CalcFromMatrix(&state.camera, &state.camera.mtxView[0]);
|
||||
glfwSetInputMode(w, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
ImVec2 viewport_widget_size = ImGui::GetWindowSize();
|
||||
gApplicationConfig.viewport_widget.size[0] = static_cast<int>(viewport_widget_size.x);
|
||||
gApplicationConfig.viewport_widget.size[1] = static_cast<int>(viewport_widget_size.y);
|
||||
|
|
Loading…
Reference in New Issue