@xviewer.js/debug 1.0.0-beta.1 → 1.0.0

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/module.js CHANGED
@@ -1,9 +1,9 @@
1
- import { MeshBasicMaterial, MeshStandardMaterial, ShaderMaterial, Material } from 'three';
2
- import { property, Plugin, PropertyManager, Component, ObjectInstance } from '@xviewer.js/core';
1
+ import { Viewer, property, ObjectInstance, Mount, PropertyManager, Component, BoxProjection } from '@xviewer.js/core';
2
+ import { MeshBasicMaterial, WebGLRenderer, Material, MeshStandardMaterial, MeshPhysicalMaterial, Scene, OrthographicCamera, Sprite, Vector3, ShaderMaterial, Box3, Box3Helper } from 'three';
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}}
5
5
 
6
- var css = "@charset \"UTF-8\";\n.lil-gui {\n font-family: var(--font-family);\n font-size: var(--font-size);\n line-height: 1;\n font-weight: normal;\n font-style: normal;\n text-align: left;\n background-color: var(--background-color);\n color: var(--text-color);\n user-select: none;\n -webkit-user-select: none;\n touch-action: manipulation;\n --background-color: #1f1f1f;\n --text-color: #ebebeb;\n --title-background-color: #111111;\n --title-text-color: #ebebeb;\n --widget-color: #424242;\n --hover-color: #4f4f4f;\n --focus-color: #595959;\n --number-color: #2cc9ff;\n --string-color: #a2db3c;\n --font-size: 11px;\n --input-font-size: 11px;\n --font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif;\n --font-family-mono: Menlo, Monaco, Consolas, \"Droid Sans Mono\", monospace;\n --padding: 4px;\n --spacing: 4px;\n --widget-height: 20px;\n --title-height: calc(var(--widget-height) + var(--spacing) * 1.25);\n --name-width: 40%;\n --slider-knob-width: 2px;\n --slider-input-width: 27%;\n --color-input-width: 27%;\n --slider-input-min-width: 45px;\n --color-input-min-width: 45px;\n --folder-indent: 7px;\n --widget-padding: 0 0 0 3px;\n --widget-border-radius: 2px;\n --checkbox-size: calc(0.75 * var(--widget-height));\n --scrollbar-width: 5px;\n}\n.lil-gui, .lil-gui * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n}\n.lil-gui.root {\n width: var(--width, 245px);\n display: flex;\n flex-direction: column;\n}\n.lil-gui.root > .title {\n background: var(--title-background-color);\n color: var(--title-text-color);\n}\n.lil-gui.root > .children {\n overflow-x: hidden;\n overflow-y: auto;\n}\n.lil-gui.root > .children::-webkit-scrollbar {\n width: var(--scrollbar-width);\n height: var(--scrollbar-width);\n background: var(--background-color);\n}\n.lil-gui.root > .children::-webkit-scrollbar-thumb {\n border-radius: var(--scrollbar-width);\n background: var(--focus-color);\n}\n@media (pointer: coarse) {\n .lil-gui.allow-touch-styles, .lil-gui.allow-touch-styles .lil-gui {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n }\n}\n.lil-gui.force-touch-styles, .lil-gui.force-touch-styles .lil-gui {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n}\n.lil-gui.autoPlace {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 1001;\n}\n\n.lil-gui .controller {\n display: flex;\n align-items: center;\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n}\n.lil-gui .controller.disabled {\n opacity: 0.5;\n}\n.lil-gui .controller.disabled, .lil-gui .controller.disabled * {\n pointer-events: none !important;\n}\n.lil-gui .controller > .name {\n min-width: var(--name-width);\n flex-shrink: 0;\n white-space: pre;\n padding-right: var(--spacing);\n line-height: var(--widget-height);\n}\n.lil-gui .controller .widget {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n min-height: var(--widget-height);\n}\n.lil-gui .controller.string input {\n color: var(--string-color);\n}\n.lil-gui .controller.boolean .widget {\n cursor: pointer;\n}\n.lil-gui .controller.color .display {\n width: 100%;\n height: var(--widget-height);\n border-radius: var(--widget-border-radius);\n position: relative;\n}\n@media (hover: hover) {\n .lil-gui .controller.color .display:hover:before {\n content: \" \";\n display: block;\n position: absolute;\n border-radius: var(--widget-border-radius);\n border: 1px solid rgba(255, 255, 255, 0.6);\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n}\n.lil-gui .controller.color input[type=color] {\n opacity: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n}\n.lil-gui .controller.color input[type=text] {\n margin-left: var(--spacing);\n font-family: var(--font-family-mono);\n min-width: var(--color-input-min-width);\n width: var(--color-input-width);\n flex-shrink: 0;\n}\n.lil-gui .controller.option select {\n opacity: 0;\n position: absolute;\n width: 100%;\n max-width: 100%;\n}\n.lil-gui .controller.option .display {\n position: relative;\n pointer-events: none;\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n line-height: var(--widget-height);\n max-width: 100%;\n overflow: hidden;\n word-break: break-all;\n padding-left: 0.55em;\n padding-right: 1.75em;\n background: var(--widget-color);\n}\n@media (hover: hover) {\n .lil-gui .controller.option .display.focus {\n background: var(--focus-color);\n }\n}\n.lil-gui .controller.option .display.active {\n background: var(--focus-color);\n}\n.lil-gui .controller.option .display:after {\n font-family: \"lil-gui\";\n content: \"↕\";\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n padding-right: 0.375em;\n}\n.lil-gui .controller.option .widget,\n.lil-gui .controller.option select {\n cursor: pointer;\n}\n@media (hover: hover) {\n .lil-gui .controller.option .widget:hover .display {\n background: var(--hover-color);\n }\n}\n.lil-gui .controller.number input {\n color: var(--number-color);\n}\n.lil-gui .controller.number.hasSlider input {\n margin-left: var(--spacing);\n width: var(--slider-input-width);\n min-width: var(--slider-input-min-width);\n flex-shrink: 0;\n}\n.lil-gui .controller.number .slider {\n width: 100%;\n height: var(--widget-height);\n background-color: var(--widget-color);\n border-radius: var(--widget-border-radius);\n padding-right: var(--slider-knob-width);\n overflow: hidden;\n cursor: ew-resize;\n touch-action: pan-y;\n}\n@media (hover: hover) {\n .lil-gui .controller.number .slider:hover {\n background-color: var(--hover-color);\n }\n}\n.lil-gui .controller.number .slider.active {\n background-color: var(--focus-color);\n}\n.lil-gui .controller.number .slider.active .fill {\n opacity: 0.95;\n}\n.lil-gui .controller.number .fill {\n height: 100%;\n border-right: var(--slider-knob-width) solid var(--number-color);\n box-sizing: content-box;\n}\n.lil-gui .controller.image img {\n max-width: 100%;\n}\n.lil-gui .controller.image canvas {\n max-width: 100%;\n min-height: 1px;\n}\n.lil-gui .controller.vector input {\n color: var(--number-color);\n}\n.lil-gui .controller.vector .fill {\n height: 100%;\n margin-left: var(--spacing);\n box-sizing: content-box;\n}\n\n.lil-gui-dragging .lil-gui {\n --hover-color: var(--widget-color);\n}\n.lil-gui-dragging * {\n cursor: ew-resize !important;\n}\n\n.lil-gui-dragging.lil-gui-vertical * {\n cursor: ns-resize !important;\n}\n\n.lil-gui .title {\n height: var(--title-height);\n line-height: calc(var(--title-height) - 4px);\n font-weight: 600;\n padding: 0 var(--padding);\n -webkit-tap-highlight-color: transparent;\n cursor: pointer;\n outline: none;\n text-decoration-skip: objects;\n}\n.lil-gui .title:before {\n font-family: \"lil-gui\";\n content: \"▾\";\n padding-right: 2px;\n display: inline-block;\n}\n.lil-gui .title:active {\n background: var(--title-background-color);\n opacity: 0.75;\n}\n@media (hover: hover) {\n body:not(.lil-gui-dragging) .lil-gui .title:hover {\n background: var(--title-background-color);\n opacity: 0.85;\n }\n .lil-gui .title:focus {\n text-decoration: underline var(--focus-color);\n }\n}\n.lil-gui.root > .title:focus {\n text-decoration: none !important;\n}\n.lil-gui.closed > .title:before {\n content: \"▸\";\n}\n.lil-gui.closed > .children {\n transform: translateY(-7px);\n opacity: 0;\n}\n.lil-gui.closed:not(.transition) > .children {\n display: none;\n}\n.lil-gui.transition > .children {\n transition-duration: 300ms;\n transition-property: height, opacity, transform;\n transition-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1);\n overflow: hidden;\n pointer-events: none;\n}\n.lil-gui .children:empty:before {\n content: \"Empty\";\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n display: block;\n height: var(--widget-height);\n font-style: italic;\n line-height: var(--widget-height);\n opacity: 0.5;\n}\n.lil-gui.root > .children > .lil-gui > .title {\n border: 0 solid var(--widget-color);\n border-width: 1px 0;\n transition: border-color 300ms;\n}\n.lil-gui.root > .children > .lil-gui.closed > .title {\n border-bottom-color: transparent;\n}\n.lil-gui + .controller {\n border-top: 1px solid var(--widget-color);\n margin-top: 0;\n padding-top: var(--spacing);\n}\n.lil-gui .lil-gui .lil-gui > .title {\n border: none;\n}\n.lil-gui .lil-gui .lil-gui > .children {\n border: none;\n margin-left: var(--folder-indent);\n border-left: 2px solid var(--widget-color);\n}\n.lil-gui .lil-gui .controller {\n border: none;\n}\n\n.lil-gui input {\n -webkit-tap-highlight-color: transparent;\n border: 0;\n outline: none;\n font-family: var(--font-family);\n font-size: var(--input-font-size);\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n background: var(--widget-color);\n color: var(--text-color);\n width: 100%;\n}\n@media (hover: hover) {\n .lil-gui input:hover {\n background: var(--hover-color);\n }\n .lil-gui input:active {\n background: var(--focus-color);\n }\n}\n.lil-gui input:disabled {\n opacity: 1;\n}\n.lil-gui input[type=text],\n.lil-gui input[type=number] {\n padding: var(--widget-padding);\n}\n.lil-gui input[type=text]:focus,\n.lil-gui input[type=number]:focus {\n background: var(--focus-color);\n}\n.lil-gui input::-webkit-outer-spin-button,\n.lil-gui input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n.lil-gui input[type=number] {\n -moz-appearance: textfield;\n}\n.lil-gui input[type=checkbox] {\n appearance: none;\n -webkit-appearance: none;\n height: var(--checkbox-size);\n width: var(--checkbox-size);\n border-radius: var(--widget-border-radius);\n text-align: center;\n cursor: pointer;\n}\n.lil-gui input[type=checkbox]:checked:before {\n font-family: \"lil-gui\";\n content: \"✓\";\n font-size: var(--checkbox-size);\n line-height: var(--checkbox-size);\n}\n@media (hover: hover) {\n .lil-gui input[type=checkbox]:focus {\n box-shadow: inset 0 0 0 1px var(--focus-color);\n }\n}\n.lil-gui button {\n -webkit-tap-highlight-color: transparent;\n outline: none;\n cursor: pointer;\n font-family: var(--font-family);\n font-size: var(--font-size);\n color: var(--text-color);\n width: 100%;\n height: var(--widget-height);\n text-transform: none;\n background: var(--widget-color);\n border-radius: var(--widget-border-radius);\n border: 1px solid var(--widget-color);\n text-align: center;\n line-height: calc(var(--widget-height) - 4px);\n}\n@media (hover: hover) {\n .lil-gui button:hover {\n background: var(--hover-color);\n border-color: var(--hover-color);\n }\n .lil-gui button:focus {\n border-color: var(--focus-color);\n }\n}\n.lil-gui button:active {\n background: var(--focus-color);\n}\n\n@font-face {\n font-family: \"lil-gui\";\n src: url(\"data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==\") format(\"woff\");\n}\n.curve-editor {\n display: flex;\n flex-direction: column;\n gap: 5px;\n background-color: #303030;\n outline: 1px solid #000000;\n padding: 5px;\n width: 100%;\n}\n.curve-editor .button-medium {\n background-color: #545454;\n min-width: var(--widget-height);\n min-height: var(--widget-height);\n height: 100%;\n outline: 1px solid #3c3c3c;\n display: flex;\n justify-content: center;\n align-items: center;\n color: #fff;\n font-size: var(--input-font-size, 11px);\n}\n.curve-editor .button-medium.selected {\n background-color: #4772b3;\n pointer-events: none;\n}\n.curve-editor .button-medium:hover {\n background-color: #656565;\n cursor: default;\n}\n.curve-editor .curve-top {\n display: flex;\n width: 100%;\n}\n.curve-editor .curve-panel {\n width: 100%;\n height: 90px;\n outline: 1px solid #646464;\n}\n.curve-editor .curve-point-panel {\n display: flex;\n align-items: center;\n width: 100%;\n height: var(--widget-height);\n}\n.curve-editor .curve-point-panel input {\n background-color: #545454;\n height: 100%;\n width: 100%;\n color: #fff;\n border: 0;\n outline: 1px solid #3c3c3c;\n text-align: center;\n font-size: var(--input-font-size, 11px);\n}";
6
+ var css = "@charset \"UTF-8\";\n.lil-gui {\n font-family: var(--font-family);\n font-size: var(--font-size);\n line-height: 1;\n font-weight: normal;\n font-style: normal;\n text-align: left;\n background-color: var(--background-color);\n color: var(--text-color);\n user-select: none;\n -webkit-user-select: none;\n touch-action: manipulation;\n --background-color: #1f1f1f;\n --text-color: #ebebeb;\n --title-background-color: #111111;\n --title-text-color: #ebebeb;\n --widget-color: #424242;\n --hover-color: #4f4f4f;\n --focus-color: #595959;\n --number-color: #2cc9ff;\n --string-color: #a2db3c;\n --font-size: 11px;\n --input-font-size: 11px;\n --font-family: -apple-system,\n BlinkMacSystemFont,\n \"Segoe UI\",\n Roboto,\n Arial,\n sans-serif;\n --font-family-mono: Menlo,\n Monaco,\n Consolas,\n \"Droid Sans Mono\",\n monospace;\n --padding: 4px;\n --spacing: 4px;\n --widget-height: 20px;\n --title-height: calc(var(--widget-height) + var(--spacing) * 1.25);\n --name-width: 40%;\n --slider-knob-width: 2px;\n --slider-input-width: 27%;\n --color-input-width: 27%;\n --slider-input-min-width: 45px;\n --color-input-min-width: 45px;\n --folder-indent: 7px;\n --widget-padding: 0 0 0 3px;\n --widget-border-radius: 2px;\n --checkbox-size: calc(0.75 * var(--widget-height));\n --scrollbar-width: 5px;\n}\n.lil-gui, .lil-gui * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n}\n.lil-gui.root {\n width: var(--width, 245px);\n display: flex;\n flex-direction: column;\n}\n.lil-gui.root > .title {\n background: var(--title-background-color);\n color: var(--title-text-color);\n}\n.lil-gui.root > .children {\n overflow-x: hidden;\n overflow-y: auto;\n}\n.lil-gui.root > .children::-webkit-scrollbar {\n width: var(--scrollbar-width);\n height: var(--scrollbar-width);\n background: var(--background-color);\n}\n.lil-gui.root > .children::-webkit-scrollbar-thumb {\n border-radius: var(--scrollbar-width);\n background: var(--focus-color);\n}\n@media (pointer: coarse) {\n .lil-gui.allow-touch-styles, .lil-gui.allow-touch-styles .lil-gui {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n }\n}\n.lil-gui.force-touch-styles, .lil-gui.force-touch-styles .lil-gui {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n}\n.lil-gui.autoPlace {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 1001;\n}\n\n.lil-gui .controller {\n display: flex;\n align-items: center;\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n}\n.lil-gui .controller.disabled {\n opacity: 0.5;\n}\n.lil-gui .controller.disabled, .lil-gui .controller.disabled * {\n pointer-events: none !important;\n}\n.lil-gui .controller > .name {\n min-width: var(--name-width);\n flex-shrink: 0;\n white-space: pre;\n padding-right: var(--spacing);\n line-height: var(--widget-height);\n}\n.lil-gui .controller .widget {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n min-height: var(--widget-height);\n}\n.lil-gui .controller.string input {\n color: var(--string-color);\n}\n.lil-gui .controller.boolean .widget {\n cursor: pointer;\n}\n.lil-gui .controller.color .display {\n width: 100%;\n height: var(--widget-height);\n border-radius: var(--widget-border-radius);\n position: relative;\n}\n@media (hover: hover) {\n .lil-gui .controller.color .display:hover:before {\n content: \" \";\n display: block;\n position: absolute;\n border-radius: var(--widget-border-radius);\n border: 1px solid rgba(255, 255, 255, 0.6);\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n}\n.lil-gui .controller.color input[type=color] {\n opacity: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n}\n.lil-gui .controller.color input[type=text] {\n margin-left: var(--spacing);\n font-family: var(--font-family-mono);\n min-width: var(--color-input-min-width);\n width: var(--color-input-width);\n flex-shrink: 0;\n}\n.lil-gui .controller.option select {\n opacity: 0;\n position: absolute;\n width: 100%;\n max-width: 100%;\n}\n.lil-gui .controller.option .display {\n position: relative;\n pointer-events: none;\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n line-height: var(--widget-height);\n max-width: 100%;\n overflow: hidden;\n word-break: break-all;\n padding-left: 0.55em;\n padding-right: 1.75em;\n background: var(--widget-color);\n}\n@media (hover: hover) {\n .lil-gui .controller.option .display.focus {\n background: var(--focus-color);\n }\n}\n.lil-gui .controller.option .display.active {\n background: var(--focus-color);\n}\n.lil-gui .controller.option .display:after {\n font-family: \"lil-gui\";\n content: \"↕\";\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n padding-right: 0.375em;\n}\n.lil-gui .controller.option .widget,\n.lil-gui .controller.option select {\n cursor: pointer;\n}\n@media (hover: hover) {\n .lil-gui .controller.option .widget:hover .display {\n background: var(--hover-color);\n }\n}\n.lil-gui .controller.number input {\n color: var(--number-color);\n}\n.lil-gui .controller.number.hasSlider input {\n margin-left: var(--spacing);\n width: var(--slider-input-width);\n min-width: var(--slider-input-min-width);\n flex-shrink: 0;\n}\n.lil-gui .controller.number .slider {\n width: 100%;\n height: var(--widget-height);\n background-color: var(--widget-color);\n border-radius: var(--widget-border-radius);\n padding-right: var(--slider-knob-width);\n overflow: hidden;\n cursor: ew-resize;\n touch-action: pan-y;\n}\n@media (hover: hover) {\n .lil-gui .controller.number .slider:hover {\n background-color: var(--hover-color);\n }\n}\n.lil-gui .controller.number .slider.active {\n background-color: var(--focus-color);\n}\n.lil-gui .controller.number .slider.active .fill {\n opacity: 0.95;\n}\n.lil-gui .controller.number .fill {\n height: 100%;\n border-right: var(--slider-knob-width) solid var(--number-color);\n box-sizing: content-box;\n}\n.lil-gui .controller.image img {\n max-width: 100%;\n}\n.lil-gui .controller.image canvas {\n max-width: 100%;\n min-height: 1px;\n}\n.lil-gui .controller.vector input {\n color: var(--number-color);\n}\n.lil-gui .controller.vector .fill {\n height: 100%;\n margin-left: var(--spacing);\n box-sizing: content-box;\n}\n\n.lil-gui-dragging .lil-gui {\n --hover-color: var(--widget-color);\n}\n.lil-gui-dragging * {\n cursor: ew-resize !important;\n}\n\n.lil-gui-dragging.lil-gui-vertical * {\n cursor: ns-resize !important;\n}\n\n.lil-gui .title {\n height: var(--title-height);\n line-height: calc(var(--title-height) - 4px);\n font-weight: 600;\n padding: 0 var(--padding);\n -webkit-tap-highlight-color: transparent;\n cursor: pointer;\n outline: none;\n text-decoration-skip: objects;\n}\n.lil-gui .title:before {\n font-family: \"lil-gui\";\n content: \"▾\";\n padding-right: 2px;\n display: inline-block;\n}\n.lil-gui .title:active {\n background: var(--title-background-color);\n opacity: 0.75;\n}\n@media (hover: hover) {\n body:not(.lil-gui-dragging) .lil-gui .title:hover {\n background: var(--title-background-color);\n opacity: 0.85;\n }\n .lil-gui .title:focus {\n text-decoration: underline var(--focus-color);\n }\n}\n.lil-gui.root > .title:focus {\n text-decoration: none !important;\n}\n.lil-gui.closed > .title:before {\n content: \"▸\";\n}\n.lil-gui.closed > .children {\n transform: translateY(-7px);\n opacity: 0;\n}\n.lil-gui.closed:not(.transition) > .children {\n display: none;\n}\n.lil-gui.transition > .children {\n transition-duration: 300ms;\n transition-property: height, opacity, transform;\n transition-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1);\n overflow: hidden;\n pointer-events: none;\n}\n.lil-gui .children:empty:before {\n content: \"Empty\";\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n display: block;\n height: var(--widget-height);\n font-style: italic;\n line-height: var(--widget-height);\n opacity: 0.5;\n}\n.lil-gui.root > .children > .lil-gui > .title {\n border: 0 solid var(--widget-color);\n border-width: 1px 0;\n transition: border-color 300ms;\n}\n.lil-gui.root > .children > .lil-gui.closed > .title {\n border-bottom-color: transparent;\n}\n.lil-gui + .controller {\n border-top: 1px solid var(--widget-color);\n margin-top: 0;\n padding-top: var(--spacing);\n}\n.lil-gui .lil-gui .lil-gui > .title {\n border: none;\n}\n.lil-gui .lil-gui .lil-gui > .children {\n border: none;\n margin-left: var(--folder-indent);\n border-left: 2px solid var(--widget-color);\n}\n.lil-gui .lil-gui .controller {\n border: none;\n}\n\n.lil-gui input {\n -webkit-tap-highlight-color: transparent;\n border: 0;\n outline: none;\n font-family: var(--font-family);\n font-size: var(--input-font-size);\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n background: var(--widget-color);\n color: var(--text-color);\n width: 100%;\n}\n@media (hover: hover) {\n .lil-gui input:hover {\n background: var(--hover-color);\n }\n .lil-gui input:active {\n background: var(--focus-color);\n }\n}\n.lil-gui input:disabled {\n opacity: 1;\n}\n.lil-gui input[type=text],\n.lil-gui input[type=number] {\n padding: var(--widget-padding);\n}\n.lil-gui input[type=text]:focus,\n.lil-gui input[type=number]:focus {\n background: var(--focus-color);\n}\n.lil-gui input::-webkit-outer-spin-button,\n.lil-gui input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n.lil-gui input[type=number] {\n -moz-appearance: textfield;\n}\n.lil-gui input[type=checkbox] {\n appearance: none;\n -webkit-appearance: none;\n height: var(--checkbox-size);\n width: var(--checkbox-size);\n border-radius: var(--widget-border-radius);\n text-align: center;\n cursor: pointer;\n}\n.lil-gui input[type=checkbox]:checked:before {\n font-family: \"lil-gui\";\n content: \"✓\";\n font-size: var(--checkbox-size);\n line-height: var(--checkbox-size);\n}\n@media (hover: hover) {\n .lil-gui input[type=checkbox]:focus {\n box-shadow: inset 0 0 0 1px var(--focus-color);\n }\n}\n.lil-gui button {\n -webkit-tap-highlight-color: transparent;\n outline: none;\n cursor: pointer;\n font-family: var(--font-family);\n font-size: var(--font-size);\n color: var(--text-color);\n width: 100%;\n height: var(--widget-height);\n text-transform: none;\n background: var(--widget-color);\n border-radius: var(--widget-border-radius);\n border: 1px solid var(--widget-color);\n text-align: center;\n line-height: calc(var(--widget-height) - 4px);\n}\n@media (hover: hover) {\n .lil-gui button:hover {\n background: var(--hover-color);\n border-color: var(--hover-color);\n }\n .lil-gui button:focus {\n border-color: var(--focus-color);\n }\n}\n.lil-gui button:active {\n background: var(--focus-color);\n}\n\n@font-face {\n font-family: \"lil-gui\";\n src: url(\"data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==\") format(\"woff\");\n}\n.curve-editor {\n display: flex;\n flex-direction: column;\n gap: 5px;\n background-color: #303030;\n outline: 1px solid #000000;\n padding: 5px;\n width: 100%;\n}\n.curve-editor .button-medium {\n background-color: #545454;\n min-width: var(--widget-height);\n min-height: var(--widget-height);\n height: 100%;\n outline: 1px solid #3c3c3c;\n display: flex;\n justify-content: center;\n align-items: center;\n color: #fff;\n font-size: var(--input-font-size, 11px);\n}\n.curve-editor .button-medium.selected {\n background-color: #4772b3;\n pointer-events: none;\n}\n.curve-editor .button-medium:hover {\n background-color: #656565;\n cursor: default;\n}\n.curve-editor .curve-top {\n display: flex;\n width: 100%;\n}\n.curve-editor .curve-panel {\n width: 100%;\n height: 90px;\n outline: 1px solid #646464;\n}\n.curve-editor .curve-point-panel {\n display: flex;\n align-items: center;\n width: 100%;\n height: var(--widget-height);\n}\n.curve-editor .curve-point-panel input {\n background-color: #545454;\n height: 100%;\n width: 100%;\n color: #fff;\n border: 0;\n outline: 1px solid #3c3c3c;\n text-align: center;\n font-size: var(--input-font-size, 11px);\n}";
7
7
  n(css,{});
8
8
 
9
9
  class Controller {
@@ -420,6 +420,18 @@ function getPrecision(value) {
420
420
  function hasDecimal(value) {
421
421
  return value % 1 !== 0;
422
422
  }
423
+ let renderer;
424
+ let material = new MeshBasicMaterial();
425
+ function renderToCanvas(texture) {
426
+ if (renderer === undefined) {
427
+ renderer = new WebGLRenderer();
428
+ }
429
+ const image = texture.image;
430
+ material.map = texture;
431
+ renderer.setSize(image.width, image.height, false);
432
+ Viewer.Blit(renderer, null, material);
433
+ return renderer.domElement;
434
+ }
423
435
 
424
436
  class NumberController extends Controller {
425
437
  min(min) {
@@ -449,14 +461,14 @@ class NumberController extends Controller {
449
461
  return false;
450
462
  }
451
463
  updateDisplay() {
452
- const value = this.getValue();
464
+ const value = this._snap(this.getValue());
453
465
  if (this._hasSlider) {
454
466
  let percent = (value - this._min) / (this._max - this._min);
455
467
  percent = Math.max(0, Math.min(percent, 1));
456
468
  this.$fill.style.width = percent * 100 + '%';
457
469
  }
458
470
  if (!this._inputFocused) {
459
- this.$input.value = value;
471
+ this.$input.value = "" + value;
460
472
  }
461
473
  return this;
462
474
  }
@@ -861,8 +873,7 @@ class ColorController extends Controller {
861
873
  this.setValue(newValue);
862
874
  } else {
863
875
  this._format.fromHexString(value, this.getValue(), this._rgbScale);
864
- this._callOnChange();
865
- this.updateDisplay();
876
+ this.setValue(this.getValue());
866
877
  }
867
878
  }
868
879
  save() {
@@ -929,82 +940,6 @@ class ColorController extends Controller {
929
940
  }
930
941
  }
931
942
 
932
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
933
- try {
934
- var info = gen[key](arg);
935
- var value = info.value;
936
- } catch (error) {
937
- reject(error);
938
- return;
939
- }
940
- if (info.done) resolve(value);
941
- else Promise.resolve(value).then(_next, _throw);
942
- }
943
- function _async_to_generator(fn) {
944
- return function() {
945
- var self = this, args = arguments;
946
-
947
- return new Promise(function(resolve, reject) {
948
- var gen = fn.apply(self, args);
949
-
950
- function _next(value) {
951
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
952
- }
953
-
954
- function _throw(err) {
955
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
956
- }
957
-
958
- _next(undefined);
959
- });
960
- };
961
- }
962
-
963
- class ImageController extends Controller {
964
- static toDataURL(img) {
965
- return _async_to_generator(function*() {
966
- if (img instanceof HTMLImageElement) {
967
- return img.src;
968
- } else {
969
- if (img) {
970
- let url = ImageController._imageMap.get(img);
971
- if (url) return url;
972
- const w = Math.min(img.width, 256);
973
- const h = Math.min(img.height, 256);
974
- if (ImageController._context == null) {
975
- ImageController._context = document.createElement('canvas').getContext("2d");
976
- }
977
- ImageController._context.canvas.width = w;
978
- ImageController._context.canvas.height = h;
979
- if (img.data) {
980
- let imageData = ImageController._context.createImageData(img.width, img.height);
981
- imageData.data.set(img.data);
982
- img = yield createImageBitmap(imageData);
983
- }
984
- if (img instanceof ImageBitmap) {
985
- ImageController._context.drawImage(img, 0, 0, img.width, img.height, 0, 0, w, h);
986
- ImageController._imageMap.set(img, url = ImageController._context.canvas.toDataURL());
987
- return url;
988
- }
989
- }
990
- return "";
991
- }
992
- })();
993
- }
994
- updateDisplay() {
995
- ImageController.toDataURL(this.getValue()).then((url)=>this.$img.src = url);
996
- return this;
997
- }
998
- constructor(parent, object, property){
999
- super(parent, object, property, "image");
1000
- this.$img = document.createElement("img");
1001
- this.$widget.appendChild(this.$img);
1002
- this.updateDisplay();
1003
- }
1004
- }
1005
- ImageController._context = null;
1006
- ImageController._imageMap = new WeakMap();
1007
-
1008
943
  class UIElement {
1009
944
  add(...args) {
1010
945
  for(let i = 0; i < args.length; i++){
@@ -1092,8 +1027,8 @@ class UINumber extends UIElement {
1092
1027
  return this;
1093
1028
  }
1094
1029
  updateDisplay() {
1095
- let value = this.getValue();
1096
- this.dom.value = "" + this._snap(value);
1030
+ let value = this._snap(this.getValue());
1031
+ this.dom.value = "" + value;
1097
1032
  if (this.unit !== '') this.dom.value += ' ' + this.unit;
1098
1033
  }
1099
1034
  _getImplicitStep(value) {
@@ -1767,57 +1702,46 @@ class CurveController extends Controller {
1767
1702
  }
1768
1703
 
1769
1704
  class TextureController extends Controller {
1770
- needsUpdateDisplay() {
1771
- if (this.parent._closed) {
1772
- return false;
1773
- }
1774
- let texture = this.getValue();
1775
- if (texture && this._version !== texture.version) {
1776
- this._version = texture.version;
1777
- return true;
1778
- }
1779
- return false;
1780
- }
1781
1705
  updateDisplay() {
1782
1706
  const canvas = this.$canvas;
1783
1707
  const context = canvas.getContext("2d");
1784
- const texture = this.getValue();
1785
- const image = texture.image;
1786
- // Seems like context can be null if the canvas is not visible
1787
1708
  if (context) {
1788
- // Always clear the context before set new texture, because new texture may has transparency
1789
1709
  context.clearRect(0, 0, canvas.width, canvas.height);
1790
1710
  }
1791
- if (image && image.width > 0) {
1792
- const scale = canvas.width / image.width;
1793
- canvas.height = Math.max(2, image.height / image.width * canvas.width);
1794
- const width = Math.max(image.width * scale, 2);
1795
- const height = Math.max(image.height * scale, 2);
1796
- if (texture.__getImage) {
1797
- context.drawImage(texture.__getImage(), 0, 0, width, height);
1711
+ let texture = this.getValue();
1712
+ if (texture) {
1713
+ let image = texture.image;
1714
+ if (image && image.width > 0) {
1715
+ this.$label.textContent = `${image.width}x${image.height}`;
1716
+ canvas.title = texture.sourceFile;
1717
+ let scale = canvas.width / image.width;
1718
+ if (texture.isDataTexture || texture.isCompressedTexture) {
1719
+ context.drawImage(renderToCanvas(texture), 0, 0, image.width * scale, image.height * scale);
1720
+ } else if (image.depth) ; else {
1721
+ context.drawImage(image, 0, 0, image.width * scale, image.height * scale);
1722
+ }
1798
1723
  } else {
1799
- context.drawImage(image, 0, 0, width, height);
1724
+ canvas.title = texture.sourceFile + ' (error)';
1800
1725
  }
1726
+ } else {
1727
+ canvas.title = 'empty';
1801
1728
  }
1802
1729
  return this;
1803
1730
  }
1804
1731
  constructor(parent, object, property){
1805
1732
  super(parent, object, property, "image");
1806
- this._version = 0;
1807
- let group = document.createElement("div");
1733
+ const group = this.$widget.appendChild(document.createElement("div"));
1808
1734
  group.style.display = "flex";
1809
1735
  group.style.flexDirection = "column";
1810
1736
  group.style.width = "100%";
1811
- this.$widget.appendChild(group);
1812
- this.$canvas = document.createElement("canvas");
1813
- group.appendChild(this.$canvas);
1814
- const texture = this.getValue();
1815
- if (texture.isRenderTargetTexture) {
1816
- let button = document.createElement("button");
1817
- button.textContent = "capture";
1818
- button.onclick = ()=>this.updateDisplay();
1819
- group.appendChild(button);
1820
- }
1737
+ this.$canvas = group.appendChild(document.createElement("canvas"));
1738
+ const label = document.createElement("div");
1739
+ label.style.position = "absolute";
1740
+ label.style.display = "flex";
1741
+ label.style.backgroundColor = "black";
1742
+ this.$label = group.appendChild(label);
1743
+ group.onpointerover = (e)=>this.onpointerover && this.onpointerover(e);
1744
+ group.onpointerout = (e)=>this.onpointerout && this.onpointerout(e);
1821
1745
  }
1822
1746
  }
1823
1747
 
@@ -1878,14 +1802,6 @@ class GUI {
1878
1802
  */ addColor(object, property, rgbScale = 1) {
1879
1803
  return new ColorController(this, object, property, rgbScale);
1880
1804
  }
1881
- /**
1882
- *
1883
- * @param {object} object
1884
- * @param {string} property Name of the property to control.
1885
- * @returns {Controller}
1886
- */ addImage(object, property) {
1887
- return new ImageController(this, object, property);
1888
- }
1889
1805
  addTexture(object, property) {
1890
1806
  return new TextureController(this, object, property);
1891
1807
  }
@@ -2229,7 +2145,9 @@ class GUI {
2229
2145
  this.$title.setAttribute('role', 'button');
2230
2146
  this.$title.setAttribute('aria-expanded', "true");
2231
2147
  this.$title.setAttribute('tabindex', "0");
2232
- this.$title.addEventListener('click', ()=>this.openAnimated(this._closed));
2148
+ this.$title.addEventListener('click', ()=>{
2149
+ this.openAnimated(this._closed);
2150
+ });
2233
2151
  this.$title.addEventListener('keydown', (e)=>{
2234
2152
  if (e.code === 'Enter' || e.code === 'Space') {
2235
2153
  e.preventDefault();
@@ -2301,38 +2219,214 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
2301
2219
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2302
2220
  };
2303
2221
 
2304
- class InspectorPlugin extends Plugin {
2305
- static _getTargetName(target) {
2306
- return target.name || target.constructor.name || target.type;
2222
+ class ViewerHelper extends ObjectInstance {
2223
+ get outputColorSpace() {
2224
+ return this._renderer.outputColorSpace;
2225
+ }
2226
+ set outputColorSpace(v) {
2227
+ this._renderer.outputColorSpace = v;
2228
+ }
2229
+ get toneMapping() {
2230
+ return this._renderer.toneMapping;
2231
+ }
2232
+ set toneMapping(v) {
2233
+ this._renderer.toneMapping = v;
2234
+ }
2235
+ get toneMappingExposure() {
2236
+ return this._renderer.toneMappingExposure;
2237
+ }
2238
+ set toneMappingExposure(v) {
2239
+ this._renderer.toneMappingExposure = v;
2240
+ }
2241
+ get shadows() {
2242
+ return this._renderer.shadowMap.enabled;
2243
+ }
2244
+ set shadows(v) {
2245
+ this._renderer.shadowMap.enabled = v;
2246
+ }
2247
+ get backgroundBlurriness() {
2248
+ return this._scene.backgroundBlurriness;
2249
+ }
2250
+ set backgroundBlurriness(v) {
2251
+ this._scene.backgroundBlurriness = v;
2252
+ }
2253
+ get environment() {
2254
+ return this._scene.environment;
2255
+ }
2256
+ set environment(v) {
2257
+ this._scene.environment = v;
2258
+ }
2259
+ get environmentIntensity() {
2260
+ return this._scene.environmentIntensity;
2307
2261
  }
2308
- onUpdate(dt) {
2262
+ set environmentIntensity(v) {
2263
+ this._scene.environmentIntensity = v;
2264
+ }
2265
+ get environmentRotation() {
2266
+ return this._scene.environmentRotation;
2267
+ }
2268
+ set environmentRotation(v) {
2269
+ this._scene.environmentRotation.copy(v);
2270
+ }
2271
+ get backgroundRotation() {
2272
+ return this._scene.backgroundRotation;
2273
+ }
2274
+ set backgroundRotation(v) {
2275
+ this._scene.backgroundRotation.copy(v);
2276
+ }
2277
+ get targetFrameRate() {
2278
+ return this._viewer.targetFrameRate;
2279
+ }
2280
+ set targetFrameRate(v) {
2281
+ this._viewer.targetFrameRate = v;
2282
+ }
2283
+ constructor(viewer){
2284
+ super();
2285
+ this._viewer = viewer;
2286
+ this._scene = viewer.scene;
2287
+ this._renderer = viewer.renderer;
2288
+ }
2289
+ }
2290
+ __decorate([
2291
+ property({
2292
+ value: {
2293
+ SRGBColorSpace: "srgb",
2294
+ LinearSRGBColorSpace: "srgb-linear",
2295
+ DisplayP3ColorSpace: "display-p3",
2296
+ LinearDisplayP3ColorSpace: "display-p3-linear"
2297
+ }
2298
+ })
2299
+ ], ViewerHelper.prototype, "outputColorSpace", null);
2300
+ __decorate([
2301
+ property({
2302
+ value: {
2303
+ NoToneMapping: 0,
2304
+ LinearToneMapping: 1,
2305
+ ReinhardToneMapping: 2,
2306
+ CineonToneMapping: 3,
2307
+ ACESFilmicToneMapping: 4
2308
+ }
2309
+ })
2310
+ ], ViewerHelper.prototype, "toneMapping", null);
2311
+ __decorate([
2312
+ property({
2313
+ min: 0,
2314
+ max: 10,
2315
+ step: 0.01
2316
+ })
2317
+ ], ViewerHelper.prototype, "toneMappingExposure", null);
2318
+ __decorate([
2319
+ property
2320
+ ], ViewerHelper.prototype, "shadows", null);
2321
+ __decorate([
2322
+ property({
2323
+ min: 0,
2324
+ max: 1,
2325
+ step: 0.01
2326
+ })
2327
+ ], ViewerHelper.prototype, "backgroundBlurriness", null);
2328
+ __decorate([
2329
+ property
2330
+ ], ViewerHelper.prototype, "environment", null);
2331
+ __decorate([
2332
+ property({
2333
+ min: 0,
2334
+ max: 1,
2335
+ step: 0.01
2336
+ })
2337
+ ], ViewerHelper.prototype, "environmentIntensity", null);
2338
+ __decorate([
2339
+ property({
2340
+ step: 0.01
2341
+ })
2342
+ ], ViewerHelper.prototype, "environmentRotation", null);
2343
+ __decorate([
2344
+ property({
2345
+ step: 0.01
2346
+ })
2347
+ ], ViewerHelper.prototype, "backgroundRotation", null);
2348
+ __decorate([
2349
+ property({
2350
+ min: 1,
2351
+ max: 120,
2352
+ step: 1
2353
+ })
2354
+ ], ViewerHelper.prototype, "targetFrameRate", null);
2355
+
2356
+ class Inspector extends Mount {
2357
+ onLoad() {
2358
+ this._scene = new Scene();
2359
+ this._camera = new OrthographicCamera(0, window.innerWidth, window.innerHeight, 0, -1, 1);
2360
+ this._gui = new GUI({
2361
+ width: 310,
2362
+ title: "Inspector"
2363
+ }).close();
2364
+ this._gui.addFolder("Viewer").close().hide();
2365
+ this._gui.addFolder("Component").close().hide();
2366
+ this._gui.addFolder("Material").close().hide();
2367
+ this._gui.addFolder("Other").close().hide();
2368
+ this._rect = this._gui.domElement.getBoundingClientRect();
2369
+ this._inspect(new ViewerHelper(this.viewer));
2370
+ this._addSprite();
2371
+ }
2372
+ onDestroy() {
2373
+ this._gui.destroy();
2374
+ this._refCntMap.clear();
2375
+ this._targetMap.clear();
2376
+ }
2377
+ update(dt) {
2309
2378
  this._gui.update();
2310
2379
  this._updateFolders();
2311
2380
  }
2312
- _initFolders() {
2313
- const gui = this._gui;
2314
- gui.addFolder("Viewer").close().hide();
2315
- gui.addFolder("Plugin").close().hide();
2316
- gui.addFolder("Component").close().hide();
2317
- gui.addFolder("Material").close().hide();
2318
- gui.addFolder("Other").close().hide();
2319
- }
2320
- _initViewer() {
2321
- this.inspect(new ViewerExtension(this.viewer));
2381
+ resize(width, height) {
2382
+ this._camera.left = 0;
2383
+ this._camera.right = width;
2384
+ this._camera.top = height;
2385
+ this._camera.bottom = 0;
2386
+ this._camera.updateProjectionMatrix();
2387
+ this._rect = this._gui.domElement.getBoundingClientRect();
2388
+ }
2389
+ render(dt) {
2390
+ const { renderer } = this.viewer;
2391
+ const autoClearDepth = renderer.autoClearDepth;
2392
+ const autoClearColor = renderer.autoClearColor;
2393
+ renderer.autoClearDepth = true;
2394
+ renderer.autoClearColor = false;
2395
+ renderer.render(this._scene, this._camera);
2396
+ renderer.autoClearDepth = autoClearDepth;
2397
+ renderer.autoClearColor = autoClearColor;
2398
+ }
2399
+ _addSprite() {
2400
+ const viewer = this.viewer;
2401
+ this._tween = viewer.tween();
2402
+ this._background = viewer.add(Sprite, {
2403
+ parent: this._scene,
2404
+ scale: new Vector3(258, 258, 1),
2405
+ position: new Vector3(viewer.width / 2, viewer.height / 2)
2406
+ });
2407
+ this._background.material.opacity = 0;
2408
+ this._sprite = viewer.add(Sprite, {
2409
+ parent: this._scene,
2410
+ scale: new Vector3(256, 256, 1),
2411
+ position: new Vector3(viewer.width / 2, viewer.height / 2)
2412
+ });
2413
+ this._sprite.material.opacity = 0;
2322
2414
  }
2323
2415
  _updateFolders() {
2324
- const statesMap = this._statesMap;
2325
- const setState = (v)=>statesMap.set(v, statesMap.has(v) ? 0 : 1);
2326
- statesMap.forEach((_, k, map)=>map.set(k, -1));
2327
- this.viewer.traversePlugins(setState);
2416
+ const refCntMap = this._refCntMap;
2417
+ const setState = (v)=>{
2418
+ if (refCntMap.get(v) === -1) refCntMap.set(v, 0);
2419
+ if (refCntMap.get(v) === undefined) refCntMap.set(v, 1);
2420
+ };
2421
+ refCntMap.forEach((_, k, map)=>map.set(k, -1));
2328
2422
  this.viewer.traverseComponents(setState);
2329
2423
  this.viewer.traverseMaterials(setState);
2330
- statesMap.forEach((v, k, map)=>{
2424
+ refCntMap.forEach((v, k, map)=>{
2331
2425
  if (v === 1) {
2332
- this.inspect(k);
2426
+ this._inspect(k);
2333
2427
  }
2334
2428
  if (v === -1) {
2335
- this.uninspect(k);
2429
+ this._uninspect(k);
2336
2430
  map.delete(k);
2337
2431
  }
2338
2432
  });
@@ -2341,15 +2435,14 @@ class InspectorPlugin extends Plugin {
2341
2435
  const list = [];
2342
2436
  let props = PropertyManager._getMergedProperties(target.constructor);
2343
2437
  if (props) {
2344
- list.push(props);
2345
- this._targetMap.set(props, target);
2438
+ const values = propsSort(props);
2439
+ list.push(values);
2440
+ this._targetMap.set(values, target);
2346
2441
  }
2347
2442
  if (target instanceof ShaderMaterial) {
2348
2443
  props = Object.create(null);
2349
2444
  const uniforms = Object.create(null);
2350
- this._targetMap.set(props, uniforms);
2351
- const entries = Object.entries(target.uniforms);
2352
- entries.forEach(([name])=>{
2445
+ Object.keys(target.uniforms).forEach((name)=>{
2353
2446
  Object.defineProperty(uniforms, name, {
2354
2447
  get: ()=>target.uniforms[name].value,
2355
2448
  set: (v)=>target.uniforms[name].value = v
@@ -2358,18 +2451,18 @@ class InspectorPlugin extends Plugin {
2358
2451
  dir: "uniforms"
2359
2452
  };
2360
2453
  });
2361
- list.push(props);
2454
+ const values = propsSort(props);
2455
+ list.push(values);
2456
+ this._targetMap.set(values, uniforms);
2362
2457
  }
2363
2458
  return list;
2364
2459
  }
2365
- inspect(target) {
2460
+ _inspect(target) {
2366
2461
  let propsList = this._getPropertiesList(target);
2367
2462
  if (propsList.length === 0) return;
2368
2463
  let gui = this._gui;
2369
- if (target instanceof ViewerExtension) {
2464
+ if (target instanceof ViewerHelper) {
2370
2465
  gui = gui.getFolder("Viewer").show();
2371
- } else if (target instanceof Plugin) {
2372
- gui = gui.getFolder("Plugin").show();
2373
2466
  } else if (target instanceof Component) {
2374
2467
  gui = gui.getFolder("Component").show();
2375
2468
  } else if (target instanceof Material) {
@@ -2378,28 +2471,29 @@ class InspectorPlugin extends Plugin {
2378
2471
  gui = gui.getFolder("Other").show();
2379
2472
  }
2380
2473
  if (gui._title !== "Viewer") {
2381
- gui = gui.getFolder(target.uuid) || gui.addFolder(InspectorPlugin._getTargetName(target), target.uuid).close();
2474
+ gui = gui.getFolder(target.uuid) || gui.addFolder(targetName(target), target.uuid).close();
2382
2475
  }
2383
- this._addPropsListGUI(gui, propsList, target);
2476
+ this._addGUI(gui, propsList, target);
2384
2477
  return target;
2385
2478
  }
2386
- _addPropsListGUI(gui, list, target, dir = "") {
2387
- let source = target;
2388
- for (let props of list){
2389
- if (dir) {
2390
- gui = gui.getFolder(dir) || gui.addFolder(dir).close();
2391
- }
2479
+ _addGUI(gui, list, target, dir = "") {
2480
+ if (dir) {
2481
+ gui = gui.getFolder(dir) || gui.addFolder(dir).close();
2482
+ }
2483
+ const source = target;
2484
+ for (const props of list){
2392
2485
  target = this._targetMap.get(props) || source;
2393
- for(let k in props){
2486
+ for (const [k, prop] of props){
2394
2487
  let value = target[k];
2395
- if (value == null) continue;
2396
- const prop = props[k];
2488
+ if (value == null || prop.parent && target[prop.parent] == null) {
2489
+ continue;
2490
+ }
2397
2491
  let folder = gui;
2398
2492
  if (prop.dir) {
2399
2493
  folder = folder.getFolder(prop.dir) || folder.addFolder(prop.dir).close();
2400
2494
  }
2401
2495
  if (PropertyManager._hasProperties(value.constructor)) {
2402
- this._addPropsListGUI(folder, this._getPropertiesList(value), target, k);
2496
+ this._addGUI(folder, this._getPropertiesList(value), target, k);
2403
2497
  }
2404
2498
  const type = typeof value;
2405
2499
  let ins = null;
@@ -2409,7 +2503,34 @@ class InspectorPlugin extends Plugin {
2409
2503
  ins = folder.addCurve(target, k);
2410
2504
  } else if (value.isVector2 || value.isVector3 || value.isVector4 || value.isEuler) {
2411
2505
  ins = folder.addVector(target, k, prop.min, prop.max, prop.step);
2412
- } else if (value.isTexture) ; else if (type === "number" || type === "boolean" || type === "string" || type === "function") {
2506
+ } else if (value.isTexture) {
2507
+ ins = folder.addTexture(target, k);
2508
+ ins.onpointerover = ()=>{
2509
+ const image = value.image;
2510
+ const w = image.width * 256 / image.height, h = 256;
2511
+ const x = this._rect.x - w / 2 - 10;
2512
+ this._background.scale.set(w + 2, h + 2, 1);
2513
+ this._background.position.x = x;
2514
+ this._sprite.scale.set(w, h, 1);
2515
+ this._sprite.position.x = x;
2516
+ this._sprite.material.map = value;
2517
+ this._sprite.material.needsUpdate = true;
2518
+ this._tween.timeline(this._sprite.material).to({
2519
+ opacity: 1
2520
+ }, 0.3).start();
2521
+ this._tween.timeline(this._background.material).to({
2522
+ opacity: 1
2523
+ }, 0.3).start();
2524
+ };
2525
+ ins.onpointerout = ()=>{
2526
+ this._tween.timeline(this._background.material).to({
2527
+ opacity: 0
2528
+ }, 0.3).start();
2529
+ this._tween.timeline(this._sprite.material).to({
2530
+ opacity: 0
2531
+ }, 0.3).start();
2532
+ };
2533
+ } else if (type === "number" || type === "boolean" || type === "string" || type === "function") {
2413
2534
  ins = folder.add(target, k, prop.value || prop.min, prop.max, prop.step);
2414
2535
  } else ;
2415
2536
  if (ins && prop.name) {
@@ -2418,11 +2539,9 @@ class InspectorPlugin extends Plugin {
2418
2539
  }
2419
2540
  }
2420
2541
  }
2421
- uninspect(target) {
2542
+ _uninspect(target) {
2422
2543
  let gui = this._gui;
2423
- if (target instanceof Plugin) {
2424
- gui = gui.getFolder("Plugin");
2425
- } else if (target instanceof Component) {
2544
+ if (target instanceof Component) {
2426
2545
  gui = gui.getFolder("Component");
2427
2546
  } else if (target instanceof Material) {
2428
2547
  gui = gui.getFolder("Material");
@@ -2434,100 +2553,52 @@ class InspectorPlugin extends Plugin {
2434
2553
  gui.hide();
2435
2554
  }
2436
2555
  }
2437
- constructor(){
2438
- super();
2439
- this._statesMap = new Map();
2556
+ constructor(...args){
2557
+ super(...args);
2558
+ this._refCntMap = new Map();
2440
2559
  this._targetMap = new Map();
2441
- this.install = ()=>{
2442
- this._gui = new GUI({
2443
- width: 310,
2444
- title: "Inspector"
2445
- }).close();
2446
- this._initFolders();
2447
- this._initViewer();
2448
- };
2449
- this.uninstall = ()=>{
2450
- this._gui.destroy();
2451
- this._statesMap.clear();
2452
- this._targetMap.clear();
2453
- };
2454
2560
  }
2455
2561
  }
2456
- class ViewerExtension extends ObjectInstance {
2457
- get outputColorSpace() {
2458
- return this._renderer.outputColorSpace;
2459
- }
2460
- set outputColorSpace(v) {
2461
- this._renderer.outputColorSpace = v;
2462
- }
2463
- get toneMapping() {
2464
- return this._renderer.toneMapping;
2465
- }
2466
- set toneMapping(v) {
2467
- this._renderer.toneMapping = v;
2468
- }
2469
- get toneMappingExposure() {
2470
- return this._renderer.toneMappingExposure;
2471
- }
2472
- set toneMappingExposure(v) {
2473
- this._renderer.toneMappingExposure = v;
2474
- }
2475
- get shadows() {
2476
- return this._renderer.shadowMap.enabled;
2477
- }
2478
- set shadows(v) {
2479
- this._renderer.shadowMap.enabled = v;
2480
- }
2481
- get backgroundBlurriness() {
2482
- return this._scene.backgroundBlurriness;
2483
- }
2484
- set backgroundBlurriness(v) {
2485
- this._scene.backgroundBlurriness = v;
2486
- }
2487
- constructor(viewer){
2488
- super();
2489
- this._scene = viewer.scene;
2490
- this._renderer = viewer.renderer;
2491
- }
2562
+ function targetName(target) {
2563
+ return target.name || target.constructor.name || target.type;
2492
2564
  }
2493
- __decorate([
2494
- property({
2495
- value: {
2496
- SRGBColorSpace: "srgb",
2497
- LinearSRGBColorSpace: "srgb-linear",
2498
- DisplayP3ColorSpace: "display-p3",
2499
- LinearDisplayP3ColorSpace: "display-p3-linear"
2500
- }
2501
- })
2502
- ], ViewerExtension.prototype, "outputColorSpace", null);
2503
- __decorate([
2504
- property({
2565
+ function propsSort(props) {
2566
+ const order = (v)=>v.order || 10000;
2567
+ const values = Object.entries(props);
2568
+ const array0 = values.filter((v)=>!v[1].dir).sort((a, b)=>order(a[1]) - order(b[1]));
2569
+ const array1 = values.filter((v)=>v[1].dir).sort((a, b)=>order(a[1]) - order(b[1]));
2570
+ return array0.concat(array1);
2571
+ }
2572
+ const materialProperties = {
2573
+ visible: {
2574
+ order: 1
2575
+ },
2576
+ transparent: {
2577
+ order: 2
2578
+ },
2579
+ side: {
2580
+ order: 3,
2505
2581
  value: {
2506
- NoToneMapping: 0,
2507
- LinearToneMapping: 1,
2508
- ReinhardToneMapping: 2,
2509
- CineonToneMapping: 3,
2510
- ACESFilmicToneMapping: 4
2582
+ FrontSide: 0,
2583
+ BackSide: 1,
2584
+ DoubleSide: 2
2511
2585
  }
2512
- })
2513
- ], ViewerExtension.prototype, "toneMapping", null);
2514
- __decorate([
2515
- property({
2516
- min: 0,
2517
- max: 10,
2518
- step: 0.01
2519
- })
2520
- ], ViewerExtension.prototype, "toneMappingExposure", null);
2521
- __decorate([
2522
- property
2523
- ], ViewerExtension.prototype, "shadows", null);
2524
- __decorate([
2525
- property({
2586
+ },
2587
+ color: {
2588
+ order: 4,
2589
+ dir: "diffuse"
2590
+ },
2591
+ opacity: {
2592
+ order: 5,
2593
+ dir: "diffuse",
2526
2594
  min: 0,
2527
2595
  max: 1,
2528
2596
  step: 0.01
2529
- })
2530
- ], ViewerExtension.prototype, "backgroundBlurriness", null);
2597
+ }
2598
+ };
2599
+ for(let k in materialProperties){
2600
+ property(materialProperties[k])(Material.prototype, k);
2601
+ }
2531
2602
  const meshBasicMaterislProperties = {
2532
2603
  map: {
2533
2604
  dir: "diffuse"
@@ -2560,24 +2631,6 @@ for(let k in meshBasicMaterislProperties){
2560
2631
  property(meshBasicMaterislProperties[k])(MeshBasicMaterial.prototype, k);
2561
2632
  }
2562
2633
  const meshStandardMaterialProperties = {
2563
- visible: {},
2564
- transparent: {},
2565
- side: {
2566
- value: {
2567
- FrontSide: 0,
2568
- BackSide: 1,
2569
- DoubleSide: 2
2570
- }
2571
- },
2572
- color: {
2573
- dir: "diffuse"
2574
- },
2575
- opacity: {
2576
- dir: "diffuse",
2577
- min: 0,
2578
- max: 1,
2579
- step: 0.01
2580
- },
2581
2634
  map: {
2582
2635
  dir: "diffuse"
2583
2636
  },
@@ -2627,7 +2680,8 @@ const meshStandardMaterialProperties = {
2627
2680
  },
2628
2681
  normalScale: {
2629
2682
  dir: "normal",
2630
- parent: "normalMap"
2683
+ step: 0.01,
2684
+ parent: "normalMap "
2631
2685
  },
2632
2686
  displacementScale: {
2633
2687
  dir: "displacement",
@@ -2647,7 +2701,8 @@ const meshStandardMaterialProperties = {
2647
2701
  dir: "envMap",
2648
2702
  min: 0,
2649
2703
  max: 1,
2650
- step: 0.01
2704
+ step: 0.01,
2705
+ parent: "envMap"
2651
2706
  },
2652
2707
  lightMap: {
2653
2708
  dir: "lightMap"
@@ -2663,6 +2718,116 @@ const meshStandardMaterialProperties = {
2663
2718
  for(let k in meshStandardMaterialProperties){
2664
2719
  property(meshStandardMaterialProperties[k])(MeshStandardMaterial.prototype, k);
2665
2720
  }
2721
+ const meshPhysicalMaterialProperties = {
2722
+ ior: {
2723
+ min: 0,
2724
+ max: 10,
2725
+ step: 0.01
2726
+ },
2727
+ anisotropy: {
2728
+ min: 0,
2729
+ max: 10,
2730
+ step: 0.01
2731
+ },
2732
+ clearcoat: {
2733
+ dir: "clearcoat"
2734
+ },
2735
+ clearcoatMap: {
2736
+ dir: "clearcoat",
2737
+ min: 0,
2738
+ max: 1,
2739
+ step: 0.01
2740
+ },
2741
+ clearcoatRoughness: {
2742
+ dir: "clearcoat",
2743
+ min: 0,
2744
+ max: 1,
2745
+ step: 0.01
2746
+ },
2747
+ clearcoatNormalScale: {
2748
+ dir: "clearcoat",
2749
+ step: 0.01
2750
+ },
2751
+ clearcoatNormalMap: {
2752
+ dir: "clearcoat"
2753
+ },
2754
+ iridescence: {
2755
+ dir: "iridescence",
2756
+ min: 0,
2757
+ max: 1,
2758
+ step: 0.01
2759
+ },
2760
+ iridescenceMap: {
2761
+ dir: "iridescence"
2762
+ },
2763
+ iridescenceIOR: {
2764
+ dir: "iridescence",
2765
+ step: 0.01
2766
+ },
2767
+ iridescenceThicknessRange: {
2768
+ dir: "iridescence"
2769
+ },
2770
+ iridescenceThicknessMap: {
2771
+ dir: "iridescence"
2772
+ },
2773
+ sheen: {
2774
+ dir: "sheen"
2775
+ },
2776
+ sheenColor: {
2777
+ dir: "sheen"
2778
+ },
2779
+ sheenColorMap: {
2780
+ dir: "sheen"
2781
+ },
2782
+ sheenRoughness: {
2783
+ dir: "sheen",
2784
+ min: 0,
2785
+ max: 1,
2786
+ step: 0.01
2787
+ },
2788
+ sheenRoughnessMap: {
2789
+ dir: "sheen"
2790
+ },
2791
+ transmission: {
2792
+ dir: "transmission"
2793
+ },
2794
+ transmissionMap: {
2795
+ dir: "transmission"
2796
+ },
2797
+ thickness: {
2798
+ dir: "thickness",
2799
+ min: 0,
2800
+ max: 1,
2801
+ step: 0.01
2802
+ },
2803
+ thicknessMap: {
2804
+ dir: "thickness"
2805
+ },
2806
+ attenuationDistance: {
2807
+ dir: "attenuation"
2808
+ },
2809
+ attenuationColor: {
2810
+ dir: "attenuation"
2811
+ },
2812
+ specularIntensity: {
2813
+ dir: "specular",
2814
+ min: 0,
2815
+ max: 1,
2816
+ step: 0.01
2817
+ },
2818
+ specularIntensityMap: {
2819
+ dir: "specular"
2820
+ },
2821
+ specularColor: {
2822
+ dir: "specular"
2823
+ },
2824
+ specularColorMap: {
2825
+ dir: "specular"
2826
+ }
2827
+ };
2828
+ for(let k in meshPhysicalMaterialProperties){
2829
+ property(meshPhysicalMaterialProperties[k])(MeshPhysicalMaterial.prototype, k);
2830
+ }
2666
2831
 
2667
2832
  /**
2668
2833
  * @author mrdoob / http://mrdoob.com/
@@ -2712,7 +2877,7 @@ var Panel = function(name, fg, bg) {
2712
2877
  }
2713
2878
  };
2714
2879
  };
2715
- var Stats = function() {
2880
+ var Stats$1 = function() {
2716
2881
  var mode = 0;
2717
2882
  var container = document.createElement('div');
2718
2883
  container.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';
@@ -2771,8 +2936,19 @@ var Stats = function() {
2771
2936
  };
2772
2937
  };
2773
2938
 
2774
- class StatsPlugin extends Plugin {
2775
- onUpdate(dt) {
2939
+ class Stats extends Mount {
2940
+ onLoad() {
2941
+ this._stats.addPanel(this._dcPanel);
2942
+ this._stats.addPanel(this._texPanel);
2943
+ this._stats.addPanel(this._triPanel);
2944
+ this._stats.addPanel(this._prgPanel);
2945
+ this._stats.showPanel(0);
2946
+ document.body.appendChild(this._stats.dom);
2947
+ }
2948
+ onDestroy() {
2949
+ document.body.removeChild(this._stats.dom);
2950
+ }
2951
+ update(dt) {
2776
2952
  const info = this.viewer.renderer.info;
2777
2953
  this._dcPanel.update(info.render.calls, 300);
2778
2954
  this._triPanel.update(info.render.triangles, 500000);
@@ -2780,26 +2956,35 @@ class StatsPlugin extends Plugin {
2780
2956
  this._prgPanel.update(info.programs.length, 50);
2781
2957
  this._stats.update();
2782
2958
  }
2783
- constructor(){
2784
- super();
2785
- this._stats = new Stats();
2959
+ constructor(...args){
2960
+ super(...args);
2961
+ this._stats = new Stats$1();
2786
2962
  this._dcPanel = new Panel('DC', '#ff8', '#221');
2787
2963
  this._triPanel = new Panel("TRI", '#ff8', '#221');
2788
2964
  this._texPanel = new Panel('TEX', '#ff8', '#221');
2789
2965
  this._prgPanel = new Panel('PRG', '#ff8', '#221');
2790
- this.install = ()=>{
2791
- this._stats.addPanel(this._dcPanel);
2792
- this._stats.addPanel(this._texPanel);
2793
- this._stats.addPanel(this._triPanel);
2794
- this._stats.addPanel(this._prgPanel);
2795
- this._stats.showPanel(0);
2796
- document.body.appendChild(this._stats.dom);
2797
- };
2798
- this.uninstall = ()=>{
2799
- document.body.removeChild(this._stats.dom);
2800
- };
2801
2966
  }
2802
2967
  }
2803
2968
 
2804
- export { GUI, InspectorPlugin, StatsPlugin };
2969
+ class BoxProjectionHelper extends Mount {
2970
+ onLoad() {
2971
+ this._box3 = new Box3();
2972
+ this._target = this.viewer.mount(BoxProjection);
2973
+ this._helper = this.viewer.add(new Box3Helper(this._box3));
2974
+ }
2975
+ onEnable() {
2976
+ this._helper.visible = true;
2977
+ }
2978
+ onDisable() {
2979
+ this._helper.visible = false;
2980
+ }
2981
+ update(dt) {
2982
+ const { center, boxMin, boxMax } = this._target;
2983
+ this._box3.min.copy(center).add(boxMin);
2984
+ this._box3.max.copy(center).add(boxMax);
2985
+ this._helper.updateMatrixWorld();
2986
+ }
2987
+ }
2988
+
2989
+ export { BoxProjectionHelper, GUI, Inspector, Stats };
2805
2990
  //# sourceMappingURL=module.js.map