excalibur
Version:
Excalibur.js is a simple JavaScript game engine with TypeScript bindings for making 2D games in HTML5 Canvas. Our mission is to make web game development as simple as possible.
51 lines (50 loc) • 1.72 kB
TypeScript
import { ExcaliburGraphicsContextWebGL } from '../Graphics/Context/ExcaliburGraphicsContextWebGL';
import { GpuParticleEmitter } from './GpuParticleEmitter';
import { ParticleConfig } from './Particles';
import { Random } from '../Math/Random';
import { Sprite } from '../Graphics/Sprite';
export interface GpuParticleConfig extends ParticleConfig {
/**
* Only Sprite graphics are supported in GPU particles at the moment
*/
graphic?: Sprite;
/**
* Set the maximum particles to use for this emitter
*/
maxParticles?: number;
}
/**
* Container for the GPU Particle State contains the internal state needed for the GPU
* to render particles and maintain state.
*/
export declare class GpuParticleRenderer {
static readonly GPU_MAX_PARTICLES: number;
emitter: GpuParticleEmitter;
emitRate: number;
particle: GpuParticleConfig;
private _initialized;
private _vaos;
private _buffers;
private _random;
private _drawIndex;
private _currentVao;
private _currentBuffer;
private _numInputFloats;
private _particleData;
private _particleIndex;
private _uploadIndex;
private _wrappedLife;
private _wrappedParticles;
private _particleLife;
constructor(emitter: GpuParticleEmitter, random: Random, options: GpuParticleConfig);
get isInitialized(): boolean;
get maxParticles(): number;
initialize(gl: WebGL2RenderingContext, context: ExcaliburGraphicsContextWebGL): void;
private _clearRequested;
clearParticles(): void;
private _emitted;
emitParticles(particleCount: number): void;
private _uploadEmitted;
update(elapsed: number): void;
draw(gl: WebGL2RenderingContext): void;
}