Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nametags - Fix overlapping draw order #10680

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mjc4wilton
Copy link
Contributor

@mjc4wilton mjc4wilton commented Jan 20, 2025

When merged this pull request will:

  • Nametags of units closest to the camera are drawn last, making them appear on top of more distant units
  • Makes overlapping nametags more readable, especially useful for briefing / debriefing types of scenarios

Screenshot of before vs after
image

Performance comparison:

Command Avg. Time
Disabled private _nearMenOld = (positionCameraToWorld [0, 0, 0]) nearObjects ["CAManBase", 5 + 7]; 0.00488354 ms
Enabled private _nearMen = nearestObjects [(positionCameraToWorld [0, 0, 0]), ["CAManBase"], 5 + 7]; reverse _nearMen; 0.00593126 ms
(Note, there is caching going on that this comparison does not account for)

@severgun
Copy link
Contributor

Why it should be toggable setting?
Why not just always sort?

@Mike-MF
Copy link
Member

Mike-MF commented Jan 20, 2025

Yeah I don't really see the point of the setting here, this is an improvement and I can't imagine anyone would want overlapping when they have the option not to.

addons/nametags/initSettings.inc.sqf Outdated Show resolved Hide resolved
@mjc4wilton
Copy link
Contributor Author

I had it as a setting as it technically comes with a 18% performance penalty over the previous one which could add up since its running on most drawn frames.

@johnb432
Copy link
Contributor

I had it as a setting as it technically comes with a 18% performance penalty over the previous one which could add up since its running on most drawn frames.

Can't we just do a forEachReversed?

@mjc4wilton
Copy link
Contributor Author

Removed the option and utilized forEachReversed as an extra optimization step.

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.

5 participants