https://github.com/eriksom/pixiculling
A cell based culling engine for Pixi
https://github.com/eriksom/pixiculling
culling culling-engine graphics optimization pixi
Last synced: 3 months ago
JSON representation
A cell based culling engine for Pixi
- Host: GitHub
- URL: https://github.com/eriksom/pixiculling
- Owner: ErikSom
- License: mit
- Created: 2018-11-23T16:32:07.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-29T16:22:07.000Z (almost 7 years ago)
- Last Synced: 2025-03-25T23:11:46.357Z (7 months ago)
- Topics: culling, culling-engine, graphics, optimization, pixi
- Language: JavaScript
- Size: 2.18 MB
- Stars: 14
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PixiCulling [](https://twitter.com/intent/tweet?text=Checkout%20this%20culling%20engine%20for%20pixi&url=https://github.com/ErikSom/PixiCulling&hashtags=pixi)
A cell based culling engine for Pixi# Example
https://eriksom.github.io/PixiCulling/# Notes
* Graphics need to have their pivot in the center
* Graphics are initialized once. If a graphic changes in shape or form during runtime you need to update the graphic size info, you can use PixiCulling.getSizeInfoForGraphic(graphic) for this
* For debugging the container needs to be a graphic```javascript
//Example scripts, also feel free to look at the demo
import * as PixiCulling from './PixiCulling';
//render area sets the viewport that will be used to cull things, you can also change these during runtime
PixiCulling.renderArea.x = 100;
PixiCulling.renderArea.y = 100;
PixiCulling.renderArea.width = 200;
PixiCulling.renderArea.height = 300;PixiCulling.marginCells = 1; // ads an extra border of X cells arround the renderArea, usefull when setting renderArea to full screen and you dont want big objects to pop in the screen, default=0 You can also set this to a negative number.
//here you can set the precision of the culling, lower number is more precision, don't change these during runtime
PixiCulling.cellSize.x = 50;
PixiCulling.cellSize.y = 50;//initialize PixiCulling on your container
PixiCulling.init(container);// run update on every frame or on changing the render area
PixiCulling.update();PixiCulling.setDebug(true); // false by default, you can also use PixiCulling.toggleDebug();
//PixiCulling.setEnabled(true) // true by default, you can also use PixiCulling.toggleEnabled();```