UNPKG

blaze-2d

Version:

A fast and simple WebGL 2 2D game engine written in TypeScript

50 lines (49 loc) 1.58 kB
import Renderer from "./renderer"; import { ZMap } from "../utils/types"; import Fluid from "../physics/fluid/fluid"; import { vec2 } from "gl-matrix"; /** * Renders {@link Fluid}s using a marching squares metaball algorithm. */ export default abstract class FluidRenderer extends Renderer { private static fluidQueue; /** * Renders all fluids in the queue and clears the queue. * * If the {@link Renderer}'s camera has not been set nothing will be rendered. */ static flush(z: number): void; /** * Renders a {@link Fluid} using a metaball shader. * * @param fluid The fluid to render * @param quad The vertices of the quad to render to (should be size of camera's viewport) * @param indices The indices of the quad to render to * @param quadDimensions The width and height of the quad */ static renderFluid(fluid: Fluid, quad: Float32Array, indices: Uint16Array, quadDimensions: vec2): void; /** * Adds a {@link Fluid} to the render queue. * * @param fluid The fluid to queue for rendering */ static queueFluid(fluid: Fluid): void; /** * Gets the fluid render queue. * * @returns the fluid render queue */ static getFluidQueue(): ZMap<Fluid[]>; /** * Gets the maximum zIndex used by the queue. * * @returns The max zIndex of the queue */ static getQueueMax(): number; /** * Gets the minimum zIndex used by the queue. * * @returns The min zIndex of the queue */ static getQueueMin(): number; }