-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40b5631
commit 0d073e6
Showing
7 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import * as THREE from 'three' | ||
|
||
import Experience from './Experience.js' | ||
|
||
export default class Screen | ||
{ | ||
constructor(_mesh, _sourcePath) | ||
{ | ||
this.experience = new Experience() | ||
this.resources = this.experience.resources | ||
this.debug = this.experience.debug | ||
this.scene = this.experience.scene | ||
this.world = this.experience.world | ||
|
||
this.mesh = _mesh | ||
this.sourcePath = _sourcePath | ||
|
||
this.setModel() | ||
} | ||
|
||
setModel() | ||
{ | ||
this.model = {} | ||
|
||
// Element | ||
this.model.element = document.createElement('video') | ||
this.model.element.muted = true | ||
this.model.element.loop = true | ||
this.model.element.controls = true | ||
this.model.element.playsInline = true | ||
this.model.element.autoplay = true | ||
this.model.element.src = this.sourcePath | ||
this.model.element.play() | ||
|
||
// Texture | ||
this.model.texture = new THREE.VideoTexture(this.model.element) | ||
this.model.texture.encoding = THREE.sRGBEncoding | ||
|
||
// Material | ||
this.model.material = new THREE.MeshBasicMaterial({ | ||
map: this.model.texture | ||
}) | ||
|
||
// Mesh | ||
this.model.mesh = this.mesh | ||
this.model.mesh.material = this.model.material | ||
this.scene.add(this.model.mesh) | ||
} | ||
|
||
update() | ||
{ | ||
// this.model.group.rotation.y = Math.sin(this.time.elapsed * 0.0005) * 0.5 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0d073e6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: