Skip to content

Instantly share code, notes, and snippets.

@kenjiSpecial
Created August 18, 2021 03:54
Show Gist options
  • Save kenjiSpecial/3c3d58b8000739a77126d2696d60e49f to your computer and use it in GitHub Desktop.
Save kenjiSpecial/3c3d58b8000739a77126d2696d60e49f to your computer and use it in GitHub Desktop.
import React from 'react';
import { ILights } from 'src/types/lights';
import { GLTF } from 'three-stdlib';
import { GltfModel } from './gltf-model';
export const GltfScene = (props: { gltf: GLTF | undefined; lights: ILights }) => {
const { gltf, lights } = props;
const gltfElement = gltf ? <GltfModel gltf={gltf} lightOption={lights.additonalLights} /> : <group />;
const baseLightElement = lights.baseLight ? (
<ambientLight intensity={lights.baseLight.intensity} visible={lights.baseLight.visible} />
) : (
<group />
);
return (
<group>
{baseLightElement}
{gltfElement}
</group>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment