@xviewer.js/debug 1.0.0-alpha.6 → 1.0.0-alpha.60

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/dist/main.js CHANGED
@@ -451,14 +451,14 @@ class NumberController extends Controller {
451
451
  return false;
452
452
  }
453
453
  updateDisplay() {
454
- const value = this.getValue();
454
+ const value = this._snap(this.getValue());
455
455
  if (this._hasSlider) {
456
456
  let percent = (value - this._min) / (this._max - this._min);
457
457
  percent = Math.max(0, Math.min(percent, 1));
458
458
  this.$fill.style.width = percent * 100 + '%';
459
459
  }
460
460
  if (!this._inputFocused) {
461
- this.$input.value = value;
461
+ this.$input.value = "" + value;
462
462
  }
463
463
  return this;
464
464
  }
@@ -863,8 +863,7 @@ class ColorController extends Controller {
863
863
  this.setValue(newValue);
864
864
  } else {
865
865
  this._format.fromHexString(value, this.getValue(), this._rgbScale);
866
- this._callOnChange();
867
- this.updateDisplay();
866
+ this.setValue(this.getValue());
868
867
  }
869
868
  }
870
869
  save() {
@@ -1061,8 +1060,8 @@ class UINumber extends UIElement {
1061
1060
  return this;
1062
1061
  }
1063
1062
  updateDisplay() {
1064
- let value = this.getValue();
1065
- this.dom.value = "" + this._snap(value);
1063
+ let value = this._snap(this.getValue());
1064
+ this.dom.value = "" + value;
1066
1065
  if (this.unit !== '') this.dom.value += ' ' + this.unit;
1067
1066
  }
1068
1067
  _getImplicitStep(value) {
@@ -2291,7 +2290,10 @@ class InspectorPlugin extends core.Plugin {
2291
2290
  }
2292
2291
  _updateFolders() {
2293
2292
  const statesMap = this._statesMap;
2294
- const setState = (v)=>statesMap.set(v, statesMap.has(v) ? 0 : 1);
2293
+ const setState = (v)=>{
2294
+ if (statesMap.get(v) === -1) statesMap.set(v, 0);
2295
+ if (statesMap.get(v) === undefined) statesMap.set(v, 1);
2296
+ };
2295
2297
  statesMap.forEach((_, k, map)=>map.set(k, -1));
2296
2298
  this.viewer.traversePlugins(setState);
2297
2299
  this.viewer.traverseComponents(setState);
@@ -2308,7 +2310,7 @@ class InspectorPlugin extends core.Plugin {
2308
2310
  }
2309
2311
  _getPropertiesList(target) {
2310
2312
  const list = [];
2311
- let props = core.PropertyManager._getMergedProperties(target);
2313
+ let props = core.PropertyManager._getMergedProperties(target.constructor);
2312
2314
  if (props) {
2313
2315
  list.push(props);
2314
2316
  this._targetMap.set(props, target);
@@ -2367,7 +2369,7 @@ class InspectorPlugin extends core.Plugin {
2367
2369
  if (prop.dir) {
2368
2370
  folder = folder.getFolder(prop.dir) || folder.addFolder(prop.dir).close();
2369
2371
  }
2370
- if (core.PropertyManager._hasProperties(value)) {
2372
+ if (core.PropertyManager._hasProperties(value.constructor)) {
2371
2373
  this._addPropsListGUI(folder, this._getPropertiesList(value), target, k);
2372
2374
  }
2373
2375
  const type = typeof value;
@@ -2453,8 +2455,27 @@ class ViewerExtension extends core.ObjectInstance {
2453
2455
  set backgroundBlurriness(v) {
2454
2456
  this._scene.backgroundBlurriness = v;
2455
2457
  }
2458
+ get environmentRotation() {
2459
+ return this._scene.environmentRotation;
2460
+ }
2461
+ set environmentRotation(v) {
2462
+ this._scene.environmentRotation.copy(v);
2463
+ }
2464
+ get backgroundRotation() {
2465
+ return this._scene.backgroundRotation;
2466
+ }
2467
+ set backgroundRotation(v) {
2468
+ this._scene.backgroundRotation.copy(v);
2469
+ }
2470
+ get targetFrameRate() {
2471
+ return this._viewer.targetFrameRate;
2472
+ }
2473
+ set targetFrameRate(v) {
2474
+ this._viewer.targetFrameRate = v;
2475
+ }
2456
2476
  constructor(viewer){
2457
2477
  super();
2478
+ this._viewer = viewer;
2458
2479
  this._scene = viewer.scene;
2459
2480
  this._renderer = viewer.renderer;
2460
2481
  }
@@ -2497,6 +2518,46 @@ __decorate([
2497
2518
  step: 0.01
2498
2519
  })
2499
2520
  ], ViewerExtension.prototype, "backgroundBlurriness", null);
2521
+ __decorate([
2522
+ core.property({
2523
+ step: 0.01
2524
+ })
2525
+ ], ViewerExtension.prototype, "environmentRotation", null);
2526
+ __decorate([
2527
+ core.property({
2528
+ step: 0.01
2529
+ })
2530
+ ], ViewerExtension.prototype, "backgroundRotation", null);
2531
+ __decorate([
2532
+ core.property({
2533
+ min: 1,
2534
+ max: 120,
2535
+ step: 1
2536
+ })
2537
+ ], ViewerExtension.prototype, "targetFrameRate", null);
2538
+ const materialProperties = {
2539
+ visible: {},
2540
+ transparent: {},
2541
+ side: {
2542
+ value: {
2543
+ FrontSide: 0,
2544
+ BackSide: 1,
2545
+ DoubleSide: 2
2546
+ }
2547
+ },
2548
+ color: {
2549
+ dir: "diffuse"
2550
+ },
2551
+ opacity: {
2552
+ dir: "diffuse",
2553
+ min: 0,
2554
+ max: 1,
2555
+ step: 0.01
2556
+ }
2557
+ };
2558
+ for(let k in materialProperties){
2559
+ core.property(materialProperties[k])(three.Material.prototype, k);
2560
+ }
2500
2561
  const meshBasicMaterislProperties = {
2501
2562
  map: {
2502
2563
  dir: "diffuse"
@@ -2529,18 +2590,6 @@ for(let k in meshBasicMaterislProperties){
2529
2590
  core.property(meshBasicMaterislProperties[k])(three.MeshBasicMaterial.prototype, k);
2530
2591
  }
2531
2592
  const meshStandardMaterialProperties = {
2532
- visible: {},
2533
- transparent: {},
2534
- side: {
2535
- value: {
2536
- FrontSide: 0,
2537
- BackSide: 1,
2538
- DoubleSide: 2
2539
- }
2540
- },
2541
- color: {
2542
- dir: "diffuse"
2543
- },
2544
2593
  opacity: {
2545
2594
  dir: "diffuse",
2546
2595
  min: 0,
@@ -2596,7 +2645,8 @@ const meshStandardMaterialProperties = {
2596
2645
  },
2597
2646
  normalScale: {
2598
2647
  dir: "normal",
2599
- parent: "normalMap"
2648
+ parent: "normalMap",
2649
+ step: 0.01
2600
2650
  },
2601
2651
  displacementScale: {
2602
2652
  dir: "displacement",
@@ -2632,6 +2682,116 @@ const meshStandardMaterialProperties = {
2632
2682
  for(let k in meshStandardMaterialProperties){
2633
2683
  core.property(meshStandardMaterialProperties[k])(three.MeshStandardMaterial.prototype, k);
2634
2684
  }
2685
+ const meshPhysicalMaterialProperties = {
2686
+ ior: {
2687
+ min: 0,
2688
+ max: 10,
2689
+ step: 0.01
2690
+ },
2691
+ anisotropy: {
2692
+ min: 0,
2693
+ max: 10,
2694
+ step: 0.01
2695
+ },
2696
+ clearcoat: {
2697
+ dir: "clearcoat"
2698
+ },
2699
+ clearcoatMap: {
2700
+ dir: "clearcoat",
2701
+ min: 0,
2702
+ max: 1,
2703
+ step: 0.01
2704
+ },
2705
+ clearcoatRoughness: {
2706
+ dir: "clearcoat",
2707
+ min: 0,
2708
+ max: 1,
2709
+ step: 0.01
2710
+ },
2711
+ clearcoatNormalScale: {
2712
+ dir: "clearcoat",
2713
+ step: 0.01
2714
+ },
2715
+ clearcoatNormalMap: {
2716
+ dir: "clearcoat"
2717
+ },
2718
+ iridescence: {
2719
+ dir: "iridescence",
2720
+ min: 0,
2721
+ max: 1,
2722
+ step: 0.01
2723
+ },
2724
+ iridescenceMap: {
2725
+ dir: "iridescence"
2726
+ },
2727
+ iridescenceIOR: {
2728
+ dir: "iridescence",
2729
+ step: 0.01
2730
+ },
2731
+ iridescenceThicknessRange: {
2732
+ dir: "iridescence"
2733
+ },
2734
+ iridescenceThicknessMap: {
2735
+ dir: "iridescence"
2736
+ },
2737
+ sheen: {
2738
+ dir: "sheen"
2739
+ },
2740
+ sheenColor: {
2741
+ dir: "sheen"
2742
+ },
2743
+ sheenColorMap: {
2744
+ dir: "sheen"
2745
+ },
2746
+ sheenRoughness: {
2747
+ dir: "sheen",
2748
+ min: 0,
2749
+ max: 1,
2750
+ step: 0.01
2751
+ },
2752
+ sheenRoughnessMap: {
2753
+ dir: "sheen"
2754
+ },
2755
+ transmission: {
2756
+ dir: "transmission"
2757
+ },
2758
+ transmissionMap: {
2759
+ dir: "transmission"
2760
+ },
2761
+ thickness: {
2762
+ dir: "thickness",
2763
+ min: 0,
2764
+ max: 1,
2765
+ step: 0.01
2766
+ },
2767
+ thicknessMap: {
2768
+ dir: "thickness"
2769
+ },
2770
+ attenuationDistance: {
2771
+ dir: "attenuation"
2772
+ },
2773
+ attenuationColor: {
2774
+ dir: "attenuation"
2775
+ },
2776
+ specularIntensity: {
2777
+ dir: "specular",
2778
+ min: 0,
2779
+ max: 1,
2780
+ step: 0.01
2781
+ },
2782
+ specularIntensityMap: {
2783
+ dir: "specular"
2784
+ },
2785
+ specularColor: {
2786
+ dir: "specular"
2787
+ },
2788
+ specularColorMap: {
2789
+ dir: "specular"
2790
+ }
2791
+ };
2792
+ for(let k in meshPhysicalMaterialProperties){
2793
+ core.property(meshPhysicalMaterialProperties[k])(three.MeshPhysicalMaterial.prototype, k);
2794
+ }
2635
2795
 
2636
2796
  /**
2637
2797
  * @author mrdoob / http://mrdoob.com/