pixijs / pixi-react

Write PIXI apps using React declarative style
https://pixijs.io/pixi-react/
MIT License
2.33k stars 177 forks source link

How does react-pixi handle culling? #318

Closed lanyusan closed 2 years ago

lanyusan commented 2 years ago

Pixi's guide talked about it in length.

If you're building a project where a large proportion of your DisplayObject's are off-screen (say, a side-scrolling game), you will want to cull those objects. Culling is the process of evaluating if an object (or its children!) is on the screen, and if not, turning off rendering for it. If you don't cull off-screen objects, the renderer will still draw them, even though none of their pixels end up on the screen.

PixiJS doesn't provide built-in support for viewport culling, but you can find 3rd party plugins that might fit your needs. Alternately, if you'd like to build your own culling system, simply run your objects during each tick and set renderable to false on any object that doesn't need to be drawn.

How does react-pixi handle it? Automatically or should developers deal with it manually? Or any helper function?

Thanks.

I am evaluating canvas libraries for a project. This feature would be very helpful.

inlet commented 2 years ago

Hi @lanyusan,

Thanks for pointing out, culling is not part of this lib. This lib simply is a React wrapper for PIXI. However there are plenty of PIXI third party extensions available that support culling.