import { IParticleSystem2dComponent, ParticleRenderBuffers, ParticleSystem2dRenderOptions } from '@gg-web-engine/core'; import { ParticleContainer, Texture } from 'pixi.js'; import { PixiDisplayObjectComponent } from './pixi-display-object.component'; import { PixiVisualTypeDocRepo2D } from '../types'; /** * pixi.js-only particle system options, merged into `ParticleSystem2dRenderOptions` when creating a * system (`factory.createParticleSystem` / `world.addParticleSystem`). */ export type PixiParticleSystemExtraOpts = { /** * Whether sprite positions are rounded to whole pixels (crisp pixel art). Default `false`. * * @example * ```ts * world.addParticleSystem({ capacity: 64, texture: pixelDust, roundPixels: true }, { lifetime: 0.4 }); * ``` */ roundPixels?: boolean; }; /** * The pixi.js `IParticleSystem2dComponent`: a `ParticleContainer` whose `particleChildren` are * `capacity` pooled plain `IParticle` records, refilled from core's `ParticleRenderBuffers` on every * `setParticles` - position, scale (the particle's size in world units over the frame's size in * pixels), rotation, anchor (pixi's own `anchorX`/`anchorY`, the point at the position that the * sprite turns around), packed tint and opacity, and the atlas region as a sub-texture of the system's * texture (one `Texture` per distinct region, created on demand and shared by every particle * showing it). Every property is dynamic, so the container re-uploads them each frame. The * container's own `tint`/`opacity` multiply the particles' (inherited, like any pixi container). * * pixi's `ParticleContainer` never computes bounds itself, so `getBoundings`/`getLocalBoundings` * report whatever `nativeSprite.boundsArea` was set to (an empty box by default). */ export declare class PixiParticleSystemComponent extends PixiDisplayObjectComponent implements IParticleSystem2dComponent { readonly nativeSprite: ParticleContainer; readonly capacity: number; private readonly _renderOptions; get renderOptions(): Readonly>; private readonly pool; /** sub-textures of the current texture by atlas region, see `frameTexture` */ private readonly frameTextures; constructor(options: ParticleSystem2dRenderOptions & PixiParticleSystemExtraOpts); get texture(): Texture | null; set texture(value: Texture | null); setParticles(buffers: ParticleRenderBuffers): void; /** * The sub-texture of the system's texture showing the atlas region (normalized, top-left origin), * the texture itself for the whole image. */ private frameTexture; private disposeFrameTextures; clone(): PixiParticleSystemComponent; popChild(): null; dispose(): void; }