Skip to content

[Sofa.GL] DrawtoolGL: Auto-scale indices display based on camera distance#6092

Open
fredroy wants to merge 1 commit intosofa-framework:masterfrom
fredroy:update_showindices_autoscale
Open

[Sofa.GL] DrawtoolGL: Auto-scale indices display based on camera distance#6092
fredroy wants to merge 1 commit intosofa-framework:masterfrom
fredroy:update_showindices_autoscale

Conversation

@fredroy
Copy link
Copy Markdown
Contributor

@fredroy fredroy commented Apr 23, 2026

The indices are rendered independently of the size of the scene (bbox) and zoom.
Now the size is determined by screen space, i.e it will always show the same size, no matter the zoom.

Breaking side-effect: the side-car parameter, scale (like showIndicesScale of the mechanical object, is now defaultted to 1.
Default pixel-size is set to 30 but I guess it could be tweaked if the reviewers want.

Screenshot 2026-04-23 at 11 36 25 Screenshot 2026-04-23 at 11 36 41

By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

The indices text now maintains a constant screen-space size regardless of zoom level and scene dimensions, removing the need to manually adjust showIndicesScale per scene.

  - Compute per-vertex scale from the projection matrix and camera depth in GlText::textureDraw_Indices
  - Handle both perspective and orthographic projections
  - Add alpha blending for smoother text rendering
  - Update all callers to pass a dimensionless multiplier (default 1.0) instead of bbox-dependent world-space size
@fredroy fredroy added pr: enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request pr: AI-aided Label notifying the reviewers that part or all of the PR has been generated with the help of an AI labels Apr 23, 2026
Copy link
Copy Markdown
Contributor

@hugtalbot hugtalbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Scaling factor" instead of "Multiplier" ?

Else OK to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: AI-aided Label notifying the reviewers that part or all of the PR has been generated with the help of an AI pr: enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants