//...
// 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 );
});
}
view raw block16.js hosted with ❤ by GitHub