From 54ed4c3c415c38a68302755fe3c9288c8d20041d Mon Sep 17 00:00:00 2001 From: Andrew Prifer <2991360+AndrewPrifer@users.noreply.github.com> Date: Fri, 14 Oct 2022 15:43:53 +0200 Subject: [PATCH] Improve light support in theatre/r3f (#316) Add color to all light types and add ambient and hemisphere lights --- .../src/main/defaultEditableFactoryConfig.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/r3f/src/main/defaultEditableFactoryConfig.ts b/packages/r3f/src/main/defaultEditableFactoryConfig.ts index a893304..9376c82 100644 --- a/packages/r3f/src/main/defaultEditableFactoryConfig.ts +++ b/packages/r3f/src/main/defaultEditableFactoryConfig.ts @@ -17,6 +17,7 @@ import type { import { BoxHelper, CameraHelper, + Color, DirectionalLightHelper, PointLightHelper, SpotLightHelper, @@ -38,6 +39,7 @@ const baseLightConfig = { intensity: createNumberPropConfig('intensity', 1), distance: createNumberPropConfig('distance'), decay: createNumberPropConfig('decay'), + color: createColorPropConfig('color', new Color('white')), }), dimensionless: true, } @@ -80,6 +82,7 @@ const defaultEditableFactoryConfig = { directionalLight: { ...extendObjectProps(baseObjectConfig, { intensity: createNumberPropConfig('intensity', 1), + color: createColorPropConfig('color', new Color('white')), }), icon: 'sun' as const, dimensionless: true, @@ -92,6 +95,23 @@ const defaultEditableFactoryConfig = { createHelper: (light: PointLight) => new PointLightHelper(light, 1, selectionColor), }, + ambientLight: { + props: { + intensity: createNumberPropConfig('intensity', 1), + color: createColorPropConfig('color', new Color('white')), + }, + useTransformControls: false, + icon: 'lightBulb' as const, + }, + hemisphereLight: { + props: { + intensity: createNumberPropConfig('intensity', 1), + color: createColorPropConfig('color', new Color('white')), + groundColor: createColorPropConfig('groundColor', new Color('white')), + }, + useTransformControls: false, + icon: 'lightBulb' as const, + }, perspectiveCamera: extendObjectProps(baseCameraConfig, { fov: createNumberPropConfig('fov', 50, {nudgeMultiplier: 0.1}), zoom: createNumberPropConfig('zoom', 1),