()
| 1199 | } |
| 1200 | |
| 1201 | public update(): void { |
| 1202 | if (!this.moonData) return; |
| 1203 | |
| 1204 | if (this.detectCameraMovement()) { |
| 1205 | this.onCameraMovement(); |
| 1206 | } |
| 1207 | this.updateOrbitalLinesFade(); |
| 1208 | |
| 1209 | const currentTime = Date.now() / 1000; |
| 1210 | |
| 1211 | if (!isFinite(this.cosmicOriginTime)) { |
| 1212 | return; |
| 1213 | } |
| 1214 | |
| 1215 | const cosmicTimeElapsed = currentTime - this.cosmicOriginTime + this.timeOffset; |
| 1216 | |
| 1217 | if (!isFinite(cosmicTimeElapsed)) { |
| 1218 | return; |
| 1219 | } |
| 1220 | |
| 1221 | if (cosmicTimeElapsed < 0) { |
| 1222 | return; |
| 1223 | } |
| 1224 | |
| 1225 | this.moonData.moons.forEach((moonData, index) => { |
| 1226 | if (index < this.moonMeshes.length) { |
| 1227 | this.updateMoonPosition(this.moonMeshes[index], moonData, cosmicTimeElapsed, index); |
| 1228 | |
| 1229 | if (Math.floor(cosmicTimeElapsed) % 30 === 0) { |
| 1230 | this.updateMoonSurfaceRelaxation(this.moonMeshes[index], moonData); |
| 1231 | } |
| 1232 | } |
| 1233 | }); |
| 1234 | |
| 1235 | this.updateLOD(); |
| 1236 | } |
| 1237 | |
| 1238 | private updateMoonPosition(moonGroup: THREE.Group, moonData: MoonData, elapsedTimeSeconds: number, index: number = 0): void { |
| 1239 | if (!isFinite(elapsedTimeSeconds)) { |
no test coverage detected