/** * Creates a LOD instance. * * @constructor * @augments THREE.LOD * * @param {string} id - The id of the LOD instance. * @param {number} mode - The transition mode. * @param {Camera} camera - The camera object. * @param {number} threshold - The threshold where the blending is done. */ function LOD( id, mode, camera, threshold ) { THREE.LOD.call( this ); Object.defineProperties( this, { idLOD : { value : id, configurable : false, enumerable : true, writable : false }, mode : { value : mode || LOD.MODE.DIRECT, configurable : false, enumerable : true, writable : true }, camera : { value : camera, configurable : false, enumerable : true, writable : true }, threshold : { value : threshold || 0, configurable : false, enumerable : true, writable : true } } ); }
this.allSystems.forEach( system => { // Build a LOD mesh for the stars to make them properly rounded // when viewed up close yet low on geometry at a distance const starLOD = new THREE.LOD(); for ( let i = 0; i < STAR_LOD_MESHES.length; i++ ) { const star = new THREE.Mesh( STAR_LOD_MESHES[ i ][ 0 ], material ); star.scale.set( system.scale * config.renderScale, system.scale * config.renderScale, system.scale * config.renderScale ); star.updateMatrix(); star.matrixAutoUpdate = false; starLOD.addLevel( star, STAR_LOD_MESHES[ i ][ 1 ] ); } starLOD.position.copy( system.position ); starLOD.updateMatrix(); starLOD.matrixAutoUpdate = false; starLOD.userData.isSystem = true; starLOD.userData.isLOD = true; group.add( starLOD ); });