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

Fix ShowRecieveStats in the Developer > Avatar menu #1247

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

Conversation

Armored-Dragon
Copy link
Member

@Armored-Dragon Armored-Dragon commented Nov 22, 2024

This is an attempt at fixing, or at least making this feature operational, ShowRecieveStats setting.
This renders a users display name along with their networking statistics.

While functional this pull creates a hell of a lot of compiler warnings. While not blocking this is annoying. Until I can quiet down its pleaful cries, this won't be ready to merge.

image

* Adjustments
* Don't show local stats.
@Armored-Dragon Armored-Dragon added bug Something isn't working work in progress Do not merge yet needs CR This pull request needs to be code reviewed needs QA This pull request needs to be tested labels Nov 22, 2024
@Armored-Dragon Armored-Dragon self-assigned this Nov 22, 2024
@Armored-Dragon Armored-Dragon removed the work in progress Do not merge yet label Nov 24, 2024
@Armored-Dragon
Copy link
Member Author

It seems as if the compiler issues I had noticed are nothing new.

@Armored-Dragon Armored-Dragon added the work in progress Do not merge yet label Nov 25, 2024
@HifiExperiments HifiExperiments added CR approved This pull request has been successfully code reviewed and removed needs CR This pull request needs to be code reviewed labels Nov 26, 2024
@Armored-Dragon Armored-Dragon removed the work in progress Do not merge yet label Nov 26, 2024
@HifiExperiments
Copy link
Member

ah ok I figured out the problem:

  1. we do need that change in the shader:
diff --git a/libraries/render-utils/src/sdf_text3D.slh b/libraries/render-utils/src/sdf_text3D.slh
index c927070a4dd..5471415e1cc 100644
--- a/libraries/render-utils/src/sdf_text3D.slh
+++ b/libraries/render-utils/src/sdf_text3D.slh
@@ -95,8 +95,8 @@ vec4 evalSDFColor(vec2 texCoord, vec4 glyphBounds) {

 vec4 evalSDFSuperSampled(vec2 texCoord, vec2 positionMS, vec4 glyphBounds) {
     // Clip to edges. Note: We don't need to check the top edge.
-    if (positionMS.x < params.bounds.x || positionMS.x > (params.bounds.x + params.bounds.z) ||
-        positionMS.y < params.bounds.y - params.bounds.w) {
+    if ((params.bounds.z > 0.0 && (positionMS.x < params.bounds.x || positionMS.x > (params.bounds.x + params.bounds.z))) ||
+        (params.bounds.w > 0.0 && (positionMS.y < params.bounds.y - params.bounds.w))) {
         return vec4(0.0);
     }
  1. there's a missing check in Font.cpp:
diff --git a/libraries/render-utils/src/text/Font.cpp b/libraries/render-utils/src/text/Font.cpp
index 81badb84406..23699de69a9 100644
--- a/libraries/render-utils/src/text/Font.cpp
+++ b/libraries/render-utils/src/text/Font.cpp
@@ -438,7 +438,7 @@ void Font::buildVertices(Font::DrawInfo& drawInfo, const QString& str, const glm

         // Draw the token
         for (const QChar& c : token) {
-            if (advance.x > rightEdge) {
+            if (bounds.x != -1 && advance.x > rightEdge) {
                 break;
             }
             const Glyph& glyph = _glyphs[c];
  1. you can't add TextAlignment::CENTER if you're using bounds of -1.0f because then it doesn't have any bounds to center between!

so I'd suggest:

  • make the first two changes, because they're good to have
  • either leave it left aligned and with the -1 bounds, or center it with some bounds like you current have

@Armored-Dragon
Copy link
Member Author

I applied the suggested patches and it seems that everything is now working as expected, thank you for your support!
The text is also left aligned again. I left the option in there as the statistics we may want displayed using this might grow and it might make sense to adjust the alignment in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CR approved This pull request has been successfully code reviewed needs QA This pull request needs to be tested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants