@anov/3d-ability 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/camera/index.d.ts +11 -7
- package/dist/camera/index.js +48 -45
- package/dist/camera/index.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/poi/2D/index.d.ts +1 -0
- package/dist/poi/2D/index.js +10 -0
- package/dist/poi/2D/index.js.map +1 -1
- package/dist/poi/3D/index.d.ts +12 -18
- package/dist/poi/3D/index.js +159 -123
- package/dist/poi/3D/index.js.map +1 -1
- package/dist/poi/3D/index1.d.ts +19 -0
- package/dist/poi/3D/index1.js +144 -0
- package/dist/poi/3D/index1.js.map +1 -0
- package/dist/poi/Sprite/index.js +44 -51
- package/dist/poi/Sprite/index.js.map +1 -1
- package/dist/poi/index.d.ts +2 -1
- package/dist/poi/index.js +2 -1
- package/dist/poi/index.js.map +1 -1
- package/dist/poi/utils/type.d.ts +4 -4
- package/dist/poi/utils/type.js +2 -1
- package/dist/poi/utils/type.js.map +1 -1
- package/dist/postEffects/addACESFilmicToneMappingPass.d.ts +4 -0
- package/dist/postEffects/addACESFilmicToneMappingPass.js +28 -0
- package/dist/postEffects/addACESFilmicToneMappingPass.js.map +1 -0
- package/dist/postEffects/addBrightnessContrastPass.d.ts +4 -0
- package/dist/postEffects/addBrightnessContrastPass.js +28 -0
- package/dist/postEffects/addBrightnessContrastPass.js.map +1 -0
- package/dist/postEffects/bloomPass.d.ts +2 -2
- package/dist/postEffects/bloomPass.js +14 -19
- package/dist/postEffects/bloomPass.js.map +1 -1
- package/dist/postEffects/colorifyPass.d.ts +6 -0
- package/dist/postEffects/colorifyPass.js +33 -0
- package/dist/postEffects/colorifyPass.js.map +1 -0
- package/dist/postEffects/index.d.ts +7 -1
- package/dist/postEffects/index.js +16 -5
- package/dist/postEffects/index.js.map +1 -1
- package/dist/postEffects/shader/colorify.d.ts +17 -0
- package/dist/postEffects/shader/colorify.js +19 -0
- package/dist/postEffects/shader/colorify.js.map +1 -0
- package/dist/postEffects/shader/gammaCorrectionShader.d.ts +15 -0
- package/dist/postEffects/shader/gammaCorrectionShader.js +18 -0
- package/dist/postEffects/shader/gammaCorrectionShader.js.map +1 -0
- package/dist/postEffects/shader/mapping.d.ts +19 -0
- package/dist/postEffects/shader/mapping.js +22 -0
- package/dist/postEffects/shader/mapping.js.map +1 -0
- package/dist/postEffects/shader/thermalMaging.d.ts +17 -0
- package/dist/postEffects/shader/thermalMaging.js +18 -0
- package/dist/postEffects/shader/thermalMaging.js.map +1 -0
- package/package.json +3 -3
|
@@ -2,7 +2,9 @@ import { lib, use, utils } from '@anov/3d-core';
|
|
|
2
2
|
var EffectComposer = lib.EffectComposer,
|
|
3
3
|
RenderPass = lib.RenderPass;
|
|
4
4
|
var storeManagement = utils.storeManagement;
|
|
5
|
-
var
|
|
5
|
+
var useSubComposerFrame = use.useSubComposerFrame,
|
|
6
|
+
useComposerFrame = use.useComposerFrame;
|
|
7
|
+
var clean;
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* init post effects
|
|
@@ -13,21 +15,30 @@ var useframe = use.useframe;
|
|
|
13
15
|
* @param afterhooks composer render after hook
|
|
14
16
|
* @returns
|
|
15
17
|
*/
|
|
16
|
-
export var initPostEffects = function initPostEffects(scene, renderer, camera,
|
|
18
|
+
export var initPostEffects = function initPostEffects(scene, renderer, camera, options) {
|
|
17
19
|
var composer = new EffectComposer(renderer);
|
|
18
20
|
var renderPass = new RenderPass(scene, camera);
|
|
21
|
+
var _ref = options || {
|
|
22
|
+
type: 'main'
|
|
23
|
+
},
|
|
24
|
+
type = _ref.type,
|
|
25
|
+
beforehooks = _ref.beforehooks,
|
|
26
|
+
afterhooks = _ref.afterhooks;
|
|
27
|
+
var func = type === 'main' ? useComposerFrame : useSubComposerFrame;
|
|
28
|
+
clean && clean();
|
|
19
29
|
storeManagement.set('composer', composer);
|
|
20
|
-
composer.addPass(renderPass);
|
|
21
30
|
storeManagement.set('renderPass', renderPass);
|
|
22
|
-
|
|
31
|
+
composer.addPass(renderPass);
|
|
32
|
+
var cleanEffectsframe = func(function () {
|
|
23
33
|
beforehooks && beforehooks();
|
|
24
34
|
composer.render();
|
|
25
35
|
afterhooks && afterhooks();
|
|
26
36
|
});
|
|
27
|
-
|
|
37
|
+
clean = function clean() {
|
|
28
38
|
storeManagement.delete('composer');
|
|
29
39
|
storeManagement.delete('renderPass');
|
|
30
40
|
cleanEffectsframe();
|
|
31
41
|
};
|
|
42
|
+
return clean;
|
|
32
43
|
};
|
|
33
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["lib","use","utils","EffectComposer","RenderPass","storeManagement","
|
|
1
|
+
{"version":3,"names":["lib","use","utils","EffectComposer","RenderPass","storeManagement","useSubComposerFrame","useComposerFrame","clean","initPostEffects","scene","renderer","camera","options","composer","renderPass","type","beforehooks","afterhooks","func","set","addPass","cleanEffectsframe","render","delete"],"sources":["../../src/postEffects/index.ts"],"sourcesContent":["import type { Camera, Scene, WebGLRenderer } from '@anov/3d-core'\nimport { lib, use, utils } from '@anov/3d-core'\n\nconst { EffectComposer, RenderPass } = lib\nconst { storeManagement } = utils\nconst { useSubComposerFrame, useComposerFrame } = use\n\ntype InitPostEffectsOptions = {\n type: 'main' | 'sub'\n beforehooks?: () => void\n afterhooks?: () => void\n}\n\nlet clean: () => void\n\n/**\n * init post effects\n * @param scene\n * @param renderer\n * @param camera\n * @param beforehooks composer render before hook\n * @param afterhooks composer render after hook\n * @returns\n */\nexport const initPostEffects = (scene: Scene, renderer: WebGLRenderer, camera: Camera, options?: InitPostEffectsOptions) => {\n const composer = new EffectComposer(renderer)\n const renderPass = new RenderPass(scene, camera)\n\n const { type, beforehooks, afterhooks } = options || { type: 'main' }\n const func = type === 'main' ? useComposerFrame : useSubComposerFrame\n\n clean && clean()\n\n storeManagement.set('composer', composer)\n storeManagement.set('renderPass', renderPass)\n\n composer.addPass(renderPass)\n\n const cleanEffectsframe = func (() => {\n beforehooks && beforehooks()\n composer.render()\n afterhooks && afterhooks()\n })\n\n clean = () => {\n storeManagement.delete('composer')\n storeManagement.delete('renderPass')\n\n cleanEffectsframe()\n }\n\n return clean\n}"],"mappings":"AACA,SAASA,GAAG,EAAEC,GAAG,EAAEC,KAAK,QAAQ,eAAe;AAE/C,IAAQC,cAAc,GAAiBH,GAAG,CAAlCG,cAAc;EAAEC,UAAU,GAAKJ,GAAG,CAAlBI,UAAU;AAClC,IAAQC,eAAe,GAAKH,KAAK,CAAzBG,eAAe;AACvB,IAAQC,mBAAmB,GAAuBL,GAAG,CAA7CK,mBAAmB;EAAEC,gBAAgB,GAAKN,GAAG,CAAxBM,gBAAgB;AAQ7C,IAAIC,KAAiB;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,eAAe,GAAG,SAAlBA,eAAe,CAAIC,KAAY,EAAEC,QAAuB,EAAEC,MAAc,EAAEC,OAAgC,EAAK;EAC1H,IAAMC,QAAQ,GAAG,IAAIX,cAAc,CAACQ,QAAQ,CAAC;EAC7C,IAAMI,UAAU,GAAG,IAAIX,UAAU,CAACM,KAAK,EAAEE,MAAM,CAAC;EAEhD,WAA0CC,OAAO,IAAI;MAAEG,IAAI,EAAE;IAAO,CAAC;IAA7DA,IAAI,QAAJA,IAAI;IAAEC,WAAW,QAAXA,WAAW;IAAEC,UAAU,QAAVA,UAAU;EACrC,IAAMC,IAAI,GAAGH,IAAI,KAAK,MAAM,GAAGT,gBAAgB,GAAGD,mBAAmB;EAErEE,KAAK,IAAIA,KAAK,EAAE;EAEhBH,eAAe,CAACe,GAAG,CAAC,UAAU,EAAEN,QAAQ,CAAC;EACzCT,eAAe,CAACe,GAAG,CAAC,YAAY,EAAEL,UAAU,CAAC;EAE7CD,QAAQ,CAACO,OAAO,CAACN,UAAU,CAAC;EAE5B,IAAMO,iBAAiB,GAAGH,IAAI,CAAE,YAAM;IACpCF,WAAW,IAAIA,WAAW,EAAE;IAC5BH,QAAQ,CAACS,MAAM,EAAE;IACjBL,UAAU,IAAIA,UAAU,EAAE;EAC5B,CAAC,CAAC;EAEFV,KAAK,GAAG,iBAAM;IACZH,eAAe,CAACmB,MAAM,CAAC,UAAU,CAAC;IAClCnB,eAAe,CAACmB,MAAM,CAAC,YAAY,CAAC;IAEpCF,iBAAiB,EAAE;EACrB,CAAC;EAED,OAAOd,KAAK;AACd,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Color } from '@anov/3d-core';
|
|
2
|
+
declare const ColorifyShader: {
|
|
3
|
+
uniforms: {
|
|
4
|
+
tDiffuse: {
|
|
5
|
+
value: null;
|
|
6
|
+
};
|
|
7
|
+
color: {
|
|
8
|
+
value: Color;
|
|
9
|
+
};
|
|
10
|
+
alpha: {
|
|
11
|
+
value: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
vertexShader: string;
|
|
15
|
+
fragmentShader: string;
|
|
16
|
+
};
|
|
17
|
+
export default ColorifyShader;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* eslint-disable no-tabs */
|
|
2
|
+
import { Color } from '@anov/3d-core';
|
|
3
|
+
var ColorifyShader = {
|
|
4
|
+
uniforms: {
|
|
5
|
+
tDiffuse: {
|
|
6
|
+
value: null
|
|
7
|
+
},
|
|
8
|
+
color: {
|
|
9
|
+
value: new Color(0xFFFFFF)
|
|
10
|
+
},
|
|
11
|
+
alpha: {
|
|
12
|
+
value: 1.0
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
vertexShader: /* glsl */"\n\t varying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",
|
|
16
|
+
fragmentShader: /* glsl */"\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n uniform float alpha;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\t\t\tfloat v = dot( texel.xyz, luma );\n\t\t\tgl_FragColor = vec4( v * color, texel.w );\n gl_FragColor = mix( texel, gl_FragColor, alpha );\n\n\t\t}"
|
|
17
|
+
};
|
|
18
|
+
export default ColorifyShader;
|
|
19
|
+
//# sourceMappingURL=colorify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Color","ColorifyShader","uniforms","tDiffuse","value","color","alpha","vertexShader","fragmentShader"],"sources":["../../../src/postEffects/shader/colorify.ts"],"sourcesContent":["/* eslint-disable no-tabs */\nimport { Color } from '@anov/3d-core'\n\nconst ColorifyShader = {\n uniforms: {\n tDiffuse: { value: null },\n color: { value: new Color(0xFFFFFF) },\n alpha: { value: 1.0 },\n\n },\n\n vertexShader: /* glsl */`\n\t varying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}`,\n\n fragmentShader: /* glsl */`\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n uniform float alpha;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\t\t\tfloat v = dot( texel.xyz, luma );\n\t\t\tgl_FragColor = vec4( v * color, texel.w );\n gl_FragColor = mix( texel, gl_FragColor, alpha );\n\n\t\t}`,\n}\n\nexport default ColorifyShader"],"mappings":"AAAA;AACA,SAASA,KAAK,QAAQ,eAAe;AAErC,IAAMC,cAAc,GAAG;EACrBC,QAAQ,EAAE;IACRC,QAAQ,EAAE;MAAEC,KAAK,EAAE;IAAK,CAAC;IACzBC,KAAK,EAAE;MAAED,KAAK,EAAE,IAAIJ,KAAK,CAAC,QAAQ;IAAE,CAAC;IACrCM,KAAK,EAAE;MAAEF,KAAK,EAAE;IAAI;EAEtB,CAAC;EAEDG,YAAY,EAAE,iKAKZ;EAEFC,cAAc,EAAE;AAelB,CAAC;AAED,eAAeP,cAAc"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gamma Correction Shader
|
|
3
|
+
* http://en.wikipedia.org/wiki/gamma_correction
|
|
4
|
+
*/
|
|
5
|
+
declare const GammaCorrectionShader: {
|
|
6
|
+
name: string;
|
|
7
|
+
uniforms: {
|
|
8
|
+
tDiffuse: {
|
|
9
|
+
value: null;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
vertexShader: string;
|
|
13
|
+
fragmentShader: string;
|
|
14
|
+
};
|
|
15
|
+
export default GammaCorrectionShader;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable no-tabs */
|
|
2
|
+
/**
|
|
3
|
+
* Gamma Correction Shader
|
|
4
|
+
* http://en.wikipedia.org/wiki/gamma_correction
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var GammaCorrectionShader = {
|
|
8
|
+
name: 'GammaCorrectionShader',
|
|
9
|
+
uniforms: {
|
|
10
|
+
tDiffuse: {
|
|
11
|
+
value: null
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
vertexShader: /* glsl */"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",
|
|
15
|
+
fragmentShader: /* glsl */"\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n vec4 sRGBTransferOETF1( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.03 - vec3( 0.03 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n }\n\t\tvoid main() {\n\n\t\t\tvec4 tex = texture2D( tDiffuse, vUv );\n\n\t\t\tgl_FragColor = sRGBTransferOETF1( tex );\n\n\t\t}"
|
|
16
|
+
};
|
|
17
|
+
export default GammaCorrectionShader;
|
|
18
|
+
//# sourceMappingURL=gammaCorrectionShader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["GammaCorrectionShader","name","uniforms","tDiffuse","value","vertexShader","fragmentShader"],"sources":["../../../src/postEffects/shader/gammaCorrectionShader.ts"],"sourcesContent":["/* eslint-disable no-tabs */\n/**\n * Gamma Correction Shader\n * http://en.wikipedia.org/wiki/gamma_correction\n */\n\nconst GammaCorrectionShader = {\n\n name: 'GammaCorrectionShader',\n\n uniforms: {\n\n tDiffuse: { value: null },\n\n },\n\n vertexShader: /* glsl */`\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}`,\n\n fragmentShader: /* glsl */`\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n vec4 sRGBTransferOETF1( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.03 - vec3( 0.03 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n }\n\t\tvoid main() {\n\n\t\t\tvec4 tex = texture2D( tDiffuse, vUv );\n\n\t\t\tgl_FragColor = sRGBTransferOETF1( tex );\n\n\t\t}`,\n\n}\n\nexport default GammaCorrectionShader\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,IAAMA,qBAAqB,GAAG;EAE5BC,IAAI,EAAE,uBAAuB;EAE7BC,QAAQ,EAAE;IAERC,QAAQ,EAAE;MAAEC,KAAK,EAAE;IAAK;EAE1B,CAAC;EAEDC,YAAY,EAAE,uKASZ;EAEFC,cAAc,EAAE;AAiBlB,CAAC;AAED,eAAeN,qBAAqB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* ACES Filmic Tone Mapping Shader by Stephen Hill
|
|
4
|
+
* source: https://github.com/mrdoob/three.js/blob/3bffaf229d9646a61b9c7087d255c2360d1d2856/examples/jsm/shaders/ACESFilmicToneMappingShader.js
|
|
5
|
+
*/
|
|
6
|
+
declare const ACESFilmicToneMappingShader: {
|
|
7
|
+
name: string;
|
|
8
|
+
uniforms: {
|
|
9
|
+
tDiffuse: {
|
|
10
|
+
value: null;
|
|
11
|
+
};
|
|
12
|
+
exposure: {
|
|
13
|
+
value: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
vertexShader: string;
|
|
17
|
+
fragmentShader: string;
|
|
18
|
+
};
|
|
19
|
+
export default ACESFilmicToneMappingShader;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* ACES Filmic Tone Mapping Shader by Stephen Hill
|
|
4
|
+
* source: https://github.com/mrdoob/three.js/blob/3bffaf229d9646a61b9c7087d255c2360d1d2856/examples/jsm/shaders/ACESFilmicToneMappingShader.js
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* eslint-disable no-tabs */
|
|
8
|
+
var ACESFilmicToneMappingShader = {
|
|
9
|
+
name: 'ACESFilmicToneMappingShader',
|
|
10
|
+
uniforms: {
|
|
11
|
+
tDiffuse: {
|
|
12
|
+
value: null
|
|
13
|
+
},
|
|
14
|
+
exposure: {
|
|
15
|
+
value: 1.0
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
vertexShader: /* glsl */"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",
|
|
19
|
+
fragmentShader: /* glsl */"\n\n\t\t#define saturate(a) clamp( a, 0.0, 1.0 )\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tuniform float exposure;\n\n\t\tvarying vec2 vUv;\n\n\t\t// vec3 RRTAndODTFit( vec3 v ) {\n\n\t\t// \tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\t\t// \tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\t\t// \treturn a / b;\n\n\t\t// }\n\n\t\t// vec3 ACESFilmicToneMapping( vec3 color ) {\n\n\t\t// // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT\n\t\t// \tconst mat3 ACESInputMat = mat3(\n\t\t// \t\tvec3( 0.59719, 0.07600, 0.02840 ), // transposed from source\n\t\t// \t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\t// \t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t\t// \t);\n\n\t\t// // ODT_SAT => XYZ => D60_2_D65 => sRGB\n\t\t// \tconst mat3 ACESOutputMat = mat3(\n\t\t// \t\tvec3( 1.60475, -0.10208, -0.00327 ), // transposed from source\n\t\t// \t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\t// \t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t\t// \t);\n\n\t\t// \tcolor = ACESInputMat * color;\n\n\t\t// // Apply RRT and ODT\n\t\t// \tcolor = RRTAndODTFit( color );\n\n\t\t// \tcolor = ACESOutputMat * color;\n\n\t\t// // Clamp to [0, 1]\n\t\t// \treturn saturate( color );\n\n\t\t// }\n\n\t\tvoid main() {\n\n\t\t\tvec4 tex = texture2D( tDiffuse, vUv );\n\n\t\t\ttex.rgb *= exposure / 0.6; // pre-exposed, outside of the tone mapping function\n\n\t\t\tgl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );\n\n\t\t}"
|
|
20
|
+
};
|
|
21
|
+
export default ACESFilmicToneMappingShader;
|
|
22
|
+
//# sourceMappingURL=mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ACESFilmicToneMappingShader","name","uniforms","tDiffuse","value","exposure","vertexShader","fragmentShader"],"sources":["../../../src/postEffects/shader/mapping.ts"],"sourcesContent":["/**\n *\n * ACES Filmic Tone Mapping Shader by Stephen Hill\n * source: https://github.com/mrdoob/three.js/blob/3bffaf229d9646a61b9c7087d255c2360d1d2856/examples/jsm/shaders/ACESFilmicToneMappingShader.js\n */\n\n/* eslint-disable no-tabs */\nconst ACESFilmicToneMappingShader = {\n\n name: 'ACESFilmicToneMappingShader',\n\n uniforms: {\n\n tDiffuse: { value: null },\n exposure: { value: 1.0 },\n\n },\n\n vertexShader: /* glsl */`\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}`,\n\n fragmentShader: /* glsl */`\n\n\t\t#define saturate(a) clamp( a, 0.0, 1.0 )\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tuniform float exposure;\n\n\t\tvarying vec2 vUv;\n\n\t\t// vec3 RRTAndODTFit( vec3 v ) {\n\n\t\t// \tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\t\t// \tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\t\t// \treturn a / b;\n\n\t\t// }\n\n\t\t// vec3 ACESFilmicToneMapping( vec3 color ) {\n\n\t\t// // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT\n\t\t// \tconst mat3 ACESInputMat = mat3(\n\t\t// \t\tvec3( 0.59719, 0.07600, 0.02840 ), // transposed from source\n\t\t// \t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\t// \t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t\t// \t);\n\n\t\t// // ODT_SAT => XYZ => D60_2_D65 => sRGB\n\t\t// \tconst mat3 ACESOutputMat = mat3(\n\t\t// \t\tvec3( 1.60475, -0.10208, -0.00327 ), // transposed from source\n\t\t// \t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\t// \t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t\t// \t);\n\n\t\t// \tcolor = ACESInputMat * color;\n\n\t\t// // Apply RRT and ODT\n\t\t// \tcolor = RRTAndODTFit( color );\n\n\t\t// \tcolor = ACESOutputMat * color;\n\n\t\t// // Clamp to [0, 1]\n\t\t// \treturn saturate( color );\n\n\t\t// }\n\n\t\tvoid main() {\n\n\t\t\tvec4 tex = texture2D( tDiffuse, vUv );\n\n\t\t\ttex.rgb *= exposure / 0.6; // pre-exposed, outside of the tone mapping function\n\n\t\t\tgl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );\n\n\t\t}`,\n\n}\n\nexport default ACESFilmicToneMappingShader"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAMA,2BAA2B,GAAG;EAElCC,IAAI,EAAE,6BAA6B;EAEnCC,QAAQ,EAAE;IAERC,QAAQ,EAAE;MAAEC,KAAK,EAAE;IAAK,CAAC;IACzBC,QAAQ,EAAE;MAAED,KAAK,EAAE;IAAI;EAEzB,CAAC;EAEDE,YAAY,EAAE,uKASZ;EAEFC,cAAc,EAAE;AAwDlB,CAAC;AAED,eAAeP,2BAA2B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Vector2, Vector3 } from '@anov/3d-core';
|
|
2
|
+
declare const thermalMagingShader: {
|
|
3
|
+
uniforms: {
|
|
4
|
+
tDiffuse: {
|
|
5
|
+
value: null;
|
|
6
|
+
};
|
|
7
|
+
iResolution: {
|
|
8
|
+
value: Vector2;
|
|
9
|
+
};
|
|
10
|
+
colorLevels: {
|
|
11
|
+
value: Vector3[];
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
vertexShader: string;
|
|
15
|
+
fragmentShader: string;
|
|
16
|
+
};
|
|
17
|
+
export default thermalMagingShader;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Vector2, Vector3 } from '@anov/3d-core';
|
|
2
|
+
var thermalMagingShader = {
|
|
3
|
+
uniforms: {
|
|
4
|
+
tDiffuse: {
|
|
5
|
+
value: null
|
|
6
|
+
},
|
|
7
|
+
iResolution: {
|
|
8
|
+
value: new Vector2(1, 1)
|
|
9
|
+
},
|
|
10
|
+
colorLevels: {
|
|
11
|
+
value: [new Vector3(234.0, 51.0, 61.0), new Vector3(235.0, 70.0, 105.0), new Vector3(178.0, 119.0, 37.0), new Vector3(247.0, 206.0, 70.0), new Vector3(149.0, 232.0, 71.0), new Vector3(103.0, 200.0, 250.0), new Vector3(68.0, 132.0, 245.0), new Vector3(40.0, 3.0, 143.0), new Vector3(18.0, 5.0, 62.0)]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
vertexShader: /* glsl */"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",
|
|
15
|
+
fragmentShader: /* glsl */"\n uniform sampler2D tDiffuse;\n uniform vec3 colorLevels[9];\n varying vec2 vUv;\n\n void main() {\n vec4 color = texture2D(tDiffuse, vUv);\n\n color.rgb += vec3(1.0, 0.0, 0.5) * color.rgb * 0.2;\n\n float lum = dot(color.rgb, vec3(0.3, 0.59, 0.11));\n lum = 1.0 - lum;\n\n float d = 1.0 / 9.0;\n int i = int(lum / d);\n i = clamp(i, 0, 8);\n\n gl_FragColor = vec4(colorLevels[i] / 255.0, 1.0);\n }\n "
|
|
16
|
+
};
|
|
17
|
+
export default thermalMagingShader;
|
|
18
|
+
//# sourceMappingURL=thermalMaging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Vector2","Vector3","thermalMagingShader","uniforms","tDiffuse","value","iResolution","colorLevels","vertexShader","fragmentShader"],"sources":["../../../src/postEffects/shader/thermalMaging.ts"],"sourcesContent":["import { Vector2, Vector3 } from '@anov/3d-core'\n\nconst thermalMagingShader = {\n uniforms: {\n tDiffuse: { value: null },\n iResolution: { value: new Vector2(1, 1) },\n colorLevels: { value: [new Vector3(234.0, 51.0, 61.0), new Vector3(235.0, 70.0, 105.0), new Vector3(178.0, 119.0, 37.0), new Vector3(247.0, 206.0, 70.0), new Vector3(149.0, 232.0, 71.0), new Vector3(103.0, 200.0, 250.0), new Vector3(68.0, 132.0, 245.0), new Vector3(40.0, 3.0, 143.0), new Vector3(18.0, 5.0, 62.0)] },\n },\n vertexShader: /* glsl */`\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n `,\n fragmentShader: /* glsl */`\n uniform sampler2D tDiffuse;\n uniform vec3 colorLevels[9];\n varying vec2 vUv;\n\n void main() {\n vec4 color = texture2D(tDiffuse, vUv);\n\n color.rgb += vec3(1.0, 0.0, 0.5) * color.rgb * 0.2;\n\n float lum = dot(color.rgb, vec3(0.3, 0.59, 0.11));\n lum = 1.0 - lum;\n\n float d = 1.0 / 9.0;\n int i = int(lum / d);\n i = clamp(i, 0, 8);\n\n gl_FragColor = vec4(colorLevels[i] / 255.0, 1.0);\n }\n `,\n}\n\nexport default thermalMagingShader\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,OAAO,QAAQ,eAAe;AAEhD,IAAMC,mBAAmB,GAAG;EAC1BC,QAAQ,EAAE;IACRC,QAAQ,EAAE;MAAEC,KAAK,EAAE;IAAK,CAAC;IACzBC,WAAW,EAAE;MAAED,KAAK,EAAE,IAAIL,OAAO,CAAC,CAAC,EAAE,CAAC;IAAE,CAAC;IACzCO,WAAW,EAAE;MAAEF,KAAK,EAAE,CAAC,IAAIJ,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAIA,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,IAAIA,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAIA,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAIA,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAIA,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,IAAIA,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,IAAIA,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,IAAIA,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC;IAAE;EAC7T,CAAC;EACDO,YAAY,EAAE,2LAMX;EACHC,cAAc,EAAE;AAoBlB,CAAC;AAED,eAAeP,mBAAmB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anov/3d-ability",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"suncalc": "^1.9.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@anov/3d-core": "^0.0.
|
|
26
|
+
"@anov/3d-core": "^0.0.7"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@anov/3d-core": "^0.0.
|
|
29
|
+
"@anov/3d-core": "^0.0.7"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "father build",
|