MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / applyEnvironment

Function applyEnvironment

src/world/loader.ts:284–303  ·  view source on GitHub ↗
(world: WorldData)

Source from the content-addressed store, hash-verified

282// ---- environment -----------------------------------------------------------
283
284function 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

Callers 1

instantiateWorldFunction · 0.85

Calls 3

addDirectionalLightFunction · 0.90
enableShadowsFunction · 0.90
disableShadowsFunction · 0.90

Tested by

no test coverage detected