Files
nothoughts/node_modules/pixi.js/lib/culling/Culler.mjs.map
2025-08-04 18:57:35 +02:00

1 line
3.9 KiB
Plaintext

{"version":3,"file":"Culler.mjs","sources":["../../src/culling/Culler.ts"],"sourcesContent":["import { Bounds } from '../scene/container/bounds/Bounds';\nimport { getGlobalBounds } from '../scene/container/bounds/getGlobalBounds';\n\nimport type { Container } from '../scene/container/Container';\n\nconst tempBounds = new Bounds();\n\ntype RectangleLike = {x: number, y: number, width: number, height: number};\n\n/**\n * The Culler class is responsible for managing and culling containers.\n *\n *\n * Culled containers will not be rendered, and their children will not be processed. This can be useful for\n * performance optimization when dealing with large scenes.\n * @example\n * import { Culler, Container } from 'pixi.js';\n *\n * const culler = new Culler();\n * const stage = new Container();\n *\n * ... set up stage ...\n *\n * culler.cull(stage, { x: 0, y: 0, width: 800, height: 600 });\n * renderer.render(stage);\n * @memberof scene\n */\nexport class Culler\n{\n /**\n * Culls the children of a specific container based on the given view. This will also cull items that are not\n * being explicitly managed by the culler.\n * @param container - The container to cull.\n * @param view - The view rectangle.\n * @param skipUpdateTransform - Whether to skip updating the transform.\n */\n public cull(container: Container, view: RectangleLike, skipUpdateTransform = true)\n {\n this._cullRecursive(container, view, skipUpdateTransform);\n }\n\n private _cullRecursive(container: Container, view: RectangleLike, skipUpdateTransform = true)\n {\n if (container.cullable && container.measurable && container.includeInBuild)\n {\n const bounds = container.cullArea ?? getGlobalBounds(container, skipUpdateTransform, tempBounds);\n\n // check view intersection..\n container.culled = bounds.x >= view.x + view.width\n || bounds.y >= view.y + view.height\n || bounds.x + bounds.width <= view.x\n || bounds.y + bounds.height <= view.y;\n }\n else\n {\n container.culled = false;\n }\n\n // dont process children if not needed\n if (\n !container.cullableChildren\n || container.culled\n || !container.renderable\n || !container.measurable\n || !container.includeInBuild\n ) return;\n\n for (let i = 0; i < container.children.length; i++)\n {\n this._cullRecursive(container.children[i], view, skipUpdateTransform);\n }\n }\n\n /** A shared instance of the Culler class. */\n public static shared = new Culler();\n}\n"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