@combeenation/3d-viewer 12.4.1 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/dist/lib-cjs/buildinfo.json +1 -1
  2. package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
  3. package/dist/lib-cjs/index.d.ts +63 -63
  4. package/dist/lib-cjs/index.js +81 -114
  5. package/dist/lib-cjs/index.js.map +1 -1
  6. package/dist/lib-cjs/internal/cbnCustomBabylonLoaderPlugin.d.ts +10 -0
  7. package/dist/lib-cjs/internal/cbnCustomBabylonLoaderPlugin.js +124 -0
  8. package/dist/lib-cjs/internal/cbnCustomBabylonLoaderPlugin.js.map +1 -0
  9. package/dist/lib-cjs/internal/cloningHelper.d.ts +19 -0
  10. package/dist/lib-cjs/internal/cloningHelper.js +165 -0
  11. package/dist/lib-cjs/internal/cloningHelper.js.map +1 -0
  12. package/dist/lib-cjs/internal/deviceHelper.d.ts +9 -0
  13. package/dist/lib-cjs/{api/util → internal}/deviceHelper.js +6 -10
  14. package/dist/lib-cjs/internal/deviceHelper.js.map +1 -0
  15. package/dist/lib-cjs/internal/geometryHelper.d.ts +21 -0
  16. package/dist/lib-cjs/{api/util → internal}/geometryHelper.js +57 -24
  17. package/dist/lib-cjs/internal/geometryHelper.js.map +1 -0
  18. package/dist/lib-cjs/internal/metadataHelper.d.ts +26 -0
  19. package/dist/lib-cjs/internal/metadataHelper.js +51 -0
  20. package/dist/lib-cjs/internal/metadataHelper.js.map +1 -0
  21. package/dist/lib-cjs/internal/paintableHelper.d.ts +40 -0
  22. package/dist/lib-cjs/internal/paintableHelper.js +287 -0
  23. package/dist/lib-cjs/internal/paintableHelper.js.map +1 -0
  24. package/dist/lib-cjs/internal/tagsHelper.d.ts +12 -0
  25. package/dist/lib-cjs/internal/tagsHelper.js +38 -0
  26. package/dist/lib-cjs/internal/tagsHelper.js.map +1 -0
  27. package/dist/lib-cjs/manager/cameraManager.d.ts +51 -0
  28. package/dist/lib-cjs/manager/cameraManager.js +154 -0
  29. package/dist/lib-cjs/manager/cameraManager.js.map +1 -0
  30. package/dist/lib-cjs/manager/debugManager.d.ts +60 -0
  31. package/dist/lib-cjs/manager/debugManager.js +218 -0
  32. package/dist/lib-cjs/manager/debugManager.js.map +1 -0
  33. package/dist/lib-cjs/manager/eventManager.d.ts +52 -0
  34. package/dist/lib-cjs/manager/eventManager.js +72 -0
  35. package/dist/lib-cjs/manager/eventManager.js.map +1 -0
  36. package/dist/lib-cjs/{api/manager → manager}/gltfExportManager.d.ts +29 -34
  37. package/dist/lib-cjs/{api/manager → manager}/gltfExportManager.js +99 -120
  38. package/dist/lib-cjs/manager/gltfExportManager.js.map +1 -0
  39. package/dist/lib-cjs/manager/materialManager.d.ts +35 -0
  40. package/dist/lib-cjs/manager/materialManager.js +126 -0
  41. package/dist/lib-cjs/manager/materialManager.js.map +1 -0
  42. package/dist/lib-cjs/manager/modelManager.d.ts +145 -0
  43. package/dist/lib-cjs/manager/modelManager.js +381 -0
  44. package/dist/lib-cjs/manager/modelManager.js.map +1 -0
  45. package/dist/lib-cjs/manager/parameterManager.d.ts +210 -0
  46. package/dist/lib-cjs/manager/parameterManager.js +515 -0
  47. package/dist/lib-cjs/manager/parameterManager.js.map +1 -0
  48. package/dist/lib-cjs/manager/sceneManager.d.ts +45 -0
  49. package/dist/lib-cjs/manager/sceneManager.js +65 -0
  50. package/dist/lib-cjs/manager/sceneManager.js.map +1 -0
  51. package/dist/lib-cjs/manager/screenshotManager.d.ts +36 -0
  52. package/dist/lib-cjs/manager/screenshotManager.js +40 -0
  53. package/dist/lib-cjs/manager/screenshotManager.js.map +1 -0
  54. package/dist/lib-cjs/manager/textureManager.d.ts +12 -0
  55. package/dist/lib-cjs/manager/textureManager.js +44 -0
  56. package/dist/lib-cjs/manager/textureManager.js.map +1 -0
  57. package/dist/lib-cjs/viewer.d.ts +117 -0
  58. package/dist/lib-cjs/viewer.js +222 -0
  59. package/dist/lib-cjs/viewer.js.map +1 -0
  60. package/dist/lib-cjs/{api/classes/viewerError.d.ts → viewerError.d.ts} +6 -1
  61. package/dist/lib-cjs/{api/classes/viewerError.js → viewerError.js} +6 -1
  62. package/dist/lib-cjs/viewerError.js.map +1 -0
  63. package/package.json +10 -11
  64. package/src/dev.ts +14 -37
  65. package/src/{types.d.ts → globalTypes.d.ts} +8 -18
  66. package/src/index.ts +79 -113
  67. package/src/internal/cbnCustomBabylonLoaderPlugin.ts +149 -0
  68. package/src/internal/cloningHelper.ts +225 -0
  69. package/src/internal/deviceHelper.ts +25 -0
  70. package/src/{api/util → internal}/geometryHelper.ts +63 -24
  71. package/src/internal/metadataHelper.ts +63 -0
  72. package/src/internal/paintableHelper.ts +310 -0
  73. package/src/internal/tagsHelper.ts +41 -0
  74. package/src/manager/cameraManager.ts +236 -0
  75. package/src/manager/debugManager.ts +245 -0
  76. package/src/manager/eventManager.ts +72 -0
  77. package/src/{api/manager → manager}/gltfExportManager.ts +132 -125
  78. package/src/manager/materialManager.ts +135 -0
  79. package/src/manager/modelManager.ts +456 -0
  80. package/src/manager/parameterManager.ts +652 -0
  81. package/src/manager/sceneManager.ts +101 -0
  82. package/src/manager/screenshotManager.ts +59 -0
  83. package/src/manager/textureManager.ts +32 -0
  84. package/src/viewer.ts +296 -0
  85. package/src/{api/classes/viewerError.ts → viewerError.ts} +6 -1
  86. package/dist/lib-cjs/api/classes/animationInterface.d.ts +0 -8
  87. package/dist/lib-cjs/api/classes/animationInterface.js +0 -3
  88. package/dist/lib-cjs/api/classes/animationInterface.js.map +0 -1
  89. package/dist/lib-cjs/api/classes/dottedPath.d.ts +0 -79
  90. package/dist/lib-cjs/api/classes/dottedPath.js +0 -167
  91. package/dist/lib-cjs/api/classes/dottedPath.js.map +0 -1
  92. package/dist/lib-cjs/api/classes/element.d.ts +0 -153
  93. package/dist/lib-cjs/api/classes/element.js +0 -703
  94. package/dist/lib-cjs/api/classes/element.js.map +0 -1
  95. package/dist/lib-cjs/api/classes/event.d.ts +0 -401
  96. package/dist/lib-cjs/api/classes/event.js +0 -425
  97. package/dist/lib-cjs/api/classes/event.js.map +0 -1
  98. package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +0 -26
  99. package/dist/lib-cjs/api/classes/eventBroadcaster.js +0 -50
  100. package/dist/lib-cjs/api/classes/eventBroadcaster.js.map +0 -1
  101. package/dist/lib-cjs/api/classes/fuzzyMap.d.ts +0 -7
  102. package/dist/lib-cjs/api/classes/fuzzyMap.js +0 -22
  103. package/dist/lib-cjs/api/classes/fuzzyMap.js.map +0 -1
  104. package/dist/lib-cjs/api/classes/parameter.d.ts +0 -410
  105. package/dist/lib-cjs/api/classes/parameter.js +0 -643
  106. package/dist/lib-cjs/api/classes/parameter.js.map +0 -1
  107. package/dist/lib-cjs/api/classes/parameterObservable.d.ts +0 -36
  108. package/dist/lib-cjs/api/classes/parameterObservable.js +0 -73
  109. package/dist/lib-cjs/api/classes/parameterObservable.js.map +0 -1
  110. package/dist/lib-cjs/api/classes/parameterizable.d.ts +0 -15
  111. package/dist/lib-cjs/api/classes/parameterizable.js +0 -103
  112. package/dist/lib-cjs/api/classes/parameterizable.js.map +0 -1
  113. package/dist/lib-cjs/api/classes/placementAnimation.d.ts +0 -45
  114. package/dist/lib-cjs/api/classes/placementAnimation.js +0 -177
  115. package/dist/lib-cjs/api/classes/placementAnimation.js.map +0 -1
  116. package/dist/lib-cjs/api/classes/variant.d.ts +0 -261
  117. package/dist/lib-cjs/api/classes/variant.js +0 -873
  118. package/dist/lib-cjs/api/classes/variant.js.map +0 -1
  119. package/dist/lib-cjs/api/classes/variantInstance.d.ts +0 -53
  120. package/dist/lib-cjs/api/classes/variantInstance.js +0 -126
  121. package/dist/lib-cjs/api/classes/variantInstance.js.map +0 -1
  122. package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +0 -17
  123. package/dist/lib-cjs/api/classes/variantParameterizable.js +0 -87
  124. package/dist/lib-cjs/api/classes/variantParameterizable.js.map +0 -1
  125. package/dist/lib-cjs/api/classes/viewer.d.ts +0 -215
  126. package/dist/lib-cjs/api/classes/viewer.js +0 -709
  127. package/dist/lib-cjs/api/classes/viewer.js.map +0 -1
  128. package/dist/lib-cjs/api/classes/viewerError.js.map +0 -1
  129. package/dist/lib-cjs/api/classes/viewerLight.d.ts +0 -66
  130. package/dist/lib-cjs/api/classes/viewerLight.js +0 -345
  131. package/dist/lib-cjs/api/classes/viewerLight.js.map +0 -1
  132. package/dist/lib-cjs/api/internal/lensRendering.d.ts +0 -8
  133. package/dist/lib-cjs/api/internal/lensRendering.js +0 -12
  134. package/dist/lib-cjs/api/internal/lensRendering.js.map +0 -1
  135. package/dist/lib-cjs/api/internal/sceneSetup.d.ts +0 -13
  136. package/dist/lib-cjs/api/internal/sceneSetup.js +0 -228
  137. package/dist/lib-cjs/api/internal/sceneSetup.js.map +0 -1
  138. package/dist/lib-cjs/api/manager/animationManager.d.ts +0 -30
  139. package/dist/lib-cjs/api/manager/animationManager.js +0 -127
  140. package/dist/lib-cjs/api/manager/animationManager.js.map +0 -1
  141. package/dist/lib-cjs/api/manager/gltfExportManager.js.map +0 -1
  142. package/dist/lib-cjs/api/manager/sceneManager.d.ts +0 -33
  143. package/dist/lib-cjs/api/manager/sceneManager.js +0 -129
  144. package/dist/lib-cjs/api/manager/sceneManager.js.map +0 -1
  145. package/dist/lib-cjs/api/manager/tagManager.d.ts +0 -118
  146. package/dist/lib-cjs/api/manager/tagManager.js +0 -531
  147. package/dist/lib-cjs/api/manager/tagManager.js.map +0 -1
  148. package/dist/lib-cjs/api/manager/textureLoadManager.d.ts +0 -22
  149. package/dist/lib-cjs/api/manager/textureLoadManager.js +0 -108
  150. package/dist/lib-cjs/api/manager/textureLoadManager.js.map +0 -1
  151. package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +0 -106
  152. package/dist/lib-cjs/api/manager/variantInstanceManager.js +0 -291
  153. package/dist/lib-cjs/api/manager/variantInstanceManager.js.map +0 -1
  154. package/dist/lib-cjs/api/store/specStorage.d.ts +0 -32
  155. package/dist/lib-cjs/api/store/specStorage.js +0 -66
  156. package/dist/lib-cjs/api/store/specStorage.js.map +0 -1
  157. package/dist/lib-cjs/api/util/babylonHelper.d.ts +0 -238
  158. package/dist/lib-cjs/api/util/babylonHelper.js +0 -826
  159. package/dist/lib-cjs/api/util/babylonHelper.js.map +0 -1
  160. package/dist/lib-cjs/api/util/debugHelper.d.ts +0 -9
  161. package/dist/lib-cjs/api/util/debugHelper.js +0 -94
  162. package/dist/lib-cjs/api/util/debugHelper.js.map +0 -1
  163. package/dist/lib-cjs/api/util/deviceHelper.d.ts +0 -9
  164. package/dist/lib-cjs/api/util/deviceHelper.js.map +0 -1
  165. package/dist/lib-cjs/api/util/geometryHelper.d.ts +0 -17
  166. package/dist/lib-cjs/api/util/geometryHelper.js.map +0 -1
  167. package/dist/lib-cjs/api/util/globalTypes.d.ts +0 -490
  168. package/dist/lib-cjs/api/util/globalTypes.js +0 -2
  169. package/dist/lib-cjs/api/util/globalTypes.js.map +0 -1
  170. package/dist/lib-cjs/api/util/resourceHelper.d.ts +0 -58
  171. package/dist/lib-cjs/api/util/resourceHelper.js +0 -215
  172. package/dist/lib-cjs/api/util/resourceHelper.js.map +0 -1
  173. package/dist/lib-cjs/api/util/sceneLoaderHelper.d.ts +0 -58
  174. package/dist/lib-cjs/api/util/sceneLoaderHelper.js +0 -229
  175. package/dist/lib-cjs/api/util/sceneLoaderHelper.js.map +0 -1
  176. package/dist/lib-cjs/api/util/stringHelper.d.ts +0 -13
  177. package/dist/lib-cjs/api/util/stringHelper.js +0 -33
  178. package/dist/lib-cjs/api/util/stringHelper.js.map +0 -1
  179. package/dist/lib-cjs/api/util/structureHelper.d.ts +0 -9
  180. package/dist/lib-cjs/api/util/structureHelper.js +0 -58
  181. package/dist/lib-cjs/api/util/structureHelper.js.map +0 -1
  182. package/src/api/classes/animationInterface.ts +0 -10
  183. package/src/api/classes/dottedPath.ts +0 -181
  184. package/src/api/classes/element.ts +0 -766
  185. package/src/api/classes/event.ts +0 -457
  186. package/src/api/classes/eventBroadcaster.ts +0 -52
  187. package/src/api/classes/fuzzyMap.ts +0 -21
  188. package/src/api/classes/parameter.ts +0 -686
  189. package/src/api/classes/parameterObservable.ts +0 -73
  190. package/src/api/classes/parameterizable.ts +0 -87
  191. package/src/api/classes/placementAnimation.ts +0 -162
  192. package/src/api/classes/variant.ts +0 -965
  193. package/src/api/classes/variantInstance.ts +0 -123
  194. package/src/api/classes/variantParameterizable.ts +0 -83
  195. package/src/api/classes/viewer.ts +0 -751
  196. package/src/api/classes/viewerLight.ts +0 -335
  197. package/src/api/internal/debugViewer.ts +0 -90
  198. package/src/api/internal/lensRendering.ts +0 -9
  199. package/src/api/internal/sceneSetup.ts +0 -208
  200. package/src/api/manager/animationManager.ts +0 -143
  201. package/src/api/manager/sceneManager.ts +0 -134
  202. package/src/api/manager/tagManager.ts +0 -572
  203. package/src/api/manager/textureLoadManager.ts +0 -107
  204. package/src/api/manager/variantInstanceManager.ts +0 -306
  205. package/src/api/store/specStorage.ts +0 -68
  206. package/src/api/util/babylonHelper.ts +0 -915
  207. package/src/api/util/debugHelper.ts +0 -121
  208. package/src/api/util/deviceHelper.ts +0 -31
  209. package/src/api/util/globalTypes.ts +0 -566
  210. package/src/api/util/resourceHelper.ts +0 -201
  211. package/src/api/util/sceneLoaderHelper.ts +0 -247
  212. package/src/api/util/stringHelper.ts +0 -30
  213. package/src/api/util/structureHelper.ts +0 -62
@@ -0,0 +1,218 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.DebugManager = void 0;
36
+ const index_1 = require("../index");
37
+ /**
38
+ * Manager for debugging functionalities
39
+ */
40
+ class DebugManager {
41
+ /** @internal */
42
+ constructor(viewer) {
43
+ this.viewer = viewer;
44
+ this._axesViewer = null;
45
+ this._showBoundingSphereForAutofocus = false;
46
+ }
47
+ /**
48
+ * Assign callback for drawing bounding sphere on autofocusing
49
+ * @internal
50
+ */
51
+ registerAutofocusStartListener() {
52
+ this.viewer.eventManager.addListener(index_1.ViewerEvent.AutofocusStart, boundingSphere => this._drawBoundingSphereForAutofocus(boundingSphere));
53
+ }
54
+ /**
55
+ * Enables the Babylon.js [Inspector](https://doc.babylonjs.com/toolsAndResources/tools/inspector).\
56
+ * Due to the additional size of the inspector, this function is only available in "development" builds!
57
+ *
58
+ * @returns Signalizes if inspector could be loaded
59
+ */
60
+ showInspector(options) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ if (process.env.NODE_ENV === 'development') {
63
+ const inspModule = yield Promise.resolve().then(() => __importStar(require(/* webpackChunkName: "inspector"*/ '@babylonjs/inspector')));
64
+ if (!options && window.Cbn) {
65
+ // special case for usage in Combeenation configurator:
66
+ // if no options are set the inspector will be rendered into the parent element of the configurator
67
+ // in this way the configurator layout itself will not be affected by the inspector
68
+ const cfgrParentEl = window.Cbn.utils.Viewer3dHelper.getCfgrParentDomElementForInspector();
69
+ inspModule.Inspector.Show(this.viewer.scene, { globalRoot: cfgrParentEl });
70
+ }
71
+ else {
72
+ inspModule.Inspector.Show(this.viewer.scene, options !== null && options !== void 0 ? options : {});
73
+ }
74
+ // load additional packages for certain inspector features like "node material editor"
75
+ // this is done after showing the debug layer to save time
76
+ yield Promise.resolve().then(() => __importStar(require(/* webpackChunkName: "node-material-editor" */ '@babylonjs/node-editor')));
77
+ yield Promise.resolve().then(() => __importStar(require(/* webpackChunkName: "node-geometry-editor" */ '@babylonjs/node-geometry-editor')));
78
+ return true;
79
+ }
80
+ else {
81
+ // inspector not available, set according warning message in console
82
+ if (window.Cbn) {
83
+ console.warn(`Inspector not loaded.
84
+ The inspector can only be used in development builds (e.g. during development with watch mode, in the configurator preview, ...)
85
+ but not in production (e.g. production build of Custom JS, published configurator, ...).`);
86
+ }
87
+ else {
88
+ console.warn(`Inspector not loaded.
89
+ The inspector can only be used in development builds.`);
90
+ }
91
+ return false;
92
+ }
93
+ });
94
+ }
95
+ hideInspector() {
96
+ var _a;
97
+ (_a = this.viewer.scene.debugLayer) === null || _a === void 0 ? void 0 : _a.hide();
98
+ }
99
+ /**
100
+ * Show world coordinate system with given dimension.\
101
+ * This is especially usefull when working on project with tricky positioning. (e.g. clones)
102
+ */
103
+ showWorldCoordinates(dimension) {
104
+ // make sure to remove already existing debug coordinate systems
105
+ this.hideWorldCoordinates();
106
+ // draw in utility layer, so that there is no interaction with the actually scene content
107
+ // (e.g. glb export, autofocus)
108
+ const utilityLayerScene = index_1.UtilityLayerRenderer.DefaultUtilityLayer.utilityLayerScene;
109
+ const worldCoordRoot = new index_1.TransformNode(DebugManager._WORLD_COORD_ROOT_KEY, utilityLayerScene);
110
+ // axes viewer coordinate system is a bit too large
111
+ // multiply with unify factor to create arrows which exactly match the length of the input dimension
112
+ const factor = DebugManager._getWorldCoordinatesAxesUnifyFactor();
113
+ this._axesViewer = new index_1.AxesViewer(utilityLayerScene, dimension * factor);
114
+ DebugManager._prepareWorldCoordinateAxis('X', this._axesViewer.xAxis, worldCoordRoot, dimension, utilityLayerScene);
115
+ DebugManager._prepareWorldCoordinateAxis('Y', this._axesViewer.yAxis, worldCoordRoot, dimension, utilityLayerScene);
116
+ DebugManager._prepareWorldCoordinateAxis('Z', this._axesViewer.zAxis, worldCoordRoot, dimension, utilityLayerScene);
117
+ }
118
+ hideWorldCoordinates() {
119
+ var _a;
120
+ const utilityLayerScene = index_1.UtilityLayerRenderer.DefaultUtilityLayer.utilityLayerScene;
121
+ (_a = this._axesViewer) === null || _a === void 0 ? void 0 : _a.dispose();
122
+ this._axesViewer = null;
123
+ const worldCoordRoot = utilityLayerScene.getTransformNodeByName(DebugManager._WORLD_COORD_ROOT_KEY);
124
+ if (worldCoordRoot) {
125
+ worldCoordRoot.dispose(false, true);
126
+ }
127
+ }
128
+ /**
129
+ * Draws a wireframe bounding sphere on the next call of {@link CameraManager.autofocusActiveCamera}.\
130
+ * This is usefull for checking which parts of the scene get centered.
131
+ */
132
+ showBoundingSphereForAutofocus() {
133
+ this._showBoundingSphereForAutofocus = true;
134
+ }
135
+ hideBoundingSphereForAutofocus() {
136
+ this._showBoundingSphereForAutofocus = false;
137
+ this._removeBoundingSphereForAutofocus();
138
+ }
139
+ /**
140
+ * Adjust and enhance coordinate axes to fulfill our needs.
141
+ * - moves nodes into common root
142
+ * - adds text node
143
+ */
144
+ static _prepareWorldCoordinateAxis(text, axis, root, dimension, utilityLayerScene) {
145
+ // create unique names
146
+ axis.name = `${DebugManager._WORLD_COORD_ROOT_KEY}.${text}`;
147
+ axis.parent = root;
148
+ // create text mesh via dynamic texture
149
+ const dynamicTexture = new index_1.DynamicTexture(`${DebugManager._WORLD_COORD_ROOT_KEY}.${text}`, 50, utilityLayerScene, true);
150
+ dynamicTexture.hasAlpha = true;
151
+ // 42.5 is a magic offset, so that the text is vertically centered for font size 50px
152
+ // horizontal centering works well with the standard behaviour of Babylon.js (setting "null" as "width")
153
+ dynamicTexture.drawText(text, null, 42.5, 'bold 50px Arial', 'white', 'transparent', true);
154
+ const material = new index_1.StandardMaterial(`${DebugManager._WORLD_COORD_ROOT_KEY}.${text}`, utilityLayerScene);
155
+ material.disableLighting = true;
156
+ material.emissiveColor = DebugManager._DEBUG_AXIS_MAP[text].color;
157
+ material.diffuseTexture = dynamicTexture;
158
+ const plane = index_1.MeshBuilder.CreatePlane(`${DebugManager._WORLD_COORD_ROOT_KEY}.${text}.TextPlane`, { size: dimension / 10 }, utilityLayerScene);
159
+ // make sure that text is located outside of arrow
160
+ plane.position = DebugManager._DEBUG_AXIS_MAP[text].position.multiplyByFloats(dimension * 1.05, dimension * 1.05, dimension * 1.05);
161
+ plane.parent = root;
162
+ plane.material = material;
163
+ // will be rendered on top of "default" meshes => taken from Babylon.js repo "AxesViewer" implementation
164
+ plane.renderingGroupId = 2;
165
+ // setting billboard mode ensures, that the text is always readable
166
+ plane.billboardMode = index_1.TransformNode.BILLBOARDMODE_ALL;
167
+ }
168
+ /**
169
+ * Calculate factor for creating world coordinate axes with exactly one unit in length
170
+ */
171
+ static _getWorldCoordinatesAxesUnifyFactor() {
172
+ // These constants are taken from the Babylon.js repository
173
+ const coneZPosOffset = 0.3;
174
+ const coneHeight = 0.075;
175
+ const baseScaling = 4;
176
+ // cone is moved 0.3 units away from the center
177
+ // the origin of the cone will be located on 1.2, if combined with the base scaling of 4
178
+ // invert that offset to get the origin to 1
179
+ // also consider the cone height to move the tip of the cone to 1 instead the center
180
+ const factor = 1 / ((coneZPosOffset + coneHeight / 2) * baseScaling);
181
+ return factor;
182
+ }
183
+ /**
184
+ * Visualize bounding sphere which is used to zoom in via `autofocusActiveCamera` function
185
+ */
186
+ _drawBoundingSphereForAutofocus(boundingSphere) {
187
+ if (!this._showBoundingSphereForAutofocus) {
188
+ return;
189
+ }
190
+ this._removeBoundingSphereForAutofocus();
191
+ const utilityLayerScene = index_1.UtilityLayerRenderer.DefaultUtilityLayer.utilityLayerScene;
192
+ let boundingMaterial = utilityLayerScene.getMaterialByName(DebugManager._BOUNDING_SPHERE_KEY);
193
+ if (!boundingMaterial) {
194
+ boundingMaterial = new index_1.StandardMaterial(DebugManager._BOUNDING_SPHERE_KEY, utilityLayerScene);
195
+ boundingMaterial.wireframe = true;
196
+ boundingMaterial.alpha = 0.1;
197
+ boundingMaterial.emissiveColor = new index_1.Color3(1, 1, 1);
198
+ }
199
+ const sphere = index_1.MeshBuilder.CreateSphere(DebugManager._BOUNDING_SPHERE_KEY, { diameter: boundingSphere.radius * 2 }, utilityLayerScene);
200
+ sphere.position = boundingSphere.center;
201
+ sphere.material = boundingMaterial;
202
+ sphere.isPickable = false;
203
+ }
204
+ _removeBoundingSphereForAutofocus() {
205
+ const utilityLayerScene = index_1.UtilityLayerRenderer.DefaultUtilityLayer.utilityLayerScene;
206
+ const existingSphere = utilityLayerScene.getMeshByName(DebugManager._BOUNDING_SPHERE_KEY);
207
+ existingSphere === null || existingSphere === void 0 ? void 0 : existingSphere.dispose();
208
+ }
209
+ }
210
+ exports.DebugManager = DebugManager;
211
+ DebugManager._DEBUG_AXIS_MAP = {
212
+ X: { color: index_1.Color3.Red().scale(0.5), position: new index_1.Vector3(1, 0, 0) },
213
+ Y: { color: index_1.Color3.Green().scale(0.5), position: new index_1.Vector3(0, 1, 0) },
214
+ Z: { color: index_1.Color3.Blue().scale(0.5), position: new index_1.Vector3(0, 0, 1) },
215
+ };
216
+ DebugManager._WORLD_COORD_ROOT_KEY = '__world_coordinates__';
217
+ DebugManager._BOUNDING_SPHERE_KEY = '__bounding_sphere__';
218
+ //# sourceMappingURL=debugManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debugManager.js","sourceRoot":"","sources":["../../../src/manager/debugManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAckB;AAKlB;;GAEG;AACH,MAAa,YAAY;IAYvB,gBAAgB;IAChB,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAJjC,gBAAW,GAAsB,IAAI,CAAC;QACtC,oCAA+B,GAAY,KAAK,CAAC;IAGb,CAAC;IAE/C;;;OAGG;IACI,8BAA8B;QACnC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,mBAAW,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAChF,IAAI,CAAC,+BAA+B,CAAC,cAAc,CAAC,CACrD,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACU,aAAa,CAAC,OAA2B;;YACpD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;gBAC1C,MAAM,UAAU,GAAG,wDAAa,kCAAkC,CAAC,sBAAsB,GAAC,CAAC;gBAE3F,IAAI,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,EAAE;oBAC1B,uDAAuD;oBACvD,mGAAmG;oBACnG,mFAAmF;oBACnF,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,mCAAmC,EAAE,CAAC;oBAC3F,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,CAAC;iBAC5E;qBAAM;oBACL,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,E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E,CAAC;IAC5B,CAAC;;AA7NH,oCA8NC;AA7NkB,4BAAe,GAA2C;IACzE,CAAC,EAAE,EAAE,KAAK,EAAE,cAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;IACrE,CAAC,EAAE,EAAE,KAAK,EAAE,cAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;IACvE,CAAC,EAAE,EAAE,KAAK,EAAE,cAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;CACvE,CAAC;AACe,kCAAqB,GAAG,uBAAuB,CAAC;AAChD,iCAAoB,GAAG,qBAAqB,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { Viewer } from '../index';
2
+ import EventEmitter from 'eventemitter3';
3
+ /**
4
+ * Events that are fired by the viewer
5
+ */
6
+ export declare enum ViewerEvent {
7
+ /**
8
+ * Requested material is not available in the scene yet and is about to be created
9
+ * @param materialId
10
+ */
11
+ MaterialCreationStart = "MaterialCreationStart",
12
+ /**
13
+ * Material creation has been finished, that includes:
14
+ * - Load definition from Combeenation server
15
+ * - Load all textures
16
+ * - Compile shader
17
+ * @param materialId
18
+ * @param allMaterialsCreated signalizes that no more materials are currently being created
19
+ */
20
+ MaterialCreationEnd = "MaterialCreationEnd",
21
+ /**
22
+ * Bounding sphere for autofocusing camera has been calculated.
23
+ * This is used internally for debugging purposes.
24
+ * @param boundingSphere
25
+ */
26
+ AutofocusStart = "AutofocusStart"
27
+ }
28
+ /**
29
+ * Manager for eventing system, which ATM is only a slim wrapper about the "eventemitter3" library
30
+ */
31
+ export declare class EventManager {
32
+ protected viewer: Viewer;
33
+ protected _eventEmitter: EventEmitter;
34
+ /** @internal */
35
+ constructor(viewer: Viewer);
36
+ /**
37
+ * Used @internal to fire a viewer event
38
+ */
39
+ fireEvent(event: ViewerEvent, ...args: any[]): void;
40
+ /**
41
+ * Add listener to certain viewer event
42
+ */
43
+ addListener(event: ViewerEvent, fn: EventEmitter.ListenerFn): void;
44
+ /**
45
+ * Remove listener to viewer event
46
+ */
47
+ removeListener(event: ViewerEvent, fn: EventEmitter.ListenerFn): void;
48
+ /**
49
+ * Used @internal to clean eventing sytem before viewer destruction
50
+ */
51
+ removeAllListeners(event?: ViewerEvent): void;
52
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EventManager = exports.ViewerEvent = void 0;
7
+ const eventemitter3_1 = __importDefault(require("eventemitter3"));
8
+ // NOTE: ATM we expose only very few events, due to the following reasons:
9
+ // - Code is generally asynchronous and can be awaited by consumer
10
+ // - We don't want to bloat the code with events that are never used
11
+ /**
12
+ * Events that are fired by the viewer
13
+ */
14
+ var ViewerEvent;
15
+ (function (ViewerEvent) {
16
+ /**
17
+ * Requested material is not available in the scene yet and is about to be created
18
+ * @param materialId
19
+ */
20
+ ViewerEvent["MaterialCreationStart"] = "MaterialCreationStart";
21
+ /**
22
+ * Material creation has been finished, that includes:
23
+ * - Load definition from Combeenation server
24
+ * - Load all textures
25
+ * - Compile shader
26
+ * @param materialId
27
+ * @param allMaterialsCreated signalizes that no more materials are currently being created
28
+ */
29
+ ViewerEvent["MaterialCreationEnd"] = "MaterialCreationEnd";
30
+ /**
31
+ * Bounding sphere for autofocusing camera has been calculated.
32
+ * This is used internally for debugging purposes.
33
+ * @param boundingSphere
34
+ */
35
+ ViewerEvent["AutofocusStart"] = "AutofocusStart";
36
+ })(ViewerEvent = exports.ViewerEvent || (exports.ViewerEvent = {}));
37
+ /**
38
+ * Manager for eventing system, which ATM is only a slim wrapper about the "eventemitter3" library
39
+ */
40
+ class EventManager {
41
+ /** @internal */
42
+ constructor(viewer) {
43
+ this.viewer = viewer;
44
+ this._eventEmitter = new eventemitter3_1.default();
45
+ }
46
+ /**
47
+ * Used @internal to fire a viewer event
48
+ */
49
+ fireEvent(event, ...args) {
50
+ this._eventEmitter.emit(event, ...args);
51
+ }
52
+ /**
53
+ * Add listener to certain viewer event
54
+ */
55
+ addListener(event, fn) {
56
+ this._eventEmitter.addListener(event, fn);
57
+ }
58
+ /**
59
+ * Remove listener to viewer event
60
+ */
61
+ removeListener(event, fn) {
62
+ this._eventEmitter.removeListener(event, fn);
63
+ }
64
+ /**
65
+ * Used @internal to clean eventing sytem before viewer destruction
66
+ */
67
+ removeAllListeners(event) {
68
+ this._eventEmitter.removeAllListeners(event);
69
+ }
70
+ }
71
+ exports.EventManager = EventManager;
72
+ //# sourceMappingURL=eventManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventManager.js","sourceRoot":"","sources":["../../../src/manager/eventManager.ts"],"names":[],"mappings":";;;;;;AACA,kEAAyC;AAEzC,0EAA0E;AAC1E,kEAAkE;AAClE,oEAAoE;AAEpE;;GAEG;AACH,IAAY,WAqBX;AArBD,WAAY,WAAW;IACrB;;;OAGG;IACH,8DAA+C,CAAA;IAC/C;;;;;;;OAOG;IACH,0DAA2C,CAAA;IAC3C;;;;OAIG;IACH,gDAAiC,CAAA;AACnC,CAAC,EArBW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAqBtB;AAED;;GAEG;AACH,MAAa,YAAY;IAGvB,gBAAgB;IAChB,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QACzC,IAAI,CAAC,aAAa,GAAG,IAAI,uBAAY,EAAE,CAAC;IAC1C,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,KAAkB,EAAE,GAAG,IAAW;QACjD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACI,WAAW,CAAC,KAAkB,EAAE,EAA2B;QAChE,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,KAAkB,EAAE,EAA2B;QACnE,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACI,kBAAkB,CAAC,KAAmB;QAC3C,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;CACF;AAnCD,oCAmCC"}
@@ -1,18 +1,35 @@
1
- import { Viewer } from '../classes/viewer';
2
- import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
3
- import { Node as BjsNode } from '@babylonjs/core/node';
4
- import '@babylonjs/serializers/glTF/2.0/Extensions/KHR_texture_transform';
1
+ import { ExcludedGeometryList, IExportOptions, Material, Node, TransformNode, Viewer } from '../index';
2
+ /**
3
+ * Manager for gltf export and augmented reality features
4
+ */
5
5
  export declare class GltfExportManager {
6
6
  protected viewer: Viewer;
7
- protected static readonly _METADATA_PROPS: {
8
- exportNode: string;
9
- deleteAfterExport: string;
10
- exchangeMaterialWith: string;
11
- };
12
7
  protected static readonly _EXPORT_ROOT_NAME = "__export_root__";
13
8
  protected _maxTextureSize: number;
14
- protected constructor(viewer: Viewer);
15
- static create(viewer: Viewer): Promise<GltfExportManager>;
9
+ /**
10
+ * Defines options for the export.
11
+ * We don't allow the user to overwrite certain settings, since we rely on properties like `removeNoopRootNodes` to
12
+ * stay `true` in order to make the AR export work.
13
+ * We could theoretically allow it if AR optimization is not desired, but this may confuse the user.
14
+ */
15
+ protected static _gltfExportOptions(optimizeForAR: boolean, excluded?: ExcludedGeometryList): IExportOptions;
16
+ /**
17
+ * Checks if a node should be available in the export
18
+ */
19
+ protected static _shouldExportNode(node: Node, excluded?: ExcludedGeometryList): boolean;
20
+ /**
21
+ * Creates a clone of the material which should be used for the export.
22
+ * This is mostly required for recreating textures with lower sizes.
23
+ * CAUTION: Material exchanging is not supported for materials that contain certain texture types:
24
+ * - Dynamic textures (Paintables): Cloning dynamic textures doesn't clone the canvas context
25
+ * => so the clone is just empty
26
+ * - Render target textures: Disposing the clone will leave the scene in a "not ready" state
27
+ * => this scenario is not fully analyzed yet, but it's not really worth the effort right now, since this kind of
28
+ * of texture is not really used ATM
29
+ */
30
+ protected static _exchangeMaterial(material: Material): void;
31
+ /** @internal */
32
+ constructor(viewer: Viewer);
16
33
  /**
17
34
  * Exports selected nodes to a file.
18
35
  * @param filename Optional name of the exported .GLB file.
@@ -50,31 +67,9 @@ export declare class GltfExportManager {
50
67
  * Creates a clone of the node which should be used for the export.
51
68
  * Also switches to the cloned material if required.
52
69
  */
53
- protected _prepareNodeForExport(node: BjsNode, clonedParent: TransformNode, excluded?: ExcludedGeometryList): void;
70
+ protected _prepareNodeForExport(node: Node, clonedParent: TransformNode, excluded?: ExcludedGeometryList): void;
54
71
  /**
55
72
  * Help function for receiving all nodes that are marked for the export
56
73
  */
57
74
  protected _getNodesMarkedForExport(meshesOnly?: boolean): TransformNode[];
58
- /**
59
- * Defines options for the export.
60
- * We don't allow the user to overwrite certain settings, since we rely on properties like `removeNoopRootNodes` to
61
- * stay `true` in order to make the AR export work.
62
- * We could theoretically allow it if AR optimization is not desired, but this may confuse the user.
63
- */
64
- protected static _gltfExportOptions(optimizeForAR: boolean, excluded?: ExcludedGeometryList): IExportOptions;
65
- /**
66
- * Checks if a node should be available in the export
67
- */
68
- protected static _shouldExportNode(node: BjsNode, excluded?: ExcludedGeometryList): boolean;
69
- /**
70
- * Creates a clone of the material which should be used for the export.
71
- * This is mostly required for recreating textures with lower sizes.
72
- * CAUTION: Material exchanging is not supported for materials that contain certain texture types:
73
- * - Dynamic textures (Paintables): Cloning dynamic textures doesn't clone the canvas context
74
- * => so the clone is just empty
75
- * - Render target textures: Disposing the clone will leave the scene in a "not ready" state
76
- * => this scenario is not fully analyzed yet, but it's not really worth the effort right now, since this kind of
77
- * of texture is not really used ATM
78
- */
79
- protected static _exchangeMaterial(material: Material): void;
80
75
  }