Created
July 28, 2020 23:52
-
-
Save marshallmurphy/7b84955a8a41cbc749e6fc138c1cd477 to your computer and use it in GitHub Desktop.
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
//... | |
// LIGHTING | |
const light = new THREE.PointLight("white", 1.25); | |
light.position.set(0, 0, 0); | |
scene.add(light); | |
// illuminate the sun | |
createSpotlights(scene); // call the function and pass in our scene | |
// HELPERS | |
// ... | |
function createPlanet(scene, mesh, group, x, scale) { } | |
// generate spotlights on all sides like a cube. | |
function createSpotlights(scene) { | |
var color = 0xFFFFFF; | |
var intensity = 5; | |
var distance = 25; | |
var angle = Math.PI/7; | |
new Array(6).fill('').forEach((item, i) => { | |
var spotlight = new THREE.SpotLight(color, intensity, distance, angle); | |
var value = i % 2 === 0 ? 25 : -25; | |
spotlight.position.set( | |
i < 2 ? value : 0, | |
i >= 2 && i < 4 ? value : 0, | |
i >= 4 ? value : 0 | |
); | |
scene.add( spotlight ); | |
}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment