@xviewer.js/debug 1.0.0-alpha.6 → 1.0.0-alpha.61
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 +182 -22
- package/dist/main.js.map +1 -1
- package/dist/module.js +183 -23
- package/dist/module.js.map +1 -1
- package/package.json +18 -21
- package/types/gui/controllers/NumberController.d.ts +1 -1
package/dist/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MeshBasicMaterial, MeshStandardMaterial,
|
|
1
|
+
import { Material, MeshBasicMaterial, MeshStandardMaterial, MeshPhysicalMaterial, ShaderMaterial } from 'three';
|
|
2
2
|
import { property, Plugin, PropertyManager, Component, ObjectInstance } from '@xviewer.js/core';
|
|
3
3
|
|
|
4
4
|
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
@@ -449,14 +449,14 @@ class NumberController extends Controller {
|
|
|
449
449
|
return false;
|
|
450
450
|
}
|
|
451
451
|
updateDisplay() {
|
|
452
|
-
const value = this.getValue();
|
|
452
|
+
const value = this._snap(this.getValue());
|
|
453
453
|
if (this._hasSlider) {
|
|
454
454
|
let percent = (value - this._min) / (this._max - this._min);
|
|
455
455
|
percent = Math.max(0, Math.min(percent, 1));
|
|
456
456
|
this.$fill.style.width = percent * 100 + '%';
|
|
457
457
|
}
|
|
458
458
|
if (!this._inputFocused) {
|
|
459
|
-
this.$input.value = value;
|
|
459
|
+
this.$input.value = "" + value;
|
|
460
460
|
}
|
|
461
461
|
return this;
|
|
462
462
|
}
|
|
@@ -861,8 +861,7 @@ class ColorController extends Controller {
|
|
|
861
861
|
this.setValue(newValue);
|
|
862
862
|
} else {
|
|
863
863
|
this._format.fromHexString(value, this.getValue(), this._rgbScale);
|
|
864
|
-
this.
|
|
865
|
-
this.updateDisplay();
|
|
864
|
+
this.setValue(this.getValue());
|
|
866
865
|
}
|
|
867
866
|
}
|
|
868
867
|
save() {
|
|
@@ -1059,8 +1058,8 @@ class UINumber extends UIElement {
|
|
|
1059
1058
|
return this;
|
|
1060
1059
|
}
|
|
1061
1060
|
updateDisplay() {
|
|
1062
|
-
let value = this.getValue();
|
|
1063
|
-
this.dom.value = "" +
|
|
1061
|
+
let value = this._snap(this.getValue());
|
|
1062
|
+
this.dom.value = "" + value;
|
|
1064
1063
|
if (this.unit !== '') this.dom.value += ' ' + this.unit;
|
|
1065
1064
|
}
|
|
1066
1065
|
_getImplicitStep(value) {
|
|
@@ -2289,7 +2288,10 @@ class InspectorPlugin extends Plugin {
|
|
|
2289
2288
|
}
|
|
2290
2289
|
_updateFolders() {
|
|
2291
2290
|
const statesMap = this._statesMap;
|
|
2292
|
-
const setState = (v)=>
|
|
2291
|
+
const setState = (v)=>{
|
|
2292
|
+
if (statesMap.get(v) === -1) statesMap.set(v, 0);
|
|
2293
|
+
if (statesMap.get(v) === undefined) statesMap.set(v, 1);
|
|
2294
|
+
};
|
|
2293
2295
|
statesMap.forEach((_, k, map)=>map.set(k, -1));
|
|
2294
2296
|
this.viewer.traversePlugins(setState);
|
|
2295
2297
|
this.viewer.traverseComponents(setState);
|
|
@@ -2306,7 +2308,7 @@ class InspectorPlugin extends Plugin {
|
|
|
2306
2308
|
}
|
|
2307
2309
|
_getPropertiesList(target) {
|
|
2308
2310
|
const list = [];
|
|
2309
|
-
let props = PropertyManager._getMergedProperties(target);
|
|
2311
|
+
let props = PropertyManager._getMergedProperties(target.constructor);
|
|
2310
2312
|
if (props) {
|
|
2311
2313
|
list.push(props);
|
|
2312
2314
|
this._targetMap.set(props, target);
|
|
@@ -2365,7 +2367,7 @@ class InspectorPlugin extends Plugin {
|
|
|
2365
2367
|
if (prop.dir) {
|
|
2366
2368
|
folder = folder.getFolder(prop.dir) || folder.addFolder(prop.dir).close();
|
|
2367
2369
|
}
|
|
2368
|
-
if (PropertyManager._hasProperties(value)) {
|
|
2370
|
+
if (PropertyManager._hasProperties(value.constructor)) {
|
|
2369
2371
|
this._addPropsListGUI(folder, this._getPropertiesList(value), target, k);
|
|
2370
2372
|
}
|
|
2371
2373
|
const type = typeof value;
|
|
@@ -2451,8 +2453,27 @@ class ViewerExtension extends ObjectInstance {
|
|
|
2451
2453
|
set backgroundBlurriness(v) {
|
|
2452
2454
|
this._scene.backgroundBlurriness = v;
|
|
2453
2455
|
}
|
|
2456
|
+
get environmentRotation() {
|
|
2457
|
+
return this._scene.environmentRotation;
|
|
2458
|
+
}
|
|
2459
|
+
set environmentRotation(v) {
|
|
2460
|
+
this._scene.environmentRotation.copy(v);
|
|
2461
|
+
}
|
|
2462
|
+
get backgroundRotation() {
|
|
2463
|
+
return this._scene.backgroundRotation;
|
|
2464
|
+
}
|
|
2465
|
+
set backgroundRotation(v) {
|
|
2466
|
+
this._scene.backgroundRotation.copy(v);
|
|
2467
|
+
}
|
|
2468
|
+
get targetFrameRate() {
|
|
2469
|
+
return this._viewer.targetFrameRate;
|
|
2470
|
+
}
|
|
2471
|
+
set targetFrameRate(v) {
|
|
2472
|
+
this._viewer.targetFrameRate = v;
|
|
2473
|
+
}
|
|
2454
2474
|
constructor(viewer){
|
|
2455
2475
|
super();
|
|
2476
|
+
this._viewer = viewer;
|
|
2456
2477
|
this._scene = viewer.scene;
|
|
2457
2478
|
this._renderer = viewer.renderer;
|
|
2458
2479
|
}
|
|
@@ -2495,6 +2516,46 @@ __decorate([
|
|
|
2495
2516
|
step: 0.01
|
|
2496
2517
|
})
|
|
2497
2518
|
], ViewerExtension.prototype, "backgroundBlurriness", null);
|
|
2519
|
+
__decorate([
|
|
2520
|
+
property({
|
|
2521
|
+
step: 0.01
|
|
2522
|
+
})
|
|
2523
|
+
], ViewerExtension.prototype, "environmentRotation", null);
|
|
2524
|
+
__decorate([
|
|
2525
|
+
property({
|
|
2526
|
+
step: 0.01
|
|
2527
|
+
})
|
|
2528
|
+
], ViewerExtension.prototype, "backgroundRotation", null);
|
|
2529
|
+
__decorate([
|
|
2530
|
+
property({
|
|
2531
|
+
min: 1,
|
|
2532
|
+
max: 120,
|
|
2533
|
+
step: 1
|
|
2534
|
+
})
|
|
2535
|
+
], ViewerExtension.prototype, "targetFrameRate", null);
|
|
2536
|
+
const materialProperties = {
|
|
2537
|
+
visible: {},
|
|
2538
|
+
transparent: {},
|
|
2539
|
+
side: {
|
|
2540
|
+
value: {
|
|
2541
|
+
FrontSide: 0,
|
|
2542
|
+
BackSide: 1,
|
|
2543
|
+
DoubleSide: 2
|
|
2544
|
+
}
|
|
2545
|
+
},
|
|
2546
|
+
color: {
|
|
2547
|
+
dir: "diffuse"
|
|
2548
|
+
},
|
|
2549
|
+
opacity: {
|
|
2550
|
+
dir: "diffuse",
|
|
2551
|
+
min: 0,
|
|
2552
|
+
max: 1,
|
|
2553
|
+
step: 0.01
|
|
2554
|
+
}
|
|
2555
|
+
};
|
|
2556
|
+
for(let k in materialProperties){
|
|
2557
|
+
property(materialProperties[k])(Material.prototype, k);
|
|
2558
|
+
}
|
|
2498
2559
|
const meshBasicMaterislProperties = {
|
|
2499
2560
|
map: {
|
|
2500
2561
|
dir: "diffuse"
|
|
@@ -2527,18 +2588,6 @@ for(let k in meshBasicMaterislProperties){
|
|
|
2527
2588
|
property(meshBasicMaterislProperties[k])(MeshBasicMaterial.prototype, k);
|
|
2528
2589
|
}
|
|
2529
2590
|
const meshStandardMaterialProperties = {
|
|
2530
|
-
visible: {},
|
|
2531
|
-
transparent: {},
|
|
2532
|
-
side: {
|
|
2533
|
-
value: {
|
|
2534
|
-
FrontSide: 0,
|
|
2535
|
-
BackSide: 1,
|
|
2536
|
-
DoubleSide: 2
|
|
2537
|
-
}
|
|
2538
|
-
},
|
|
2539
|
-
color: {
|
|
2540
|
-
dir: "diffuse"
|
|
2541
|
-
},
|
|
2542
2591
|
opacity: {
|
|
2543
2592
|
dir: "diffuse",
|
|
2544
2593
|
min: 0,
|
|
@@ -2594,7 +2643,8 @@ const meshStandardMaterialProperties = {
|
|
|
2594
2643
|
},
|
|
2595
2644
|
normalScale: {
|
|
2596
2645
|
dir: "normal",
|
|
2597
|
-
parent: "normalMap"
|
|
2646
|
+
parent: "normalMap",
|
|
2647
|
+
step: 0.01
|
|
2598
2648
|
},
|
|
2599
2649
|
displacementScale: {
|
|
2600
2650
|
dir: "displacement",
|
|
@@ -2630,6 +2680,116 @@ const meshStandardMaterialProperties = {
|
|
|
2630
2680
|
for(let k in meshStandardMaterialProperties){
|
|
2631
2681
|
property(meshStandardMaterialProperties[k])(MeshStandardMaterial.prototype, k);
|
|
2632
2682
|
}
|
|
2683
|
+
const meshPhysicalMaterialProperties = {
|
|
2684
|
+
ior: {
|
|
2685
|
+
min: 0,
|
|
2686
|
+
max: 10,
|
|
2687
|
+
step: 0.01
|
|
2688
|
+
},
|
|
2689
|
+
anisotropy: {
|
|
2690
|
+
min: 0,
|
|
2691
|
+
max: 10,
|
|
2692
|
+
step: 0.01
|
|
2693
|
+
},
|
|
2694
|
+
clearcoat: {
|
|
2695
|
+
dir: "clearcoat"
|
|
2696
|
+
},
|
|
2697
|
+
clearcoatMap: {
|
|
2698
|
+
dir: "clearcoat",
|
|
2699
|
+
min: 0,
|
|
2700
|
+
max: 1,
|
|
2701
|
+
step: 0.01
|
|
2702
|
+
},
|
|
2703
|
+
clearcoatRoughness: {
|
|
2704
|
+
dir: "clearcoat",
|
|
2705
|
+
min: 0,
|
|
2706
|
+
max: 1,
|
|
2707
|
+
step: 0.01
|
|
2708
|
+
},
|
|
2709
|
+
clearcoatNormalScale: {
|
|
2710
|
+
dir: "clearcoat",
|
|
2711
|
+
step: 0.01
|
|
2712
|
+
},
|
|
2713
|
+
clearcoatNormalMap: {
|
|
2714
|
+
dir: "clearcoat"
|
|
2715
|
+
},
|
|
2716
|
+
iridescence: {
|
|
2717
|
+
dir: "iridescence",
|
|
2718
|
+
min: 0,
|
|
2719
|
+
max: 1,
|
|
2720
|
+
step: 0.01
|
|
2721
|
+
},
|
|
2722
|
+
iridescenceMap: {
|
|
2723
|
+
dir: "iridescence"
|
|
2724
|
+
},
|
|
2725
|
+
iridescenceIOR: {
|
|
2726
|
+
dir: "iridescence",
|
|
2727
|
+
step: 0.01
|
|
2728
|
+
},
|
|
2729
|
+
iridescenceThicknessRange: {
|
|
2730
|
+
dir: "iridescence"
|
|
2731
|
+
},
|
|
2732
|
+
iridescenceThicknessMap: {
|
|
2733
|
+
dir: "iridescence"
|
|
2734
|
+
},
|
|
2735
|
+
sheen: {
|
|
2736
|
+
dir: "sheen"
|
|
2737
|
+
},
|
|
2738
|
+
sheenColor: {
|
|
2739
|
+
dir: "sheen"
|
|
2740
|
+
},
|
|
2741
|
+
sheenColorMap: {
|
|
2742
|
+
dir: "sheen"
|
|
2743
|
+
},
|
|
2744
|
+
sheenRoughness: {
|
|
2745
|
+
dir: "sheen",
|
|
2746
|
+
min: 0,
|
|
2747
|
+
max: 1,
|
|
2748
|
+
step: 0.01
|
|
2749
|
+
},
|
|
2750
|
+
sheenRoughnessMap: {
|
|
2751
|
+
dir: "sheen"
|
|
2752
|
+
},
|
|
2753
|
+
transmission: {
|
|
2754
|
+
dir: "transmission"
|
|
2755
|
+
},
|
|
2756
|
+
transmissionMap: {
|
|
2757
|
+
dir: "transmission"
|
|
2758
|
+
},
|
|
2759
|
+
thickness: {
|
|
2760
|
+
dir: "thickness",
|
|
2761
|
+
min: 0,
|
|
2762
|
+
max: 1,
|
|
2763
|
+
step: 0.01
|
|
2764
|
+
},
|
|
2765
|
+
thicknessMap: {
|
|
2766
|
+
dir: "thickness"
|
|
2767
|
+
},
|
|
2768
|
+
attenuationDistance: {
|
|
2769
|
+
dir: "attenuation"
|
|
2770
|
+
},
|
|
2771
|
+
attenuationColor: {
|
|
2772
|
+
dir: "attenuation"
|
|
2773
|
+
},
|
|
2774
|
+
specularIntensity: {
|
|
2775
|
+
dir: "specular",
|
|
2776
|
+
min: 0,
|
|
2777
|
+
max: 1,
|
|
2778
|
+
step: 0.01
|
|
2779
|
+
},
|
|
2780
|
+
specularIntensityMap: {
|
|
2781
|
+
dir: "specular"
|
|
2782
|
+
},
|
|
2783
|
+
specularColor: {
|
|
2784
|
+
dir: "specular"
|
|
2785
|
+
},
|
|
2786
|
+
specularColorMap: {
|
|
2787
|
+
dir: "specular"
|
|
2788
|
+
}
|
|
2789
|
+
};
|
|
2790
|
+
for(let k in meshPhysicalMaterialProperties){
|
|
2791
|
+
property(meshPhysicalMaterialProperties[k])(MeshPhysicalMaterial.prototype, k);
|
|
2792
|
+
}
|
|
2633
2793
|
|
|
2634
2794
|
/**
|
|
2635
2795
|
* @author mrdoob / http://mrdoob.com/
|