Improve light support in theatre/r3f (#316)
Add color to all light types and add ambient and hemisphere lights
This commit is contained in:
parent
6497bf2097
commit
54ed4c3c41
1 changed files with 20 additions and 0 deletions
|
@ -17,6 +17,7 @@ import type {
|
||||||
import {
|
import {
|
||||||
BoxHelper,
|
BoxHelper,
|
||||||
CameraHelper,
|
CameraHelper,
|
||||||
|
Color,
|
||||||
DirectionalLightHelper,
|
DirectionalLightHelper,
|
||||||
PointLightHelper,
|
PointLightHelper,
|
||||||
SpotLightHelper,
|
SpotLightHelper,
|
||||||
|
@ -38,6 +39,7 @@ const baseLightConfig = {
|
||||||
intensity: createNumberPropConfig('intensity', 1),
|
intensity: createNumberPropConfig('intensity', 1),
|
||||||
distance: createNumberPropConfig('distance'),
|
distance: createNumberPropConfig('distance'),
|
||||||
decay: createNumberPropConfig('decay'),
|
decay: createNumberPropConfig('decay'),
|
||||||
|
color: createColorPropConfig('color', new Color('white')),
|
||||||
}),
|
}),
|
||||||
dimensionless: true,
|
dimensionless: true,
|
||||||
}
|
}
|
||||||
|
@ -80,6 +82,7 @@ const defaultEditableFactoryConfig = {
|
||||||
directionalLight: {
|
directionalLight: {
|
||||||
...extendObjectProps(baseObjectConfig, {
|
...extendObjectProps(baseObjectConfig, {
|
||||||
intensity: createNumberPropConfig('intensity', 1),
|
intensity: createNumberPropConfig('intensity', 1),
|
||||||
|
color: createColorPropConfig('color', new Color('white')),
|
||||||
}),
|
}),
|
||||||
icon: 'sun' as const,
|
icon: 'sun' as const,
|
||||||
dimensionless: true,
|
dimensionless: true,
|
||||||
|
@ -92,6 +95,23 @@ const defaultEditableFactoryConfig = {
|
||||||
createHelper: (light: PointLight) =>
|
createHelper: (light: PointLight) =>
|
||||||
new PointLightHelper(light, 1, selectionColor),
|
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, {
|
perspectiveCamera: extendObjectProps(baseCameraConfig, {
|
||||||
fov: createNumberPropConfig('fov', 50, {nudgeMultiplier: 0.1}),
|
fov: createNumberPropConfig('fov', 50, {nudgeMultiplier: 0.1}),
|
||||||
zoom: createNumberPropConfig('zoom', 1),
|
zoom: createNumberPropConfig('zoom', 1),
|
||||||
|
|
Loading…
Reference in a new issue