@colijnit/configuratorcore 262.1.5 → 262.1.6

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.
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three';
2
- import { Group, BufferGeometry, Float32BufferAttribute, Line, LineBasicMaterial, Vector3, CylinderGeometry, Mesh, MeshBasicMaterial, Object3D, EquirectangularReflectionMapping, Vector2, Material as Material$1, Texture, Source, Camera, Box3, LinearSRGBColorSpace, SRGBColorSpace, Color, MaterialLoader, MeshPhongMaterial, NearestFilter, DoubleSide, MeshPhysicalMaterial, MeshStandardMaterial, Euler, Quaternion } from 'three';
2
+ import { Group, BufferGeometry, Float32BufferAttribute, Line, LineBasicMaterial, Vector3, CylinderGeometry, Mesh, MeshBasicMaterial, Object3D, EquirectangularReflectionMapping, Vector2, Material as Material$1, Texture, Source, LinearSRGBColorSpace, SRGBColorSpace, Color, MaterialLoader, MeshPhongMaterial, NearestFilter, DoubleSide, MeshPhysicalMaterial, MeshStandardMaterial, Box3, Euler, Quaternion } from 'three';
3
3
  import { Subject, BehaviorSubject } from 'rxjs';
4
4
  import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
5
5
  import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
@@ -451,7 +451,7 @@ class ThreedUtils {
451
451
  loader.dracoLoader.setDecoderConfig({ type: 'js' });
452
452
  loader.load(file, async (object) => {
453
453
  this.clips = object.animations || [];
454
- const obj = this.cleanedUpObjectsWeb(object.scene, false);
454
+ const obj = this._cleanedUpObjects(object.scene, cleanUp);
455
455
  this._objectCache.set(file, obj);
456
456
  resolve(obj);
457
457
  }, xhr => this._handleUpdateProgressBar(xhr.loaded / xhr.total * 100), error => {
@@ -473,7 +473,7 @@ class ThreedUtils {
473
473
  }
474
474
  }
475
475
  async loadGlbSource(file, setVisibleFalse = true, dracoPath) {
476
- const obj = await this.loadGlbModel(file, true, dracoPath);
476
+ const obj = await this.loadGlbModel(file, false, dracoPath);
477
477
  if (obj) {
478
478
  obj.children = obj.children.filter(c => !(c instanceof THREE.Camera || (c.constructor.name && c.constructor.name.toLowerCase().indexOf('camera') > -1)));
479
479
  obj.children.sort((a, b) => a['name'] < b['name'] ? 1 : -1);
@@ -511,46 +511,6 @@ class ThreedUtils {
511
511
  }, null, reject);
512
512
  });
513
513
  }
514
- cleanedUpObjectsWeb(object, cleanUp = true) {
515
- let obj = new Object3D();
516
- // console.log(this.clips);
517
- object.children.forEach((c) => {
518
- if (!(c instanceof Camera)) {
519
- if (cleanUp && c instanceof Group || (c.children.length === 1 && c.children[0] instanceof Group)) {
520
- this._addGroupChildrenToObject(c, obj);
521
- }
522
- else if ((cleanUp && !(c instanceof Mesh)) || (!(c instanceof Mesh) && !c.name && c.children.length > 0)) {
523
- c.children.forEach((child) => {
524
- child.translateY(c.position.y);
525
- });
526
- c.translateY(-c.position.y);
527
- if (obj.children.length > 0) {
528
- obj.add(c.clone());
529
- }
530
- else {
531
- obj = c.clone();
532
- }
533
- }
534
- else {
535
- // if (c.position.y > 0 || c.position.y < 0) {
536
- // c.children.forEach((child) => {
537
- // child.translateY(c.position.y);
538
- // });
539
- // c.translateY(-c.position.y);
540
- // }
541
- obj.add(c.clone());
542
- }
543
- }
544
- });
545
- const boundingBox = new Box3().setFromObject(obj);
546
- const bbCenterPivot = new Vector3();
547
- boundingBox.getCenter(bbCenterPivot);
548
- const delta = new Vector3().add(bbCenterPivot).negate();
549
- obj.children.forEach((cc) => {
550
- cc.position.add(delta);
551
- });
552
- return obj;
553
- }
554
514
  _cleanedUpObjects(object, cleanUp = true) {
555
515
  let obj = new THREE.Object3D();
556
516
  object.children.forEach((c) => {
@@ -571,12 +531,6 @@ class ThreedUtils {
571
531
  }
572
532
  }
573
533
  else {
574
- if (c.position.y > 0 || c.position.y < 0) {
575
- c.children.forEach((child) => {
576
- child.translateY(c.position.y);
577
- });
578
- c.translateY(-c.position.y);
579
- }
580
534
  obj.add(c.clone());
581
535
  }
582
536
  }