Skip to content

Commit

Permalink
Merge branch 'main' into chore-emboss-filter-tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bbazukun123 committed Feb 14, 2024
2 parents e35b39f + b512624 commit 93c4db8
Show file tree
Hide file tree
Showing 37 changed files with 85 additions and 76 deletions.
2 changes: 1 addition & 1 deletion examples/src/DemoApplication.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export default class DemoApplication extends PIXI.Application
name: id,
enabled: false,
opened: false,
args: null,
args: undefined,
fishOnly: false,
global: false,
oncreate: null,
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions scripts/screenshots/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ const outputOptions = {
},
};

const indexCount = 0;

const app = new Application();

app.init({
width: outputOptions.width,
height: outputOptions.height,
backgroundColor: outputOptions.border.color,
autoStart: false,
preference: 'webgl',
preference: 'webgpu',
hello: true,
}).then(() =>
{
Expand Down Expand Up @@ -163,8 +165,15 @@ app.init({
app.render();
const canvas = app.renderer.extract.canvas(app.stage);

const canvas2 = document.createElement('canvas');

canvas2.width = canvas.width;
canvas2.height = canvas.height;

document.body.appendChild(canvas);
const context = canvas.getContext('2d');
const context = canvas2.getContext('2d');

context.drawImage(canvas, 0, 0);

context.scale(1, -1);
const imageData = context.getImageData(0, 0, outputOptions.width, outputOptions.height);
Expand Down
4 changes: 2 additions & 2 deletions src/adjustment/AdjustmentFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class AdjustmentFilter extends Filter
{
options = { ...AdjustmentFilter.DEFAULT_OPTIONS, ...options };

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -95,7 +95,7 @@ export class AdjustmentFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'adjustment-filter'
Expand Down
4 changes: 2 additions & 2 deletions src/advanced-bloom/AdvancedBloomFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class AdvancedBloomFilter extends Filter
{
options = { ...AdvancedBloomFilter.DEFAULT_OPTIONS, ...options };

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -88,7 +88,7 @@ export class AdvancedBloomFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'advanced-bloom-filter',
Expand Down
4 changes: 2 additions & 2 deletions src/advanced-bloom/ExtractBrightnessFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class ExtractBrightnessFilter extends Filter
{
options = { ...ExtractBrightnessFilter.DEFAULT_OPTIONS, ...options };

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -42,7 +42,7 @@ export class ExtractBrightnessFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'extract-brightness-filter',
Expand Down
4 changes: 2 additions & 2 deletions src/ascii/AsciiFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class AsciiFilter extends Filter

options = { ...AsciiFilter.DEFAULT_OPTIONS, ...options } as AsciiFilterOptions;

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -70,7 +70,7 @@ export class AsciiFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'ascii-filter',
Expand Down
4 changes: 2 additions & 2 deletions src/bevel/BevelFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class BevelFilter extends Filter

const rotation = (options.rotation ?? 45) * DEG_TO_RAD;

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -89,7 +89,7 @@ export class BevelFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'bevel-filter',
Expand Down
4 changes: 2 additions & 2 deletions src/bulge-pinch/BulgePinchFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class BulgePinchFilter extends Filter
{
options = { ...BulgePinchFilter.DEFAULT_OPTIONS, ...options };

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -64,7 +64,7 @@ export class BulgePinchFilter extends Filter
entryPoint: 'mainFragment',
},
});
const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'bulge-pinch-filter',
Expand Down
4 changes: 2 additions & 2 deletions src/color-gradient/ColorGradientFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class ColorGradientFilter extends Filter
throw new Error('ColorGradientFilter requires at least 2 color stops.');
}

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source,
entryPoint: 'mainVertex',
Expand All @@ -108,7 +108,7 @@ export class ColorGradientFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'color-gradient-filter',
Expand Down
4 changes: 2 additions & 2 deletions src/color-map/ColorMapFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class ColorMapFilter extends Filter

if (!options.colorMap) throw Error('No color map texture source was provided to ColorMapFilter');

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -71,7 +71,7 @@ export class ColorMapFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'color-map-filter',
Expand Down
4 changes: 2 additions & 2 deletions src/color-overlay/ColorOverlayFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class ColorOverlayFilter extends Filter
{
options = { ...ColorOverlayFilter.DEFAULT_OPTIONS, ...options };

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -56,7 +56,7 @@ export class ColorOverlayFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'color-overlay-filter',
Expand Down
4 changes: 2 additions & 2 deletions src/color-replace/ColorReplaceFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class ColorReplaceFilter extends Filter
{
options = { ...ColorReplaceFilter.DEFAULT_OPTIONS, ...options };

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -88,7 +88,7 @@ export class ColorReplaceFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'color-replace-filter',
Expand Down
4 changes: 2 additions & 2 deletions src/convolution/ConvolutionFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class ConvolutionFilter extends Filter
const width = options.width ?? 200;
const height = options.height ?? 200;

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -73,7 +73,7 @@ export class ConvolutionFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'convolution-filter',
Expand Down
4 changes: 2 additions & 2 deletions src/cross-hatch/CrossHatchFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class CrossHatchFilter extends Filter
{
constructor()
{
const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -26,7 +26,7 @@ export class CrossHatchFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'cross-hatch-filter',
Expand Down
4 changes: 2 additions & 2 deletions src/crt/CRTFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class CRTFilter extends Filter
{
options = { ...CRTFilter.DEFAULT_OPTIONS, ...options };

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -127,7 +127,7 @@ export class CRTFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'crt-filter',
Expand Down
4 changes: 2 additions & 2 deletions src/dot/DotFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class DotFilter extends Filter
uGrayScale: { value: options.grayscale ? 1 : 0, type: 'f32' },
};

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -69,7 +69,7 @@ export class DotFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'dot-filter',
Expand Down
8 changes: 4 additions & 4 deletions src/drop-shadow/DropShadowFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class DropShadowFilter extends Filter
{
options = { ...DropShadowFilter.DEFAULT_OPTIONS, ...options };

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -112,7 +112,7 @@ export class DropShadowFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'drop-shadow-filter',
Expand Down Expand Up @@ -140,7 +140,7 @@ export class DropShadowFilter extends Filter
});

this._basePass = new Filter({
gpuProgram: new GpuProgram({
gpuProgram: GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -160,7 +160,7 @@ export class DropShadowFilter extends Filter
entryPoint: 'mainFragment',
},
}),
glProgram: new GlProgram({
glProgram: GlProgram.from({
vertex,
fragment: `
in vec2 vTextureCoord;
Expand Down
4 changes: 2 additions & 2 deletions src/glitch/GlitchFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class GlitchFilter extends Filter
{
options = { ...GlitchFilter.defaults, ...options };

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -132,7 +132,7 @@ export class GlitchFilter extends Filter
},
});

const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment,
name: 'glitch-filter',
Expand Down
4 changes: 2 additions & 2 deletions src/glow/GlowFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class GlowFilter extends Filter
const distance = options.distance ?? 10;
const quality = options.quality ?? 0.1;

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -108,7 +108,7 @@ export class GlowFilter extends Filter
* since we hard-assign them during creation to allow
* for the values to be used in GLSL loops
*/
const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment: fragment
.replace(/__ANGLE_STEP_SIZE__/gi, `${(1 / quality / distance).toFixed(7)}`)
Expand Down
4 changes: 2 additions & 2 deletions src/godray/GodrayFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class GodrayFilter extends Filter
{
options = { ...GodrayFilter.DEFAULT_OPTIONS, ...options };

const gpuProgram = new GpuProgram({
const gpuProgram = GpuProgram.from({
vertex: {
source: wgslVertex,
entryPoint: 'mainVertex',
Expand All @@ -109,7 +109,7 @@ export class GodrayFilter extends Filter
entryPoint: 'mainFragment',
},
});
const glProgram = new GlProgram({
const glProgram = GlProgram.from({
vertex,
fragment: fragment.replace('${PERLIN}', perlin),
name: 'god-ray-filter',
Expand Down
Loading

0 comments on commit 93c4db8

Please sign in to comment.