@babylonjs/viewer 5.0.0-rc.2 → 5.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 (159) hide show
  1. package/configuration/configuration.d.ts +13 -13
  2. package/configuration/configuration.js +1 -1
  3. package/configuration/configuration.js.map +1 -1
  4. package/configuration/configurationCompatibility.d.ts +1 -1
  5. package/configuration/configurationCompatibility.js +2 -2
  6. package/configuration/configurationCompatibility.js.map +1 -1
  7. package/configuration/configurationContainer.d.ts +3 -3
  8. package/configuration/configurationContainer.js +1 -1
  9. package/configuration/configurationContainer.js.map +1 -1
  10. package/configuration/globals.d.ts +1 -1
  11. package/configuration/globals.js.map +1 -1
  12. package/configuration/index.d.ts +2 -2
  13. package/configuration/index.js +3 -2
  14. package/configuration/index.js.map +1 -1
  15. package/configuration/interfaces/cameraConfiguration.js.map +1 -1
  16. package/configuration/interfaces/colorGradingConfiguration.js.map +1 -1
  17. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +1 -1
  18. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +1 -1
  19. package/configuration/interfaces/environmentMapConfiguration.js.map +1 -1
  20. package/configuration/interfaces/groundConfiguration.js.map +1 -1
  21. package/configuration/interfaces/imageProcessingConfiguration.js.map +1 -1
  22. package/configuration/interfaces/index.d.ts +15 -15
  23. package/configuration/interfaces/index.js +15 -15
  24. package/configuration/interfaces/index.js.map +1 -1
  25. package/configuration/interfaces/lightConfiguration.js.map +1 -1
  26. package/configuration/interfaces/modelAnimationConfiguration.js.map +1 -1
  27. package/configuration/interfaces/modelConfiguration.d.ts +1 -1
  28. package/configuration/interfaces/modelConfiguration.js.map +1 -1
  29. package/configuration/interfaces/observersConfiguration.js.map +1 -1
  30. package/configuration/interfaces/sceneConfiguration.d.ts +3 -3
  31. package/configuration/interfaces/sceneConfiguration.js.map +1 -1
  32. package/configuration/interfaces/sceneOptimizerConfiguration.js.map +1 -1
  33. package/configuration/interfaces/skyboxConfiguration.d.ts +1 -1
  34. package/configuration/interfaces/skyboxConfiguration.js.map +1 -1
  35. package/configuration/interfaces/templateConfiguration.js.map +1 -1
  36. package/configuration/interfaces/vrConfiguration.d.ts +1 -1
  37. package/configuration/interfaces/vrConfiguration.js.map +1 -1
  38. package/configuration/loader.js +3 -15
  39. package/configuration/loader.js.map +1 -1
  40. package/configuration/mappers.d.ts +3 -3
  41. package/configuration/mappers.js +13 -12
  42. package/configuration/mappers.js.map +1 -1
  43. package/configuration/renderOnlyLoader.d.ts +1 -1
  44. package/configuration/renderOnlyLoader.js +18 -15
  45. package/configuration/renderOnlyLoader.js.map +1 -1
  46. package/configuration/types/default.d.ts +2 -2
  47. package/configuration/types/default.js +37 -36
  48. package/configuration/types/default.js.map +1 -1
  49. package/configuration/types/environmentMap.d.ts +1 -1
  50. package/configuration/types/environmentMap.js +5 -5
  51. package/configuration/types/environmentMap.js.map +1 -1
  52. package/configuration/types/extended.d.ts +2 -2
  53. package/configuration/types/extended.js +49 -49
  54. package/configuration/types/extended.js.map +1 -1
  55. package/configuration/types/index.d.ts +4 -4
  56. package/configuration/types/index.js +14 -13
  57. package/configuration/types/index.js.map +1 -1
  58. package/configuration/types/minimal.d.ts +2 -2
  59. package/configuration/types/minimal.js +12 -12
  60. package/configuration/types/minimal.js.map +1 -1
  61. package/configuration/types/renderOnlyDefault.d.ts +1 -1
  62. package/configuration/types/renderOnlyDefault.js +8 -8
  63. package/configuration/types/renderOnlyDefault.js.map +1 -1
  64. package/configuration/types/shadowLight.d.ts +1 -1
  65. package/configuration/types/shadowLight.js +12 -12
  66. package/configuration/types/shadowLight.js.map +1 -1
  67. package/helper/index.d.ts +3 -3
  68. package/helper/index.js +14 -8
  69. package/helper/index.js.map +1 -1
  70. package/index.d.ts +20 -20
  71. package/index.js +22 -18
  72. package/index.js.map +1 -1
  73. package/initializer.js +8 -7
  74. package/initializer.js.map +1 -1
  75. package/interfaces.js.map +1 -1
  76. package/labs/environmentSerializer.d.ts +6 -6
  77. package/labs/environmentSerializer.js +18 -14
  78. package/labs/environmentSerializer.js.map +1 -1
  79. package/labs/texture.d.ts +7 -8
  80. package/labs/texture.js +30 -27
  81. package/labs/texture.js.map +1 -1
  82. package/labs/viewerLabs.d.ts +11 -11
  83. package/labs/viewerLabs.js +9 -7
  84. package/labs/viewerLabs.js.map +1 -1
  85. package/license.md +71 -0
  86. package/loader/modelLoader.d.ts +10 -7
  87. package/loader/modelLoader.js +26 -19
  88. package/loader/modelLoader.js.map +1 -1
  89. package/loader/plugins/applyMaterialConfig.d.ts +4 -4
  90. package/loader/plugins/applyMaterialConfig.js.map +1 -1
  91. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +2 -2
  92. package/loader/plugins/extendedMaterialLoaderPlugin.js +1 -1
  93. package/loader/plugins/extendedMaterialLoaderPlugin.js.map +1 -1
  94. package/loader/plugins/index.d.ts +5 -4
  95. package/loader/plugins/index.js +9 -8
  96. package/loader/plugins/index.js.map +1 -1
  97. package/loader/plugins/loaderPlugin.d.ts +7 -7
  98. package/loader/plugins/loaderPlugin.js.map +1 -1
  99. package/loader/plugins/msftLodLoaderPlugin.d.ts +5 -5
  100. package/loader/plugins/msftLodLoaderPlugin.js +2 -1
  101. package/loader/plugins/msftLodLoaderPlugin.js.map +1 -1
  102. package/loader/plugins/telemetryLoaderPlugin.d.ts +4 -4
  103. package/loader/plugins/telemetryLoaderPlugin.js +4 -4
  104. package/loader/plugins/telemetryLoaderPlugin.js.map +1 -1
  105. package/managers/observablesManager.d.ts +6 -6
  106. package/managers/observablesManager.js +1 -1
  107. package/managers/observablesManager.js.map +1 -1
  108. package/managers/sceneManager.d.ts +28 -30
  109. package/managers/sceneManager.js +96 -95
  110. package/managers/sceneManager.js.map +1 -1
  111. package/managers/telemetryManager.d.ts +6 -6
  112. package/managers/telemetryManager.js +6 -6
  113. package/managers/telemetryManager.js.map +1 -1
  114. package/model/modelAnimation.d.ts +14 -14
  115. package/model/modelAnimation.js +3 -3
  116. package/model/modelAnimation.js.map +1 -1
  117. package/model/viewerModel.d.ts +23 -31
  118. package/model/viewerModel.js +51 -46
  119. package/model/viewerModel.js.map +1 -1
  120. package/optimizer/custom/extended.d.ts +3 -5
  121. package/optimizer/custom/extended.js +3 -5
  122. package/optimizer/custom/extended.js.map +1 -1
  123. package/optimizer/custom/index.d.ts +1 -1
  124. package/optimizer/custom/index.js +1 -1
  125. package/optimizer/custom/index.js.map +1 -1
  126. package/package.json +41 -215
  127. package/readme.md +12 -8
  128. package/renderOnlyIndex.d.ts +10 -10
  129. package/renderOnlyIndex.js +6 -4
  130. package/renderOnlyIndex.js.map +1 -1
  131. package/templating/eventManager.d.ts +1 -1
  132. package/templating/eventManager.js +4 -2
  133. package/templating/eventManager.js.map +1 -1
  134. package/templating/plugins/hdButtonPlugin.d.ts +2 -2
  135. package/templating/plugins/hdButtonPlugin.js +2 -15
  136. package/templating/plugins/hdButtonPlugin.js.map +1 -1
  137. package/templating/plugins/printButton.d.ts +2 -3
  138. package/templating/plugins/printButton.js +3 -16
  139. package/templating/plugins/printButton.js.map +1 -1
  140. package/templating/templateManager.d.ts +8 -7
  141. package/templating/templateManager.js +72 -62
  142. package/templating/templateManager.js.map +1 -1
  143. package/templating/viewerTemplatePlugin.d.ts +1 -1
  144. package/templating/viewerTemplatePlugin.js +4 -4
  145. package/templating/viewerTemplatePlugin.js.map +1 -1
  146. package/viewer/defaultViewer.d.ts +17 -11
  147. package/viewer/defaultViewer.js +116 -121
  148. package/viewer/defaultViewer.js.map +1 -1
  149. package/viewer/renderOnlyViewer.d.ts +2 -2
  150. package/viewer/renderOnlyViewer.js +17 -24
  151. package/viewer/renderOnlyViewer.js.map +1 -1
  152. package/viewer/viewer.d.ts +19 -18
  153. package/viewer/viewer.js +63 -49
  154. package/viewer/viewer.js.map +1 -1
  155. package/viewer/viewerManager.d.ts +5 -5
  156. package/viewer/viewerManager.js +4 -3
  157. package/viewer/viewerManager.js.map +1 -1
  158. package/viewer/viewerWithTemplate.js +2 -15
  159. package/viewer/viewerWithTemplate.js.map +1 -1
@@ -10,8 +10,6 @@ var TelemetryManager = /** @class */ (function () {
10
10
  Object.defineProperty(TelemetryManager.prototype, "broadcast", {
11
11
  /**
12
12
  * Receives a telemetry event
13
- * @param event The name of the Telemetry event
14
- * @param details An additional value, or an object containing a list of property/value pairs
15
13
  */
16
14
  get: function () {
17
15
  return this._event;
@@ -22,6 +20,7 @@ var TelemetryManager = /** @class */ (function () {
22
20
  /**
23
21
  * Log a Telemetry event for errors raised on the WebGL context.
24
22
  * @param engine The Babylon engine with the WebGL context.
23
+ * @param viewerId
25
24
  */
26
25
  TelemetryManager.prototype.flushWebGLErrors = function (engine, viewerId) {
27
26
  if (!engine) {
@@ -41,7 +40,7 @@ var TelemetryManager = /** @class */ (function () {
41
40
  Object.defineProperty(TelemetryManager.prototype, "enable", {
42
41
  /**
43
42
  * Enable or disable telemetry events
44
- * @param enabled Boolan, true if events are enabled
43
+ * @param enabled Boolean, true if events are enabled
45
44
  */
46
45
  set: function (enabled) {
47
46
  if (enabled) {
@@ -63,6 +62,7 @@ var TelemetryManager = /** @class */ (function () {
63
62
  /**
64
63
  * Called on event when enabled
65
64
  * @param event - The name of the Telemetry event
65
+ * @param viewerId
66
66
  * @param details An additional value, or an object containing a list of property/value pairs
67
67
  */
68
68
  TelemetryManager.prototype._eventEnabled = function (event, viewerId, details) {
@@ -72,11 +72,11 @@ var TelemetryManager = /** @class */ (function () {
72
72
  session: this.session,
73
73
  date: new Date(),
74
74
  now: window.performance ? window.performance.now() : Date.now(),
75
- detail: null
75
+ detail: null,
76
76
  };
77
77
  if (typeof details === "object") {
78
78
  for (var attr in details) {
79
- if (details.hasOwnProperty(attr)) {
79
+ if (Object.prototype.hasOwnProperty.call(details, attr)) {
80
80
  telemetryData[attr] = details[attr];
81
81
  }
82
82
  }
@@ -88,7 +88,7 @@ var TelemetryManager = /** @class */ (function () {
88
88
  };
89
89
  Object.defineProperty(TelemetryManager.prototype, "session", {
90
90
  /**
91
- * Returns the current session ID or creates one if it doesn't exixt
91
+ * Returns the current session ID or creates one if it doesn't exist
92
92
  * @return The current session ID
93
93
  */
94
94
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryManager.js","sourceRoot":"","sources":["../../../../sourceES6/viewer/src/managers/telemetryManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAgB7D;;GAEG;AACH;IAAA;QAEW,iCAA4B,GAA8B,IAAI,UAAU,EAAE,CAAC;QAI1E,WAAM,GAA8D,IAAI,CAAC,aAAa,CAAC;IAgGnG,CAAC;IAzFG,sBAAW,uCAAS;QALpB;;;;WAIG;aACH;YACI,OAAO,IAAI,CAAC,MAAM,CAAC;QACvB,CAAC;;;OAAA;IAED;;;OAGG;IACI,2CAAgB,GAAvB,UAAwB,MAAc,EAAE,QAAiB;QACrD,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,SAAS,GAAG,IAAI,CAAC;QAErB,OAAO,SAAS,EAAE;YACd,IAAI,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,KAAK,KAAK,CAAC,EAAE;gBACb,SAAS,GAAG,KAAK,CAAC;aACrB;iBAAM;gBACH,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;aAC7D;SACJ;IACL,CAAC;IAMD,sBAAW,oCAAM;QAJjB;;;WAGG;aACH,UAAkB,OAAgB;YAC9B,IAAI,OAAO,EAAE;gBACT,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC;aACpC;iBAAM;gBACH,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC;aACrC;QACL,CAAC;;;OAAA;IAED;;OAEG;IACK,yCAAc,GAAtB;QACI,gBAAgB;IACpB,CAAC;IAED;;;;OAIG;IACK,wCAAa,GAArB,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sourcesContent":["import { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Engine } from \"@babylonjs/core/Engines/engine\";\r\n\r\n\r\n/**\r\n * The data structure of a telemetry event.\r\n */\r\nexport interface TelemetryData {\r\n event: string;\r\n session: string;\r\n date: Date;\r\n now: number;\r\n viewerId?: string;\r\n detail: any;\r\n}\r\n\r\n/**\r\n * Receives Telemetry events and raises events to the API\r\n */\r\nexport class TelemetryManager {\r\n\r\n public onEventBroadcastedObservable: Observable<TelemetryData> = new Observable();\r\n\r\n private _currentSessionId: string;\r\n\r\n private _event: (event: string, viewerId?: string, details?: any) => void = this._eventEnabled;\r\n\r\n /**\r\n * Receives a telemetry event\r\n * @param event The name of the Telemetry event\r\n * @param details An additional value, or an object containing a list of property/value pairs\r\n */\r\n public get broadcast() {\r\n return this._event;\r\n }\r\n\r\n /**\r\n * Log a Telemetry event for errors raised on the WebGL context.\r\n * @param engine The Babylon engine with the WebGL context.\r\n */\r\n public flushWebGLErrors(engine: Engine, viewerId?: string) {\r\n if (!engine) {\r\n return;\r\n }\r\n let logErrors = true;\r\n\r\n while (logErrors) {\r\n let error = engine.getError();\r\n if (error === 0) {\r\n logErrors = false;\r\n } else {\r\n this.broadcast(\"WebGL Error\", viewerId, { error: error });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Enable or disable telemetry events\r\n * @param enabled Boolan, true if events are enabled\r\n */\r\n public set enable(enabled: boolean) {\r\n if (enabled) {\r\n this._event = this._eventEnabled;\r\n } else {\r\n this._event = this._eventDisabled;\r\n }\r\n }\r\n\r\n /**\r\n * Called on event when disabled, typically do nothing here\r\n */\r\n private _eventDisabled(): void {\r\n // nothing to do\r\n }\r\n\r\n /**\r\n * Called on event when enabled\r\n * @param event - The name of the Telemetry event\r\n * @param details An additional value, or an object containing a list of property/value pairs\r\n */\r\n private _eventEnabled(event: string, viewerId?: string, details?: any): void {\r\n let telemetryData: TelemetryData = {\r\n viewerId,\r\n event: event,\r\n session: this.session,\r\n date: new Date(),\r\n now: window.performance ? window.performance.now() : Date.now(),\r\n detail: null\r\n };\r\n\r\n if (typeof details === \"object\") {\r\n for (var attr in details) {\r\n if (details.hasOwnProperty(attr)) {\r\n telemetryData[attr] = details[attr];\r\n }\r\n }\r\n } else if (details) {\r\n telemetryData.detail = details;\r\n }\r\n\r\n this.onEventBroadcastedObservable.notifyObservers(telemetryData);\r\n }\r\n\r\n /**\r\n * Returns the current session ID or creates one if it doesn't exixt\r\n * @return The current session ID\r\n */\r\n public get session(): string {\r\n if (!this._currentSessionId) {\r\n //String + Timestamp + Random Integer\r\n this._currentSessionId = \"SESSION_\" + Date.now() + Math.floor(Math.random() * 0x10000);\r\n }\r\n return this._currentSessionId;\r\n }\r\n\r\n /**\r\n * Disposes the telemetry manager\r\n */\r\n public dispose() {\r\n this.onEventBroadcastedObservable.clear();\r\n }\r\n}\r\n\r\nexport const telemetryManager = new TelemetryManager();\r\n"]}
1
+ {"version":3,"file":"telemetryManager.js","sourceRoot":"","sources":["../../../../../tools/viewer/src/managers/telemetryManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAelD;;GAEG;AACH;IAAA;QACW,iCAA4B,GAA8B,IAAI,UAAU,EAAE,CAAC;QAI1E,WAAM,GAA8D,IAAI,CAAC,aAAa,CAAC;IAgGnG,CAAC;IA3FG,sBAAW,uCAAS;QAHpB;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,MAAM,CAAC;QACvB,CAAC;;;OAAA;IAED;;;;OAIG;IACI,2CAAgB,GAAvB,UAAwB,MAAc,EAAE,QAAiB;QACrD,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,SAAS,GAAG,IAAI,CAAC;QAErB,OAAO,SAAS,EAAE;YACd,IAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;YAChC,IAAI,KAAK,KAAK,CAAC,EAAE;gBACb,SAAS,GAAG,KAAK,CAAC;aACrB;iBAAM;gBACH,IA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I,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE;gBACzB,qCAAqC;gBACrC,IAAI,CAAC,iBAAiB,GAAG,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;aAC1F;YACD,OAAO,IAAI,CAAC,iBAAiB,CAAC;QAClC,CAAC;;;OAAA;IAED;;OAEG;IACI,kCAAO,GAAd;QACI,IAAI,CAAC,4BAA4B,CAAC,KAAK,EAAE,CAAC;IAC9C,CAAC;IACL,uBAAC;AAAD,CAAC,AArGD,IAqGC;;AAED,MAAM,CAAC,IAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC","sourcesContent":["import { Observable } from \"core/Misc/observable\";\r\nimport type { Engine } from \"core/Engines/engine\";\r\n\r\n/**\r\n * The data structure of a telemetry event.\r\n */\r\nexport interface TelemetryData {\r\n event: string;\r\n session: string;\r\n date: Date;\r\n now: number;\r\n viewerId?: string;\r\n detail: any;\r\n}\r\n\r\n/**\r\n * Receives Telemetry events and raises events to the API\r\n */\r\nexport class TelemetryManager {\r\n public onEventBroadcastedObservable: Observable<TelemetryData> = new Observable();\r\n\r\n private _currentSessionId: string;\r\n\r\n private _event: (event: string, viewerId?: string, details?: any) => void = this._eventEnabled;\r\n\r\n /**\r\n * Receives a telemetry event\r\n */\r\n public get broadcast() {\r\n return this._event;\r\n }\r\n\r\n /**\r\n * Log a Telemetry event for errors raised on the WebGL context.\r\n * @param engine The Babylon engine with the WebGL context.\r\n * @param viewerId\r\n */\r\n public flushWebGLErrors(engine: Engine, viewerId?: string) {\r\n if (!engine) {\r\n return;\r\n }\r\n let logErrors = true;\r\n\r\n while (logErrors) {\r\n const error = engine.getError();\r\n if (error === 0) {\r\n logErrors = false;\r\n } else {\r\n this.broadcast(\"WebGL Error\", viewerId, { error: error });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Enable or disable telemetry events\r\n * @param enabled Boolean, true if events are enabled\r\n */\r\n public set enable(enabled: boolean) {\r\n if (enabled) {\r\n this._event = this._eventEnabled;\r\n } else {\r\n this._event = this._eventDisabled;\r\n }\r\n }\r\n\r\n /**\r\n * Called on event when disabled, typically do nothing here\r\n */\r\n private _eventDisabled(): void {\r\n // nothing to do\r\n }\r\n\r\n /**\r\n * Called on event when enabled\r\n * @param event - The name of the Telemetry event\r\n * @param viewerId\r\n * @param details An additional value, or an object containing a list of property/value pairs\r\n */\r\n private _eventEnabled(event: string, viewerId?: string, details?: any): void {\r\n const telemetryData: TelemetryData = {\r\n viewerId,\r\n event: event,\r\n session: this.session,\r\n date: new Date(),\r\n now: window.performance ? window.performance.now() : Date.now(),\r\n detail: null,\r\n };\r\n\r\n if (typeof details === \"object\") {\r\n for (const attr in details) {\r\n if (Object.prototype.hasOwnProperty.call(details, attr)) {\r\n (telemetryData as any)[attr] = details[attr];\r\n }\r\n }\r\n } else if (details) {\r\n telemetryData.detail = details;\r\n }\r\n\r\n this.onEventBroadcastedObservable.notifyObservers(telemetryData);\r\n }\r\n\r\n /**\r\n * Returns the current session ID or creates one if it doesn't exist\r\n * @return The current session ID\r\n */\r\n public get session(): string {\r\n if (!this._currentSessionId) {\r\n //String + Timestamp + Random Integer\r\n this._currentSessionId = \"SESSION_\" + Date.now() + Math.floor(Math.random() * 0x10000);\r\n }\r\n return this._currentSessionId;\r\n }\r\n\r\n /**\r\n * Disposes the telemetry manager\r\n */\r\n public dispose() {\r\n this.onEventBroadcastedObservable.clear();\r\n }\r\n}\r\n\r\nexport const telemetryManager = new TelemetryManager();\r\n"]}
@@ -1,5 +1,5 @@
1
- import { Vector3 } from "@babylonjs/core/Maths/math.vector";
2
- import { AnimationGroup } from "@babylonjs/core/Animations/index";
1
+ import type { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
2
+ import type { AnimationGroup } from "@babylonjs/core/Animations/index.js";
3
3
  /**
4
4
  * Animation play mode enum - is the animation looping or playing once
5
5
  */
@@ -72,12 +72,12 @@ export interface IModelAnimation {
72
72
  /**
73
73
  * Get the max numbers of frame available in the animation group
74
74
  *
75
- * In correlation to an arry, this would be ".length"
75
+ * In correlation to an array, this would be ".length"
76
76
  */
77
77
  readonly frames: number;
78
78
  /**
79
79
  * Get the current frame playing right now.
80
- * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)
80
+ * This can be used to poll the frame currently playing (and, for example, display a progress bar with the data)
81
81
  *
82
82
  * In correlation to an array, this would be the current index
83
83
  */
@@ -97,34 +97,34 @@ export interface IModelAnimation {
97
97
  /**
98
98
  * Start the animation
99
99
  */
100
- start(): any;
100
+ start(): void;
101
101
  /**
102
102
  * Stop the animation.
103
103
  * This will fail silently if the animation group is already stopped.
104
104
  */
105
- stop(): any;
105
+ stop(): void;
106
106
  /**
107
107
  * Pause the animation
108
108
  * This will fail silently if the animation is not currently playing
109
109
  */
110
- pause(): any;
110
+ pause(): void;
111
111
  /**
112
112
  * Reset this animation
113
113
  */
114
- reset(): any;
114
+ reset(): void;
115
115
  /**
116
116
  * Restart the animation
117
117
  */
118
- restart(): any;
118
+ restart(): void;
119
119
  /**
120
120
  * Go to a specific
121
121
  * @param frameNumber the frame number to go to
122
122
  */
123
- goToFrame(frameNumber: number): any;
123
+ goToFrame(frameNumber: number): void;
124
124
  /**
125
125
  * Dispose this animation
126
126
  */
127
- dispose(): any;
127
+ dispose(): void;
128
128
  }
129
129
  /**
130
130
  * The GroupModelAnimation is an implementation of the IModelAnimation interface using BABYLON's
@@ -136,7 +136,7 @@ export declare class GroupModelAnimation implements IModelAnimation {
136
136
  private _state;
137
137
  /**
138
138
  * Create a new GroupModelAnimation object using an AnimationGroup object
139
- * @param _animationGroup The aniamtion group to base the class on
139
+ * @param _animationGroup The animation group to base the class on
140
140
  */
141
141
  constructor(_animationGroup: AnimationGroup);
142
142
  /**
@@ -158,12 +158,12 @@ export declare class GroupModelAnimation implements IModelAnimation {
158
158
  /**
159
159
  * Get the max numbers of frame available in the animation group
160
160
  *
161
- * In correlation to an arry, this would be ".length"
161
+ * In correlation to an array, this would be ".length"
162
162
  */
163
163
  get frames(): number;
164
164
  /**
165
165
  * Get the current frame playing right now.
166
- * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)
166
+ * This can be used to poll the frame currently playing (and, for example, display a progress bar with the data)
167
167
  *
168
168
  * In correlation to an array, this would be the current index
169
169
  */
@@ -42,7 +42,7 @@ export var EasingFunction;
42
42
  var GroupModelAnimation = /** @class */ (function () {
43
43
  /**
44
44
  * Create a new GroupModelAnimation object using an AnimationGroup object
45
- * @param _animationGroup The aniamtion group to base the class on
45
+ * @param _animationGroup The animation group to base the class on
46
46
  */
47
47
  function GroupModelAnimation(_animationGroup) {
48
48
  var _this = this;
@@ -94,7 +94,7 @@ var GroupModelAnimation = /** @class */ (function () {
94
94
  /**
95
95
  * Get the max numbers of frame available in the animation group
96
96
  *
97
- * In correlation to an arry, this would be ".length"
97
+ * In correlation to an array, this would be ".length"
98
98
  */
99
99
  get: function () {
100
100
  return this._animationGroup.to - this._animationGroup.from;
@@ -105,7 +105,7 @@ var GroupModelAnimation = /** @class */ (function () {
105
105
  Object.defineProperty(GroupModelAnimation.prototype, "currentFrame", {
106
106
  /**
107
107
  * Get the current frame playing right now.
108
- * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)
108
+ * This can be used to poll the frame currently playing (and, for example, display a progress bar with the data)
109
109
  *
110
110
  * In correlation to an array, this would be the current index
111
111
  */
@@ -1 +1 @@
1
- {"version":3,"file":"modelAnimation.js","sourceRoot":"","sources":["../../../../sourceES6/viewer/src/model/modelAnimation.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IACzB,yDAAI,CAAA;IACJ,yDAAI,CAAA;AACR,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACt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AAC,CAAC;QACtF,IAAI,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE;YAChC,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC;SACxC;IACL,CAAC;IAED;;OAEG;IACH,mCAAK,GAAL;QACI,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;IACxC,CAAC;IAED;;;OAGG;IACI,kCAAI,GAAX;QACI,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE;YACjC,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC;SACxC;IACL,CAAC;IAED;;OAEG;IACI,qCAAO,GAAd;QACI,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;IACL,0BAAC;AAAD,CAAC,AAnLD,IAmLC","sourcesContent":["import { Vector3 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { AnimationGroup, Animatable } from \"@babylonjs/core/Animations/index\";\r\n\r\n/**\r\n * Animation play mode enum - is the animation looping or playing once\r\n */\r\nexport enum AnimationPlayMode {\r\n ONCE,\r\n LOOP\r\n}\r\n\r\n/**\r\n * An enum representing the current state of an animation object\r\n */\r\nexport enum AnimationState {\r\n INIT,\r\n PLAYING,\r\n PAUSED,\r\n STOPPED,\r\n ENDED\r\n}\r\n\r\n/**\r\n * The different type of easing functions available\r\n */\r\nexport enum EasingFunction {\r\n Linear = 0,\r\n CircleEase = 1,\r\n BackEase = 2,\r\n BounceEase = 3,\r\n CubicEase = 4,\r\n ElasticEase = 5,\r\n ExponentialEase = 6,\r\n PowerEase = 7,\r\n QuadraticEase = 8,\r\n QuarticEase = 9,\r\n QuinticEase = 10,\r\n SineEase = 11\r\n}\r\n\r\n/**\r\n * Defines a simple animation to be applied to a model (scale).\r\n */\r\nexport interface ModelAnimationConfiguration {\r\n /**\r\n * Time of animation, in seconds\r\n */\r\n time: number;\r\n\r\n /**\r\n * Scale to apply\r\n */\r\n scaling?: Vector3;\r\n\r\n /**\r\n * Easing function to apply\r\n * See SPECTRE.EasingFunction\r\n */\r\n easingFunction?: number;\r\n\r\n /**\r\n * An Easing mode to apply to the easing function\r\n * See BABYLON.EasingFunction\r\n */\r\n easingMode?: number;\r\n}\r\n\r\n/**\r\n * This interface can be implemented to define new types of ModelAnimation objects.\r\n */\r\nexport interface IModelAnimation {\r\n /**\r\n * Current animation state (playing, stopped etc')\r\n */\r\n readonly state: AnimationState;\r\n /**\r\n * the name of the animation\r\n */\r\n readonly name: string;\r\n /**\r\n * Get the max numbers of frame available in the animation group\r\n *\r\n * In correlation to an arry, this would be \".length\"\r\n */\r\n readonly frames: number;\r\n /**\r\n * Get the current frame playing right now.\r\n * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)\r\n *\r\n * In correlation to an array, this would be the current index\r\n */\r\n readonly currentFrame: number;\r\n /**\r\n * Animation's FPS value\r\n */\r\n readonly fps: number;\r\n /**\r\n * Get or set the animation's speed ration (Frame-to-fps)\r\n */\r\n speedRatio: number;\r\n /**\r\n * Gets or sets the aimation's play mode.\r\n */\r\n playMode: AnimationPlayMode;\r\n /**\r\n * Start the animation\r\n */\r\n start();\r\n /**\r\n * Stop the animation.\r\n * This will fail silently if the animation group is already stopped.\r\n */\r\n stop();\r\n /**\r\n * Pause the animation\r\n * This will fail silently if the animation is not currently playing\r\n */\r\n pause();\r\n /**\r\n * Reset this animation\r\n */\r\n reset();\r\n /**\r\n * Restart the animation\r\n */\r\n restart();\r\n /**\r\n * Go to a specific\r\n * @param frameNumber the frame number to go to\r\n */\r\n goToFrame(frameNumber: number);\r\n /**\r\n * Dispose this animation\r\n */\r\n dispose();\r\n}\r\n\r\n/**\r\n * The GroupModelAnimation is an implementation of the IModelAnimation interface using BABYLON's\r\n * native GroupAnimation class.\r\n */\r\nexport class GroupModelAnimation implements IModelAnimation {\r\n\r\n private _playMode: AnimationPlayMode;\r\n private _state: AnimationState;\r\n\r\n /**\r\n * Create a new GroupModelAnimation object using an AnimationGroup object\r\n * @param _animationGroup The aniamtion group to base the class on\r\n */\r\n constructor(private _animationGroup: AnimationGroup) {\r\n this._state = AnimationState.INIT;\r\n this._playMode = AnimationPlayMode.LOOP;\r\n\r\n this._animationGroup.onAnimationEndObservable.add(() => {\r\n this.stop();\r\n this._state = AnimationState.ENDED;\r\n });\r\n }\r\n\r\n /**\r\n * Get the animation's name\r\n */\r\n public get name() {\r\n return this._animationGroup.name;\r\n }\r\n\r\n /**\r\n * Get the current animation's state\r\n */\r\n public get state() {\r\n return this._state;\r\n }\r\n\r\n /**\r\n * Gets the speed ratio to use for all animations\r\n */\r\n public get speedRatio(): number {\r\n return this._animationGroup.speedRatio;\r\n }\r\n\r\n /**\r\n * Sets the speed ratio to use for all animations\r\n */\r\n public set speedRatio(value: number) {\r\n this._animationGroup.speedRatio = value;\r\n }\r\n\r\n /**\r\n * Get the max numbers of frame available in the animation group\r\n *\r\n * In correlation to an arry, this would be \".length\"\r\n */\r\n public get frames(): number {\r\n return this._animationGroup.to - this._animationGroup.from;\r\n }\r\n\r\n /**\r\n * Get the current frame playing right now.\r\n * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)\r\n *\r\n * In correlation to an array, this would be the current index\r\n */\r\n public get currentFrame(): number {\r\n if (this._animationGroup.targetedAnimations[0] && this._animationGroup.targetedAnimations[0].animation.runtimeAnimations[0]) {\r\n return this._animationGroup.targetedAnimations[0].animation.runtimeAnimations[0].currentFrame - this._animationGroup.from;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n\r\n /**\r\n * Get the FPS value of this animation\r\n */\r\n public get fps(): number {\r\n // get the first currentFrame found\r\n for (let i = 0; i < this._animationGroup.animatables.length; ++i) {\r\n let animatable: Animatable = this._animationGroup.animatables[i];\r\n let animations = animatable.getAnimations();\r\n if (!animations || !animations.length) {\r\n continue;\r\n }\r\n for (let idx = 0; idx < animations.length; ++idx) {\r\n if (animations[idx].animation && animations[idx].animation.framePerSecond) {\r\n return animations[idx].animation.framePerSecond;\r\n }\r\n }\r\n }\r\n return 0;\r\n }\r\n\r\n /**\r\n * What is the animation'S play mode (looping or played once)\r\n */\r\n public get playMode(): AnimationPlayMode {\r\n return this._playMode;\r\n }\r\n\r\n /**\r\n * Set the play mode.\r\n * If the animation is played, it will continue playing at least once more, depending on the new play mode set.\r\n * If the animation is not set, the will be initialized and will wait for the user to start playing it.\r\n */\r\n public set playMode(value: AnimationPlayMode) {\r\n if (value === this._playMode) {\r\n return;\r\n }\r\n\r\n this._playMode = value;\r\n\r\n if (this.state === AnimationState.PLAYING) {\r\n this._animationGroup.play(this._playMode === AnimationPlayMode.LOOP);\r\n } else {\r\n this._animationGroup.reset();\r\n this._state = AnimationState.INIT;\r\n }\r\n }\r\n\r\n /**\r\n * Reset the animation group\r\n */\r\n reset() {\r\n this._animationGroup.reset();\r\n }\r\n\r\n /**\r\n * Restart the animation group\r\n */\r\n restart() {\r\n if (this.state === AnimationState.PAUSED) {\r\n this._animationGroup.restart();\r\n }\r\n else {\r\n this.start();\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param frameNumber Go to a specific frame in the animation\r\n */\r\n goToFrame(frameNumber: number) {\r\n this._animationGroup.goToFrame(frameNumber + this._animationGroup.from);\r\n }\r\n\r\n /**\r\n * Start playing the animation.\r\n */\r\n public start() {\r\n this._animationGroup.start(this.playMode === AnimationPlayMode.LOOP, this.speedRatio);\r\n if (this._animationGroup.isStarted) {\r\n this._state = AnimationState.PLAYING;\r\n }\r\n }\r\n\r\n /**\r\n * Pause the animation\r\n */\r\n pause() {\r\n this._animationGroup.pause();\r\n this._state = AnimationState.PAUSED;\r\n }\r\n\r\n /**\r\n * Stop the animation.\r\n * This will fail silently if the animation group is already stopped.\r\n */\r\n public stop() {\r\n this._animationGroup.stop();\r\n if (!this._animationGroup.isStarted) {\r\n this._state = AnimationState.STOPPED;\r\n }\r\n }\r\n\r\n /**\r\n * Dispose this animation object.\r\n */\r\n public dispose() {\r\n this._animationGroup.dispose();\r\n }\r\n}"]}
1
+ {"version":3,"file":"modelAnimation.js","sourceRoot":"","sources":["../../../../../tools/viewer/src/model/modelAnimation.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IACzB,yDAAI,CAAA;IACJ,yDAAI,CAAA;AACR,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACtB,mDAAI,CAAA;IACJ,yDAAO,CAAA;IACP,uDAAM,CAAA;IACN,yDAAO,CAAA;IACP,qDAAK,CAAA;AACT,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAaX;AAbD,WAAY,cAAc;IACtB,uDAAU,CAAA;IACV,+DAAc,CAAA;IACd,2DAAY,CAAA;IACZ,+DAAc,CAAA;IACd,6DAAa,CAAA;IACb,iEAAe,CAAA;IACf,yEAAmB,CAAA;IACnB,6DAAa,CAAA;IACb,qEAAiB,CAAA;IACjB,iEAAe,CAAA;IACf,kEAAgB,CAAA;IAChB,4DAAa,CAAA;AACjB,CAAC,EAbW,cAAc,KAAd,cAAc,QAazB;AAmGD;;;GAGG;AACH;IAII;;;OAGG;IACH,6BAAoB,eAA+B;QAAnD,iBAQC;QARmB,oBAAe,GAAf,eAAe,CAAgB;QAC/C,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC,IAAI,CAAC;QAExC,IAAI,CAAC,eAAe,CAAC,wBAAwB,CAAC,GAAG,CAAC;YAC9C,KAAI,CAAC,IAAI,EAAE,CAAC;YACZ,KAAI,CAAC,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC;QACvC,CAAC,CAAC,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AAC,eAAe,CAAC,OAAO,EAAE,CAAC;SAClC;aAAM;YACH,IAAI,CAAC,KAAK,EAAE,CAAC;SAChB;IACL,CAAC;IAED;;;OAGG;IACH,uCAAS,GAAT,UAAU,WAAmB;QACzB,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC5E,CAAC;IAED;;OAEG;IACI,mCAAK,GAAZ;QACI,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,KAAK,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACtF,IAAI,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE;YAChC,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC;SACxC;IACL,CAAC;IAED;;OAEG;IACH,mCAAK,GAAL;QACI,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;IACxC,CAAC;IAED;;;OAGG;IACI,kCAAI,GAAX;QACI,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE;YACjC,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC;SACxC;IACL,CAAC;IAED;;OAEG;IACI,qCAAO,GAAd;QACI,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;IACL,0BAAC;AAAD,CAAC,AAjLD,IAiLC","sourcesContent":["import type { Vector3 } from \"core/Maths/math.vector\";\r\n// eslint-disable-next-line import/no-internal-modules\r\nimport type { AnimationGroup, Animatable } from \"core/Animations/index\";\r\n\r\n/**\r\n * Animation play mode enum - is the animation looping or playing once\r\n */\r\nexport enum AnimationPlayMode {\r\n ONCE,\r\n LOOP,\r\n}\r\n\r\n/**\r\n * An enum representing the current state of an animation object\r\n */\r\nexport enum AnimationState {\r\n INIT,\r\n PLAYING,\r\n PAUSED,\r\n STOPPED,\r\n ENDED,\r\n}\r\n\r\n/**\r\n * The different type of easing functions available\r\n */\r\nexport enum EasingFunction {\r\n Linear = 0,\r\n CircleEase = 1,\r\n BackEase = 2,\r\n BounceEase = 3,\r\n CubicEase = 4,\r\n ElasticEase = 5,\r\n ExponentialEase = 6,\r\n PowerEase = 7,\r\n QuadraticEase = 8,\r\n QuarticEase = 9,\r\n QuinticEase = 10,\r\n SineEase = 11,\r\n}\r\n\r\n/**\r\n * Defines a simple animation to be applied to a model (scale).\r\n */\r\nexport interface ModelAnimationConfiguration {\r\n /**\r\n * Time of animation, in seconds\r\n */\r\n time: number;\r\n\r\n /**\r\n * Scale to apply\r\n */\r\n scaling?: Vector3;\r\n\r\n /**\r\n * Easing function to apply\r\n * See SPECTRE.EasingFunction\r\n */\r\n easingFunction?: number;\r\n\r\n /**\r\n * An Easing mode to apply to the easing function\r\n * See BABYLON.EasingFunction\r\n */\r\n easingMode?: number;\r\n}\r\n\r\n/**\r\n * This interface can be implemented to define new types of ModelAnimation objects.\r\n */\r\nexport interface IModelAnimation {\r\n /**\r\n * Current animation state (playing, stopped etc')\r\n */\r\n readonly state: AnimationState;\r\n /**\r\n * the name of the animation\r\n */\r\n readonly name: string;\r\n /**\r\n * Get the max numbers of frame available in the animation group\r\n *\r\n * In correlation to an array, this would be \".length\"\r\n */\r\n readonly frames: number;\r\n /**\r\n * Get the current frame playing right now.\r\n * This can be used to poll the frame currently playing (and, for example, display a progress bar with the data)\r\n *\r\n * In correlation to an array, this would be the current index\r\n */\r\n readonly currentFrame: number;\r\n /**\r\n * Animation's FPS value\r\n */\r\n readonly fps: number;\r\n /**\r\n * Get or set the animation's speed ration (Frame-to-fps)\r\n */\r\n speedRatio: number;\r\n /**\r\n * Gets or sets the aimation's play mode.\r\n */\r\n playMode: AnimationPlayMode;\r\n /**\r\n * Start the animation\r\n */\r\n start(): void;\r\n /**\r\n * Stop the animation.\r\n * This will fail silently if the animation group is already stopped.\r\n */\r\n stop(): void;\r\n /**\r\n * Pause the animation\r\n * This will fail silently if the animation is not currently playing\r\n */\r\n pause(): void;\r\n /**\r\n * Reset this animation\r\n */\r\n reset(): void;\r\n /**\r\n * Restart the animation\r\n */\r\n restart(): void;\r\n /**\r\n * Go to a specific\r\n * @param frameNumber the frame number to go to\r\n */\r\n goToFrame(frameNumber: number): void;\r\n /**\r\n * Dispose this animation\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * The GroupModelAnimation is an implementation of the IModelAnimation interface using BABYLON's\r\n * native GroupAnimation class.\r\n */\r\nexport class GroupModelAnimation implements IModelAnimation {\r\n private _playMode: AnimationPlayMode;\r\n private _state: AnimationState;\r\n\r\n /**\r\n * Create a new GroupModelAnimation object using an AnimationGroup object\r\n * @param _animationGroup The animation group to base the class on\r\n */\r\n constructor(private _animationGroup: AnimationGroup) {\r\n this._state = AnimationState.INIT;\r\n this._playMode = AnimationPlayMode.LOOP;\r\n\r\n this._animationGroup.onAnimationEndObservable.add(() => {\r\n this.stop();\r\n this._state = AnimationState.ENDED;\r\n });\r\n }\r\n\r\n /**\r\n * Get the animation's name\r\n */\r\n public get name() {\r\n return this._animationGroup.name;\r\n }\r\n\r\n /**\r\n * Get the current animation's state\r\n */\r\n public get state() {\r\n return this._state;\r\n }\r\n\r\n /**\r\n * Gets the speed ratio to use for all animations\r\n */\r\n public get speedRatio(): number {\r\n return this._animationGroup.speedRatio;\r\n }\r\n\r\n /**\r\n * Sets the speed ratio to use for all animations\r\n */\r\n public set speedRatio(value: number) {\r\n this._animationGroup.speedRatio = value;\r\n }\r\n\r\n /**\r\n * Get the max numbers of frame available in the animation group\r\n *\r\n * In correlation to an array, this would be \".length\"\r\n */\r\n public get frames(): number {\r\n return this._animationGroup.to - this._animationGroup.from;\r\n }\r\n\r\n /**\r\n * Get the current frame playing right now.\r\n * This can be used to poll the frame currently playing (and, for example, display a progress bar with the data)\r\n *\r\n * In correlation to an array, this would be the current index\r\n */\r\n public get currentFrame(): number {\r\n if (this._animationGroup.targetedAnimations[0] && this._animationGroup.targetedAnimations[0].animation.runtimeAnimations[0]) {\r\n return this._animationGroup.targetedAnimations[0].animation.runtimeAnimations[0].currentFrame - this._animationGroup.from;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n\r\n /**\r\n * Get the FPS value of this animation\r\n */\r\n public get fps(): number {\r\n // get the first currentFrame found\r\n for (let i = 0; i < this._animationGroup.animatables.length; ++i) {\r\n const animatable: Animatable = this._animationGroup.animatables[i];\r\n const animations = animatable.getAnimations();\r\n if (!animations || !animations.length) {\r\n continue;\r\n }\r\n for (let idx = 0; idx < animations.length; ++idx) {\r\n if (animations[idx].animation && animations[idx].animation.framePerSecond) {\r\n return animations[idx].animation.framePerSecond;\r\n }\r\n }\r\n }\r\n return 0;\r\n }\r\n\r\n /**\r\n * What is the animation'S play mode (looping or played once)\r\n */\r\n public get playMode(): AnimationPlayMode {\r\n return this._playMode;\r\n }\r\n\r\n /**\r\n * Set the play mode.\r\n * If the animation is played, it will continue playing at least once more, depending on the new play mode set.\r\n * If the animation is not set, the will be initialized and will wait for the user to start playing it.\r\n */\r\n public set playMode(value: AnimationPlayMode) {\r\n if (value === this._playMode) {\r\n return;\r\n }\r\n\r\n this._playMode = value;\r\n\r\n if (this.state === AnimationState.PLAYING) {\r\n this._animationGroup.play(this._playMode === AnimationPlayMode.LOOP);\r\n } else {\r\n this._animationGroup.reset();\r\n this._state = AnimationState.INIT;\r\n }\r\n }\r\n\r\n /**\r\n * Reset the animation group\r\n */\r\n reset() {\r\n this._animationGroup.reset();\r\n }\r\n\r\n /**\r\n * Restart the animation group\r\n */\r\n restart() {\r\n if (this.state === AnimationState.PAUSED) {\r\n this._animationGroup.restart();\r\n } else {\r\n this.start();\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param frameNumber Go to a specific frame in the animation\r\n */\r\n goToFrame(frameNumber: number) {\r\n this._animationGroup.goToFrame(frameNumber + this._animationGroup.from);\r\n }\r\n\r\n /**\r\n * Start playing the animation.\r\n */\r\n public start() {\r\n this._animationGroup.start(this.playMode === AnimationPlayMode.LOOP, this.speedRatio);\r\n if (this._animationGroup.isStarted) {\r\n this._state = AnimationState.PLAYING;\r\n }\r\n }\r\n\r\n /**\r\n * Pause the animation\r\n */\r\n pause() {\r\n this._animationGroup.pause();\r\n this._state = AnimationState.PAUSED;\r\n }\r\n\r\n /**\r\n * Stop the animation.\r\n * This will fail silently if the animation group is already stopped.\r\n */\r\n public stop() {\r\n this._animationGroup.stop();\r\n if (!this._animationGroup.isStarted) {\r\n this._state = AnimationState.STOPPED;\r\n }\r\n }\r\n\r\n /**\r\n * Dispose this animation object.\r\n */\r\n public dispose() {\r\n this._animationGroup.dispose();\r\n }\r\n}\r\n"]}
@@ -1,19 +1,18 @@
1
- import { IDisposable } from "@babylonjs/core/scene";
2
- import { ISceneLoaderPlugin, ISceneLoaderPluginAsync } from "@babylonjs/core/Loading/sceneLoader";
3
- import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh";
4
- import { IParticleSystem } from "@babylonjs/core/Particles/IParticleSystem";
5
- import { Skeleton } from "@babylonjs/core/Bones/skeleton";
6
- import { Observable } from "@babylonjs/core/Misc/observable";
7
- import { ISceneLoaderProgressEvent } from "@babylonjs/core/Loading/sceneLoader";
8
- import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup";
9
- import { Animation } from "@babylonjs/core/Animations/index";
10
- import { Nullable } from "@babylonjs/core/types";
11
- import { Material } from "@babylonjs/core/Materials/material";
12
- import { IAsset } from "babylonjs-gltf2interface";
13
- import { IModelConfiguration } from "../configuration/interfaces/modelConfiguration";
14
- import { IModelAnimation } from "./modelAnimation";
15
- import { ObservablesManager } from "../managers/observablesManager";
16
- import { ConfigurationContainer } from "../configuration/configurationContainer";
1
+ import type { IDisposable } from "@babylonjs/core/scene.js";
2
+ import type { ISceneLoaderPlugin, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent } from "@babylonjs/core/Loading/sceneLoader.js";
3
+ import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
4
+ import type { IParticleSystem } from "@babylonjs/core/Particles/IParticleSystem.js";
5
+ import type { Skeleton } from "@babylonjs/core/Bones/skeleton.js";
6
+ import { Observable } from "@babylonjs/core/Misc/observable.js";
7
+ import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup.js";
8
+ import { Animation } from "@babylonjs/core/Animations/index.js";
9
+ import type { Nullable } from "@babylonjs/core/types.js";
10
+ import type { Material } from "@babylonjs/core/Materials/material.js";
11
+ import type { IAsset } from "babylonjs-gltf2interface";
12
+ import type { IModelConfiguration } from "../configuration/interfaces/modelConfiguration";
13
+ import type { IModelAnimation } from "./modelAnimation";
14
+ import type { ObservablesManager } from "../managers/observablesManager";
15
+ import type { ConfigurationContainer } from "../configuration/configurationContainer";
17
16
  /**
18
17
  * The current state of the model
19
18
  */
@@ -94,11 +93,9 @@ export declare class ViewerModel implements IDisposable {
94
93
  */
95
94
  loadId: number;
96
95
  loadInfo: IAsset;
97
- private _loadedUrl;
98
96
  private _modelConfiguration;
99
97
  private _loaderDone;
100
98
  private _entryAnimation;
101
- private _exitAnimation;
102
99
  private _scaleTransition;
103
100
  private _animatables;
104
101
  private _frameRate;
@@ -124,7 +121,7 @@ export declare class ViewerModel implements IDisposable {
124
121
  * @param mesh the new mesh to add
125
122
  * @param triggerLoaded should this mesh trigger the onLoaded observable. Used when adding meshes manually.
126
123
  */
127
- addMesh(mesh: AbstractMesh, triggerLoaded?: boolean): Promise<ViewerModel> | undefined;
124
+ addMesh(mesh: AbstractMesh, triggerLoaded?: boolean): Promise<ViewerModel>;
128
125
  /**
129
126
  * get the list of meshes (excluding the root mesh)
130
127
  */
@@ -151,11 +148,6 @@ export declare class ViewerModel implements IDisposable {
151
148
  * @param completeCallback A function to call when the animation has completed
152
149
  */
153
150
  private _enterScene;
154
- /**
155
- * Animates the model from the current position to the exit-screen position
156
- * @param completeCallback A function to call when the animation has completed
157
- */
158
- private _exitScene;
159
151
  private _modelComplete;
160
152
  /**
161
153
  * Add a new animation group to this model.
@@ -198,13 +190,13 @@ export declare class ViewerModel implements IDisposable {
198
190
  */
199
191
  private _applyAnimation;
200
192
  /**
201
- * Begin @animations with the specified @easingFunction
202
- * @param animations The BABYLON Animations to begin
203
- * @param duration of transition, in seconds
204
- * @param easingFunction An easing function to apply
205
- * @param easingMode A easing mode to apply to the easingFunction
206
- * @param onAnimationEnd Call back trigger at the end of the animation.
207
- */
193
+ * Begin @animations with the specified @easingFunction
194
+ * @param animations The BABYLON Animations to begin
195
+ * @param duration of transition, in seconds
196
+ * @param easingFunction An easing function to apply
197
+ * @param easingMode A easing mode to apply to the easingFunction
198
+ * @param onAnimationEnd Call back trigger at the end of the animation.
199
+ */
208
200
  transitionTo(animations: Animation[], duration: number, easingFunction: any, easingMode: number | undefined, // BABYLON.EasingFunction.EASINGMODE_EASEINOUT,
209
201
  onAnimationEnd: () => void): void;
210
202
  /**
@@ -1,14 +1,14 @@
1
1
  import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
2
2
  import { Observable } from "@babylonjs/core/Misc/observable.js";
3
3
  import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup.js";
4
- import { Animation, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase } from "@babylonjs/core/Animations/index.js";
4
+ import { Animation, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, } from "@babylonjs/core/Animations/index.js";
5
5
  import { Quaternion, Vector3 } from "@babylonjs/core/Maths/math.vector.js";
6
6
  import { Tags } from "@babylonjs/core/Misc/tags.js";
7
7
  import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
8
8
  import { MultiMaterial } from "@babylonjs/core/Materials/multiMaterial.js";
9
9
  import { Tools } from "@babylonjs/core/Misc/tools.js";
10
10
  import { GroupModelAnimation, AnimationPlayMode, EasingFunction, AnimationState } from "./modelAnimation.js";
11
- import { deepmerge, extendClassWithConfig } from '../helper/index.js';
11
+ import { deepmerge, extendClassWithConfig } from "../helper/index.js";
12
12
  /**
13
13
  * The current state of the model
14
14
  */
@@ -123,7 +123,7 @@ var ViewerModel = /** @class */ (function () {
123
123
  configurable: true
124
124
  });
125
125
  ViewerModel.prototype._checkCompleteState = function () {
126
- if (this._loaderDone && (this.state === ModelState.ENTRYDONE)) {
126
+ if (this._loaderDone && this.state === ModelState.ENTRYDONE) {
127
127
  this._modelComplete();
128
128
  }
129
129
  };
@@ -145,6 +145,7 @@ var ViewerModel = /** @class */ (function () {
145
145
  if (triggerLoaded) {
146
146
  return this.onLoadedObservable.notifyObserversWithPromise(this);
147
147
  }
148
+ return Promise.resolve(this);
148
149
  };
149
150
  Object.defineProperty(ViewerModel.prototype, "meshes", {
150
151
  /**
@@ -202,8 +203,7 @@ var ViewerModel = /** @class */ (function () {
202
203
  }
203
204
  });
204
205
  }
205
- var completeCallback = function () {
206
- };
206
+ var completeCallback = function () { };
207
207
  if (this._modelConfiguration.animation) {
208
208
  if (this._modelConfiguration.animation.playOnce) {
209
209
  this._animations.forEach(function (a) {
@@ -211,8 +211,7 @@ var ViewerModel = /** @class */ (function () {
211
211
  });
212
212
  }
213
213
  if (this._modelConfiguration.animation.autoStart && this._animations.length) {
214
- var animationName_1 = this._modelConfiguration.animation.autoStart === true ?
215
- this._animations[0].name : this._modelConfiguration.animation.autoStart;
214
+ var animationName_1 = this._modelConfiguration.animation.autoStart === true ? this._animations[0].name : this._modelConfiguration.animation.autoStart;
216
215
  completeCallback = function () {
217
216
  _this.playAnimation(animationName_1);
218
217
  };
@@ -245,22 +244,24 @@ var ViewerModel = /** @class */ (function () {
245
244
  scene.animationPropertiesOverride.enableBlending = false;
246
245
  this._applyAnimation(this._entryAnimation, true, callback);
247
246
  };
248
- /**
249
- * Animates the model from the current position to the exit-screen position
250
- * @param completeCallback A function to call when the animation has completed
251
- */
252
- ViewerModel.prototype._exitScene = function (completeCallback) {
253
- if (!this._exitAnimation) {
254
- completeCallback();
255
- return;
256
- }
257
- this._applyAnimation(this._exitAnimation, false, completeCallback);
258
- };
247
+ // /**
248
+ // * Animates the model from the current position to the exit-screen position
249
+ // * @param completeCallback A function to call when the animation has completed
250
+ // */
251
+ // private _exitScene(completeCallback: () => void): void {
252
+ // if (!this._exitAnimation) {
253
+ // completeCallback();
254
+ // return;
255
+ // }
256
+ // this._applyAnimation(this._exitAnimation, false, completeCallback);
257
+ // }
259
258
  ViewerModel.prototype._modelComplete = function () {
260
259
  var _this = this;
261
260
  //reapply material defines to be sure:
262
261
  var meshes = this._pivotMesh.getChildMeshes(false);
263
- meshes.filter(function (m) { return m.material; }).forEach(function (mesh) {
262
+ meshes
263
+ .filter(function (m) { return m.material; })
264
+ .forEach(function (mesh) {
264
265
  _this._applyModelMaterialConfiguration(mesh.material);
265
266
  });
266
267
  this.state = ModelState.COMPLETE;
@@ -341,16 +342,16 @@ var ViewerModel = /** @class */ (function () {
341
342
  };
342
343
  var updateXYZ = function (variable, configValues) {
343
344
  if (configValues.x !== undefined) {
344
- updateMeshesWithNoParent(variable, configValues.x, 'x');
345
+ updateMeshesWithNoParent(variable, configValues.x, "x");
345
346
  }
346
347
  if (configValues.y !== undefined) {
347
- updateMeshesWithNoParent(variable, configValues.y, 'y');
348
+ updateMeshesWithNoParent(variable, configValues.y, "y");
348
349
  }
349
350
  if (configValues.z !== undefined) {
350
- updateMeshesWithNoParent(variable, configValues.z, 'z');
351
+ updateMeshesWithNoParent(variable, configValues.z, "z");
351
352
  }
352
353
  if (configValues.w !== undefined) {
353
- updateMeshesWithNoParent(variable, configValues.w, 'w');
354
+ updateMeshesWithNoParent(variable, configValues.w, "w");
354
355
  }
355
356
  };
356
357
  if (this._modelConfiguration.normalize) {
@@ -397,7 +398,7 @@ var ViewerModel = /** @class */ (function () {
397
398
  }
398
399
  // position?
399
400
  if (this._modelConfiguration.position) {
400
- updateXYZ('position', this._modelConfiguration.position);
401
+ updateXYZ("position", this._modelConfiguration.position);
401
402
  }
402
403
  if (this._modelConfiguration.rotation) {
403
404
  //quaternion?
@@ -407,10 +408,10 @@ var ViewerModel = /** @class */ (function () {
407
408
  mesh.rotationQuaternion = new Quaternion();
408
409
  }
409
410
  });
410
- updateXYZ('rotationQuaternion', this._modelConfiguration.rotation);
411
+ updateXYZ("rotationQuaternion", this._modelConfiguration.rotation);
411
412
  }
412
413
  else {
413
- updateXYZ('rotation', this._modelConfiguration.rotation);
414
+ updateXYZ("rotation", this._modelConfiguration.rotation);
414
415
  }
415
416
  }
416
417
  if (this._modelConfiguration.rotationOffsetAxis) {
@@ -422,28 +423,30 @@ var ViewerModel = /** @class */ (function () {
422
423
  });
423
424
  }
424
425
  if (this._modelConfiguration.scaling) {
425
- updateXYZ('scaling', this._modelConfiguration.scaling);
426
+ updateXYZ("scaling", this._modelConfiguration.scaling);
426
427
  }
427
428
  if (this._modelConfiguration.castShadow) {
428
429
  this._meshes.forEach(function (mesh) {
429
- Tags.AddTagsTo(mesh, 'castShadow');
430
+ Tags.AddTagsTo(mesh, "castShadow");
430
431
  });
431
432
  }
432
433
  var meshes = this._pivotMesh.getChildMeshes(false);
433
- meshes.filter(function (m) { return m.material; }).forEach(function (mesh) {
434
+ meshes
435
+ .filter(function (m) { return m.material; })
436
+ .forEach(function (mesh) {
434
437
  _this._applyModelMaterialConfiguration(mesh.material);
435
438
  });
436
439
  if (this._modelConfiguration.entryAnimation) {
437
440
  this._entryAnimation = this._modelAnimationConfigurationToObject(this._modelConfiguration.entryAnimation);
438
441
  }
439
- if (this._modelConfiguration.exitAnimation) {
440
- this._exitAnimation = this._modelAnimationConfigurationToObject(this._modelConfiguration.exitAnimation);
441
- }
442
+ // if (this._modelConfiguration.exitAnimation) {
443
+ // this._exitAnimation = this._modelAnimationConfigurationToObject(this._modelConfiguration.exitAnimation);
444
+ // }
442
445
  this.onAfterConfigure.notifyObservers(this);
443
446
  };
444
447
  ViewerModel.prototype._modelAnimationConfigurationToObject = function (animConfig) {
445
448
  var anim = {
446
- time: 0.5
449
+ time: 0.5,
447
450
  };
448
451
  if (animConfig.scaling) {
449
452
  anim.scaling = Vector3.Zero();
@@ -512,18 +515,20 @@ var ViewerModel = /** @class */ (function () {
512
515
  }
513
516
  }
514
517
  //Start the animation(s)
515
- this.transitionTo(animations, animationConfiguration.time, this._createEasingFunction(animationConfiguration.easingFunction), animationConfiguration.easingMode, function () { if (completeCallback) {
516
- completeCallback();
517
- } });
518
+ this.transitionTo(animations, animationConfiguration.time, this._createEasingFunction(animationConfiguration.easingFunction), animationConfiguration.easingMode, function () {
519
+ if (completeCallback) {
520
+ completeCallback();
521
+ }
522
+ });
518
523
  };
519
524
  /**
520
- * Begin @animations with the specified @easingFunction
521
- * @param animations The BABYLON Animations to begin
522
- * @param duration of transition, in seconds
523
- * @param easingFunction An easing function to apply
524
- * @param easingMode A easing mode to apply to the easingFunction
525
- * @param onAnimationEnd Call back trigger at the end of the animation.
526
- */
525
+ * Begin @animations with the specified @easingFunction
526
+ * @param animations The BABYLON Animations to begin
527
+ * @param duration of transition, in seconds
528
+ * @param easingFunction An easing function to apply
529
+ * @param easingMode A easing mode to apply to the easingFunction
530
+ * @param onAnimationEnd Call back trigger at the end of the animation.
531
+ */
527
532
  ViewerModel.prototype.transitionTo = function (animations, duration, easingFunction, easingMode, // BABYLON.EasingFunction.EASINGMODE_EASEINOUT,
528
533
  onAnimationEnd) {
529
534
  if (easingMode === void 0) { easingMode = 2; }
@@ -557,12 +562,12 @@ var ViewerModel = /** @class */ (function () {
557
562
  animation.setKeys([
558
563
  {
559
564
  frame: 0,
560
- value: startValue
565
+ value: startValue,
561
566
  },
562
567
  {
563
568
  frame: this._frameRate * duration,
564
- value: endValue
565
- }
569
+ value: endValue,
570
+ },
566
571
  ]);
567
572
  };
568
573
  /**