@combeenation/3d-viewer 9.2.0 → 9.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combeenation/3d-viewer",
3
- "version": "9.2.0",
3
+ "version": "9.3.0",
4
4
  "description": "Combeenation 3D Viewer",
5
5
  "homepage": "https://github.com/Combeenation/3d-viewer#readme",
6
6
  "bugs": {
@@ -689,6 +689,7 @@ export class Variant extends Parameterizable {
689
689
  this.viewer.scene.addCamera(camera);
690
690
  });
691
691
  this.assetContainer.materials.forEach(material => this.viewer.scene.materials.push(material));
692
+ this.assetContainer.skeletons.forEach(skeleton => this.viewer.scene.skeletons.push(skeleton));
692
693
  this.broadcastEvent(Event.ASSET_LOADING_END, this);
693
694
  resolve(this);
694
695
  },
@@ -165,6 +165,12 @@ export class GltfExportManager {
165
165
  this.setUniqueMeshNames(copiedScene);
166
166
  // get rid of negative scalings and morph targets, since iOS can't handle it in the QuickLook app
167
167
  bakeGeometryOfAllMeshes(copiedScene);
168
+ // certain devices can't load models with skeletons, just remove them since animations are not supported in the AR
169
+ // scene anyway
170
+ while (copiedScene.skeletons.length) {
171
+ const skeleton = copiedScene.skeletons.pop();
172
+ skeleton!.dispose();
173
+ }
168
174
  }
169
175
 
170
176
  return { scene: copiedScene, sceneCopied: true };
@@ -1,6 +1,6 @@
1
1
  import { Event } from '../classes/event';
2
2
  import { EventBroadcaster } from '../classes/eventBroadcaster';
3
- import { isTextureWithOnLoadObservable } from '../util/babylonHelper';
3
+ import { isLoadableTexture } from '../util/babylonHelper';
4
4
  import { sleep } from '../util/resourceHelper';
5
5
  import { BaseTexture } from '@babylonjs/core/Materials/Textures/baseTexture';
6
6
  import { Scene as BabylonScene } from '@babylonjs/core/scene';
@@ -81,8 +81,9 @@ export class TextureLoadManager extends EventBroadcaster {
81
81
  await sleep(0);
82
82
 
83
83
  // Some textures are already in "ready state" after the sleep -> We don't care for them anymore as well as for
84
- // textures which don't come with an `onLoadObservable` (i.e. not of class {@link Texture}).
85
- if (texture.isReady() || !isTextureWithOnLoadObservable(texture)) return;
84
+ // textures which don't come with an `onLoadObservable` (i.e. not of class {@link Texture}) or do not have an URL to
85
+ // load (i.e. RawTexture2DArray texture type for morph target data storage).
86
+ if (!isLoadableTexture(texture) || texture.isReady()) return;
86
87
 
87
88
  const noCurrentLoadingTextures = !this._loadingTextures.size;
88
89
  if (noCurrentLoadingTextures) {
@@ -763,19 +763,21 @@ const getClientRectFromMesh = function (mesh: AbstractMesh, scene: Scene, canvas
763
763
  } as ClientRect;
764
764
  };
765
765
 
766
- type BaseTextureWithOnLoadObservable = BaseTexture & {
766
+ type LoadableBaseTexture = BaseTexture & {
767
+ url: string;
767
768
  onLoadObservable: Observable<BaseTexture>;
768
769
  };
769
770
 
770
771
  /**
771
- * This type guard checks whether the given `BaseTextures` is any of its subtypes which comes with an
772
+ * This type guard checks whether the given `BaseTextures` is any of its subtypes which comes with an url and
772
773
  * `onLoadObservable`.
773
774
  *
774
775
  * !!! Timing of when this function is called is important !!!
775
776
  * See the following for more details: https://forum.babylonjs.com/t/basetexture-whenallready-returns-too-early/34501/6
776
777
  */
777
- const isTextureWithOnLoadObservable = function (texture: BaseTexture): texture is BaseTextureWithOnLoadObservable {
778
- return !!(texture as BaseTextureWithOnLoadObservable).onLoadObservable;
778
+ const isLoadableTexture = function (texture: BaseTexture): texture is LoadableBaseTexture {
779
+ const castedTexture = texture as LoadableBaseTexture;
780
+ return !!castedTexture.url && !!castedTexture.onLoadObservable;
779
781
  };
780
782
 
781
783
  /**
@@ -874,7 +876,7 @@ const drawPaintableOnMaterial = function (
874
876
 
875
877
  export {
876
878
  getRootNode,
877
- isTextureWithOnLoadObservable,
879
+ isLoadableTexture,
878
880
  mapToDottedNodes,
879
881
  getDottedPathForNode,
880
882
  cloneTransformNode,