@inweb/viewer-three 26.8.0 → 26.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,7 +52,7 @@ export class IFCXCloudLoader extends Loader {
52
52
  const textDecoder = new TextDecoder();
53
53
  const json = JSON.parse(textDecoder.decode(arrayBuffer));
54
54
 
55
- const scene = parse(json);
55
+ const scene = await parse(json);
56
56
  clear();
57
57
 
58
58
  let handle = 0;
@@ -73,20 +73,26 @@ export class LightComponent implements IComponent {
73
73
  const extentsCenter = this.viewer.extents.getCenter(new Vector3());
74
74
  const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere()).radius;
75
75
 
76
+ const front = new Vector3()
77
+ .copy(this.viewer.camera.up)
78
+ .cross(new Vector3(1, 0, 0))
79
+ .negate();
80
+
76
81
  this.directionalLight.position
77
- .set(0.5, 0.866, 0) // ~60º
82
+ .copy(this.viewer.camera.up)
83
+ .applyAxisAngle(front, (-Math.PI * 30) / 180)
78
84
  .multiplyScalar(extentsSize * 2)
79
85
  .add(extentsCenter);
80
86
  this.directionalLight.target.position.copy(extentsCenter);
81
87
 
82
88
  this.frontLight.position
83
- .set(0, 0, 1)
89
+ .copy(front)
84
90
  .multiplyScalar(extentsSize * 2)
85
91
  .add(extentsCenter);
86
92
  this.frontLight.target.position.copy(extentsCenter);
87
93
 
88
94
  this.hemisphereLight.position
89
- .set(0, 0, 1)
95
+ .copy(front)
90
96
  .multiplyScalar(extentsSize * 3)
91
97
  .add(extentsCenter);
92
98