Skip to content

Instantly share code, notes, and snippets.

@thylacinelol
Created May 5, 2021 13:12
Show Gist options
  • Save thylacinelol/6b9478d3c2a4dac1db3582b7fcdf5901 to your computer and use it in GitHub Desktop.
Save thylacinelol/6b9478d3c2a4dac1db3582b7fcdf5901 to your computer and use it in GitHub Desktop.
diff --git a/src/ARnft.js b/src/ARnft.js
index eef64a7..f95e821 100644
--- a/src/ARnft.js
+++ b/src/ARnft.js
@@ -143,18 +143,22 @@ export default class ARnft {
addVideo (id, scale) {
const root = this.root
var ARVideo = document.getElementById(id)
+ ARVideo.play();
+
var texture = new THREE.VideoTexture(ARVideo)
- var mat = new THREE.MeshLambertMaterial({ color: 0xbbbbff, map: texture })
- ARVideo.play()
- var planeGeom = new THREE.PlaneGeometry(1, 1, 1, 1)
- var plane = new THREE.Mesh(planeGeom, mat)
- plane.scale.set(scale, scale, scale)
+ texture.minFilter = THREE.LinearFilter;
+ texture.magFilter = THREE.LinearFilter;
+ const matParameters = { color: 0xffffff, map: texture };
+ var mat = new THREE.MeshLambertMaterial(matParameters);
+ var geometry = new THREE.BoxGeometry( 480, 204, 480 );
+ var mesh = new THREE.Mesh(geometry, mat);
+
document.addEventListener('getNFTData', (ev) => {
var msg = ev.detail
- plane.position.y = (msg.height / msg.dpi * 2.54 * 10) / 2.0
- plane.position.x = (msg.width / msg.dpi * 2.54 * 10) / 2.0
+ mesh.position.y = (msg.height / msg.dpi * 2.54 * 10) / 2.0
+ mesh.position.x = (msg.width / msg.dpi * 2.54 * 10) / 2.0
})
- root.add(plane)
+ root.add(mesh);
}
dispatchEvent (event) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment