From 2216543b85b00dad8b086e664d41e1d11dafd71b Mon Sep 17 00:00:00 2001 From: bbazukun123 Date: Wed, 14 Feb 2024 19:42:27 +0000 Subject: [PATCH] Chore: PixelateFilter backward-compatibility (#431) Co-authored-by: Baz Utsahajit --- src/pixelate/PixelateFilter.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/pixelate/PixelateFilter.ts b/src/pixelate/PixelateFilter.ts index cb7f0382c..8b5a13e7c 100644 --- a/src/pixelate/PixelateFilter.ts +++ b/src/pixelate/PixelateFilter.ts @@ -1,4 +1,4 @@ -import { Filter, GlProgram, GpuProgram, Point, UniformGroup } from 'pixi.js'; +import { Filter, GlProgram, GpuProgram, Point } from 'pixi.js'; import { vertex, wgslVertex } from '../defaults'; import fragment from './pixelate.frag'; import source from './pixelate.wgsl'; @@ -15,20 +15,11 @@ type Size = number | number[] | Point; */ export class PixelateFilter extends Filter { - /** Default values for options. */ - public static readonly DEFAULT_SIZE: Size = 10; - /** * @param {Point|Array|number} [size=10] - Either the width/height of the size of the pixels, or square size */ - constructor(size: Size) + constructor(size: Size = 10) { - size = size ?? PixelateFilter.DEFAULT_SIZE; - - const pixelateUniforms = new UniformGroup({ - uSize: { value: new Float32Array(2), type: 'vec2' }, - }); - const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, @@ -50,7 +41,9 @@ export class PixelateFilter extends Filter gpuProgram, glProgram, resources: { - pixelateUniforms, + pixelateUniforms: { + uSize: { value: new Float32Array(2), type: 'vec2' }, + }, }, });