@ntalmagor/3drize-viewer 0.1.26 → 0.1.27

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 (60) hide show
  1. package/dist/components/Bubbles.d.ts +3 -2
  2. package/dist/components/Bubbles.d.ts.map +1 -1
  3. package/dist/components/Bubbles.js +2 -3
  4. package/dist/components/Corona.d.ts +26 -0
  5. package/dist/components/Corona.d.ts.map +1 -0
  6. package/dist/components/Corona.js +12 -0
  7. package/dist/components/CustomPrimitive.d.ts.map +1 -1
  8. package/dist/components/CustomPrimitive.js +46 -40
  9. package/dist/components/Earth.d.ts +3 -13
  10. package/dist/components/Earth.d.ts.map +1 -1
  11. package/dist/components/Earth.js +7 -12
  12. package/dist/components/EffectsGenerator.d.ts +1 -1
  13. package/dist/components/EffectsGenerator.d.ts.map +1 -1
  14. package/dist/components/EffectsGenerator.js +10 -2
  15. package/dist/components/EffectsGroup.d.ts.map +1 -1
  16. package/dist/components/EffectsGroup.js +3 -1
  17. package/dist/components/Flares.d.ts +64 -0
  18. package/dist/components/Flares.d.ts.map +1 -0
  19. package/dist/components/Flares.js +134 -0
  20. package/dist/components/Frame.js +1 -0
  21. package/dist/components/GalleryLayout.d.ts.map +1 -1
  22. package/dist/components/GalleryLayout.js +5 -5
  23. package/dist/components/Glyphs.d.ts +3 -2
  24. package/dist/components/Glyphs.d.ts.map +1 -1
  25. package/dist/components/Glyphs.js +5 -5
  26. package/dist/components/ImageGeometry.js +1 -1
  27. package/dist/components/Lensflare.d.ts +1 -1
  28. package/dist/components/Lensflare.d.ts.map +1 -1
  29. package/dist/components/Lensflare.js +1 -1
  30. package/dist/components/Moon.d.ts +2 -2
  31. package/dist/components/Moon.d.ts.map +1 -1
  32. package/dist/components/Moon.js +4 -4
  33. package/dist/components/ObjectNode.d.ts.map +1 -1
  34. package/dist/components/ObjectNode.js +11 -9
  35. package/dist/components/Planet.d.ts +16 -0
  36. package/dist/components/Planet.d.ts.map +1 -0
  37. package/dist/components/Planet.js +60 -0
  38. package/dist/components/ShootingStars.d.ts.map +1 -1
  39. package/dist/components/ShootingStars.js +1 -0
  40. package/dist/components/SolarSystem.d.ts +5 -0
  41. package/dist/components/SolarSystem.d.ts.map +1 -0
  42. package/dist/components/SolarSystem.js +76 -0
  43. package/dist/components/SparklesBurst.d.ts +3 -2
  44. package/dist/components/SparklesBurst.d.ts.map +1 -1
  45. package/dist/components/SparklesBurst.js +3 -3
  46. package/dist/components/Sun.d.ts +34 -0
  47. package/dist/components/Sun.d.ts.map +1 -0
  48. package/dist/components/Sun.js +7 -0
  49. package/dist/components/SunCore.d.ts +26 -0
  50. package/dist/components/SunCore.d.ts.map +1 -0
  51. package/dist/components/SunCore.js +14 -0
  52. package/dist/components/effects/Fire.d.ts +29 -0
  53. package/dist/components/effects/Fire.d.ts.map +1 -0
  54. package/dist/components/effects/Fire.js +208 -0
  55. package/dist/hooks/useMeshController.d.ts.map +1 -1
  56. package/dist/hooks/useMeshController.js +5 -1
  57. package/dist/index.d.ts +3 -2
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +3 -1
  60. package/package.json +4 -2
@@ -39,7 +39,7 @@ export const ImageGeometry = forwardRef(({ geometryType, url, position = [0, 0,
39
39
  }
40
40
  }, [geometryType, position, rotation, scale]);
41
41
  const createdMesh = useMemo(() => {
42
- const mesh = createMeshByType(meshConfig);
42
+ const mesh = createMeshByType(meshConfig)?.mesh;
43
43
  if (!(mesh instanceof Mesh))
44
44
  return null;
45
45
  if (texture) {
@@ -5,7 +5,7 @@ export declare function createFlareTexture(type: number): THREE.CanvasTexture;
5
5
  export interface LensflareProps {
6
6
  visible?: boolean;
7
7
  intensity?: number;
8
- timeSettings: TimeSettings;
8
+ timeSettings?: TimeSettings;
9
9
  }
10
10
  declare const Lensflare: React.FC<LensflareProps>;
11
11
  export default Lensflare;
@@ -1 +1 @@
1
- {"version":3,"file":"Lensflare.d.ts","sourceRoot":"","sources":["../../src/components/Lensflare.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CA6BpE;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA4CvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"Lensflare.d.ts","sourceRoot":"","sources":["../../src/components/Lensflare.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CA6BpE;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA4CvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -32,7 +32,7 @@ export function createFlareTexture(type) {
32
32
  texture.magFilter = THREE.LinearFilter;
33
33
  return texture;
34
34
  }
35
- const Lensflare = ({ visible = true, intensity = 1, timeSettings, }) => {
35
+ const Lensflare = ({ visible = true, intensity = 1, timeSettings = { enabled: false, timeOfDay: 12, timescale: 1, autoAnimate: true, syncWithRealTime: false }, }) => {
36
36
  const spriteRef = useRef(null);
37
37
  const { camera } = useThree();
38
38
  const texture = useMemo(() => createFlareTexture(0), []);
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import * as THREE from 'three';
2
+ import { Mesh } from 'three';
3
3
  import type { MoonSettings } from '@ntalmagor/3drize-core';
4
4
  export { defaultMoonSettings } from '@ntalmagor/3drize-core';
5
5
  export interface MoonProps {
6
6
  settings?: MoonSettings;
7
7
  sunPosition?: [number, number, number];
8
- onMeshReady?: (mesh: THREE.Mesh) => void;
8
+ onMeshReady?: (mesh: Mesh) => void;
9
9
  }
10
10
  declare const Moon: React.FC<MoonProps>;
11
11
  export default Moon;
@@ -1 +1 @@
1
- {"version":3,"file":"Moon.d.ts","sourceRoot":"","sources":["../../src/components/Moon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAK7D,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;CAC1C;AAED,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAuF7B,CAAC;AAGF,eAAe,IAAI,CAAC;AACpB,YAAY,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"Moon.d.ts","sourceRoot":"","sources":["../../src/components/Moon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAC,IAAI,EAA8D,MAAM,OAAO,CAAC;AAExF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAK7D,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CACpC;AAED,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAuF7B,CAAC;AAGF,eAAe,IAAI,CAAC;AACpB,YAAY,EAAE,YAAY,EAAE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useRef, useEffect, useState, useCallback } from 'react';
3
- import * as THREE from 'three';
3
+ import { TextureLoader, Vector3 } from 'three';
4
4
  import { useFrame } from '@react-three/fiber';
5
5
  export { defaultMoonSettings } from '@ntalmagor/3drize-core';
6
6
  const MOON_TEXTURE_URL = "https://3d-rise.sfo3.cdn.digitaloceanspaces.com/app/images/moon_1024.jpg";
@@ -10,7 +10,7 @@ const Moon = ({ settings, sunPosition, onMeshReady }) => {
10
10
  const targetRef = useRef(null);
11
11
  const [texture, setTexture] = useState(null);
12
12
  useEffect(() => {
13
- const loader = new THREE.TextureLoader();
13
+ const loader = new TextureLoader();
14
14
  loader.setCrossOrigin('anonymous');
15
15
  let cancelled = false;
16
16
  loader.load(MOON_TEXTURE_URL, (loaded) => {
@@ -52,8 +52,8 @@ const Moon = ({ settings, sunPosition, onMeshReady }) => {
52
52
  }
53
53
  if (lightRef.current && targetRef.current) {
54
54
  const cameraPos = state.camera.position;
55
- const moonPosition = meshRef.current?.position ?? new THREE.Vector3(...moonPos);
56
- const dirToMoon = new THREE.Vector3().subVectors(moonPosition, cameraPos).normalize();
55
+ const moonPosition = meshRef.current?.position ?? new Vector3(...moonPos);
56
+ const dirToMoon = new Vector3().subVectors(moonPosition, cameraPos).normalize();
57
57
  const dist = cameraPos.distanceTo(moonPosition) * 0.2;
58
58
  lightRef.current.position.copy(cameraPos).addScaledVector(dirToMoon, dist);
59
59
  targetRef.current.position.copy(moonPosition);
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAA6D,cAAc,EAAuD,MAAM,wBAAwB,CAAC;AAEjN,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAqBrD,KAAK,eAAe,GAAG;IACnB,IAAI,EAAE,cAAc,CAAC;IACrB,cAAc,EAAE,WAAW,CAAC;IAC5B,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7G,CAAC;AA4DF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA2KzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAA6D,cAAc,EAA8G,MAAM,wBAAwB,CAAC;AAExQ,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAyBrD,KAAK,eAAe,GAAG;IACnB,IAAI,EAAE,cAAc,CAAC;IACrB,cAAc,EAAE,WAAW,CAAC;IAC5B,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7G,CAAC;AA8DF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA0KzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -15,18 +15,20 @@ import Ocean from "./Ocean.js";
15
15
  import Stars from "./Stars.js";
16
16
  import Clouds from "./Clouds.js";
17
17
  import Rain from "./Rain.js";
18
- import Bubbles from "./Bubbles.js";
19
- import Glyphs from "./Glyphs.js";
20
- import SparklesBurst from "./SparklesBurst.js";
18
+ import Earth from "./Earth.js";
19
+ import SolarSystem from "./SolarSystem.js";
20
+ import ShootingStars from "./ShootingStars.js";
21
21
  // Types whose React component instantiates and drives its own ShaderMaterial.
22
22
  // useMaterialApplication would otherwise traverse the mesh tree and replace
23
23
  // that material with a registry-default instance, breaking config-driven
24
24
  // uniform updates (e.g. only ringRadius worked on glyphs because that drives
25
25
  // geometry, not the material).
26
26
  const SELF_MANAGED_MATERIAL = new Set([
27
- 'bubbles',
28
- 'glyphs',
29
- 'sparklesBurst',
27
+ 'effect',
28
+ // 'gallery',
29
+ 'earth',
30
+ 'solarSystem',
31
+ 'shootingStars'
30
32
  // 'moon'
31
33
  ]);
32
34
  // const EffectsLayer: React.FC<{ effects: CreatedObjectSettings['effects'] }> = ({ effects }) =>
@@ -80,9 +82,9 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick })
80
82
  gallery: (obj, cameraSettings, onObjectReady) => (_jsx(GalleryLayout, { createdObject: obj, handleObjectClick: handleObjectClick })),
81
83
  light: (obj, cameraSettings, onObjectReady) => (_jsx(LightObject, { createdObject: obj })),
82
84
  rain: (obj, cameraSettings, onObjectReady) => (_jsx(Rain, { settings: obj })),
83
- bubbles: (obj, cameraSettings, onObjectReady) => (_jsx(Bubbles, { settings: obj })),
84
- glyphs: (obj, cameraSettings, onObjectReady) => (_jsx(Glyphs, { settings: obj })),
85
- sparklesBurst: (obj, cameraSettings, onObjectReady) => (_jsx(SparklesBurst, { settings: obj })),
85
+ earth: (obj, cameraSettings, onObjectReady) => (_jsx(Earth, { ...obj.config })),
86
+ solarSystem: (obj, cameraSettings, onObjectReady) => (_jsx(SolarSystem, { ...obj.config })),
87
+ shootingStars: (obj, cameraSettings, onObjectReady) => (_jsx(ShootingStars, { settings: obj.config })),
86
88
  }), [handleObjectClick]);
87
89
  if (!createdObject) {
88
90
  console.warn(`createdObject not found.`);
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { Mesh } from 'three';
3
+ export type PlanetType = 'moon' | 'sun' | 'mercury' | 'venus' | 'mars' | 'jupiter' | 'saturn' | 'uranus' | 'neptune';
4
+ export interface PlanetProps {
5
+ type?: PlanetType;
6
+ position?: [number, number, number];
7
+ scale?: number;
8
+ rotation?: [number, number, number];
9
+ visible?: boolean;
10
+ emissiveIntensity?: number;
11
+ shininess?: number;
12
+ onMeshReady?: (mesh: Mesh) => void;
13
+ }
14
+ declare const Planet: React.FC<PlanetProps>;
15
+ export default Planet;
16
+ //# sourceMappingURL=Planet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Planet.d.ts","sourceRoot":"","sources":["../../src/components/Planet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EACL,IAAI,EAKL,MAAM,OAAO,CAAC;AAGf,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,KAAK,GACL,SAAS,GACT,OAAO,GACP,MAAM,GACN,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,SAAS,CAAC;AAqBd,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CACpC;AAyCD,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA+CjC,CAAC;AAGF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef, useEffect, useMemo, useCallback } from 'react';
3
+ import { RingGeometry, DoubleSide, Vector3, SRGBColorSpace, } from 'three';
4
+ import { useTexture } from '@react-three/drei';
5
+ const CDN = 'https://3d-rise.sfo3.cdn.digitaloceanspaces.com/app/images/planets';
6
+ const PLANET_TEXTURES = {
7
+ moon: `${CDN}/2k_moon.jpg`,
8
+ sun: `${CDN}/2k_sun.jpg`,
9
+ mercury: `${CDN}/2k_mercury.jpg`,
10
+ venus: `${CDN}/2k_venus_surface.jpg`,
11
+ mars: `${CDN}/2k_mars.jpg`,
12
+ jupiter: `${CDN}/2k_jupiter.jpg`,
13
+ saturn: `${CDN}/2k_saturn.jpg`,
14
+ uranus: `${CDN}/2k_uranus.jpg`,
15
+ neptune: `${CDN}/2k_neptune.jpg`,
16
+ };
17
+ const saturnRingTextureUrl = `${CDN}/2k_saturn_ring_alpha.png`;
18
+ const RING_INNER = 1.3;
19
+ const RING_OUTER = 2.3;
20
+ function createRingGeometry(inner, outer, segments = 128) {
21
+ const geom = new RingGeometry(inner, outer, segments);
22
+ // RingGeometry's default UVs go around the ring. Remap so the radial axis
23
+ // (inner → outer) maps to U (0 → 1) so a strip-style ring texture displays correctly.
24
+ const pos = geom.attributes.position;
25
+ const uv = geom.attributes.uv;
26
+ const v = new Vector3();
27
+ for (let i = 0; i < pos.count; i++) {
28
+ v.fromBufferAttribute(pos, i);
29
+ const r = v.length();
30
+ const t = (r - inner) / (outer - inner);
31
+ uv.setXY(i, t, 0.5);
32
+ }
33
+ uv.needsUpdate = true;
34
+ return geom;
35
+ }
36
+ const SaturnRing = () => {
37
+ const ringTexture = useTexture(saturnRingTextureUrl);
38
+ useEffect(() => {
39
+ ringTexture.colorSpace = SRGBColorSpace;
40
+ }, [ringTexture]);
41
+ const ringGeometry = useMemo(() => createRingGeometry(RING_INNER, RING_OUTER), []);
42
+ return (_jsx("mesh", { geometry: ringGeometry, rotation: [-Math.PI / 2, 0, 0], children: _jsx("meshBasicMaterial", { map: ringTexture, alphaMap: ringTexture, transparent: true, side: DoubleSide, depthWrite: false }) }));
43
+ };
44
+ const Planet = ({ type = 'moon', position = [0, 0, 0], scale = 5, rotation = [0, 0, 0], visible = true, emissiveIntensity = 0, shininess = 30, onMeshReady, }) => {
45
+ const meshRef = useRef(null);
46
+ const texture = useTexture(PLANET_TEXTURES[type]);
47
+ useEffect(() => {
48
+ texture.colorSpace = SRGBColorSpace;
49
+ texture.anisotropy = 8;
50
+ }, [texture]);
51
+ const handleMeshRef = useCallback((mesh) => {
52
+ if (mesh) {
53
+ meshRef.current = mesh;
54
+ onMeshReady?.(mesh);
55
+ }
56
+ }, [onMeshReady]);
57
+ return (_jsxs("group", { userData: { id: `3drise-planet-${type}` }, position: position, rotation: rotation, scale: scale, visible: visible, children: [_jsxs("mesh", { ref: handleMeshRef, children: [_jsx("sphereGeometry", { args: [1, 64, 64] }), _jsx("meshPhongMaterial", { map: texture, color: '#ffffff', emissive: '#ffffff', emissiveMap: texture, emissiveIntensity: emissiveIntensity, shininess: shininess })] }), type === 'saturn' && _jsx(SaturnRing, {})] }));
58
+ };
59
+ Planet.displayName = 'Planet';
60
+ export default Planet;
@@ -1 +1 @@
1
- {"version":3,"file":"ShootingStars.d.ts","sourceRoot":"","sources":["../../src/components/ShootingStars.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,KAAK,EAAE,qBAAqB,EAAiB,MAAM,wBAAwB,CAAC;AAInF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,qBAAqB,CAAC;CACjC;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsD/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ShootingStars.d.ts","sourceRoot":"","sources":["../../src/components/ShootingStars.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,KAAK,EAAE,qBAAqB,EAAiB,MAAM,wBAAwB,CAAC;AAInF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,qBAAqB,CAAC;CACjC;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAuD/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -35,6 +35,7 @@ const ShootingStars = ({ settings }) => {
35
35
  }, []);
36
36
  if (!settings?.enabled)
37
37
  return null;
38
+ console.log("Rendering ShootingStars with settings:", settings, "and shootingStars:", shootingStars);
38
39
  return (_jsx(_Fragment, { children: shootingStars.map(star => (_jsx(ShootingStar, { position: star.position, direction: star.direction, speed: star.speed, color: star.color, trailLength: star.trailLength, size: 0.08, opacity: 0.9, maxDistance: star.length, onComplete: () => handleComplete(star.id), followMouse: settings.followMouse }, star.id))) }));
39
40
  };
40
41
  export default ShootingStars;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { SolarSystemConfig } from '@ntalmagor/3drize-core';
3
+ declare const SolarSystem: React.FC<SolarSystemConfig>;
4
+ export default SolarSystem;
5
+ //# sourceMappingURL=SolarSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SolarSystem.d.ts","sourceRoot":"","sources":["../../src/components/SolarSystem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAMtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAoI3D,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA2E5C,CAAC;AAGF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef, useMemo, useState, useCallback } from 'react';
3
+ import * as THREE from 'three';
4
+ import { useFrame } from '@react-three/fiber';
5
+ import Planet from './Planet.js';
6
+ import Earth from './Earth.js';
7
+ import Sun from './Sun.js';
8
+ // Stylized constants — distances compressed, sizes exaggerated for legibility.
9
+ const PLANETS = [
10
+ { body: { name: 'mercury', kind: 'planet', type: 'mercury' }, radius: 0.6, orbitRadius: 18, periodYears: 0.24, axialTilt: 0.03, spinRate: 1.0, initialPhase: 0.2 },
11
+ { body: { name: 'venus', kind: 'planet', type: 'venus' }, radius: 1.2, orbitRadius: 26, periodYears: 0.62, axialTilt: 3.10, spinRate: -0.4, initialPhase: 1.1 },
12
+ { body: { name: 'earth', kind: 'earth' }, radius: 1.3, orbitRadius: 36, periodYears: 1.00, axialTilt: 0.41, spinRate: 1.0, initialPhase: 2.3 },
13
+ { body: { name: 'mars', kind: 'planet', type: 'mars' }, radius: 0.9, orbitRadius: 46, periodYears: 1.88, axialTilt: 0.44, spinRate: 0.97, initialPhase: 3.7 },
14
+ { body: { name: 'jupiter', kind: 'planet', type: 'jupiter' }, radius: 3.6, orbitRadius: 70, periodYears: 11.86, axialTilt: 0.05, spinRate: 2.4, initialPhase: 0.8 },
15
+ { body: { name: 'saturn', kind: 'planet', type: 'saturn' }, radius: 3.2, orbitRadius: 92, periodYears: 29.46, axialTilt: 0.47, spinRate: 2.2, initialPhase: 4.2 },
16
+ { body: { name: 'uranus', kind: 'planet', type: 'uranus' }, radius: 2.0, orbitRadius: 114, periodYears: 84.0, axialTilt: 1.71, spinRate: 1.4, initialPhase: 5.5 },
17
+ { body: { name: 'neptune', kind: 'planet', type: 'neptune' }, radius: 2.0, orbitRadius: 134, periodYears: 164.8, axialTilt: 0.49, spinRate: 1.5, initialPhase: 1.9 },
18
+ ];
19
+ // Default: one Earth-year = 8 scene-seconds.
20
+ const EARTH_YEAR_SECONDS = 8;
21
+ const OrbitRing = ({ radius, color, opacity }) => {
22
+ const geometry = useMemo(() => {
23
+ const segments = 128;
24
+ const points = new Float32Array((segments + 1) * 3);
25
+ for (let i = 0; i <= segments; i++) {
26
+ const t = (i / segments) * Math.PI * 2;
27
+ points[i * 3 + 0] = Math.cos(t) * radius;
28
+ points[i * 3 + 1] = 0;
29
+ points[i * 3 + 2] = Math.sin(t) * radius;
30
+ }
31
+ const geom = new THREE.BufferGeometry();
32
+ geom.setAttribute('position', new THREE.BufferAttribute(points, 3));
33
+ return geom;
34
+ }, [radius]);
35
+ return (_jsx("lineLoop", { geometry: geometry, children: _jsx("lineBasicMaterial", { color: color, transparent: true, opacity: opacity, depthWrite: false }) }));
36
+ };
37
+ const OrbitedBody = ({ orbitRadius, orbitSpeed, spinSpeed, axialTilt, enableOrbit, enableSelfRotation, initialPhase, onWorldPositionChange, children, }) => {
38
+ const orbitRef = useRef(null);
39
+ const spinRef = useRef(null);
40
+ const worldPosRef = useRef(new THREE.Vector3());
41
+ useFrame((_, delta) => {
42
+ if (enableOrbit && orbitRef.current) {
43
+ orbitRef.current.rotation.y += delta * orbitSpeed;
44
+ }
45
+ if (enableSelfRotation && spinRef.current) {
46
+ spinRef.current.rotation.y += delta * spinSpeed;
47
+ }
48
+ if (onWorldPositionChange && spinRef.current) {
49
+ spinRef.current.getWorldPosition(worldPosRef.current);
50
+ onWorldPositionChange(worldPosRef.current);
51
+ }
52
+ });
53
+ return (_jsx("group", { ref: orbitRef, "rotation-y": initialPhase, children: _jsx("group", { position: [orbitRadius, 0, 0], "rotation-z": axialTilt, children: _jsx("group", { ref: spinRef, children: children }) }) }));
54
+ };
55
+ const SolarSystem = ({ enableOrbit = true, enableSelfRotation = true, showOrbitRings = true, orbitSpeedMultiplier = 1, sunColor = '#ffd27a', sunRadius = 8, sunIntensity = 3, orbitRingColor = '#444444', orbitRingOpacity = 0.35, }) => {
56
+ const [earthSunPos, setEarthSunPos] = useState([1, 0, 0]);
57
+ const lastEarthSyncRef = useRef(0);
58
+ const handleEarthWorld = useCallback((p) => {
59
+ const now = performance.now();
60
+ if (now - lastEarthSyncRef.current < 100)
61
+ return;
62
+ lastEarthSyncRef.current = now;
63
+ setEarthSunPos([-p.x, -p.y, -p.z]);
64
+ }, []);
65
+ return (_jsxs("group", { userData: { id: '3drise-solar-system' }, children: [_jsx(Sun, { radius: sunRadius }), showOrbitRings &&
66
+ PLANETS.map((p) => (_jsx(OrbitRing, { radius: p.orbitRadius, color: orbitRingColor, opacity: orbitRingOpacity }, `ring-${p.body.name}`))), PLANETS.map((p) => {
67
+ const orbitSpeed = ((2 * Math.PI) / (p.periodYears * EARTH_YEAR_SECONDS)) * orbitSpeedMultiplier;
68
+ const spinSpeed = p.spinRate * orbitSpeedMultiplier;
69
+ if (p.body.kind === 'earth') {
70
+ return (_jsx(OrbitedBody, { orbitRadius: p.orbitRadius, orbitSpeed: orbitSpeed, spinSpeed: spinSpeed, axialTilt: p.axialTilt, enableOrbit: enableOrbit, enableSelfRotation: enableSelfRotation, initialPhase: p.initialPhase, onWorldPositionChange: handleEarthWorld, children: _jsx(Earth, { radius: p.radius, sunPosition: earthSunPos, atmosphereDayColor: "#6db3f2", atmosphereTwilightColor: "#d97e54" }) }, "earth"));
71
+ }
72
+ return (_jsx(OrbitedBody, { orbitRadius: p.orbitRadius, orbitSpeed: orbitSpeed, spinSpeed: spinSpeed, axialTilt: p.axialTilt, enableOrbit: enableOrbit, enableSelfRotation: enableSelfRotation, initialPhase: p.initialPhase, children: _jsx(Planet, { type: p.body.type, scale: p.radius }) }, p.body.name));
73
+ })] }));
74
+ };
75
+ SolarSystem.displayName = 'SolarSystem';
76
+ export default SolarSystem;
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import type { CreatedObjectSettings } from '@ntalmagor/3drize-core';
2
+ import type { SparklesBurstConfig } from '@ntalmagor/3drize-core';
3
3
  export interface SparklesBurstProps {
4
- settings: CreatedObjectSettings;
4
+ config: SparklesBurstConfig;
5
+ boundingRadius?: number;
5
6
  }
6
7
  declare const SparklesBurst: React.FC<SparklesBurstProps>;
7
8
  export default SparklesBurst;
@@ -1 +1 @@
1
- {"version":3,"file":"SparklesBurst.d.ts","sourceRoot":"","sources":["../../src/components/SparklesBurst.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAG1D,OAAO,KAAK,EAAE,qBAAqB,EAAuB,MAAM,wBAAwB,CAAC;AAGzF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,qBAAqB,CAAC;CACjC;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6D/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"SparklesBurst.d.ts","sourceRoot":"","sources":["../../src/components/SparklesBurst.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAG1D,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGzF,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6D/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -3,8 +3,8 @@ import { useEffect, useMemo, useRef } from 'react';
3
3
  import { useFrame } from '@react-three/fiber';
4
4
  import * as THREE from 'three';
5
5
  import { SparklesBurstMaterial } from '@ntalmagor/3drize-core';
6
- const SparklesBurst = ({ settings }) => {
7
- const config = settings.config;
6
+ const SparklesBurst = ({ config, boundingRadius }) => {
7
+ // console.log("Rendering SparklesBurst with config:", config, "and boundingRadius:", boundingRadius);
8
8
  const planeSize = useMemo(() => Math.max(0.05, config.scale ?? 2.5), [config.scale]);
9
9
  const geometry = useMemo(() => new THREE.PlaneGeometry(planeSize, planeSize, 1, 1), [planeSize]);
10
10
  const material = useMemo(() => {
@@ -55,7 +55,7 @@ const SparklesBurst = ({ settings }) => {
55
55
  material.uniforms.uProgress.value = progress;
56
56
  material.uniforms.uTime.value = now;
57
57
  });
58
- if (!settings.meshSettings.visible)
58
+ if (!config.enabled)
59
59
  return null;
60
60
  return _jsx("mesh", { geometry: geometry, material: material, frustumCulled: false });
61
61
  };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * <Sun />
3
+ * Composes the three layers:
4
+ * - <SunCore />: boiling lava surface (SunCoreMaterial)
5
+ * - <Corona />: additive halo shell (SunCoronaMaterial)
6
+ * - <Flares />: explosive burst billboard (SunFlareMaterial)
7
+ *
8
+ * Each layer is also usable standalone. Override any material parameter via
9
+ * the per-layer uniforms props — see each material's Uniforms interface for
10
+ * the full documented list:
11
+ *
12
+ * <Sun
13
+ * coreUniforms={{ u_speed: 2, u_cellScale: 0.9, u_spotIntensity: 0 }}
14
+ * coronaUniforms={{ u_intensity: 2.5 }}
15
+ * flareUniforms={{ u_frequency: 2, u_reach: 1.1 }}
16
+ * />
17
+ *
18
+ * Vector3 uniforms accept arrays: coreUniforms={{ u_rimColor: [1, 0.2, 0.9] }}
19
+ */
20
+ type SunProps = {
21
+ /** Radius of the sun core. Default 1. */
22
+ radius?: number;
23
+ /** Corona shell size relative to the core. Default 1.25. */
24
+ coronaScale?: number;
25
+ /** Uniform overrides for SunCoreMaterial. */
26
+ coreUniforms?: Record<string, any>;
27
+ /** Uniform overrides for SunCoronaMaterial. */
28
+ coronaUniforms?: Record<string, any>;
29
+ /** Uniform overrides for SunFlareMaterial. */
30
+ flareUniforms?: Record<string, any>;
31
+ };
32
+ export default function Sun({ radius, coronaScale, coreUniforms, coronaUniforms, flareUniforms, }: SunProps): import("react/jsx-runtime").JSX.Element;
33
+ export {};
34
+ //# sourceMappingURL=Sun.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sun.d.ts","sourceRoot":"","sources":["../../src/components/Sun.tsx"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,KAAK,QAAQ,GAAG;IACd,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,GAAG,CAAC,EAC1B,MAAU,EACV,WAAkB,EAClB,YAAY,EACZ,cAAc,EACd,aAAa,GAEd,EAAE,QAAQ,2CASV"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // import { ReactNode } from "react";
3
+ import SunCore from "./SunCore.js";
4
+ import Corona from "./Corona.js";
5
+ export default function Sun({ radius = 1, coronaScale = 1.25, coreUniforms, coronaUniforms, flareUniforms, }) {
6
+ return (_jsxs("group", { children: [_jsx(SunCore, { radius: radius, uniforms: coreUniforms }), _jsx(Corona, { radius: radius, shellScale: coronaScale, uniforms: coronaUniforms }), _jsx("pointLight", { color: "#ffa544", intensity: 6, distance: 60, decay: 1.6 })] }));
7
+ }
@@ -0,0 +1,26 @@
1
+ import * as THREE from "three";
2
+ /**
3
+ * <SunCore />
4
+ * The boiling lava surface: an icosphere driven by SunCoreMaterial
5
+ * (domain-warped fBm, sunspots, filament cracks, fresnel limb glow).
6
+ *
7
+ * Unit geometry + mesh scale keeps the shader's local-space noise
8
+ * identical at any radius.
9
+ */
10
+ declare global {
11
+ namespace JSX {
12
+ interface IntrinsicElements {
13
+ sunCoreMaterial: any;
14
+ }
15
+ }
16
+ }
17
+ export type SunCoreProps = {
18
+ /** Radius of the core. Default 1. */
19
+ radius?: number;
20
+ /** Self-rotation speed in rad/s. Default 0.02. */
21
+ rotationSpeed?: number;
22
+ /** Uniform overrides for SunCoreMaterial (u_speed, u_cellScale, u_color1..5, ...). */
23
+ uniforms?: Record<string, number | THREE.Vector3 | number[]>;
24
+ };
25
+ export default function SunCore({ radius, rotationSpeed, uniforms }: SunCoreProps): import("react/jsx-runtime").JSX.Element;
26
+ //# sourceMappingURL=SunCore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SunCore.d.ts","sourceRoot":"","sources":["../../src/components/SunCore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;;;;;;GAOG;AAEH,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,eAAe,EAAE,GAAG,CAAC;SACtB;KACF;CACF;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,EAAE,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAC9B,MAAU,EACV,aAAoB,EACpB,QAAQ,EACT,EAAE,YAAY,2CAiBd"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import { useFrame } from "@react-three/fiber";
4
+ export default function SunCore({ radius = 1, rotationSpeed = 0.02, uniforms }) {
5
+ const meshRef = useRef(null);
6
+ // drei's shaderMaterial exposes each uniform as a property on the instance.
7
+ const matRef = useRef(null);
8
+ useFrame((_, delta) => {
9
+ if (matRef.current)
10
+ matRef.current.u_time += delta;
11
+ // if (meshRef.current) meshRef.current.rotation.y += delta * rotationSpeed;
12
+ });
13
+ return (_jsxs("mesh", { ref: meshRef, scale: radius, children: [_jsx("icosahedronGeometry", { args: [1, 64] }), _jsx("lavaMaterial", { ref: matRef, ...uniforms })] }));
14
+ }
@@ -0,0 +1,29 @@
1
+ import { Object3D } from 'three';
2
+ import { AnimationOptions, FireConfig } from '@ntalmagor/3drize-core';
3
+ export interface FireProps {
4
+ /**
5
+ * Host object to wrap. When provided, the fire auto-fits the host's
6
+ * bounding sphere. mode 'wrap' scatters flame tongues across the host's
7
+ * surface; mode 'crown' keeps a single flame sitting on top.
8
+ *
9
+ * The host may live anywhere in the scene graph at any position — the fit
10
+ * is computed in world space and converted into this component's parent
11
+ * frame, so <Fire /> works as a sibling, child, or distant relative of
12
+ * the host.
13
+ */
14
+ hostRef?: Object3D | null;
15
+ config: FireConfig;
16
+ animations?: AnimationOptions[];
17
+ }
18
+ declare const Fire: ({ hostRef, config, animations }: FireProps) => import("react/jsx-runtime").JSX.Element;
19
+ export default Fire;
20
+ /**
21
+ * Usage:
22
+ *
23
+ * // Flames wrapping the object — works wherever the host is positioned
24
+ * <Fire hostRef={statue} config={{ mode: 'wrap', coverage: 0.85, tongues: 40 }} />
25
+ *
26
+ * // Single flame sitting on top (campfire on logs)
27
+ * <Fire hostRef={logs} config={{}} />
28
+ */
29
+ //# sourceMappingURL=Fire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Fire.d.ts","sourceRoot":"","sources":["../../../src/components/effects/Fire.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAoB,MAAM,wBAAwB,CAAA;AAEvF,MAAM,WAAW,SAAS;IACxB;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAA;IACzB,MAAM,EAAE,UAAU,CAAA;IAClB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAA;CAChC;AA6FD,QAAA,MAAM,IAAI,GAAI,iCAAiC,SAAS,4CAoLvD,CAAA;AAED,eAAe,IAAI,CAAA;AACnB;;;;;;;;GAQG"}