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