reduce point light sources for performance

This commit is contained in:
Stewart Allen 2022-01-23 14:06:27 -05:00
commit 21d2f8ab53
3 changed files with 20 additions and 20 deletions

View file

@ -1879,18 +1879,18 @@
gridMinor = unitMM ? 5 : 25.4 / 10;
if (updateDark) {
if (ctrl.dark) {
SPACE.platform.set({ light: 0.06 });
SPACE.platform.set({ light: 0.08 });
SPACE.platform.setFont({rulerColor:'#888888'});
SPACE.platform.setGrid(gridMajor, gridMinor, 0x666666, 0x333333);
SPACE.platform.opacity(0.05);
SPACE.sky.set({ color: 0, ambient: { intensity: 0.5 } });
SPACE.sky.set({ color: 0, ambient: { intensity: 0.6 } });
DOC.body.classList.add('dark');
} else {
SPACE.platform.set({ light: 0.06 });
SPACE.platform.set({ light: 0.08 });
SPACE.platform.setFont({rulerColor:'#333333'});
SPACE.platform.setGrid(gridMajor, gridMinor, 0x999999, 0xcccccc);
SPACE.platform.opacity(0.2);
SPACE.sky.set({ color: 0xffffff, ambient: { intensity: 1 } });
SPACE.sky.set({ color: 0xffffff, ambient: { intensity: 1.1 } });
DOC.body.classList.remove('dark');
}
SPACE.platform.setSize();

View file

@ -493,10 +493,10 @@ function set_darkmode(dark) {
}
sky.set({
color: dark ? 0 : 0xffffff,
ambient: { intensity: dark ? 0.5 : 1.0 }
ambient: { intensity: dark ? 0.5 : 1.1 }
});
platform.set({
light: dark ? 0.06 : 0.06,
light: dark ? 0.08 : 0.08,
grid: dark ? {
colorMajor: 0x666666,
colorMinor: 0x333333,

View file

@ -256,19 +256,19 @@
lights = [
// top
addLight( x0, y0, z1, lightIntensity * 2.5),
addLight( x0, y1, z1, lightIntensity * 2.0),
// addLight( x0, y1, z1, lightIntensity * 2.0),
addLight( x1, y1, z1, lightIntensity * 2.5),
addLight( x1, y0, z1, lightIntensity * 2.0),
// addLight( x1, y0, z1, lightIntensity * 2.0),
// middle
addLight( x0, y0, z0, lightIntensity * 0.8),
addLight( x0, y1, z0, lightIntensity * 1.2),
addLight( x1, y1, z0, lightIntensity * 0.8),
addLight( x1, y0, z0, lightIntensity * 1.2),
// addLight( x0, y0, z0, lightIntensity * 0.8),
// addLight( x0, y1, z0, lightIntensity * 1.2), // opt
// addLight( x1, y1, z0, lightIntensity * 0.8),
// addLight( x1, y0, z0, lightIntensity * 1.2), // opt
// bottom
addLight( x0, y0, -z1, lightIntensity * 0.5),
addLight( x0, y1, -z1, lightIntensity * 0.2),
addLight( x1, y1, -z1, lightIntensity * 0.5),
addLight( x1, y0, -z1, lightIntensity * 0.2),
// addLight( x0, y0, -z1, lightIntensity * 0.5),
addLight( x0, y1, -z1, lightIntensity * 0.5),
// addLight( x1, y1, -z1, lightIntensity * 0.5),
addLight( x1, y0, -z1, lightIntensity * 0.5),
// center top/bottom
addLight( 0, 0, z2, lightIntensity * 1.2),
addLight( 0, 0, -z2, lightIntensity * 0.8),
@ -278,10 +278,10 @@
function addLight(x,y,z,i) {
let l = new THREE.PointLight(0xffffff, i, 0);
l.position.set(x,z,y);
// let b; l.add(b = new THREE.Mesh(
// new THREE.BoxGeometry(1,1,1),
// new THREE.MeshBasicMaterial( {color: 0xff0000} )
// )); b.scale.set(5,5,5);
let b; l.add(b = new THREE.Mesh(
new THREE.BoxGeometry(1,1,1),
new THREE.MeshBasicMaterial( {color: 0xff0000} )
)); b.scale.set(5,5,5);
SCENE.add(l);
return l;
}