Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
A library to visibly cull objects designed to work with pixi.js (but not dependent on pixi.js).
Includes two types of culling algorithms: simple and spatial hash. The spatial hash may be also be used for collision detection, AI, etc.
Features include:
pixi-cull has been reworked and ported to typescript. The following functionality was removed:
Since I maintain pixi-viewport, I was asked a number of times for a culling library. Well here it is. Choose from two drop-in algorithms to cull your objects.
import * as PIXI from "pixi.js"
import { Viewport } from "pixi-viewport"
import { Simple, SpatialHash } from "pixi-cull"
const app = new PIXI.Application()
document.body.appendChild(app.view)
// create viewport
const viewport = new Viewport({
screenWidth: app.view.offsetWidth,
screenHeight: app.view.offsetHeight,
worldWidth: 10000,
worldHeight: 10000,
})
app.stage.addChild(viewport)
viewport.drag().pinch().wheel().decelerate().moveCenter(5000, 5000)
// add red boxes
for (let i = 0; i < 500; i++) {
const sprite = viewport.addChild(new PIXI.Sprite(PIXI.Texture.WHITE))
sprite.tint = 0xff0000
sprite.width = sprite.height = 100
sprite.position.set(Math.random() * 10000, Math.random() * 10000)
}
const cull = new Simple() // new SpatialHash()
cull.addList(viewport.children)
cull.cull(viewport.getVisibleBounds())
// cull whenever the viewport moves
PIXI.Ticker.shared.add(() => {
if (viewport.dirty) {
cull.cull(viewport.getVisibleBounds())
viewport.dirty = false
}
})
https://davidfig.github.io/pixi-cull/
https://davidfig.github.io/pixi-cull/jsdoc/
npm i pixi-cull
or grab the latest release and use it:
<script src="/directory-to-file/pixi.js"></script>
<script src="/directory-to-file/pixi-cull.min.js"></script>
<script>
const SimpleCull = new Cull.Simple()
</script>
MIT License (c) 2021 YOPEY YOPEY LLC by David Figatner
FAQs
a library to visibly cull objects designed to work with pixi.js
We found that pixi-cull demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.