Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Emboss Filter Tweaks #423

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading