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,42 @@
## ADDED Requirements
### Requirement: Camera frustum wireframe drawn every frame
For every `UsdGeomCamera` prim present in the current USD stage, the system SHALL draw a 3D wireframe representation into the viewport FBO each frame. The wireframe SHALL be drawn at `UsdTimeCode::Default()`. The wireframe SHALL consist of: (a) a small body box centred at the camera origin, (b) four lines from the camera origin to the corners of a near-clip display quad, and (c) a short up-arrow line indicating the camera's local Y axis.
#### Scenario: Camera wireframe appears when camera prim exists
- **WHEN** a `UsdGeomCamera` prim exists in the stage
- **THEN** a frustum wireframe is visible in the viewport at the camera prim's world-space position and orientation
#### Scenario: No wireframe when stage has no cameras
- **WHEN** no `UsdGeomCamera` prims exist in the stage
- **THEN** no camera wireframe is drawn
### Requirement: Wireframe size scales with viewport camera distance
The wireframe scale SHALL be proportional to the current viewport camera's look-at distance (`ViewportCamera::GetDist()`), clamped to a maximum of 50 world units, so that camera shapes maintain a consistent apparent screen size regardless of zoom level.
#### Scenario: Camera wireframe stays visible when zooming out
- **WHEN** the viewport camera is zoomed out (increasing distance)
- **THEN** the camera wireframe grows proportionally so it remains visible at roughly the same screen size
### Requirement: Three distinct visual states
The system SHALL draw camera wireframes using three colour states:
- **Inactive** (default): muted grey `(0.55, 0.55, 0.55, 0.85)`
- **Active** (the camera currently driving the viewport via the camera toolbar): cyan `(0.2, 0.9, 1.0, 1.0)`
- **Selected** (the camera prim is the current primary selection): yellow-orange `(1.0, 0.75, 0.1, 1.0)`
A camera that is both active and selected SHALL use the selected colour (selected takes priority).
#### Scenario: Active camera shown in cyan
- **WHEN** a USD camera prim is set as the active viewport camera via the camera toolbar
- **THEN** its wireframe is drawn in cyan
#### Scenario: Selected camera shown in yellow-orange
- **WHEN** a camera prim is the primary selected prim in the scene hierarchy
- **THEN** its wireframe is drawn in yellow-orange, overriding the cyan active colour
### Requirement: Camera list cached and refreshed on stage change
The system SHALL cache the list of `UsdGeomCamera` prim paths to avoid re-traversing the stage every frame. The cache SHALL be invalidated whenever `SetForceRefresh(true)` is called or the stage pointer changes.
#### Scenario: Cache invalidated on stage reload
- **WHEN** a new USD file is opened
- **THEN** the camera wireframe list reflects the new stage's cameras in the next frame
@@ -0,0 +1,27 @@
## ADDED Requirements
### Requirement: Camera prim selectable by clicking its wireframe
The system SHALL test each viewport left-mouse-button click against all camera wireframe segments before running the existing geometry pick. If the click position is within 10 screen pixels of any projected wireframe edge, the corresponding `UsdGeomCamera` prim SHALL be selected. Among multiple qualifying cameras the nearest one (smallest minimum screen distance) SHALL be chosen.
#### Scenario: Clicking camera wireframe selects the camera prim
- **WHEN** the user left-clicks within 10 pixels of a camera wireframe segment
- **THEN** the camera prim appears selected in the Scene Hierarchy panel and the Property panel shows its attributes
#### Scenario: Camera pick takes priority over geometry behind it
- **WHEN** the user clicks on a camera wireframe that visually overlaps rendered geometry
- **THEN** the camera prim is selected, not the geometry behind it
#### Scenario: Click misses all cameras — falls through to geometry pick
- **WHEN** the user left-clicks on an area with no camera wireframe within 10 pixels
- **THEN** the normal geometry pick runs as before
### Requirement: Selected camera is editable with the transform manipulator
After a camera prim is selected via viewport click, the system SHALL allow the `TransformManipulator` to translate and rotate it using the existing W/E/R tool modes. The camera SHALL implement `UsdGeomXformCommonAPI` for the manipulator to write to. No additional manipulator changes are required.
#### Scenario: Move manipulator repositions selected camera
- **WHEN** a camera prim is selected and the Move tool (W) is active
- **THEN** the translate gizmo appears at the camera's world position and dragging it moves the camera prim
#### Scenario: Rotate manipulator reorients selected camera
- **WHEN** a camera prim is selected and the Rotate tool (E) is active
- **THEN** the rotate rings appear at the camera's world position and dragging them rotates the camera prim