@3driseai/3drise-viewer 0.1.16 → 0.1.17

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 (116) hide show
  1. package/README.md +4 -3
  2. package/dist/components/ChladniGrid.d.ts +15 -0
  3. package/dist/components/ChladniGrid.d.ts.map +1 -0
  4. package/dist/components/ChladniGrid.js +62 -0
  5. package/dist/components/CustomPrimitive.d.ts +2 -0
  6. package/dist/components/CustomPrimitive.d.ts.map +1 -1
  7. package/dist/components/CustomPrimitive.js +2 -2
  8. package/dist/components/EffectsGenerator.d.ts.map +1 -1
  9. package/dist/components/EffectsGenerator.js +26 -2
  10. package/dist/components/FlowNetGrid.d.ts +15 -0
  11. package/dist/components/FlowNetGrid.d.ts.map +1 -0
  12. package/dist/components/FlowNetGrid.js +61 -0
  13. package/dist/components/GirihGrid.d.ts +15 -0
  14. package/dist/components/GirihGrid.d.ts.map +1 -0
  15. package/dist/components/GirihGrid.js +62 -0
  16. package/dist/components/GravWaveGrid.d.ts +15 -0
  17. package/dist/components/GravWaveGrid.d.ts.map +1 -0
  18. package/dist/components/GravWaveGrid.js +62 -0
  19. package/dist/components/GridsGenerator.d.ts +2 -2
  20. package/dist/components/GridsGenerator.d.ts.map +1 -1
  21. package/dist/components/GridsGenerator.js +21 -0
  22. package/dist/components/HyperbolicGrid.d.ts +15 -0
  23. package/dist/components/HyperbolicGrid.d.ts.map +1 -0
  24. package/dist/components/HyperbolicGrid.js +61 -0
  25. package/dist/components/LayoutInstances.d.ts +13 -0
  26. package/dist/components/LayoutInstances.d.ts.map +1 -0
  27. package/dist/components/LayoutInstances.js +39 -0
  28. package/dist/components/ModelPrimitive.d.ts +2 -0
  29. package/dist/components/ModelPrimitive.d.ts.map +1 -1
  30. package/dist/components/ModelPrimitive.js +3 -3
  31. package/dist/components/ObjectNode.d.ts.map +1 -1
  32. package/dist/components/ObjectNode.js +36 -8
  33. package/dist/components/ReactionDiffusionGrid.d.ts +15 -0
  34. package/dist/components/ReactionDiffusionGrid.d.ts.map +1 -0
  35. package/dist/components/ReactionDiffusionGrid.js +376 -0
  36. package/dist/components/WallpaperGrid.d.ts +15 -0
  37. package/dist/components/WallpaperGrid.d.ts.map +1 -0
  38. package/dist/components/WallpaperGrid.js +555 -0
  39. package/dist/components/cursor/CursorController.d.ts.map +1 -1
  40. package/dist/components/effects/BlackHoleEffect.d.ts +3 -3
  41. package/dist/components/effects/BlackHoleEffect.d.ts.map +1 -1
  42. package/dist/components/effects/BlackHoleEffect.js +293 -163
  43. package/dist/components/effects/DandelionSeedsEffect.d.ts +13 -0
  44. package/dist/components/effects/DandelionSeedsEffect.d.ts.map +1 -0
  45. package/dist/components/effects/DandelionSeedsEffect.js +510 -0
  46. package/dist/components/effects/FallingLeavesEffect.d.ts +13 -0
  47. package/dist/components/effects/FallingLeavesEffect.d.ts.map +1 -0
  48. package/dist/components/effects/FallingLeavesEffect.js +446 -0
  49. package/dist/components/effects/FieldLinesEffect.d.ts +11 -0
  50. package/dist/components/effects/FieldLinesEffect.d.ts.map +1 -0
  51. package/dist/components/effects/FieldLinesEffect.js +260 -0
  52. package/dist/components/effects/FireflySwarmEffect.d.ts +13 -0
  53. package/dist/components/effects/FireflySwarmEffect.d.ts.map +1 -0
  54. package/dist/components/effects/FireflySwarmEffect.js +408 -0
  55. package/dist/components/effects/GalaxyEffect.d.ts +13 -0
  56. package/dist/components/effects/GalaxyEffect.d.ts.map +1 -0
  57. package/dist/components/effects/GalaxyEffect.js +374 -0
  58. package/dist/components/effects/HarmonicShellEffect.d.ts +11 -0
  59. package/dist/components/effects/HarmonicShellEffect.d.ts.map +1 -0
  60. package/dist/components/effects/HarmonicShellEffect.js +209 -0
  61. package/dist/components/effects/IceCrystalsEffect.d.ts +3 -3
  62. package/dist/components/effects/IceCrystalsEffect.d.ts.map +1 -1
  63. package/dist/components/effects/IceCrystalsEffect.js +286 -166
  64. package/dist/components/effects/IceHaloEffect.d.ts +13 -0
  65. package/dist/components/effects/IceHaloEffect.d.ts.map +1 -0
  66. package/dist/components/effects/IceHaloEffect.js +306 -0
  67. package/dist/components/effects/LichtenbergEffect.d.ts +13 -0
  68. package/dist/components/effects/LichtenbergEffect.d.ts.map +1 -0
  69. package/dist/components/effects/LichtenbergEffect.js +517 -0
  70. package/dist/components/effects/MoleculesEffect.d.ts +3 -3
  71. package/dist/components/effects/MoleculesEffect.d.ts.map +1 -1
  72. package/dist/components/effects/MoleculesEffect.js +322 -164
  73. package/dist/components/effects/MurmurationEffect.d.ts +13 -0
  74. package/dist/components/effects/MurmurationEffect.d.ts.map +1 -0
  75. package/dist/components/effects/MurmurationEffect.js +539 -0
  76. package/dist/components/effects/PlanetaryRingsEffect.d.ts +13 -0
  77. package/dist/components/effects/PlanetaryRingsEffect.d.ts.map +1 -0
  78. package/dist/components/effects/PlanetaryRingsEffect.js +458 -0
  79. package/dist/components/effects/PortalEffect.d.ts +3 -3
  80. package/dist/components/effects/PortalEffect.d.ts.map +1 -1
  81. package/dist/components/effects/PortalEffect.js +240 -163
  82. package/dist/components/effects/ShockwaveEffect.d.ts +5 -3
  83. package/dist/components/effects/ShockwaveEffect.d.ts.map +1 -1
  84. package/dist/components/effects/ShockwaveEffect.js +538 -142
  85. package/dist/components/effects/SmokePlumeEffect.d.ts +3 -3
  86. package/dist/components/effects/SmokePlumeEffect.d.ts.map +1 -1
  87. package/dist/components/effects/SmokePlumeEffect.js +180 -116
  88. package/dist/components/effects/SmokeRingEffect.d.ts +3 -3
  89. package/dist/components/effects/SmokeRingEffect.d.ts.map +1 -1
  90. package/dist/components/effects/SmokeRingEffect.js +260 -135
  91. package/dist/components/effects/StrangeAttractorEffect.d.ts +11 -0
  92. package/dist/components/effects/StrangeAttractorEffect.d.ts.map +1 -0
  93. package/dist/components/effects/StrangeAttractorEffect.js +229 -0
  94. package/dist/components/effects/VolumetricFogEffect.d.ts +5 -3
  95. package/dist/components/effects/VolumetricFogEffect.d.ts.map +1 -1
  96. package/dist/components/effects/VolumetricFogEffect.js +211 -93
  97. package/dist/components/effects/WaterCausticsEffect.d.ts +13 -0
  98. package/dist/components/effects/WaterCausticsEffect.d.ts.map +1 -0
  99. package/dist/components/effects/WaterCausticsEffect.js +308 -0
  100. package/dist/components/effects/index.d.ts +9 -0
  101. package/dist/components/effects/index.d.ts.map +1 -1
  102. package/dist/components/effects/index.js +9 -0
  103. package/dist/components/index.d.ts +16 -0
  104. package/dist/components/index.d.ts.map +1 -1
  105. package/dist/components/index.js +8 -0
  106. package/dist/constants.d.ts +1 -1
  107. package/dist/constants.d.ts.map +1 -1
  108. package/dist/constants.js +1 -1
  109. package/dist/hooks/useModelObject.d.ts +6 -1
  110. package/dist/hooks/useModelObject.d.ts.map +1 -1
  111. package/dist/hooks/useModelObject.js +19 -6
  112. package/dist/types/gridConfigs.d.ts +98 -0
  113. package/dist/types/gridConfigs.d.ts.map +1 -1
  114. package/dist/types/index.d.ts +1 -1
  115. package/dist/types/index.d.ts.map +1 -1
  116. package/package.json +2 -2
package/README.md CHANGED
@@ -6,7 +6,7 @@ You build in the **3dRise studio** — create objects, apply materials, set up a
6
6
  interactions — then render the result in React with one component. Nothing about the scene is configured
7
7
  in code: geometry, materials, lighting, animations and interactions all come from what you published.
8
8
 
9
- There are two components, depending on how much you want to embed:
9
+ There are many components, these are the main ones:
10
10
 
11
11
  | Component | Embeds |
12
12
  | ------------------ | ----------------------------------------------------------------------- |
@@ -15,6 +15,8 @@ There are two components, depending on how much you want to embed:
15
15
 
16
16
  ---
17
17
 
18
+ A ready to go react project with some examples: https://github.com/nadavtal/3drise-react
19
+
18
20
  ## Installation
19
21
 
20
22
  ```bash
@@ -131,7 +133,7 @@ export function Hero({ objectId }: { objectId: string }) {
131
133
  <ambientLight intensity={0.5} />
132
134
  <directionalLight position={[5, 10, 5]} intensity={1.5} />
133
135
 
134
- <ObjectNodeApi objectId={objectId} cameraSettings={cameraSettings} />
136
+ <ObjectNodeApi objectId={objectId} />
135
137
 
136
138
  <OrbitControls />
137
139
  </Canvas>
@@ -152,7 +154,6 @@ their own materials and animations.
152
154
  | Prop | Type | Description |
153
155
  | ------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
154
156
  | `objectId` | `string` **(required)** | Id of the published scene object to load. |
155
- | `cameraSettings` | `CameraState` **(required)** | The camera the object should assume. Currently only `fov` is read, and only by particle objects — but the full object is required. |
156
157
  | `handleObjectClick` | `(object: CreatedObjectSettings, ref: Object3D, event: ThreeEvent<MouseEvent>) => void` | The object was clicked. Note the name differs from `ProjectLoader`'s `onObjectClick`. |
157
158
  | `onObjectReady` | `(object, ref: Object3D) => void` | The object reports its `Object3D` here — see below. |
158
159
  | `onObjectDispose` | `(object, ref: Object3D) => void` | The matching teardown event. |
@@ -0,0 +1,15 @@
1
+ import type { ThreeElements } from '@react-three/fiber';
2
+ import type { ObjectReadyProps } from '../types/objectReady';
3
+ import type { ChladniGridConfig } from '../types/gridConfigs';
4
+ export interface ChladniGridProps extends ObjectReadyProps {
5
+ config?: ChladniGridConfig;
6
+ groupProps?: ThreeElements['group'];
7
+ }
8
+ /** ChladniGridConfig defaults. Must match the catalog entry in grid-defaults.json exactly. */
9
+ export declare const defaultChladniGridConfig: ChladniGridConfig;
10
+ /**
11
+ * Chladni plates: the nodal lines of a standing wave on a square plate, with sand settling on them, drifting slowly between two neighbouring resonances.
12
+ */
13
+ export declare function ChladniGrid({ config, groupProps, onObjectReady, onObjectDispose }: ChladniGridProps): import("react").JSX.Element;
14
+ export default ChladniGrid;
15
+ //# sourceMappingURL=ChladniGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChladniGrid.d.ts","sourceRoot":"","sources":["../../src/components/ChladniGrid.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,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACtD,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,UAAU,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACvC;AAKD,8FAA8F;AAC9F,eAAO,MAAM,wBAAwB,EAAE,iBA6BtC,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,MAAiC,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,gBAAgB,+BAiE9H;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,62 @@
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 { ChladniGridMaterial } from '@3driseai/3drise-core';
7
+ // Side-effect import registers <chladniGridMaterial> via extend().
8
+ void ChladniGridMaterial;
9
+ /** ChladniGridConfig defaults. Must match the catalog entry in grid-defaults.json exactly. */
10
+ export const defaultChladniGridConfig = {
11
+ cellSize: 8,
12
+ size: 50,
13
+ flat: true,
14
+ segments: undefined,
15
+ lineMode: 0,
16
+ cellMode: 2,
17
+ lineWidth: 1.2,
18
+ sectionSize: 1,
19
+ sectionWidth: 0.8,
20
+ animSpeed: 1,
21
+ animScale: 0.5,
22
+ animIntensity: 0.6,
23
+ fadeDistance: undefined,
24
+ fadeStrength: 0.6,
25
+ displace: 0,
26
+ modeN: 3,
27
+ modeM: 5,
28
+ morph: 0.4,
29
+ grain: 0.8,
30
+ lineColor: '#d9c7a3',
31
+ sectionColor: '#4d5d6e',
32
+ cellColor: '#16222e',
33
+ glowColor: '#ffe2a8',
34
+ bgColor: '#06080b',
35
+ bgOpacity: 0,
36
+ followMouse: false,
37
+ reveal: 1,
38
+ revealDuration: 0,
39
+ };
40
+ /**
41
+ * Chladni plates: the nodal lines of a standing wave on a square plate, with sand settling on them, drifting slowly between two neighbouring resonances.
42
+ */
43
+ export function ChladniGrid({ config = defaultChladniGridConfig, groupProps, onObjectReady, onObjectDispose }) {
44
+ const matRef = useRef(null);
45
+ const rootRef = useRef(null);
46
+ const meshRef = useRef(null);
47
+ useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
48
+ const { cellSize, size, segments, flat, lineMode, cellMode, lineWidth, sectionSize, sectionWidth, animSpeed, animScale, animIntensity, fadeDistance, fadeStrength, displace, modeN, modeM, morph, grain, lineColor, sectionColor, cellColor, glowColor, bgColor, bgOpacity, followMouse, reveal, revealDuration, } = config;
49
+ // the displacement is the standing wave itself, so the mesh has to resolve every mode
50
+ const segs = segments ?? (displace > 0 ? Math.min(512, Math.max(96, Math.ceil(size / Math.max(cellSize, 1e-4)) * 48)) : 1);
51
+ const fade = fadeDistance ?? size * 0.5;
52
+ const colors = useMemo(() => ({
53
+ line: new THREE.Color(lineColor),
54
+ section: new THREE.Color(sectionColor),
55
+ cell: new THREE.Color(cellColor),
56
+ glow: new THREE.Color(glowColor),
57
+ bg: new THREE.Color(bgColor),
58
+ }), [lineColor, sectionColor, cellColor, glowColor, bgColor]);
59
+ useGridSurface(matRef, meshRef, { followMouse, reveal, revealDuration });
60
+ 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("chladniGridMaterial", { 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_modeN: modeN, u_modeM: modeM, u_morph: morph, u_grain: grain, u_lineColor: colors.line, u_sectionColor: colors.section, u_cellColor: colors.cell, u_glowColor: colors.glow, u_bgColor: colors.bg, u_bgOpacity: bgOpacity }, ChladniGridMaterial.key)] }) }));
61
+ }
62
+ export default ChladniGrid;
@@ -5,6 +5,8 @@ import React from "react";
5
5
  import { type ThreeEvent } from "@react-three/fiber";
6
6
  interface CustomPrimitiveProps extends ObjectReadyProps {
7
7
  createdObject: CreatedObjectSettings;
8
+ /** Layout slot (meshSettings.layout). A model needs its own clone per slot. */
9
+ slot?: number;
8
10
  handleObjectClick?: (createdObject: CreatedObjectSettings, ref: Object3D, event: ThreeEvent<MouseEvent>) => void;
9
11
  }
10
12
  declare const CustomPrimitive: React.FC<CustomPrimitiveProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"CustomPrimitive.d.ts","sourceRoot":"","sources":["../../src/components/CustomPrimitive.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAOtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,UAAU,oBAAqB,SAAQ,gBAAgB;IACnD,aAAa,EAAE,qBAAqB,CAAC;IACrC,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CACpH;AAGD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAoElD,CAAC;AAEH,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"CustomPrimitive.d.ts","sourceRoot":"","sources":["../../src/components/CustomPrimitive.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAOtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,UAAU,oBAAqB,SAAQ,gBAAgB;IACnD,aAAa,EAAE,qBAAqB,CAAC;IACrC,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CACpH;AAGD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAoElD,CAAC;AAEH,eAAe,eAAe,CAAC"}
@@ -7,7 +7,7 @@ import ModelPrimitive from "./ModelPrimitive.js";
7
7
  import { useWaterReflections } from "../hooks/useWaterReflections.js";
8
8
  import { GeometryMesh } from "./GeometryShape.js";
9
9
  import { useObjectReady } from "../hooks/useObjectReady.js";
10
- const CustomPrimitive = memo(({ createdObject, onObjectReady, onObjectDispose, handleObjectClick, }) => {
10
+ const CustomPrimitive = memo(({ createdObject, slot = 0, onObjectReady, onObjectDispose, handleObjectClick, }) => {
11
11
  const meshRef = useRef(null);
12
12
  // CustomPrimitive accepted onObjectReady but never fired it; this is the fix.
13
13
  useObjectReady(meshRef, createdObject, onObjectReady, onObjectDispose);
@@ -74,7 +74,7 @@ const CustomPrimitive = memo(({ createdObject, onObjectReady, onObjectDispose, h
74
74
  // ModelPrimitive owns its own ref and reports readiness: the meshRef above stays null
75
75
  // for a model, so the useObjectReady call at the top of this component is a no-op here
76
76
  // and cannot double-report alongside it.
77
- return _jsx(ModelBoundary, { label: `${createdObject.name} (${createdObject.id})`, children: _jsx(ModelPrimitive, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, children: useDreiMaterials && createdObject.meshSettings.visible && (_jsx(MaterialLibrary, { materialSettings: createdObject.materialSettings })) }) });
77
+ return _jsx(ModelBoundary, { label: `${createdObject.name} (${createdObject.id})${slot ? ` slot ${slot}` : ''}`, children: _jsx(ModelPrimitive, { createdObject: createdObject, slot: slot, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, children: useDreiMaterials && createdObject.meshSettings.visible && (_jsx(MaterialLibrary, { materialSettings: createdObject.materialSettings })) }) });
78
78
  });
79
79
  CustomPrimitive.displayName = 'CustomPrimitive';
80
80
  export default CustomPrimitive;
@@ -1 +1 @@
1
- {"version":3,"file":"EffectsGenerator.d.ts","sourceRoot":"","sources":["../../src/components/EffectsGenerator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAyBtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC3D,QAAQ,EAAE,wBAAwB,CAAC;IACnC,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC5B;AAGD,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA0CrD,CAAC;AACF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"EffectsGenerator.d.ts","sourceRoot":"","sources":["../../src/components/EffectsGenerator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAqCtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC3D,QAAQ,EAAE,wBAAwB,CAAC;IACnC,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC5B;AAGD,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsDrD,CAAC;AACF,eAAe,gBAAgB,CAAC"}
@@ -25,6 +25,18 @@ import Bubbles from './Bubbles.js';
25
25
  import Glyphs from './Glyphs.js';
26
26
  import Fire from './effects/Fire.js';
27
27
  import SmokeRibbon from './effects/SmokeRibbon.js';
28
+ import FieldLinesEffect from './effects/FieldLinesEffect.js';
29
+ import StrangeAttractorEffect from './effects/StrangeAttractorEffect.js';
30
+ import HarmonicShellEffect from './effects/HarmonicShellEffect.js';
31
+ import GalaxyEffect from './effects/GalaxyEffect.js';
32
+ import FireflySwarmEffect from './effects/FireflySwarmEffect.js';
33
+ import MurmurationEffect from './effects/MurmurationEffect.js';
34
+ import PlanetaryRingsEffect from './effects/PlanetaryRingsEffect.js';
35
+ import WaterCausticsEffect from './effects/WaterCausticsEffect.js';
36
+ import IceHaloEffect from './effects/IceHaloEffect.js';
37
+ import FallingLeavesEffect from './effects/FallingLeavesEffect.js';
38
+ import LichtenbergEffect from './effects/LichtenbergEffect.js';
39
+ import DandelionSeedsEffect from './effects/DandelionSeedsEffect.js';
28
40
  const EffectsGenerator = ({ settings, object, onObjectReady, onObjectDispose }) => {
29
41
  const { config } = settings;
30
42
  const boundingRadius = useMemo(() => {
@@ -41,7 +53,7 @@ const EffectsGenerator = ({ settings, object, onObjectReady, onObjectDispose })
41
53
  const ready = { onObjectReady, onObjectDispose };
42
54
  switch (config.type) {
43
55
  case 'molecules': return _jsx(MoleculesEffect, { boundingRadius: boundingRadius, config: config, animations: animations, ...ready });
44
- case 'shockwave': return _jsx(ShockwaveEffect, { boundingRadius: boundingRadius, config: config, animations: animations, ...ready });
56
+ case 'shockwave': return _jsx(ShockwaveEffect, { boundingRadius: boundingRadius, config: config, animations: animations, hasHost: !!object, ...ready });
45
57
  case 'aura': return _jsx(AuraEffect, { boundingRadius: boundingRadius, config: config, animations: animations, ...ready });
46
58
  case 'dataStream': return _jsx(DataStreamEffect, { boundingRadius: boundingRadius, config: config, animations: animations, ...ready });
47
59
  case 'constellation': return _jsx(ConstellationEffect, { boundingRadius: boundingRadius, config: config, animations: animations, ...ready });
@@ -56,7 +68,7 @@ const EffectsGenerator = ({ settings, object, onObjectReady, onObjectDispose })
56
68
  case 'blackHole': return _jsx(BlackHoleEffect, { boundingRadius: boundingRadius, config: config, animations: animations, ...ready });
57
69
  case 'iceCrystals': return _jsx(IceCrystalsEffect, { boundingRadius: boundingRadius, config: config, animations: animations, ...ready });
58
70
  case 'smokePlume': return _jsx(SmokePlumeEffect, { boundingRadius: boundingRadius, config: config, animations: animations, ...ready });
59
- case 'volumetricFog': return _jsx(VolumetricFogEffect, { boundingRadius: boundingRadius, config: config, animations: animations, ...ready });
71
+ case 'volumetricFog': return _jsx(VolumetricFogEffect, { boundingRadius: boundingRadius, config: config, animations: animations, hasHost: !!object, ...ready });
60
72
  case 'smokeRing': return _jsx(SmokeRingEffect, { boundingRadius: boundingRadius, config: config, animations: animations, ...ready });
61
73
  case 'fire': return _jsx(Fire, { hostRef: object, config: config, animations: animations, ...ready });
62
74
  case 'flares': return _jsx(Flares, { hostRef: object, config: config, animations: animations, ...ready });
@@ -64,6 +76,18 @@ const EffectsGenerator = ({ settings, object, onObjectReady, onObjectDispose })
64
76
  case 'bubbles': return _jsx(Bubbles, { boundingRadius: boundingRadius, config: config });
65
77
  case 'glyphs': return _jsx(Glyphs, { boundingRadius: boundingRadius, config: config });
66
78
  case 'smokeRibbon': return _jsx(SmokeRibbon, { config: config, boundingRadius: boundingRadius, ...ready });
79
+ case 'fieldLines': return _jsx(FieldLinesEffect, { boundingRadius: boundingRadius, config: config, animations: animations, ...ready });
80
+ case 'strangeAttractor': return _jsx(StrangeAttractorEffect, { boundingRadius: boundingRadius, config: config, animations: animations, ...ready });
81
+ case 'harmonicShell': return _jsx(HarmonicShellEffect, { boundingRadius: boundingRadius, config: config, animations: animations, ...ready });
82
+ case 'galaxy': return _jsx(GalaxyEffect, { boundingRadius: boundingRadius, config: config, animations: animations, hasHost: !!object, ...ready });
83
+ case 'fireflySwarm': return _jsx(FireflySwarmEffect, { boundingRadius: boundingRadius, config: config, animations: animations, hasHost: !!object, ...ready });
84
+ case 'murmuration': return _jsx(MurmurationEffect, { boundingRadius: boundingRadius, config: config, animations: animations, hasHost: !!object, ...ready });
85
+ case 'planetaryRings': return _jsx(PlanetaryRingsEffect, { boundingRadius: boundingRadius, config: config, animations: animations, hasHost: !!object, ...ready });
86
+ case 'waterCaustics': return _jsx(WaterCausticsEffect, { boundingRadius: boundingRadius, config: config, animations: animations, hasHost: !!object, ...ready });
87
+ case 'iceHalo': return _jsx(IceHaloEffect, { boundingRadius: boundingRadius, config: config, animations: animations, hasHost: !!object, ...ready });
88
+ case 'fallingLeaves': return _jsx(FallingLeavesEffect, { boundingRadius: boundingRadius, config: config, animations: animations, hasHost: !!object, ...ready });
89
+ case 'lichtenberg': return _jsx(LichtenbergEffect, { boundingRadius: boundingRadius, config: config, animations: animations, hasHost: !!object, ...ready });
90
+ case 'dandelionSeeds': return _jsx(DandelionSeedsEffect, { boundingRadius: boundingRadius, config: config, animations: animations, hasHost: !!object, ...ready });
67
91
  default: return null;
68
92
  }
69
93
  };
@@ -0,0 +1,15 @@
1
+ import type { ThreeElements } from '@react-three/fiber';
2
+ import type { ObjectReadyProps } from '../types/objectReady';
3
+ import type { FlowNetGridConfig } from '../types/gridConfigs';
4
+ export interface FlowNetGridProps extends ObjectReadyProps {
5
+ config?: FlowNetGridConfig;
6
+ groupProps?: ThreeElements['group'];
7
+ }
8
+ /** FlowNetGridConfig defaults. Must match the catalog entry in grid-defaults.json exactly. */
9
+ export declare const defaultFlowNetGridConfig: FlowNetGridConfig;
10
+ /**
11
+ * Potential flow past a cylinder with circulation, drawn as a flow net: streamlines and equipotentials that cross at right angles everywhere and bend around the obstacle.
12
+ */
13
+ export declare function FlowNetGrid({ config, groupProps, onObjectReady, onObjectDispose }: FlowNetGridProps): import("react").JSX.Element;
14
+ export default FlowNetGrid;
15
+ //# sourceMappingURL=FlowNetGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlowNetGrid.d.ts","sourceRoot":"","sources":["../../src/components/FlowNetGrid.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,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACtD,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,UAAU,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACvC;AAKD,8FAA8F;AAC9F,eAAO,MAAM,wBAAwB,EAAE,iBA4BtC,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,MAAiC,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,gBAAgB,+BAgE9H;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,61 @@
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 { FlowNetGridMaterial } from '@3driseai/3drise-core';
7
+ // Side-effect import registers <flowNetGridMaterial> via extend().
8
+ void FlowNetGridMaterial;
9
+ /** FlowNetGridConfig defaults. Must match the catalog entry in grid-defaults.json exactly. */
10
+ export const defaultFlowNetGridConfig = {
11
+ cellSize: 1.5,
12
+ size: 50,
13
+ flat: true,
14
+ segments: undefined,
15
+ lineMode: 2,
16
+ cellMode: 1,
17
+ lineWidth: 1,
18
+ sectionSize: 5,
19
+ sectionWidth: 1.6,
20
+ animSpeed: 1,
21
+ animScale: 0.6,
22
+ animIntensity: 0.8,
23
+ fadeDistance: undefined,
24
+ fadeStrength: 0.7,
25
+ displace: 0,
26
+ obstacleRadius: 3,
27
+ circulation: 2,
28
+ flowAngle: 0,
29
+ lineColor: '#3f8fbf',
30
+ sectionColor: '#9fe3ff',
31
+ cellColor: '#0c3148',
32
+ glowColor: '#5fd0ff',
33
+ bgColor: '#02070b',
34
+ bgOpacity: 0,
35
+ followMouse: false,
36
+ reveal: 1,
37
+ revealDuration: 0,
38
+ };
39
+ /**
40
+ * Potential flow past a cylinder with circulation, drawn as a flow net: streamlines and equipotentials that cross at right angles everywhere and bend around the obstacle.
41
+ */
42
+ export function FlowNetGrid({ config = defaultFlowNetGridConfig, groupProps, onObjectReady, onObjectDispose }) {
43
+ const matRef = useRef(null);
44
+ const rootRef = useRef(null);
45
+ const meshRef = useRef(null);
46
+ useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
47
+ const { cellSize, size, segments, flat, lineMode, cellMode, lineWidth, sectionSize, sectionWidth, animSpeed, animScale, animIntensity, fadeDistance, fadeStrength, displace, obstacleRadius, circulation, flowAngle, lineColor, sectionColor, cellColor, glowColor, bgColor, bgOpacity, followMouse, reveal, revealDuration, } = config;
48
+ // a gentle wave only needs a moderate mesh
49
+ const segs = segments ?? (displace > 0 ? Math.min(512, Math.max(96, Math.ceil(size / Math.max(cellSize, 1e-4)) * 4)) : 1);
50
+ const fade = fadeDistance ?? size * 0.5;
51
+ const colors = useMemo(() => ({
52
+ line: new THREE.Color(lineColor),
53
+ section: new THREE.Color(sectionColor),
54
+ cell: new THREE.Color(cellColor),
55
+ glow: new THREE.Color(glowColor),
56
+ bg: new THREE.Color(bgColor),
57
+ }), [lineColor, sectionColor, cellColor, glowColor, bgColor]);
58
+ useGridSurface(matRef, meshRef, { followMouse, reveal, revealDuration });
59
+ 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("flowNetGridMaterial", { 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_obstacleRadius: obstacleRadius, u_circulation: Math.round(circulation), u_flowAngle: flowAngle, u_lineColor: colors.line, u_sectionColor: colors.section, u_cellColor: colors.cell, u_glowColor: colors.glow, u_bgColor: colors.bg, u_bgOpacity: bgOpacity }, FlowNetGridMaterial.key)] }) }));
60
+ }
61
+ export default FlowNetGrid;
@@ -0,0 +1,15 @@
1
+ import type { ThreeElements } from '@react-three/fiber';
2
+ import type { ObjectReadyProps } from '../types/objectReady';
3
+ import type { GirihGridConfig } from '../types/gridConfigs';
4
+ export interface GirihGridProps extends ObjectReadyProps {
5
+ config?: GirihGridConfig;
6
+ groupProps?: ThreeElements['group'];
7
+ }
8
+ /** GirihGridConfig defaults. Must match the catalog entry in grid-defaults.json exactly. */
9
+ export declare const defaultGirihGridConfig: GirihGridConfig;
10
+ /**
11
+ * An Islamic star pattern drawn by Hankin polygons-in-contact. One ray per dihedral sector, from the edge midpoint to the sector bisector, generates the whole interlaced star-and-rosette strapwork over an octagon-square, hexagonal or trihexagonal tiling.
12
+ */
13
+ export declare function GirihGrid({ config, groupProps, onObjectReady, onObjectDispose }: GirihGridProps): import("react").JSX.Element;
14
+ export default GirihGrid;
15
+ //# sourceMappingURL=GirihGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GirihGrid.d.ts","sourceRoot":"","sources":["../../src/components/GirihGrid.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,4FAA4F;AAC5F,eAAO,MAAM,sBAAsB,EAAE,eA6BpC,CAAC;AAEF;;GAEG;AACH,wBAAgB,SAAS,CAAC,EAAE,MAA+B,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,cAAc,+BAiExH;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,62 @@
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 { GirihGridMaterial } from '@3driseai/3drise-core';
7
+ // Side-effect import registers <girihGridMaterial> via extend().
8
+ void GirihGridMaterial;
9
+ /** GirihGridConfig defaults. Must match the catalog entry in grid-defaults.json exactly. */
10
+ export const defaultGirihGridConfig = {
11
+ cellSize: 4,
12
+ size: 50,
13
+ flat: true,
14
+ segments: undefined,
15
+ lineMode: 2,
16
+ cellMode: 2,
17
+ lineWidth: 1.2,
18
+ sectionSize: 3,
19
+ sectionWidth: 0.8,
20
+ animSpeed: 1,
21
+ animScale: 0.5,
22
+ animIntensity: 0.25,
23
+ fadeDistance: undefined,
24
+ fadeStrength: 0.65,
25
+ displace: 0,
26
+ tiling: 0,
27
+ contactAngle: 67.5,
28
+ strapWidth: 0.07,
29
+ angleDrift: 5,
30
+ lineColor: '#f2c469',
31
+ sectionColor: '#3f6fc4',
32
+ cellColor: '#12616f',
33
+ glowColor: '#38c4c8',
34
+ bgColor: '#05070a',
35
+ bgOpacity: 0,
36
+ followMouse: false,
37
+ reveal: 1,
38
+ revealDuration: 0,
39
+ };
40
+ /**
41
+ * An Islamic star pattern drawn by Hankin polygons-in-contact. One ray per dihedral sector, from the edge midpoint to the sector bisector, generates the whole interlaced star-and-rosette strapwork over an octagon-square, hexagonal or trihexagonal tiling.
42
+ */
43
+ export function GirihGrid({ config = defaultGirihGridConfig, groupProps, onObjectReady, onObjectDispose }) {
44
+ const matRef = useRef(null);
45
+ const rootRef = useRef(null);
46
+ const meshRef = useRef(null);
47
+ useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
48
+ const { cellSize, size, segments, flat, lineMode, cellMode, lineWidth, sectionSize, sectionWidth, animSpeed, animScale, animIntensity, fadeDistance, fadeStrength, displace, tiling, contactAngle, strapWidth, angleDrift, lineColor, sectionColor, cellColor, glowColor, bgColor, bgOpacity, followMouse, reveal, revealDuration, } = config;
49
+ // the relief follows the star outlines, which are a fraction of a cell wide
50
+ const segs = segments ?? (displace > 0 ? Math.min(512, Math.max(128, Math.ceil(size / Math.max(cellSize, 1e-4)) * 24)) : 1);
51
+ const fade = fadeDistance ?? size * 0.5;
52
+ const colors = useMemo(() => ({
53
+ line: new THREE.Color(lineColor),
54
+ section: new THREE.Color(sectionColor),
55
+ cell: new THREE.Color(cellColor),
56
+ glow: new THREE.Color(glowColor),
57
+ bg: new THREE.Color(bgColor),
58
+ }), [lineColor, sectionColor, cellColor, glowColor, bgColor]);
59
+ useGridSurface(matRef, meshRef, { followMouse, reveal, revealDuration });
60
+ 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("girihGridMaterial", { 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_tiling: Math.round(tiling), u_contactAngle: contactAngle, u_strapWidth: strapWidth, u_angleDrift: angleDrift, u_lineColor: colors.line, u_sectionColor: colors.section, u_cellColor: colors.cell, u_glowColor: colors.glow, u_bgColor: colors.bg, u_bgOpacity: bgOpacity }, GirihGridMaterial.key)] }) }));
61
+ }
62
+ export default GirihGrid;
@@ -0,0 +1,15 @@
1
+ import type { ThreeElements } from '@react-three/fiber';
2
+ import type { ObjectReadyProps } from '../types/objectReady';
3
+ import type { GravWaveGridConfig } from '../types/gridConfigs';
4
+ export interface GravWaveGridProps extends ObjectReadyProps {
5
+ config?: GravWaveGridConfig;
6
+ groupProps?: ThreeElements['group'];
7
+ }
8
+ /** GravWaveGridConfig defaults. Must match the catalog entry in grid-defaults.json exactly. */
9
+ export declare const defaultGravWaveGridConfig: GravWaveGridConfig;
10
+ /**
11
+ * A spacetime lattice around a binary black-hole inspiral. The Newtonian wells pinch the lines, and quadrupole waves, evaluated at the retarded time, spiral outward and chirp toward the merger before the remnant rings down.
12
+ */
13
+ export declare function GravWaveGrid({ config, groupProps, onObjectReady, onObjectDispose }: GravWaveGridProps): import("react").JSX.Element;
14
+ export default GravWaveGrid;
15
+ //# sourceMappingURL=GravWaveGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GravWaveGrid.d.ts","sourceRoot":"","sources":["../../src/components/GravWaveGrid.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,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG/D,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACvD,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,UAAU,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACvC;AAKD,+FAA+F;AAC/F,eAAO,MAAM,yBAAyB,EAAE,kBA6BvC,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,MAAkC,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,iBAAiB,+BAiEjI;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,62 @@
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 { GravWaveGridMaterial } from '@3driseai/3drise-core';
7
+ // Side-effect import registers <gravWaveGridMaterial> via extend().
8
+ void GravWaveGridMaterial;
9
+ /** GravWaveGridConfig defaults. Must match the catalog entry in grid-defaults.json exactly. */
10
+ export const defaultGravWaveGridConfig = {
11
+ cellSize: 1,
12
+ size: 50,
13
+ flat: true,
14
+ segments: undefined,
15
+ lineMode: 0,
16
+ cellMode: 0,
17
+ lineWidth: 1,
18
+ sectionSize: 5,
19
+ sectionWidth: 1.4,
20
+ animSpeed: 1,
21
+ animScale: 0.5,
22
+ animIntensity: 0.7,
23
+ fadeDistance: undefined,
24
+ fadeStrength: 0.7,
25
+ displace: 0,
26
+ strain: 1,
27
+ chirpTime: 14,
28
+ waveSpeed: 6.5,
29
+ massRatio: 0.6,
30
+ lineColor: '#3d6fc9',
31
+ sectionColor: '#9cc2ff',
32
+ cellColor: '#1b3a7a',
33
+ glowColor: '#8fd8ff',
34
+ bgColor: '#03050b',
35
+ bgOpacity: 0,
36
+ followMouse: false,
37
+ reveal: 1,
38
+ revealDuration: 0,
39
+ };
40
+ /**
41
+ * A spacetime lattice around a binary black-hole inspiral. The Newtonian wells pinch the lines, and quadrupole waves, evaluated at the retarded time, spiral outward and chirp toward the merger before the remnant rings down.
42
+ */
43
+ export function GravWaveGrid({ config = defaultGravWaveGridConfig, groupProps, onObjectReady, onObjectDispose }) {
44
+ const matRef = useRef(null);
45
+ const rootRef = useRef(null);
46
+ const meshRef = useRef(null);
47
+ useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
48
+ const { cellSize, size, segments, flat, lineMode, cellMode, lineWidth, sectionSize, sectionWidth, animSpeed, animScale, animIntensity, fadeDistance, fadeStrength, displace, strain, chirpTime, waveSpeed, massRatio, lineColor, sectionColor, cellColor, glowColor, bgColor, bgOpacity, followMouse, reveal, revealDuration, } = config;
49
+ // the wells are about a cell wide and the waves reach two-cell wavelengths near merger
50
+ const segs = segments ?? (displace > 0 ? Math.min(512, Math.max(128, Math.ceil(size / Math.max(cellSize, 1e-4)) * 8)) : 1);
51
+ const fade = fadeDistance ?? size * 0.5;
52
+ const colors = useMemo(() => ({
53
+ line: new THREE.Color(lineColor),
54
+ section: new THREE.Color(sectionColor),
55
+ cell: new THREE.Color(cellColor),
56
+ glow: new THREE.Color(glowColor),
57
+ bg: new THREE.Color(bgColor),
58
+ }), [lineColor, sectionColor, cellColor, glowColor, bgColor]);
59
+ useGridSurface(matRef, meshRef, { followMouse, reveal, revealDuration });
60
+ 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("gravWaveGridMaterial", { 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_strain: strain, u_chirpTime: chirpTime, u_waveSpeed: waveSpeed, u_massRatio: massRatio, u_lineColor: colors.line, u_sectionColor: colors.section, u_cellColor: colors.cell, u_glowColor: colors.glow, u_bgColor: colors.bg, u_bgOpacity: bgOpacity }, GravWaveGridMaterial.key)] }) }));
61
+ }
62
+ export default GravWaveGrid;
@@ -1,9 +1,9 @@
1
1
  import type { ObjectReadyProps } from '../types/objectReady';
2
- import type { CircuitGridConfig, ContourGridConfig, FractalGridConfig, HexGridConfig, MoireGridConfig, QuasiGridConfig, RadarGridConfig, VoronoiGridConfig } from '../types/gridConfigs';
2
+ import type { ChladniGridConfig, CircuitGridConfig, ContourGridConfig, FlowNetGridConfig, FractalGridConfig, HexGridConfig, HyperbolicGridConfig, MoireGridConfig, QuasiGridConfig, RadarGridConfig, VoronoiGridConfig, GravWaveGridConfig, GirihGridConfig, WallpaperGridConfig, ReactionDiffusionGridConfig } from '../types/gridConfigs';
3
3
  import React from "react";
4
4
  import type { GridConfig, MyGridConfig } from "@3driseai/3drise-core";
5
5
  /** Every grid config this generator knows how to render. */
6
- export type GridGeneratorConfig = GridConfig | MyGridConfig | HexGridConfig | CircuitGridConfig | VoronoiGridConfig | RadarGridConfig | MoireGridConfig | FractalGridConfig | ContourGridConfig | QuasiGridConfig;
6
+ export type GridGeneratorConfig = GridConfig | MyGridConfig | HexGridConfig | CircuitGridConfig | VoronoiGridConfig | RadarGridConfig | MoireGridConfig | FractalGridConfig | ContourGridConfig | QuasiGridConfig | FlowNetGridConfig | ChladniGridConfig | HyperbolicGridConfig | GravWaveGridConfig | GirihGridConfig | WallpaperGridConfig | ReactionDiffusionGridConfig;
7
7
  type GridGeneratorProps = ObjectReadyProps & {
8
8
  config: GridGeneratorConfig & {
9
9
  type: string;
@@ -1 +1 @@
1
- {"version":3,"file":"GridsGenerator.d.ts","sourceRoot":"","sources":["../../src/components/GridsGenerator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EACR,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,eAAe,EACf,eAAe,EACf,iBAAiB,EACpB,MAAM,sBAAsB,CAAC;AAW9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEtE,4DAA4D;AAC5D,MAAM,MAAM,mBAAmB,GACzB,UAAU,GACV,YAAY,GACZ,aAAa,GACb,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,GACf,eAAe,GACf,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,CAAC;AAEtB,KAAK,kBAAkB,GAAG,gBAAgB,GAAG;IACzC,MAAM,EAAE,mBAAmB,GAAG;QAC1B,IAAI,EAAE,MAAM,CAAC;KAChB,CAAC;CACL,CAAC;AAGF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA+B/C,CAAC;AACF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"GridsGenerator.d.ts","sourceRoot":"","sources":["../../src/components/GridsGenerator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EACR,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,2BAA2B,EAC9B,MAAM,sBAAsB,CAAC;AAkB9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEtE,4DAA4D;AAC5D,MAAM,MAAM,mBAAmB,GACzB,UAAU,GACV,YAAY,GACZ,aAAa,GACb,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,GACf,eAAe,GACf,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,GACf,iBAAiB,GACjB,iBAAiB,GACjB,oBAAoB,GACpB,kBAAkB,GAClB,eAAe,GACf,mBAAmB,GACnB,2BAA2B,CAAC;AAElC,KAAK,kBAAkB,GAAG,gBAAgB,GAAG;IACzC,MAAM,EAAE,mBAAmB,GAAG;QAC1B,IAAI,EAAE,MAAM,CAAC;KAChB,CAAC;CACL,CAAC;AAGF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6C/C,CAAC;AACF,eAAe,aAAa,CAAC"}
@@ -9,8 +9,15 @@ import FractalGrid from "./FractalGrid.js";
9
9
  import HexGrid from "./HexGrid.js";
10
10
  import MoireGrid from "./MoireGrid.js";
11
11
  import QuasiGrid from "./QuasiGrid.js";
12
+ import FlowNetGrid from "./FlowNetGrid.js";
13
+ import ChladniGrid from "./ChladniGrid.js";
14
+ import HyperbolicGrid from "./HyperbolicGrid.js";
12
15
  import RadarGrid from "./RadarGrid.js";
13
16
  import VoronoiGrid from "./VoronoiGrid.js";
17
+ import GravWaveGrid from "./GravWaveGrid.js";
18
+ import GirihGrid from "./GirihGrid.js";
19
+ import WallpaperGrid from "./WallpaperGrid.js";
20
+ import ReactionDiffusionGrid from "./ReactionDiffusionGrid.js";
14
21
  const GridGenerator = ({ config, onObjectReady, onObjectDispose }) => {
15
22
  // The other branches render components that report themselves; the
16
23
  // native <gridHelper> is a plain three object, so this component holds its
@@ -39,6 +46,20 @@ const GridGenerator = ({ config, onObjectReady, onObjectDispose }) => {
39
46
  return _jsx(ContourGrid, { config: config, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
40
47
  case "quasiGrid":
41
48
  return _jsx(QuasiGrid, { config: config, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
49
+ case "flowNetGrid":
50
+ return _jsx(FlowNetGrid, { config: config, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
51
+ case "chladniGrid":
52
+ return _jsx(ChladniGrid, { config: config, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
53
+ case "hyperbolicGrid":
54
+ return _jsx(HyperbolicGrid, { config: config, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
55
+ case "gravWaveGrid":
56
+ return _jsx(GravWaveGrid, { config: config, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
57
+ case "girihGrid":
58
+ return _jsx(GirihGrid, { config: config, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
59
+ case "wallpaperGrid":
60
+ return _jsx(WallpaperGrid, { config: config, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
61
+ case "reactionDiffusionGrid":
62
+ return _jsx(ReactionDiffusionGrid, { config: config, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
42
63
  default:
43
64
  return _jsx("gridHelper", { ...config, ref: nativeGridRef });
44
65
  }
@@ -0,0 +1,15 @@
1
+ import type { ThreeElements } from '@react-three/fiber';
2
+ import type { ObjectReadyProps } from '../types/objectReady';
3
+ import type { HyperbolicGridConfig } from '../types/gridConfigs';
4
+ export interface HyperbolicGridProps extends ObjectReadyProps {
5
+ config?: HyperbolicGridConfig;
6
+ groupProps?: ThreeElements['group'];
7
+ }
8
+ /** HyperbolicGridConfig defaults. Must match the catalog entry in grid-defaults.json exactly. */
9
+ export declare const defaultHyperbolicGridConfig: HyperbolicGridConfig;
10
+ /**
11
+ * An Escher-style {p,q} tiling of the Poincare disk. A slow Mobius translation glides the tiling through itself, and the tiles shrink without end toward the rim.
12
+ */
13
+ export declare function HyperbolicGrid({ config, groupProps, onObjectReady, onObjectDispose }: HyperbolicGridProps): import("react").JSX.Element;
14
+ export default HyperbolicGrid;
15
+ //# sourceMappingURL=HyperbolicGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HyperbolicGrid.d.ts","sourceRoot":"","sources":["../../src/components/HyperbolicGrid.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,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAGjE,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IACzD,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,UAAU,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACvC;AAKD,iGAAiG;AACjG,eAAO,MAAM,2BAA2B,EAAE,oBA4BzC,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAoC,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,mBAAmB,+BAgEvI;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,61 @@
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 { HyperbolicGridMaterial } from '@3driseai/3drise-core';
7
+ // Side-effect import registers <hyperbolicGridMaterial> via extend().
8
+ void HyperbolicGridMaterial;
9
+ /** HyperbolicGridConfig defaults. Must match the catalog entry in grid-defaults.json exactly. */
10
+ export const defaultHyperbolicGridConfig = {
11
+ cellSize: 22,
12
+ size: 50,
13
+ flat: true,
14
+ segments: undefined,
15
+ lineMode: 1,
16
+ cellMode: 2,
17
+ lineWidth: 1.4,
18
+ sectionSize: 3,
19
+ sectionWidth: 1,
20
+ animSpeed: 1,
21
+ animScale: 1.2,
22
+ animIntensity: 0.7,
23
+ fadeDistance: undefined,
24
+ fadeStrength: 0.2,
25
+ displace: 0,
26
+ sides: 7,
27
+ valence: 3,
28
+ drift: 0.5,
29
+ lineColor: '#c9a4ff',
30
+ sectionColor: '#ffd9f2',
31
+ cellColor: '#2a1446',
32
+ glowColor: '#b07cff',
33
+ bgColor: '#07030c',
34
+ bgOpacity: 0,
35
+ followMouse: false,
36
+ reveal: 1,
37
+ revealDuration: 0,
38
+ };
39
+ /**
40
+ * An Escher-style {p,q} tiling of the Poincare disk. A slow Mobius translation glides the tiling through itself, and the tiles shrink without end toward the rim.
41
+ */
42
+ export function HyperbolicGrid({ config = defaultHyperbolicGridConfig, groupProps, onObjectReady, onObjectDispose }) {
43
+ const matRef = useRef(null);
44
+ const rootRef = useRef(null);
45
+ const meshRef = useRef(null);
46
+ useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
47
+ const { cellSize, size, segments, flat, lineMode, cellMode, lineWidth, sectionSize, sectionWidth, animSpeed, animScale, animIntensity, fadeDistance, fadeStrength, displace, sides, valence, drift, lineColor, sectionColor, cellColor, glowColor, bgColor, bgOpacity, followMouse, reveal, revealDuration, } = config;
48
+ // the ripple is fine-grained relative to the disk
49
+ const segs = segments ?? (displace > 0 ? Math.min(512, Math.max(96, Math.ceil(size / Math.max(cellSize, 1e-4)) * 64)) : 1);
50
+ const fade = fadeDistance ?? size * 0.5;
51
+ const colors = useMemo(() => ({
52
+ line: new THREE.Color(lineColor),
53
+ section: new THREE.Color(sectionColor),
54
+ cell: new THREE.Color(cellColor),
55
+ glow: new THREE.Color(glowColor),
56
+ bg: new THREE.Color(bgColor),
57
+ }), [lineColor, sectionColor, cellColor, glowColor, bgColor]);
58
+ useGridSurface(matRef, meshRef, { followMouse, reveal, revealDuration });
59
+ 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("hyperbolicGridMaterial", { 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_sides: sides, u_valence: valence, u_drift: drift, u_lineColor: colors.line, u_sectionColor: colors.section, u_cellColor: colors.cell, u_glowColor: colors.glow, u_bgColor: colors.bg, u_bgOpacity: bgOpacity }, HyperbolicGridMaterial.key)] }) }));
60
+ }
61
+ export default HyperbolicGrid;