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

Only create stars if needed and dispose them when no longer needed #99

Merged
merged 1 commit into from
May 22, 2024

Conversation

mrxz
Copy link
Contributor

@mrxz mrxz commented May 10, 2024

When the sky is set to atmosphere the stars entity and mesh are generated. However, this also happens if the computed number of stars is 0, which is the case for several of the presets. While nothing is being drawn it still has some drawbacks:

  1. Three.js still prepares everything for this draw call (e.g. uniforms), which is just wasted effort
  2. The Quest browser logs a warning each frame (RENDER WARNING: Render count or primcount is 0.), which after logging 256 warnings stops any further WebGL errors from being logged.

This PR adds an additional check if the star count is 0, in which case the stars aren't created (or even disposed/removed if created prior).

Copy link
Contributor

@vincentfretin vincentfretin left a comment

Choose a reason for hiding this comment

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

Oh yeah I saw this warning in the past, I had no idea it was coming from the stars.
@dmarcos

index.js Outdated Show resolved Hide resolved
@dmarcos
Copy link
Member

dmarcos commented May 22, 2024

Thank you!

@dmarcos dmarcos merged commit 3c2d7db into supermedium:master May 22, 2024
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.

None yet

3 participants