修复使用视频当贴图bug。

This commit is contained in:
tengge1 2019-09-13 21:25:01 +08:00
parent 52fe81661e
commit dcfb84d38e
2 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,7 @@ Supported Languages: 中文 / [繁體中文](README-tw.md) / [English](README-en
11. 修复贴图路径为blob:http://导致加载场景模型显示黑色bug。
12. 服务端国际化完成。
13. 发布新版演示程序:[GitHub](https://tengge1.github.io/ShadowEditor-examples/) [Gitee](http://tengge1.gitee.io/shadoweditor-examples/)
14. 修复使用视频当贴图bug。
## v0.3.2更新

View File

@ -92,6 +92,17 @@ class TextureProperty extends React.Component {
texture.sourceFile = name;
onChange && onChange(texture, this.props.name, data);
});
} else if (type === 'video') {
let video = document.createElement('video');
video.setAttribute('src', data.Url);
video.setAttribute('autoplay', 'autoplay');
let texture = new THREE.VideoTexture(video);
texture.minFilter = THREE.LinearFilter;
texture.magFilter = THREE.LinearFilter;
texture.format = THREE.RGBFormat;
onChange && onChange(texture, this.props.name, data);
} else {
const loader = new THREE.TextureLoader();
loader.load(url, obj => {