viral-viewer-2 6.2.8 → 6.3.0

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.
Files changed (154) hide show
  1. package/dist/components/loader/viral-revit.loader.js +8 -3
  2. package/dist/components/loader/viral-revit.loader.js.map +1 -1
  3. package/dist/index.mjs +41153 -0
  4. package/package.json +1 -1
  5. package/dist/components/centralized-event-handler/viral-centralized-event-handler.d.ts +0 -7
  6. package/dist/components/centralized-event-handler/viral-centralized-event-handler.js +0 -47
  7. package/dist/components/centralized-event-handler/viral-centralized-event-handler.js.map +0 -1
  8. package/dist/components/compress/compress.processor.d.ts +0 -4
  9. package/dist/components/compress/compress.processor.js +0 -29
  10. package/dist/components/compress/compress.processor.js.map +0 -1
  11. package/dist/components/context-menu/viral-context-menu.d.ts +0 -17
  12. package/dist/components/context-menu/viral-context-menu.js +0 -74
  13. package/dist/components/context-menu/viral-context-menu.js.map +0 -1
  14. package/dist/components/keyboard/viral-keyboard.d.ts +0 -17
  15. package/dist/components/keyboard/viral-keyboard.js +0 -76
  16. package/dist/components/keyboard/viral-keyboard.js.map +0 -1
  17. package/dist/components/loader/viral-viewer-point-cloud.loader.d.ts +0 -16
  18. package/dist/components/loader/viral-viewer-point-cloud.loader.js +0 -33
  19. package/dist/components/loader/viral-viewer-point-cloud.loader.js.map +0 -1
  20. package/dist/components/loader/viral-viewer-revit.loader.d.ts +0 -13
  21. package/dist/components/loader/viral-viewer-revit.loader.js +0 -124
  22. package/dist/components/loader/viral-viewer-revit.loader.js.map +0 -1
  23. package/dist/components/mouse/viral-mouse.d.ts +0 -31
  24. package/dist/components/mouse/viral-mouse.js +0 -234
  25. package/dist/components/mouse/viral-mouse.js.map +0 -1
  26. package/dist/components/navigation-cube/components/cube-camera.d.ts +0 -15
  27. package/dist/components/navigation-cube/components/cube-camera.js +0 -74
  28. package/dist/components/navigation-cube/components/cube-camera.js.map +0 -1
  29. package/dist/components/navigation-cube/components/cube-renderer.d.ts +0 -9
  30. package/dist/components/navigation-cube/components/cube-renderer.js +0 -31
  31. package/dist/components/navigation-cube/components/cube-renderer.js.map +0 -1
  32. package/dist/components/navigation-cube/components/cube-scene.d.ts +0 -13
  33. package/dist/components/navigation-cube/components/cube-scene.js +0 -546
  34. package/dist/components/navigation-cube/components/cube-scene.js.map +0 -1
  35. package/dist/components/navigation-cube/components/cube.mouse.d.ts +0 -9
  36. package/dist/components/navigation-cube/components/cube.mouse.js +0 -109
  37. package/dist/components/navigation-cube/components/cube.mouse.js.map +0 -1
  38. package/dist/components/navigation-cube/viral-navigation-cube.d.ts +0 -16
  39. package/dist/components/navigation-cube/viral-navigation-cube.js +0 -50
  40. package/dist/components/navigation-cube/viral-navigation-cube.js.map +0 -1
  41. package/dist/components/post-processing/ambient-occlusion-effect.d.ts +0 -13
  42. package/dist/components/post-processing/ambient-occlusion-effect.js +0 -33
  43. package/dist/components/post-processing/ambient-occlusion-effect.js.map +0 -1
  44. package/dist/components/post-processing/bloom-effect.d.ts +0 -11
  45. package/dist/components/post-processing/bloom-effect.js +0 -29
  46. package/dist/components/post-processing/bloom-effect.js.map +0 -1
  47. package/dist/components/post-processing/outline-effect.d.ts +0 -13
  48. package/dist/components/post-processing/outline-effect.js +0 -33
  49. package/dist/components/post-processing/outline-effect.js.map +0 -1
  50. package/dist/components/spinner/viral-spinner.d.ts +0 -10
  51. package/dist/components/spinner/viral-spinner.js +0 -207
  52. package/dist/components/spinner/viral-spinner.js.map +0 -1
  53. package/dist/components/tools/tools/viral-tool-ambient-occlusion.d.ts +0 -7
  54. package/dist/components/tools/tools/viral-tool-ambient-occlusion.js +0 -16
  55. package/dist/components/tools/tools/viral-tool-ambient-occlusion.js.map +0 -1
  56. package/dist/components/tools/tools/viral-tool-dark-mode.d.ts +0 -7
  57. package/dist/components/tools/tools/viral-tool-dark-mode.js +0 -21
  58. package/dist/components/tools/tools/viral-tool-dark-mode.js.map +0 -1
  59. package/dist/components/tools/tools/viral-tool-elevation.d.ts +0 -11
  60. package/dist/components/tools/tools/viral-tool-elevation.js +0 -30
  61. package/dist/components/tools/tools/viral-tool-elevation.js.map +0 -1
  62. package/dist/components/tools/tools/viral-tool-measure.d.ts +0 -33
  63. package/dist/components/tools/tools/viral-tool-measure.js +0 -243
  64. package/dist/components/tools/tools/viral-tool-measure.js.map +0 -1
  65. package/dist/components/tools/tools/viral-tool-sunlight.d.ts +0 -7
  66. package/dist/components/tools/tools/viral-tool-sunlight.js +0 -46
  67. package/dist/components/tools/tools/viral-tool-sunlight.js.map +0 -1
  68. package/dist/components/tools/viral-tools.d.ts +0 -32
  69. package/dist/components/tools/viral-tools.js +0 -213
  70. package/dist/components/tools/viral-tools.js.map +0 -1
  71. package/dist/components/worker/load-model.d.ts +0 -126
  72. package/dist/components/worker/load-model.js +0 -1265
  73. package/dist/components/worker/load-model.js.map +0 -1
  74. package/dist/components/worker/test-worker-pool.d.ts +0 -6
  75. package/dist/components/worker/test-worker-pool.js +0 -21
  76. package/dist/components/worker/test-worker-pool.js.map +0 -1
  77. package/dist/components/worker/viral-viewer-4.worker.d.ts +0 -10
  78. package/dist/components/worker/viral-viewer-4.worker.js +0 -97
  79. package/dist/components/worker/viral-viewer-4.worker.js.map +0 -1
  80. package/dist/components/worker/viral-viewer.worker-pool.d.ts +0 -0
  81. package/dist/components/worker/viral-viewer.worker-pool.js +0 -61
  82. package/dist/components/worker/viral-viewer.worker-pool.js.map +0 -1
  83. package/dist/components/worker/worker-pool.d.ts +0 -21
  84. package/dist/components/worker/worker-pool.js +0 -47
  85. package/dist/components/worker/worker-pool.js.map +0 -1
  86. package/dist/components/worker/worker-thread.d.ts +0 -9
  87. package/dist/components/worker/worker-thread.js +0 -30
  88. package/dist/components/worker/worker-thread.js.map +0 -1
  89. package/dist/components/worker-script/load-model-worker-3.script.d.ts +0 -1
  90. package/dist/components/worker-script/load-model-worker-3.script.js +0 -34170
  91. package/dist/components/worker-script/load-model-worker-3.script.js.map +0 -1
  92. package/dist/components/worker-script/test-worker-pool.script.d.ts +0 -1
  93. package/dist/components/worker-script/test-worker-pool.script.js +0 -12
  94. package/dist/components/worker-script/test-worker-pool.script.js.map +0 -1
  95. package/dist/models/dictionary.model.d.ts +0 -10
  96. package/dist/models/dictionary.model.js +0 -42
  97. package/dist/models/dictionary.model.js.map +0 -1
  98. package/dist/threejs-addon/buffer-geometry-utils.d.ts +0 -64
  99. package/dist/threejs-addon/buffer-geometry-utils.js +0 -807
  100. package/dist/threejs-addon/buffer-geometry-utils.js.map +0 -1
  101. package/dist/threejs-addon/gltf-loader.d.ts +0 -17
  102. package/dist/threejs-addon/gltf-loader.js +0 -2796
  103. package/dist/threejs-addon/gltf-loader.js.map +0 -1
  104. package/dist/threejs-addon/post-processing/effect-composer.d.ts +0 -27
  105. package/dist/threejs-addon/post-processing/effect-composer.js +0 -134
  106. package/dist/threejs-addon/post-processing/effect-composer.js.map +0 -1
  107. package/dist/threejs-addon/post-processing/mask-pass.d.ts +0 -11
  108. package/dist/threejs-addon/post-processing/mask-pass.js +0 -69
  109. package/dist/threejs-addon/post-processing/mask-pass.js.map +0 -1
  110. package/dist/threejs-addon/post-processing/outline-pass.d.ts +0 -58
  111. package/dist/threejs-addon/post-processing/outline-pass.js +0 -484
  112. package/dist/threejs-addon/post-processing/outline-pass.js.map +0 -1
  113. package/dist/threejs-addon/post-processing/output-pass.d.ts +0 -11
  114. package/dist/threejs-addon/post-processing/output-pass.js +0 -61
  115. package/dist/threejs-addon/post-processing/output-pass.js.map +0 -1
  116. package/dist/threejs-addon/post-processing/pass.d.ts +0 -20
  117. package/dist/threejs-addon/post-processing/pass.js +0 -48
  118. package/dist/threejs-addon/post-processing/pass.js.map +0 -1
  119. package/dist/threejs-addon/post-processing/render-pass.d.ts +0 -13
  120. package/dist/threejs-addon/post-processing/render-pass.js +0 -50
  121. package/dist/threejs-addon/post-processing/render-pass.js.map +0 -1
  122. package/dist/threejs-addon/post-processing/sao-pass.d.ts +0 -62
  123. package/dist/threejs-addon/post-processing/sao-pass.js +0 -296
  124. package/dist/threejs-addon/post-processing/sao-pass.js.map +0 -1
  125. package/dist/threejs-addon/post-processing/shader-pass.d.ts +0 -11
  126. package/dist/threejs-addon/post-processing/shader-pass.js +0 -48
  127. package/dist/threejs-addon/post-processing/shader-pass.js.map +0 -1
  128. package/dist/threejs-addon/post-processing/unreal-bloom-pass.d.ts +0 -48
  129. package/dist/threejs-addon/post-processing/unreal-bloom-pass.js +0 -290
  130. package/dist/threejs-addon/post-processing/unreal-bloom-pass.js.map +0 -1
  131. package/dist/threejs-addon/shaders/copy-shader.d.ts +0 -13
  132. package/dist/threejs-addon/shaders/copy-shader.js +0 -39
  133. package/dist/threejs-addon/shaders/copy-shader.js.map +0 -1
  134. package/dist/threejs-addon/shaders/depth-limited-blur-shader.d.ts +0 -48
  135. package/dist/threejs-addon/shaders/depth-limited-blur-shader.js +0 -142
  136. package/dist/threejs-addon/shaders/depth-limited-blur-shader.js.map +0 -1
  137. package/dist/threejs-addon/shaders/luminosity-high-pass-shader.d.ts +0 -27
  138. package/dist/threejs-addon/shaders/luminosity-high-pass-shader.js +0 -56
  139. package/dist/threejs-addon/shaders/luminosity-high-pass-shader.js.map +0 -1
  140. package/dist/threejs-addon/shaders/output-shader.d.ts +0 -13
  141. package/dist/threejs-addon/shaders/output-shader.js +0 -72
  142. package/dist/threejs-addon/shaders/output-shader.js.map +0 -1
  143. package/dist/threejs-addon/shaders/sao-shader.d.ts +0 -71
  144. package/dist/threejs-addon/shaders/sao-shader.js +0 -180
  145. package/dist/threejs-addon/shaders/sao-shader.js.map +0 -1
  146. package/dist/threejs-addon/shaders/unpack-depth-rgba-shader.d.ts +0 -13
  147. package/dist/threejs-addon/shaders/unpack-depth-rgba-shader.js +0 -41
  148. package/dist/threejs-addon/shaders/unpack-depth-rgba-shader.js.map +0 -1
  149. package/dist/threejs-addon/simplify-modifier.d.ts +0 -4
  150. package/dist/threejs-addon/simplify-modifier.js +0 -325
  151. package/dist/threejs-addon/simplify-modifier.js.map +0 -1
  152. package/dist/threejs-addon/transform-control.d.ts +0 -74
  153. package/dist/threejs-addon/transform-control.js +0 -1033
  154. package/dist/threejs-addon/transform-control.js.map +0 -1
@@ -1,290 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnrealBloomPass = void 0;
4
- const three_1 = require("three");
5
- const pass_1 = require("./pass");
6
- const copy_shader_1 = require("../shaders/copy-shader");
7
- const luminosity_high_pass_shader_1 = require("../shaders/luminosity-high-pass-shader");
8
- /**
9
- * UnrealBloomPass is inspired by the bloom pass of Unreal Engine. It creates a
10
- * mip map chain of bloom textures and blurs them with different radii. Because
11
- * of the weighted combination of mips, and because larger blurs are done on
12
- * higher mips, this effect provides good quality and performance.
13
- *
14
- * Reference:
15
- * - https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/Bloom/
16
- */
17
- class UnrealBloomPass extends pass_1.Pass {
18
- constructor(resolution, strength, radius, threshold) {
19
- super();
20
- this.strength = (strength !== undefined) ? strength : 1;
21
- this.radius = radius;
22
- this.threshold = threshold;
23
- this.resolution = (resolution !== undefined) ? new three_1.Vector2(resolution.x, resolution.y) : new three_1.Vector2(256, 256);
24
- // create color only once here, reuse it later inside the render function
25
- this.clearColor = new three_1.Color(0, 0, 0);
26
- // render targets
27
- this.renderTargetsHorizontal = [];
28
- this.renderTargetsVertical = [];
29
- this.nMips = 5;
30
- let resx = Math.round(this.resolution.x / 2);
31
- let resy = Math.round(this.resolution.y / 2);
32
- this.renderTargetBright = new three_1.WebGLRenderTarget(resx, resy);
33
- this.renderTargetBright.texture.name = 'UnrealBloomPass.bright';
34
- this.renderTargetBright.texture.generateMipmaps = false;
35
- for (let i = 0; i < this.nMips; i++) {
36
- const renderTargetHorizonal = new three_1.WebGLRenderTarget(resx, resy);
37
- renderTargetHorizonal.texture.name = 'UnrealBloomPass.h' + i;
38
- renderTargetHorizonal.texture.generateMipmaps = false;
39
- this.renderTargetsHorizontal.push(renderTargetHorizonal);
40
- const renderTargetVertical = new three_1.WebGLRenderTarget(resx, resy);
41
- renderTargetVertical.texture.name = 'UnrealBloomPass.v' + i;
42
- renderTargetVertical.texture.generateMipmaps = false;
43
- this.renderTargetsVertical.push(renderTargetVertical);
44
- resx = Math.round(resx / 2);
45
- resy = Math.round(resy / 2);
46
- }
47
- // luminosity high pass material
48
- const highPassShader = luminosity_high_pass_shader_1.LuminosityHighPassShader;
49
- this.highPassUniforms = three_1.UniformsUtils.clone(highPassShader.uniforms);
50
- this.highPassUniforms['luminosityThreshold'].value = threshold;
51
- this.highPassUniforms['smoothWidth'].value = 0.01;
52
- this.materialHighPassFilter = new three_1.ShaderMaterial({
53
- uniforms: this.highPassUniforms,
54
- vertexShader: highPassShader.vertexShader,
55
- fragmentShader: highPassShader.fragmentShader,
56
- defines: {}
57
- });
58
- // Gaussian Blur Materials
59
- this.separableBlurMaterials = [];
60
- const kernelSizeArray = [3, 5, 7, 9, 11];
61
- resx = Math.round(this.resolution.x / 2);
62
- resy = Math.round(this.resolution.y / 2);
63
- for (let i = 0; i < this.nMips; i++) {
64
- this.separableBlurMaterials.push(this.getSeperableBlurMaterial(kernelSizeArray[i]));
65
- this.separableBlurMaterials[i].uniforms['texSize'].value = new three_1.Vector2(resx, resy);
66
- resx = Math.round(resx / 2);
67
- resy = Math.round(resy / 2);
68
- }
69
- // Composite material
70
- this.compositeMaterial = this.getCompositeMaterial(this.nMips);
71
- this.compositeMaterial.uniforms['blurTexture1'].value = this.renderTargetsVertical[0].texture;
72
- this.compositeMaterial.uniforms['blurTexture2'].value = this.renderTargetsVertical[1].texture;
73
- this.compositeMaterial.uniforms['blurTexture3'].value = this.renderTargetsVertical[2].texture;
74
- this.compositeMaterial.uniforms['blurTexture4'].value = this.renderTargetsVertical[3].texture;
75
- this.compositeMaterial.uniforms['blurTexture5'].value = this.renderTargetsVertical[4].texture;
76
- this.compositeMaterial.uniforms['bloomStrength'].value = strength;
77
- this.compositeMaterial.uniforms['bloomRadius'].value = 0.1;
78
- this.compositeMaterial.needsUpdate = true;
79
- const bloomFactors = [1.0, 0.8, 0.6, 0.4, 0.2];
80
- this.compositeMaterial.uniforms['bloomFactors'].value = bloomFactors;
81
- this.bloomTintColors = [new three_1.Vector3(1, 1, 1), new three_1.Vector3(1, 1, 1), new three_1.Vector3(1, 1, 1), new three_1.Vector3(1, 1, 1), new three_1.Vector3(1, 1, 1)];
82
- this.compositeMaterial.uniforms['bloomTintColors'].value = this.bloomTintColors;
83
- // copy material
84
- const copyShader = copy_shader_1.CopyShader;
85
- this.copyUniforms = three_1.UniformsUtils.clone(copyShader.uniforms);
86
- this.copyUniforms['opacity'].value = 1.0;
87
- this.materialCopy = new three_1.ShaderMaterial({
88
- uniforms: this.copyUniforms,
89
- vertexShader: copyShader.vertexShader,
90
- fragmentShader: copyShader.fragmentShader,
91
- blending: three_1.AdditiveBlending,
92
- depthTest: false,
93
- depthWrite: false,
94
- transparent: true
95
- });
96
- this.enabled = true;
97
- this.needsSwap = false;
98
- this._oldClearColor = new three_1.Color();
99
- this.oldClearAlpha = 1;
100
- this.basic = new three_1.MeshBasicMaterial();
101
- this.fsQuad = new pass_1.FullScreenQuad(null);
102
- }
103
- dispose() {
104
- for (let i = 0; i < this.renderTargetsHorizontal.length; i++) {
105
- this.renderTargetsHorizontal[i].dispose();
106
- }
107
- for (let i = 0; i < this.renderTargetsVertical.length; i++) {
108
- this.renderTargetsVertical[i].dispose();
109
- }
110
- this.renderTargetBright.dispose();
111
- //
112
- for (let i = 0; i < this.separableBlurMaterials.length; i++) {
113
- this.separableBlurMaterials[i].dispose();
114
- }
115
- this.compositeMaterial.dispose();
116
- this.materialCopy.dispose();
117
- this.basic.dispose();
118
- //
119
- this.fsQuad.dispose();
120
- }
121
- setSize(width, height) {
122
- let resx = Math.round(width / 2);
123
- let resy = Math.round(height / 2);
124
- this.renderTargetBright.setSize(resx, resy);
125
- for (let i = 0; i < this.nMips; i++) {
126
- this.renderTargetsHorizontal[i].setSize(resx, resy);
127
- this.renderTargetsVertical[i].setSize(resx, resy);
128
- this.separableBlurMaterials[i].uniforms['texSize'].value = new three_1.Vector2(resx, resy);
129
- resx = Math.round(resx / 2);
130
- resy = Math.round(resy / 2);
131
- }
132
- }
133
- render(renderer, writeBuffer, readBuffer, deltaTime, maskActive) {
134
- renderer.getClearColor(this._oldClearColor);
135
- this.oldClearAlpha = renderer.getClearAlpha();
136
- const oldAutoClear = renderer.autoClear;
137
- renderer.autoClear = false;
138
- renderer.setClearColor(this.clearColor, 0);
139
- if (maskActive)
140
- renderer.state.buffers.stencil.setTest(false);
141
- // Render input to screen
142
- if (this.renderToScreen) {
143
- this.fsQuad.material = this.basic;
144
- this.basic.map = readBuffer.texture;
145
- renderer.setRenderTarget(null);
146
- renderer.clear();
147
- this.fsQuad.render(renderer);
148
- }
149
- // 1. Extract Bright Areas
150
- this.highPassUniforms['tDiffuse'].value = readBuffer.texture;
151
- this.highPassUniforms['luminosityThreshold'].value = this.threshold;
152
- this.fsQuad.material = this.materialHighPassFilter;
153
- renderer.setRenderTarget(this.renderTargetBright);
154
- renderer.clear();
155
- this.fsQuad.render(renderer);
156
- // 2. Blur All the mips progressively
157
- let inputRenderTarget = this.renderTargetBright;
158
- for (let i = 0; i < this.nMips; i++) {
159
- this.fsQuad.material = this.separableBlurMaterials[i];
160
- this.separableBlurMaterials[i].uniforms['colorTexture'].value = inputRenderTarget.texture;
161
- this.separableBlurMaterials[i].uniforms['direction'].value = UnrealBloomPass.BlurDirectionX;
162
- renderer.setRenderTarget(this.renderTargetsHorizontal[i]);
163
- renderer.clear();
164
- this.fsQuad.render(renderer);
165
- this.separableBlurMaterials[i].uniforms['colorTexture'].value = this.renderTargetsHorizontal[i].texture;
166
- this.separableBlurMaterials[i].uniforms['direction'].value = UnrealBloomPass.BlurDirectionY;
167
- renderer.setRenderTarget(this.renderTargetsVertical[i]);
168
- renderer.clear();
169
- this.fsQuad.render(renderer);
170
- inputRenderTarget = this.renderTargetsVertical[i];
171
- }
172
- // Composite All the mips
173
- this.fsQuad.material = this.compositeMaterial;
174
- this.compositeMaterial.uniforms['bloomStrength'].value = this.strength;
175
- this.compositeMaterial.uniforms['bloomRadius'].value = this.radius;
176
- this.compositeMaterial.uniforms['bloomTintColors'].value = this.bloomTintColors;
177
- renderer.setRenderTarget(this.renderTargetsHorizontal[0]);
178
- renderer.clear();
179
- this.fsQuad.render(renderer);
180
- // Blend it additively over the input texture
181
- this.fsQuad.material = this.materialCopy;
182
- this.copyUniforms['tDiffuse'].value = this.renderTargetsHorizontal[0].texture;
183
- if (maskActive)
184
- renderer.state.buffers.stencil.setTest(true);
185
- if (this.renderToScreen) {
186
- renderer.setRenderTarget(null);
187
- this.fsQuad.render(renderer);
188
- }
189
- else {
190
- renderer.setRenderTarget(readBuffer);
191
- this.fsQuad.render(renderer);
192
- }
193
- // Restore renderer settings
194
- renderer.setClearColor(this._oldClearColor, this.oldClearAlpha);
195
- renderer.autoClear = oldAutoClear;
196
- }
197
- getSeperableBlurMaterial(kernelRadius) {
198
- return new three_1.ShaderMaterial({
199
- defines: {
200
- 'KERNEL_RADIUS': kernelRadius,
201
- 'SIGMA': kernelRadius
202
- },
203
- uniforms: {
204
- 'colorTexture': { value: null },
205
- 'texSize': { value: new three_1.Vector2(0.5, 0.5) },
206
- 'direction': { value: new three_1.Vector2(0.5, 0.5) }
207
- },
208
- vertexShader: `varying vec2 vUv;
209
- void main() {
210
- vUv = uv;
211
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
212
- }`,
213
- fragmentShader: `#include <common>
214
- varying vec2 vUv;
215
- uniform sampler2D colorTexture;
216
- uniform vec2 texSize;
217
- uniform vec2 direction;
218
-
219
- float gaussianPdf(in float x, in float sigma) {
220
- return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;
221
- }
222
- void main() {
223
- vec2 invSize = 1.0 / texSize;
224
- float fSigma = float(SIGMA);
225
- float weightSum = gaussianPdf(0.0, fSigma);
226
- vec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;
227
- for( int i = 1; i < KERNEL_RADIUS; i ++ ) {
228
- float x = float(i);
229
- float w = gaussianPdf(x, fSigma);
230
- vec2 uvOffset = direction * invSize * x;
231
- vec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;
232
- vec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;
233
- diffuseSum += (sample1 + sample2) * w;
234
- weightSum += 2.0 * w;
235
- }
236
- gl_FragColor = vec4(diffuseSum/weightSum, 1.0);
237
- }`
238
- });
239
- }
240
- getCompositeMaterial(nMips) {
241
- return new three_1.ShaderMaterial({
242
- defines: {
243
- 'NUM_MIPS': nMips
244
- },
245
- uniforms: {
246
- 'blurTexture1': { value: null },
247
- 'blurTexture2': { value: null },
248
- 'blurTexture3': { value: null },
249
- 'blurTexture4': { value: null },
250
- 'blurTexture5': { value: null },
251
- 'bloomStrength': { value: 1.0 },
252
- 'bloomFactors': { value: null },
253
- 'bloomTintColors': { value: null },
254
- 'bloomRadius': { value: 0.0 }
255
- },
256
- vertexShader: `varying vec2 vUv;
257
- void main() {
258
- vUv = uv;
259
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
260
- }`,
261
- fragmentShader: `varying vec2 vUv;
262
- uniform sampler2D blurTexture1;
263
- uniform sampler2D blurTexture2;
264
- uniform sampler2D blurTexture3;
265
- uniform sampler2D blurTexture4;
266
- uniform sampler2D blurTexture5;
267
- uniform float bloomStrength;
268
- uniform float bloomRadius;
269
- uniform float bloomFactors[NUM_MIPS];
270
- uniform vec3 bloomTintColors[NUM_MIPS];
271
-
272
- float lerpBloomFactor(const in float factor) {
273
- float mirrorFactor = 1.2 - factor;
274
- return mix(factor, mirrorFactor, bloomRadius);
275
- }
276
-
277
- void main() {
278
- gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
279
- lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
280
- lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
281
- lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
282
- lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
283
- }`
284
- });
285
- }
286
- }
287
- exports.UnrealBloomPass = UnrealBloomPass;
288
- UnrealBloomPass.BlurDirectionX = new three_1.Vector2(1.0, 0.0);
289
- UnrealBloomPass.BlurDirectionY = new three_1.Vector2(0.0, 1.0);
290
- //# sourceMappingURL=unreal-bloom-pass.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unreal-bloom-pass.js","sourceRoot":"","sources":["../../../src/threejs-addon/post-processing/unreal-bloom-pass.js"],"names":[],"mappings":";;;AAAA,iCASe;AACf,iCAA8C;AAC9C,wDAAoD;AACpD,wFAAkF;AAElF;;;;;;;;GAQG;AACH,MAAM,eAAgB,SAAQ,WAAI;IAE9B,YAAY,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS;QAE/C,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,QAAQ,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,eAAO,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,eAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAE/G,yEAAyE;QACzE,IAAI,CAAC,UAAU,GAAG,IAAI,aAAK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AAY,EAAE;;;;MAIpB;YAEM,cAAc,EAAE;;;;;;;;;;;;;;;;;;;;;;;;MAwBtB;SACG,CAAC,CAAC;IAEP,CAAC;IAED,oBAAoB,CAAC,KAAK;QAEtB,OAAO,IAAI,sBAAc,CAAC;YAEtB,OAAO,EAAE;gBACL,UAAU,EAAE,KAAK;aACpB;YAED,QAAQ,EAAE;gBACN,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;gBAC/B,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;gBAC/B,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;gBAC/B,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;gBAC/B,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;gBAC/B,eAAe,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;gBAC/B,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;gBAC/B,iBAAiB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;gBAClC,aAAa,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;aAChC;YAED,YAAY,EAAE;;;;MAIpB;YAEM,cAAc,EAAE;;;;;;;;;;;;;;;;;;;;;;MAsBtB;SACG,CAAC,CAAC;IAEP,CAAC;CAEJ;AAKQ,0CAAe;AAHxB,eAAe,CAAC,cAAc,GAAG,IAAI,eAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACvD,eAAe,CAAC,cAAc,GAAG,IAAI,eAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC"}
@@ -1,13 +0,0 @@
1
- export namespace CopyShader {
2
- namespace uniforms {
3
- namespace tDiffuse {
4
- const value: null;
5
- }
6
- namespace opacity {
7
- const value_1: number;
8
- export { value_1 as value };
9
- }
10
- }
11
- const vertexShader: string;
12
- const fragmentShader: string;
13
- }
@@ -1,39 +0,0 @@
1
- "use strict";
2
- /**
3
- * Full-screen textured quad shader
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CopyShader = void 0;
7
- const CopyShader = {
8
- uniforms: {
9
- 'tDiffuse': { value: null },
10
- 'opacity': { value: 1.0 }
11
- },
12
- vertexShader: /* glsl */ `
13
-
14
- varying vec2 vUv;
15
-
16
- void main() {
17
-
18
- vUv = uv;
19
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
20
-
21
- }`,
22
- fragmentShader: /* glsl */ `
23
-
24
- uniform float opacity;
25
-
26
- uniform sampler2D tDiffuse;
27
-
28
- varying vec2 vUv;
29
-
30
- void main() {
31
-
32
- gl_FragColor = texture2D( tDiffuse, vUv );
33
- gl_FragColor.a *= opacity;
34
-
35
-
36
- }`
37
- };
38
- exports.CopyShader = CopyShader;
39
- //# sourceMappingURL=copy-shader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"copy-shader.js","sourceRoot":"","sources":["../../../src/threejs-addon/shaders/copy-shader.js"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,MAAM,UAAU,GAAG;IAEf,QAAQ,EAAE;QAEN,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;QAC3B,SAAS,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;KAE5B;IAED,YAAY,EAAE,UAAU,CAAC;;;;;;;;;IASzB;IAEA,cAAc,EAAE,UAAU,CAAC;;;;;;;;;;;;;;IAc3B;CAEH,CAAC;AAEO,gCAAU"}
@@ -1,48 +0,0 @@
1
- export namespace DepthLimitedBlurShader {
2
- namespace defines {
3
- const KERNEL_RADIUS: number;
4
- const DEPTH_PACKING: number;
5
- const PERSPECTIVE_CAMERA: number;
6
- }
7
- namespace uniforms {
8
- namespace tDiffuse {
9
- const value: null;
10
- }
11
- namespace size {
12
- const value_1: Vector2;
13
- export { value_1 as value };
14
- }
15
- namespace sampleUvOffsets {
16
- const value_2: Vector2[];
17
- export { value_2 as value };
18
- }
19
- namespace sampleWeights {
20
- const value_3: number[];
21
- export { value_3 as value };
22
- }
23
- namespace tDepth {
24
- const value_4: null;
25
- export { value_4 as value };
26
- }
27
- namespace cameraNear {
28
- const value_5: number;
29
- export { value_5 as value };
30
- }
31
- namespace cameraFar {
32
- const value_6: number;
33
- export { value_6 as value };
34
- }
35
- namespace depthCutoff {
36
- const value_7: number;
37
- export { value_7 as value };
38
- }
39
- }
40
- const vertexShader: string;
41
- const fragmentShader: string;
42
- }
43
- export namespace BlurShaderUtils {
44
- function createSampleWeights(kernelRadius: any, stdDev: any): number[];
45
- function createSampleOffsets(kernelRadius: any, uvIncrement: any): any[];
46
- function configure(material: any, kernelRadius: any, stdDev: any, uvIncrement: any): void;
47
- }
48
- import { Vector2 } from 'three';
@@ -1,142 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BlurShaderUtils = exports.DepthLimitedBlurShader = void 0;
4
- const three_1 = require("three");
5
- /**
6
- * TODO
7
- */
8
- const DepthLimitedBlurShader = {
9
- defines: {
10
- 'KERNEL_RADIUS': 4,
11
- 'DEPTH_PACKING': 1,
12
- 'PERSPECTIVE_CAMERA': 1
13
- },
14
- uniforms: {
15
- 'tDiffuse': { value: null },
16
- 'size': { value: new three_1.Vector2(512, 512) },
17
- 'sampleUvOffsets': { value: [new three_1.Vector2(0, 0)] },
18
- 'sampleWeights': { value: [1.0] },
19
- 'tDepth': { value: null },
20
- 'cameraNear': { value: 10 },
21
- 'cameraFar': { value: 1000 },
22
- 'depthCutoff': { value: 10 },
23
- },
24
- vertexShader: /* glsl */ `
25
-
26
- #include <common>
27
-
28
- uniform vec2 size;
29
-
30
- varying vec2 vUv;
31
- varying vec2 vInvSize;
32
-
33
- void main() {
34
- vUv = uv;
35
- vInvSize = 1.0 / size;
36
-
37
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
38
- }`,
39
- fragmentShader: /* glsl */ `
40
-
41
- #include <common>
42
- #include <packing>
43
-
44
- uniform sampler2D tDiffuse;
45
- uniform sampler2D tDepth;
46
-
47
- uniform float cameraNear;
48
- uniform float cameraFar;
49
- uniform float depthCutoff;
50
-
51
- uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];
52
- uniform float sampleWeights[ KERNEL_RADIUS + 1 ];
53
-
54
- varying vec2 vUv;
55
- varying vec2 vInvSize;
56
-
57
- float getDepth( const in vec2 screenPosition ) {
58
- #if DEPTH_PACKING == 1
59
- return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );
60
- #else
61
- return texture2D( tDepth, screenPosition ).x;
62
- #endif
63
- }
64
-
65
- float getViewZ( const in float depth ) {
66
- #if PERSPECTIVE_CAMERA == 1
67
- return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );
68
- #else
69
- return orthographicDepthToViewZ( depth, cameraNear, cameraFar );
70
- #endif
71
- }
72
-
73
- void main() {
74
- float depth = getDepth( vUv );
75
- if( depth >= ( 1.0 - EPSILON ) ) {
76
- discard;
77
- }
78
-
79
- float centerViewZ = -getViewZ( depth );
80
- bool rBreak = false, lBreak = false;
81
-
82
- float weightSum = sampleWeights[0];
83
- vec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;
84
-
85
- for( int i = 1; i <= KERNEL_RADIUS; i ++ ) {
86
-
87
- float sampleWeight = sampleWeights[i];
88
- vec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;
89
-
90
- vec2 sampleUv = vUv + sampleUvOffset;
91
- float viewZ = -getViewZ( getDepth( sampleUv ) );
92
-
93
- if( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;
94
-
95
- if( ! rBreak ) {
96
- diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;
97
- weightSum += sampleWeight;
98
- }
99
-
100
- sampleUv = vUv - sampleUvOffset;
101
- viewZ = -getViewZ( getDepth( sampleUv ) );
102
-
103
- if( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;
104
-
105
- if( ! lBreak ) {
106
- diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;
107
- weightSum += sampleWeight;
108
- }
109
-
110
- }
111
-
112
- gl_FragColor = diffuseSum / weightSum;
113
- }`
114
- };
115
- exports.DepthLimitedBlurShader = DepthLimitedBlurShader;
116
- const BlurShaderUtils = {
117
- createSampleWeights: function (kernelRadius, stdDev) {
118
- const weights = [];
119
- for (let i = 0; i <= kernelRadius; i++) {
120
- weights.push(gaussian(i, stdDev));
121
- }
122
- return weights;
123
- },
124
- createSampleOffsets: function (kernelRadius, uvIncrement) {
125
- const offsets = [];
126
- for (let i = 0; i <= kernelRadius; i++) {
127
- offsets.push(uvIncrement.clone().multiplyScalar(i));
128
- }
129
- return offsets;
130
- },
131
- configure: function (material, kernelRadius, stdDev, uvIncrement) {
132
- material.defines['KERNEL_RADIUS'] = kernelRadius;
133
- material.uniforms['sampleUvOffsets'].value = BlurShaderUtils.createSampleOffsets(kernelRadius, uvIncrement);
134
- material.uniforms['sampleWeights'].value = BlurShaderUtils.createSampleWeights(kernelRadius, stdDev);
135
- material.needsUpdate = true;
136
- }
137
- };
138
- exports.BlurShaderUtils = BlurShaderUtils;
139
- function gaussian(x, stdDev) {
140
- return Math.exp(-(x * x) / (2.0 * (stdDev * stdDev))) / (Math.sqrt(2.0 * Math.PI) * stdDev);
141
- }
142
- //# sourceMappingURL=depth-limited-blur-shader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"depth-limited-blur-shader.js","sourceRoot":"","sources":["../../../src/threejs-addon/shaders/depth-limited-blur-shader.js"],"names":[],"mappings":";;;AAAA,iCAEe;AAEf;;GAEG;AAEH,MAAM,sBAAsB,GAAG;IAC3B,OAAO,EAAE;QACL,eAAe,EAAE,CAAC;QAClB,eAAe,EAAE,CAAC;QAClB,oBAAoB,EAAE,CAAC;KAC1B;IACD,QAAQ,EAAE;QACN,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;QAC3B,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,eAAO,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE;QACxC,iBA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AM,EAAE,WAAW;QAE3D,QAAQ,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,YAAY,CAAC;QACjD,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,KAAK,GAAG,eAAe,CAAC,mBAAmB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;QAC5G,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,KAAK,GAAG,eAAe,CAAC,mBAAmB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACrG,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC;IAEhC,CAAC;CAEJ,CAAC;AAQ+B,0CAAe;AANhD,SAAS,QAAQ,CAAC,CAAC,EAAE,MAAM;IAEvB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;AAEhG,CAAC"}
@@ -1,27 +0,0 @@
1
- export namespace LuminosityHighPassShader {
2
- const shaderID: string;
3
- namespace uniforms {
4
- namespace tDiffuse {
5
- const value: null;
6
- }
7
- namespace luminosityThreshold {
8
- const value_1: number;
9
- export { value_1 as value };
10
- }
11
- namespace smoothWidth {
12
- const value_2: number;
13
- export { value_2 as value };
14
- }
15
- namespace defaultColor {
16
- const value_3: Color;
17
- export { value_3 as value };
18
- }
19
- namespace defaultOpacity {
20
- const value_4: number;
21
- export { value_4 as value };
22
- }
23
- }
24
- const vertexShader: string;
25
- const fragmentShader: string;
26
- }
27
- import { Color } from 'three';
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LuminosityHighPassShader = void 0;
4
- const three_1 = require("three");
5
- /**
6
- * Luminosity
7
- * http://en.wikipedia.org/wiki/Luminosity
8
- */
9
- const LuminosityHighPassShader = {
10
- shaderID: 'luminosityHighPass',
11
- uniforms: {
12
- 'tDiffuse': { value: null },
13
- 'luminosityThreshold': { value: 1.0 },
14
- 'smoothWidth': { value: 1.0 },
15
- 'defaultColor': { value: new three_1.Color(0x000000) },
16
- 'defaultOpacity': { value: 0.0 }
17
- },
18
- vertexShader: /* glsl */ `
19
-
20
- varying vec2 vUv;
21
-
22
- void main() {
23
-
24
- vUv = uv;
25
-
26
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
27
-
28
- }`,
29
- fragmentShader: /* glsl */ `
30
-
31
- uniform sampler2D tDiffuse;
32
- uniform vec3 defaultColor;
33
- uniform float defaultOpacity;
34
- uniform float luminosityThreshold;
35
- uniform float smoothWidth;
36
-
37
- varying vec2 vUv;
38
-
39
- void main() {
40
-
41
- vec4 texel = texture2D( tDiffuse, vUv );
42
-
43
- vec3 luma = vec3( 0.299, 0.587, 0.114 );
44
-
45
- float v = dot( texel.xyz, luma );
46
-
47
- vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
48
-
49
- float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
50
-
51
- gl_FragColor = mix( outputColor, texel, alpha );
52
-
53
- }`
54
- };
55
- exports.LuminosityHighPassShader = LuminosityHighPassShader;
56
- //# sourceMappingURL=luminosity-high-pass-shader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"luminosity-high-pass-shader.js","sourceRoot":"","sources":["../../../src/threejs-addon/shaders/luminosity-high-pass-shader.js"],"names":[],"mappings":";;;AAAA,iCAEe;AAEf;;;GAGG;AAEH,MAAM,wBAAwB,GAAG;IAE7B,QAAQ,EAAE,oBAAoB;IAE9B,QAAQ,EAAE;QAEN,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;QAC3B,qBAAqB,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;QACrC,aAAa,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;QAC7B,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,aAAK,CAAC,QAAQ,CAAC,EAAE;QAC9C,gBAAgB,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;KAEnC;IAED,YAAY,EAAE,UAAU,CAAC;;;;;;;;;;IAUzB;IAEA,cAAc,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;IAwB3B;CAEH,CAAC;AAEO,4DAAwB"}
@@ -1,13 +0,0 @@
1
- export namespace OutputShader {
2
- namespace uniforms {
3
- namespace tDiffuse {
4
- const value: null;
5
- }
6
- namespace toneMappingExposure {
7
- const value_1: number;
8
- export { value_1 as value };
9
- }
10
- }
11
- const vertexShader: string;
12
- const fragmentShader: string;
13
- }