Created
July 31, 2017 07:05
-
-
Save leefsmp/e33d1a2cd7bba255cde2d8c9dc5d25a3 to your computer and use it in GitHub Desktop.
Forge Viewer Skybox
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
class ViewerSkybox { | |
constructor (viewer, options) { | |
const faceMaterials = options.imageList.map((url) => { | |
return new THREE.MeshBasicMaterial({ | |
map: THREE.ImageUtils.loadTexture(url), | |
side: THREE.BackSide | |
}) | |
}) | |
const skyMaterial = new THREE.MeshFaceMaterial( | |
faceMaterials) | |
const geometry = new THREE.CubeGeometry( | |
options.size.x, | |
options.size.y, | |
options.size.z, | |
1, 1, 1, | |
null, true) | |
const skybox = new THREE.Mesh( | |
geometry, skyMaterial) | |
viewer.impl.scene.add(skybox) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment