(world: WorldData)
| 282 | // ---- environment ----------------------------------------------------------- |
| 283 | |
| 284 | function applyEnvironment(world: WorldData): void { |
| 285 | const env = world.environment; |
| 286 | if (!env) return; |
| 287 | |
| 288 | // Primary directional light (sun). Additional lights can be added by the |
| 289 | // game/editor through `addDirectionalLight` / `addPointLight` directly. |
| 290 | addDirectionalLight( |
| 291 | env.sunDirection[0], env.sunDirection[1], env.sunDirection[2], |
| 292 | env.sunColor[0] * env.sunIntensity, |
| 293 | env.sunColor[1] * env.sunIntensity, |
| 294 | env.sunColor[2] * env.sunIntensity, |
| 295 | env.sunIntensity, |
| 296 | ); |
| 297 | |
| 298 | if (env.shadowsEnabled) { |
| 299 | enableShadows(); |
| 300 | } else { |
| 301 | disableShadows(); |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | // ---- TRS -> column-major 4x4 ----------------------------------------------- |
| 306 |
no test coverage detected