@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
package/dist/RenderingEngine.js
CHANGED
|
@@ -39,37 +39,37 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
39
39
|
var _RenderingEngine_defaultLogo, _RenderingEngine_defaultLogoStatic, _RenderingEngine_defaultSpinner, _RenderingEngine_animations, _RenderingEngine_flags;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.RenderingEngine = void 0;
|
|
42
|
-
const THREE = __importStar(require("three"));
|
|
43
|
-
const MaterialLoader_1 = require("./loaders/MaterialLoader");
|
|
44
42
|
const viewer_rendering_engine_animation_engine_1 = require("@shapediver/viewer.rendering-engine.animation-engine");
|
|
45
|
-
const
|
|
46
|
-
const CameraManager_1 = require("./managers/CameraManager");
|
|
43
|
+
const viewer_rendering_engine_camera_engine_1 = require("@shapediver/viewer.rendering-engine.camera-engine");
|
|
47
44
|
const viewer_rendering_engine_canvas_engine_1 = require("@shapediver/viewer.rendering-engine.canvas-engine");
|
|
48
|
-
const
|
|
49
|
-
const
|
|
45
|
+
const viewer_rendering_engine_intersection_engine_1 = require("@shapediver/viewer.rendering-engine.intersection-engine");
|
|
46
|
+
const viewer_rendering_engine_light_engine_1 = require("@shapediver/viewer.rendering-engine.light-engine");
|
|
47
|
+
const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
|
|
48
|
+
const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
|
|
49
|
+
const viewer_shared_types_1 = require("@shapediver/viewer.shared.types");
|
|
50
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
51
|
+
const THREE = __importStar(require("three"));
|
|
50
52
|
const EnvironmentMapLoader_1 = require("./loaders/EnvironmentMapLoader");
|
|
51
53
|
const GeometryLoader_1 = require("./loaders/GeometryLoader");
|
|
52
54
|
const HTMLElementAnchorLoader_1 = require("./loaders/HTMLElementAnchorLoader");
|
|
53
|
-
const viewer_rendering_engine_intersection_engine_1 = require("@shapediver/viewer.rendering-engine.intersection-engine");
|
|
54
|
-
const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
|
|
55
|
-
const viewer_rendering_engine_light_engine_1 = require("@shapediver/viewer.rendering-engine.light-engine");
|
|
56
55
|
const LightLoader_1 = require("./loaders/LightLoader");
|
|
56
|
+
const MaterialLoader_1 = require("./loaders/MaterialLoader");
|
|
57
|
+
const CameraManager_1 = require("./managers/CameraManager");
|
|
58
|
+
const EnvironmentGeometryManager_1 = require("./managers/EnvironmentGeometryManager");
|
|
57
59
|
const PostProcessingManager_1 = require("./managers/PostProcessingManager");
|
|
58
|
-
const gl_matrix_1 = require("gl-matrix");
|
|
59
60
|
const RenderingManager_1 = require("./managers/RenderingManager");
|
|
60
61
|
const SceneTracingManager_1 = require("./managers/SceneTracingManager");
|
|
61
62
|
const SceneTreeManager_1 = require("./managers/SceneTreeManager");
|
|
62
63
|
const SDColor_1 = require("./objects/SDColor");
|
|
63
|
-
const
|
|
64
|
-
const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
|
|
64
|
+
const viewport_css_1 = require("./styling/viewport-css");
|
|
65
65
|
class RenderingEngine {
|
|
66
66
|
// #endregion Properties (76)
|
|
67
67
|
// #region Constructors (1)
|
|
68
68
|
constructor(properties) {
|
|
69
69
|
// #region Properties (76)
|
|
70
|
-
_RenderingEngine_defaultLogo.set(this,
|
|
71
|
-
_RenderingEngine_defaultLogoStatic.set(this,
|
|
72
|
-
_RenderingEngine_defaultSpinner.set(this,
|
|
70
|
+
_RenderingEngine_defaultLogo.set(this, "https://viewer.shapediver.com/v3/graphics/logo_animated_breath.svg");
|
|
71
|
+
_RenderingEngine_defaultLogoStatic.set(this, "https://viewer.shapediver.com/v3/graphics/logo.png");
|
|
72
|
+
_RenderingEngine_defaultSpinner.set(this, "https://viewer.shapediver.com/v3/graphics/spinner_ripple.svg");
|
|
73
73
|
this._animationEngine = viewer_rendering_engine_animation_engine_1.AnimationEngine.instance;
|
|
74
74
|
this._canvasEngine = viewer_rendering_engine_canvas_engine_1.CanvasEngine.instance;
|
|
75
75
|
this._colorCache = [];
|
|
@@ -87,6 +87,7 @@ class RenderingEngine {
|
|
|
87
87
|
[viewer_shared_types_1.FLAG_TYPE.CAMERA_FREEZE]: [],
|
|
88
88
|
[viewer_shared_types_1.FLAG_TYPE.CONTINUOUS_RENDERING]: [],
|
|
89
89
|
[viewer_shared_types_1.FLAG_TYPE.CONTINUOUS_SHADOW_MAP_UPDATE]: [],
|
|
90
|
+
[viewer_shared_types_1.FLAG_TYPE.SUSPEND_SCENE_UPDATES]: [],
|
|
90
91
|
});
|
|
91
92
|
// settings
|
|
92
93
|
this._arRotation = gl_matrix_1.vec3.create();
|
|
@@ -99,22 +100,25 @@ class RenderingEngine {
|
|
|
99
100
|
this._busy = false;
|
|
100
101
|
this._busyModeDisplay = viewer_shared_types_1.BUSY_MODE_DISPLAY.SPINNER;
|
|
101
102
|
this._clearAlpha = 1.0;
|
|
102
|
-
this._clearColor =
|
|
103
|
+
this._clearColor = "#ffffff";
|
|
103
104
|
// viewer global vars
|
|
104
105
|
this._closed = false;
|
|
105
106
|
this._enableAR = true;
|
|
106
|
-
this._environmentMap =
|
|
107
|
+
this._environmentMap = "null";
|
|
107
108
|
this._environmentMapAsBackground = false;
|
|
108
109
|
this._environmentMapBlurriness = 0;
|
|
109
110
|
this._environmentMapForUnlitMaterials = false;
|
|
110
111
|
this._environmentMapIntensity = 1;
|
|
111
|
-
this._environmentMapResolution =
|
|
112
|
+
this._environmentMapResolution = "1024";
|
|
112
113
|
this._environmentMapRotation = gl_matrix_1.quat.create();
|
|
113
114
|
this._gridVisibility = true;
|
|
114
115
|
this._groundPlaneShadowVisibility = false;
|
|
115
116
|
this._groundPlaneVisibility = true;
|
|
116
117
|
this._lights = true;
|
|
117
|
-
this._maximumRenderingSize = this
|
|
118
|
+
this._maximumRenderingSize = this
|
|
119
|
+
._systemInfo.isMobile
|
|
120
|
+
? { width: 1280, height: 720 }
|
|
121
|
+
: { width: 1920, height: 1080 };
|
|
118
122
|
this._pause = false;
|
|
119
123
|
this._shadows = true;
|
|
120
124
|
this._show = false;
|
|
@@ -129,23 +133,26 @@ class RenderingEngine {
|
|
|
129
133
|
// adapt some of the three.js shaders according to our needs
|
|
130
134
|
(0, MaterialLoader_1.adaptShaders)();
|
|
131
135
|
// add css to the document
|
|
132
|
-
const style = document.createElement(
|
|
136
|
+
const style = document.createElement("style");
|
|
133
137
|
style.innerHTML = viewport_css_1.css;
|
|
134
138
|
document.head.appendChild(style);
|
|
135
139
|
const prop = Object.assign({}, properties);
|
|
136
140
|
const branding = Object.assign({}, prop.branding);
|
|
137
141
|
// setting some of the provided properties
|
|
138
|
-
this._id = prop.id ||
|
|
142
|
+
this._id = prop.id || viewer_shared_services_1.UuidGenerator.instance.create();
|
|
139
143
|
this._visibilitySessionIds = prop.visibilitySessionIds;
|
|
140
144
|
this._visibility = prop.visibility || viewer_shared_types_1.VISIBILITY_MODE.SESSION;
|
|
141
|
-
this._sessionSettingsMode =
|
|
145
|
+
this._sessionSettingsMode =
|
|
146
|
+
prop.sessionSettingsMode || viewer_shared_services_1.SESSION_SETTINGS_MODE.FIRST;
|
|
142
147
|
this._sessionSettingsId = prop.sessionSettingsId;
|
|
143
148
|
this._branding = {
|
|
144
149
|
logo: branding.logo === undefined ? __classPrivateFieldGet(this, _RenderingEngine_defaultLogo, "f") : branding.logo,
|
|
145
|
-
backgroundColor: branding.backgroundColor ||
|
|
146
|
-
busyModeSpinner: branding.busyModeSpinner === undefined
|
|
150
|
+
backgroundColor: branding.backgroundColor || "#393a45FF",
|
|
151
|
+
busyModeSpinner: branding.busyModeSpinner === undefined
|
|
152
|
+
? __classPrivateFieldGet(this, _RenderingEngine_defaultSpinner, "f")
|
|
153
|
+
: branding.busyModeSpinner,
|
|
147
154
|
busyModeDisplay: branding.busyModeDisplay || viewer_shared_types_1.BUSY_MODE_DISPLAY.SPINNER,
|
|
148
|
-
spinnerPositioning: branding.spinnerPositioning || viewer_shared_types_1.SPINNER_POSITIONING.BOTTOM_RIGHT
|
|
155
|
+
spinnerPositioning: branding.spinnerPositioning || viewer_shared_types_1.SPINNER_POSITIONING.BOTTOM_RIGHT,
|
|
149
156
|
};
|
|
150
157
|
// creation of viewer essentials
|
|
151
158
|
this._canvas = this._canvasEngine.getCanvas(this._canvasEngine.createCanvasObject(prop.canvas));
|
|
@@ -166,7 +173,7 @@ class RenderingEngine {
|
|
|
166
173
|
this._geometryLoader = new GeometryLoader_1.GeometryLoader(this);
|
|
167
174
|
this._htmlElementAnchorLoader = new HTMLElementAnchorLoader_1.HTMLElementAnchorLoader(this);
|
|
168
175
|
this._lightLoader = new LightLoader_1.LightLoader(this);
|
|
169
|
-
// start the creation and initialization process
|
|
176
|
+
// start the creation and initialization process
|
|
170
177
|
this._renderer = this.renderingManager.createRenderer(this._canvas.canvasElement);
|
|
171
178
|
this._spinnerDivElement = this.renderingManager.addSpinner(this._canvas.canvasElement, this._branding);
|
|
172
179
|
this._logoDivElement = this.renderingManager.addLogo(this._canvas.canvasElement, this._branding);
|
|
@@ -211,7 +218,7 @@ class RenderingEngine {
|
|
|
211
218
|
if (this._automaticColorAdjustment === value)
|
|
212
219
|
return;
|
|
213
220
|
this._automaticColorAdjustment = value;
|
|
214
|
-
this._colorCache.forEach(c => c.colorCorrection(value));
|
|
221
|
+
this._colorCache.forEach((c) => c.colorCorrection(value));
|
|
215
222
|
this._materialLoader.assignColorCorrection(value);
|
|
216
223
|
}
|
|
217
224
|
get automaticResizing() {
|
|
@@ -322,6 +329,12 @@ class RenderingEngine {
|
|
|
322
329
|
set continuousShadowMapUpdate(value) {
|
|
323
330
|
this._renderingManager.continuousShadowMapUpdate = value;
|
|
324
331
|
}
|
|
332
|
+
get suspendSceneUpdates() {
|
|
333
|
+
return this._sceneTreeManager.suspendSceneUpdates;
|
|
334
|
+
}
|
|
335
|
+
set suspendSceneUpdates(value) {
|
|
336
|
+
this._sceneTreeManager.suspendSceneUpdates = value;
|
|
337
|
+
}
|
|
325
338
|
get defaultLineMaterial() {
|
|
326
339
|
return this.materialLoader.defaultLineMaterialData;
|
|
327
340
|
}
|
|
@@ -381,7 +394,8 @@ class RenderingEngine {
|
|
|
381
394
|
}
|
|
382
395
|
set environmentMapBlurriness(value) {
|
|
383
396
|
this._environmentMapBlurriness = value;
|
|
384
|
-
this._sceneTreeManager.scene.backgroundBlurriness =
|
|
397
|
+
this._sceneTreeManager.scene.backgroundBlurriness =
|
|
398
|
+
this._environmentMapBlurriness;
|
|
385
399
|
}
|
|
386
400
|
get environmentMapForUnlitMaterials() {
|
|
387
401
|
return this._environmentMapForUnlitMaterials;
|
|
@@ -477,10 +491,14 @@ class RenderingEngine {
|
|
|
477
491
|
return this._lightLoader;
|
|
478
492
|
}
|
|
479
493
|
get lightScene() {
|
|
480
|
-
return this.lightEngine.lightScene
|
|
494
|
+
return this.lightEngine.lightScene
|
|
495
|
+
? this.lightEngine.lightScene.id
|
|
496
|
+
: "";
|
|
481
497
|
}
|
|
482
498
|
get lightSceneId() {
|
|
483
|
-
return this.lightEngine.lightScene
|
|
499
|
+
return this.lightEngine.lightScene
|
|
500
|
+
? this.lightEngine.lightScene.id
|
|
501
|
+
: "";
|
|
484
502
|
}
|
|
485
503
|
get lights() {
|
|
486
504
|
return this._lights;
|
|
@@ -511,19 +529,19 @@ class RenderingEngine {
|
|
|
511
529
|
}
|
|
512
530
|
get outputEncoding() {
|
|
513
531
|
switch (this._renderer.outputColorSpace) {
|
|
514
|
-
case
|
|
532
|
+
case THREE.SRGBColorSpace:
|
|
515
533
|
return viewer_shared_types_1.TEXTURE_ENCODING.SRGB;
|
|
516
|
-
case
|
|
534
|
+
case THREE.LinearSRGBColorSpace:
|
|
517
535
|
default:
|
|
518
536
|
return viewer_shared_types_1.TEXTURE_ENCODING.LINEAR;
|
|
519
537
|
}
|
|
520
538
|
}
|
|
521
539
|
set outputEncoding(value) {
|
|
522
540
|
switch (value) {
|
|
523
|
-
case
|
|
541
|
+
case viewer_shared_types_1.TEXTURE_ENCODING.SRGB:
|
|
524
542
|
this._renderer.outputColorSpace = THREE.SRGBColorSpace;
|
|
525
543
|
break;
|
|
526
|
-
case
|
|
544
|
+
case viewer_shared_types_1.TEXTURE_ENCODING.LINEAR:
|
|
527
545
|
default:
|
|
528
546
|
this._renderer.outputColorSpace = THREE.LinearSRGBColorSpace;
|
|
529
547
|
break;
|
|
@@ -628,23 +646,26 @@ class RenderingEngine {
|
|
|
628
646
|
}
|
|
629
647
|
get textureEncoding() {
|
|
630
648
|
switch (this.materialLoader.textureEncoding) {
|
|
631
|
-
case
|
|
649
|
+
case THREE.SRGBColorSpace:
|
|
632
650
|
return viewer_shared_types_1.TEXTURE_ENCODING.SRGB;
|
|
633
|
-
case
|
|
651
|
+
case THREE.LinearSRGBColorSpace:
|
|
634
652
|
default:
|
|
635
653
|
return viewer_shared_types_1.TEXTURE_ENCODING.LINEAR;
|
|
636
654
|
}
|
|
637
655
|
}
|
|
638
656
|
set textureEncoding(value) {
|
|
639
657
|
switch (value) {
|
|
640
|
-
case
|
|
641
|
-
this.environmentMapLoader.textureEncoding =
|
|
658
|
+
case viewer_shared_types_1.TEXTURE_ENCODING.SRGB:
|
|
659
|
+
this.environmentMapLoader.textureEncoding =
|
|
660
|
+
THREE.SRGBColorSpace;
|
|
642
661
|
this.materialLoader.textureEncoding = THREE.SRGBColorSpace;
|
|
643
662
|
break;
|
|
644
|
-
case
|
|
663
|
+
case viewer_shared_types_1.TEXTURE_ENCODING.LINEAR:
|
|
645
664
|
default:
|
|
646
|
-
this.environmentMapLoader.textureEncoding =
|
|
647
|
-
|
|
665
|
+
this.environmentMapLoader.textureEncoding =
|
|
666
|
+
THREE.LinearSRGBColorSpace;
|
|
667
|
+
this.materialLoader.textureEncoding =
|
|
668
|
+
THREE.LinearSRGBColorSpace;
|
|
648
669
|
}
|
|
649
670
|
}
|
|
650
671
|
get toneMapping() {
|
|
@@ -653,19 +674,19 @@ class RenderingEngine {
|
|
|
653
674
|
set toneMapping(value) {
|
|
654
675
|
this._toneMapping = value;
|
|
655
676
|
switch (value) {
|
|
656
|
-
case
|
|
677
|
+
case viewer_shared_types_1.TONE_MAPPING.LINEAR:
|
|
657
678
|
this._renderer.toneMapping = THREE.LinearToneMapping;
|
|
658
679
|
break;
|
|
659
|
-
case
|
|
680
|
+
case viewer_shared_types_1.TONE_MAPPING.REINHARD:
|
|
660
681
|
this._renderer.toneMapping = THREE.ReinhardToneMapping;
|
|
661
682
|
break;
|
|
662
|
-
case
|
|
683
|
+
case viewer_shared_types_1.TONE_MAPPING.CINEON:
|
|
663
684
|
this._renderer.toneMapping = THREE.CineonToneMapping;
|
|
664
685
|
break;
|
|
665
|
-
case
|
|
686
|
+
case viewer_shared_types_1.TONE_MAPPING.ACES_FILMIC:
|
|
666
687
|
this._renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
|
667
688
|
break;
|
|
668
|
-
case
|
|
689
|
+
case viewer_shared_types_1.TONE_MAPPING.NONE:
|
|
669
690
|
default:
|
|
670
691
|
this._renderer.toneMapping = THREE.NoToneMapping;
|
|
671
692
|
}
|
|
@@ -717,7 +738,7 @@ class RenderingEngine {
|
|
|
717
738
|
light: true,
|
|
718
739
|
environment: true,
|
|
719
740
|
general: true,
|
|
720
|
-
postprocessing: true
|
|
741
|
+
postprocessing: true,
|
|
721
742
|
}, settingsEngine, updateViewport = true) {
|
|
722
743
|
return __awaiter(this, void 0, void 0, function* () {
|
|
723
744
|
settingsEngine = settingsEngine || this._settingsEngine;
|
|
@@ -725,6 +746,7 @@ class RenderingEngine {
|
|
|
725
746
|
return;
|
|
726
747
|
if (sections.environment) {
|
|
727
748
|
const promises = [];
|
|
749
|
+
promises.push(this._postProcessingManager.initialize());
|
|
728
750
|
// as the environment map is the only thing that needs time to load, load it first
|
|
729
751
|
promises.push(new Promise((resolve, reject) => {
|
|
730
752
|
var _a;
|
|
@@ -732,12 +754,21 @@ class RenderingEngine {
|
|
|
732
754
|
try {
|
|
733
755
|
if (!settingsEngine)
|
|
734
756
|
return;
|
|
735
|
-
this.environmentMapAsBackground =
|
|
736
|
-
|
|
757
|
+
this.environmentMapAsBackground =
|
|
758
|
+
settingsEngine.environment.mapAsBackground;
|
|
759
|
+
this.clearAlpha =
|
|
760
|
+
settingsEngine.environment.clearAlpha;
|
|
737
761
|
this.clearColor = this._converter.toHexColor(settingsEngine.environment.clearColor);
|
|
738
|
-
this.environmentMapRotation = [
|
|
739
|
-
|
|
740
|
-
|
|
762
|
+
this.environmentMapRotation = [
|
|
763
|
+
settingsEngine.environment.rotation.x,
|
|
764
|
+
settingsEngine.environment.rotation.y,
|
|
765
|
+
settingsEngine.environment.rotation.z,
|
|
766
|
+
settingsEngine.environment.rotation.w,
|
|
767
|
+
];
|
|
768
|
+
this.environmentMapBlurriness =
|
|
769
|
+
settingsEngine.environment.blurriness;
|
|
770
|
+
this.environmentMapIntensity =
|
|
771
|
+
settingsEngine.environment.intensity;
|
|
741
772
|
this.applySyncSettings(sections, settingsEngine, updateViewport);
|
|
742
773
|
this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE_VIEWPORT.VIEWPORT_SETTINGS_LOADED, { viewportId: this.id });
|
|
743
774
|
resolve();
|
|
@@ -745,9 +776,10 @@ class RenderingEngine {
|
|
|
745
776
|
catch (e) {
|
|
746
777
|
reject(e);
|
|
747
778
|
}
|
|
748
|
-
}).catch(e => reject(e));
|
|
779
|
+
}).catch((e) => reject(e));
|
|
749
780
|
// set it like this to not trigger the loading
|
|
750
|
-
this.environmentMap =
|
|
781
|
+
this.environmentMap =
|
|
782
|
+
this.environmentMapLoader.reconstructSavedEnvironmentMapContent(settingsEngine.environment.map);
|
|
751
783
|
}));
|
|
752
784
|
yield Promise.all(promises);
|
|
753
785
|
}
|
|
@@ -799,13 +831,14 @@ class RenderingEngine {
|
|
|
799
831
|
}
|
|
800
832
|
displayErrorMessage(message) {
|
|
801
833
|
for (let i = 0; i < this.logoDivElement.children.length; i++)
|
|
802
|
-
this.logoDivElement.children[i].style.visibility =
|
|
803
|
-
|
|
804
|
-
d.
|
|
834
|
+
this.logoDivElement.children[i].style.visibility =
|
|
835
|
+
"hidden";
|
|
836
|
+
const d = document.createElement("div");
|
|
837
|
+
d.classList.add("sdv-error-message-container");
|
|
805
838
|
this.logoDivElement.appendChild(d);
|
|
806
|
-
const p = document.createElement(
|
|
839
|
+
const p = document.createElement("p");
|
|
807
840
|
p.textContent = message;
|
|
808
|
-
p.classList.add(
|
|
841
|
+
p.classList.add("sdv-error-message");
|
|
809
842
|
p.style.color = this.logoDivElement.style.backgroundColor;
|
|
810
843
|
d.appendChild(p);
|
|
811
844
|
}
|
|
@@ -813,7 +846,8 @@ class RenderingEngine {
|
|
|
813
846
|
// busy
|
|
814
847
|
{
|
|
815
848
|
const currentBusyState = this.busy;
|
|
816
|
-
if (this.stateEngine.viewportEngines[this.id] &&
|
|
849
|
+
if (this.stateEngine.viewportEngines[this.id] &&
|
|
850
|
+
this.stateEngine.viewportEngines[this.id].busy.length > 0) {
|
|
817
851
|
if (!currentBusyState) {
|
|
818
852
|
this.busy = true;
|
|
819
853
|
this._renderingManager.render();
|
|
@@ -867,6 +901,21 @@ class RenderingEngine {
|
|
|
867
901
|
}
|
|
868
902
|
}
|
|
869
903
|
}
|
|
904
|
+
// suspend scene updates
|
|
905
|
+
{
|
|
906
|
+
const currentSuspendSceneUpdatesState = this.suspendSceneUpdates;
|
|
907
|
+
if (currentSuspendSceneUpdatesState) {
|
|
908
|
+
if (__classPrivateFieldGet(this, _RenderingEngine_flags, "f")[viewer_shared_types_1.FLAG_TYPE.SUSPEND_SCENE_UPDATES].length === 0) {
|
|
909
|
+
this.suspendSceneUpdates = false;
|
|
910
|
+
this._renderingManager.render();
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
else {
|
|
914
|
+
if (__classPrivateFieldGet(this, _RenderingEngine_flags, "f")[viewer_shared_types_1.FLAG_TYPE.SUSPEND_SCENE_UPDATES].length > 0) {
|
|
915
|
+
this.suspendSceneUpdates = true;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
}
|
|
870
919
|
}
|
|
871
920
|
getEnvironmentMapImageUrl() {
|
|
872
921
|
return this._environmentMapLoader.getEnvironmentMapImageUrl(this.environmentMap);
|
|
@@ -876,13 +925,16 @@ class RenderingEngine {
|
|
|
876
925
|
}
|
|
877
926
|
isMobileDeviceWithoutBrowserARSupport() {
|
|
878
927
|
// has to be a mobile device (duh)
|
|
879
|
-
if (this._systemInfo.isIOS === false &&
|
|
928
|
+
if (this._systemInfo.isIOS === false &&
|
|
929
|
+
this._systemInfo.isAndroid === false)
|
|
880
930
|
return false;
|
|
881
931
|
// no Firefox on Android
|
|
882
|
-
if (this._systemInfo.isAndroid === true &&
|
|
932
|
+
if (this._systemInfo.isAndroid === true &&
|
|
933
|
+
this._systemInfo.isFirefox === true)
|
|
883
934
|
return true;
|
|
884
935
|
// no Instagram on iOS
|
|
885
|
-
if (this._systemInfo.isIOS === true &&
|
|
936
|
+
if (this._systemInfo.isIOS === true &&
|
|
937
|
+
this._systemInfo.isInstagram === true)
|
|
886
938
|
return true;
|
|
887
939
|
return false;
|
|
888
940
|
}
|
|
@@ -894,11 +946,11 @@ class RenderingEngine {
|
|
|
894
946
|
}
|
|
895
947
|
raytraceScene(origin, direction, filterCriteria) {
|
|
896
948
|
const intersect = this._intersectionManager.intersect({ origin, direction }, this.id, filterCriteria);
|
|
897
|
-
return intersect.map(i => {
|
|
949
|
+
return intersect.map((i) => {
|
|
898
950
|
return {
|
|
899
951
|
distance: i.distance,
|
|
900
952
|
node: i.node,
|
|
901
|
-
data: i.geometryData
|
|
953
|
+
data: i.geometryData,
|
|
902
954
|
};
|
|
903
955
|
});
|
|
904
956
|
}
|
|
@@ -907,7 +959,8 @@ class RenderingEngine {
|
|
|
907
959
|
const Flags = Object.values(viewer_shared_types_1.FLAG_TYPE);
|
|
908
960
|
for (const f of Flags) {
|
|
909
961
|
if (f === viewer_shared_types_1.FLAG_TYPE.BUSY_MODE) {
|
|
910
|
-
if (this.stateEngine.viewportEngines[this.id] &&
|
|
962
|
+
if (this.stateEngine.viewportEngines[this.id] &&
|
|
963
|
+
this.stateEngine.viewportEngines[this.id].busy.includes(token)) {
|
|
911
964
|
this.stateEngine.viewportEngines[this.id].busy.splice(this.stateEngine.viewportEngines[this.id].busy.indexOf(token), 1);
|
|
912
965
|
success = true;
|
|
913
966
|
break;
|
|
@@ -945,39 +998,74 @@ class RenderingEngine {
|
|
|
945
998
|
this.cameraEngine.saveSettings(settingsEngine);
|
|
946
999
|
this.postProcessingManager.saveSettings(settingsEngine);
|
|
947
1000
|
settingsEngine.ar.enable = this.enableAR;
|
|
948
|
-
settingsEngine.environment.mapResolution =
|
|
949
|
-
|
|
950
|
-
settingsEngine.environment.
|
|
1001
|
+
settingsEngine.environment.mapResolution =
|
|
1002
|
+
this.environmentMapResolution;
|
|
1003
|
+
settingsEngine.environment.map =
|
|
1004
|
+
this._environmentMapLoader.createSaveableEnvironmentMapContent(this.environmentMap);
|
|
1005
|
+
settingsEngine.environment.mapAsBackground =
|
|
1006
|
+
this.environmentMapAsBackground;
|
|
951
1007
|
settingsEngine.environment.clearAlpha = this.clearAlpha;
|
|
952
1008
|
settingsEngine.environment.clearColor = this._converter.toHexColor(this.clearColor);
|
|
953
|
-
settingsEngine.environment.rotation = {
|
|
1009
|
+
settingsEngine.environment.rotation = {
|
|
1010
|
+
x: this.environmentMapRotation[0],
|
|
1011
|
+
y: this.environmentMapRotation[1],
|
|
1012
|
+
z: this.environmentMapRotation[2],
|
|
1013
|
+
w: this.environmentMapRotation[3],
|
|
1014
|
+
};
|
|
954
1015
|
settingsEngine.environment.blurriness = this.environmentMapBlurriness;
|
|
955
1016
|
settingsEngine.environment.intensity = this.environmentMapIntensity;
|
|
956
1017
|
settingsEngine.environmentGeometry.gridVisibility = this.gridVisibility;
|
|
957
|
-
settingsEngine.environmentGeometry.groundPlaneVisibility =
|
|
958
|
-
|
|
959
|
-
settingsEngine.environmentGeometry.
|
|
960
|
-
|
|
961
|
-
settingsEngine.environmentGeometry.
|
|
962
|
-
|
|
963
|
-
settingsEngine.environmentGeometry.
|
|
964
|
-
|
|
965
|
-
settingsEngine.environmentGeometry.
|
|
966
|
-
|
|
1018
|
+
settingsEngine.environmentGeometry.groundPlaneVisibility =
|
|
1019
|
+
this.groundPlaneVisibility;
|
|
1020
|
+
settingsEngine.environmentGeometry.groundPlaneShadowVisibility =
|
|
1021
|
+
this.groundPlaneShadowVisibility;
|
|
1022
|
+
settingsEngine.environmentGeometry.gridColor =
|
|
1023
|
+
this._converter.toHexColor(this.gridColor);
|
|
1024
|
+
settingsEngine.environmentGeometry.groundPlaneColor =
|
|
1025
|
+
this._converter.toHexColor(this.groundPlaneColor);
|
|
1026
|
+
settingsEngine.environmentGeometry.groundPlaneShadowColor =
|
|
1027
|
+
this._converter.toHexColor(this.groundPlaneShadowColor);
|
|
1028
|
+
settingsEngine.environmentGeometry.contactShadowBlur =
|
|
1029
|
+
this.contactShadowBlur;
|
|
1030
|
+
settingsEngine.environmentGeometry.contactShadowDarkness =
|
|
1031
|
+
this.contactShadowDarkness;
|
|
1032
|
+
settingsEngine.environmentGeometry.contactShadowHeight =
|
|
1033
|
+
this.contactShadowHeight;
|
|
1034
|
+
settingsEngine.environmentGeometry.contactShadowOpacity =
|
|
1035
|
+
this.contactShadowOpacity;
|
|
1036
|
+
settingsEngine.environmentGeometry.contactShadowVisibility =
|
|
1037
|
+
this.contactShadowVisibility;
|
|
967
1038
|
settingsEngine.general.pointSize = this.pointSize;
|
|
968
|
-
settingsEngine.general.transformation.rotation = {
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
settingsEngine.
|
|
1039
|
+
settingsEngine.general.transformation.rotation = {
|
|
1040
|
+
x: this.arRotation[0],
|
|
1041
|
+
y: this.arRotation[1],
|
|
1042
|
+
z: this.arRotation[2],
|
|
1043
|
+
};
|
|
1044
|
+
settingsEngine.general.transformation.translation = {
|
|
1045
|
+
x: this.arTranslation[0],
|
|
1046
|
+
y: this.arTranslation[1],
|
|
1047
|
+
z: this.arTranslation[2],
|
|
1048
|
+
};
|
|
1049
|
+
settingsEngine.general.transformation.scale = {
|
|
1050
|
+
x: this.arScale[0],
|
|
1051
|
+
y: this.arScale[1],
|
|
1052
|
+
z: this.arScale[2],
|
|
1053
|
+
};
|
|
1054
|
+
settingsEngine.material.defaultMaterialColor =
|
|
1055
|
+
this._converter.toHexColor(this.defaultMaterialColor);
|
|
1056
|
+
settingsEngine.material.materialOverrideType =
|
|
1057
|
+
this.materialOverrideType;
|
|
1058
|
+
settingsEngine.rendering.automaticColorAdjustment =
|
|
1059
|
+
this.automaticColorAdjustment;
|
|
974
1060
|
settingsEngine.rendering.lights = this.lights;
|
|
975
1061
|
settingsEngine.rendering.outputEncoding = this.outputEncoding;
|
|
976
|
-
settingsEngine.rendering.physicallyCorrectLights =
|
|
1062
|
+
settingsEngine.rendering.physicallyCorrectLights =
|
|
1063
|
+
this.physicallyCorrectLights;
|
|
977
1064
|
settingsEngine.rendering.textureEncoding = this.textureEncoding;
|
|
978
1065
|
settingsEngine.rendering.toneMapping = this.toneMapping;
|
|
979
1066
|
settingsEngine.rendering.toneMappingExposure = this.toneMappingExposure;
|
|
980
|
-
settingsEngine.rendering.beautyRenderBlendingDuration =
|
|
1067
|
+
settingsEngine.rendering.beautyRenderBlendingDuration =
|
|
1068
|
+
this.beautyRenderBlendingDuration;
|
|
981
1069
|
settingsEngine.rendering.beautyRenderDelay = this.beautyRenderDelay;
|
|
982
1070
|
settingsEngine.rendering.shadows = this.shadows;
|
|
983
1071
|
settingsEngine.rendering.softShadows = this.softShadows;
|
|
@@ -989,13 +1077,15 @@ class RenderingEngine {
|
|
|
989
1077
|
this._environmentGeometryManager.changeSceneExtents(this._sceneTreeManager.boundingBox);
|
|
990
1078
|
});
|
|
991
1079
|
if (this._sessionSettingsMode === viewer_shared_services_1.SESSION_SETTINGS_MODE.NONE) {
|
|
992
|
-
this.environmentMap =
|
|
1080
|
+
this.environmentMap = "photo_studio";
|
|
993
1081
|
}
|
|
994
1082
|
}
|
|
995
1083
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
996
1084
|
update(id) {
|
|
997
1085
|
if (this.closed)
|
|
998
1086
|
return;
|
|
1087
|
+
if (this.sceneTreeManager.suspendSceneUpdates === true)
|
|
1088
|
+
return;
|
|
999
1089
|
this._sceneTreeManager.updateSceneTree(this._tree.root);
|
|
1000
1090
|
this._renderingManager.updateShadowMap();
|
|
1001
1091
|
this._animationEngine.updateAnimationData();
|
|
@@ -1005,18 +1095,28 @@ class RenderingEngine {
|
|
|
1005
1095
|
updateEnvironmentGeometry() {
|
|
1006
1096
|
this._environmentGeometryManager.updateEnvironmentGeometryPosition();
|
|
1007
1097
|
}
|
|
1008
|
-
viewInAR(file, options = { arScale:
|
|
1098
|
+
viewInAR(file, options = { arScale: "auto", arPlacement: "floor", xrEnvironment: false }) {
|
|
1009
1099
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1010
1100
|
const eventId = this._uuidGenerator.create();
|
|
1011
|
-
const event = {
|
|
1101
|
+
const event = {
|
|
1102
|
+
type: viewer_shared_types_1.TASK_TYPE.AR_LOADING,
|
|
1103
|
+
id: eventId,
|
|
1104
|
+
progress: 0,
|
|
1105
|
+
status: "Loading AR scene",
|
|
1106
|
+
};
|
|
1012
1107
|
this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_START, event);
|
|
1013
1108
|
// if this is not a supported device, throw an error
|
|
1014
1109
|
if (this.viewableInAR() === false) {
|
|
1015
|
-
const event = {
|
|
1110
|
+
const event = {
|
|
1111
|
+
type: viewer_shared_types_1.TASK_TYPE.AR_LOADING,
|
|
1112
|
+
id: eventId,
|
|
1113
|
+
progress: 1,
|
|
1114
|
+
status: "Stopped AR loading due to an error",
|
|
1115
|
+
};
|
|
1016
1116
|
this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_CANCEL, event);
|
|
1017
1117
|
throw new viewer_shared_services_1.ShapeDiverViewerArError('Api.viewInAR: The device or browser is not supported for this functionality, please call "viewableInAR" for more information.');
|
|
1018
1118
|
}
|
|
1019
|
-
const arScale = options.arScale !==
|
|
1119
|
+
const arScale = options.arScale !== "auto" ? "fixed" : "auto";
|
|
1020
1120
|
// const arPlacement = options.arPlacement !== 'wall' ? 'floor' : 'wall';
|
|
1021
1121
|
// const xrEnvironment = options.xrEnvironment !== true ? false : true;
|
|
1022
1122
|
// let arEnvironment = '';
|
|
@@ -1030,35 +1130,48 @@ class RenderingEngine {
|
|
|
1030
1130
|
// }
|
|
1031
1131
|
if (this._systemInfo.isIOS) {
|
|
1032
1132
|
// create the link and click it
|
|
1033
|
-
const a = document.createElement(
|
|
1034
|
-
a.href =
|
|
1035
|
-
|
|
1036
|
-
|
|
1133
|
+
const a = document.createElement("a");
|
|
1134
|
+
a.href =
|
|
1135
|
+
file +
|
|
1136
|
+
(arScale === "fixed"
|
|
1137
|
+
? ".usdz_allowsContentScaling=0"
|
|
1138
|
+
: ".usdz");
|
|
1139
|
+
a.rel = "ar";
|
|
1140
|
+
const img = document.createElement("img");
|
|
1037
1141
|
img.src = __classPrivateFieldGet(this, _RenderingEngine_defaultLogoStatic, "f");
|
|
1038
1142
|
a.appendChild(img);
|
|
1039
1143
|
a.click();
|
|
1040
1144
|
}
|
|
1041
1145
|
else {
|
|
1042
|
-
const a = document.createElement(
|
|
1043
|
-
a.href = `intent://arvr.google.com/scene-viewer/1.0?resizable=${arScale ===
|
|
1146
|
+
const a = document.createElement("a");
|
|
1147
|
+
a.href = `intent://arvr.google.com/scene-viewer/1.0?resizable=${arScale === "fixed" ? "false" : "true"}&file=${file}&mode=ar_only#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;end;`;
|
|
1044
1148
|
a.click();
|
|
1045
1149
|
}
|
|
1046
|
-
const event2 = {
|
|
1150
|
+
const event2 = {
|
|
1151
|
+
type: viewer_shared_types_1.TASK_TYPE.AR_LOADING,
|
|
1152
|
+
id: eventId,
|
|
1153
|
+
progress: 1,
|
|
1154
|
+
status: "Done loading AR scene, launching AR",
|
|
1155
|
+
};
|
|
1047
1156
|
this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_END, event2);
|
|
1048
1157
|
});
|
|
1049
1158
|
}
|
|
1050
1159
|
viewableInAR() {
|
|
1051
1160
|
// has to be a mobile device (duh)
|
|
1052
|
-
if (this._systemInfo.isIOS === false &&
|
|
1161
|
+
if (this._systemInfo.isIOS === false &&
|
|
1162
|
+
this._systemInfo.isAndroid === false)
|
|
1053
1163
|
return false;
|
|
1054
1164
|
// no Firefox on Android
|
|
1055
|
-
if (this._systemInfo.isAndroid === true &&
|
|
1165
|
+
if (this._systemInfo.isAndroid === true &&
|
|
1166
|
+
this._systemInfo.isFirefox === true)
|
|
1056
1167
|
return false;
|
|
1057
1168
|
// no Firefox on iOS
|
|
1058
|
-
if (this._systemInfo.isIOS === true &&
|
|
1169
|
+
if (this._systemInfo.isIOS === true &&
|
|
1170
|
+
this._systemInfo.isFirefox === true)
|
|
1059
1171
|
return false;
|
|
1060
1172
|
// no Instagram on iOS
|
|
1061
|
-
if (this._systemInfo.isIOS === true &&
|
|
1173
|
+
if (this._systemInfo.isIOS === true &&
|
|
1174
|
+
this._systemInfo.isInstagram === true)
|
|
1062
1175
|
return false;
|
|
1063
1176
|
return true;
|
|
1064
1177
|
}
|
|
@@ -1071,7 +1184,7 @@ class RenderingEngine {
|
|
|
1071
1184
|
light: true,
|
|
1072
1185
|
environment: true,
|
|
1073
1186
|
general: true,
|
|
1074
|
-
postprocessing: true
|
|
1187
|
+
postprocessing: true,
|
|
1075
1188
|
}, settingsEngine, updateViewport = true) {
|
|
1076
1189
|
var _a;
|
|
1077
1190
|
settingsEngine = settingsEngine || this._settingsEngine;
|
|
@@ -1079,35 +1192,62 @@ class RenderingEngine {
|
|
|
1079
1192
|
return;
|
|
1080
1193
|
if (sections.ar) {
|
|
1081
1194
|
this.enableAR = settingsEngine.ar.enable;
|
|
1082
|
-
this.arScale = [
|
|
1083
|
-
|
|
1084
|
-
|
|
1195
|
+
this.arScale = [
|
|
1196
|
+
settingsEngine.general.transformation.scale.x,
|
|
1197
|
+
settingsEngine.general.transformation.scale.y,
|
|
1198
|
+
settingsEngine.general.transformation.scale.z,
|
|
1199
|
+
];
|
|
1200
|
+
this.arTranslation = [
|
|
1201
|
+
settingsEngine.general.transformation.translation.x,
|
|
1202
|
+
settingsEngine.general.transformation.translation.y,
|
|
1203
|
+
settingsEngine.general.transformation.translation.z,
|
|
1204
|
+
];
|
|
1205
|
+
this.arRotation = [
|
|
1206
|
+
settingsEngine.general.transformation.rotation.x,
|
|
1207
|
+
settingsEngine.general.transformation.rotation.y,
|
|
1208
|
+
settingsEngine.general.transformation.rotation.z,
|
|
1209
|
+
];
|
|
1085
1210
|
}
|
|
1086
1211
|
if (sections.scene) {
|
|
1087
1212
|
this.gridColor = settingsEngine.environmentGeometry.gridColor;
|
|
1088
|
-
this.gridVisibility =
|
|
1089
|
-
|
|
1090
|
-
this.
|
|
1091
|
-
|
|
1092
|
-
this.
|
|
1093
|
-
|
|
1094
|
-
this.
|
|
1095
|
-
|
|
1096
|
-
this.
|
|
1097
|
-
|
|
1213
|
+
this.gridVisibility =
|
|
1214
|
+
settingsEngine.environmentGeometry.gridVisibility;
|
|
1215
|
+
this.groundPlaneColor =
|
|
1216
|
+
settingsEngine.environmentGeometry.groundPlaneColor;
|
|
1217
|
+
this.groundPlaneVisibility =
|
|
1218
|
+
settingsEngine.environmentGeometry.groundPlaneVisibility;
|
|
1219
|
+
this.groundPlaneShadowColor =
|
|
1220
|
+
settingsEngine.environmentGeometry.groundPlaneShadowColor;
|
|
1221
|
+
this.groundPlaneShadowVisibility =
|
|
1222
|
+
settingsEngine.environmentGeometry.groundPlaneShadowVisibility;
|
|
1223
|
+
this.contactShadowBlur =
|
|
1224
|
+
settingsEngine.environmentGeometry.contactShadowBlur;
|
|
1225
|
+
this.contactShadowDarkness =
|
|
1226
|
+
settingsEngine.environmentGeometry.contactShadowDarkness;
|
|
1227
|
+
this.contactShadowHeight =
|
|
1228
|
+
settingsEngine.environmentGeometry.contactShadowHeight;
|
|
1229
|
+
this.contactShadowOpacity =
|
|
1230
|
+
settingsEngine.environmentGeometry.contactShadowOpacity;
|
|
1231
|
+
this.contactShadowVisibility =
|
|
1232
|
+
settingsEngine.environmentGeometry.contactShadowVisibility;
|
|
1098
1233
|
this.shadows = settingsEngine.rendering.shadows;
|
|
1099
1234
|
this.softShadows = settingsEngine.rendering.softShadows;
|
|
1100
1235
|
this.lights = settingsEngine.rendering.lights;
|
|
1101
|
-
this.automaticColorAdjustment =
|
|
1102
|
-
|
|
1103
|
-
this.
|
|
1104
|
-
this.
|
|
1105
|
-
this.
|
|
1106
|
-
|
|
1236
|
+
this.automaticColorAdjustment =
|
|
1237
|
+
settingsEngine.rendering.automaticColorAdjustment;
|
|
1238
|
+
this.textureEncoding = (settingsEngine.rendering.textureEncoding);
|
|
1239
|
+
this.outputEncoding = (settingsEngine.rendering.outputEncoding);
|
|
1240
|
+
this.physicallyCorrectLights =
|
|
1241
|
+
settingsEngine.rendering.physicallyCorrectLights;
|
|
1242
|
+
this.toneMapping = (settingsEngine.rendering.toneMapping);
|
|
1243
|
+
this.toneMappingExposure =
|
|
1244
|
+
settingsEngine.rendering.toneMappingExposure;
|
|
1107
1245
|
}
|
|
1108
1246
|
if (sections.general) {
|
|
1109
|
-
this.defaultMaterialColor =
|
|
1110
|
-
|
|
1247
|
+
this.defaultMaterialColor =
|
|
1248
|
+
settingsEngine.material.defaultMaterialColor;
|
|
1249
|
+
this.materialOverrideType = settingsEngine.material
|
|
1250
|
+
.materialOverrideType;
|
|
1111
1251
|
this.pointSize = settingsEngine.general.pointSize;
|
|
1112
1252
|
}
|
|
1113
1253
|
if (sections.light)
|
|
@@ -1120,7 +1260,7 @@ class RenderingEngine {
|
|
|
1120
1260
|
this.cameraManager.adjustCamera(1);
|
|
1121
1261
|
(_a = this._stateEngine.viewportEngines[this.id]) === null || _a === void 0 ? void 0 : _a.settingsAssigned.resolve(true);
|
|
1122
1262
|
if (updateViewport)
|
|
1123
|
-
this.update(
|
|
1263
|
+
this.update("RenderingEngine.applySyncSettings");
|
|
1124
1264
|
}
|
|
1125
1265
|
}
|
|
1126
1266
|
exports.RenderingEngine = RenderingEngine;
|