Skip to content

Commit

Permalink
Chore: EmbossFilter backward-compatibility (#423)
Browse files Browse the repository at this point in the history
Co-authored-by: Baz Utsahajit <baz.utsahajit@play.co>
  • Loading branch information
bbazukun123 and bbazukun123 committed Feb 14, 2024
1 parent 89baaec commit c76067e
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions src/emboss/EmbossFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ import { vertex, wgslVertex } from '../defaults';
import fragment from './emboss.frag';
import source from './emboss.wgsl';

export interface EmbossFilterOptions
{
/**
* Strength of the emboss
* @default 5
*/
strength?: number;
}

/**
* An RGB Split Filter.<br>
* ![original](../screenshots/original.png)![filter](../screenshots/emboss.png)
Expand All @@ -22,19 +13,15 @@ export interface EmbossFilterOptions
*/
export class EmbossFilter extends Filter
{
/** Default values for options. */
public static readonly DEFAULT_OPTIONS: EmbossFilterOptions = {
strength: 5,
};

public uniforms: {
uStrength: number;
};

constructor(options?: EmbossFilterOptions)
/**
* @param {number} [strength=5] - Strength of the emboss.
*/
constructor(strength = 5)
{
options = { ...EmbossFilter.DEFAULT_OPTIONS, ...options };

const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
Expand All @@ -57,7 +44,7 @@ export class EmbossFilter extends Filter
glProgram,
resources: {
embossUniforms: {
uStrength: { value: options.strength, type: 'f32' },
uStrength: { value: strength, type: 'f32' },
}
},
});
Expand Down

0 comments on commit c76067e

Please sign in to comment.