@3driseai/3drise-viewer 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/LightObject.d.ts.map +1 -1
- package/dist/components/LightObject.js +8 -0
- package/dist/components/ModelPrimitive.d.ts.map +1 -1
- package/dist/components/ModelPrimitive.js +11 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/lightBulb/LightBulb.d.ts +16 -0
- package/dist/components/lightBulb/LightBulb.d.ts.map +1 -0
- package/dist/components/lightBulb/LightBulb.js +144 -0
- package/dist/components/lightBulb/bulbMaterials.d.ts +27 -0
- package/dist/components/lightBulb/bulbMaterials.d.ts.map +1 -0
- package/dist/components/lightBulb/bulbMaterials.js +133 -0
- package/dist/components/lightBulb/bulbShapes.d.ts +15 -0
- package/dist/components/lightBulb/bulbShapes.d.ts.map +1 -0
- package/dist/components/lightBulb/bulbShapes.js +180 -0
- package/dist/components/lightBulb/index.d.ts +5 -0
- package/dist/components/lightBulb/index.d.ts.map +1 -0
- package/dist/components/lightBulb/index.js +3 -0
- package/dist/components/lightBulb/kelvin.d.ts +7 -0
- package/dist/components/lightBulb/kelvin.d.ts.map +1 -0
- package/dist/components/lightBulb/kelvin.js +21 -0
- package/dist/components/lightBulb/types.d.ts +2 -0
- package/dist/components/lightBulb/types.d.ts.map +1 -0
- package/dist/components/lightBulb/types.js +1 -0
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -1
- package/dist/hooks/useConfigLive.d.ts +2 -2
- package/dist/hooks/useConfigLive.d.ts.map +1 -1
- package/dist/hooks/useConfigLive.js +1 -1
- package/dist/hooks/useLightLive.d.ts +12 -0
- package/dist/hooks/useLightLive.d.ts.map +1 -0
- package/dist/hooks/useLightLive.js +46 -0
- package/dist/hooks/useShadowApplication.d.ts +8 -0
- package/dist/hooks/useShadowApplication.d.ts.map +1 -1
- package/dist/hooks/useShadowApplication.js +17 -8
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightObject.d.ts","sourceRoot":"","sources":["../../src/components/LightObject.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"LightObject.d.ts","sourceRoot":"","sources":["../../src/components/LightObject.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAO7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAGnE,KAAK,gBAAgB,GAAG,gBAAgB,GAAG;IACvC,aAAa,EAAE,qBAAqB,CAAC;CACxC,CAAC;AAkDF,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAmB3C,CAAC;AACF,eAAe,WAAW,CAAC"}
|
|
@@ -5,12 +5,15 @@ import { useThree } from '@react-three/fiber';
|
|
|
5
5
|
import { useLightShadow } from '../hooks/useLightShadow.js';
|
|
6
6
|
import { useLightAnimation } from '../hooks/useLightAnimation.js';
|
|
7
7
|
import { useLightMouseMove } from '../hooks/useLightMouseMove.js';
|
|
8
|
+
import { useLightLive } from '../hooks/useLightLive.js';
|
|
9
|
+
import LightBulb from './lightBulb/LightBulb.js';
|
|
8
10
|
const DirectionalLightR3F = ({ config, animations, mouseMove, settings, onObjectReady, onObjectDispose }) => {
|
|
9
11
|
const lightRef = useRef(null);
|
|
10
12
|
useObjectReady(lightRef, settings, onObjectReady, onObjectDispose);
|
|
11
13
|
useLightShadow(lightRef, config.shadow);
|
|
12
14
|
useLightAnimation(lightRef, animations);
|
|
13
15
|
useLightMouseMove(lightRef, mouseMove, { lightConfig: config });
|
|
16
|
+
useLightLive(lightRef, lightRef, settings?.id, config);
|
|
14
17
|
return (_jsx("directionalLight", { ref: lightRef, color: config.color || '#ffffff', intensity: config.intensity ?? 1 }));
|
|
15
18
|
};
|
|
16
19
|
const SpotLightR3F = ({ config, animations, mouseMove, settings, onObjectReady, onObjectDispose }) => {
|
|
@@ -39,6 +42,7 @@ const SpotLightR3F = ({ config, animations, mouseMove, settings, onObjectReady,
|
|
|
39
42
|
useLightShadow(lightRef, config.shadow);
|
|
40
43
|
useLightAnimation(lightRef, animations);
|
|
41
44
|
useLightMouseMove(lightRef, mouseMove, { lightConfig: config });
|
|
45
|
+
useLightLive(lightRef, lightRef, settings?.id, config);
|
|
42
46
|
return (_jsx("spotLight", { ref: lightRef, color: config.color || '#ffffff', intensity: config.intensity ?? 1, angle: config.angle ?? Math.PI / 4, penumbra: config.penumbra ?? 0.1, decay: config.decay ?? 1, distance: config.distance ?? 0 }));
|
|
43
47
|
};
|
|
44
48
|
const PointLightR3F = ({ config, animations, mouseMove, settings, onObjectReady, onObjectDispose }) => {
|
|
@@ -47,6 +51,7 @@ const PointLightR3F = ({ config, animations, mouseMove, settings, onObjectReady,
|
|
|
47
51
|
useLightShadow(lightRef, config.shadow);
|
|
48
52
|
useLightAnimation(lightRef, animations);
|
|
49
53
|
useLightMouseMove(lightRef, mouseMove, { lightConfig: config });
|
|
54
|
+
useLightLive(lightRef, lightRef, settings?.id, config);
|
|
50
55
|
return (_jsx("pointLight", { ref: lightRef, color: config.color || '#ffffff', intensity: config.intensity ?? 1, decay: config.decay ?? 1, distance: config.distance ?? 0 }));
|
|
51
56
|
};
|
|
52
57
|
const LightObject = ({ createdObject, onObjectReady, onObjectDispose }) => {
|
|
@@ -62,6 +67,9 @@ const LightObject = ({ createdObject, onObjectReady, onObjectDispose }) => {
|
|
|
62
67
|
return _jsx(SpotLightR3F, { config: config, animations: animations, mouseMove: mouseMove, settings: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
|
|
63
68
|
case 'point':
|
|
64
69
|
return _jsx(PointLightR3F, { config: config, animations: animations, mouseMove: mouseMove, settings: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
|
|
70
|
+
// A visible bulb: point light + glass/filament/base + self-drawn glow.
|
|
71
|
+
case 'lightBulb':
|
|
72
|
+
return _jsx(LightBulb, { id: createdObject.id, config: config, animations: animations, mouseMove: mouseMove, settings: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
|
|
65
73
|
default:
|
|
66
74
|
return null;
|
|
67
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelPrimitive.d.ts","sourceRoot":"","sources":["../../src/components/ModelPrimitive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ModelPrimitive.d.ts","sourceRoot":"","sources":["../../src/components/ModelPrimitive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAMnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,UAAU,mBAAoB,SAAQ,gBAAgB;IAClD,aAAa,EAAE,qBAAqB,CAAC;IACrC,kFAAkF;IAClF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA4ChD,CAAC;AAIH,eAAe,cAAc,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { useModelObject } from '../hooks/useModelObject.js';
|
|
|
4
4
|
import { useNodeOverrides } from '../hooks/useNodeOverrides.js';
|
|
5
5
|
import { getNodeOverrides, peekModelAsset } from '@3driseai/3drise-core';
|
|
6
6
|
import { useObjectReadyReporter } from '../hooks/useObjectReady.js';
|
|
7
|
+
import { applyShadowFlags } from '../hooks/useShadowApplication.js';
|
|
7
8
|
/**
|
|
8
9
|
* Mounts the Object3D behind a `type: 'model'` scene object, and hands it to the host
|
|
9
10
|
* application.
|
|
@@ -39,8 +40,18 @@ const ModelPrimitive = memo(({ createdObject, slot = 0, onObjectReady, onObjectD
|
|
|
39
40
|
const master = useMemo(() => (url ? peekModelAsset(url)?.scene ?? null : null), [url, object]);
|
|
40
41
|
useNodeOverrides(object, getNodeOverrides(createdObject), master);
|
|
41
42
|
const { report, reportDisposed } = useObjectReadyReporter(createdObject, onObjectReady, onObjectDispose);
|
|
43
|
+
// CreatedObject applies meshSettings' shadow flags on its own mount and on every
|
|
44
|
+
// change. A model that suspended attaches after that mount, so it gets them here.
|
|
45
|
+
// Read through a ref: a changing callback ref would detach/attach the object and
|
|
46
|
+
// fire a spurious onObjectDispose / onObjectReady pair on every shadow toggle.
|
|
47
|
+
const shadowFlags = useRef({});
|
|
48
|
+
shadowFlags.current = {
|
|
49
|
+
cast: createdObject.meshSettings?.castShadow,
|
|
50
|
+
receive: createdObject.meshSettings?.receiveShadow,
|
|
51
|
+
};
|
|
42
52
|
const setObjectRef = useCallback((instance) => {
|
|
43
53
|
if (instance) {
|
|
54
|
+
applyShadowFlags(instance, shadowFlags.current.cast, shadowFlags.current.receive);
|
|
44
55
|
attachedRef.current = instance;
|
|
45
56
|
report(instance);
|
|
46
57
|
return;
|
|
@@ -158,6 +158,7 @@ export * from './terrain';
|
|
|
158
158
|
export * from './water';
|
|
159
159
|
export * from './effects';
|
|
160
160
|
export * from './particles';
|
|
161
|
+
export * from './lightBulb';
|
|
161
162
|
export type { LandscapeBuilderProps } from './LandscapeBuilder';
|
|
162
163
|
export { default as LandscapeBuilder } from './LandscapeBuilder';
|
|
163
164
|
export type { LandscapeObjectProps } from './LandscapeObject';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,YAAY,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC7F,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC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EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAO9C,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,EACZ,MAAM,EACN,cAAc,EACd,gBAAgB,EAChB,gBAAgB,IAAI,gBAAgB,EACpC,UAAU,EACV,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGtD,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAI5B,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,cAAc,aAAa,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -102,6 +102,7 @@ export * from './terrain/index.js';
|
|
|
102
102
|
export * from './water/index.js';
|
|
103
103
|
export * from './effects/index.js';
|
|
104
104
|
export * from './particles/index.js';
|
|
105
|
+
export * from './lightBulb/index.js';
|
|
105
106
|
export { default as LandscapeBuilder } from './LandscapeBuilder.js';
|
|
106
107
|
export { default as LandscapeObject } from './LandscapeObject.js';
|
|
107
108
|
export * from './landscape/index.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AnimationOptions, CreatedObjectSettings, MouseMoveDomain } from '@3driseai/3drise-core';
|
|
3
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
+
import type { LightBulbConfig } from '@3driseai/3drise-core';
|
|
5
|
+
export type LightBulbProps = ObjectReadyProps & {
|
|
6
|
+
/** Scene object id: the light controller finds the live-edit handle by it. */
|
|
7
|
+
id?: string;
|
|
8
|
+
config: LightBulbConfig;
|
|
9
|
+
animations?: AnimationOptions[];
|
|
10
|
+
mouseMove?: MouseMoveDomain;
|
|
11
|
+
/** Reported as the first argument of onObjectReady / onObjectDispose. */
|
|
12
|
+
settings: CreatedObjectSettings | Record<string, any>;
|
|
13
|
+
};
|
|
14
|
+
declare const LightBulb: React.FC<LightBulbProps>;
|
|
15
|
+
export default LightBulb;
|
|
16
|
+
//# sourceMappingURL=LightBulb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LightBulb.d.ts","sourceRoot":"","sources":["../../../src/components/lightBulb/LightBulb.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAK1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAMtG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG;IAC5C,8EAA8E;IAC9E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,yEAAyE;IACzE,QAAQ,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzD,CAAC;AAsBF,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAsHvC,CAAC;AACF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// LightBulb — a point light you can see: glass, filament, base and glow
|
|
4
|
+
// =============================================================================
|
|
5
|
+
//
|
|
6
|
+
// Rendered by LightObject for `config.type === 'lightBulb'`. The object origin
|
|
7
|
+
// is the filament centre, which is where the point light sits; the bulb stands
|
|
8
|
+
// upright (base down, -Y) — rotate the object 180° for a pendant.
|
|
9
|
+
//
|
|
10
|
+
// Intensity ownership: useLightAnimation / useLightMouseMove (and R3F's
|
|
11
|
+
// `intensity` prop) write `light.intensity` as usual. This component then
|
|
12
|
+
// multiplies in the power level (on/off, warm-up, flicker) each frame. Any
|
|
13
|
+
// intensity it did not write itself is adopted as the new base, so the
|
|
14
|
+
// multiplier never compounds and external writers stay in charge of the base.
|
|
15
|
+
// The glow reads the light's real output every frame, so an animated or
|
|
16
|
+
// pointer-driven intensity/colour dims and tints the bulb with it.
|
|
17
|
+
//
|
|
18
|
+
// Materials are self-owned: the root carries SELF_OWNED_MATERIAL_KEY so the
|
|
19
|
+
// CreatedObject wrapper's material/shadow application skips the bulb. Only the
|
|
20
|
+
// screw base casts a shadow — the glass and filament surround the light and
|
|
21
|
+
// would otherwise black it out.
|
|
22
|
+
//
|
|
23
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
24
|
+
import { useFrame } from '@react-three/fiber';
|
|
25
|
+
import { Color } from 'three';
|
|
26
|
+
import { SELF_OWNED_MATERIAL_KEY } from '@3driseai/3drise-core';
|
|
27
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
28
|
+
import { useLightShadow } from '../../hooks/useLightShadow.js';
|
|
29
|
+
import { useLightAnimation } from '../../hooks/useLightAnimation.js';
|
|
30
|
+
import { useLightMouseMove } from '../../hooks/useLightMouseMove.js';
|
|
31
|
+
import { useLightLive } from '../../hooks/useLightLive.js';
|
|
32
|
+
import { buildBulbShape, disposeBulbShape } from './bulbShapes.js';
|
|
33
|
+
import { applyGlass, createBulbMaterials, disposeBulbMaterials, GLASS_RESPONSE } from './bulbMaterials.js';
|
|
34
|
+
import { kelvinToColor } from './kelvin.js';
|
|
35
|
+
const num = (v, fallback) => (typeof v === 'number' ? v : fallback);
|
|
36
|
+
// Smooth 1D value noise for flicker.
|
|
37
|
+
const hash = (n) => {
|
|
38
|
+
const s = Math.sin(n * 127.1) * 43758.5453;
|
|
39
|
+
return s - Math.floor(s);
|
|
40
|
+
};
|
|
41
|
+
const noise = (x) => {
|
|
42
|
+
const i = Math.floor(x), f = x - i, u = f * f * (3 - 2 * f);
|
|
43
|
+
return hash(i) * (1 - u) + hash(i + 1) * u;
|
|
44
|
+
};
|
|
45
|
+
// Tungsten heating ramp: unlit grey → dull red → orange → the light's own colour.
|
|
46
|
+
const UNLIT = new Color(0.12, 0.12, 0.12);
|
|
47
|
+
const DULL_RED = new Color(0.55, 0.05, 0.0);
|
|
48
|
+
const ORANGE = new Color(1.0, 0.38, 0.06);
|
|
49
|
+
const WHITE = new Color(1, 1, 1);
|
|
50
|
+
const HALO_SEGMENTS = [2, 2];
|
|
51
|
+
const LightBulb = ({ id, config, animations, mouseMove, settings, onObjectReady, onObjectDispose }) => {
|
|
52
|
+
const groupRef = useRef(null);
|
|
53
|
+
const lightRef = useRef(null);
|
|
54
|
+
useObjectReady(groupRef, settings, onObjectReady, onObjectDispose);
|
|
55
|
+
useLightShadow(lightRef, config.shadow);
|
|
56
|
+
useLightAnimation(lightRef, animations);
|
|
57
|
+
useLightMouseMove(lightRef, mouseMove, { lightConfig: config });
|
|
58
|
+
// Slider drags: light props land on the light; flicker / halo / warmup are read per frame below.
|
|
59
|
+
const live = useLightLive(groupRef, lightRef, id, config);
|
|
60
|
+
const glass = config.glass ?? 'clear';
|
|
61
|
+
const glassTint = config.glassTint ?? '#ffb070';
|
|
62
|
+
const on = config.on ?? true;
|
|
63
|
+
const baseIntensity = config.intensity ?? 1;
|
|
64
|
+
const shape = useMemo(() => buildBulbShape(config.shape), [config.shape]);
|
|
65
|
+
useEffect(() => () => disposeBulbShape(shape), [shape]);
|
|
66
|
+
const mats = useMemo(() => createBulbMaterials(), []);
|
|
67
|
+
useEffect(() => () => disposeBulbMaterials(mats), [mats]);
|
|
68
|
+
useEffect(() => applyGlass(mats, glass, glassTint), [mats, glass, glassTint]);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
mats.halo.uniforms.uRadius.value = shape.haloRadius;
|
|
71
|
+
}, [mats, shape]);
|
|
72
|
+
const lightColor = useMemo(() => (config.colorMode ?? 'temperature') === 'color'
|
|
73
|
+
? new Color(config.color || '#ffffff')
|
|
74
|
+
: kelvinToColor(config.temperature ?? 2700), [config.colorMode, config.color, config.temperature]);
|
|
75
|
+
const tint = useMemo(() => new Color(glass === 'tinted' ? glassTint : '#ffffff'), [glass, glassTint]);
|
|
76
|
+
// The screw base sits close to the light; three's default shadow near (0.5)
|
|
77
|
+
// would clip it out of the shadow map.
|
|
78
|
+
const shadowNear = config.shadow?.cameraNear;
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
const light = lightRef.current;
|
|
81
|
+
if (!light || shadowNear !== undefined)
|
|
82
|
+
return;
|
|
83
|
+
light.shadow.camera.near = 0.05;
|
|
84
|
+
light.shadow.camera.updateProjectionMatrix();
|
|
85
|
+
}, [shadowNear]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
const group = groupRef.current;
|
|
88
|
+
if (!group)
|
|
89
|
+
return;
|
|
90
|
+
group.userData[SELF_OWNED_MATERIAL_KEY] = true;
|
|
91
|
+
return () => {
|
|
92
|
+
delete group.userData[SELF_OWNED_MATERIAL_KEY];
|
|
93
|
+
};
|
|
94
|
+
}, []);
|
|
95
|
+
const power = useRef({ level: on ? 1 : 0, base: baseIntensity, written: Number.NaN, seed: Math.random() * 1000 });
|
|
96
|
+
const scratch = useMemo(() => ({ heat: new Color(), glow: new Color() }), []);
|
|
97
|
+
useFrame(({ clock }, delta) => {
|
|
98
|
+
const light = lightRef.current;
|
|
99
|
+
if (!light)
|
|
100
|
+
return;
|
|
101
|
+
const p = power.current;
|
|
102
|
+
const lv = live.current;
|
|
103
|
+
const warmup = Math.max(num(lv.warmup, config.warmup ?? 0.25), 0);
|
|
104
|
+
const flicker = Math.min(Math.max(num(lv.flicker, config.flicker ?? 0), 0), 1);
|
|
105
|
+
const haloAmount = Math.min(Math.max(num(lv.halo, config.halo ?? 1), 0), 2);
|
|
106
|
+
if (light.intensity !== p.written)
|
|
107
|
+
p.base = light.intensity;
|
|
108
|
+
const target = on ? 1 : 0;
|
|
109
|
+
const tau = target > p.level ? warmup : warmup * 2.5;
|
|
110
|
+
p.level = tau <= 0 ? target : p.level + (target - p.level) * (1 - Math.exp(-Math.min(delta, 0.1) * 3 / tau));
|
|
111
|
+
if (Math.abs(target - p.level) < 1e-4)
|
|
112
|
+
p.level = target;
|
|
113
|
+
let flick = 1;
|
|
114
|
+
if (flicker > 0) {
|
|
115
|
+
const t = clock.elapsedTime + p.seed;
|
|
116
|
+
flick = 1 - flicker * (0.15 * noise(t * 13) + 0.6 * Math.pow(noise(t * 3.1), 4));
|
|
117
|
+
}
|
|
118
|
+
const output = Math.pow(p.level, 2.2) * flick;
|
|
119
|
+
light.intensity = p.base * output;
|
|
120
|
+
p.written = light.intensity;
|
|
121
|
+
// Glow follows the light's real output relative to the configured intensity.
|
|
122
|
+
const glowK = Math.min(output * (p.base / Math.max(baseIntensity, 1e-4)), 2);
|
|
123
|
+
const response = GLASS_RESPONSE[glass];
|
|
124
|
+
// Filament: grey when cold, heats through red/orange to near-white of the light colour.
|
|
125
|
+
const k = p.level * flick;
|
|
126
|
+
const heat = scratch.heat;
|
|
127
|
+
if (k < 0.35)
|
|
128
|
+
heat.copy(UNLIT).lerp(DULL_RED, k / 0.35);
|
|
129
|
+
else if (k < 0.7)
|
|
130
|
+
heat.copy(DULL_RED).lerp(ORANGE, (k - 0.35) / 0.35);
|
|
131
|
+
else
|
|
132
|
+
heat.copy(ORANGE).lerp(scratch.glow.copy(light.color).lerp(WHITE, 0.55), (k - 0.7) / 0.3);
|
|
133
|
+
mats.filament.color.copy(heat).multiplyScalar(k < 0.05 ? 1 : 1 + glowK * 2);
|
|
134
|
+
const glow = scratch.glow.copy(light.color).multiply(tint);
|
|
135
|
+
mats.glass.emissive.copy(glow).multiplyScalar(response.emissive * glowK);
|
|
136
|
+
mats.innerGlow.uniforms.uColor.value.copy(glow);
|
|
137
|
+
mats.innerGlow.uniforms.uStrength.value = response.inner * glowK;
|
|
138
|
+
mats.halo.uniforms.uColor.value.copy(glow);
|
|
139
|
+
mats.halo.uniforms.uStrength.value = response.halo * haloAmount * glowK;
|
|
140
|
+
});
|
|
141
|
+
const dy = -shape.filamentCenterY;
|
|
142
|
+
return (_jsxs("group", { ref: groupRef, children: [_jsx("pointLight", { ref: lightRef, color: lightColor, intensity: baseIntensity, decay: config.decay ?? 1, distance: config.distance ?? 0 }), _jsxs("group", { position: [0, dy, 0], children: [_jsx("mesh", { geometry: shape.filament, material: mats.filament }), shape.supports.map((g, i) => (_jsx("mesh", { geometry: g, material: i === 0 ? mats.stem : mats.wire, renderOrder: i === 0 ? 1 : 0 }, i))), _jsx("mesh", { geometry: shape.base, material: mats.metal, castShadow: true }), _jsx("mesh", { geometry: shape.glass, material: mats.glass, renderOrder: 2 }), _jsx("mesh", { geometry: shape.glass, material: mats.innerGlow, scale: 0.97, renderOrder: 3 })] }), _jsx("mesh", { material: mats.halo, renderOrder: 4, frustumCulled: false, children: _jsx("planeGeometry", { args: HALO_SEGMENTS }) })] }));
|
|
143
|
+
};
|
|
144
|
+
export default LightBulb;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MeshBasicMaterial, MeshPhysicalMaterial, MeshStandardMaterial, ShaderMaterial } from 'three';
|
|
2
|
+
import type { LightBulbGlass } from './types';
|
|
3
|
+
export interface BulbMaterials {
|
|
4
|
+
glass: MeshPhysicalMaterial;
|
|
5
|
+
filament: MeshBasicMaterial;
|
|
6
|
+
metal: MeshStandardMaterial;
|
|
7
|
+
wire: MeshStandardMaterial;
|
|
8
|
+
stem: MeshPhysicalMaterial;
|
|
9
|
+
innerGlow: ShaderMaterial;
|
|
10
|
+
halo: ShaderMaterial;
|
|
11
|
+
}
|
|
12
|
+
/** Per-glass tuning of how much of the light the glass itself shows. */
|
|
13
|
+
export interface GlassResponse {
|
|
14
|
+
/** Emissive strength of the glass surface itself. */
|
|
15
|
+
emissive: number;
|
|
16
|
+
/** innerGlow strength + falloff power (low power = even, frosted-looking fill). */
|
|
17
|
+
inner: number;
|
|
18
|
+
innerPower: number;
|
|
19
|
+
/** Halo multiplier. */
|
|
20
|
+
halo: number;
|
|
21
|
+
}
|
|
22
|
+
export declare const GLASS_RESPONSE: Record<LightBulbGlass, GlassResponse>;
|
|
23
|
+
export declare function createBulbMaterials(): BulbMaterials;
|
|
24
|
+
/** Configure the glass surface for a finish. Emissive is driven per frame. */
|
|
25
|
+
export declare function applyGlass(m: BulbMaterials, glass: LightBulbGlass, tint: string): void;
|
|
26
|
+
export declare function disposeBulbMaterials(m: BulbMaterials): void;
|
|
27
|
+
//# sourceMappingURL=bulbMaterials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulbMaterials.d.ts","sourceRoot":"","sources":["../../../src/components/lightBulb/bulbMaterials.ts"],"names":[],"mappings":"AAaA,OAAO,EAAsC,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC1I,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,oBAAoB,CAAC;IAC5B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,EAAE,oBAAoB,CAAC;IAC5B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,SAAS,EAAE,cAAc,CAAC;IAC1B,IAAI,EAAE,cAAc,CAAC;CACxB;AAED,wEAAwE;AACxE,MAAM,WAAW,aAAa;IAC1B,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,mFAAmF;IACnF,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE,aAAa,CAIhE,CAAC;AA8EF,wBAAgB,mBAAmB,IAAI,aAAa,CAanD;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAsBtF;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI,CAE3D"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// bulbMaterials — glass, filament, metal and the two self-drawn glow layers
|
|
3
|
+
// =============================================================================
|
|
4
|
+
//
|
|
5
|
+
// The viewer renders with NoToneMapping and no postprocessing, so there is no
|
|
6
|
+
// bloom to lean on. The bulb draws its own glow instead:
|
|
7
|
+
// - innerGlow: a view-facing fresnel shell just inside the glass — light
|
|
8
|
+
// scattering in the glass, strongest where you look straight through it.
|
|
9
|
+
// - halo: a camera-facing quad with a soft radial falloff, sized in object
|
|
10
|
+
// space so it scales with the bulb.
|
|
11
|
+
// Both are additive and depthWrite-off; their strength is set per frame from
|
|
12
|
+
// the light's actual intensity, so animations / mouseMove dim the glow too.
|
|
13
|
+
//
|
|
14
|
+
import { AdditiveBlending, Color, FrontSide, MeshBasicMaterial, MeshPhysicalMaterial, MeshStandardMaterial, ShaderMaterial } from 'three';
|
|
15
|
+
export const GLASS_RESPONSE = {
|
|
16
|
+
clear: { emissive: 0.02, inner: 0.14, innerPower: 4.0, halo: 0.7 },
|
|
17
|
+
frosted: { emissive: 0.9, inner: 0.55, innerPower: 0.8, halo: 1.15 },
|
|
18
|
+
tinted: { emissive: 0.3, inner: 0.5, innerPower: 1.6, halo: 0.9 },
|
|
19
|
+
};
|
|
20
|
+
const OUTPUT = /* glsl */ `
|
|
21
|
+
#include <tonemapping_fragment>
|
|
22
|
+
#include <colorspace_fragment>
|
|
23
|
+
`;
|
|
24
|
+
function innerGlowMaterial() {
|
|
25
|
+
return new ShaderMaterial({
|
|
26
|
+
uniforms: {
|
|
27
|
+
uColor: { value: new Color(1, 0.7, 0.4) },
|
|
28
|
+
uStrength: { value: 0 },
|
|
29
|
+
uPower: { value: 3 },
|
|
30
|
+
},
|
|
31
|
+
vertexShader: /* glsl */ `
|
|
32
|
+
varying vec3 vNormal;
|
|
33
|
+
varying vec3 vView;
|
|
34
|
+
void main() {
|
|
35
|
+
vec4 mv = modelViewMatrix * vec4(position, 1.0);
|
|
36
|
+
vNormal = normalize(normalMatrix * normal);
|
|
37
|
+
vView = normalize(-mv.xyz);
|
|
38
|
+
gl_Position = projectionMatrix * mv;
|
|
39
|
+
}`,
|
|
40
|
+
fragmentShader: /* glsl */ `
|
|
41
|
+
uniform vec3 uColor;
|
|
42
|
+
uniform float uStrength;
|
|
43
|
+
uniform float uPower;
|
|
44
|
+
varying vec3 vNormal;
|
|
45
|
+
varying vec3 vView;
|
|
46
|
+
void main() {
|
|
47
|
+
float facing = clamp(dot(normalize(vNormal), normalize(vView)), 0.0, 1.0);
|
|
48
|
+
gl_FragColor = vec4(uColor * uStrength * pow(facing, uPower), 1.0);
|
|
49
|
+
${OUTPUT}
|
|
50
|
+
}`,
|
|
51
|
+
transparent: true,
|
|
52
|
+
depthWrite: false,
|
|
53
|
+
blending: AdditiveBlending,
|
|
54
|
+
side: FrontSide,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function haloMaterial() {
|
|
58
|
+
return new ShaderMaterial({
|
|
59
|
+
uniforms: {
|
|
60
|
+
uColor: { value: new Color(1, 0.7, 0.4) },
|
|
61
|
+
uStrength: { value: 0 },
|
|
62
|
+
uRadius: { value: 1 },
|
|
63
|
+
},
|
|
64
|
+
vertexShader: /* glsl */ `
|
|
65
|
+
uniform float uRadius;
|
|
66
|
+
varying vec2 vUv;
|
|
67
|
+
void main() {
|
|
68
|
+
// Billboard: expand the quad in view space around the object origin,
|
|
69
|
+
// sized by the object's world scale so the halo tracks the bulb.
|
|
70
|
+
vec4 mv = modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);
|
|
71
|
+
float s = length(modelMatrix[0].xyz) * uRadius;
|
|
72
|
+
mv.xy += position.xy * s;
|
|
73
|
+
vUv = position.xy;
|
|
74
|
+
gl_Position = projectionMatrix * mv;
|
|
75
|
+
}`,
|
|
76
|
+
fragmentShader: /* glsl */ `
|
|
77
|
+
uniform vec3 uColor;
|
|
78
|
+
uniform float uStrength;
|
|
79
|
+
varying vec2 vUv;
|
|
80
|
+
void main() {
|
|
81
|
+
float d = length(vUv);
|
|
82
|
+
float core = exp(-d * 9.0);
|
|
83
|
+
float wide = exp(-d * d * 5.0) * 0.35;
|
|
84
|
+
float a = (core + wide) * (1.0 - smoothstep(0.7, 1.0, d));
|
|
85
|
+
gl_FragColor = vec4(uColor * uStrength * a, 1.0);
|
|
86
|
+
${OUTPUT}
|
|
87
|
+
}`,
|
|
88
|
+
transparent: true,
|
|
89
|
+
depthWrite: false,
|
|
90
|
+
blending: AdditiveBlending,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export function createBulbMaterials() {
|
|
94
|
+
return {
|
|
95
|
+
glass: new MeshPhysicalMaterial({
|
|
96
|
+
color: '#ffffff', roughness: 0.05, metalness: 0, transparent: true, opacity: 0.18,
|
|
97
|
+
clearcoat: 1, clearcoatRoughness: 0.05, depthWrite: false, emissive: '#000000',
|
|
98
|
+
}),
|
|
99
|
+
filament: new MeshBasicMaterial({ color: '#202020', toneMapped: false }),
|
|
100
|
+
metal: new MeshStandardMaterial({ color: '#b9ae98', metalness: 1, roughness: 0.3 }),
|
|
101
|
+
wire: new MeshStandardMaterial({ color: '#9a9a9a', metalness: 1, roughness: 0.35 }),
|
|
102
|
+
stem: new MeshPhysicalMaterial({ color: '#ffffff', roughness: 0.1, transparent: true, opacity: 0.25, depthWrite: false }),
|
|
103
|
+
innerGlow: innerGlowMaterial(),
|
|
104
|
+
halo: haloMaterial(),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** Configure the glass surface for a finish. Emissive is driven per frame. */
|
|
108
|
+
export function applyGlass(m, glass, tint) {
|
|
109
|
+
const g = m.glass;
|
|
110
|
+
if (glass === 'frosted') {
|
|
111
|
+
g.color.set('#f4f1ec');
|
|
112
|
+
g.roughness = 0.9;
|
|
113
|
+
g.opacity = 0.88;
|
|
114
|
+
g.clearcoat = 0;
|
|
115
|
+
}
|
|
116
|
+
else if (glass === 'tinted') {
|
|
117
|
+
g.color.set(tint);
|
|
118
|
+
g.roughness = 0.08;
|
|
119
|
+
g.opacity = 0.42;
|
|
120
|
+
g.clearcoat = 1;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
g.color.set('#ffffff');
|
|
124
|
+
g.roughness = 0.05;
|
|
125
|
+
g.opacity = 0.18;
|
|
126
|
+
g.clearcoat = 1;
|
|
127
|
+
}
|
|
128
|
+
m.innerGlow.uniforms.uPower.value = GLASS_RESPONSE[glass].innerPower;
|
|
129
|
+
g.needsUpdate = true;
|
|
130
|
+
}
|
|
131
|
+
export function disposeBulbMaterials(m) {
|
|
132
|
+
Object.values(m).forEach((mat) => mat.dispose());
|
|
133
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BufferGeometry } from 'three';
|
|
2
|
+
import type { LightBulbShape } from './types';
|
|
3
|
+
export interface BulbShapeGeometry {
|
|
4
|
+
glass: BufferGeometry;
|
|
5
|
+
filament: BufferGeometry;
|
|
6
|
+
supports: BufferGeometry[];
|
|
7
|
+
base: BufferGeometry;
|
|
8
|
+
/** Bulb-space height of the filament centre — becomes the object origin. */
|
|
9
|
+
filamentCenterY: number;
|
|
10
|
+
/** Radius of the glow halo, bulb space. */
|
|
11
|
+
haloRadius: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function buildBulbShape(shape: LightBulbShape | undefined): BulbShapeGeometry;
|
|
14
|
+
export declare function disposeBulbShape(g: BulbShapeGeometry): void;
|
|
15
|
+
//# sourceMappingURL=bulbShapes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulbShapes.d.ts","sourceRoot":"","sources":["../../../src/components/lightBulb/bulbShapes.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,cAAc,CAAC;IACzB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,IAAI,EAAE,cAAc,CAAC;IACrB,4EAA4E;IAC5E,eAAe,EAAE,MAAM,CAAC;IACxB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;CACtB;AAyKD,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,GAAG,iBAAiB,CAEnF;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAK3D"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// bulbShapes — glass profiles, filaments and supports for each LightBulbShape
|
|
3
|
+
// =============================================================================
|
|
4
|
+
//
|
|
5
|
+
// Units: the glass is ~1 unit tall; object scale comes from the CreatedObject
|
|
6
|
+
// wrapper. "Bulb space" has the neck at y = 0 and the glass growing up +Y; the
|
|
7
|
+
// screw base hangs below it. LightBulb shifts the whole bulb down by
|
|
8
|
+
// `filamentCenterY` so the light (and the object's origin) sits on the filament.
|
|
9
|
+
//
|
|
10
|
+
// Lathe profiles run bottom → top. Reversed, the normals face inward and the
|
|
11
|
+
// point light lights the inside of the far wall instead of the near one.
|
|
12
|
+
//
|
|
13
|
+
import { CatmullRomCurve3, Curve, LatheGeometry, TubeGeometry, Vector2, Vector3 } from 'three';
|
|
14
|
+
const LATHE_SEGMENTS = 64;
|
|
15
|
+
/** A tightly wound coil along an arbitrary path. */
|
|
16
|
+
class CoiledCurve extends Curve {
|
|
17
|
+
path;
|
|
18
|
+
turns;
|
|
19
|
+
radius;
|
|
20
|
+
tmpT = new Vector3();
|
|
21
|
+
tmpN = new Vector3();
|
|
22
|
+
tmpB = new Vector3();
|
|
23
|
+
constructor(path, turns, radius) {
|
|
24
|
+
super();
|
|
25
|
+
this.path = path;
|
|
26
|
+
this.turns = turns;
|
|
27
|
+
this.radius = radius;
|
|
28
|
+
}
|
|
29
|
+
getPoint(t, target = new Vector3()) {
|
|
30
|
+
const p = this.path.getPoint(t, target);
|
|
31
|
+
const tangent = this.path.getTangent(t, this.tmpT);
|
|
32
|
+
// Any vector not parallel to the tangent gives a stable frame for these gentle paths.
|
|
33
|
+
const ref = Math.abs(tangent.y) < 0.9 ? this.tmpN.set(0, 1, 0) : this.tmpN.set(1, 0, 0);
|
|
34
|
+
const b = this.tmpB.crossVectors(tangent, ref).normalize();
|
|
35
|
+
const n = ref.crossVectors(b, tangent).normalize();
|
|
36
|
+
const a = t * Math.PI * 2 * this.turns;
|
|
37
|
+
return p.addScaledVector(n, Math.cos(a) * this.radius).addScaledVector(b, Math.sin(a) * this.radius);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const coil = (points, turns, radius = 0.02, wire = 0.0045) => new TubeGeometry(new CoiledCurve(new CatmullRomCurve3(points), turns, radius), turns * 28, wire, 5, false);
|
|
41
|
+
const wire = (from, to, bend = 0) => {
|
|
42
|
+
const mid = from.clone().lerp(to, 0.5);
|
|
43
|
+
mid.x += bend;
|
|
44
|
+
return new TubeGeometry(new CatmullRomCurve3([from, mid, to]), 16, 0.0035, 5, false);
|
|
45
|
+
};
|
|
46
|
+
/** Glass stem rising from the neck: a short flared cone. */
|
|
47
|
+
const stemProfile = (top, r = 0.035) => new LatheGeometry([
|
|
48
|
+
new Vector2(0.09, -0.02), new Vector2(0.05, 0.03), new Vector2(r * 0.9, top * 0.6), new Vector2(r, top), new Vector2(0.001, top + 0.01),
|
|
49
|
+
], 24);
|
|
50
|
+
/** Screw base below the neck. */
|
|
51
|
+
function baseGeometry(neckRadius) {
|
|
52
|
+
const pts = [new Vector2(0.001, -0.36), new Vector2(0.05, -0.355), new Vector2(neckRadius * 0.62, -0.33)];
|
|
53
|
+
const threads = 22;
|
|
54
|
+
for (let i = 0; i <= threads; i++) {
|
|
55
|
+
const y = -0.3 + (i / threads) * 0.3;
|
|
56
|
+
pts.push(new Vector2(neckRadius + Math.abs(Math.sin(i * Math.PI / 4)) * 0.018, y));
|
|
57
|
+
}
|
|
58
|
+
pts.push(new Vector2(neckRadius * 0.98, 0.012));
|
|
59
|
+
return new LatheGeometry(pts, LATHE_SEGMENTS);
|
|
60
|
+
}
|
|
61
|
+
const lathe = (pts) => {
|
|
62
|
+
const g = new LatheGeometry(pts, LATHE_SEGMENTS);
|
|
63
|
+
g.computeVertexNormals();
|
|
64
|
+
return g;
|
|
65
|
+
};
|
|
66
|
+
const smooth = (e0, e1, x) => {
|
|
67
|
+
const t = Math.min(Math.max((x - e0) / (e1 - e0), 0), 1);
|
|
68
|
+
return t * t * (3 - 2 * t);
|
|
69
|
+
};
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
function classic() {
|
|
72
|
+
// A19: narrow neck swelling into a pear, round crown.
|
|
73
|
+
const neck = 0.17, pts = [];
|
|
74
|
+
for (let i = 0; i <= 64; i++) {
|
|
75
|
+
const t = i / 64, y = t * 0.97;
|
|
76
|
+
let r;
|
|
77
|
+
if (t < 0.22)
|
|
78
|
+
r = neck + Math.pow(t / 0.22, 1.6) * 0.07;
|
|
79
|
+
else {
|
|
80
|
+
const u = (t - 0.22) / 0.78;
|
|
81
|
+
r = 0.24 + Math.sin(u * Math.PI * 0.62) * 0.16;
|
|
82
|
+
if (u > 0.62)
|
|
83
|
+
r *= Math.sqrt(Math.max(0, 1 - Math.pow((u - 0.62) / 0.38, 2)));
|
|
84
|
+
}
|
|
85
|
+
pts.push(new Vector2(Math.max(r, 0.0005), y));
|
|
86
|
+
}
|
|
87
|
+
const cy = 0.55, half = 0.1;
|
|
88
|
+
const ends = [new Vector3(-half, cy, 0), new Vector3(half, cy, 0)];
|
|
89
|
+
return {
|
|
90
|
+
glass: lathe(pts),
|
|
91
|
+
filament: coil([ends[0], new Vector3(0, cy - 0.03, 0), ends[1]], 14),
|
|
92
|
+
supports: [stemProfile(0.26), wire(new Vector3(-0.02, 0.26, 0), ends[0], -0.03), wire(new Vector3(0.02, 0.26, 0), ends[1], 0.03)],
|
|
93
|
+
base: baseGeometry(neck),
|
|
94
|
+
filamentCenterY: cy,
|
|
95
|
+
haloRadius: 1.1,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function globe() {
|
|
99
|
+
// G25: short neck, near-perfect sphere.
|
|
100
|
+
const neck = 0.17, R = 0.42, c = 0.52;
|
|
101
|
+
const join = c - Math.sqrt(R * R - neck * neck);
|
|
102
|
+
const pts = [new Vector2(neck, 0)];
|
|
103
|
+
for (let i = 0; i <= 64; i++) {
|
|
104
|
+
const y = join + (i / 64) * (c + R - join);
|
|
105
|
+
pts.push(new Vector2(Math.max(Math.sqrt(Math.max(R * R - (y - c) * (y - c), 0)), 0.0005), y));
|
|
106
|
+
}
|
|
107
|
+
const half = 0.1;
|
|
108
|
+
const ends = [new Vector3(-half, c, 0), new Vector3(half, c, 0)];
|
|
109
|
+
return {
|
|
110
|
+
glass: lathe(pts),
|
|
111
|
+
filament: coil([ends[0], new Vector3(0, c - 0.03, 0), ends[1]], 14),
|
|
112
|
+
supports: [stemProfile(0.3), wire(new Vector3(-0.02, 0.3, 0), ends[0], -0.03), wire(new Vector3(0.02, 0.3, 0), ends[1], 0.03)],
|
|
113
|
+
base: baseGeometry(neck),
|
|
114
|
+
filamentCenterY: c,
|
|
115
|
+
haloRadius: 1.25,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function edison() {
|
|
119
|
+
// ST64: tall teardrop with a squirrel-cage filament.
|
|
120
|
+
const neck = 0.17, top = 1.35, pts = [];
|
|
121
|
+
for (let i = 0; i <= 80; i++) {
|
|
122
|
+
const y = (i / 80) * top;
|
|
123
|
+
let r = neck + (0.33 - neck) * smooth(0.02, 0.8, y);
|
|
124
|
+
if (y > 0.86)
|
|
125
|
+
r *= Math.sqrt(Math.max(0, 1 - Math.pow((y - 0.86) / (top - 0.86), 2)));
|
|
126
|
+
pts.push(new Vector2(Math.max(r, 0.0005), y));
|
|
127
|
+
}
|
|
128
|
+
// Zig-zag between a lower and an upper ring: the vintage "cage".
|
|
129
|
+
const strands = 7, lowY = 0.42, highY = 1.02, lowR = 0.035, highR = 0.12;
|
|
130
|
+
const cage = [];
|
|
131
|
+
for (let i = 0; i < strands * 2; i++) {
|
|
132
|
+
const a = (i / (strands * 2)) * Math.PI * 2;
|
|
133
|
+
const up = i % 2 === 1;
|
|
134
|
+
const r = up ? highR : lowR;
|
|
135
|
+
cage.push(new Vector3(Math.cos(a) * r, up ? highY : lowY, Math.sin(a) * r));
|
|
136
|
+
}
|
|
137
|
+
const filament = new TubeGeometry(new CatmullRomCurve3(cage, true, 'catmullrom', 0.15), 420, 0.004, 5, true);
|
|
138
|
+
const supports = [stemProfile(lowY - 0.02, 0.03)];
|
|
139
|
+
// A centre rod up to the top ring, with spokes out to each upper vertex.
|
|
140
|
+
supports.push(wire(new Vector3(0, lowY, 0), new Vector3(0, highY + 0.04, 0)));
|
|
141
|
+
for (let i = 1; i < strands * 2; i += 2)
|
|
142
|
+
supports.push(wire(new Vector3(0, highY + 0.04, 0), cage[i]));
|
|
143
|
+
return {
|
|
144
|
+
glass: lathe(pts),
|
|
145
|
+
filament,
|
|
146
|
+
supports,
|
|
147
|
+
base: baseGeometry(neck),
|
|
148
|
+
filamentCenterY: (lowY + highY) / 2,
|
|
149
|
+
haloRadius: 1.3,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function tube() {
|
|
153
|
+
// T10: straight tube, rounded crown, long axial coil.
|
|
154
|
+
const R = 0.14, top = 1.4, pts = [];
|
|
155
|
+
for (let i = 0; i <= 64; i++) {
|
|
156
|
+
const y = (i / 64) * top;
|
|
157
|
+
const crown = top - R;
|
|
158
|
+
const r = y < crown ? R : Math.sqrt(Math.max(R * R - (y - crown) * (y - crown), 0));
|
|
159
|
+
pts.push(new Vector2(Math.max(r, 0.0005), y));
|
|
160
|
+
}
|
|
161
|
+
const lo = new Vector3(0, 0.3, 0), hi = new Vector3(0, 1.2, 0);
|
|
162
|
+
return {
|
|
163
|
+
glass: lathe(pts),
|
|
164
|
+
filament: coil([lo, new Vector3(0.005, 0.75, 0), hi], 60, 0.014, 0.0035),
|
|
165
|
+
supports: [stemProfile(0.24, 0.028), wire(new Vector3(0, 0.24, 0), lo), wire(new Vector3(0.03, 0.2, 0), new Vector3(0.09, 0.75, 0), 0.02), wire(new Vector3(0.09, 0.75, 0), hi, 0.02)],
|
|
166
|
+
base: baseGeometry(R),
|
|
167
|
+
filamentCenterY: 0.75,
|
|
168
|
+
haloRadius: 1.2,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
const BUILDERS = { classic, globe, edison, tube };
|
|
172
|
+
export function buildBulbShape(shape) {
|
|
173
|
+
return (BUILDERS[shape ?? 'classic'] ?? classic)();
|
|
174
|
+
}
|
|
175
|
+
export function disposeBulbShape(g) {
|
|
176
|
+
g.glass.dispose();
|
|
177
|
+
g.filament.dispose();
|
|
178
|
+
g.base.dispose();
|
|
179
|
+
g.supports.forEach((s) => s.dispose());
|
|
180
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as LightBulb } from './LightBulb';
|
|
2
|
+
export type { LightBulbProps } from './LightBulb';
|
|
3
|
+
export type { LightBulbConfig, LightBulbShape, LightBulbGlass, LightBulbColorMode } from './types';
|
|
4
|
+
export { kelvinToColor } from './kelvin';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/lightBulb/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Color } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Colour temperature → colour (Tanner Helland's blackbody fit, sRGB).
|
|
4
|
+
* Writes into `target` and returns it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function kelvinToColor(kelvin: number, target?: Color): Color;
|
|
7
|
+
//# sourceMappingURL=kelvin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kelvin.d.ts","sourceRoot":"","sources":["../../../src/components/lightBulb/kelvin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAkB,MAAM,OAAO,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,KAAmB,GAAG,KAAK,CAehF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Color, SRGBColorSpace } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Colour temperature → colour (Tanner Helland's blackbody fit, sRGB).
|
|
4
|
+
* Writes into `target` and returns it.
|
|
5
|
+
*/
|
|
6
|
+
export function kelvinToColor(kelvin, target = new Color()) {
|
|
7
|
+
const t = Math.min(Math.max(kelvin, 1000), 40000) / 100;
|
|
8
|
+
let r, g, b;
|
|
9
|
+
if (t <= 66) {
|
|
10
|
+
r = 255;
|
|
11
|
+
g = 99.4708025861 * Math.log(t) - 161.1195681661;
|
|
12
|
+
b = t <= 19 ? 0 : 138.5177312231 * Math.log(t - 10) - 305.0447927307;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
r = 329.698727446 * Math.pow(t - 60, -0.1332047592);
|
|
16
|
+
g = 288.1221695283 * Math.pow(t - 60, -0.0755148492);
|
|
17
|
+
b = 255;
|
|
18
|
+
}
|
|
19
|
+
const c = (v) => Math.min(Math.max(v, 0), 255) / 255;
|
|
20
|
+
return target.setRGB(c(r), c(g), c(b), SRGBColorSpace);
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/lightBulb/types.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export { useLightHandlers } from './useLightHandlers';
|
|
|
44
44
|
export type { UseLightMouseMoveOptions } from './useLightMouseMove';
|
|
45
45
|
export { useLightMouseMove } from './useLightMouseMove';
|
|
46
46
|
export { useLightShadow } from './useLightShadow';
|
|
47
|
+
export { LIGHT_STRUCTURAL, applyLightLive, useLightLive } from './useLightLive';
|
|
47
48
|
export { useMaterialApplication } from './useMaterialApplication';
|
|
48
49
|
export type { UseMaterialOptionsReturn } from './useMaterialOptions';
|
|
49
50
|
export { useMaterialOptions } from './useMaterialOptions';
|
|
@@ -70,7 +71,7 @@ export type { PathAnimationOptions } from './usePathAnimation';
|
|
|
70
71
|
export { usePathAnimation } from './usePathAnimation';
|
|
71
72
|
export { useRegisterScene } from './useRegisterScene';
|
|
72
73
|
export { useSequenceAnimation } from './useSequenceAnimation';
|
|
73
|
-
export { useShadowApplication } from './useShadowApplication';
|
|
74
|
+
export { applyShadowFlags, useShadowApplication } from './useShadowApplication';
|
|
74
75
|
export { useShapeGeometry } from './useShapeGeometry';
|
|
75
76
|
export type { SkyAnimValues } from './useSkyAnimation';
|
|
76
77
|
export { useSkyAnimation } from './useSkyAnimation';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE7D,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9D,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEpE,YAAY,EAAE,cAAc,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BAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -30,6 +30,7 @@ export { useLightAnimation } from './useLightAnimation.js';
|
|
|
30
30
|
export { useLightHandlers } from './useLightHandlers.js';
|
|
31
31
|
export { useLightMouseMove } from './useLightMouseMove.js';
|
|
32
32
|
export { useLightShadow } from './useLightShadow.js';
|
|
33
|
+
export { LIGHT_STRUCTURAL, applyLightLive, useLightLive } from './useLightLive.js';
|
|
33
34
|
export { useMaterialApplication } from './useMaterialApplication.js';
|
|
34
35
|
export { useMaterialOptions } from './useMaterialOptions.js';
|
|
35
36
|
export { useMaterialUniforms } from './useMaterialUniforms.js';
|
|
@@ -51,7 +52,7 @@ export { useParticlesTextures } from './useParticlesTextures.js';
|
|
|
51
52
|
export { usePathAnimation } from './usePathAnimation.js';
|
|
52
53
|
export { useRegisterScene } from './useRegisterScene.js';
|
|
53
54
|
export { useSequenceAnimation } from './useSequenceAnimation.js';
|
|
54
|
-
export { useShadowApplication } from './useShadowApplication.js';
|
|
55
|
+
export { applyShadowFlags, useShadowApplication } from './useShadowApplication.js';
|
|
55
56
|
export { useShapeGeometry } from './useShapeGeometry.js';
|
|
56
57
|
export { useSkyAnimation } from './useSkyAnimation.js';
|
|
57
58
|
export { useSkySystem } from './useSkySystem.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type MutableRefObject, type RefObject } from 'react';
|
|
2
2
|
import type { Object3D } from 'three';
|
|
3
3
|
/**
|
|
4
|
-
* Live config editing for the generative families (particles
|
|
4
|
+
* Live config editing for the generative families (particles, effects) and lights,
|
|
5
5
|
* the counterpart to `useOceanLive` / `useTerrainLive`.
|
|
6
6
|
*
|
|
7
7
|
* A slider drag fires on every pointer-move. Routing that through Redux hands the
|
|
@@ -29,7 +29,7 @@ import type { Object3D } from 'three';
|
|
|
29
29
|
export declare const CONFIG_LIVE_KEY = "__configLive";
|
|
30
30
|
export type ConfigLiveValue = number | string | boolean;
|
|
31
31
|
/** Generative families that support live config editing. */
|
|
32
|
-
export type ConfigLiveFamily = 'particles' | 'effects';
|
|
32
|
+
export type ConfigLiveFamily = 'particles' | 'effects' | 'lights';
|
|
33
33
|
export interface ConfigLiveHandle {
|
|
34
34
|
id: string;
|
|
35
35
|
family: ConfigLiveFamily;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConfigLive.d.ts","sourceRoot":"","sources":["../../src/hooks/useConfigLive.ts"],"names":[],"mappings":"AAAA,OAAO,EA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;AACH,wBAAgB,mBAAmB,CAC/B,OAAO,EAAE,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,EACnC,EAAE,EAAE,MAAM,GAAG,SAAS,EACtB,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,KAAK,IAAI,GAC5D,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CA8BnD;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useLayoutEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { SceneStore } from '@3driseai/3drise-core';
|
|
3
3
|
/**
|
|
4
|
-
* Live config editing for the generative families (particles
|
|
4
|
+
* Live config editing for the generative families (particles, effects) and lights,
|
|
5
5
|
* the counterpart to `useOceanLive` / `useTerrainLive`.
|
|
6
6
|
*
|
|
7
7
|
* A slider drag fires on every pointer-move. Routing that through Redux hands the
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MutableRefObject, RefObject } from 'react';
|
|
2
|
+
import type { Light, Object3D } from 'three';
|
|
3
|
+
import type { ConfigLiveValue } from './useConfigLive';
|
|
4
|
+
export declare const LIGHT_STRUCTURAL: readonly string[];
|
|
5
|
+
export declare function applyLightLive(light: Light, overrides: Record<string, ConfigLiveValue>, config: Record<string, any>): void;
|
|
6
|
+
/**
|
|
7
|
+
* Registers the live handle on `rootRef` (found by `id`) and applies drags to
|
|
8
|
+
* `lightRef`. Returns the ref of everything dragged since the last commit.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useLightLive(rootRef: RefObject<Object3D | null>, lightRef: RefObject<Light | null>, id: string | undefined, config: Record<string, any>): MutableRefObject<Record<string, ConfigLiveValue>>;
|
|
11
|
+
export default useLightLive;
|
|
12
|
+
//# sourceMappingURL=useLightLive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLightLive.d.ts","sourceRoot":"","sources":["../../src/hooks/useLightLive.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAK7C,CAAC;AAKF,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAuB1H;AAED;;;GAGG;AACH,wBAAgB,YAAY,CACxB,OAAO,EAAE,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,EACnC,QAAQ,EAAE,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC,EACjC,EAAE,EAAE,MAAM,GAAG,SAAS,EACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC5B,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAMnD;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useConfigLiveHandle } from './useConfigLive.js';
|
|
2
|
+
import { kelvinToColor } from '../components/lightBulb/kelvin.js';
|
|
3
|
+
export const LIGHT_STRUCTURAL = [
|
|
4
|
+
'shape', 'glass', 'glassTint', 'colorMode', 'on', 'targetPosition',
|
|
5
|
+
'shadow.enabled', 'shadow.mapSize', 'shadow.cameraNear', 'shadow.cameraFar',
|
|
6
|
+
'shadow.cameraLeft', 'shadow.cameraRight', 'shadow.cameraTop', 'shadow.cameraBottom',
|
|
7
|
+
'shadow.cameraFov', 'shadow.focus',
|
|
8
|
+
];
|
|
9
|
+
const DIRECT = ['intensity', 'decay', 'distance', 'angle', 'penumbra'];
|
|
10
|
+
const SHADOW = ['bias', 'normalBias', 'radius', 'intensity'];
|
|
11
|
+
export function applyLightLive(light, overrides, config) {
|
|
12
|
+
const isBulb = config?.type === 'lightBulb';
|
|
13
|
+
const colorMode = isBulb ? (config.colorMode ?? 'temperature') : 'color';
|
|
14
|
+
for (const [key, value] of Object.entries(overrides)) {
|
|
15
|
+
if (DIRECT.includes(key)) {
|
|
16
|
+
if (typeof value === 'number' && key in light)
|
|
17
|
+
light[key] = value;
|
|
18
|
+
}
|
|
19
|
+
else if (key === 'color') {
|
|
20
|
+
if (colorMode === 'color' && typeof value === 'string')
|
|
21
|
+
light.color.set(value);
|
|
22
|
+
}
|
|
23
|
+
else if (key === 'temperature') {
|
|
24
|
+
if (colorMode === 'temperature' && typeof value === 'number')
|
|
25
|
+
kelvinToColor(value, light.color);
|
|
26
|
+
}
|
|
27
|
+
else if (key.startsWith('shadow.')) {
|
|
28
|
+
const k = key.slice(7);
|
|
29
|
+
const shadow = light.shadow;
|
|
30
|
+
if (SHADOW.includes(k) && typeof value === 'number' && shadow)
|
|
31
|
+
shadow[k] = value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Registers the live handle on `rootRef` (found by `id`) and applies drags to
|
|
37
|
+
* `lightRef`. Returns the ref of everything dragged since the last commit.
|
|
38
|
+
*/
|
|
39
|
+
export function useLightLive(rootRef, lightRef, id, config) {
|
|
40
|
+
return useConfigLiveHandle(rootRef, id, 'lights', config, LIGHT_STRUCTURAL, (overrides) => {
|
|
41
|
+
const light = lightRef.current;
|
|
42
|
+
if (light)
|
|
43
|
+
applyLightLive(light, overrides, config);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export default useLightLive;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { Object3D } from "three";
|
|
1
2
|
import type { Object3DSource } from "../utils/resolveObject3D";
|
|
3
|
+
/**
|
|
4
|
+
* Set castShadow / receiveShadow on every mesh under `obj`. An unset flag means
|
|
5
|
+
* off: an object opts into shadows through its meshSettings, whatever its loader
|
|
6
|
+
* or component set. Shared with ModelPrimitive, which calls it for models that
|
|
7
|
+
* attach after this hook's effect has already run.
|
|
8
|
+
*/
|
|
9
|
+
export declare const applyShadowFlags: (obj: Object3D, castShadow: boolean | undefined, receiveShadow: boolean | undefined) => void;
|
|
2
10
|
export declare const useShadowApplication: (source: Object3DSource, castShadow: boolean | undefined, receiveShadow: boolean | undefined, triggerKey?: unknown) => void;
|
|
3
11
|
//# sourceMappingURL=useShadowApplication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useShadowApplication.d.ts","sourceRoot":"","sources":["../../src/hooks/useShadowApplication.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useShadowApplication.d.ts","sourceRoot":"","sources":["../../src/hooks/useShadowApplication.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,QAAQ,EAAE,YAAY,OAAO,GAAG,SAAS,EAAE,eAAe,OAAO,GAAG,SAAS,KAAG,IASrH,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,QAAQ,cAAc,EAAE,YAAY,OAAO,GAAG,SAAS,EAAE,eAAe,OAAO,GAAG,SAAS,EAAE,aAAa,OAAO,KAAG,IASxJ,CAAC"}
|
|
@@ -16,6 +16,22 @@
|
|
|
16
16
|
import { useEffect } from 'react';
|
|
17
17
|
import { traverseSkippingEdgesAndEffects } from '@3driseai/3drise-core';
|
|
18
18
|
import { resolveObject3D } from "../utils/resolveObject3D.js";
|
|
19
|
+
/**
|
|
20
|
+
* Set castShadow / receiveShadow on every mesh under `obj`. An unset flag means
|
|
21
|
+
* off: an object opts into shadows through its meshSettings, whatever its loader
|
|
22
|
+
* or component set. Shared with ModelPrimitive, which calls it for models that
|
|
23
|
+
* attach after this hook's effect has already run.
|
|
24
|
+
*/
|
|
25
|
+
export const applyShadowFlags = (obj, castShadow, receiveShadow) => {
|
|
26
|
+
const cast = castShadow ?? false;
|
|
27
|
+
const receive = receiveShadow ?? false;
|
|
28
|
+
traverseSkippingEdgesAndEffects(obj, true, (child) => {
|
|
29
|
+
if (child.isMesh) {
|
|
30
|
+
child.castShadow = cast;
|
|
31
|
+
child.receiveShadow = receive;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
};
|
|
19
35
|
export const useShadowApplication = (source, castShadow, receiveShadow, triggerKey) => {
|
|
20
36
|
useEffect(() => {
|
|
21
37
|
// Read the ref here, not at the call site: effects run after React has
|
|
@@ -23,13 +39,6 @@ export const useShadowApplication = (source, castShadow, receiveShadow, triggerK
|
|
|
23
39
|
const obj = resolveObject3D(source);
|
|
24
40
|
if (!obj)
|
|
25
41
|
return;
|
|
26
|
-
|
|
27
|
-
const receive = receiveShadow ?? false;
|
|
28
|
-
traverseSkippingEdgesAndEffects(obj, true, (child) => {
|
|
29
|
-
if (child.isMesh) {
|
|
30
|
-
child.castShadow = cast;
|
|
31
|
-
child.receiveShadow = receive;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
42
|
+
applyShadowFlags(obj, castShadow, receiveShadow);
|
|
34
43
|
}, [source, castShadow, receiveShadow, triggerKey]);
|
|
35
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3driseai/3drise-viewer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,6 +39,6 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@3driseai/3drise-common": "^1.0.1",
|
|
42
|
-
"@3driseai/3drise-core": "^1.0.
|
|
42
|
+
"@3driseai/3drise-core": "^1.0.15"
|
|
43
43
|
}
|
|
44
44
|
}
|