1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

add VideoTexture

This commit is contained in:
YangLei 2021-09-09 17:24:22 +08:00
parent 67f4c2dffd
commit 18c30d212f
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,22 @@
import { defineComponent, watch } from 'vue'
import { VideoTexture } from 'three'
import Texture from './Texture'
export default defineComponent({
extends: Texture,
props: {
videoId: {
type: String,
required: true,
},
},
created() {
watch(() => this.videoId, this.refreshTexture)
},
methods: {
createTexture() {
const video = document.getElementById(this.videoId) as HTMLVideoElement
return new VideoTexture(video)
},
},
})

View File

@ -5,5 +5,6 @@ export { default as SubSurfaceMaterial } from './SubSurfaceMaterial'
export { default as Texture } from './Texture' export { default as Texture } from './Texture'
export { default as CubeTexture } from './CubeTexture' export { default as CubeTexture } from './CubeTexture'
export { default as VideoTexture } from './VideoTexture'
export type { MaterialPublicInterface } from './Material' export type { MaterialPublicInterface } from './Material'