UNPKG

react-native-filament

Version:

A real-time physically based 3D rendering engine for React Native

29 lines (28 loc) 826 B
import { useBuffer } from '../hooks/useBuffer'; import { useFilamentContext } from '../hooks/useFilamentContext'; import { useWorkletEffect } from '../hooks/useWorkletEffect'; /** * Sets the light of the scene. An environmental light uses an image file to simulate indirect light. * @note You can only have one environmental light in the scene. */ export function EnvironmentalLight({ source, intensity = 25_000, irradianceBands }) { const { engine } = useFilamentContext(); const lightBuffer = useBuffer({ source: source, releaseOnUnmount: false }); useWorkletEffect(() => { 'worklet'; if (lightBuffer == null) return; engine.setIndirectLight(lightBuffer, intensity, irradianceBands); lightBuffer.release(); }); return null; } //# sourceMappingURL=EnvironmentalLight.js.map