Skip to content

Commit

Permalink
Merge pull request #283 from vanruesc/dev
Browse files Browse the repository at this point in the history
Version 6.21.3
  • Loading branch information
vanruesc authored Apr 7, 2021
2 parents 51d60cb + 3917d58 commit d04698a
Show file tree
Hide file tree
Showing 40 changed files with 2,380 additions and 2,639 deletions.
28 changes: 11 additions & 17 deletions demo/src/demos/PerformanceDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ import {
SMAAImageLoader,
SMAAPreset,
TextureEffect,
ToneMappingEffect,
ToneMappingMode,
VignetteEffect
} from "../../../src";

Expand Down Expand Up @@ -240,7 +238,7 @@ export class PerformanceDemo extends PostProcessingDemo {
// Lights

const ambientLight = new AmbientLight(0x323232);
const pointLight = new PointLight(0xffbbaa, 80, 12);
const pointLight = new PointLight(0xb6d4ff, 80, 10);

this.light = pointLight;
scene.add(ambientLight, pointLight);
Expand Down Expand Up @@ -276,7 +274,7 @@ export class PerformanceDemo extends PostProcessingDemo {
// Sun

const sunMaterial = new MeshBasicMaterial({
color: 0xffddaa,
color: pointLight.color,
transparent: true,
fog: false
});
Expand Down Expand Up @@ -328,16 +326,16 @@ export class PerformanceDemo extends PostProcessingDemo {

const scanlineEffect = new ScanlineEffect({
blendFunction: BlendFunction.OVERLAY,
density: 1.04
density: 0.75
});

const textureEffect = new TextureEffect({
blendFunction: BlendFunction.REFLECT,
blendFunction: BlendFunction.COLOR_DODGE,
texture: assets.get("scratches-color")
});

const colorAverageEffect = new ColorAverageEffect(BlendFunction.COLOR_DODGE);
const colorDepthEffect = new ColorDepthEffect({ bits: 56 });
const colorDepthEffect = new ColorDepthEffect({ bits: 24 });
const sepiaEffect = new SepiaEffect({ blendFunction: BlendFunction.NORMAL });

const brightnessContrastEffect = new BrightnessContrastEffect({ contrast: 0.0 });
Expand All @@ -347,37 +345,33 @@ export class PerformanceDemo extends PostProcessingDemo {
const vignetteEffect = new VignetteEffect();

const lut = LookupTexture3D.createNeutral(8);
const lutEffect = capabilities.isWebGL2 ? new LUTEffect(lut) :
const lutEffect = capabilities.isWebGL2 ?
new LUTEffect(lut.convertToUint8()) :
new LUTEffect(lut.convertToUint8().toDataTexture());

const toneMappingEffect = new ToneMappingEffect({
mode: ToneMappingMode.REINHARD2_ADAPTIVE
});

colorAverageEffect.blendMode.opacity.value = 0.01;
sepiaEffect.blendMode.opacity.value = 0.01;
dotScreenEffect.blendMode.opacity.value = 0.01;
gridEffect.blendMode.opacity.value = 0.01;
scanlineEffect.blendMode.opacity.value = 0.01;
textureEffect.blendMode.opacity.value = 0.8;
scanlineEffect.blendMode.opacity.value = 0.05;
textureEffect.blendMode.opacity.value = 1.0;
noiseEffect.blendMode.opacity.value = 0.25;

const effects = [
smaaEffect,
bloomEffect,
godRaysEffect,
colorAverageEffect,
colorDepthEffect,
colorAverageEffect,
dotScreenEffect,
gridEffect,
scanlineEffect,
brightnessContrastEffect,
hueSaturationEffect,
sepiaEffect,
vignetteEffect,
textureEffect,
noiseEffect,
vignetteEffect,
toneMappingEffect,
lutEffect
];

Expand Down
102 changes: 49 additions & 53 deletions esbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,89 +1,85 @@
import { createRequire } from "module";
import { hideBin } from "yargs/helpers";
import { glsl } from "esbuild-plugin-glsl";
import esbuild from "esbuild";
import yargs from "yargs";

const require = createRequire(import.meta.url);
const pkg = require("./package");
const date = (new Date()).toDateString();
const production = (process.env.NODE_ENV === "production");
const globalName = pkg.name.replace(/-/g, "").toUpperCase();
const external = Object.keys(pkg.peerDependencies);
const { argv } = yargs(hideBin(process.argv))
.option("watch", { alias: "w", type: "boolean" });

const external = Object.keys(pkg.peerDependencies || {});
const minify = (process.env.NODE_ENV === "production");
const watch = process.argv.includes("-w");
const plugins = [glsl({ minify })];
const banner = `/**
* ${pkg.name} v${pkg.version} build ${date}
* ${pkg.homepage}
* Copyright ${date.slice(-4)} ${pkg.author.name}
* @license ${pkg.license}
*/`;

// @todo Remove in next major release.
const requireShim = `if(typeof window === "object"&&!window.require)window.require=()=>window.THREE;`;
const footer = `if(typeof module==="object"&&module.exports)module.exports=${globalName};`;

const common = {
bundle: true,
await esbuild.build({
entryPoints: [
"src/images/lut/worker.js",
"src/images/smaa/worker.js"
],
outExtension: { ".js": ".txt" },
outdir: "tmp",
logLevel: "info",
plugins: [glsl({ minify: production })],
loader: {
".worker": "text",
".png": "dataurl"
}
};

const workers = [{
entryPoints: ["src/images/lut/worker.js"],
outfile: "tmp/lut.worker",
format: "iife",
minify: production,
watch: argv.watch
}, {
entryPoints: ["src/images/smaa/worker.js"],
outfile: "tmp/smaa.worker",
format: "iife",
minify: production,
watch: argv.watch
}];
bundle: true,
minify,
watch
}).catch(() => process.exit(1));

const demo = [{
await esbuild.build({
entryPoints: ["demo/src/index.js"],
outfile: "public/demo/index.js",
outdir: "public/demo",
logLevel: "info",
format: "iife",
minify: production,
watch: argv.watch
}];
bundle: true,
plugins,
minify,
watch
}).catch(() => process.exit(1));

const lib = [{
await esbuild.build({
entryPoints: ["src/index.js"],
outfile: `build/${pkg.name}.esm.js`,
banner: { js: banner },
logLevel: "info",
format: "esm",
external
}, {
bundle: true,
external,
plugins
}).catch(() => process.exit(1));

// @todo Remove in next major release.
const globalName = pkg.name.replace(/-/g, "").toUpperCase();
const requireShim = `if(typeof window==="object"&&!window.require)window.require=()=>window.THREE;`;
const footer = `if(typeof module==="object"&&module.exports)module.exports=${globalName};`;

await esbuild.build({
entryPoints: ["src/index.js"],
outfile: `build/${pkg.name}.js`,
banner: { js: `${banner}\n${requireShim}` },
footer: { js: footer },
logLevel: "info",
format: "iife",
bundle: true,
globalName,
external
}, {
external,
plugins
}).catch(() => process.exit(1));

await esbuild.build({
entryPoints: ["src/index.js"],
outfile: `build/${pkg.name}.min.js`,
banner: { js: `${banner}\n${requireShim}` },
footer: { js: footer },
logLevel: "info",
format: "iife",
minify: true,
bundle: true,
globalName,
external
}];

for(const configs of [workers, demo, lib]) {

const promises = configs.map(c => esbuild.build(Object.assign(c, common)));
await Promise.all(promises);

}
external,
plugins,
minify
}).catch(() => process.exit(1));
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postprocessing",
"version": "6.21.2",
"version": "6.21.3",
"description": "A post processing library that provides the means to implement image filter effects for three.js.",
"homepage": "https://github.com/vanruesc/postprocessing",
"main": "build/postprocessing.js",
Expand Down Expand Up @@ -71,7 +71,7 @@
"extends": "aether"
},
"peerDependencies": {
"three": ">= 0.102.0 < 0.127.0"
"three": ">= 0.102.0 < 0.128.0"
},
"devDependencies": {
"@types/three": "0.x.x",
Expand All @@ -92,10 +92,9 @@
"http-server": "0.x.x",
"npm-run-all": "4.x.x",
"spatial-controls": "4.x.x",
"three": "0.x.x",
"three": "0.126.x",
"three-demo": "5.x.x",
"tslib": "2.x.x",
"typescript": "4.x.x",
"yargs": "16.x.x"
"typescript": "4.x.x"
}
}
Loading

0 comments on commit d04698a

Please sign in to comment.