react-native-filament
Version:
A real-time physically based 3D rendering engine for React Native
44 lines (43 loc) • 1.02 kB
JavaScript
;
import React from 'react';
import { useBuffer } from '../hooks/useBuffer';
import { useSkybox } from '../hooks/useSkybox';
import { jsx as _jsx } from "react/jsx-runtime";
export function Skybox(props) {
if ('colorInHex' in props) {
return /*#__PURE__*/_jsx(SkyboxByColor, {
...props
});
}
return /*#__PURE__*/_jsx(SkyboxBySource, {
...props
});
}
function SkyboxByColor(props) {
useSkybox({
showSun: props.showSun,
envIntensity: props.envIntensity,
color: props.colorInHex
});
return null;
}
function SkyboxBySource(props) {
const textureBuffer = useBuffer({
source: props.source,
releaseOnUnmount: false
});
if (textureBuffer == null) return null;
return /*#__PURE__*/_jsx(SkyboxByLoadedBuffer, {
...props,
buffer: textureBuffer
});
}
function SkyboxByLoadedBuffer(props) {
useSkybox({
showSun: props.showSun,
envIntensity: props.envIntensity,
texture: props.buffer
});
return null;
}
//# sourceMappingURL=Skybox.js.map