UNPKG

@mesmotronic/three-retropass

Version:

RetroPass applies a retro aesthetic to your Three.js project, emulating the visual style of classic 8-bit and 16-bit games

69 lines (68 loc) 2.28 kB
import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; import { RetroPassParameters } from '../models/RetroPassParameters'; import * as THREE from 'three'; /** * Post-processing pass for applying a retro-style effect with color quantization and dithering */ export declare class RetroPass extends ShaderPass { #private; protected size: THREE.Vector2; /** * Creates a new RetroPass instance * @param parameters - Configuration parameters for the retro effect */ constructor({ colorCount, colorPalette, dithering, ditheringOffset, autoDitheringOffset, pixelRatio, resolution, autoResolution, }?: RetroPassParameters); /** * Pixel resolution to use */ get resolution(): THREE.Vector2; set resolution(value: THREE.Vector2); /** * Whether to automatically update the resolution based on the specified pixelRatio */ get autoResolution(): boolean; set autoResolution(value: boolean); /** * Pixel ratio to use if autoResolution is true, typically 0.0-1.0 (optional) */ get pixelRatio(): number; set pixelRatio(value: number); /** * The number of colors in the palette */ get colorCount(): number; set colorCount(value: number); /** * The current color palette */ get colorPalette(): THREE.Color[]; set colorPalette(colors: THREE.Color[]); /** * Whether or not to apply dithering */ get dithering(): boolean; set dithering(value: boolean); /** * The amount of dithering to apply, typically 0.0 to 1.0 */ get ditheringOffset(): number; set ditheringOffset(value: number); /** * Whether to automatically update the dithering offset based on the color count */ get autoDitheringOffset(): boolean; set autoDitheringOffset(value: boolean); /** * Set the pixel resolution to use (used by EffectComposer) * @see {@link RetroPass.resolution} */ setSize(width: number, height: number): void; /** * Updates the resolution based on the current pixel ratio and size */ protected updateResolution(): void; /** * Updates the dithering offset based on the current color count */ protected updateDitheringOffset(): void; }