@3driseai/3drise-core 1.0.10 → 1.0.11

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 (46) hide show
  1. package/dist/data/effectsDefaults.d.ts.map +1 -1
  2. package/dist/data/effectsDefaults.js +32 -8
  3. package/dist/shaders/ChladniGridMaterial.d.ts +77 -0
  4. package/dist/shaders/ChladniGridMaterial.d.ts.map +1 -0
  5. package/dist/shaders/ChladniGridMaterial.js +301 -0
  6. package/dist/shaders/FlowNetGridMaterial.d.ts +74 -0
  7. package/dist/shaders/FlowNetGridMaterial.d.ts.map +1 -0
  8. package/dist/shaders/FlowNetGridMaterial.js +269 -0
  9. package/dist/shaders/GirihGridMaterial.d.ts +77 -0
  10. package/dist/shaders/GirihGridMaterial.d.ts.map +1 -0
  11. package/dist/shaders/GirihGridMaterial.js +464 -0
  12. package/dist/shaders/GravWaveGridMaterial.d.ts +77 -0
  13. package/dist/shaders/GravWaveGridMaterial.d.ts.map +1 -0
  14. package/dist/shaders/GravWaveGridMaterial.js +479 -0
  15. package/dist/shaders/HyperbolicGridMaterial.d.ts +74 -0
  16. package/dist/shaders/HyperbolicGridMaterial.d.ts.map +1 -0
  17. package/dist/shaders/HyperbolicGridMaterial.js +298 -0
  18. package/dist/shaders/ReactionDiffusionGridMaterial.d.ts +80 -0
  19. package/dist/shaders/ReactionDiffusionGridMaterial.d.ts.map +1 -0
  20. package/dist/shaders/ReactionDiffusionGridMaterial.js +247 -0
  21. package/dist/shaders/WallpaperGridMaterial.d.ts +134 -0
  22. package/dist/shaders/WallpaperGridMaterial.d.ts.map +1 -0
  23. package/dist/shaders/WallpaperGridMaterial.js +433 -0
  24. package/dist/shaders/index.d.ts +7 -0
  25. package/dist/shaders/index.d.ts.map +1 -1
  26. package/dist/shaders/index.js +7 -0
  27. package/dist/types/gallery.d.ts +21 -0
  28. package/dist/types/gallery.d.ts.map +1 -1
  29. package/dist/types/generativeEffects.d.ts +270 -2
  30. package/dist/types/generativeEffects.d.ts.map +1 -1
  31. package/dist/types/mesh.d.ts +3 -0
  32. package/dist/types/mesh.d.ts.map +1 -1
  33. package/dist/utils/GalleryCreator.d.ts +4 -75
  34. package/dist/utils/GalleryCreator.d.ts.map +1 -1
  35. package/dist/utils/GalleryCreator.js +12 -461
  36. package/dist/utils/LayoutCreator.d.ts +125 -0
  37. package/dist/utils/LayoutCreator.d.ts.map +1 -0
  38. package/dist/utils/LayoutCreator.js +521 -0
  39. package/dist/utils/galleriesUtils.d.ts.map +1 -1
  40. package/dist/utils/galleriesUtils.js +3 -2
  41. package/dist/utils/handleTransformEffects.d.ts.map +1 -1
  42. package/dist/utils/handleTransformEffects.js +5 -3
  43. package/dist/utils/index.d.ts +1 -0
  44. package/dist/utils/index.d.ts.map +1 -1
  45. package/dist/utils/index.js +1 -0
  46. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"effectsDefaults.d.ts","sourceRoot":"","sources":["../../src/data/effectsDefaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKxE,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,oBAAoB,EAAE,sBAAsB,CAyB3F,CAAC;AACF,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAyBzE,CAAC"}
1
+ {"version":3,"file":"effectsDefaults.d.ts","sourceRoot":"","sources":["../../src/data/effectsDefaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKxE,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,oBAAoB,EAAE,sBAAsB,CAqC3F,CAAC;AACF,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAqCzE,CAAC"}
@@ -2,13 +2,13 @@
2
2
  // DEFAULTS
3
3
  // =============================================================================
4
4
  export const DEFAULT_GENERATIVE_EFFECTS = {
5
- molecules: { type: 'molecules', enabled: true, intensity: 1, speed: 1, color: '#00d4ff', opacity: 0.9, atomCount: 6, orbitRadius: 1.5, atomSize: 0.08, showBonds: true, bondColor: '#ffffff', randomizeAxes: true },
6
- shockwave: { type: 'shockwave', enabled: true, intensity: 1, speed: 1, color: '#ffffff', opacity: 0.8, ringCount: 2, expansionRadius: 3, thickness: 0.04, intervalSeconds: 2, rimColor: '#88ccff' },
5
+ molecules: { type: 'molecules', enabled: true, intensity: 1, speed: 1, color: '#00d4ff', opacity: 0.9, atomCount: 6, orbitRadius: 1.5, atomSize: 0.08, showBonds: true, bondColor: '#ffffff', randomizeAxes: true, orbital: -1, phaseColor: '#ff5a8a', cloudDensity: 1 },
6
+ shockwave: { type: 'shockwave', enabled: true, intensity: 1, speed: 1, color: '#ffffff', opacity: 0.8, ringCount: 2, expansionRadius: 3, thickness: 0.04, intervalSeconds: 2, rimColor: '#88ccff', shape: 0, deceleration: 0.85, instability: 0.4, dust: 0.5, condensation: 0.3 },
7
7
  aura: { type: 'aura', enabled: true, intensity: 1, speed: 1, color: '#7b2fff', opacity: 0.6, layerCount: 3, fresnelPower: 3, pulseSpeed: 1.5, innerColor: '#ffffff', outerColor: '#7b2fff', noiseAmount: 0.3, sizeMultiplier: 1.3 },
8
8
  dataStream: { type: 'dataStream', enabled: true, intensity: 1, speed: 1, color: '#00ff88', opacity: 0.85, particleCount: 150, spiralTurns: 3, streamRadius: 1.2, inward: false, particleSize: 0.04, coldColor: '#0d26e6', midColor: '#00d9ff', hotColor: '#ffeb8c' },
9
9
  constellation: { type: 'constellation', enabled: true, intensity: 1, speed: 0.3, color: '#ffe066', opacity: 0.9, starCount: 60, connectRadius: 1.2, orbitRadius: 2.0, twinkleSpeed: 2, lineOpacity: 0.3, starSize: 0.05 },
10
10
  hologram: { type: 'hologram', enabled: true, intensity: 1, speed: 1, color: '#00ffcc', opacity: 0.5, scanlineCount: 8, scanSpeed: 1.5, scanColor: '#00ffcc', gridEnabled: true, flickerAmount: 0.15, glitchEnabled: true },
11
- portal: { type: 'portal', enabled: true, intensity: 1, speed: 1, color: '#8800ff', opacity: 0.85, radius: 1.5, spiralTurns: 6, innerGlowColor: '#ffffff', outerGlowColor: '#8800ff', rotationSpeed: 1.2, particleRingEnabled: true, particleCount: 80 },
11
+ portal: { type: 'portal', enabled: true, intensity: 1, speed: 1, color: '#8800ff', opacity: 0.95, radius: 1.5, spiralTurns: 6, innerGlowColor: '#e9e4ff', outerGlowColor: '#8800ff', rotationSpeed: 1.2, particleRingEnabled: true, particleCount: 160, throatSize: 0.38, funnelDepth: 0.6, otherSideColor: '#2a6bff' },
12
12
  dnaHelix: { type: 'dnaHelix', enabled: true, intensity: 0.02, speed: 1, color: '#ff6600', opacity: 0.9, particleCount: 60, strandCount: 2, helixRadius: 0.8, helixHeight: 2.0, basePairColor: '#aaffcc', runningLightEnabled: true },
13
13
  orb: { type: 'orb', enabled: true, intensity: 1.5, speed: 1, color: '#7b2fff', opacity: 0.9, coreSize: 0.15, glowLayers: 3, innerColor: '#ffffff', outerColor: '#7b2fff', coronaEnabled: true, coronaColor: '#88ccff', noiseAmount: 0.45, pulseSpeed: 1.5 },
14
14
  lightning: { type: 'lightning', enabled: true, intensity: 1, speed: 1, color: '#ffffff', opacity: 0.9, glowColor: '#6699ff', boltCount: 4, branchDepth: 4, branchProbability: 0.5, flickerRate: 10, strikeRadius: 2.0 },
@@ -16,16 +16,28 @@ export const DEFAULT_GENERATIVE_EFFECTS = {
16
16
  fire: { type: 'fire', enabled: true, intensity: 1, speed: 1, color: '#ff3300', opacity: 0.9, radius: 1.0, height: 2.0, radiusScale: 0.5, heightScale: 1.5, turbulence: 1.5, sway: 1.2, tint: '#ff6600', light: true, mode: 'tongues', coverage: 0.85, tongues: 36 },
17
17
  forcefield: { type: 'forcefield', enabled: true, intensity: 1, speed: 1, color: '#44aaff', opacity: 0.9, hexSize: 0.06, rippleEnabled: true, shieldColor: '#44aaff', rimColor: '#ffffff' },
18
18
  neuralNetwork: { type: 'neuralNetwork', enabled: true, intensity: 1, speed: 1, color: '#00aaff', opacity: 0.9, nodeCount: 20, signalSpeed: 1.2, nodeColor: '#00aaff', pulseColor: '#ffffff', orbitSpeed: 0.3 },
19
- blackHole: { type: 'blackHole', enabled: true, intensity: 1.5, speed: 1, color: '#ff6600', opacity: 0.95, diskColor: '#ff6600', jetEnabled: true, jetColor: '#88aaff', rotationSpeed: 1.0, tilt: 15 },
20
- iceCrystals: { type: 'iceCrystals', enabled: true, intensity: 1, speed: 0.5, color: '#88ccff', opacity: 0.9, spikeCount: 30, spikeLength: 1.0, frostEnabled: true, iceColor: '#88ccff', pulseSpeed: 0.4 },
21
- smokePlume: { type: 'smokePlume', enabled: true, intensity: 1, speed: 1, color: '#aaaaaa', opacity: 0.6, particleCount: 180, height: 2.0, spread: 0.5, smokeColor: '#aaaaaa', turbulence: 0.5 },
22
- volumetricFog: { type: 'volumetricFog', enabled: true, intensity: 1, speed: 0.4, color: '#cccccc', opacity: 0.5, particleCount: 60, fogRadius: 1.4, driftSpeed: 0.3, fogColor: '#cccccc', density: 0.35 },
23
- smokeRing: { type: 'smokeRing', enabled: true, intensity: 1, speed: 1, color: '#bbbbbb', opacity: 0.65, ringCount: 2, expansionRadius: 3.0, riseSpeed: 0.5, intervalSeconds: 2.5, smokeColor: '#bbbbbb', thickness: 0.18 },
19
+ blackHole: { type: 'blackHole', enabled: true, intensity: 1.2, speed: 1, color: '#ffd2a0', opacity: 0.95, diskColor: '#ff6600', jetEnabled: true, jetColor: '#88aaff', rotationSpeed: 1, tilt: 15, horizonSize: 0.4, diskOuter: 3, lensing: 1, beaming: 1 },
20
+ iceCrystals: { type: 'iceCrystals', enabled: true, intensity: 1, speed: 0.5, color: '#88ccff', opacity: 0.9, spikeCount: 30, spikeLength: 1, frostEnabled: true, iceColor: '#9fd8ff', pulseSpeed: 0.4, habit: 0.8, branches: 5, sparkle: 1 },
21
+ smokePlume: { type: 'smokePlume', enabled: true, intensity: 1, speed: 1, color: '#aaaaaa', opacity: 0.6, particleCount: 180, height: 2, spread: 0.5, smokeColor: '#b4b4b8', turbulence: 0.5, heat: 0, wind: 0 },
22
+ volumetricFog: { type: 'volumetricFog', enabled: true, intensity: 1, speed: 0.4, color: '#fff1dc', opacity: 0.9, particleCount: 60, fogRadius: 1.8, driftSpeed: 0.3, fogColor: '#c9d2dc', density: 1, layerHeight: 1.2, anisotropy: 0.55, noiseScale: 1.5 },
23
+ smokeRing: { type: 'smokeRing', enabled: true, intensity: 1, speed: 1, color: '#bbbbbb', opacity: 0.65, ringCount: 2, expansionRadius: 3, riseSpeed: 0.5, intervalSeconds: 2.5, smokeColor: '#c4c4c8', thickness: 0.18, leapfrog: true, wobble: 0.5 },
24
24
  smokeRibbon: { type: 'smokeRibbon', enabled: true, intensity: 1, speed: 1, color: '#bbbbbb', detail: 1.4, remapLow: 0.2, remapHigh: 0.8, edgeX: 0.1, edgeY: 0.1, density: 1.0, twistStrength: 0.5, twistSpeed: 1.0, twistScale: 1.0, twistStart: 0.2 },
25
25
  flares: { type: 'flares', enabled: true, intensity: 1, speed: 1, color: '#ff6600', opacity: 0.9, shooting: true, maskResolution: 512, maskLayer: 0, radius: 1.0, padding: 0.5, fitKey: 'scale' },
26
26
  sparklesBurst: { type: 'sparklesBurst', enabled: true, intensity: 1, speed: 1, color: '#ffffff', opacity: 0.9, coreColor: '#ffffff', burstColor: '#ffffff', loop: true, durationMs: 1000, rayCount: 20, scale: 1.2, hoverColor: '#ffeb99', hoverRadius: 0.5, hoverIntensity: 2 },
27
27
  bubbles: { type: 'bubbles', enabled: true, intensity: 1, speed: 1, color: '#00ffff', opacity: 0.8, colors: ['#00ffff', '#88ccff', '#ffffff'], scale: 1.0, spawnRate: 5, floatSpeed: 0.5, iridescence: 0.7, lifetimeMs: 4000 },
28
28
  glyphs: { type: 'glyphs', enabled: true, intensity: 1, speed: 1, color: '#ff00ff', opacity: 0.9, ringColor: '#ff00ff', glyphsColor: '#ff00ff', shadesMultiplier: 0.5, hoverColor: '#ffeb99', hoverRadius: 0.5, hoverIntensity: 2, ringRadius: 1.2, glyphCount: 30, rotationSpeed: 0.5, morphSpeed: 0.3 },
29
+ fieldLines: { type: 'fieldLines', enabled: true, intensity: 1, speed: 1, color: '#7ff5e4', opacity: 0.9, shells: 4, linesPerShell: 12, extent: 3.2, twist: 0, tilt: 11, particleCount: 6, particleSize: 1.2, apexColor: '#6a5cff' },
30
+ strangeAttractor: { type: 'strangeAttractor', enabled: true, intensity: 1, speed: 1, color: '#5fb8ff', opacity: 0.9, system: 0, strands: 6, chaos: 0.5, trailLength: 0.18, scale: 1.4, ghostOpacity: 0.07, particleSize: 2.5, headColor: '#fff1c9' },
31
+ harmonicShell: { type: 'harmonicShell', enabled: true, intensity: 1, speed: 1, color: '#3a2a6b', opacity: 0.9, degree: 3, amplitude: 0.22, sizeMultiplier: 1.35, filmThickness: 380, nodalLines: 0.6, rimColor: '#bfe8ff' },
32
+ galaxy: { type: 'galaxy', enabled: true, intensity: 1, speed: 1, color: '#9fc4ff', opacity: 0.9, starCount: 18000, radius: 3, armTwist: 5.5, ellipticity: 0.32, bulgeSize: 0.22, dust: 0.6, tilt: 22, coreColor: '#ffd9a8' },
33
+ fireflySwarm: { type: 'fireflySwarm', enabled: true, intensity: 1, speed: 1, color: '#6f7d45', opacity: 1, count: 150, coupling: 1, frequency: 0.55, spread: 2.4, driftSpeed: 1, glowSize: 1, flashColor: '#d4ff5c' },
34
+ murmuration: { type: 'murmuration', enabled: true, intensity: 1, speed: 1, color: '#b9c8dc', opacity: 0.92, count: 2200, flockRadius: 2.6, cohesion: 1, alignment: 1, separation: 1, birdSize: 1 },
35
+ planetaryRings: { type: 'planetaryRings', enabled: true, intensity: 1, speed: 1, color: '#e9dcc2', opacity: 1, innerRadius: 1.35, outerRadius: 2.6, tilt: 17, moons: 3, spokes: 0.45, forwardScatter: 0.35, sunAngle: 45, sunElevation: 24, gapColor: '#8fa2b6', dustColor: '#ffd3a1' },
36
+ waterCaustics: { type: 'waterCaustics', enabled: true, intensity: 1, speed: 1, color: '#a9ecff', opacity: 1, waterDepth: 2.6, waveScale: 0.45, waveHeight: 1, dispersion: 0.5, radius: 3.4, showOnHost: true },
37
+ iceHalo: { type: 'iceHalo', enabled: true, intensity: 1, speed: 1, color: '#fff2dd', opacity: 1, haloScale: 0.35, sunDogs: 0.8, outerHalo: 0.4, parhelicCircle: 0.35, pillar: 0.45, glare: 0.9 },
38
+ fallingLeaves: { type: 'fallingLeaves', enabled: true, intensity: 1, speed: 1, color: '#7f9b3f', opacity: 1, leafCount: 60, leafSize: 1.3, fallHeight: 3, spread: 2.2, tumble: 0.35, wind: 0.5, autumnColor: '#c4631f' },
39
+ lichtenberg: { type: 'lichtenberg', enabled: true, intensity: 1, speed: 1, color: '#6f9dff', opacity: 1, nodeCount: 3200, branching: 2.2, growthTime: 9, lineWidth: 1, pulse: 0.6, coreColor: '#f2f6ff' },
40
+ dandelionSeeds: { type: 'dandelionSeeds', enabled: true, intensity: 1, speed: 1, color: '#ffeccf', opacity: 1, seedCount: 90, windSpeed: 0.55, windDirection: 20, turbulence: 0.8, seedSize: 1, lift: 1, stemColor: '#d8b183' },
29
41
  };
30
42
  export const GENERATIVE_EFFECT_LABELS = {
31
43
  molecules: 'Molecules',
@@ -52,4 +64,16 @@ export const GENERATIVE_EFFECT_LABELS = {
52
64
  sparklesBurst: 'Sparkles Burst',
53
65
  bubbles: 'Bubbles',
54
66
  glyphs: 'Glyphs',
67
+ fieldLines: 'Field Lines',
68
+ strangeAttractor: 'Strange Attractor',
69
+ harmonicShell: 'Harmonic Shell',
70
+ galaxy: 'Galaxy',
71
+ fireflySwarm: 'Firefly Swarm',
72
+ murmuration: 'Murmuration',
73
+ planetaryRings: 'Planetary Rings',
74
+ waterCaustics: 'Water Caustics',
75
+ iceHalo: 'Ice Halo',
76
+ fallingLeaves: 'Falling Leaves',
77
+ lichtenberg: 'Lichtenberg',
78
+ dandelionSeeds: 'Dandelion Seeds',
55
79
  };
@@ -0,0 +1,77 @@
1
+ import * as THREE from 'three';
2
+ /**
3
+ * Chladni plates: the nodal lines of a standing wave on a square plate, with sand settling on them, drifting slowly between two neighbouring resonances.
4
+ *
5
+ * Shares the grid vocabulary with the other shader-plane grids (lineMode /
6
+ * cellMode 0..4, fade, reveal, focus), so the same controller drives it.
7
+ */
8
+ export interface ChladniGridMaterialUniforms {
9
+ u_time: number;
10
+ u_cellSize: number;
11
+ u_lineWidth: number;
12
+ u_sectionSize: number;
13
+ u_sectionWidth: number;
14
+ u_lineColor: THREE.Color;
15
+ u_sectionColor: THREE.Color;
16
+ u_cellColor: THREE.Color;
17
+ u_glowColor: THREE.Color;
18
+ u_bgColor: THREE.Color;
19
+ u_bgOpacity: number;
20
+ u_lineMode: number;
21
+ u_cellMode: number;
22
+ u_animSpeed: number;
23
+ u_animScale: number;
24
+ u_animIntensity: number;
25
+ u_fadeDistance: number;
26
+ u_fadeStrength: number;
27
+ u_focus: THREE.Vector2;
28
+ u_mouse: THREE.Vector2;
29
+ u_displace: number;
30
+ /** 0..1 assemble/dissolve. The build boundary sweeps outward from u_focus with a bright leading edge; 1 is fully built, 0 is gone. */
31
+ u_reveal: number;
32
+ /** first mode number of the standing wave, 1..12 */
33
+ u_modeN: number;
34
+ /** second mode number of the standing wave, 1..12 */
35
+ u_modeM: number;
36
+ /** how fast the plate drifts to the neighbouring resonance; 0 holds the pattern */
37
+ u_morph: number;
38
+ /** 0..1 amount of sand on the plate */
39
+ u_grain: number;
40
+ }
41
+ declare module '@react-three/fiber' {
42
+ interface ThreeElements {
43
+ chladniGridMaterial: ThreeElements['shaderMaterial'] & Partial<ChladniGridMaterialUniforms>;
44
+ }
45
+ }
46
+ export declare const chladniGridMaterialDefaults: ChladniGridMaterialUniforms;
47
+ export declare const ChladniGridMaterial: import("@react-three/fiber").ConstructorRepresentation<THREE.ShaderMaterial & {
48
+ u_time: number;
49
+ u_cellSize: number;
50
+ u_lineWidth: number;
51
+ u_sectionSize: number;
52
+ u_sectionWidth: number;
53
+ u_lineColor: THREE.Color;
54
+ u_sectionColor: THREE.Color;
55
+ u_cellColor: THREE.Color;
56
+ u_glowColor: THREE.Color;
57
+ u_bgColor: THREE.Color;
58
+ u_bgOpacity: number;
59
+ u_lineMode: number;
60
+ u_cellMode: number;
61
+ u_animSpeed: number;
62
+ u_animScale: number;
63
+ u_animIntensity: number;
64
+ u_fadeDistance: number;
65
+ u_fadeStrength: number;
66
+ u_focus: THREE.Vector2;
67
+ u_mouse: THREE.Vector2;
68
+ u_displace: number;
69
+ u_reveal: number;
70
+ u_modeN: number;
71
+ u_modeM: number;
72
+ u_morph: number;
73
+ u_grain: number;
74
+ }> & {
75
+ key: string;
76
+ };
77
+ //# sourceMappingURL=ChladniGridMaterial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChladniGridMaterial.d.ts","sourceRoot":"","sources":["../../src/shaders/ChladniGridMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;;;GAKG;AACH,MAAM,WAAW,2BAA2B;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC;IAC5B,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,sIAAsI;IACtI,QAAQ,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,OAAO,QAAQ,oBAAoB,CAAC;IAChC,UAAU,aAAa;QACnB,mBAAmB,EAAE,aAAa,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;KAC/F;CACJ;AAED,eAAO,MAAM,2BAA2B,EAAE,2BA2BzC,CAAC;AAqPF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+B/B,CAAC"}
@@ -0,0 +1,301 @@
1
+ import * as THREE from 'three';
2
+ import { shaderMaterial } from '@react-three/drei';
3
+ import { extend } from '@react-three/fiber';
4
+ export const chladniGridMaterialDefaults = {
5
+ u_time: 0,
6
+ u_cellSize: 8,
7
+ u_lineWidth: 1.2,
8
+ u_sectionSize: 1,
9
+ u_sectionWidth: 0.8,
10
+ u_lineColor: new THREE.Color('#d9c7a3'),
11
+ u_sectionColor: new THREE.Color('#4d5d6e'),
12
+ u_cellColor: new THREE.Color('#16222e'),
13
+ u_glowColor: new THREE.Color('#ffe2a8'),
14
+ u_bgColor: new THREE.Color('#06080b'),
15
+ u_bgOpacity: 0,
16
+ u_lineMode: 0,
17
+ u_cellMode: 2,
18
+ u_animSpeed: 1,
19
+ u_animScale: 0.5,
20
+ u_animIntensity: 0.6,
21
+ u_fadeDistance: 25,
22
+ u_fadeStrength: 0.6,
23
+ u_focus: new THREE.Vector2(0, 0),
24
+ u_mouse: new THREE.Vector2(0, 0),
25
+ u_displace: 0,
26
+ u_reveal: 1.0,
27
+ u_modeN: 3,
28
+ u_modeM: 5,
29
+ u_morph: 0.4,
30
+ u_grain: 0.8,
31
+ };
32
+ const vertex = /* glsl */ `
33
+
34
+ uniform float u_time;
35
+ uniform float u_cellSize;
36
+ uniform float u_displace;
37
+ uniform float u_animSpeed;
38
+ uniform float u_animScale;
39
+
40
+ varying vec2 vGridPos;
41
+
42
+
43
+ const float PI = 3.14159265359;
44
+ const float TAU = 6.28318530718;
45
+
46
+ float hash21(vec2 p){
47
+ p = fract(p * vec2(123.34, 456.21));
48
+ p += dot(p, p + 45.32);
49
+ return fract(p.x * p.y);
50
+ }
51
+
52
+
53
+ uniform float u_modeN;
54
+ uniform float u_modeM;
55
+ uniform float u_morph;
56
+
57
+ // Chladni's plate. A standing wave on a square plate is a superposition of
58
+ // two degenerate modes, cos(n*pi*x)cos(m*pi*y) - cos(m*pi*x)cos(n*pi*y).
59
+ // Sand collects where it is zero: the nodal lines.
60
+ float chladniMode(vec2 x, float n, float m){
61
+ m += step(abs(n - m), 0.5); // n == m is the trivial zero field
62
+ return cos(n * x.x) * cos(m * x.y) - cos(m * x.x) * cos(n * x.y);
63
+ }
64
+
65
+ float chladniField(vec2 coord, float t){
66
+ float n = floor(clamp(u_modeN, 1.0, 12.0) + 0.5);
67
+ float m = floor(clamp(u_modeM, 1.0, 12.0) + 0.5);
68
+ vec2 x = coord * PI;
69
+ // Drift between two neighbouring resonances: the nodal lines slide
70
+ // continuously from one pattern into the next.
71
+ float a = t * u_morph * 0.35;
72
+ return cos(a) * chladniMode(x, n, m) + sin(a) * chladniMode(x, n + 1.0, m);
73
+ }
74
+
75
+
76
+ void main(){
77
+ vGridPos = position.xy;
78
+ vec3 pos = position;
79
+ if (u_displace > 0.0){
80
+ // the plate itself vibrates: the displacement is the standing wave
81
+ float t = u_time * u_animSpeed;
82
+ float f = chladniField(position.xy / max(u_cellSize, 1e-4), t);
83
+ pos.z += f * u_displace * 0.5 * sin(t * 3.0);
84
+ }
85
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
86
+ }
87
+ `;
88
+ const fragment = /* glsl */ `
89
+
90
+ precision highp float;
91
+
92
+ uniform float u_time;
93
+ uniform float u_cellSize;
94
+ uniform float u_lineWidth;
95
+ uniform float u_sectionSize;
96
+ uniform float u_sectionWidth;
97
+ uniform vec3 u_lineColor;
98
+ uniform vec3 u_sectionColor;
99
+ uniform vec3 u_cellColor;
100
+ uniform vec3 u_glowColor;
101
+ uniform vec3 u_bgColor;
102
+ uniform float u_bgOpacity;
103
+ uniform float u_lineMode;
104
+ uniform float u_cellMode;
105
+ uniform float u_animSpeed;
106
+ uniform float u_animScale;
107
+ uniform float u_animIntensity;
108
+ uniform float u_fadeDistance;
109
+ uniform float u_fadeStrength;
110
+ uniform vec2 u_focus;
111
+ uniform float u_reveal;
112
+
113
+ varying vec2 vGridPos;
114
+
115
+ float lineAt(float c, float width, float fp){
116
+ float d = abs(fract(c - 0.5) - 0.5);
117
+ return 1.0 - clamp(d / max(fp * max(width, 0.05), 1e-6), 0.0, 1.0);
118
+ }
119
+
120
+
121
+ const float PI = 3.14159265359;
122
+ const float TAU = 6.28318530718;
123
+
124
+ float hash21(vec2 p){
125
+ p = fract(p * vec2(123.34, 456.21));
126
+ p += dot(p, p + 45.32);
127
+ return fract(p.x * p.y);
128
+ }
129
+
130
+
131
+ uniform float u_modeN;
132
+ uniform float u_modeM;
133
+ uniform float u_morph;
134
+
135
+ // Chladni's plate. A standing wave on a square plate is a superposition of
136
+ // two degenerate modes, cos(n*pi*x)cos(m*pi*y) - cos(m*pi*x)cos(n*pi*y).
137
+ // Sand collects where it is zero: the nodal lines.
138
+ float chladniMode(vec2 x, float n, float m){
139
+ m += step(abs(n - m), 0.5); // n == m is the trivial zero field
140
+ return cos(n * x.x) * cos(m * x.y) - cos(m * x.x) * cos(n * x.y);
141
+ }
142
+
143
+ float chladniField(vec2 coord, float t){
144
+ float n = floor(clamp(u_modeN, 1.0, 12.0) + 0.5);
145
+ float m = floor(clamp(u_modeM, 1.0, 12.0) + 0.5);
146
+ vec2 x = coord * PI;
147
+ // Drift between two neighbouring resonances: the nodal lines slide
148
+ // continuously from one pattern into the next.
149
+ float a = t * u_morph * 0.35;
150
+ return cos(a) * chladniMode(x, n, m) + sin(a) * chladniMode(x, n + 1.0, m);
151
+ }
152
+
153
+
154
+ uniform float u_grain;
155
+
156
+ void main(){
157
+ float cs = max(u_cellSize, 1e-4);
158
+ vec2 coord = vGridPos / cs; // one plate per cell
159
+ vec2 focus = u_focus / cs;
160
+ float t = u_time * u_animSpeed;
161
+
162
+ float f = chladniField(coord, t);
163
+ float fp = max(fwidth(f), 1e-5);
164
+ float nodal = 1.0 - clamp(abs(f) / (fp * max(u_lineWidth, 0.05)), 0.0, 1.0);
165
+
166
+ // Sand: one grain slot per small cell. A grain sits in its slot with a
167
+ // probability that falls off exponentially with the local amplitude |f|,
168
+ // so grains pile up on the nodal lines and thin out towards antinodes.
169
+ vec2 gq = coord * 72.0;
170
+ vec2 gid = floor(gq);
171
+ float gh = hash21(gid);
172
+ vec2 go = vec2(hash21(gid + 3.1), hash21(gid + 7.7)) - 0.5;
173
+ float gd = length(fract(gq) - 0.5 - go * 0.4);
174
+ float gpx = 1.0 / max(length(fwidth(gq)) * 0.7071, 1e-4); // pixels per slot
175
+ float settle = exp(-abs(f) * 7.0);
176
+ float grainOn = step(gh, u_grain * settle);
177
+ float disk = 1.0 - smoothstep(0.22 - 0.5 / gpx, 0.22 + 0.5 / gpx, gd);
178
+ // when a slot is smaller than a couple of pixels, draw the average density instead
179
+ float resolved = clamp((gpx - 1.5) / 3.0, 0.0, 1.0);
180
+ float sand = mix(u_grain * settle * 0.35,
181
+ grainOn * disk * (0.55 + 0.45 * hash21(gid + 1.3)),
182
+ resolved);
183
+
184
+ float lines = max(nodal, sand);
185
+
186
+ float accent = 0.0;
187
+ if (u_sectionWidth > 0.0 && u_sectionSize > 0.0){
188
+ vec2 sc = coord / u_sectionSize;
189
+ vec2 sfp = max(fwidth(sc), vec2(1e-6));
190
+ accent = max(lineAt(sc.x, u_sectionWidth, sfp.x), lineAt(sc.y, u_sectionWidth, sfp.y));
191
+ }
192
+
193
+ vec2 plate = floor(coord);
194
+ float cellH = hash21(plate + 0.5);
195
+ float cellDist = length(coord - focus) * 6.0;
196
+ float flowCoord = (coord.x + coord.y) * 6.0;
197
+ float scanCoord = (coord.x + coord.y) * 8.0;
198
+ // the fill shimmers on the antinodes and stays off the sand
199
+ float edgeKeep = smoothstep(0.15, 0.9, abs(f));
200
+ float fadeR = length(vGridPos) / max(u_fadeDistance, 1e-4);
201
+
202
+ vec3 extraCol = u_glowColor * nodal * 0.25;
203
+ float extraA = 0.0;
204
+ float regionMask = 1.0;
205
+
206
+ // ---- line animation --------------------------------------------------
207
+ float lineAnim = 1.0;
208
+ if (u_lineMode > 0.5){
209
+ if (u_lineMode < 1.5){
210
+ lineAnim = 0.5 + 0.5 * sin(cellDist * u_animScale - t);
211
+ } else if (u_lineMode < 2.5){
212
+ lineAnim = 0.5 + 0.5 * sin(flowCoord * u_animScale - t);
213
+ } else if (u_lineMode < 3.5){
214
+ float s = fract(scanCoord * 0.05 * u_animScale - t * 0.15);
215
+ lineAnim = 0.25 + smoothstep(0.0, 0.15, s) * (1.0 - smoothstep(0.15, 0.35, s));
216
+ } else {
217
+ lineAnim = 0.5 + 0.5 * sin(t);
218
+ }
219
+ }
220
+ lineAnim = mix(1.0, lineAnim, u_animIntensity);
221
+
222
+ // ---- cell fill -------------------------------------------------------
223
+ float cell = 0.0;
224
+ if (u_cellMode > 0.5){
225
+ if (u_cellMode < 1.5){
226
+ cell = 0.5 + 0.5 * sin(flowCoord * 0.5 * u_animScale - t);
227
+ } else if (u_cellMode < 2.5){
228
+ cell = 0.5 + 0.5 * sin(t * (0.6 + cellH) + cellH * TAU);
229
+ } else if (u_cellMode < 3.5){
230
+ cell = smoothstep(0.6, 1.0, sin(cellDist * u_animScale - t));
231
+ } else {
232
+ cell = step(0.5, cellH) * (0.5 + 0.5 * sin(t));
233
+ }
234
+ }
235
+ cell *= u_animIntensity * edgeKeep;
236
+
237
+ float tone = step(0.55, cellH);
238
+
239
+ vec3 col = u_bgColor * u_bgOpacity;
240
+ float a = u_bgOpacity;
241
+
242
+ col += mix(u_cellColor, u_cellColor * 2.2, tone) * cell;
243
+ a = max(a, cell * 0.9);
244
+ float linesI = lines * lineAnim;
245
+ col += u_lineColor * linesI; a = max(a, linesI);
246
+ float accentI = accent * lineAnim;
247
+ col += u_sectionColor * accentI; a = max(a, accentI);
248
+ col += u_glowColor * (linesI * 0.2 + cell * 0.35) * u_animIntensity;
249
+
250
+ col = col * regionMask + extraCol;
251
+ a = max(a * regionMask, extraA);
252
+
253
+ float fade = 1.0 - smoothstep(1.0 - u_fadeStrength, 1.0, fadeR);
254
+ col *= fade;
255
+ a *= fade;
256
+
257
+ // ---- reveal ----------------------------------------------------------
258
+ // The build boundary sweeps outward from the focus point with a bright
259
+ // leading edge, so the grid reads as assembling itself.
260
+ if (u_reveal < 0.999){
261
+ float rd = length(vGridPos - u_focus) / max(u_fadeDistance, 1e-4);
262
+ float edge = u_reveal * 1.1;
263
+ float mask = 1.0 - smoothstep(edge - 0.05, edge, rd);
264
+ float front = mask * smoothstep(edge - 0.22, edge - 0.05, rd);
265
+ col = col * mask + u_glowColor * front * (a * 1.8 + 0.08);
266
+ a = max(a * mask, front * 0.10);
267
+ }
268
+
269
+ if (a < 0.002) discard;
270
+ gl_FragColor = vec4(col, a);
271
+ }
272
+ `;
273
+ export const ChladniGridMaterial = shaderMaterial({
274
+ u_time: chladniGridMaterialDefaults.u_time,
275
+ u_cellSize: chladniGridMaterialDefaults.u_cellSize,
276
+ u_lineWidth: chladniGridMaterialDefaults.u_lineWidth,
277
+ u_sectionSize: chladniGridMaterialDefaults.u_sectionSize,
278
+ u_sectionWidth: chladniGridMaterialDefaults.u_sectionWidth,
279
+ u_lineColor: chladniGridMaterialDefaults.u_lineColor.clone(),
280
+ u_sectionColor: chladniGridMaterialDefaults.u_sectionColor.clone(),
281
+ u_cellColor: chladniGridMaterialDefaults.u_cellColor.clone(),
282
+ u_glowColor: chladniGridMaterialDefaults.u_glowColor.clone(),
283
+ u_bgColor: chladniGridMaterialDefaults.u_bgColor.clone(),
284
+ u_bgOpacity: chladniGridMaterialDefaults.u_bgOpacity,
285
+ u_lineMode: chladniGridMaterialDefaults.u_lineMode,
286
+ u_cellMode: chladniGridMaterialDefaults.u_cellMode,
287
+ u_animSpeed: chladniGridMaterialDefaults.u_animSpeed,
288
+ u_animScale: chladniGridMaterialDefaults.u_animScale,
289
+ u_animIntensity: chladniGridMaterialDefaults.u_animIntensity,
290
+ u_fadeDistance: chladniGridMaterialDefaults.u_fadeDistance,
291
+ u_fadeStrength: chladniGridMaterialDefaults.u_fadeStrength,
292
+ u_focus: chladniGridMaterialDefaults.u_focus.clone(),
293
+ u_mouse: chladniGridMaterialDefaults.u_mouse.clone(),
294
+ u_displace: chladniGridMaterialDefaults.u_displace,
295
+ u_reveal: chladniGridMaterialDefaults.u_reveal,
296
+ u_modeN: chladniGridMaterialDefaults.u_modeN,
297
+ u_modeM: chladniGridMaterialDefaults.u_modeM,
298
+ u_morph: chladniGridMaterialDefaults.u_morph,
299
+ u_grain: chladniGridMaterialDefaults.u_grain,
300
+ }, vertex, fragment);
301
+ extend({ ChladniGridMaterial });
@@ -0,0 +1,74 @@
1
+ import * as THREE from 'three';
2
+ /**
3
+ * 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.
4
+ *
5
+ * Shares the grid vocabulary with the other shader-plane grids (lineMode /
6
+ * cellMode 0..4, fade, reveal, focus), so the same controller drives it.
7
+ */
8
+ export interface FlowNetGridMaterialUniforms {
9
+ u_time: number;
10
+ u_cellSize: number;
11
+ u_lineWidth: number;
12
+ u_sectionSize: number;
13
+ u_sectionWidth: number;
14
+ u_lineColor: THREE.Color;
15
+ u_sectionColor: THREE.Color;
16
+ u_cellColor: THREE.Color;
17
+ u_glowColor: THREE.Color;
18
+ u_bgColor: THREE.Color;
19
+ u_bgOpacity: number;
20
+ u_lineMode: number;
21
+ u_cellMode: number;
22
+ u_animSpeed: number;
23
+ u_animScale: number;
24
+ u_animIntensity: number;
25
+ u_fadeDistance: number;
26
+ u_fadeStrength: number;
27
+ u_focus: THREE.Vector2;
28
+ u_mouse: THREE.Vector2;
29
+ u_displace: number;
30
+ /** 0..1 assemble/dissolve. The build boundary sweeps outward from u_focus with a bright leading edge; 1 is fully built, 0 is gone. */
31
+ u_reveal: number;
32
+ /** cylinder radius, in cells */
33
+ u_obstacleRadius: number;
34
+ /** circulation around the cylinder, in whole units; shifts the flow to one side (lift) */
35
+ u_circulation: number;
36
+ /** direction of the free-stream flow, in radians */
37
+ u_flowAngle: number;
38
+ }
39
+ declare module '@react-three/fiber' {
40
+ interface ThreeElements {
41
+ flowNetGridMaterial: ThreeElements['shaderMaterial'] & Partial<FlowNetGridMaterialUniforms>;
42
+ }
43
+ }
44
+ export declare const flowNetGridMaterialDefaults: FlowNetGridMaterialUniforms;
45
+ export declare const FlowNetGridMaterial: import("@react-three/fiber").ConstructorRepresentation<THREE.ShaderMaterial & {
46
+ u_time: number;
47
+ u_cellSize: number;
48
+ u_lineWidth: number;
49
+ u_sectionSize: number;
50
+ u_sectionWidth: number;
51
+ u_lineColor: THREE.Color;
52
+ u_sectionColor: THREE.Color;
53
+ u_cellColor: THREE.Color;
54
+ u_glowColor: THREE.Color;
55
+ u_bgColor: THREE.Color;
56
+ u_bgOpacity: number;
57
+ u_lineMode: number;
58
+ u_cellMode: number;
59
+ u_animSpeed: number;
60
+ u_animScale: number;
61
+ u_animIntensity: number;
62
+ u_fadeDistance: number;
63
+ u_fadeStrength: number;
64
+ u_focus: THREE.Vector2;
65
+ u_mouse: THREE.Vector2;
66
+ u_displace: number;
67
+ u_reveal: number;
68
+ u_obstacleRadius: number;
69
+ u_circulation: number;
70
+ u_flowAngle: number;
71
+ }> & {
72
+ key: string;
73
+ };
74
+ //# sourceMappingURL=FlowNetGridMaterial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlowNetGridMaterial.d.ts","sourceRoot":"","sources":["../../src/shaders/FlowNetGridMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;;;GAKG;AACH,MAAM,WAAW,2BAA2B;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC;IAC5B,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,sIAAsI;IACtI,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,0FAA0F;IAC1F,aAAa,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,OAAO,QAAQ,oBAAoB,CAAC;IAChC,UAAU,aAAa;QACnB,mBAAmB,EAAE,aAAa,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;KAC/F;CACJ;AAED,eAAO,MAAM,2BAA2B,EAAE,2BA0BzC,CAAC;AAuNF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B/B,CAAC"}