Skip to content

Refactor GuiRotationDial, AimLock rendering#2781

Merged
daid merged 7 commits intodaid:masterfrom
oznogon:refactor-guirotationdial-aimlock
Mar 27, 2026
Merged

Refactor GuiRotationDial, AimLock rendering#2781
daid merged 7 commits intodaid:masterfrom
oznogon:refactor-guirotationdial-aimlock

Conversation

@oznogon
Copy link
Copy Markdown
Contributor

@oznogon oznogon commented Mar 12, 2026

GuiRotationDial uses sprites for the handle and ring. This limits how GuiRotationDial can be used, since resizing it also changes the width of the ring and size of the handle, and the handle's arc is fixed to 20 degrees, which happens to be the size of the default handle sprite.

Use triangle strips for the handle, use a 9-segment stretched texture to allow texturing the handle, and apply theme colors for direct customization. Add a drawCircleOutline fallback for the background ring, to use if no textures is defined on the theme. Also scale that fallback relative to the ring radius or use an optional defined size.

While the fallback ring is more flexible, this still uses and prioitizes a fixed ring texture to retain backward behaviors.

Correspondingly refactor AimLock (the only use of GuiRotationDial) to remove its redundant rendering logic, move its radar rotation offset handling to GuiRotationDial, and fix the headers of the screens that use AimLock and AimLockButton to correctly declare their classes.

Ring thickness, which is now configurable, is also reduced to 1/10 of the radius instead of about 1/8 to avoid hiding heading tigs. The background ring texture is also modified to better fit this new width.

Before:

image

After (textures on ring and handle):

Screenshot 2026-03-20 171942

After (no textures on ring or handle):

Screenshot 2026-03-20 172008

Demonstrating handle UVs (sliders were a debug tool and not part of the PR):

Recording.2026-03-20.144216.uvrect.guirotationdial.mp4

@oznogon oznogon force-pushed the refactor-guirotationdial-aimlock branch from af4b70a to 6e7acac Compare March 12, 2026 17:30
@daid
Copy link
Copy Markdown
Owner

daid commented Mar 19, 2026

It's a big of a visual shame to lose the rounded corners, this could potentially be fixed by rendering a (stretched) texture on the dial instead of a solid color.

@oznogon
Copy link
Copy Markdown
Contributor Author

oznogon commented Mar 20, 2026

Since this uses drawTriangleStrip I assume that'd require a drawTexturedTriangleStrip equivalent on the SP side to set the UVs, similar to drawTexturedQuad?

EDIT: Like daid/SeriousProton#306 ?

@oznogon oznogon force-pushed the refactor-guirotationdial-aimlock branch from 5eb7b57 to 346831f Compare March 20, 2026 17:47
@oznogon
Copy link
Copy Markdown
Contributor Author

oznogon commented Mar 20, 2026

Refactored to use drawTexturedTriangleStrip, brought back textures for both the handle and ring, and made them optional to fall back on plain-color circle outline and triangle strip rendering if no textures are defined in the theme.

@oznogon oznogon marked this pull request as draft March 20, 2026 17:58
oznogon added 7 commits March 20, 2026 16:09
GuiRotationDial uses sprites for the handle and ring, which makes
resizing it inflexible and requires replacing sprites to theme it.

Use drawCircleOutline, triangle strips, and theme colors instead to
allow the ring and handle to be more easily customized.
Allow defining optional textures for the GuiRotationDial handle (front)
and ring (back).

- Rename dial_background.png to RotationDialBackground.png per other widget
  PNG naming conventions, and reshade to white to take theme colors better.
- Replace dial_button.png with new RotationDialHandle.png as a 9-segment
  stretched texture in white with rounded corners.
- Use drawTexturedTriangleStrip to texture the handle, falling back to
  colored drawTriangleStrip if no texture is defined in the theme.
- Update drawStretched call to apply a ring texture if present, falling
  back to colored drawCircleOutline.
- Fix theme defaults and expand theme properties.
- Fix left-column segment U-axis coordinates.
- Fix radial band rendering to reduce artifacts on large arc widths.
- Dynamically resegment handle strip for runtime changes to handle_arc.
- Stop rendering if visible but the parent radius is < 1.
- Allow function-defined thickness to override theme definition, i.e.
  for runtime-defined arc changes.
- Update click region if thickness changed.
@oznogon oznogon force-pushed the refactor-guirotationdial-aimlock branch from 72d320a to e34f6cb Compare March 20, 2026 23:09
@oznogon oznogon marked this pull request as ready for review March 21, 2026 00:22
@daid daid merged commit e3e2783 into daid:master Mar 27, 2026
5 checks passed
@oznogon oznogon deleted the refactor-guirotationdial-aimlock branch March 27, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants