Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
added environment map support for aframe
Browse files Browse the repository at this point in the history
  • Loading branch information
coderofsalvation committed Jul 10, 2024
1 parent 5250e1d commit da5fa1d
Show file tree
Hide file tree
Showing 6 changed files with 15,754 additions and 4 deletions.
29 changes: 28 additions & 1 deletion dist/xrfragment.aframe.all.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 28 additions & 1 deletion dist/xrfragment.aframe.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* v0.5.1 generated at Tue Jul 9 04:28:50 PM UTC 2024
* v0.5.1 generated at Wed Jul 10 10:00:28 AM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
*/
Expand Down Expand Up @@ -4103,6 +4103,33 @@ let videoMimeTypes = [
'video/mp4'
]
videoMimeTypes.map( (mimetype) => xrf.frag.src.type[ mimetype ] = loadVideo(mimetype) )
// poor man's way to move forward using hand gesture pinch

window.AFRAME.registerComponent('envmap', {
schema:{
src: {type: "string"}
},
init: function(){
const loader = new THREE.TextureLoader();
const onLoad = (texture) => {
texture.colorSpace = THREE.SRGBColorSpace;
texture.mapping = THREE.EquirectangularReflectionMapping;
xrf.scene.environment = texture
xrf.scene.texture = texture
}
new THREE.TextureLoader().load( this.data.src, onLoad, null, console.error );

xrf.addEventListener('navigateLoaded', () => {
xrf.scene.traverse( (n) => {
if( n.material && n.material.isMeshPhysicalMaterial){
console.dir(n.material)
n.material.envMap = xrf.scene.environment
}
})
})

},
})
window.AFRAME.registerComponent('href', {
schema: {
},
Expand Down
Loading

0 comments on commit da5fa1d

Please sign in to comment.