UNPKG

pixi.js

Version:

<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">

1 lines 3.54 kB
{"version":3,"file":"cullingMixin.mjs","sources":["../../src/culling/cullingMixin.ts"],"sourcesContent":["import type { Rectangle } from '../maths/shapes/Rectangle';\n\n/**\n * The CullingMixin interface provides properties and methods for managing culling behavior\n * of a display object. Culling is the process of determining whether an object should be rendered\n * based on its visibility within the current view or frame.\n *\n * Key Features:\n * - Custom culling areas for better performance\n * - Per-object culling control\n * - Child culling management\n * @example\n * ```ts\n * // Enable culling for a container\n * const container = new Container();\n * container.cullable = true;\n *\n * // Set custom cull area for better performance\n * container.cullArea = new Rectangle(0, 0, 800, 600);\n *\n * // Disable child culling for static scenes\n * container.cullableChildren = false;\n * ```\n * @category scene\n * @standard\n */\nexport interface CullingMixinConstructor\n{\n /**\n * Custom shape used for culling calculations instead of object bounds.\n * Defined in local space coordinates relative to the object.\n * > [!NOTE]\n * > Setting this to a custom Rectangle allows you to define a specific area for culling,\n * > which can improve performance by avoiding expensive bounds calculations.\n * @example\n * ```ts\n * const container = new Container();\n *\n * // Define custom culling boundary\n * container.cullArea = new Rectangle(0, 0, 800, 600);\n *\n * // Reset to use object bounds\n * container.cullArea = null;\n * ```\n * @remarks\n * - Improves performance by avoiding bounds calculations\n * - Useful for containers with many children\n * - Set to null to use object bounds\n * @default null\n */\n cullArea: Rectangle;\n\n /**\n * Controls whether this object should be culled when out of view.\n * When true, the object will not be rendered if its bounds are outside the visible area.\n * @example\n * ```ts\n * const sprite = new Sprite(texture);\n *\n * // Enable culling\n * sprite.cullable = true;\n *\n * // Force object to always render\n * sprite.cullable = false;\n * ```\n * @remarks\n * - Does not affect transform updates\n * - Applies to this object only\n * - Children follow their own cullable setting\n * @default false\n */\n cullable: boolean;\n\n /**\n * Controls whether children of this container can be culled.\n * When false, skips recursive culling checks for better performance.\n * @example\n * ```ts\n * const container = new Container();\n *\n * // Enable container culling\n * container.cullable = true;\n *\n * // Disable child culling for performance\n * container.cullableChildren = false;\n *\n * // Children will always render if container is visible\n * container.addChild(sprite1, sprite2, sprite3);\n * ```\n * @remarks\n * - Improves performance for static scenes\n * - Useful when children are always within container bounds\n * - Parent culling still applies\n * @default true\n */\n cullableChildren: boolean;\n}\n\n/** @internal */\nexport const cullingMixin: CullingMixinConstructor = {\n cullArea: null,\n cullable: false,\n cullableChildren: true,\n};\n"],"names":[],"mappings":";AAmGO,MAAM,YAAwC,GAAA;AAAA,EACjD,QAAU,EAAA,IAAA;AAAA,EACV,QAAU,EAAA,KAAA;AAAA,EACV,gBAAkB,EAAA,IAAA;AACtB;;;;"}