diff --git a/ShadowEditor.Web/src/editor/control/TextureSelectControl.js b/ShadowEditor.Web/src/editor/control/TextureSelectControl.js index 2009cb97..96570984 100644 --- a/ShadowEditor.Web/src/editor/control/TextureSelectControl.js +++ b/ShadowEditor.Web/src/editor/control/TextureSelectControl.js @@ -88,14 +88,32 @@ TextureSelectControl.prototype.onClick = function () { TextureSelectControl.prototype.onSelect = function (data) { var urls = data.Url.split(';'); // 立体贴图data.Url多于一张,只取第一个。 - var loader = new THREE.TextureLoader(); - loader.load(`${this.app.options.server}${urls[0]}`, texture => { - this.texture = texture; - this.texture.name = data.Name; - this.window.hide(); - this.updateUI(); - this.onChange(); - }); + if (data.Type === 'video') { // 视频贴图 + var video = document.createElement('video'); + video.src = `${this.app.options.server}${urls[0]}`; + video.loop = 'loop'; + video.autoplay = 'autoplay'; + video.onplay = () => { + var texture = new THREE.VideoTexture(video); + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.format = THREE.RGBFormat; + this.texture = texture; + this.texture.name = data.Name; + this.window.hide(); + this.updateUI(); + this.onChange(); + } + } else { // 其他 + var loader = new THREE.TextureLoader(); + loader.load(`${this.app.options.server}${urls[0]}`, texture => { + this.texture = texture; + this.texture.name = data.Name; + this.window.hide(); + this.updateUI(); + this.onChange(); + }); + } }; export default TextureSelectControl; \ No newline at end of file diff --git a/ShadowEditor.Web/src/editor/window/TextureWindow.js b/ShadowEditor.Web/src/editor/window/TextureWindow.js index 06669f2f..4b148246 100644 --- a/ShadowEditor.Web/src/editor/window/TextureWindow.js +++ b/ShadowEditor.Web/src/editor/window/TextureWindow.js @@ -43,7 +43,6 @@ TextureWindow.prototype.onUpload = function (obj) { TextureWindow.prototype.onClick = function (data) { if (typeof (this.onSelect) === 'function') { - debugger this.onSelect(data); } else { UI.msg('请在材质控件中修改纹理。');