@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.
Files changed (102) hide show
  1. package/dist/components/CreatedObject.d.ts.map +1 -1
  2. package/dist/components/CreatedObject.js +6 -1
  3. package/dist/components/LightObject.d.ts.map +1 -1
  4. package/dist/components/LightObject.js +24 -13
  5. package/dist/components/ModelPrimitive.d.ts.map +1 -1
  6. package/dist/components/ModelPrimitive.js +4 -6
  7. package/dist/components/ObjectNode.js +1 -1
  8. package/dist/components/ParticlesGenerator.d.ts +3 -1
  9. package/dist/components/ParticlesGenerator.d.ts.map +1 -1
  10. package/dist/components/ParticlesGenerator.js +2 -2
  11. package/dist/components/ProjectLoader.js +1 -1
  12. package/dist/components/SceneBuilder.d.ts.map +1 -1
  13. package/dist/components/SceneBuilder.js +5 -1
  14. package/dist/components/candle/Candle.d.ts +14 -0
  15. package/dist/components/candle/Candle.d.ts.map +1 -0
  16. package/dist/components/candle/Candle.js +249 -0
  17. package/dist/components/candle/candleGeometry.d.ts +23 -0
  18. package/dist/components/candle/candleGeometry.d.ts.map +1 -0
  19. package/dist/components/candle/candleGeometry.js +73 -0
  20. package/dist/components/candle/candleMaterials.d.ts +24 -0
  21. package/dist/components/candle/candleMaterials.d.ts.map +1 -0
  22. package/dist/components/candle/candleMaterials.js +433 -0
  23. package/dist/components/candle/flameMotion.d.ts +64 -0
  24. package/dist/components/candle/flameMotion.d.ts.map +1 -0
  25. package/dist/components/candle/flameMotion.js +138 -0
  26. package/dist/components/candle/index.d.ts +9 -0
  27. package/dist/components/candle/index.d.ts.map +1 -0
  28. package/dist/components/candle/index.js +6 -0
  29. package/dist/components/fluorescentTube/FluorescentTube.d.ts +14 -0
  30. package/dist/components/fluorescentTube/FluorescentTube.d.ts.map +1 -0
  31. package/dist/components/fluorescentTube/FluorescentTube.js +262 -0
  32. package/dist/components/fluorescentTube/index.d.ts +5 -0
  33. package/dist/components/fluorescentTube/index.d.ts.map +1 -0
  34. package/dist/components/fluorescentTube/index.js +3 -0
  35. package/dist/components/fluorescentTube/tubeMaterials.d.ts +34 -0
  36. package/dist/components/fluorescentTube/tubeMaterials.d.ts.map +1 -0
  37. package/dist/components/fluorescentTube/tubeMaterials.js +185 -0
  38. package/dist/components/index.d.ts +4 -0
  39. package/dist/components/index.d.ts.map +1 -1
  40. package/dist/components/index.js +4 -0
  41. package/dist/components/ledArray/LedArray.d.ts +14 -0
  42. package/dist/components/ledArray/LedArray.d.ts.map +1 -0
  43. package/dist/components/ledArray/LedArray.js +243 -0
  44. package/dist/components/ledArray/index.d.ts +7 -0
  45. package/dist/components/ledArray/index.d.ts.map +1 -0
  46. package/dist/components/ledArray/index.js +4 -0
  47. package/dist/components/ledArray/ledLayout.d.ts +22 -0
  48. package/dist/components/ledArray/ledLayout.d.ts.map +1 -0
  49. package/dist/components/ledArray/ledLayout.js +59 -0
  50. package/dist/components/ledArray/ledMaterials.d.ts +14 -0
  51. package/dist/components/ledArray/ledMaterials.d.ts.map +1 -0
  52. package/dist/components/ledArray/ledMaterials.js +151 -0
  53. package/dist/components/lightBulb/LightBulb.d.ts.map +1 -1
  54. package/dist/components/lightBulb/LightBulb.js +10 -13
  55. package/dist/components/particles/BioluminescentWakeParticles.d.ts +3 -1
  56. package/dist/components/particles/BioluminescentWakeParticles.d.ts.map +1 -1
  57. package/dist/components/particles/BioluminescentWakeParticles.js +7 -3
  58. package/dist/components/particles/BrownianDustParticles.d.ts +3 -1
  59. package/dist/components/particles/BrownianDustParticles.d.ts.map +1 -1
  60. package/dist/components/particles/BrownianDustParticles.js +7 -3
  61. package/dist/components/particles/ChladniSandParticles.d.ts +3 -1
  62. package/dist/components/particles/ChladniSandParticles.d.ts.map +1 -1
  63. package/dist/components/particles/ChladniSandParticles.js +7 -3
  64. package/dist/components/particles/ElectronOrbitalsParticles.d.ts +3 -1
  65. package/dist/components/particles/ElectronOrbitalsParticles.d.ts.map +1 -1
  66. package/dist/components/particles/ElectronOrbitalsParticles.js +7 -3
  67. package/dist/components/particles/FaradayPowderParticles.d.ts +3 -1
  68. package/dist/components/particles/FaradayPowderParticles.d.ts.map +1 -1
  69. package/dist/components/particles/FaradayPowderParticles.js +7 -3
  70. package/dist/components/particles/GrinderSparksParticles.d.ts +3 -1
  71. package/dist/components/particles/GrinderSparksParticles.d.ts.map +1 -1
  72. package/dist/components/particles/GrinderSparksParticles.js +7 -3
  73. package/dist/components/particles/NeonRainParticles.d.ts +3 -1
  74. package/dist/components/particles/NeonRainParticles.d.ts.map +1 -1
  75. package/dist/components/particles/NeonRainParticles.js +7 -3
  76. package/dist/components/particles/TidalStreamParticles.d.ts +3 -1
  77. package/dist/components/particles/TidalStreamParticles.d.ts.map +1 -1
  78. package/dist/components/particles/TidalStreamParticles.js +7 -3
  79. package/dist/components/spotBeam/SpotBeam.d.ts +14 -0
  80. package/dist/components/spotBeam/SpotBeam.d.ts.map +1 -0
  81. package/dist/components/spotBeam/SpotBeam.js +244 -0
  82. package/dist/components/spotBeam/beamPatterns.d.ts +11 -0
  83. package/dist/components/spotBeam/beamPatterns.d.ts.map +1 -0
  84. package/dist/components/spotBeam/beamPatterns.js +106 -0
  85. package/dist/components/spotBeam/index.d.ts +7 -0
  86. package/dist/components/spotBeam/index.d.ts.map +1 -0
  87. package/dist/components/spotBeam/index.js +4 -0
  88. package/dist/components/spotBeam/spotBeamMaterials.d.ts +16 -0
  89. package/dist/components/spotBeam/spotBeamMaterials.d.ts.map +1 -0
  90. package/dist/components/spotBeam/spotBeamMaterials.js +307 -0
  91. package/dist/hooks/index.d.ts +2 -0
  92. package/dist/hooks/index.d.ts.map +1 -1
  93. package/dist/hooks/index.js +1 -0
  94. package/dist/hooks/useLightConfig.d.ts +25 -0
  95. package/dist/hooks/useLightConfig.d.ts.map +1 -0
  96. package/dist/hooks/useLightConfig.js +125 -0
  97. package/dist/hooks/useLightLive.d.ts.map +1 -1
  98. package/dist/hooks/useLightLive.js +12 -2
  99. package/dist/hooks/useShadowApplication.d.ts +4 -4
  100. package/dist/hooks/useShadowApplication.d.ts.map +1 -1
  101. package/dist/hooks/useShadowApplication.js +25 -10
  102. 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
- const isBulb = config?.type === 'lightBulb';
13
- const colorMode = isBulb ? (config.colorMode ?? 'temperature') : 'color';
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`. 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.
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,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"}
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 { traverseSkippingEdgesAndEffects } from '@3driseai/3drise-core';
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`. 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.
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
- traverseSkippingEdgesAndEffects(obj, true, (child) => {
29
- if (child.isMesh) {
30
- child.castShadow = cast;
31
- child.receiveShadow = receive;
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.22",
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.15"
42
+ "@3driseai/3drise-core": "^1.0.17"
43
43
  }
44
44
  }