layers icon indicating copy to clipboard operation
layers copied to clipboard

How the get only the actual rendered sprites

Open Anckermann opened this issue 4 years ago • 1 comments

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?

Anckermann avatar Nov 06 '20 12:11 Anckermann

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.

Alexbay218 avatar Mar 18 '21 15:03 Alexbay218