import { observer } from "mobx-react-lite";
import type { Scene } from "../types";
import { CharacterView } from "./CharacterView";
import { ObjectView } from "./ObjectView";

type SceneViewProps = {
    scene: Scene,
    renderCharacter: boolean;
}

export const SceneView = observer(function ({ scene, renderCharacter }: SceneViewProps) {
    return (<>
        <ambientLight intensity={0.5} />
        <directionalLight position={[5, 5, 5]} intensity={1} />
        {Object.values(scene.objects).map((obj) =>
            <ObjectView key={obj.id} object={obj} />)}
        {renderCharacter && <CharacterView character={scene.character} />}
    </>);
});
