Init Repo

This commit is contained in:
2026-06-03 09:00:11 +08:00
commit 9be48d8b9e
155 changed files with 14827 additions and 0 deletions
@@ -0,0 +1,49 @@
## ADDED Requirements
### Requirement: Alt+LMB orbit navigation
The viewport SHALL orbit the camera around the focal point when the user holds Alt and drags with the left mouse button.
#### Scenario: Alt+LMB drag orbits the camera
- **WHEN** the user holds Alt and drags with the left mouse button inside the viewport
- **THEN** the camera orbits around the focal point based on the drag delta
#### Scenario: LMB without Alt does not orbit
- **WHEN** the user drags with the left mouse button without holding Alt
- **THEN** no orbit occurs and the click is forwarded for prim selection
### Requirement: Alt+MMB pan navigation
The viewport SHALL pan the camera when the user holds Alt and drags with the middle mouse button.
#### Scenario: Alt+MMB drag pans the camera
- **WHEN** the user holds Alt and drags with the middle mouse button inside the viewport
- **THEN** the camera pans horizontally and vertically based on the drag delta
### Requirement: Alt+RMB dolly navigation
The viewport SHALL dolly (zoom) the camera when the user holds Alt and drags with the right mouse button. Vertical drag upward moves the camera closer; downward moves it farther.
#### Scenario: Alt+RMB drag dollies the camera
- **WHEN** the user holds Alt and drags vertically with the right mouse button inside the viewport
- **THEN** the camera dollies in or out based on the vertical drag delta
### Requirement: Scroll zoom without Alt
The viewport SHALL zoom the camera when the user scrolls the mouse wheel, without requiring the Alt modifier.
#### Scenario: Scroll wheel zooms
- **WHEN** the user scrolls the mouse wheel while hovering over the viewport
- **THEN** the camera zooms in or out based on the scroll direction
### Requirement: Legacy input mappings removed
The previous input mappings (LMB for orbit, MMB for pan, Shift+LMB for pan) SHALL be replaced entirely by the Maya-style Alt+button scheme.
#### Scenario: MMB without Alt does not pan
- **WHEN** the user drags with the middle mouse button without holding Alt
- **THEN** no pan occurs
#### Scenario: Shift+LMB does not pan
- **WHEN** the user holds Shift and drags with the left mouse button
- **THEN** no pan occurs
@@ -0,0 +1,62 @@
## ADDED Requirements
### Requirement: Camera selector dropdown in viewport
The viewport panel SHALL display a camera selector dropdown above the rendering canvas. The dropdown SHALL list "Free Camera" as the first entry, followed by all UsdCamera-typed prims found on the current USD stage.
#### Scenario: Dropdown shows free camera and stage cameras
- **WHEN** a USD stage is loaded and contains camera prims at paths `/cameras/main` and `/cameras/top`
- **THEN** the camera selector dropdown lists: "Free Camera", "/cameras/main", "/cameras/top"
#### Scenario: Dropdown shows only free camera with no stage cameras
- **WHEN** a USD stage is loaded and contains no camera prims
- **THEN** the camera selector dropdown lists only "Free Camera"
#### Scenario: No stage loaded
- **WHEN** no USD stage is loaded
- **THEN** the camera selector dropdown is disabled or shows only "Free Camera"
### Requirement: Switch to USD camera prim view
When the user selects a USD camera prim from the dropdown, the viewport SHALL render the scene from that camera's viewpoint by reading its transform and projection attributes.
#### Scenario: Select a USD camera from dropdown
- **WHEN** the user selects "/cameras/main" from the camera dropdown
- **THEN** the viewport renders the scene using the view matrix derived from that camera prim's world transform and the projection matrix derived from its focalLength, horizontalAperture, and clippingRange attributes
#### Scenario: USD camera attribute mapping
- **WHEN** the viewport is rendering through a UsdCamera prim
- **THEN** the projection matrix SHALL be computed from the camera's `focalLength`, `horizontalAperture`, `verticalAperture`, `clippingRange`, and `projection` attributes
- **AND** the view matrix SHALL be computed from the camera prim's world-space transform
### Requirement: Free camera navigation disabled in USD camera mode
When the viewport is in USD camera mode, orbit, pan, dolly, and zoom controls SHALL be disabled.
#### Scenario: Attempt orbit while in USD camera mode
- **WHEN** the viewport is viewing through a USD camera and the user performs Alt+LMB drag
- **THEN** no orbit occurs and the viewport remains at the USD camera's viewpoint
### Requirement: Free camera state preserved across mode switches
The free camera's position, focal point, and orientation SHALL be preserved when switching to a USD camera and restored when switching back.
#### Scenario: Switch to USD camera and back
- **WHEN** the user positions the free camera, switches to a USD camera, then switches back to "Free Camera"
- **THEN** the viewport returns to the exact free camera position and orientation before the switch
### Requirement: Camera list refreshed on stage change
The list of available USD camera prims SHALL be refreshed when the stage changes (file open, close, or stage reload).
#### Scenario: Open a new stage with different cameras
- **WHEN** the user opens a new USD file containing cameras at different paths
- **THEN** the camera selector dropdown updates to reflect the new stage's camera prims
### Requirement: Default camera mode is free camera
The viewport SHALL start in free camera mode every time a stage is loaded.
#### Scenario: Stage loaded defaults to free camera
- **WHEN** a USD stage is loaded
- **THEN** the camera selector is set to "Free Camera" and the viewport renders from the built-in free camera
@@ -0,0 +1,46 @@
## ADDED Requirements
### Requirement: Frame selected prim with F key
The viewport SHALL frame the camera on the bounding box of the currently selected prim when the user presses the F key while the viewport is focused.
#### Scenario: Frame a selected mesh prim
- **WHEN** the user has a mesh prim selected in the scene hierarchy and presses F while the viewport is focused
- **THEN** the camera repositions to frame the bounding box of that prim and all its descendants in world space
#### Scenario: Frame with no prim selected
- **WHEN** the user presses F with no prim selected
- **THEN** no camera movement occurs
#### Scenario: Frame in USD camera mode
- **WHEN** the viewport is in USD camera mode and the user presses F
- **THEN** the viewport switches to free camera mode and frames the selected prim
### Requirement: Frame all with A key
The viewport SHALL frame the camera on the bounding box of the entire USD stage when the user presses the A key while the viewport is focused.
#### Scenario: Frame all prims in the stage
- **WHEN** the user presses A while the viewport is focused and a stage is loaded
- **THEN** the camera repositions to frame the bounding box of the entire stage
#### Scenario: Frame all with no stage loaded
- **WHEN** the user presses A with no stage loaded
- **THEN** no camera movement occurs
### Requirement: Selected prim path sourced from SceneHierarchyPanel
The viewport SHALL obtain the currently selected prim path from the `SceneHierarchyPanel` via a callback wired by the `Application` class.
#### Scenario: Selection change triggers prim path update
- **WHEN** the user selects a different prim in the SceneHierarchyPanel
- **THEN** the viewport's stored selected prim path updates to reflect the new selection
- **AND** pressing F frames the newly selected prim
### Requirement: Bounding box computed via UsdGeomBBoxCache
The bounding box for framing a selected prim SHALL be computed using `UsdGeomBBoxCache` to correctly account for transforms, instancing, and purpose.
#### Scenario: Bounding box includes descendant geometry
- **WHEN** the user frames a prim that has mesh children
- **THEN** the bounding box encompasses the prim and all its descendants' geometry in world space