@3driseai/3drise-viewer 0.1.22 → 0.1.24
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/CreatedObject.d.ts.map +1 -1
- package/dist/components/CreatedObject.js +6 -1
- package/dist/components/LightObject.d.ts.map +1 -1
- package/dist/components/LightObject.js +24 -13
- package/dist/components/ModelPrimitive.d.ts.map +1 -1
- package/dist/components/ModelPrimitive.js +4 -6
- package/dist/components/ObjectNode.js +1 -1
- package/dist/components/ParticlesGenerator.d.ts +3 -1
- package/dist/components/ParticlesGenerator.d.ts.map +1 -1
- package/dist/components/ParticlesGenerator.js +2 -2
- package/dist/components/ProjectLoader.js +1 -1
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +5 -1
- package/dist/components/candle/Candle.d.ts +14 -0
- package/dist/components/candle/Candle.d.ts.map +1 -0
- package/dist/components/candle/Candle.js +249 -0
- package/dist/components/candle/candleGeometry.d.ts +23 -0
- package/dist/components/candle/candleGeometry.d.ts.map +1 -0
- package/dist/components/candle/candleGeometry.js +73 -0
- package/dist/components/candle/candleMaterials.d.ts +24 -0
- package/dist/components/candle/candleMaterials.d.ts.map +1 -0
- package/dist/components/candle/candleMaterials.js +433 -0
- package/dist/components/candle/flameMotion.d.ts +64 -0
- package/dist/components/candle/flameMotion.d.ts.map +1 -0
- package/dist/components/candle/flameMotion.js +138 -0
- package/dist/components/candle/index.d.ts +9 -0
- package/dist/components/candle/index.d.ts.map +1 -0
- package/dist/components/candle/index.js +6 -0
- package/dist/components/fluorescentTube/FluorescentTube.d.ts +14 -0
- package/dist/components/fluorescentTube/FluorescentTube.d.ts.map +1 -0
- package/dist/components/fluorescentTube/FluorescentTube.js +262 -0
- package/dist/components/fluorescentTube/index.d.ts +5 -0
- package/dist/components/fluorescentTube/index.d.ts.map +1 -0
- package/dist/components/fluorescentTube/index.js +3 -0
- package/dist/components/fluorescentTube/tubeMaterials.d.ts +34 -0
- package/dist/components/fluorescentTube/tubeMaterials.d.ts.map +1 -0
- package/dist/components/fluorescentTube/tubeMaterials.js +185 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/ledArray/LedArray.d.ts +14 -0
- package/dist/components/ledArray/LedArray.d.ts.map +1 -0
- package/dist/components/ledArray/LedArray.js +243 -0
- package/dist/components/ledArray/index.d.ts +7 -0
- package/dist/components/ledArray/index.d.ts.map +1 -0
- package/dist/components/ledArray/index.js +4 -0
- package/dist/components/ledArray/ledLayout.d.ts +22 -0
- package/dist/components/ledArray/ledLayout.d.ts.map +1 -0
- package/dist/components/ledArray/ledLayout.js +59 -0
- package/dist/components/ledArray/ledMaterials.d.ts +14 -0
- package/dist/components/ledArray/ledMaterials.d.ts.map +1 -0
- package/dist/components/ledArray/ledMaterials.js +151 -0
- package/dist/components/lightBulb/LightBulb.d.ts.map +1 -1
- package/dist/components/lightBulb/LightBulb.js +10 -13
- package/dist/components/particles/BioluminescentWakeParticles.d.ts +3 -1
- package/dist/components/particles/BioluminescentWakeParticles.d.ts.map +1 -1
- package/dist/components/particles/BioluminescentWakeParticles.js +7 -3
- package/dist/components/particles/BrownianDustParticles.d.ts +3 -1
- package/dist/components/particles/BrownianDustParticles.d.ts.map +1 -1
- package/dist/components/particles/BrownianDustParticles.js +7 -3
- package/dist/components/particles/ChladniSandParticles.d.ts +3 -1
- package/dist/components/particles/ChladniSandParticles.d.ts.map +1 -1
- package/dist/components/particles/ChladniSandParticles.js +7 -3
- package/dist/components/particles/ElectronOrbitalsParticles.d.ts +3 -1
- package/dist/components/particles/ElectronOrbitalsParticles.d.ts.map +1 -1
- package/dist/components/particles/ElectronOrbitalsParticles.js +7 -3
- package/dist/components/particles/FaradayPowderParticles.d.ts +3 -1
- package/dist/components/particles/FaradayPowderParticles.d.ts.map +1 -1
- package/dist/components/particles/FaradayPowderParticles.js +7 -3
- package/dist/components/particles/GrinderSparksParticles.d.ts +3 -1
- package/dist/components/particles/GrinderSparksParticles.d.ts.map +1 -1
- package/dist/components/particles/GrinderSparksParticles.js +7 -3
- package/dist/components/particles/NeonRainParticles.d.ts +3 -1
- package/dist/components/particles/NeonRainParticles.d.ts.map +1 -1
- package/dist/components/particles/NeonRainParticles.js +7 -3
- package/dist/components/particles/TidalStreamParticles.d.ts +3 -1
- package/dist/components/particles/TidalStreamParticles.d.ts.map +1 -1
- package/dist/components/particles/TidalStreamParticles.js +7 -3
- package/dist/components/spotBeam/SpotBeam.d.ts +14 -0
- package/dist/components/spotBeam/SpotBeam.d.ts.map +1 -0
- package/dist/components/spotBeam/SpotBeam.js +244 -0
- package/dist/components/spotBeam/beamPatterns.d.ts +11 -0
- package/dist/components/spotBeam/beamPatterns.d.ts.map +1 -0
- package/dist/components/spotBeam/beamPatterns.js +106 -0
- package/dist/components/spotBeam/index.d.ts +7 -0
- package/dist/components/spotBeam/index.d.ts.map +1 -0
- package/dist/components/spotBeam/index.js +4 -0
- package/dist/components/spotBeam/spotBeamMaterials.d.ts +16 -0
- package/dist/components/spotBeam/spotBeamMaterials.d.ts.map +1 -0
- package/dist/components/spotBeam/spotBeamMaterials.js +307 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useLightConfig.d.ts +25 -0
- package/dist/hooks/useLightConfig.d.ts.map +1 -0
- package/dist/hooks/useLightConfig.js +125 -0
- package/dist/hooks/useLightLive.d.ts.map +1 -1
- package/dist/hooks/useLightLive.js +12 -2
- package/dist/hooks/useShadowApplication.d.ts +4 -4
- package/dist/hooks/useShadowApplication.d.ts.map +1 -1
- package/dist/hooks/useShadowApplication.js +25 -10
- package/package.json +2 -2
|
@@ -2,6 +2,14 @@ import { useConfigLiveHandle } from './useConfigLive.js';
|
|
|
2
2
|
import { kelvinToColor } from '../components/lightBulb/kelvin.js';
|
|
3
3
|
export const LIGHT_STRUCTURAL = [
|
|
4
4
|
'shape', 'glass', 'glassTint', 'colorMode', 'on', 'targetPosition',
|
|
5
|
+
// spotBeam: the gobo is redrawn and the beam/emitter geometry is rebuilt.
|
|
6
|
+
'pattern', 'patternSoftness', 'patternRotation', 'beamMode', 'emitter',
|
|
7
|
+
// ledArray: the die layout is rebuilt. fluorescentTube: the tube geometry is.
|
|
8
|
+
'layout', 'count', 'rows', 'spacing', 'dieSize',
|
|
9
|
+
'tubes', 'tubeSpacing', 'length', 'diameter', 'startup',
|
|
10
|
+
// candle: the wax and wick are rebuilt, and the flame mode swaps meshes.
|
|
11
|
+
'body', 'waxColor', 'flameMode', 'smoke',
|
|
12
|
+
'height', 'radius', 'melt', 'flameHeight', 'flameWidth',
|
|
5
13
|
'shadow.enabled', 'shadow.mapSize', 'shadow.cameraNear', 'shadow.cameraFar',
|
|
6
14
|
'shadow.cameraLeft', 'shadow.cameraRight', 'shadow.cameraTop', 'shadow.cameraBottom',
|
|
7
15
|
'shadow.cameraFov', 'shadow.focus',
|
|
@@ -9,8 +17,10 @@ export const LIGHT_STRUCTURAL = [
|
|
|
9
17
|
const DIRECT = ['intensity', 'decay', 'distance', 'angle', 'penumbra'];
|
|
10
18
|
const SHADOW = ['bias', 'normalBias', 'radius', 'intensity'];
|
|
11
19
|
export function applyLightLive(light, overrides, config) {
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
// A type that has a colour-mode knob drives the light from either `color` or
|
|
21
|
+
// `temperature`; the plain lights only ever have `color`. Read the knob, not a
|
|
22
|
+
// list of type names — `config` here is the defaults-merged base.
|
|
23
|
+
const colorMode = typeof config?.colorMode === 'string' ? config.colorMode : 'color';
|
|
14
24
|
for (const [key, value] of Object.entries(overrides)) {
|
|
15
25
|
if (DIRECT.includes(key)) {
|
|
16
26
|
if (typeof value === 'number' && key in light)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Object3D } from "three";
|
|
2
2
|
import type { Object3DSource } from "../utils/resolveObject3D";
|
|
3
3
|
/**
|
|
4
|
-
* Set castShadow / receiveShadow on every mesh under `obj`.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* attach after this hook's effect has already run.
|
|
4
|
+
* Set castShadow / receiveShadow on every mesh under `obj`. Callers resolve an
|
|
5
|
+
* unset flag with `resolveShadowFlags(type, meshSettings)` from core, which
|
|
6
|
+
* falls back to the object type's default. Shared with ModelPrimitive, which
|
|
7
|
+
* calls it for models that attach after this hook's effect has already run.
|
|
8
8
|
*/
|
|
9
9
|
export declare const applyShadowFlags: (obj: Object3D, castShadow: boolean | undefined, receiveShadow: boolean | undefined) => void;
|
|
10
10
|
export declare const useShadowApplication: (source: Object3DSource, castShadow: boolean | undefined, receiveShadow: boolean | undefined, triggerKey?: unknown) => void;
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,IAwBrH,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,QAAQ,cAAc,EAAE,YAAY,OAAO,GAAG,SAAS,EAAE,eAAe,OAAO,GAAG,SAAS,EAAE,aAAa,OAAO,KAAG,IASxJ,CAAC"}
|
|
@@ -14,23 +14,38 @@
|
|
|
14
14
|
// arrive.
|
|
15
15
|
//
|
|
16
16
|
import { useEffect } from 'react';
|
|
17
|
-
import {
|
|
17
|
+
import { EDGES_GROUP_KEY, GEREATIVE_EFFECTS_KEY, IMAGE_KEY, SELF_OWNED_MATERIAL_KEY } from '@3driseai/3drise-core';
|
|
18
18
|
import { resolveObject3D } from "../utils/resolveObject3D.js";
|
|
19
19
|
/**
|
|
20
|
-
* Set castShadow / receiveShadow on every mesh under `obj`.
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* attach after this hook's effect has already run.
|
|
20
|
+
* Set castShadow / receiveShadow on every mesh under `obj`. Callers resolve an
|
|
21
|
+
* unset flag with `resolveShadowFlags(type, meshSettings)` from core, which
|
|
22
|
+
* falls back to the object type's default. Shared with ModelPrimitive, which
|
|
23
|
+
* calls it for models that attach after this hook's effect has already run.
|
|
24
24
|
*/
|
|
25
25
|
export const applyShadowFlags = (obj, castShadow, receiveShadow) => {
|
|
26
26
|
const cast = castShadow ?? false;
|
|
27
27
|
const receive = receiveShadow ?? false;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
// Stop at another object's root. A group's CreatedObject wraps its children's
|
|
29
|
+
// CreatedObjects, so a plain traverse would push the group's flags onto every
|
|
30
|
+
// descendant object and overwrite their own settings. Each object marks its
|
|
31
|
+
// root with userData.id.
|
|
32
|
+
const rootId = obj.userData?.id;
|
|
33
|
+
const walk = (node, isRoot) => {
|
|
34
|
+
if (!isRoot) {
|
|
35
|
+
const data = node.userData;
|
|
36
|
+
if (data?.[EDGES_GROUP_KEY] || data?.[GEREATIVE_EFFECTS_KEY] || data?.[SELF_OWNED_MATERIAL_KEY] || data?.[IMAGE_KEY])
|
|
37
|
+
return;
|
|
38
|
+
if (data?.id !== undefined && data.id !== rootId)
|
|
39
|
+
return;
|
|
32
40
|
}
|
|
33
|
-
|
|
41
|
+
if (node.isMesh) {
|
|
42
|
+
node.castShadow = cast;
|
|
43
|
+
node.receiveShadow = receive;
|
|
44
|
+
}
|
|
45
|
+
for (const child of node.children)
|
|
46
|
+
walk(child, false);
|
|
47
|
+
};
|
|
48
|
+
walk(obj, true);
|
|
34
49
|
};
|
|
35
50
|
export const useShadowApplication = (source, castShadow, receiveShadow, triggerKey) => {
|
|
36
51
|
useEffect(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3driseai/3drise-viewer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
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.17"
|
|
43
43
|
}
|
|
44
44
|
}
|