mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
add VideoTexture
This commit is contained in:
parent
67f4c2dffd
commit
18c30d212f
22
src/materials/VideoTexture.ts
Normal file
22
src/materials/VideoTexture.ts
Normal 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)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
@ -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'
|
||||||
|
Loading…
Reference in New Issue
Block a user