Skip to content

File ViewportController.h

FileList > controllers > ViewportController.h

Go to the source code of this file

Viewport interaction controller for object picking and viewport management.More...

  • #include "Controllers.h"
  • #include "buffers/FrameBuffer.h"

Classes

Type Name
class ViewportController
Controller for viewport interaction and object selection.

Detailed Description

ViewportController handles user interactions within the 3D viewport, including object selection via mouse picking, viewport resize events, and coordinate transformations between screen space and world space.

Architecture: * Subscribes to viewport-specific events (click, resize, focus) * Maintains framebuffer references for picking and display * Performs ray-casting from screen coordinates to 3D world * Emits SelectionEvents when objects are picked

Picking Pipeline: * Mouse click in viewport → screen coordinates (x, y) * Read id_fb at (x, y) to get object ID (GPU-based picking) * Emit SelectionEvent with picked ObjectID * SelectionManager updates, UI highlights selected object

Framebuffer Roles: * id_fb: Offscreen buffer rendering object IDs as colors (picking) * viewport_fb: Main render target displayed in UI viewport panel

Coordinate Systems: * Screen: (0,0) at top-left, Y-down (ImGui convention) * NDC: (-1,-1) to (1,1), Y-up (OpenGL convention) * World: Right-handed Y-up global space

Note:

ViewportController does not own framebuffers - pointers are non-owning.

Note:

Picking requires id_fb to be rendered with unique ID colors per object.


The documentation for this class was generated from the following file src/editor/controllers/ViewportController.h