| 4 | |
| 5 | // source: view-source:https://storage.googleapis.com/chromium-webxr-test/r886480/proposals/lighting-estimation.html |
| 6 | function 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 | |
| 26 | export var Component = register('reflection', { |
| 27 | schema: { |