MCPcopy
hub / github.com/aframevr/aframe / updateLights

Function updateLights

src/components/scene/reflection.js:6–24  ·  view source on GitHub ↗
(estimate, probeLight, directionalLight, directionalLightPosition)

Source from the content-addressed store, hash-verified

4
5// source: view-source:https://storage.googleapis.com/chromium-webxr-test/r886480/proposals/lighting-estimation.html
6function updateLights (estimate, probeLight, directionalLight, directionalLightPosition) {
7 var intensityScalar =
8 Math.max(estimate.primaryLightIntensity.x,
9 Math.max(estimate.primaryLightIntensity.y,
10 estimate.primaryLightIntensity.z));
11
12 probeLight.sh.fromArray(estimate.sphericalHarmonicsCoefficients);
13 probeLight.intensity = 3.14;
14
15 if (directionalLight) {
16 directionalLight.color.setRGB(
17 estimate.primaryLightIntensity.x / intensityScalar,
18 estimate.primaryLightIntensity.y / intensityScalar,
19 estimate.primaryLightIntensity.z / intensityScalar);
20
21 directionalLight.intensity = intensityScalar;
22 directionalLightPosition.copy(estimate.primaryLightDirection);
23 }
24}
25
26export var Component = register('reflection', {
27 schema: {

Callers 1

reflection.jsFile · 0.85

Calls 1

copyMethod · 0.80

Tested by

no test coverage detected