@3driseai/3drise-viewer 0.1.21 → 0.1.23
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 -9
- package/dist/components/ModelPrimitive.d.ts.map +1 -1
- package/dist/components/ModelPrimitive.js +10 -1
- 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/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 +16 -0
- package/dist/components/lightBulb/LightBulb.d.ts.map +1 -0
- package/dist/components/lightBulb/LightBulb.js +141 -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/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 +4 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -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/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 +12 -0
- package/dist/hooks/useLightLive.d.ts.map +1 -0
- package/dist/hooks/useLightLive.js +53 -0
- package/dist/hooks/useShadowApplication.d.ts +8 -0
- package/dist/hooks/useShadowApplication.d.ts.map +1 -1
- package/dist/hooks/useShadowApplication.js +33 -9
- package/package.json +2 -2
|
@@ -14,8 +14,39 @@
|
|
|
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
|
+
/**
|
|
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
|
+
*/
|
|
25
|
+
export const applyShadowFlags = (obj, castShadow, receiveShadow) => {
|
|
26
|
+
const cast = castShadow ?? false;
|
|
27
|
+
const receive = receiveShadow ?? false;
|
|
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;
|
|
40
|
+
}
|
|
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);
|
|
49
|
+
};
|
|
19
50
|
export const useShadowApplication = (source, castShadow, receiveShadow, triggerKey) => {
|
|
20
51
|
useEffect(() => {
|
|
21
52
|
// Read the ref here, not at the call site: effects run after React has
|
|
@@ -23,13 +54,6 @@ export const useShadowApplication = (source, castShadow, receiveShadow, triggerK
|
|
|
23
54
|
const obj = resolveObject3D(source);
|
|
24
55
|
if (!obj)
|
|
25
56
|
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
|
-
});
|
|
57
|
+
applyShadowFlags(obj, castShadow, receiveShadow);
|
|
34
58
|
}, [source, castShadow, receiveShadow, triggerKey]);
|
|
35
59
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3driseai/3drise-viewer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
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.16"
|
|
43
43
|
}
|
|
44
44
|
}
|