@3driseai/3drise-viewer 0.1.4 → 0.1.6
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/README.md +225 -0
- package/dist/components/AdvancedGrid.d.ts +16 -0
- package/dist/components/AdvancedGrid.d.ts.map +1 -0
- package/dist/components/AdvancedGrid.js +63 -0
- package/dist/components/AnimatedObject.d.ts.map +1 -1
- package/dist/components/AnimatedObject.js +6 -4
- package/dist/components/CameraController.d.ts.map +1 -1
- package/dist/components/CameraController.js +0 -6
- package/dist/components/CircuitGrid.d.ts +22 -0
- package/dist/components/CircuitGrid.d.ts.map +1 -0
- package/dist/components/CircuitGrid.js +69 -0
- package/dist/components/Clouds.d.ts.map +1 -1
- package/dist/components/Clouds.js +0 -5
- package/dist/components/ContourGrid.d.ts +25 -0
- package/dist/components/ContourGrid.d.ts.map +1 -0
- package/dist/components/ContourGrid.js +74 -0
- package/dist/components/CreatedObject.d.ts.map +1 -1
- package/dist/components/CreatedObject.js +3 -6
- package/dist/components/CustomPrimitive.d.ts.map +1 -1
- package/dist/components/CustomPrimitive.js +0 -5
- package/dist/components/EffectsGenerator.d.ts.map +1 -1
- package/dist/components/EffectsGenerator.js +0 -2
- package/dist/components/EffectsGroup.d.ts +6 -0
- package/dist/components/EffectsGroup.d.ts.map +1 -1
- package/dist/components/EffectsGroup.js +14 -4
- package/dist/components/FractalGrid.d.ts +23 -0
- package/dist/components/FractalGrid.d.ts.map +1 -0
- package/dist/components/FractalGrid.js +72 -0
- package/dist/components/Frame.d.ts.map +1 -1
- package/dist/components/Frame.js +2 -3
- package/dist/components/GalleryLayout.d.ts.map +1 -1
- package/dist/components/GalleryLayout.js +0 -3
- package/dist/components/GeometryShape.d.ts.map +1 -1
- package/dist/components/GeometryShape.js +0 -4
- package/dist/components/Glyphs.d.ts.map +1 -1
- package/dist/components/Glyphs.js +0 -1
- package/dist/components/GridsGenerator.d.ts +4 -1
- package/dist/components/GridsGenerator.d.ts.map +1 -1
- package/dist/components/GridsGenerator.js +28 -4
- package/dist/components/HdrPlaylistRenderer.d.ts.map +1 -1
- package/dist/components/HdrPlaylistRenderer.js +0 -1
- package/dist/components/HexGrid.d.ts +25 -0
- package/dist/components/HexGrid.d.ts.map +1 -0
- package/dist/components/HexGrid.js +72 -0
- package/dist/components/ImageGeometry.js +1 -1
- package/dist/components/Letter.d.ts.map +1 -1
- package/dist/components/Letter.js +1 -6
- package/dist/components/MoireGrid.d.ts +23 -0
- package/dist/components/MoireGrid.d.ts.map +1 -0
- package/dist/components/MoireGrid.js +76 -0
- package/dist/components/Moon.d.ts.map +1 -1
- package/dist/components/Moon.js +0 -1
- package/dist/components/ObjectNode.d.ts +1 -2
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +17 -20
- package/dist/components/ObjectNodeApi.d.ts +1 -2
- package/dist/components/ObjectNodeApi.d.ts.map +1 -1
- package/dist/components/ObjectNodeApi.js +7 -3
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +1 -4
- package/dist/components/ObjectsRendererApi.d.ts.map +1 -1
- package/dist/components/ObjectsRendererApi.js +4 -2
- package/dist/components/Ocean.d.ts.map +1 -1
- package/dist/components/Ocean.js +1 -4
- package/dist/components/ParticlesR3f.d.ts +0 -1
- package/dist/components/ParticlesR3f.d.ts.map +1 -1
- package/dist/components/PathRenderer.d.ts.map +1 -1
- package/dist/components/PathRenderer.js +0 -1
- package/dist/components/ProjectLoader.d.ts.map +1 -1
- package/dist/components/ProjectLoader.js +0 -28
- package/dist/components/QuasiGrid.d.ts +22 -0
- package/dist/components/QuasiGrid.d.ts.map +1 -0
- package/dist/components/QuasiGrid.js +68 -0
- package/dist/components/RadarGrid.d.ts +24 -0
- package/dist/components/RadarGrid.d.ts.map +1 -0
- package/dist/components/RadarGrid.js +71 -0
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +0 -1
- package/dist/components/ShootingStar.js +2 -2
- package/dist/components/ShootingStars.d.ts.map +1 -1
- package/dist/components/ShootingStars.js +0 -1
- package/dist/components/SkyController.d.ts.map +1 -1
- package/dist/components/SkyController.js +0 -3
- package/dist/components/Skybox.d.ts +5 -0
- package/dist/components/Skybox.d.ts.map +1 -1
- package/dist/components/Skybox.js +0 -1
- package/dist/components/SparklesBurst.d.ts.map +1 -1
- package/dist/components/SparklesBurst.js +0 -1
- package/dist/components/VoronoiGrid.d.ts +21 -0
- package/dist/components/VoronoiGrid.d.ts.map +1 -0
- package/dist/components/VoronoiGrid.js +67 -0
- package/dist/components/effects/ShockwaveEffect.d.ts.map +1 -1
- package/dist/components/effects/ShockwaveEffect.js +0 -1
- package/dist/components/effects/SmokeRibbon.d.ts.map +1 -1
- package/dist/components/effects/SmokeRibbon.js +0 -1
- package/dist/components/index.d.ts +19 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +9 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -1
- 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/use3driseShader.d.ts.map +1 -1
- package/dist/hooks/use3driseShader.js +0 -9
- package/dist/hooks/useAnimationEvents.d.ts.map +1 -1
- package/dist/hooks/useAnimationEvents.js +0 -19
- package/dist/hooks/useCameraAnimation.d.ts.map +1 -1
- package/dist/hooks/useCameraAnimation.js +0 -5
- package/dist/hooks/useContinuousEffects.d.ts +2 -3
- package/dist/hooks/useContinuousEffects.d.ts.map +1 -1
- package/dist/hooks/useContinuousEffects.js +16 -61
- package/dist/hooks/useFrameAnimations.d.ts.map +1 -1
- package/dist/hooks/useFrameAnimations.js +0 -4
- package/dist/hooks/useGridSurface.d.ts +46 -0
- package/dist/hooks/useGridSurface.d.ts.map +1 -0
- package/dist/hooks/useGridSurface.js +66 -0
- package/dist/hooks/useGsapAnimation.d.ts.map +1 -1
- package/dist/hooks/useGsapAnimation.js +0 -3
- package/dist/hooks/useInteraction.d.ts.map +1 -1
- package/dist/hooks/useInteraction.js +0 -25
- package/dist/hooks/useInteractionEffects.d.ts +2 -2
- package/dist/hooks/useInteractionEffects.d.ts.map +1 -1
- package/dist/hooks/useInteractionEffects.js +3 -1
- package/dist/hooks/useMaterialApplication.d.ts +2 -2
- package/dist/hooks/useMaterialApplication.d.ts.map +1 -1
- package/dist/hooks/useMaterialApplication.js +7 -18
- package/dist/hooks/useMaterialOptions.d.ts.map +1 -1
- package/dist/hooks/useMaterialOptions.js +0 -6
- package/dist/hooks/useMeshController.d.ts.map +1 -1
- package/dist/hooks/useMeshController.js +0 -16
- package/dist/hooks/useObjectAnimation.d.ts +13 -2
- package/dist/hooks/useObjectAnimation.d.ts.map +1 -1
- package/dist/hooks/useObjectAnimation.js +26 -28
- package/dist/hooks/useObjectEdges.d.ts +2 -1
- package/dist/hooks/useObjectEdges.d.ts.map +1 -1
- package/dist/hooks/useObjectEdges.js +15 -3
- package/dist/hooks/useObjectEffects.d.ts.map +1 -1
- package/dist/hooks/useObjectEffects.js +0 -4
- package/dist/hooks/useRegisterScene.d.ts +17 -0
- package/dist/hooks/useRegisterScene.d.ts.map +1 -0
- package/dist/hooks/useRegisterScene.js +33 -0
- package/dist/hooks/useSequenceAnimation.d.ts +2 -2
- package/dist/hooks/useSequenceAnimation.d.ts.map +1 -1
- package/dist/hooks/useSequenceAnimation.js +5 -70
- package/dist/hooks/useShadowApplication.d.ts +2 -2
- package/dist/hooks/useShadowApplication.d.ts.map +1 -1
- package/dist/hooks/useShadowApplication.js +6 -2
- package/dist/hooks/useSkyAnimation.d.ts.map +1 -1
- package/dist/hooks/useSkyAnimation.js +0 -1
- package/dist/hooks/useSkySystem.d.ts.map +1 -1
- package/dist/hooks/useSkySystem.js +0 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/services/AnimationsManager.d.ts.map +1 -1
- package/dist/services/AnimationsManager.js +0 -1
- package/dist/shaders/CircuitGridMaterial.d.ts +76 -0
- package/dist/shaders/CircuitGridMaterial.d.ts.map +1 -0
- package/dist/shaders/CircuitGridMaterial.js +298 -0
- package/dist/shaders/ContourGridMaterial.d.ts +80 -0
- package/dist/shaders/ContourGridMaterial.d.ts.map +1 -0
- package/dist/shaders/ContourGridMaterial.js +259 -0
- package/dist/shaders/FractalGridMaterial.d.ts +76 -0
- package/dist/shaders/FractalGridMaterial.d.ts.map +1 -0
- package/dist/shaders/FractalGridMaterial.js +247 -0
- package/dist/shaders/HexGridMaterial.d.ts +73 -0
- package/dist/shaders/HexGridMaterial.d.ts.map +1 -0
- package/dist/shaders/HexGridMaterial.js +265 -0
- package/dist/shaders/MoireGridMaterial.d.ts +79 -0
- package/dist/shaders/MoireGridMaterial.d.ts.map +1 -0
- package/dist/shaders/MoireGridMaterial.js +271 -0
- package/dist/shaders/QuasiGridMaterial.d.ts +76 -0
- package/dist/shaders/QuasiGridMaterial.d.ts.map +1 -0
- package/dist/shaders/QuasiGridMaterial.js +238 -0
- package/dist/shaders/RadarGridMaterial.d.ts +77 -0
- package/dist/shaders/RadarGridMaterial.d.ts.map +1 -0
- package/dist/shaders/RadarGridMaterial.js +291 -0
- package/dist/shaders/VoronoiGridMaterial.d.ts +73 -0
- package/dist/shaders/VoronoiGridMaterial.d.ts.map +1 -0
- package/dist/shaders/VoronoiGridMaterial.js +266 -0
- package/dist/types/gridConfigs.d.ts +202 -0
- package/dist/types/gridConfigs.d.ts.map +1 -0
- package/dist/types/gridConfigs.js +11 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/handleGenerativeEffectsAnimations.d.ts +0 -1
- package/dist/utils/handleGenerativeEffectsAnimations.d.ts.map +1 -1
- package/dist/utils/handleGenerativeEffectsAnimations.js +0 -29
- package/dist/utils/resolveObject3D.d.ts +20 -0
- package/dist/utils/resolveObject3D.d.ts.map +1 -0
- package/dist/utils/resolveObject3D.js +9 -0
- package/dist/utils/shapes.d.ts.map +1 -1
- package/dist/utils/shapes.js +0 -1
- package/package.json +4 -4
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef } from 'react';
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
5
|
+
import { useGridSurface } from '../hooks/useGridSurface.js';
|
|
6
|
+
import { MoireGridMaterial } from '@3driseai/3drise-core';
|
|
7
|
+
// Side-effect import registers <moireGridMaterial> via extend().
|
|
8
|
+
void MoireGridMaterial;
|
|
9
|
+
const SHAPE_INDEX = {
|
|
10
|
+
square: 0,
|
|
11
|
+
hex: 1,
|
|
12
|
+
rings: 2,
|
|
13
|
+
};
|
|
14
|
+
/** MoireGridConfig — the single source of truth for a moire grid instance. */
|
|
15
|
+
export const defaultMoireGridConfig = {
|
|
16
|
+
cellSize: 2.8,
|
|
17
|
+
size: 50,
|
|
18
|
+
segments: undefined,
|
|
19
|
+
flat: true,
|
|
20
|
+
lineMode: 0,
|
|
21
|
+
cellMode: 2, // steady nodes; the interference carries the motion
|
|
22
|
+
lineWidth: 1.4,
|
|
23
|
+
sectionSize: 12,
|
|
24
|
+
sectionWidth: 0,
|
|
25
|
+
animSpeed: 1,
|
|
26
|
+
animScale: 1,
|
|
27
|
+
animIntensity: 1,
|
|
28
|
+
fadeDistance: undefined,
|
|
29
|
+
fadeStrength: 0.7,
|
|
30
|
+
displace: 0,
|
|
31
|
+
shape: 'square',
|
|
32
|
+
layerAngle: 0.05,
|
|
33
|
+
layerScale: 1.06,
|
|
34
|
+
spin: 1,
|
|
35
|
+
lineColor: '#226bd9',
|
|
36
|
+
sectionColor: '#f2599e',
|
|
37
|
+
cellColor: '#0d1a40',
|
|
38
|
+
glowColor: '#99d9ff',
|
|
39
|
+
bgColor: '#02040d',
|
|
40
|
+
bgOpacity: 0,
|
|
41
|
+
followMouse: false,
|
|
42
|
+
reveal: 1,
|
|
43
|
+
revealDuration: 0,
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Two overlaid lattices, counter-rotating.
|
|
47
|
+
*
|
|
48
|
+
* Nothing draws the moire pattern — it emerges from where the two line sets
|
|
49
|
+
* nearly coincide, which is why it moves the way real interference does. Small
|
|
50
|
+
* `layerAngle` and `layerScale` values near 1 give the long, slow beats; larger
|
|
51
|
+
* ones break up into fine cross-hatch. `spin` 0 freezes it at `layerAngle`.
|
|
52
|
+
*
|
|
53
|
+
* `shape` picks what the two layers are made of. Rings have no orientation, so
|
|
54
|
+
* for that shape the layers are offset from each other rather than rotated.
|
|
55
|
+
*/
|
|
56
|
+
export function MoireGrid({ config = defaultMoireGridConfig, groupProps, onObjectReady, onObjectDispose }) {
|
|
57
|
+
const matRef = useRef(null);
|
|
58
|
+
const rootRef = useRef(null);
|
|
59
|
+
const meshRef = useRef(null);
|
|
60
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
61
|
+
const { cellSize, size, segments, flat, lineMode, cellMode, lineWidth, sectionSize, sectionWidth, animSpeed, animScale, animIntensity, fadeDistance, fadeStrength, displace, shape, layerAngle, layerScale, spin, lineColor, sectionColor, cellColor, glowColor, bgColor, bgOpacity, followMouse, reveal, revealDuration, } = config;
|
|
62
|
+
const segs = segments ?? (displace > 0
|
|
63
|
+
? Math.min(256, Math.max(64, Math.ceil(size / Math.max(cellSize, 1e-4)) * 2))
|
|
64
|
+
: 1);
|
|
65
|
+
const fade = fadeDistance ?? size * 0.5;
|
|
66
|
+
const colors = useMemo(() => ({
|
|
67
|
+
line: new THREE.Color(lineColor),
|
|
68
|
+
section: new THREE.Color(sectionColor),
|
|
69
|
+
cell: new THREE.Color(cellColor),
|
|
70
|
+
glow: new THREE.Color(glowColor),
|
|
71
|
+
bg: new THREE.Color(bgColor),
|
|
72
|
+
}), [lineColor, sectionColor, cellColor, glowColor, bgColor]);
|
|
73
|
+
useGridSurface(matRef, meshRef, { followMouse, reveal, revealDuration });
|
|
74
|
+
return (_jsx("group", { ref: rootRef, ...groupProps, children: _jsxs("mesh", { ref: meshRef, rotation: flat ? [-Math.PI / 2, 0, 0] : [0, 0, 0], children: [_jsx("planeGeometry", { args: [size, size, segs, segs] }), _jsx("moireGridMaterial", { ref: matRef, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending, side: THREE.DoubleSide, u_cellSize: cellSize, u_lineWidth: lineWidth, u_sectionSize: sectionSize, u_sectionWidth: sectionWidth, u_lineMode: lineMode, u_cellMode: cellMode, u_animSpeed: animSpeed, u_animScale: animScale, u_animIntensity: animIntensity, u_fadeDistance: fade, u_fadeStrength: fadeStrength, u_displace: displace, u_shape: SHAPE_INDEX[shape] ?? 0, u_layerAngle: layerAngle, u_layerScale: layerScale, u_spin: spin, u_lineColor: colors.line, u_sectionColor: colors.section, u_cellColor: colors.cell, u_glowColor: colors.glow, u_bgColor: colors.bg, u_bgOpacity: bgOpacity }, MoireGridMaterial.key)] }) }));
|
|
75
|
+
}
|
|
76
|
+
export default MoireGrid;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Moon.d.ts","sourceRoot":"","sources":["../../src/components/Moon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IAC/C,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED,YAAY,EAAE,YAAY,EAAE,CAAC;AAG7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"Moon.d.ts","sourceRoot":"","sources":["../../src/components/Moon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IAC/C,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED,YAAY,EAAE,YAAY,EAAE,CAAC;AAG7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAyD7B,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/dist/components/Moon.js
CHANGED
|
@@ -17,7 +17,6 @@ const Moon = ({ settings, sunPosition, onObjectReady, onObjectDispose }) => {
|
|
|
17
17
|
loader.setCrossOrigin('anonymous');
|
|
18
18
|
let cancelled = false;
|
|
19
19
|
loader.load(MOON_TEXTURE_URL, (loaded) => {
|
|
20
|
-
console.log("Moon texture loaded:", loaded);
|
|
21
20
|
if (!cancelled)
|
|
22
21
|
setTexture(loaded);
|
|
23
22
|
}, undefined, () => {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { ObjectReadyProps } from "../types/objectReady";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Object3D } from "three";
|
|
4
|
-
import type {
|
|
4
|
+
import type { CreatedObjectSettings, ObjectTreeNode } from "@3driseai/3drise-core";
|
|
5
5
|
import { type ThreeEvent } from "@react-three/fiber";
|
|
6
6
|
type ObjectNodeProps = ObjectReadyProps & {
|
|
7
7
|
node: ObjectTreeNode;
|
|
8
|
-
cameraSettings: CameraState;
|
|
9
8
|
handleObjectClick?: (object: CreatedObjectSettings, ref: Object3D, event: ThreeEvent<MouseEvent>) => void;
|
|
10
9
|
};
|
|
11
10
|
declare const ObjectNode: React.FC<ObjectNodeProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAe,qBAAqB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,KAAK,eAAe,GAAG,gBAAgB,GAAG;IACtC,IAAI,EAAE,cAAc,CAAC;IACrB,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7G,CAAC;AA0BF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAyGzC,CAAC;AACF,eAAe,UAAU,CAAC"}
|
|
@@ -30,14 +30,13 @@ const SELF_MANAGED_MATERIAL = new Set([
|
|
|
30
30
|
// ))}
|
|
31
31
|
// </>
|
|
32
32
|
// ) : null;
|
|
33
|
-
const GroupWithChildren = ({ createdObject, children,
|
|
33
|
+
const GroupWithChildren = ({ createdObject, children, onObjectReady, onObjectDispose, handleObjectClick, renderObject }) => {
|
|
34
34
|
const isGroup = createdObject.type === 'group';
|
|
35
35
|
const selfManagedMaterial = SELF_MANAGED_MATERIAL.has(createdObject.type);
|
|
36
|
-
return (_jsxs(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !isGroup && !selfManagedMaterial, children: [!isGroup && renderObject(createdObject, handleObjectClick), children.map(childNode => (_jsx(ObjectNode, { node: childNode,
|
|
36
|
+
return (_jsxs(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !isGroup && !selfManagedMaterial, children: [!isGroup && renderObject(createdObject, handleObjectClick), children.map(childNode => (_jsx(ObjectNode, { node: childNode, handleObjectClick: handleObjectClick, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, childNode.objectId)))] }, createdObject.id));
|
|
37
37
|
};
|
|
38
|
-
const ObjectNode = ({ node,
|
|
38
|
+
const ObjectNode = ({ node, onObjectReady, onObjectDispose, handleObjectClick }) => {
|
|
39
39
|
const { children, createdObject } = node;
|
|
40
|
-
// console.log(createdObject.meshSettings.name, createdObject.actions, createdObject.mouseMove)
|
|
41
40
|
// Children describe themselves with their own settings; the scene above
|
|
42
41
|
// knows them by the node's createdObject, so relabel on the way up.
|
|
43
42
|
const relabel = useCallback((obj) => ({
|
|
@@ -47,7 +46,7 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, onObjectDispose, hand
|
|
|
47
46
|
// Specialized renderers for each object type
|
|
48
47
|
const renderers = useMemo(() => ({
|
|
49
48
|
group: () => null,
|
|
50
|
-
mesh: (obj,
|
|
49
|
+
mesh: (obj, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick }, obj.id)),
|
|
51
50
|
// water: (obj: CreatedObjectSettings, cameraSettings: CameraState, onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void) => (
|
|
52
51
|
// <Ocean
|
|
53
52
|
// settings={obj}
|
|
@@ -63,7 +62,7 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, onObjectDispose, hand
|
|
|
63
62
|
// settings={obj}
|
|
64
63
|
// />
|
|
65
64
|
// ),
|
|
66
|
-
model: (obj,
|
|
65
|
+
model: (obj, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick }, obj.id)),
|
|
67
66
|
// custom_primitive: (obj: CreatedObjectSettings, cameraSettings: CameraState, onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void) => (
|
|
68
67
|
// <CustomPrimitive
|
|
69
68
|
// key={obj.id}
|
|
@@ -72,27 +71,27 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, onObjectDispose, hand
|
|
|
72
71
|
// handleObjectClick={handleObjectClick}
|
|
73
72
|
// />
|
|
74
73
|
// ),
|
|
75
|
-
text: (obj,
|
|
74
|
+
text: (obj, onObjectReady) => {
|
|
76
75
|
const renderMode = obj.config?.renderMode ?? 'bitmap';
|
|
77
76
|
return (_jsx(_Fragment, { children: renderMode === 'text3d'
|
|
78
77
|
? _jsx(Text3D, { textSettings: obj, ...relabel(obj) })
|
|
79
78
|
: _jsx(Text2D, { textSettings: obj, ...relabel(obj) }) }));
|
|
80
79
|
},
|
|
81
|
-
particles: (obj,
|
|
80
|
+
particles: (obj, onObjectReady) => {
|
|
82
81
|
const particlesSettings = obj;
|
|
83
|
-
return (_jsxs(_Fragment, { children: [particlesSettings.config?.particles && (_jsx(ParticlesR3f, { particlesSettings: particlesSettings,
|
|
82
|
+
return (_jsxs(_Fragment, { children: [particlesSettings.config?.particles && (_jsx(ParticlesR3f, { particlesSettings: particlesSettings, duration: 1, transitionSettings: particlesSettings.meshSettings, ...relabel(obj) })), particlesSettings.config?.paths && (_jsx(Lines, { createdObject: particlesSettings, ...relabel(obj) }))] }));
|
|
84
83
|
},
|
|
85
|
-
path: (obj,
|
|
86
|
-
grid: (obj,
|
|
84
|
+
path: (obj, onObjectReady) => (_jsx(PathRenderer, { pathSettings: obj.config, ...relabel(obj) }, obj.id)),
|
|
85
|
+
grid: (obj, onObjectReady) => (
|
|
87
86
|
// <GridHelper {...(obj.config as GridConfig)} side={2} />
|
|
88
87
|
_jsx(GridGenerator, { config: obj.config, ...relabel(obj) })),
|
|
89
88
|
effect: (obj) => (_jsx(EffectsGenerator, { settings: {
|
|
90
89
|
config: obj.config,
|
|
91
90
|
}, ...relabel(obj) }, obj.id)),
|
|
92
|
-
gallery: (obj,
|
|
93
|
-
light: (obj,
|
|
94
|
-
environment: (obj,
|
|
95
|
-
space: (obj,
|
|
91
|
+
gallery: (obj, onObjectReady) => (_jsx(GalleryLayout, { createdObject: obj, handleObjectClick: handleObjectClick, ...relabel(obj) })),
|
|
92
|
+
light: (obj, onObjectReady) => (_jsx(LightObject, { createdObject: obj, ...relabel(obj) })),
|
|
93
|
+
environment: (obj, onObjectReady) => (_jsx(EnvironmentObject, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })),
|
|
94
|
+
space: (obj, onObjectReady) => (_jsx(Galaxy, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })),
|
|
96
95
|
// rain: (obj: CreatedObjectSettings, cameraSettings: CameraState, onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void) => (
|
|
97
96
|
// <Rain
|
|
98
97
|
// settings={obj}
|
|
@@ -115,18 +114,16 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, onObjectDispose, hand
|
|
|
115
114
|
// ),
|
|
116
115
|
}), [handleObjectClick, onObjectReady, onObjectDispose, relabel]);
|
|
117
116
|
const renderObject = useCallback((obj, handleObjectClick) => {
|
|
118
|
-
// console.log('Rendering object:', obj);
|
|
119
117
|
const renderer = renderers[obj.type];
|
|
120
|
-
return renderer?.(obj,
|
|
121
|
-
}, [
|
|
118
|
+
return renderer?.(obj, onObjectReady) ?? null;
|
|
119
|
+
}, [onObjectReady, renderers]);
|
|
122
120
|
if (!createdObject) {
|
|
123
|
-
console.warn(`createdObject not found.`);
|
|
124
121
|
return null;
|
|
125
122
|
}
|
|
126
123
|
const hasChildren = children.length > 0;
|
|
127
124
|
const shouldRenderAsGroup = hasChildren || createdObject.type === 'group' || createdObject.type === 'effect';
|
|
128
125
|
const renderedObject = shouldRenderAsGroup
|
|
129
|
-
? _jsx(GroupWithChildren, { createdObject: createdObject, children: children,
|
|
126
|
+
? _jsx(GroupWithChildren, { createdObject: createdObject, children: children, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, renderObject: renderObject })
|
|
130
127
|
: _jsx(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !SELF_MANAGED_MATERIAL.has(createdObject.type), children: renderObject(createdObject) }, createdObject.id);
|
|
131
128
|
// createdObject.effects
|
|
132
129
|
// ? <>
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { ObjectReadyProps } from '../types/objectReady';
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Object3D } from "three";
|
|
4
|
-
import type {
|
|
4
|
+
import type { CreatedObjectSettings } from "@3driseai/3drise-core";
|
|
5
5
|
import { type ThreeEvent } from "@react-three/fiber";
|
|
6
6
|
type ObjectNodeApiProps = ObjectReadyProps & {
|
|
7
7
|
objectId: string;
|
|
8
|
-
cameraSettings: CameraState;
|
|
9
8
|
handleObjectClick?: (object: CreatedObjectSettings, ref: Object3D, event: ThreeEvent<MouseEvent>) => void;
|
|
10
9
|
};
|
|
11
10
|
declare const ObjectNodeApi: React.FC<ObjectNodeApiProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectNodeApi.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNodeApi.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ObjectNodeApi.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNodeApi.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAe,qBAAqB,EAAkB,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,KAAK,kBAAkB,GAAG,gBAAgB,GAAG;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7G,CAAC;AAGF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAc/C,CAAC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -2,17 +2,21 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
// import { apiFetch } from '../utils/apiFetch';
|
|
4
4
|
import ObjectNode from './ObjectNode.js';
|
|
5
|
+
import { useRegisterScene } from '../hooks/useRegisterScene.js';
|
|
5
6
|
import { dataCenterServer } from '../constants.js';
|
|
6
|
-
const ObjectNodeApi = ({ objectId,
|
|
7
|
+
const ObjectNodeApi = ({ objectId, onObjectReady, onObjectDispose, handleObjectClick }) => {
|
|
8
|
+
// Publish the host application's canvas so id-based lookups resolve here
|
|
9
|
+
// too — SceneBuilder is not in this tree to do it.
|
|
10
|
+
useRegisterScene();
|
|
7
11
|
const [node, setNode] = useState(null);
|
|
8
12
|
useEffect(() => {
|
|
9
13
|
fetch(`${dataCenterServer}scene-objects/${objectId}/tree`)
|
|
10
14
|
.then(res => res.ok ? res.json() : Promise.reject(res.status))
|
|
11
15
|
.then(({ tree }) => setNode(tree))
|
|
12
|
-
.catch(
|
|
16
|
+
.catch(() => { });
|
|
13
17
|
}, [objectId]);
|
|
14
18
|
if (!node)
|
|
15
19
|
return null;
|
|
16
|
-
return (_jsx(ObjectNode, { node: node,
|
|
20
|
+
return (_jsx(ObjectNode, { node: node, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick }));
|
|
17
21
|
};
|
|
18
22
|
export default ObjectNodeApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectsRenderer.d.ts","sourceRoot":"","sources":["../../src/components/ObjectsRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAI1H,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,UAAU,oBAAqB,SAAQ,gBAAgB;IACnD,cAAc,EAAE,WAAW,CAAC;IAC5B,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,cAAc,EAAE,qBAAqB,EAAE,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC1G,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACnC;AAGD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ObjectsRenderer.d.ts","sourceRoot":"","sources":["../../src/components/ObjectsRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAI1H,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,UAAU,oBAAqB,SAAQ,gBAAgB;IACnD,cAAc,EAAE,WAAW,CAAC;IAC5B,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,cAAc,EAAE,qBAAqB,EAAE,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC1G,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACnC;AAGD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA0ClD,CAAC;AAEH,eAAe,eAAe,CAAC"}
|
|
@@ -14,7 +14,6 @@ const ObjectsRenderer = memo(({ cameraSettings, createdObjects, generalObjectSet
|
|
|
14
14
|
const handleObjectReady = useCallback((object, ref) => {
|
|
15
15
|
readyObjectsCount.current += 1;
|
|
16
16
|
if (readyObjectsCount.current === objectsTree.length) {
|
|
17
|
-
console.log("All objects are ready!");
|
|
18
17
|
onObjectsReady && onObjectsReady();
|
|
19
18
|
}
|
|
20
19
|
onObjectReady && onObjectReady(object, ref);
|
|
@@ -35,8 +34,6 @@ const ObjectsRenderer = memo(({ cameraSettings, createdObjects, generalObjectSet
|
|
|
35
34
|
sequences,
|
|
36
35
|
});
|
|
37
36
|
const handleObjectClickHandler = (createdObject, ref, event) => {
|
|
38
|
-
console.log('Object clicked:', createdObject.meshSettings.name);
|
|
39
|
-
console.log('Object ref:', ref);
|
|
40
37
|
const clickInteractions = filterInteractionsByEvent(createdObject.actions, "click");
|
|
41
38
|
clickInteractions.forEach((interaction) => {
|
|
42
39
|
executeInteraction({ interaction, ref, createdObject });
|
|
@@ -45,7 +42,7 @@ const ObjectsRenderer = memo(({ cameraSettings, createdObjects, generalObjectSet
|
|
|
45
42
|
handleObjectClick(createdObject, ref, event);
|
|
46
43
|
}
|
|
47
44
|
};
|
|
48
|
-
return (_jsx("group", { ref: groupRef, name: "main-objects", position: generalObjectSettings.meshSettings.position, rotation: generalObjectSettings.meshSettings.rotation, scale: generalObjectSettings.meshSettings.scale, children: objectsTree.map(node => (_jsx(ObjectNode, { node: node,
|
|
45
|
+
return (_jsx("group", { ref: groupRef, name: "main-objects", position: generalObjectSettings.meshSettings.position, rotation: generalObjectSettings.meshSettings.rotation, scale: generalObjectSettings.meshSettings.scale, children: objectsTree.map(node => (_jsx(ObjectNode, { node: node, onObjectReady: handleObjectReady, onObjectDispose: handleObjectDispose, handleObjectClick: handleObjectClickHandler }, node.objectId))) }));
|
|
49
46
|
});
|
|
50
47
|
ObjectsRenderer.displayName = 'ObjectsRenderer';
|
|
51
48
|
export default ObjectsRenderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectsRendererApi.d.ts","sourceRoot":"","sources":["../../src/components/ObjectsRendererApi.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ObjectsRendererApi.d.ts","sourceRoot":"","sources":["../../src/components/ObjectsRendererApi.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC7D,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,WAAW,CAAC;IAC5B,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC1G,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAGD;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA0DzD,CAAC;AACF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import ObjectsRenderer from './ObjectsRenderer.js';
|
|
4
|
+
import { useRegisterScene } from '../hooks/useRegisterScene.js';
|
|
4
5
|
/**
|
|
5
6
|
* ObjectsRendererApi
|
|
6
7
|
*
|
|
@@ -16,6 +17,9 @@ import ObjectsRenderer from './ObjectsRenderer.js';
|
|
|
16
17
|
* />
|
|
17
18
|
*/
|
|
18
19
|
const ObjectsRendererApi = ({ objectIds, cameraSettings, generalObjectSettings, apiBaseUrl = 'http://localhost:3001', onObjectsReady, handleObjectClick, onError, onLoading, onObjectReady, onObjectDispose, }) => {
|
|
20
|
+
// Publish the host application's canvas so id-based lookups resolve here
|
|
21
|
+
// too — SceneBuilder is not in this tree to do it.
|
|
22
|
+
useRegisterScene();
|
|
19
23
|
const [createdObjects, setCreatedObjects] = useState([]);
|
|
20
24
|
const [isLoading, setIsLoading] = useState(true);
|
|
21
25
|
const [error, setError] = useState(null);
|
|
@@ -59,7 +63,6 @@ const ObjectsRendererApi = ({ objectIds, cameraSettings, generalObjectSettings,
|
|
|
59
63
|
onError?.(error);
|
|
60
64
|
setIsLoading(false);
|
|
61
65
|
onLoading?.(false);
|
|
62
|
-
console.error('Failed to fetch scene objects:', error);
|
|
63
66
|
}
|
|
64
67
|
};
|
|
65
68
|
fetchObjects();
|
|
@@ -68,7 +71,6 @@ const ObjectsRendererApi = ({ objectIds, cameraSettings, generalObjectSettings,
|
|
|
68
71
|
return (_jsx("group", { children: _jsxs("mesh", { position: [0, 0, 0], children: [_jsx("sphereGeometry", { args: [0.5, 32, 32] }), _jsx("meshStandardMaterial", { color: 0x00ff00, wireframe: true })] }) }));
|
|
69
72
|
}
|
|
70
73
|
if (error) {
|
|
71
|
-
console.error('ObjectsRendererApi Error:', error);
|
|
72
74
|
return (_jsx("group", { children: _jsxs("mesh", { position: [0, 0, 0], children: [_jsx("sphereGeometry", { args: [0.5, 32, 32] }), _jsx("meshStandardMaterial", { color: 0xff0000, wireframe: true })] }) }));
|
|
73
75
|
}
|
|
74
76
|
return (_jsx(ObjectsRenderer, { cameraSettings: cameraSettings, createdObjects: createdObjects, generalObjectSettings: generalObjectSettings, onObjectsReady: onObjectsReady, handleObjectClick: handleObjectClick, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ocean.d.ts","sourceRoot":"","sources":["../../src/components/Ocean.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAU7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAChD,QAAQ,EAAE,qBAAqB,CAAC;CACnC;AAGD,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"Ocean.d.ts","sourceRoot":"","sources":["../../src/components/Ocean.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAU7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAChD,QAAQ,EAAE,qBAAqB,CAAC;CACnC;AAGD,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA6J/B,CAAC;AACF,eAAe,KAAK,CAAC"}
|
package/dist/components/Ocean.js
CHANGED
|
@@ -26,7 +26,7 @@ const Ocean = ({ settings, onObjectReady, onObjectDispose }) => {
|
|
|
26
26
|
const position = meshSettings.position || [0, -1, 0];
|
|
27
27
|
const rotation = meshSettings.rotation || [-Math.PI / 2, 0, 0];
|
|
28
28
|
const scale = meshSettings.scale || 1;
|
|
29
|
-
useMaterialApplication(meshSettings.visible ? meshRef
|
|
29
|
+
useMaterialApplication(meshSettings.visible ? meshRef : null, materialSettings);
|
|
30
30
|
useWaterEnvironment(meshSettings.visible ? meshRef : { current: null });
|
|
31
31
|
useWaterReflections(meshSettings.visible ? meshRef : { current: null }, {
|
|
32
32
|
waterPosition: new THREE.Vector3(...position),
|
|
@@ -136,7 +136,6 @@ const Ocean = ({ settings, onObjectReady, onObjectDispose }) => {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
// ── PER-DOMAIN ANIMATIONS ───────────────────────────────────────────────
|
|
140
139
|
const now = Date.now();
|
|
141
140
|
const transformAnims = animations?.transform?.animations;
|
|
142
141
|
if (transformAnims?.length) {
|
|
@@ -146,7 +145,6 @@ const Ocean = ({ settings, onObjectReady, onObjectDispose }) => {
|
|
|
146
145
|
if (materialAnims?.length) {
|
|
147
146
|
handleMaterialAnimations({ object: mesh, materialSettings: materialSettings, startValuesCache: matAnimCacheRef.current }, materialAnims, now, false);
|
|
148
147
|
}
|
|
149
|
-
// ── PER-DOMAIN MOUSE-MOVE ───────────────────────────────────────────────
|
|
150
148
|
const mm = mouseMove;
|
|
151
149
|
const isPerDomain = mm && ('transform' in mm || 'material' in mm);
|
|
152
150
|
if (isPerDomain) {
|
|
@@ -159,7 +157,6 @@ const Ocean = ({ settings, onObjectReady, onObjectDispose }) => {
|
|
|
159
157
|
}
|
|
160
158
|
}
|
|
161
159
|
});
|
|
162
|
-
// console.log(rotation)
|
|
163
160
|
return (_jsx("mesh", { ref: meshRef,
|
|
164
161
|
// name={settings.meshSettings.name || 'Water'}
|
|
165
162
|
// position={position}
|
|
@@ -3,7 +3,6 @@ import type { ParticlesSettings } from '@3driseai/3drise-core';
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
interface ParticlesR3fProps extends ObjectReadyProps {
|
|
5
5
|
particlesSettings: ParticlesSettings;
|
|
6
|
-
cameraFov?: number;
|
|
7
6
|
duration?: number;
|
|
8
7
|
transitionSettings?: Record<string, unknown>;
|
|
9
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParticlesR3f.d.ts","sourceRoot":"","sources":["../../src/components/ParticlesR3f.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAO7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,UAAU,iBAAkB,SAAQ,gBAAgB;IAChD,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,
|
|
1
|
+
{"version":3,"file":"ParticlesR3f.d.ts","sourceRoot":"","sources":["../../src/components/ParticlesR3f.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAO7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,UAAU,iBAAkB,SAAQ,gBAAgB;IAChD,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChD;AAMD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAkG7C,CAAC;AACF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathRenderer.d.ts","sourceRoot":"","sources":["../../src/components/PathRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACvD,YAAY,EAAE,UAAU,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAGD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"PathRenderer.d.ts","sourceRoot":"","sources":["../../src/components/PathRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACvD,YAAY,EAAE,UAAU,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAGD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA8B7C,CAAC;AACF,eAAe,YAAY,CAAC"}
|
|
@@ -8,7 +8,6 @@ import PathGeometry from './PathGeometry.js';
|
|
|
8
8
|
const PathRenderer = ({ pathSettings, color = '#ffa500', showPoints = true, showLine = true, showCurve = true, onObjectReady, onObjectDispose, }) => {
|
|
9
9
|
const rootRef = useRef(null);
|
|
10
10
|
useObjectReady(rootRef, pathSettings, onObjectReady, onObjectDispose);
|
|
11
|
-
console.log("Rendering Path with settings:", pathSettings);
|
|
12
11
|
const pointSize = pathSettings.pointSize ?? 0.1;
|
|
13
12
|
const lineWidth = pathSettings.lineWidth ?? 2;
|
|
14
13
|
const points = pathSettings?.points || [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectLoader.d.ts","sourceRoot":"","sources":["../../src/components/ProjectLoader.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,KAAK,YAAY,GAAG,gBAAgB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACtG,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAChD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACvD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;
|
|
1
|
+
{"version":3,"file":"ProjectLoader.d.ts","sourceRoot":"","sources":["../../src/components/ProjectLoader.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,KAAK,YAAY,GAAG,gBAAgB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACtG,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAChD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACvD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;AAGF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAqDzC,CAAC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -5,7 +5,6 @@ import SceneBuilder from "./SceneBuilder.js";
|
|
|
5
5
|
import { loadAssets, } from "@3driseai/3drise-core";
|
|
6
6
|
import LoadingIndicator from "./LoadingIndicator.js";
|
|
7
7
|
import { useMeshController } from "../hooks/useMeshController.js";
|
|
8
|
-
const PROJECT_LOADER_DEBUG_PREFIX = '[ProjectLoaderDebug]';
|
|
9
8
|
const ProjectLoader = ({ projectId, onObjectClick, onObjectHover, onElementClick, onElementHover, onSceneInitialized, onObjectReady, onObjectDispose, loadingIndicator = _jsx(LoadingIndicator, { text: "Loading project...", fullScreen: true, animate: true }) }) => {
|
|
10
9
|
const [project, setProject] = useState(null);
|
|
11
10
|
const meshController = useMeshController();
|
|
@@ -17,22 +16,12 @@ const ProjectLoader = ({ projectId, onObjectClick, onObjectHover, onElementClick
|
|
|
17
16
|
const loadProject = async (projectId) => {
|
|
18
17
|
try {
|
|
19
18
|
const url = `${dataCenterServer}projects/${projectId}/view`;
|
|
20
|
-
console.log(PROJECT_LOADER_DEBUG_PREFIX, 'Fetching project', {
|
|
21
|
-
projectId,
|
|
22
|
-
url,
|
|
23
|
-
});
|
|
24
19
|
const response = await fetch(url, {
|
|
25
20
|
method: "GET",
|
|
26
21
|
headers: {
|
|
27
22
|
"Content-Type": "application/json",
|
|
28
23
|
},
|
|
29
24
|
});
|
|
30
|
-
console.log(PROJECT_LOADER_DEBUG_PREFIX, 'Received project response', {
|
|
31
|
-
projectId,
|
|
32
|
-
status: response.status,
|
|
33
|
-
ok: response.ok,
|
|
34
|
-
url,
|
|
35
|
-
});
|
|
36
25
|
if (!response.ok) {
|
|
37
26
|
if (response.status === 404) {
|
|
38
27
|
throw new Error("Project not found");
|
|
@@ -40,36 +29,22 @@ const ProjectLoader = ({ projectId, onObjectClick, onObjectHover, onElementClick
|
|
|
40
29
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
41
30
|
}
|
|
42
31
|
const responseData = await response.json();
|
|
43
|
-
// console.log(PROJECT_LOADER_DEBUG_PREFIX, 'Parsed project payload', {
|
|
44
|
-
// projectId,
|
|
45
|
-
// sceneObjectsCount: responseData.sceneObjects?.length || 0,
|
|
46
|
-
// projectName: responseData.name,
|
|
47
|
-
// });
|
|
48
|
-
console.log("Loaded project:", responseData);
|
|
49
32
|
const sceneObjects = responseData.sceneObjects || [];
|
|
50
33
|
const modelObjects = sceneObjects.filter(obj => obj.type === 'model');
|
|
51
34
|
const meshObjects = sceneObjects.filter(obj => obj.type === 'mesh');
|
|
52
|
-
console.log('Model objects in loaded project:', modelObjects);
|
|
53
35
|
try {
|
|
54
36
|
const models = modelObjects.map(obj => ({
|
|
55
37
|
...obj.userData,
|
|
56
38
|
id: obj.id,
|
|
57
39
|
}));
|
|
58
40
|
await loadAssets(models);
|
|
59
|
-
console.log('[useLoadProject] Assets loaded for model objects');
|
|
60
41
|
}
|
|
61
42
|
catch (assetError) {
|
|
62
|
-
console.error('[useLoadProject] Failed to load model assets, continuing with project load:', assetError);
|
|
63
43
|
}
|
|
64
44
|
// meshController.createObjects(meshObjects);
|
|
65
|
-
console.log("PROJECT LOAD COMPLETE");
|
|
66
45
|
setProject(responseData);
|
|
67
46
|
}
|
|
68
47
|
catch (error) {
|
|
69
|
-
console.error(PROJECT_LOADER_DEBUG_PREFIX, 'Error fetching project', {
|
|
70
|
-
projectId,
|
|
71
|
-
error,
|
|
72
|
-
});
|
|
73
48
|
}
|
|
74
49
|
};
|
|
75
50
|
if (!project) {
|
|
@@ -80,9 +55,6 @@ const ProjectLoader = ({ projectId, onObjectClick, onObjectHover, onElementClick
|
|
|
80
55
|
flexDirection: 'column', gap: '1rem'
|
|
81
56
|
}, children: loadingIndicator });
|
|
82
57
|
}
|
|
83
|
-
console.log(PROJECT_LOADER_DEBUG_PREFIX, 'Rendering SceneBuilder with project', {
|
|
84
|
-
project
|
|
85
|
-
});
|
|
86
58
|
return _jsx(_Fragment, { children: _jsx(SceneBuilder, { project: project, onSceneInitialized: onSceneInitialized, onUiElementClick: onElementClick, onUiElementHover: onElementHover, onObjectClick: onObjectClick, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }) });
|
|
87
59
|
};
|
|
88
60
|
export default ProjectLoader;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ThreeElements } from '@react-three/fiber';
|
|
2
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
3
|
+
import type { QuasiGridConfig } from '../types/gridConfigs';
|
|
4
|
+
export interface QuasiGridProps extends ObjectReadyProps {
|
|
5
|
+
config?: QuasiGridConfig;
|
|
6
|
+
groupProps?: ThreeElements['group'];
|
|
7
|
+
}
|
|
8
|
+
/** QuasiGridConfig — the single source of truth for a quasicrystal grid instance. */
|
|
9
|
+
export declare const defaultQuasiGridConfig: QuasiGridConfig;
|
|
10
|
+
/**
|
|
11
|
+
* An aperiodic quasicrystal lattice, built as a de Bruijn multigrid: `symmetry`
|
|
12
|
+
* families of evenly spaced parallel lines spread over a half turn.
|
|
13
|
+
*
|
|
14
|
+
* Where the angles do not divide the half turn evenly the intersections never
|
|
15
|
+
* repeat, so unlike every other grid in this package the pattern is genuinely
|
|
16
|
+
* non-periodic — pan as far as you like and it never comes back around. 5 is
|
|
17
|
+
* Penrose. 4 and 6 do divide evenly and so come out periodic, which makes them
|
|
18
|
+
* a useful sanity check rather than a bug.
|
|
19
|
+
*/
|
|
20
|
+
export declare function QuasiGrid({ config, groupProps, onObjectReady, onObjectDispose }: QuasiGridProps): import("react").JSX.Element;
|
|
21
|
+
export default QuasiGrid;
|
|
22
|
+
//# sourceMappingURL=QuasiGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuasiGrid.d.ts","sourceRoot":"","sources":["../../src/components/QuasiGrid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACpD,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,UAAU,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACvC;AAKD,qFAAqF;AACrF,eAAO,MAAM,sBAAsB,EAAE,eA2BpC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,EAAE,MAA+B,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,cAAc,+BAgExH;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef } from 'react';
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
5
|
+
import { useGridSurface } from '../hooks/useGridSurface.js';
|
|
6
|
+
import { QuasiGridMaterial } from '@3driseai/3drise-core';
|
|
7
|
+
// Side-effect import registers <quasiGridMaterial> via extend().
|
|
8
|
+
void QuasiGridMaterial;
|
|
9
|
+
/** QuasiGridConfig — the single source of truth for a quasicrystal grid instance. */
|
|
10
|
+
export const defaultQuasiGridConfig = {
|
|
11
|
+
cellSize: 3,
|
|
12
|
+
size: 50,
|
|
13
|
+
segments: undefined,
|
|
14
|
+
flat: true,
|
|
15
|
+
lineMode: 1, // ripple out from the focus point
|
|
16
|
+
cellMode: 2, // twinkle
|
|
17
|
+
lineWidth: 1.2,
|
|
18
|
+
sectionSize: 5,
|
|
19
|
+
sectionWidth: 2,
|
|
20
|
+
animSpeed: 1,
|
|
21
|
+
animScale: 0.5,
|
|
22
|
+
animIntensity: 1,
|
|
23
|
+
fadeDistance: undefined,
|
|
24
|
+
fadeStrength: 0.7,
|
|
25
|
+
displace: 0,
|
|
26
|
+
symmetry: 5, // Penrose
|
|
27
|
+
phase: 0.2,
|
|
28
|
+
lineColor: '#8c4d1f',
|
|
29
|
+
sectionColor: '#ffc759',
|
|
30
|
+
cellColor: '#381a08',
|
|
31
|
+
glowColor: '#ffa640',
|
|
32
|
+
bgColor: '#0d0503',
|
|
33
|
+
bgOpacity: 0,
|
|
34
|
+
followMouse: false,
|
|
35
|
+
reveal: 1,
|
|
36
|
+
revealDuration: 0,
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* An aperiodic quasicrystal lattice, built as a de Bruijn multigrid: `symmetry`
|
|
40
|
+
* families of evenly spaced parallel lines spread over a half turn.
|
|
41
|
+
*
|
|
42
|
+
* Where the angles do not divide the half turn evenly the intersections never
|
|
43
|
+
* repeat, so unlike every other grid in this package the pattern is genuinely
|
|
44
|
+
* non-periodic — pan as far as you like and it never comes back around. 5 is
|
|
45
|
+
* Penrose. 4 and 6 do divide evenly and so come out periodic, which makes them
|
|
46
|
+
* a useful sanity check rather than a bug.
|
|
47
|
+
*/
|
|
48
|
+
export function QuasiGrid({ config = defaultQuasiGridConfig, groupProps, onObjectReady, onObjectDispose }) {
|
|
49
|
+
const matRef = useRef(null);
|
|
50
|
+
const rootRef = useRef(null);
|
|
51
|
+
const meshRef = useRef(null);
|
|
52
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
53
|
+
const { cellSize, size, segments, flat, lineMode, cellMode, lineWidth, sectionSize, sectionWidth, animSpeed, animScale, animIntensity, fadeDistance, fadeStrength, displace, symmetry, phase, lineColor, sectionColor, cellColor, glowColor, bgColor, bgOpacity, followMouse, reveal, revealDuration, } = config;
|
|
54
|
+
const segs = segments ?? (displace > 0
|
|
55
|
+
? Math.min(256, Math.max(64, Math.ceil(size / Math.max(cellSize, 1e-4)) * 2))
|
|
56
|
+
: 1);
|
|
57
|
+
const fade = fadeDistance ?? size * 0.5;
|
|
58
|
+
const colors = useMemo(() => ({
|
|
59
|
+
line: new THREE.Color(lineColor),
|
|
60
|
+
section: new THREE.Color(sectionColor),
|
|
61
|
+
cell: new THREE.Color(cellColor),
|
|
62
|
+
glow: new THREE.Color(glowColor),
|
|
63
|
+
bg: new THREE.Color(bgColor),
|
|
64
|
+
}), [lineColor, sectionColor, cellColor, glowColor, bgColor]);
|
|
65
|
+
useGridSurface(matRef, meshRef, { followMouse, reveal, revealDuration });
|
|
66
|
+
return (_jsx("group", { ref: rootRef, ...groupProps, children: _jsxs("mesh", { ref: meshRef, rotation: flat ? [-Math.PI / 2, 0, 0] : [0, 0, 0], children: [_jsx("planeGeometry", { args: [size, size, segs, segs] }), _jsx("quasiGridMaterial", { ref: matRef, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending, side: THREE.DoubleSide, u_cellSize: cellSize, u_lineWidth: lineWidth, u_sectionSize: sectionSize, u_sectionWidth: sectionWidth, u_lineMode: lineMode, u_cellMode: cellMode, u_animSpeed: animSpeed, u_animScale: animScale, u_animIntensity: animIntensity, u_fadeDistance: fade, u_fadeStrength: fadeStrength, u_displace: displace, u_symmetry: Math.max(3, Math.min(9, symmetry)), u_phase: phase, u_lineColor: colors.line, u_sectionColor: colors.section, u_cellColor: colors.cell, u_glowColor: colors.glow, u_bgColor: colors.bg, u_bgOpacity: bgOpacity }, QuasiGridMaterial.key)] }) }));
|
|
67
|
+
}
|
|
68
|
+
export default QuasiGrid;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ThreeElements } from '@react-three/fiber';
|
|
2
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
3
|
+
import type { RadarGridConfig } from '../types/gridConfigs';
|
|
4
|
+
export interface RadarGridProps extends ObjectReadyProps {
|
|
5
|
+
config?: RadarGridConfig;
|
|
6
|
+
groupProps?: ThreeElements['group'];
|
|
7
|
+
}
|
|
8
|
+
/** RadarGridConfig — the single source of truth for a radar grid instance. */
|
|
9
|
+
export declare const defaultRadarGridConfig: RadarGridConfig;
|
|
10
|
+
/**
|
|
11
|
+
* A polar HUD — concentric rings and radial spokes instead of an X/Y lattice,
|
|
12
|
+
* masked to a disc of `fadeDistance` rather than filling its square plane.
|
|
13
|
+
*
|
|
14
|
+
* A sweep arm rotates with a decaying trail, contacts light as it crosses them
|
|
15
|
+
* and fade until it comes back around, and `lineMode` 1 sends ping rings out
|
|
16
|
+
* from the focus point. Set `sweepWidth` to 0 for a static instrument face,
|
|
17
|
+
* `spokes` to 0 for rings only.
|
|
18
|
+
*
|
|
19
|
+
* Note that `fadeDistance` is the disc radius here, so keep `size` at least
|
|
20
|
+
* twice it or the disc gets clipped by its own plane.
|
|
21
|
+
*/
|
|
22
|
+
export declare function RadarGrid({ config, groupProps, onObjectReady, onObjectDispose }: RadarGridProps): import("react").JSX.Element;
|
|
23
|
+
export default RadarGrid;
|
|
24
|
+
//# sourceMappingURL=RadarGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadarGrid.d.ts","sourceRoot":"","sources":["../../src/components/RadarGrid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACpD,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,UAAU,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACvC;AAKD,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB,EAAE,eA4BpC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,EAAE,MAA+B,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,cAAc,+BAiExH;AAED,eAAe,SAAS,CAAC"}
|