refactoredCPPNeuronMesher
|
Implementation of GLFW callback functions for the neuron viewer. More...
Functions | |
void | keyCallback (GLFWwindow *window, int key, int scancode, int action, int mods) |
Handles keyboard input events for the neuron viewer. More... | |
void | mouseButtonCallback (GLFWwindow *window, int button, int action, int mods) |
Handles mouse button events for 3D view manipulation. More... | |
void | cursorPosCallback (GLFWwindow *window, double xpos, double ypos) |
Handles mouse cursor movement for view manipulation. More... | |
void | scrollCallback (GLFWwindow *window, double xoffset, double yoffset) |
Handles mouse scroll wheel events for zooming the view. More... | |
Implementation of GLFW callback functions for the neuron viewer.
This file contains the implementation of various GLFW callback functions that handle user input and interaction with the neuron visualization window. It includes keyboard, mouse, and scroll wheel event handling for controlling the 3D view and interacting with neuron data.
Key features:
The implementation uses GLFW for window management and input handling, and integrates with the NeuronGraph class for neuron data manipulation.
void cursorPosCallback | ( | GLFWwindow * | window, |
double | xpos, | ||
double | ypos | ||
) |
Handles mouse cursor movement for view manipulation.
Handles mouse cursor movement.
[in] | window | The GLFW window that received the event |
[in] | xpos | The new x-coordinate of the cursor, in screen coordinates |
[in] | ypos | The new y-coordinate of the cursor, in screen coordinates |
This callback function processes mouse movement to implement interactive 3D view manipulation. It provides the following functionality:
The function uses the difference between the current and last cursor positions to calculate the amount of rotation or panning to apply. The actual view transformation is applied in the main rendering loop using the global state variables modified by this function.
void keyCallback | ( | GLFWwindow * | window, |
int | key, | ||
int | scancode, | ||
int | action, | ||
int | mods | ||
) |
Handles keyboard input events for the neuron viewer.
Handles keyboard input events.
[in] | window | The GLFW window that received the event |
[in] | key | The keyboard key that was pressed or released |
[in] | scancode | The system-specific scancode of the key |
[in] | action | The key action (GLFW_PRESS, GLFW_RELEASE, or GLFW_REPEAT) |
[in] | mods | Bit field describing which modifier keys were held down |
This callback function processes keyboard input for controlling the neuron viewer. It implements the following keyboard shortcuts:
The function modifies global state for view parameters and triggers updates to the neuron visualization when geometry is refined or coarsened.
void mouseButtonCallback | ( | GLFWwindow * | window, |
int | button, | ||
int | action, | ||
int | mods | ||
) |
Handles mouse button events for 3D view manipulation.
Handles mouse button input events.
[in] | window | The GLFW window that received the event |
[in] | button | The mouse button that was pressed or released |
[in] | action | The button action (GLFW_PRESS or GLFW_RELEASE) |
[in] | mods | Bit field describing which modifier keys were held down |
This callback function processes mouse button events to enable interactive 3D view manipulation. It tracks the following interactions:
The function updates global state variables (dragging, rightDragging) that are used by cursorPosCallback to implement the actual view transformations.
void scrollCallback | ( | GLFWwindow * | window, |
double | xoffset, | ||
double | yoffset | ||
) |
Handles mouse scroll wheel events for zooming the view.
Handles mouse scroll events.
[in] | window | The GLFW window that received the event |
[in] | xoffset | The scroll offset along the x-axis (unused in this implementation) |
[in] | yoffset | The scroll offset along the y-axis (positive for scroll up, negative for scroll down) |
This callback function processes mouse scroll wheel input to implement smooth zooming of the 3D view. It modifies the global zoom factor based on the vertical scroll amount.
The zoom factor is adjusted using an exponential scale (1.1^yoffset) to provide natural-feeling zoom behavior. The zoom level is clamped between 0.05 and 10.0 to prevent extreme zoom levels that might cause rendering issues or numerical instability.