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

How the get only the actual rendered sprites #63

Open
Anckermann opened this issue Nov 6, 2020 · 1 comment
Open

How the get only the actual rendered sprites #63

Anckermann opened this issue Nov 6, 2020 · 1 comment

Comments

@Anckermann
Copy link

Anckermann commented Nov 6, 2020

I have already searched on the Pixi.js forums and guidelines, but found nothing. Is there a way to get the only displayed sprites?
I have to load a lot of sprites on the map (8000+) and then populate an html list for them that is contestual to what is seen on the map. Yes, I could scroll the entire array of sprites in the container and check if every sprite is in the map bounds, but this operation takes way too much effort and is taking a lot of perfomance away.
When the sprites will be in great number, I'm planning on using an infinite procedural list, but getting what is displayed will help me a lot and avoid useless computation.

Is it possible to get just what is seen on the screen by the pixi renderer for example?

@Alexbay218
Copy link

https://github.com/davidfig/pixi-cull might fit your needs, especially if you use pixi-viewport library (by the same author). The simple version looks to be the same approach (looping through all sprites), but the spatial hash might give you the performance you need.

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

No branches or pull requests

2 participants