@things-factory/scene-visualizer 6.0.6 → 6.0.8

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@things-factory/scene-visualizer",
3
3
  "description": "The visualizer component for things-scene.",
4
- "version": "6.0.6",
4
+ "version": "6.0.8",
5
5
  "things-scene": true,
6
6
  "browser": "src/index.js",
7
7
  "author": "heartyoh <heartyoh@hatiolab.com>",
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "@hatiolab/things-scene": "^3.2.0",
19
19
  "lit": "^2.5.0",
20
- "three": "^0.149.0"
20
+ "three": "^0.150.1"
21
21
  },
22
- "gitHead": "483b3f62690284db348d176ccc1b82825fda0c98"
22
+ "gitHead": "c883904927d790f21f9e821ddbb4b74be370040e"
23
23
  }
@@ -5,6 +5,7 @@
5
5
  import { Component, RectPath, Shape } from '@hatiolab/things-scene'
6
6
  import * as THREE from 'three'
7
7
  import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
8
+ import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader'
8
9
  import GLTFLogo from '../assets/canvasicon-gltf.png'
9
10
  import Component3d from './component-3d'
10
11
  import Object3D from './object3d'
@@ -48,6 +49,11 @@ export default class GLTFObject extends Object3D {
48
49
 
49
50
  let gltfLoader = new GLTFLoader()
50
51
 
52
+ // Optional: Provide a DRACOLoader instance to decode compressed mesh data
53
+ const dracoLoader = new DRACOLoader()
54
+ dracoLoader.setDecoderPath('/node_modules/three/examples/jsm/libs/draco/')
55
+ gltfLoader.setDRACOLoader(dracoLoader)
56
+
51
57
  var fullSrc = this._visualizer.app.url(src)
52
58
  gltfLoader.setCrossOrigin('use-credentials')
53
59
 
package/src/visualizer.js CHANGED
@@ -408,7 +408,6 @@ export default class Visualizer extends ContainerAbstract {
408
408
  cameraX,
409
409
  cameraY,
410
410
  cameraZ,
411
- gammaFactor = 2,
412
411
  legendTarget,
413
412
  exposure = 2.5
414
413
  } = this.model
@@ -452,20 +451,20 @@ export default class Visualizer extends ContainerAbstract {
452
451
  context,
453
452
  precision: precision,
454
453
  alpha: true,
455
- antialias: antialias
454
+ antialias
456
455
  })
457
456
  } catch (e) {
458
457
  this._noSupportWebgl = true
459
458
  }
460
459
 
461
- if (this._noSupportWebgl) return
460
+ if (this._noSupportWebgl) {
461
+ return
462
+ }
462
463
 
463
464
  this._renderer.autoClear = true
464
465
 
465
- if (gammaFactor) {
466
- this._renderer.outputEncoding = THREE.GammaEncoding
467
- this._renderer.gammaFactor = gammaFactor
468
- }
466
+ this._renderer.outputEncoding = THREE.sRGBEncoding
467
+
469
468
  this._renderer.physicallyCorrectLights = true
470
469
  this._renderer.toneMappingExposure = Math.pow(exposure, 5.0)
471
470