Skip to content

Commit

Permalink
Chore: Emboss Filter Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bbazukun123 committed Feb 8, 2024
1 parent 9d610bb commit e35b39f
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 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,20 +13,16 @@ 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 = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -46,7 +33,7 @@ export class EmbossFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'emboss-filter',
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 e35b39f

Please sign in to comment.