@shapediver/viewer.rendering-engine.rendering-engine-threejs 3.9.0 → 3.9.2

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 (190) hide show
  1. package/README.md +1 -1
  2. package/dist/RenderingEngine.d.ts +23 -23
  3. package/dist/RenderingEngine.d.ts.map +1 -1
  4. package/dist/RenderingEngine.js +245 -128
  5. package/dist/RenderingEngine.js.map +1 -1
  6. package/dist/index.d.ts +11 -11
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +12 -11
  9. package/dist/index.js.map +1 -1
  10. package/dist/injectors/TextureUnifierInjector.d.ts.map +1 -1
  11. package/dist/injectors/TextureUnifierInjector.js +22 -13
  12. package/dist/injectors/TextureUnifierInjector.js.map +1 -1
  13. package/dist/interfaces/ILoader.d.ts.map +1 -1
  14. package/dist/interfaces/IPostProcessingEffectDefinitions.d.ts.map +1 -1
  15. package/dist/interfaces/IPostProcessingEffectDefinitions.js.map +1 -1
  16. package/dist/interfaces/IRenderingEngine.d.ts +6 -6
  17. package/dist/interfaces/IRenderingEngine.d.ts.map +1 -1
  18. package/dist/loaders/EnvironmentMapLoader.d.ts +3 -3
  19. package/dist/loaders/EnvironmentMapLoader.d.ts.map +1 -1
  20. package/dist/loaders/EnvironmentMapLoader.js +150 -52
  21. package/dist/loaders/EnvironmentMapLoader.js.map +1 -1
  22. package/dist/loaders/GeometryLoader.d.ts +6 -6
  23. package/dist/loaders/GeometryLoader.d.ts.map +1 -1
  24. package/dist/loaders/GeometryLoader.js +140 -93
  25. package/dist/loaders/GeometryLoader.js.map +1 -1
  26. package/dist/loaders/HTMLElementAnchorLoader.d.ts +4 -4
  27. package/dist/loaders/HTMLElementAnchorLoader.d.ts.map +1 -1
  28. package/dist/loaders/HTMLElementAnchorLoader.js +26 -14
  29. package/dist/loaders/HTMLElementAnchorLoader.js.map +1 -1
  30. package/dist/loaders/LightLoader.d.ts +5 -5
  31. package/dist/loaders/LightLoader.d.ts.map +1 -1
  32. package/dist/loaders/LightLoader.js +43 -15
  33. package/dist/loaders/LightLoader.js.map +1 -1
  34. package/dist/loaders/MaterialLoader.d.ts +17 -17
  35. package/dist/loaders/MaterialLoader.d.ts.map +1 -1
  36. package/dist/loaders/MaterialLoader.js +563 -198
  37. package/dist/loaders/MaterialLoader.js.map +1 -1
  38. package/dist/managers/CameraManager.d.ts +6 -6
  39. package/dist/managers/CameraManager.d.ts.map +1 -1
  40. package/dist/managers/CameraManager.js +47 -27
  41. package/dist/managers/CameraManager.js.map +1 -1
  42. package/dist/managers/EnvironmentGeometryManager.d.ts +7 -7
  43. package/dist/managers/EnvironmentGeometryManager.d.ts.map +1 -1
  44. package/dist/managers/EnvironmentGeometryManager.js +20 -8
  45. package/dist/managers/EnvironmentGeometryManager.js.map +1 -1
  46. package/dist/managers/PostProcessingManager.d.ts +9 -9
  47. package/dist/managers/PostProcessingManager.d.ts.map +1 -1
  48. package/dist/managers/PostProcessingManager.js +358 -173
  49. package/dist/managers/PostProcessingManager.js.map +1 -1
  50. package/dist/managers/RenderingManager.d.ts +4 -4
  51. package/dist/managers/RenderingManager.d.ts.map +1 -1
  52. package/dist/managers/RenderingManager.js +164 -79
  53. package/dist/managers/RenderingManager.js.map +1 -1
  54. package/dist/managers/SceneTracingManager.d.ts +3 -3
  55. package/dist/managers/SceneTracingManager.d.ts.map +1 -1
  56. package/dist/managers/SceneTracingManager.js +12 -9
  57. package/dist/managers/SceneTracingManager.js.map +1 -1
  58. package/dist/managers/SceneTreeManager.d.ts +7 -7
  59. package/dist/managers/SceneTreeManager.d.ts.map +1 -1
  60. package/dist/managers/SceneTreeManager.js +100 -52
  61. package/dist/managers/SceneTreeManager.js.map +1 -1
  62. package/dist/managers/environmentGeometry/ContactShadow.d.ts +4 -4
  63. package/dist/managers/environmentGeometry/ContactShadow.d.ts.map +1 -1
  64. package/dist/managers/environmentGeometry/ContactShadow.js +14 -9
  65. package/dist/managers/environmentGeometry/ContactShadow.js.map +1 -1
  66. package/dist/managers/environmentGeometry/Grid.d.ts +5 -5
  67. package/dist/managers/environmentGeometry/Grid.d.ts.map +1 -1
  68. package/dist/managers/environmentGeometry/Grid.js +28 -13
  69. package/dist/managers/environmentGeometry/Grid.js.map +1 -1
  70. package/dist/managers/environmentGeometry/GroundPlane.d.ts +5 -5
  71. package/dist/managers/environmentGeometry/GroundPlane.d.ts.map +1 -1
  72. package/dist/managers/environmentGeometry/GroundPlane.js +17 -10
  73. package/dist/managers/environmentGeometry/GroundPlane.js.map +1 -1
  74. package/dist/managers/environmentGeometry/GroundPlaneShadow.d.ts +5 -5
  75. package/dist/managers/environmentGeometry/GroundPlaneShadow.d.ts.map +1 -1
  76. package/dist/managers/environmentGeometry/GroundPlaneShadow.js +11 -8
  77. package/dist/managers/environmentGeometry/GroundPlaneShadow.js.map +1 -1
  78. package/dist/managers/environmentGeometry/IEnvironmentGeometry.d.ts +2 -2
  79. package/dist/managers/environmentGeometry/IEnvironmentGeometry.d.ts.map +1 -1
  80. package/dist/managers/postprocessing/GodRaysManager.d.ts +3 -3
  81. package/dist/managers/postprocessing/GodRaysManager.d.ts.map +1 -1
  82. package/dist/managers/postprocessing/GodRaysManager.js +5 -5
  83. package/dist/managers/postprocessing/GodRaysManager.js.map +1 -1
  84. package/dist/managers/postprocessing/OutlineManager.d.ts +3 -3
  85. package/dist/managers/postprocessing/OutlineManager.d.ts.map +1 -1
  86. package/dist/managers/postprocessing/OutlineManager.js +1 -1
  87. package/dist/managers/postprocessing/OutlineManager.js.map +1 -1
  88. package/dist/managers/postprocessing/SSAARenderPass.d.ts +12 -12
  89. package/dist/managers/postprocessing/SSAARenderPass.d.ts.map +1 -1
  90. package/dist/managers/postprocessing/SSAARenderPass.js +83 -35
  91. package/dist/managers/postprocessing/SSAARenderPass.js.map +1 -1
  92. package/dist/managers/postprocessing/SelectiveBloomManager.d.ts +3 -3
  93. package/dist/managers/postprocessing/SelectiveBloomManager.d.ts.map +1 -1
  94. package/dist/managers/postprocessing/SelectiveBloomManager.js +1 -1
  95. package/dist/managers/postprocessing/SelectiveBloomManager.js.map +1 -1
  96. package/dist/managers/postprocessing/ao/ao/AOEffect.d.ts +5 -5
  97. package/dist/managers/postprocessing/ao/ao/AOEffect.d.ts.map +1 -1
  98. package/dist/managers/postprocessing/ao/ao/AOEffect.js +43 -34
  99. package/dist/managers/postprocessing/ao/ao/AOEffect.js.map +1 -1
  100. package/dist/managers/postprocessing/ao/ao/AOPass.d.ts +2 -2
  101. package/dist/managers/postprocessing/ao/ao/AOPass.d.ts.map +1 -1
  102. package/dist/managers/postprocessing/ao/ao/AOPass.js +26 -14
  103. package/dist/managers/postprocessing/ao/ao/AOPass.js.map +1 -1
  104. package/dist/managers/postprocessing/ao/hbao/HBAOEffect.d.ts +3 -3
  105. package/dist/managers/postprocessing/ao/hbao/HBAOEffect.d.ts.map +1 -1
  106. package/dist/managers/postprocessing/ao/hbao/HBAOEffect.js +2 -2
  107. package/dist/managers/postprocessing/ao/hbao/HBAOEffect.js.map +1 -1
  108. package/dist/managers/postprocessing/ao/poissionDenoise/PoissionDenoisePass.d.ts +2 -2
  109. package/dist/managers/postprocessing/ao/poissionDenoise/PoissionDenoisePass.d.ts.map +1 -1
  110. package/dist/managers/postprocessing/ao/poissionDenoise/PoissionDenoisePass.js +51 -36
  111. package/dist/managers/postprocessing/ao/poissionDenoise/PoissionDenoisePass.js.map +1 -1
  112. package/dist/managers/postprocessing/ao/ssao/SSAOEffect.d.ts +3 -3
  113. package/dist/managers/postprocessing/ao/ssao/SSAOEffect.d.ts.map +1 -1
  114. package/dist/managers/postprocessing/ao/ssao/SSAOEffect.js +15 -10
  115. package/dist/managers/postprocessing/ao/ssao/SSAOEffect.js.map +1 -1
  116. package/dist/managers/postprocessing/ao/utils/shader/basic.d.ts.map +1 -1
  117. package/dist/managers/postprocessing/ao/utils/shader/basic.js.map +1 -1
  118. package/dist/managers/postprocessing/ao/utils/shader/sampleBlueNoise.d.ts.map +1 -1
  119. package/dist/managers/postprocessing/ao/utils/shader/sampleBlueNoise.js.map +1 -1
  120. package/dist/managers/postprocessing/effects/tone-mapping/ToneMappingEffect.d.ts +2 -2
  121. package/dist/managers/postprocessing/effects/tone-mapping/ToneMappingEffect.d.ts.map +1 -1
  122. package/dist/managers/postprocessing/effects/tone-mapping/ToneMappingEffect.js +43 -35
  123. package/dist/managers/postprocessing/effects/tone-mapping/ToneMappingEffect.js.map +1 -1
  124. package/dist/managers/postprocessing/utils/CopyMaterial.d.ts.map +1 -1
  125. package/dist/managers/postprocessing/utils/CopyMaterial.js +2 -2
  126. package/dist/managers/postprocessing/utils/CopyMaterial.js.map +1 -1
  127. package/dist/managers/postprocessing/utils/CopyShader.d.ts.map +1 -1
  128. package/dist/managers/postprocessing/utils/CopyShader.js +4 -4
  129. package/dist/managers/postprocessing/utils/CopyShader.js.map +1 -1
  130. package/dist/managers/postprocessing/utils/FullScreenQuad.d.ts +1 -1
  131. package/dist/managers/postprocessing/utils/FullScreenQuad.d.ts.map +1 -1
  132. package/dist/managers/postprocessing/utils/FullScreenQuad.js +2 -2
  133. package/dist/managers/postprocessing/utils/FullScreenQuad.js.map +1 -1
  134. package/dist/managers/postprocessing/utils/NormalPass.d.ts +2 -2
  135. package/dist/managers/postprocessing/utils/NormalPass.d.ts.map +1 -1
  136. package/dist/managers/postprocessing/utils/NormalPass.js +3 -3
  137. package/dist/managers/postprocessing/utils/NormalPass.js.map +1 -1
  138. package/dist/managers/postprocessing/utils/RenderPass.d.ts +2 -2
  139. package/dist/managers/postprocessing/utils/RenderPass.d.ts.map +1 -1
  140. package/dist/managers/postprocessing/utils/RenderPass.js +14 -5
  141. package/dist/managers/postprocessing/utils/RenderPass.js.map +1 -1
  142. package/dist/materials/GemMaterial.d.ts +2 -2
  143. package/dist/materials/GemMaterial.d.ts.map +1 -1
  144. package/dist/materials/GemMaterial.js +20 -20
  145. package/dist/materials/GemMaterial.js.map +1 -1
  146. package/dist/materials/MeshUnlitMaterialParameters.d.ts +1 -1
  147. package/dist/materials/MeshUnlitMaterialParameters.d.ts.map +1 -1
  148. package/dist/materials/MultiPointsMaterial.d.ts +1 -1
  149. package/dist/materials/MultiPointsMaterial.d.ts.map +1 -1
  150. package/dist/materials/MultiPointsMaterial.js +46 -45
  151. package/dist/materials/MultiPointsMaterial.js.map +1 -1
  152. package/dist/materials/SpecularGlossinessMaterial.d.ts +2 -2
  153. package/dist/materials/SpecularGlossinessMaterial.d.ts.map +1 -1
  154. package/dist/materials/SpecularGlossinessMaterial.js +47 -47
  155. package/dist/materials/SpecularGlossinessMaterial.js.map +1 -1
  156. package/dist/objects/SDBone.d.ts +3 -3
  157. package/dist/objects/SDBone.d.ts.map +1 -1
  158. package/dist/objects/SDBone.js.map +1 -1
  159. package/dist/objects/SDColor.d.ts +2 -2
  160. package/dist/objects/SDColor.d.ts.map +1 -1
  161. package/dist/objects/SDColor.js +15 -11
  162. package/dist/objects/SDColor.js.map +1 -1
  163. package/dist/objects/SDData.d.ts +1 -1
  164. package/dist/objects/SDData.d.ts.map +1 -1
  165. package/dist/objects/SDData.js.map +1 -1
  166. package/dist/objects/SDObject.d.ts +3 -3
  167. package/dist/objects/SDObject.d.ts.map +1 -1
  168. package/dist/objects/SDObject.js.map +1 -1
  169. package/dist/shaders/PCSS.d.ts.map +1 -1
  170. package/dist/shaders/PCSS.js.map +1 -1
  171. package/dist/shaders/gem.d.ts.map +1 -1
  172. package/dist/shaders/gem.js.map +1 -1
  173. package/dist/three/CSS2DRenderer.d.ts +1 -1
  174. package/dist/three/CSS2DRenderer.d.ts.map +1 -1
  175. package/dist/three/CSS2DRenderer.js +33 -17
  176. package/dist/three/CSS2DRenderer.js.map +1 -1
  177. package/dist/three/geometries/TextGeometry.d.ts +1 -1
  178. package/dist/three/geometries/TextGeometry.d.ts.map +1 -1
  179. package/dist/three/geometries/TextGeometry.js +3 -2
  180. package/dist/three/geometries/TextGeometry.js.map +1 -1
  181. package/dist/three/loaders/RGBELoader.d.ts +1 -1
  182. package/dist/three/loaders/RGBELoader.d.ts.map +1 -1
  183. package/dist/three/loaders/RGBELoader.js +59 -46
  184. package/dist/three/loaders/RGBELoader.js.map +1 -1
  185. package/dist/types/IThreejsData.d.ts +2 -2
  186. package/dist/types/IThreejsData.d.ts.map +1 -1
  187. package/dist/types/ThreejsData.d.ts +3 -3
  188. package/dist/types/ThreejsData.d.ts.map +1 -1
  189. package/dist/types/ThreejsData.js.map +1 -1
  190. package/package.json +63 -63
@@ -33,20 +33,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  exports.PostProcessingManager = void 0;
36
+ const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
37
+ const viewer_shared_types_1 = require("@shapediver/viewer.shared.types");
38
+ const gl_matrix_1 = require("gl-matrix");
39
+ const postprocessing_1 = require("postprocessing");
36
40
  const THREE = __importStar(require("three"));
37
41
  const IPostProcessingEffectDefinitions_1 = require("../interfaces/IPostProcessingEffectDefinitions");
38
- const postprocessing_1 = require("postprocessing");
39
- const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
40
- const GodRaysManager_1 = require("./postprocessing/GodRaysManager");
41
42
  const HBAOEffect_1 = require("./postprocessing/ao/hbao/HBAOEffect");
42
- const viewer_shared_types_1 = require("@shapediver/viewer.shared.types");
43
- const OutlineManager_1 = require("./postprocessing/OutlineManager");
44
43
  const PoissionDenoisePass_1 = require("./postprocessing/ao/poissionDenoise/PoissionDenoisePass");
45
- const SelectiveBloomManager_1 = require("./postprocessing/SelectiveBloomManager");
46
- const SSAARenderPass_1 = require("./postprocessing/SSAARenderPass");
47
44
  const SSAOEffect_1 = require("./postprocessing/ao/ssao/SSAOEffect");
48
- const gl_matrix_1 = require("gl-matrix");
49
45
  const ToneMappingEffect_1 = require("./postprocessing/effects/tone-mapping/ToneMappingEffect");
46
+ const GodRaysManager_1 = require("./postprocessing/GodRaysManager");
47
+ const OutlineManager_1 = require("./postprocessing/OutlineManager");
48
+ const SelectiveBloomManager_1 = require("./postprocessing/SelectiveBloomManager");
49
+ const SSAARenderPass_1 = require("./postprocessing/SSAARenderPass");
50
50
  class PostProcessingManager {
51
51
  // #endregion Properties (23)
52
52
  // #region Constructors (1)
@@ -59,7 +59,7 @@ class PostProcessingManager {
59
59
  this._uuidGenerator = viewer_shared_services_1.UuidGenerator.instance;
60
60
  this._antiAliasingTechnique = IPostProcessingEffectDefinitions_1.ANTI_ALIASING_TECHNIQUE.SMAA;
61
61
  this._antiAliasingTechniqueMobile = IPostProcessingEffectDefinitions_1.ANTI_ALIASING_TECHNIQUE.FXAA;
62
- this._currentCameraId = '';
62
+ this._currentCameraId = "";
63
63
  this._effectDefinitions = [];
64
64
  this._effects = [];
65
65
  this._enablePostProcessingOnMobile = true;
@@ -160,7 +160,8 @@ class PostProcessingManager {
160
160
  break;
161
161
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.SELECTIVE_BLOOM:
162
162
  if (!this._selectiveBloomManagers[token])
163
- this._selectiveBloomManagers[token] = new SelectiveBloomManager_1.SelectiveBloomManager(this._renderingEngine);
163
+ this._selectiveBloomManagers[token] =
164
+ new SelectiveBloomManager_1.SelectiveBloomManager(this._renderingEngine);
164
165
  break;
165
166
  default:
166
167
  }
@@ -169,13 +170,18 @@ class PostProcessingManager {
169
170
  }
170
171
  applySettings(settingsEngine) {
171
172
  this._suspendEffectPassUpdate = true;
172
- this.antiAliasingTechnique = settingsEngine.settings.postprocessing.antiAliasingTechnique;
173
- this.antiAliasingTechniqueMobile = settingsEngine.settings.postprocessing.antiAliasingTechniqueMobile;
173
+ this.antiAliasingTechnique = settingsEngine.settings.postprocessing
174
+ .antiAliasingTechnique;
175
+ this.antiAliasingTechniqueMobile = settingsEngine.settings
176
+ .postprocessing
177
+ .antiAliasingTechniqueMobile;
174
178
  // we don't allow SSAA on mobile devices anymore as it is too slow
175
179
  if (this._antiAliasingTechniqueMobile === IPostProcessingEffectDefinitions_1.ANTI_ALIASING_TECHNIQUE.SSAA)
176
180
  this._antiAliasingTechniqueMobile = IPostProcessingEffectDefinitions_1.ANTI_ALIASING_TECHNIQUE.SMAA;
177
- this.enablePostProcessingOnMobile = settingsEngine.settings.postprocessing.enablePostProcessingOnMobile;
178
- this.ssaaSampleLevel = settingsEngine.settings.postprocessing.ssaaSampleLevel;
181
+ this.enablePostProcessingOnMobile =
182
+ settingsEngine.settings.postprocessing.enablePostProcessingOnMobile;
183
+ this.ssaaSampleLevel =
184
+ settingsEngine.settings.postprocessing.ssaaSampleLevel;
179
185
  this._effectDefinitions = [];
180
186
  const effects = settingsEngine.settings.postprocessing.effects;
181
187
  for (let i = 0; i < effects.length; i++) {
@@ -184,8 +190,8 @@ class PostProcessingManager {
184
190
  token,
185
191
  definition: {
186
192
  type: effects[i].type,
187
- properties: effects[i].properties
188
- }
193
+ properties: effects[i].properties,
194
+ },
189
195
  });
190
196
  }
191
197
  this._suspendEffectPassUpdate = false;
@@ -196,14 +202,17 @@ class PostProcessingManager {
196
202
  return;
197
203
  if (this._suspendEffectPassUpdate === true)
198
204
  return;
199
- if (this._systemInfo.isMobile === true && this._enablePostProcessingOnMobile === false)
205
+ if (this._systemInfo.isMobile === true &&
206
+ this._enablePostProcessingOnMobile === false)
200
207
  return;
201
208
  if (this._manualPostProcessing)
202
209
  return;
203
210
  for (let i = 0; i < this._composer.passes.length; i++)
204
211
  this._composer.passes[i].dispose();
205
212
  this._composer.removeAllPasses();
206
- const antiAliasingTechnique = this._systemInfo.isMobile === true ? this._antiAliasingTechniqueMobile : this._antiAliasingTechnique;
213
+ const antiAliasingTechnique = this._systemInfo.isMobile === true
214
+ ? this._antiAliasingTechniqueMobile
215
+ : this._antiAliasingTechnique;
207
216
  if (antiAliasingTechnique === IPostProcessingEffectDefinitions_1.ANTI_ALIASING_TECHNIQUE.SSAA) {
208
217
  this.addPassToEffectComposer(this._ssaaRenderPass);
209
218
  }
@@ -211,13 +220,15 @@ class PostProcessingManager {
211
220
  this.addPassToEffectComposer(this._renderPass);
212
221
  }
213
222
  // remove the effects where the tokens are not in the effectDefinitions
214
- this._effects.forEach(e => e.effect.dispose());
223
+ this._effects.forEach((e) => e.effect.dispose());
215
224
  this._effects = [];
216
225
  for (let i = 0; i < this._effectDefinitions.length; i++) {
217
226
  switch (this._effectDefinitions[i].definition.type) {
218
227
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.BLOOM:
219
228
  {
220
- const definition = this._effectDefinitions[i].definition;
229
+ const definition = this
230
+ ._effectDefinitions[i]
231
+ .definition;
221
232
  const properties = definition.properties || {};
222
233
  this._effects.push({
223
234
  token: this._effectDefinitions[i].token,
@@ -227,63 +238,90 @@ class PostProcessingManager {
227
238
  luminanceSmoothing: properties.luminanceSmoothing,
228
239
  mipmapBlur: properties.mipmapBlur,
229
240
  intensity: properties.intensity,
230
- kernelSize: properties.kernelSize
231
- })
241
+ kernelSize: properties.kernelSize,
242
+ }),
232
243
  });
233
244
  }
234
245
  break;
235
246
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.CHROMATIC_ABERRATION:
236
247
  {
237
- const definition = this._effectDefinitions[i].definition;
248
+ const definition = this._effectDefinitions[i]
249
+ .definition;
238
250
  const properties = definition.properties || {};
239
- const offsetArray = properties.offset !== undefined ? Array.isArray(properties.offset) ? properties.offset : [properties.offset.x, properties.offset.y] : undefined;
251
+ const offsetArray = properties.offset !== undefined
252
+ ? Array.isArray(properties.offset)
253
+ ? properties.offset
254
+ : [
255
+ properties.offset.x,
256
+ properties.offset.y,
257
+ ]
258
+ : undefined;
240
259
  this._effects.push({
241
260
  token: this._effectDefinitions[i].token,
242
261
  effect: new postprocessing_1.ChromaticAberrationEffect({
243
262
  blendFunction: properties.blendFunction,
244
- offset: offsetArray ? new THREE.Vector2(...offsetArray) : undefined,
245
- radialModulation: properties.radialModulation !== undefined ? properties.radialModulation : false,
246
- modulationOffset: properties.modulationOffset !== undefined ? properties.modulationOffset : 0.15
247
- })
263
+ offset: offsetArray
264
+ ? new THREE.Vector2(...offsetArray)
265
+ : undefined,
266
+ radialModulation: properties.radialModulation !== undefined
267
+ ? properties.radialModulation
268
+ : false,
269
+ modulationOffset: properties.modulationOffset !== undefined
270
+ ? properties.modulationOffset
271
+ : 0.15,
272
+ }),
248
273
  });
249
274
  }
250
275
  break;
251
276
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.DEPTH_OF_FIELD:
252
277
  {
253
- const definition = this._effectDefinitions[i].definition;
278
+ const definition = this
279
+ ._effectDefinitions[i]
280
+ .definition;
254
281
  const properties = definition.properties || {};
255
282
  const depthOfFieldEffect = new postprocessing_1.DepthOfFieldEffect(this._renderingEngine.camera, {
256
283
  blendFunction: properties.blendFunction,
257
- focusDistance: properties.focusDistance !== undefined ? properties.focusDistance : 0,
258
- focusRange: properties.focusRange !== undefined ? properties.focusRange : 0.01,
259
- bokehScale: properties.bokehScale !== undefined ? properties.bokehScale : 5,
260
- resolutionScale: 1
284
+ focusDistance: properties.focusDistance !== undefined
285
+ ? properties.focusDistance
286
+ : 0,
287
+ focusRange: properties.focusRange !== undefined
288
+ ? properties.focusRange
289
+ : 0.01,
290
+ bokehScale: properties.bokehScale !== undefined
291
+ ? properties.bokehScale
292
+ : 5,
293
+ resolutionScale: 1,
261
294
  });
262
295
  depthOfFieldEffect.resolution.height = 1080;
263
- depthOfFieldEffect.blurPass.kernelSize = postprocessing_1.KernelSize.HUGE;
296
+ depthOfFieldEffect.blurPass.kernelSize =
297
+ postprocessing_1.KernelSize.HUGE;
264
298
  this._effects.push({
265
299
  token: this._effectDefinitions[i].token,
266
- effect: depthOfFieldEffect
300
+ effect: depthOfFieldEffect,
267
301
  });
268
302
  }
269
303
  break;
270
304
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.DOT_SCREEN:
271
305
  {
272
- const definition = this._effectDefinitions[i].definition;
306
+ const definition = this
307
+ ._effectDefinitions[i]
308
+ .definition;
273
309
  const properties = definition.properties || {};
274
310
  this._effects.push({
275
311
  token: this._effectDefinitions[i].token,
276
312
  effect: new postprocessing_1.DotScreenEffect({
277
313
  blendFunction: properties.blendFunction,
278
314
  scale: properties.scale,
279
- angle: properties.angle
280
- })
315
+ angle: properties.angle,
316
+ }),
281
317
  });
282
318
  }
283
319
  break;
284
320
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.GOD_RAYS:
285
321
  {
286
- const definition = this._effectDefinitions[i].definition;
322
+ const definition = this
323
+ ._effectDefinitions[i]
324
+ .definition;
287
325
  const properties = definition.properties || {};
288
326
  const godRaysEffect = new postprocessing_1.GodRaysEffect(this._renderingEngine.camera, new THREE.Mesh(), {
289
327
  blendFunction: properties.blendFunction,
@@ -293,167 +331,255 @@ class PostProcessingManager {
293
331
  exposure: properties.exposure,
294
332
  clampMax: properties.clampMax,
295
333
  kernelSize: properties.kernelSize,
296
- blur: properties.blur
334
+ blur: properties.blur,
297
335
  });
298
336
  this._effects.push({
299
337
  token: this._effectDefinitions[i].token,
300
- effect: godRaysEffect
338
+ effect: godRaysEffect,
301
339
  });
302
340
  this._godRaysManagers[this._effectDefinitions[i].token].setEffect(godRaysEffect);
303
341
  }
304
342
  break;
305
343
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.GRID:
306
344
  {
307
- const definition = this._effectDefinitions[i].definition;
345
+ const definition = this
346
+ ._effectDefinitions[i]
347
+ .definition;
308
348
  const properties = definition.properties || {};
309
349
  this._effects.push({
310
350
  token: this._effectDefinitions[i].token,
311
351
  effect: new postprocessing_1.GridEffect({
312
- blendFunction: properties.blendFunction !== undefined ? properties.blendFunction : postprocessing_1.BlendFunction.MULTIPLY,
313
- scale: properties.scale
314
- })
352
+ blendFunction: properties.blendFunction !== undefined
353
+ ? properties.blendFunction
354
+ : postprocessing_1.BlendFunction.MULTIPLY,
355
+ scale: properties.scale,
356
+ }),
315
357
  });
316
358
  }
317
359
  break;
318
360
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.HBAO:
319
361
  {
320
362
  // we currently do not support devices with WebGL 1: https://shapediver.atlassian.net/browse/SS-7069
321
- if (this._renderingEngine.renderer.capabilities.isWebGL2 === false)
363
+ if (this._renderingEngine.renderer.capabilities
364
+ .isWebGL2 === false)
322
365
  break;
323
- const definition = this._effectDefinitions[i].definition;
366
+ const definition = this
367
+ ._effectDefinitions[i]
368
+ .definition;
324
369
  const properties = definition.properties || {};
325
370
  // we adjust the scene size slightly to make the factor fit our requirements
326
371
  // with this adjusted factor, a distance value of 1 fits well as a default
327
372
  const sceneSizeFactor = this._sceneExtents / 10.0;
328
373
  const hbaoEffect = new HBAOEffect_1.HBAOEffect(this._composer, this._renderingEngine.camera, this._renderingEngine.scene, {
329
- resolutionScale: properties.resolutionScale !== undefined ? properties.resolutionScale : 1,
330
- spp: properties.spp !== undefined ? properties.spp : 16,
331
- distance: properties.distance !== undefined ? properties.distance * sceneSizeFactor : sceneSizeFactor,
332
- distancePower: properties.distanceIntensity !== undefined ? properties.distanceIntensity : 1,
333
- power: properties.intensity !== undefined ? properties.intensity : 2.5,
334
- bias: properties.bias !== undefined ? properties.bias : 10,
335
- thickness: properties.thickness !== undefined ? properties.thickness : 0.5,
336
- color: properties.color !== undefined ? new THREE.Color(this._converter.toHexColor(properties.color).substring(0, 7)) : new THREE.Color('black'),
337
- iterations: properties.iterations !== undefined ? properties.iterations : 1,
338
- radius: properties.radius !== undefined ? properties.radius : 12,
339
- rings: properties.rings !== undefined ? properties.rings : 11,
340
- lumaPhi: properties.lumaPhi !== undefined ? properties.lumaPhi : 10,
341
- depthPhi: properties.depthPhi !== undefined ? properties.depthPhi : 2,
342
- normalPhi: properties.normalPhi !== undefined ? properties.normalPhi : 3.25,
343
- samples: properties.samples !== undefined ? properties.samples : 16
374
+ resolutionScale: properties.resolutionScale !== undefined
375
+ ? properties.resolutionScale
376
+ : 1,
377
+ spp: properties.spp !== undefined
378
+ ? properties.spp
379
+ : 16,
380
+ distance: properties.distance !== undefined
381
+ ? properties.distance * sceneSizeFactor
382
+ : sceneSizeFactor,
383
+ distancePower: properties.distanceIntensity !== undefined
384
+ ? properties.distanceIntensity
385
+ : 1,
386
+ power: properties.intensity !== undefined
387
+ ? properties.intensity
388
+ : 2.5,
389
+ bias: properties.bias !== undefined
390
+ ? properties.bias
391
+ : 10,
392
+ thickness: properties.thickness !== undefined
393
+ ? properties.thickness
394
+ : 0.5,
395
+ color: properties.color !== undefined
396
+ ? new THREE.Color(this._converter
397
+ .toHexColor(properties.color)
398
+ .substring(0, 7))
399
+ : new THREE.Color("black"),
400
+ iterations: properties.iterations !== undefined
401
+ ? properties.iterations
402
+ : 1,
403
+ radius: properties.radius !== undefined
404
+ ? properties.radius
405
+ : 12,
406
+ rings: properties.rings !== undefined
407
+ ? properties.rings
408
+ : 11,
409
+ lumaPhi: properties.lumaPhi !== undefined
410
+ ? properties.lumaPhi
411
+ : 10,
412
+ depthPhi: properties.depthPhi !== undefined
413
+ ? properties.depthPhi
414
+ : 2,
415
+ normalPhi: properties.normalPhi !== undefined
416
+ ? properties.normalPhi
417
+ : 3.25,
418
+ samples: properties.samples !== undefined
419
+ ? properties.samples
420
+ : 16,
344
421
  });
345
422
  this._effects.push({
346
423
  token: this._effectDefinitions[i].token,
347
- effect: hbaoEffect
424
+ effect: hbaoEffect,
348
425
  });
349
426
  }
350
427
  break;
351
428
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.HUE_SATURATION:
352
429
  {
353
- const definition = this._effectDefinitions[i].definition;
430
+ const definition = this
431
+ ._effectDefinitions[i]
432
+ .definition;
354
433
  const properties = definition.properties || {};
355
434
  this._effects.push({
356
435
  token: this._effectDefinitions[i].token,
357
436
  effect: new postprocessing_1.HueSaturationEffect({
358
437
  blendFunction: properties.blendFunction,
359
438
  hue: properties.hue,
360
- saturation: properties.saturation
361
- })
439
+ saturation: properties.saturation,
440
+ }),
362
441
  });
363
442
  }
364
443
  break;
365
444
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.NOISE:
366
445
  {
367
- const definition = this._effectDefinitions[i].definition;
446
+ const definition = this
447
+ ._effectDefinitions[i]
448
+ .definition;
368
449
  const properties = definition.properties || {};
369
450
  this._effects.push({
370
451
  token: this._effectDefinitions[i].token,
371
452
  effect: new postprocessing_1.NoiseEffect({
372
453
  blendFunction: properties.blendFunction,
373
- premultiply: properties.premultiply
374
- })
454
+ premultiply: properties.premultiply,
455
+ }),
375
456
  });
376
457
  }
377
458
  break;
378
459
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.OUTLINE:
379
460
  {
380
- const definition = this._effectDefinitions[i].definition;
461
+ const definition = this
462
+ ._effectDefinitions[i]
463
+ .definition;
381
464
  const properties = definition.properties || {};
382
465
  const outlineEffect = new postprocessing_1.OutlineEffect(this._renderingEngine.scene, this._renderingEngine.camera, {
383
- blendFunction: properties.blendFunction !== undefined ? properties.blendFunction : postprocessing_1.BlendFunction.SCREEN,
466
+ blendFunction: properties.blendFunction !== undefined
467
+ ? properties.blendFunction
468
+ : postprocessing_1.BlendFunction.SCREEN,
384
469
  edgeStrength: properties.edgeStrength,
385
470
  pulseSpeed: properties.pulseSpeed,
386
- visibleEdgeColor: new THREE.Color(this._converter.toHexColor(properties.visibleEdgeColor).substring(0, 7)),
387
- hiddenEdgeColor: new THREE.Color(this._converter.toHexColor(properties.hiddenEdgeColor).substring(0, 7)),
471
+ visibleEdgeColor: (new THREE.Color(this._converter
472
+ .toHexColor(properties.visibleEdgeColor)
473
+ .substring(0, 7))),
474
+ hiddenEdgeColor: (new THREE.Color(this._converter
475
+ .toHexColor(properties.hiddenEdgeColor)
476
+ .substring(0, 7))),
388
477
  kernelSize: properties.kernelSize,
389
478
  blur: properties.blur,
390
479
  xRay: properties.xRay,
391
- multisampling: properties.multisampling
480
+ multisampling: properties.multisampling,
392
481
  });
393
482
  this._effects.push({
394
483
  token: this._effectDefinitions[i].token,
395
- effect: outlineEffect
484
+ effect: outlineEffect,
396
485
  });
397
486
  this._outlineManagers[this._effectDefinitions[i].token].setEffect(outlineEffect);
398
487
  }
399
488
  break;
400
489
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.PIXELATION:
401
490
  {
402
- const definition = this._effectDefinitions[i].definition;
491
+ const definition = this
492
+ ._effectDefinitions[i]
493
+ .definition;
403
494
  const properties = definition.properties || {};
404
495
  this._effects.push({
405
496
  token: this._effectDefinitions[i].token,
406
- effect: new postprocessing_1.PixelationEffect(properties.granularity)
497
+ effect: new postprocessing_1.PixelationEffect(properties.granularity),
407
498
  });
408
499
  }
409
500
  break;
410
501
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.SSAO:
411
502
  {
412
503
  // we currently do not support devices with WebGL 1: https://shapediver.atlassian.net/browse/SS-7069
413
- if (this._renderingEngine.renderer.capabilities.isWebGL2 === false)
504
+ if (this._renderingEngine.renderer.capabilities
505
+ .isWebGL2 === false)
414
506
  break;
415
- const definition = this._effectDefinitions[i].definition;
507
+ const definition = this
508
+ ._effectDefinitions[i]
509
+ .definition;
416
510
  const properties = definition.properties || {};
417
511
  // we adjust the scene size slightly to make the factor fit our requirements
418
512
  // with this adjusted factor, a distance value of 1 fits well as a default
419
513
  const sceneSizeFactor = this._sceneExtents / 50.0;
420
514
  const ssaoEffect = new SSAOEffect_1.SSAOEffect(this._composer, this._renderingEngine.camera, this._renderingEngine.scene, {
421
- resolutionScale: properties.resolutionScale !== undefined ? properties.resolutionScale : 1,
422
- spp: properties.spp !== undefined ? properties.spp : 16,
423
- distance: properties.distance !== undefined ? properties.distance * sceneSizeFactor : sceneSizeFactor,
424
- distancePower: properties.distanceIntensity !== undefined ? properties.distanceIntensity : 1,
425
- power: properties.intensity !== undefined ? properties.intensity : 2.5,
426
- color: properties.color !== undefined ? new THREE.Color(this._converter.toHexColor(properties.color).substring(0, 7)) : new THREE.Color('black'),
427
- iterations: properties.iterations !== undefined ? properties.iterations : 1,
428
- radius: properties.radius !== undefined ? properties.radius : 12,
429
- rings: properties.rings !== undefined ? properties.rings : 11,
430
- lumaPhi: properties.lumaPhi !== undefined ? properties.lumaPhi : 10,
431
- depthPhi: properties.depthPhi !== undefined ? properties.depthPhi : 2,
432
- normalPhi: properties.normalPhi !== undefined ? properties.normalPhi : 3.25,
433
- samples: properties.samples !== undefined ? properties.samples : 16
515
+ resolutionScale: properties.resolutionScale !== undefined
516
+ ? properties.resolutionScale
517
+ : 1,
518
+ spp: properties.spp !== undefined
519
+ ? properties.spp
520
+ : 16,
521
+ distance: properties.distance !== undefined
522
+ ? properties.distance * sceneSizeFactor
523
+ : sceneSizeFactor,
524
+ distancePower: properties.distanceIntensity !== undefined
525
+ ? properties.distanceIntensity
526
+ : 1,
527
+ power: properties.intensity !== undefined
528
+ ? properties.intensity
529
+ : 2.5,
530
+ color: properties.color !== undefined
531
+ ? new THREE.Color(this._converter
532
+ .toHexColor(properties.color)
533
+ .substring(0, 7))
534
+ : new THREE.Color("black"),
535
+ iterations: properties.iterations !== undefined
536
+ ? properties.iterations
537
+ : 1,
538
+ radius: properties.radius !== undefined
539
+ ? properties.radius
540
+ : 12,
541
+ rings: properties.rings !== undefined
542
+ ? properties.rings
543
+ : 11,
544
+ lumaPhi: properties.lumaPhi !== undefined
545
+ ? properties.lumaPhi
546
+ : 10,
547
+ depthPhi: properties.depthPhi !== undefined
548
+ ? properties.depthPhi
549
+ : 2,
550
+ normalPhi: properties.normalPhi !== undefined
551
+ ? properties.normalPhi
552
+ : 3.25,
553
+ samples: properties.samples !== undefined
554
+ ? properties.samples
555
+ : 16,
434
556
  });
435
557
  this._effects.push({
436
558
  token: this._effectDefinitions[i].token,
437
- effect: ssaoEffect
559
+ effect: ssaoEffect,
438
560
  });
439
561
  }
440
562
  break;
441
563
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.SCANLINE:
442
564
  {
443
- const definition = this._effectDefinitions[i].definition;
565
+ const definition = this
566
+ ._effectDefinitions[i]
567
+ .definition;
444
568
  const properties = definition.properties || {};
445
569
  this._effects.push({
446
570
  token: this._effectDefinitions[i].token,
447
571
  effect: new postprocessing_1.ScanlineEffect({
448
572
  blendFunction: properties.blendFunction,
449
- density: properties.density
450
- })
573
+ density: properties.density,
574
+ }),
451
575
  });
452
576
  }
453
577
  break;
454
578
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.SELECTIVE_BLOOM:
455
579
  {
456
- const definition = this._effectDefinitions[i].definition;
580
+ const definition = this
581
+ ._effectDefinitions[i]
582
+ .definition;
457
583
  const properties = definition.properties || {};
458
584
  const selectiveBloomEffect = new postprocessing_1.SelectiveBloomEffect(this._renderingEngine.scene, this._renderingEngine.camera, {
459
585
  blendFunction: properties.blendFunction,
@@ -461,31 +587,38 @@ class PostProcessingManager {
461
587
  luminanceThreshold: properties.luminanceThreshold,
462
588
  luminanceSmoothing: properties.luminanceSmoothing,
463
589
  intensity: properties.intensity,
464
- kernelSize: properties.kernelSize
590
+ kernelSize: properties.kernelSize,
465
591
  });
466
- selectiveBloomEffect.ignoreBackground = properties.ignoreBackground !== undefined ? properties.ignoreBackground : true;
592
+ selectiveBloomEffect.ignoreBackground =
593
+ properties.ignoreBackground !== undefined
594
+ ? properties.ignoreBackground
595
+ : true;
467
596
  this._effects.push({
468
597
  token: this._effectDefinitions[i].token,
469
- effect: selectiveBloomEffect
598
+ effect: selectiveBloomEffect,
470
599
  });
471
600
  this._selectiveBloomManagers[this._effectDefinitions[i].token].setEffect(selectiveBloomEffect);
472
601
  }
473
602
  break;
474
603
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.SEPIA:
475
604
  {
476
- const definition = this._effectDefinitions[i].definition;
605
+ const definition = this
606
+ ._effectDefinitions[i]
607
+ .definition;
477
608
  const properties = definition.properties || {};
478
609
  this._effects.push({
479
610
  token: this._effectDefinitions[i].token,
480
611
  effect: new postprocessing_1.SepiaEffect({
481
- blendFunction: properties.blendFunction
482
- })
612
+ blendFunction: properties.blendFunction,
613
+ }),
483
614
  });
484
615
  }
485
616
  break;
486
617
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.TILT_SHIFT:
487
618
  {
488
- const definition = this._effectDefinitions[i].definition;
619
+ const definition = this
620
+ ._effectDefinitions[i]
621
+ .definition;
489
622
  const properties = definition.properties || {};
490
623
  this._effects.push({
491
624
  token: this._effectDefinitions[i].token,
@@ -495,14 +628,16 @@ class PostProcessingManager {
495
628
  rotation: properties.rotation,
496
629
  focusArea: properties.focusArea,
497
630
  feather: properties.feather,
498
- kernelSize: properties.kernelSize
499
- })
631
+ kernelSize: properties.kernelSize,
632
+ }),
500
633
  });
501
634
  }
502
635
  break;
503
636
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.VIGNETTE:
504
637
  {
505
- const definition = this._effectDefinitions[i].definition;
638
+ const definition = this
639
+ ._effectDefinitions[i]
640
+ .definition;
506
641
  const properties = definition.properties || {};
507
642
  this._effects.push({
508
643
  token: this._effectDefinitions[i].token,
@@ -511,7 +646,7 @@ class PostProcessingManager {
511
646
  technique: properties.technique,
512
647
  offset: properties.offset,
513
648
  darkness: properties.darkness,
514
- })
649
+ }),
515
650
  });
516
651
  }
517
652
  break;
@@ -519,20 +654,24 @@ class PostProcessingManager {
519
654
  }
520
655
  }
521
656
  // sort effects by order in effectDefinitions
522
- this._effects.sort((a, b) => this._effectDefinitions.indexOf(this._effectDefinitions.find(e => e.token === a.token)) - this._effectDefinitions.indexOf(this._effectDefinitions.find(e => e.token === b.token)));
523
- const effectArray = this._effects.map(v => v.effect);
657
+ this._effects.sort((a, b) => this._effectDefinitions.indexOf(this._effectDefinitions.find((e) => e.token === a.token)) -
658
+ this._effectDefinitions.indexOf(this._effectDefinitions.find((e) => e.token === b.token)));
659
+ const effectArray = this._effects.map((v) => v.effect);
524
660
  if (antiAliasingTechnique === IPostProcessingEffectDefinitions_1.ANTI_ALIASING_TECHNIQUE.FXAA) {
525
661
  effectArray.unshift(this._fxaaEffect);
526
662
  }
527
663
  else if (antiAliasingTechnique === IPostProcessingEffectDefinitions_1.ANTI_ALIASING_TECHNIQUE.SMAA) {
528
664
  effectArray.unshift(this._smaaEffect);
529
665
  }
530
- this._effectPass = new postprocessing_1.EffectPass(this._renderingEngine.camera, ...this._effects.map(v => v.effect));
666
+ this._effectPass = new postprocessing_1.EffectPass(this._renderingEngine.camera, ...this._effects.map((v) => v.effect));
531
667
  this.addPassToEffectComposer(this._effectPass);
532
668
  // for the AO effects we need to add a separate AA pass at the end that anti-aliases the AO effect
533
- if (this._effectDefinitions.find(e => e.definition.type === IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.HBAO || e.definition.type === IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.SSAO)) {
669
+ if (this._effectDefinitions.find((e) => e.definition.type === IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.HBAO ||
670
+ e.definition.type === IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.SSAO)) {
534
671
  // respect the AA choice if one of the effects was selected, use SMAA otherwise
535
- this.addPassToEffectComposer(new postprocessing_1.EffectPass(this._renderingEngine.camera, antiAliasingTechnique === IPostProcessingEffectDefinitions_1.ANTI_ALIASING_TECHNIQUE.FXAA ? this._fxaaEffect : this._smaaEffect));
672
+ this.addPassToEffectComposer(new postprocessing_1.EffectPass(this._renderingEngine.camera, antiAliasingTechnique === IPostProcessingEffectDefinitions_1.ANTI_ALIASING_TECHNIQUE.FXAA
673
+ ? this._fxaaEffect
674
+ : this._smaaEffect));
536
675
  }
537
676
  if (this._renderingEngine.toneMapping !== viewer_shared_types_1.TONE_MAPPING.NONE) {
538
677
  const mode = (() => {
@@ -606,7 +745,7 @@ class PostProcessingManager {
606
745
  distance: 1,
607
746
  distanceIntensity: 1,
608
747
  intensity: 2.5,
609
- color: '#000000',
748
+ color: "#000000",
610
749
  bias: 10,
611
750
  thickness: 0.5,
612
751
  iterations: 1,
@@ -633,12 +772,12 @@ class PostProcessingManager {
633
772
  blendFunction: postprocessing_1.BlendFunction.SCREEN,
634
773
  blur: false,
635
774
  edgeStrength: 1.0,
636
- hiddenEdgeColor: '#22090a',
775
+ hiddenEdgeColor: "#22090a",
637
776
  kernelSize: postprocessing_1.KernelSize.VERY_SMALL,
638
777
  multisampling: 0,
639
778
  pulseSpeed: 0.0,
640
779
  resolution: 480,
641
- visibleEdgeColor: '#ffffff',
780
+ visibleEdgeColor: "#ffffff",
642
781
  xRay: true,
643
782
  };
644
783
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.PIXELATION:
@@ -652,7 +791,7 @@ class PostProcessingManager {
652
791
  distance: 1,
653
792
  distanceIntensity: 1,
654
793
  intensity: 2.5,
655
- color: '#000000',
794
+ color: "#000000",
656
795
  iterations: 1,
657
796
  radius: 12,
658
797
  rings: 11,
@@ -712,10 +851,12 @@ class PostProcessingManager {
712
851
  });
713
852
  }
714
853
  getEffect(token) {
715
- return this._effects.find(e => e.token === token).effect;
854
+ return this._effects.find((e) => e.token === token).effect;
716
855
  }
717
856
  getEffectTokens() {
718
- return Object.assign({}, ...this._effectDefinitions.map((e) => ({ [e.token]: e.definition.type })));
857
+ return Object.assign({}, ...this._effectDefinitions.map((e) => ({
858
+ [e.token]: e.definition.type,
859
+ })));
719
860
  }
720
861
  getPostProcessingEffectsArray() {
721
862
  const effects = [];
@@ -723,7 +864,9 @@ class PostProcessingManager {
723
864
  switch (this._effectDefinitions[i].definition.type) {
724
865
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.BLOOM:
725
866
  {
726
- const definition = this._effectDefinitions[i].definition;
867
+ const definition = this
868
+ ._effectDefinitions[i]
869
+ .definition;
727
870
  const properties = definition.properties || {};
728
871
  effects.push({
729
872
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.BLOOM,
@@ -734,30 +877,40 @@ class PostProcessingManager {
734
877
  luminanceSmoothing: properties.luminanceSmoothing,
735
878
  mipmapBlur: properties.mipmapBlur,
736
879
  intensity: properties.intensity,
737
- kernelSize: properties.kernelSize
738
- }
880
+ kernelSize: properties.kernelSize,
881
+ },
739
882
  });
740
883
  }
741
884
  break;
742
885
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.CHROMATIC_ABERRATION:
743
886
  {
744
- const definition = this._effectDefinitions[i].definition;
887
+ const definition = this._effectDefinitions[i]
888
+ .definition;
745
889
  const properties = definition.properties || {};
746
890
  effects.push({
747
891
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.CHROMATIC_ABERRATION,
748
892
  token: this._effectDefinitions[i].token,
749
893
  properties: {
750
894
  blendFunction: properties.blendFunction,
751
- offset: properties.offset ? Array.isArray(properties.offset) ? { x: properties.offset[0], y: properties.offset[1] } : properties.offset : undefined,
895
+ offset: properties.offset
896
+ ? Array.isArray(properties.offset)
897
+ ? {
898
+ x: properties.offset[0],
899
+ y: properties.offset[1],
900
+ }
901
+ : properties.offset
902
+ : undefined,
752
903
  radialModulation: properties.radialModulation,
753
- modulationOffset: properties.modulationOffset
754
- }
904
+ modulationOffset: properties.modulationOffset,
905
+ },
755
906
  });
756
907
  }
757
908
  break;
758
909
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.DEPTH_OF_FIELD:
759
910
  {
760
- const definition = this._effectDefinitions[i].definition;
911
+ const definition = this
912
+ ._effectDefinitions[i]
913
+ .definition;
761
914
  const properties = definition.properties || {};
762
915
  effects.push({
763
916
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.DEPTH_OF_FIELD,
@@ -766,14 +919,16 @@ class PostProcessingManager {
766
919
  blendFunction: properties.blendFunction,
767
920
  focusDistance: properties.focusDistance,
768
921
  focusRange: properties.focusRange,
769
- bokehScale: properties.bokehScale
770
- }
922
+ bokehScale: properties.bokehScale,
923
+ },
771
924
  });
772
925
  }
773
926
  break;
774
927
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.DOT_SCREEN:
775
928
  {
776
- const definition = this._effectDefinitions[i].definition;
929
+ const definition = this
930
+ ._effectDefinitions[i]
931
+ .definition;
777
932
  const properties = definition.properties || {};
778
933
  effects.push({
779
934
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.DOT_SCREEN,
@@ -781,28 +936,32 @@ class PostProcessingManager {
781
936
  properties: {
782
937
  blendFunction: properties.blendFunction,
783
938
  scale: properties.scale,
784
- angle: properties.angle
785
- }
939
+ angle: properties.angle,
940
+ },
786
941
  });
787
942
  }
788
943
  break;
789
944
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.GRID:
790
945
  {
791
- const definition = this._effectDefinitions[i].definition;
946
+ const definition = this
947
+ ._effectDefinitions[i]
948
+ .definition;
792
949
  const properties = definition.properties || {};
793
950
  effects.push({
794
951
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.GRID,
795
952
  token: this._effectDefinitions[i].token,
796
953
  properties: {
797
954
  blendFunction: properties.blendFunction,
798
- scale: properties.scale
799
- }
955
+ scale: properties.scale,
956
+ },
800
957
  });
801
958
  }
802
959
  break;
803
960
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.HBAO:
804
961
  {
805
- const definition = this._effectDefinitions[i].definition;
962
+ const definition = this
963
+ ._effectDefinitions[i]
964
+ .definition;
806
965
  const properties = definition.properties || {};
807
966
  effects.push({
808
967
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.HBAO,
@@ -815,21 +974,25 @@ class PostProcessingManager {
815
974
  intensity: properties.intensity,
816
975
  bias: properties.bias,
817
976
  thickness: properties.thickness,
818
- color: properties.color !== undefined ? this._converter.toHexColor(properties.color) : undefined,
977
+ color: properties.color !== undefined
978
+ ? this._converter.toHexColor(properties.color)
979
+ : undefined,
819
980
  iterations: properties.iterations,
820
981
  radius: properties.radius,
821
982
  rings: properties.rings,
822
983
  lumaPhi: properties.lumaPhi,
823
984
  depthPhi: properties.depthPhi,
824
985
  normalPhi: properties.normalPhi,
825
- samples: properties.samples
826
- }
986
+ samples: properties.samples,
987
+ },
827
988
  });
828
989
  }
829
990
  break;
830
991
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.HUE_SATURATION:
831
992
  {
832
- const definition = this._effectDefinitions[i].definition;
993
+ const definition = this
994
+ ._effectDefinitions[i]
995
+ .definition;
833
996
  const properties = definition.properties || {};
834
997
  effects.push({
835
998
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.HUE_SATURATION,
@@ -837,41 +1000,47 @@ class PostProcessingManager {
837
1000
  properties: {
838
1001
  blendFunction: properties.blendFunction,
839
1002
  hue: properties.hue,
840
- saturation: properties.saturation
841
- }
1003
+ saturation: properties.saturation,
1004
+ },
842
1005
  });
843
1006
  }
844
1007
  break;
845
1008
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.NOISE:
846
1009
  {
847
- const definition = this._effectDefinitions[i].definition;
1010
+ const definition = this
1011
+ ._effectDefinitions[i]
1012
+ .definition;
848
1013
  const properties = definition.properties || {};
849
1014
  effects.push({
850
1015
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.NOISE,
851
1016
  token: this._effectDefinitions[i].token,
852
1017
  properties: {
853
1018
  blendFunction: properties.blendFunction,
854
- premultiply: properties.premultiply
855
- }
1019
+ premultiply: properties.premultiply,
1020
+ },
856
1021
  });
857
1022
  }
858
1023
  break;
859
1024
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.PIXELATION:
860
1025
  {
861
- const definition = this._effectDefinitions[i].definition;
1026
+ const definition = this
1027
+ ._effectDefinitions[i]
1028
+ .definition;
862
1029
  const properties = definition.properties || {};
863
1030
  effects.push({
864
1031
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.PIXELATION,
865
1032
  token: this._effectDefinitions[i].token,
866
1033
  properties: {
867
- granularity: properties.granularity
868
- }
1034
+ granularity: properties.granularity,
1035
+ },
869
1036
  });
870
1037
  }
871
1038
  break;
872
1039
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.SSAO:
873
1040
  {
874
- const definition = this._effectDefinitions[i].definition;
1041
+ const definition = this
1042
+ ._effectDefinitions[i]
1043
+ .definition;
875
1044
  const properties = definition.properties || {};
876
1045
  effects.push({
877
1046
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.SSAO,
@@ -882,48 +1051,56 @@ class PostProcessingManager {
882
1051
  distance: properties.distance,
883
1052
  distanceIntensity: properties.distanceIntensity,
884
1053
  intensity: properties.intensity,
885
- color: properties.color !== undefined ? this._converter.toHexColor(properties.color) : undefined,
1054
+ color: properties.color !== undefined
1055
+ ? this._converter.toHexColor(properties.color)
1056
+ : undefined,
886
1057
  iterations: properties.iterations,
887
1058
  radius: properties.radius,
888
1059
  rings: properties.rings,
889
1060
  lumaPhi: properties.lumaPhi,
890
1061
  depthPhi: properties.depthPhi,
891
1062
  normalPhi: properties.normalPhi,
892
- samples: properties.samples
893
- }
1063
+ samples: properties.samples,
1064
+ },
894
1065
  });
895
1066
  }
896
1067
  break;
897
1068
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.SCANLINE:
898
1069
  {
899
- const definition = this._effectDefinitions[i].definition;
1070
+ const definition = this
1071
+ ._effectDefinitions[i]
1072
+ .definition;
900
1073
  const properties = definition.properties || {};
901
1074
  effects.push({
902
1075
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.SCANLINE,
903
1076
  token: this._effectDefinitions[i].token,
904
1077
  properties: {
905
1078
  blendFunction: properties.blendFunction,
906
- density: properties.density
907
- }
1079
+ density: properties.density,
1080
+ },
908
1081
  });
909
1082
  }
910
1083
  break;
911
1084
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.SEPIA:
912
1085
  {
913
- const definition = this._effectDefinitions[i].definition;
1086
+ const definition = this
1087
+ ._effectDefinitions[i]
1088
+ .definition;
914
1089
  const properties = definition.properties || {};
915
1090
  effects.push({
916
1091
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.SEPIA,
917
1092
  token: this._effectDefinitions[i].token,
918
1093
  properties: {
919
- blendFunction: properties.blendFunction
920
- }
1094
+ blendFunction: properties.blendFunction,
1095
+ },
921
1096
  });
922
1097
  }
923
1098
  break;
924
1099
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.TILT_SHIFT:
925
1100
  {
926
- const definition = this._effectDefinitions[i].definition;
1101
+ const definition = this
1102
+ ._effectDefinitions[i]
1103
+ .definition;
927
1104
  const properties = definition.properties || {};
928
1105
  effects.push({
929
1106
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.TILT_SHIFT,
@@ -934,14 +1111,16 @@ class PostProcessingManager {
934
1111
  rotation: properties.rotation,
935
1112
  focusArea: properties.focusArea,
936
1113
  feather: properties.feather,
937
- kernelSize: properties.kernelSize
938
- }
1114
+ kernelSize: properties.kernelSize,
1115
+ },
939
1116
  });
940
1117
  }
941
1118
  break;
942
1119
  case IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.VIGNETTE:
943
1120
  {
944
- const definition = this._effectDefinitions[i].definition;
1121
+ const definition = this
1122
+ ._effectDefinitions[i]
1123
+ .definition;
945
1124
  const properties = definition.properties || {};
946
1125
  effects.push({
947
1126
  type: IPostProcessingEffectDefinitions_1.POST_PROCESSING_EFFECT_TYPE.VIGNETTE,
@@ -951,7 +1130,7 @@ class PostProcessingManager {
951
1130
  technique: properties.technique,
952
1131
  offset: properties.offset,
953
1132
  darkness: properties.darkness,
954
- }
1133
+ },
955
1134
  });
956
1135
  }
957
1136
  break;
@@ -989,7 +1168,7 @@ class PostProcessingManager {
989
1168
  }
990
1169
  }
991
1170
  removeEffect(token) {
992
- const effectToRemove = this._effectDefinitions.find(e => e.token === token);
1171
+ const effectToRemove = this._effectDefinitions.find((e) => e.token === token);
993
1172
  if (effectToRemove)
994
1173
  this._effectDefinitions.splice(this._effectDefinitions.indexOf(effectToRemove), 1);
995
1174
  this.changeEffectPass();
@@ -998,14 +1177,16 @@ class PostProcessingManager {
998
1177
  render(deltaTime, camera) {
999
1178
  if (!this._composer)
1000
1179
  return;
1001
- const cameraId = `${camera.id}_${camera.type}${(camera.type === 'PerspectiveCamera' ? '' : '_' + camera.up.toArray().toString())}`;
1180
+ const cameraId = `${camera.id}_${camera.type}${camera.type === "PerspectiveCamera" ? "" : "_" + camera.up.toArray().toString()}`;
1002
1181
  if (cameraId !== this._currentCameraId) {
1003
1182
  this._currentCameraId = cameraId;
1004
1183
  this.changeEffectPass();
1005
1184
  }
1006
1185
  const currentToneMapping = this._renderingEngine.renderer.toneMapping;
1007
1186
  const currentClearColor = this._renderingEngine.renderer.getClearColor(new THREE.Color());
1008
- const convertedClearColor = currentClearColor.clone().convertSRGBToLinear();
1187
+ const convertedClearColor = currentClearColor
1188
+ .clone()
1189
+ .convertSRGBToLinear();
1009
1190
  this._renderingEngine.renderer.toneMapping = THREE.NoToneMapping;
1010
1191
  this._renderingEngine.renderer.setClearColor(convertedClearColor);
1011
1192
  this._renderingEngine.renderer.setClearAlpha(this._renderingEngine.clearAlpha);
@@ -1020,7 +1201,7 @@ class PostProcessingManager {
1020
1201
  var _a;
1021
1202
  if (!this._composer)
1022
1203
  return;
1023
- this.effects.forEach(e => {
1204
+ this.effects.forEach((e) => {
1024
1205
  if (e.effect.setSize)
1025
1206
  e.effect.setSize(width, height);
1026
1207
  });
@@ -1030,17 +1211,21 @@ class PostProcessingManager {
1030
1211
  this._composer.setSize(width, height);
1031
1212
  }
1032
1213
  saveSettings(settingsEngine) {
1033
- settingsEngine.settings.postprocessing.antiAliasingTechnique = this.antiAliasingTechnique;
1034
- settingsEngine.settings.postprocessing.antiAliasingTechniqueMobile = this.antiAliasingTechniqueMobile;
1035
- settingsEngine.settings.postprocessing.enablePostProcessingOnMobile = this.enablePostProcessingOnMobile;
1036
- settingsEngine.settings.postprocessing.ssaaSampleLevel = this.ssaaSampleLevel;
1214
+ settingsEngine.settings.postprocessing.antiAliasingTechnique =
1215
+ this.antiAliasingTechnique;
1216
+ settingsEngine.settings.postprocessing.antiAliasingTechniqueMobile =
1217
+ this.antiAliasingTechniqueMobile;
1218
+ settingsEngine.settings.postprocessing.enablePostProcessingOnMobile =
1219
+ this.enablePostProcessingOnMobile;
1220
+ settingsEngine.settings.postprocessing.ssaaSampleLevel =
1221
+ this.ssaaSampleLevel;
1037
1222
  const effects = this.getPostProcessingEffectsArray();
1038
1223
  // delete the tokens as we don't want to save them
1039
- effects.forEach(e => delete e.token);
1224
+ effects.forEach((e) => delete e.token);
1040
1225
  settingsEngine.settings.postprocessing.effects = effects;
1041
1226
  }
1042
1227
  updateEffect(token, definition) {
1043
- const effectDefinition = this._effectDefinitions.find(e => e.token === token);
1228
+ const effectDefinition = this._effectDefinitions.find((e) => e.token === token);
1044
1229
  if (!effectDefinition)
1045
1230
  return;
1046
1231
  this.removeEffect(token);