@ntalmagor/3drize-viewer 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Bubbles.d.ts +8 -0
- package/dist/components/Bubbles.d.ts.map +1 -0
- package/dist/components/Bubbles.js +106 -0
- package/dist/components/Clouds.d.ts +3 -3
- package/dist/components/Clouds.d.ts.map +1 -1
- package/dist/components/Clouds.js +162 -57
- package/dist/components/CreatedObject.d.ts.map +1 -1
- package/dist/components/CreatedObject.js +1 -5
- package/dist/components/Earth.d.ts +18 -0
- package/dist/components/Earth.d.ts.map +1 -0
- package/dist/components/Earth.js +43 -0
- package/dist/components/Frame.d.ts.map +1 -1
- package/dist/components/Frame.js +3 -1
- package/dist/components/Galaxy.js +2 -4
- package/dist/components/Glyphs.d.ts +8 -0
- package/dist/components/Glyphs.d.ts.map +1 -0
- package/dist/components/Glyphs.js +58 -0
- package/dist/components/GridHelper.js +1 -1
- package/dist/components/Moon.d.ts.map +1 -1
- package/dist/components/Moon.js +20 -6
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +53 -15
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +2 -0
- package/dist/components/Ocean.d.ts +2 -2
- package/dist/components/Ocean.d.ts.map +1 -1
- package/dist/components/Ocean.js +50 -36
- package/dist/components/ParticlesR3f.d.ts.map +1 -1
- package/dist/components/ParticlesR3f.js +15 -0
- package/dist/components/PathRenderer.d.ts +0 -2
- package/dist/components/PathRenderer.d.ts.map +1 -1
- package/dist/components/PathRenderer.js +4 -1
- package/dist/components/ProjectLoader.d.ts.map +1 -1
- package/dist/components/ProjectLoader.js +1 -7
- package/dist/components/Rain.d.ts +2 -2
- package/dist/components/Rain.d.ts.map +1 -1
- package/dist/components/Rain.js +155 -29
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +2 -2
- package/dist/components/ShootingStars.d.ts +2 -2
- package/dist/components/ShootingStars.d.ts.map +1 -1
- package/dist/components/SkySystem.d.ts.map +1 -1
- package/dist/components/SkySystem.js +2 -5
- package/dist/components/Skybox.d.ts.map +1 -1
- package/dist/components/Skybox.js +5 -1
- package/dist/components/SparklesBurst.d.ts +8 -0
- package/dist/components/SparklesBurst.d.ts.map +1 -0
- package/dist/components/SparklesBurst.js +62 -0
- package/dist/components/Stars.d.ts +2 -2
- package/dist/components/Stars.d.ts.map +1 -1
- package/dist/components/Stars.js +25 -26
- package/dist/components/cursor/AuraCursor.d.ts +6 -0
- package/dist/components/cursor/AuraCursor.d.ts.map +1 -0
- package/dist/components/cursor/AuraCursor.js +30 -0
- package/dist/components/cursor/AuroraCursor.d.ts +6 -0
- package/dist/components/cursor/AuroraCursor.d.ts.map +1 -0
- package/dist/components/cursor/AuroraCursor.js +207 -0
- package/dist/components/cursor/BubblesCursor.d.ts +6 -0
- package/dist/components/cursor/BubblesCursor.d.ts.map +1 -0
- package/dist/components/cursor/BubblesCursor.js +184 -0
- package/dist/components/cursor/CometCursor.d.ts +6 -0
- package/dist/components/cursor/CometCursor.d.ts.map +1 -0
- package/dist/components/cursor/CometCursor.js +191 -0
- package/dist/components/cursor/CrosshairCursor.d.ts +6 -0
- package/dist/components/cursor/CrosshairCursor.d.ts.map +1 -0
- package/dist/components/cursor/CrosshairCursor.js +142 -0
- package/dist/components/cursor/CursorActions.d.ts +8 -0
- package/dist/components/cursor/CursorActions.d.ts.map +1 -0
- package/dist/components/cursor/CursorActions.js +124 -0
- package/dist/components/cursor/CursorController.d.ts +10 -0
- package/dist/components/cursor/CursorController.d.ts.map +1 -0
- package/dist/components/cursor/CursorController.js +5 -0
- package/dist/components/cursor/CursorEffects.d.ts +16 -0
- package/dist/components/cursor/CursorEffects.d.ts.map +1 -0
- package/dist/components/cursor/CursorEffects.js +110 -0
- package/dist/components/cursor/FerrofluidCursor.d.ts +6 -0
- package/dist/components/cursor/FerrofluidCursor.d.ts.map +1 -0
- package/dist/components/cursor/FerrofluidCursor.js +102 -0
- package/dist/components/cursor/GlyphRingCursor.d.ts +6 -0
- package/dist/components/cursor/GlyphRingCursor.d.ts.map +1 -0
- package/dist/components/cursor/GlyphRingCursor.js +123 -0
- package/dist/components/cursor/LightningCursor.d.ts +6 -0
- package/dist/components/cursor/LightningCursor.d.ts.map +1 -0
- package/dist/components/cursor/LightningCursor.js +28 -0
- package/dist/components/cursor/LiquidMetalCursor.d.ts +6 -0
- package/dist/components/cursor/LiquidMetalCursor.d.ts.map +1 -0
- package/dist/components/cursor/LiquidMetalCursor.js +61 -0
- package/dist/components/cursor/OrbCursor.d.ts +6 -0
- package/dist/components/cursor/OrbCursor.d.ts.map +1 -0
- package/dist/components/cursor/OrbCursor.js +32 -0
- package/dist/components/cursor/PlasmaWhipCursor.d.ts +6 -0
- package/dist/components/cursor/PlasmaWhipCursor.d.ts.map +1 -0
- package/dist/components/cursor/PlasmaWhipCursor.js +134 -0
- package/dist/components/cursor/SparklesCursor.d.ts +6 -0
- package/dist/components/cursor/SparklesCursor.d.ts.map +1 -0
- package/dist/components/cursor/SparklesCursor.js +151 -0
- package/dist/components/cursor/TeslaCursor.d.ts +6 -0
- package/dist/components/cursor/TeslaCursor.d.ts.map +1 -0
- package/dist/components/cursor/TeslaCursor.js +223 -0
- package/dist/components/cursor/clickActions/BoltFlashAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/BoltFlashAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/BoltFlashAction.js +62 -0
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.js +114 -0
- package/dist/components/cursor/clickActions/ImplosionAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/ImplosionAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/ImplosionAction.js +93 -0
- package/dist/components/cursor/clickActions/PhaseShiftAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/PhaseShiftAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/PhaseShiftAction.js +71 -0
- package/dist/components/cursor/clickActions/PlasmaBombAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/PlasmaBombAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/PlasmaBombAction.js +98 -0
- package/dist/components/cursor/clickActions/RealityTearAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/RealityTearAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/RealityTearAction.js +92 -0
- package/dist/components/cursor/clickActions/ShockwaveAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/ShockwaveAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/ShockwaveAction.js +55 -0
- package/dist/components/cursor/clickActions/SparklesBurstAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/SparklesBurstAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/SparklesBurstAction.js +99 -0
- package/dist/components/cursor/clickActions/VoronoiFractureAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/VoronoiFractureAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/VoronoiFractureAction.js +149 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/hooks/useContinuousEffects.d.ts.map +1 -1
- package/dist/hooks/useContinuousEffects.js +5 -4
- package/dist/hooks/useInteraction.d.ts.map +1 -1
- package/dist/hooks/useInteraction.js +43 -10
- package/dist/hooks/useMaterialApplication.js +1 -1
- package/dist/hooks/useMaterialOptions.d.ts.map +1 -1
- package/dist/hooks/useMaterialOptions.js +2 -0
- package/dist/hooks/useMeshController.d.ts.map +1 -1
- package/dist/hooks/useMeshController.js +78 -28
- package/dist/hooks/useParticlesTextures.js +1 -1
- package/dist/hooks/useSequenceAnimation.d.ts.map +1 -1
- package/dist/hooks/useSequenceAnimation.js +38 -17
- package/dist/hooks/useSkyUniforms.d.ts +1 -1
- package/dist/hooks/useSkyUniforms.d.ts.map +1 -1
- package/dist/hooks/useSkyUniforms.js +10 -11
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/utils/CameraSingleton.d.ts +8 -1
- package/dist/utils/CameraSingleton.d.ts.map +1 -1
- package/dist/utils/CameraSingleton.js +22 -1
- package/dist/utils/cursorPicking.d.ts +8 -0
- package/dist/utils/cursorPicking.d.ts.map +1 -0
- package/dist/utils/cursorPicking.js +35 -0
- package/package.json +2 -4
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CreatedObjectSettings } from '@ntalmagor/3drize-core';
|
|
3
|
+
export interface BubblesProps {
|
|
4
|
+
settings: CreatedObjectSettings;
|
|
5
|
+
}
|
|
6
|
+
declare const Bubbles: React.FC<BubblesProps>;
|
|
7
|
+
export default Bubbles;
|
|
8
|
+
//# sourceMappingURL=Bubbles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bubbles.d.ts","sourceRoot":"","sources":["../../src/components/Bubbles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAG1D,OAAO,KAAK,EAAiB,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAKnF,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,qBAAqB,CAAC;CACjC;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA8GnC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { useFrame } from '@react-three/fiber';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { BubblesPointsMaterial } from '@ntalmagor/3drize-core';
|
|
6
|
+
const MAX_BUBBLES = 256;
|
|
7
|
+
const Bubbles = ({ settings }) => {
|
|
8
|
+
const config = settings.config;
|
|
9
|
+
const positions = useMemo(() => new Float32Array(MAX_BUBBLES * 3), []);
|
|
10
|
+
const velocities = useMemo(() => new Float32Array(MAX_BUBBLES * 3), []);
|
|
11
|
+
const ages = useMemo(() => new Float32Array(MAX_BUBBLES), []);
|
|
12
|
+
const lives = useMemo(() => new Float32Array(MAX_BUBBLES), []);
|
|
13
|
+
const baseSizes = useMemo(() => new Float32Array(MAX_BUBBLES), []);
|
|
14
|
+
const phases = useMemo(() => new Float32Array(MAX_BUBBLES), []);
|
|
15
|
+
const alive = useMemo(() => new Uint8Array(MAX_BUBBLES), []);
|
|
16
|
+
const geometry = useMemo(() => {
|
|
17
|
+
const g = new THREE.BufferGeometry();
|
|
18
|
+
g.setAttribute('position', new THREE.BufferAttribute(positions, 3));
|
|
19
|
+
g.setAttribute('aAge', new THREE.BufferAttribute(ages, 1));
|
|
20
|
+
g.setAttribute('aLife', new THREE.BufferAttribute(lives, 1));
|
|
21
|
+
g.setAttribute('aBaseSize', new THREE.BufferAttribute(baseSizes, 1));
|
|
22
|
+
g.setAttribute('aPhase', new THREE.BufferAttribute(phases, 1));
|
|
23
|
+
for (let i = 0; i < MAX_BUBBLES; i++)
|
|
24
|
+
positions[i * 3 + 1] = -1e6;
|
|
25
|
+
return g;
|
|
26
|
+
}, [positions, ages, lives, baseSizes, phases]);
|
|
27
|
+
const material = useMemo(() => {
|
|
28
|
+
const m = new BubblesPointsMaterial();
|
|
29
|
+
m.transparent = true;
|
|
30
|
+
m.depthWrite = false;
|
|
31
|
+
m.blending = THREE.NormalBlending;
|
|
32
|
+
return m;
|
|
33
|
+
}, []);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const u = material.uniforms;
|
|
36
|
+
const [cA, cB, cC] = config.colors ?? ['#aaccff', '#ffaadd', '#aaffcc'];
|
|
37
|
+
u.uColorA.value.set(cA);
|
|
38
|
+
u.uColorB.value.set(cB);
|
|
39
|
+
u.uColorC.value.set(cC);
|
|
40
|
+
u.uScale.value = (config.scale ?? 1) / 10;
|
|
41
|
+
u.uOpacity.value = config.opacity ?? 0.6;
|
|
42
|
+
u.uIridescence.value = config.iridescence ?? 0.7;
|
|
43
|
+
u.uSpeed.value = config.speed ?? 1;
|
|
44
|
+
}, [config.colors, config.scale, config.opacity, config.iridescence, config.speed, material]);
|
|
45
|
+
useEffect(() => () => { geometry.dispose(); material.dispose(); }, [geometry, material]);
|
|
46
|
+
const spawnAccum = useRef(0);
|
|
47
|
+
useFrame((state, delta) => {
|
|
48
|
+
material.uniforms.uTime.value = state.clock.getElapsedTime();
|
|
49
|
+
const scale = config.scale ?? 1;
|
|
50
|
+
const spawnRate = config.spawnRate ?? 8;
|
|
51
|
+
const floatSpeed = (config.floatSpeed ?? 0.5) * (config.speed ?? 1);
|
|
52
|
+
const lifetimeMs = config.lifetimeMs ?? 4000;
|
|
53
|
+
const speed = config.speed ?? 1;
|
|
54
|
+
spawnAccum.current += spawnRate * delta;
|
|
55
|
+
let toSpawn = Math.floor(spawnAccum.current);
|
|
56
|
+
spawnAccum.current -= toSpawn;
|
|
57
|
+
const dtMs = delta * 1000 * speed;
|
|
58
|
+
let scan = 0;
|
|
59
|
+
while (toSpawn > 0 && scan < MAX_BUBBLES) {
|
|
60
|
+
if (alive[scan] === 0) {
|
|
61
|
+
const base = scan * 3;
|
|
62
|
+
// Spawn at local origin with small lateral jitter — parent group's
|
|
63
|
+
// transform places the system in world space.
|
|
64
|
+
positions[base + 0] = (Math.random() - 0.5) * 0.2 * scale;
|
|
65
|
+
positions[base + 1] = (Math.random() - 0.5) * 0.1 * scale;
|
|
66
|
+
positions[base + 2] = (Math.random() - 0.5) * 0.2 * scale;
|
|
67
|
+
velocities[base + 0] = (Math.random() - 0.5) * 0.4;
|
|
68
|
+
velocities[base + 1] = floatSpeed * (0.7 + Math.random() * 0.6);
|
|
69
|
+
velocities[base + 2] = (Math.random() - 0.5) * 0.4;
|
|
70
|
+
ages[scan] = 0;
|
|
71
|
+
lives[scan] = lifetimeMs * (0.7 + Math.random() * 0.6);
|
|
72
|
+
baseSizes[scan] = (16 + Math.random() * 28) * (scale / 10);
|
|
73
|
+
phases[scan] = Math.random() * 100;
|
|
74
|
+
alive[scan] = 1;
|
|
75
|
+
toSpawn--;
|
|
76
|
+
}
|
|
77
|
+
scan++;
|
|
78
|
+
}
|
|
79
|
+
for (let j = 0; j < MAX_BUBBLES; j++) {
|
|
80
|
+
if (alive[j] === 0)
|
|
81
|
+
continue;
|
|
82
|
+
const base = j * 3;
|
|
83
|
+
ages[j] += dtMs;
|
|
84
|
+
if (ages[j] >= lives[j]) {
|
|
85
|
+
alive[j] = 0;
|
|
86
|
+
positions[base + 1] = -1e6;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
velocities[base + 0] *= 0.99;
|
|
90
|
+
velocities[base + 2] *= 0.99;
|
|
91
|
+
const wobble = Math.sin(state.clock.getElapsedTime() * 1.3 * speed + phases[j]) * 0.05;
|
|
92
|
+
positions[base + 0] += velocities[base + 0] * delta + wobble * delta;
|
|
93
|
+
positions[base + 1] += velocities[base + 1] * delta;
|
|
94
|
+
positions[base + 2] += velocities[base + 2] * delta;
|
|
95
|
+
}
|
|
96
|
+
geometry.attributes.position.needsUpdate = true;
|
|
97
|
+
geometry.attributes.aAge.needsUpdate = true;
|
|
98
|
+
geometry.attributes.aLife.needsUpdate = true;
|
|
99
|
+
geometry.attributes.aBaseSize.needsUpdate = true;
|
|
100
|
+
geometry.attributes.aPhase.needsUpdate = true;
|
|
101
|
+
});
|
|
102
|
+
if (!settings.meshSettings.visible)
|
|
103
|
+
return null;
|
|
104
|
+
return _jsx("points", { geometry: geometry, material: material, frustumCulled: false });
|
|
105
|
+
};
|
|
106
|
+
export default Bubbles;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TimeSettings, CreatedObjectSettings } from '@ntalmagor/3drize-core';
|
|
3
3
|
export interface CloudsProps {
|
|
4
|
-
settings:
|
|
5
|
-
timeSettings
|
|
4
|
+
settings: CreatedObjectSettings;
|
|
5
|
+
timeSettings?: TimeSettings;
|
|
6
6
|
}
|
|
7
7
|
declare const Clouds: React.FC<CloudsProps>;
|
|
8
8
|
export default Clouds;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clouds.d.ts","sourceRoot":"","sources":["../../src/components/Clouds.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAOnD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Clouds.d.ts","sourceRoot":"","sources":["../../src/components/Clouds.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAOnD,OAAO,KAAK,EAGV,YAAY,EAIZ,qBAAqB,EAEtB,MAAM,wBAAwB,CAAC;AA+BhC,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,qBAAqB,CAAC;IAChC,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAgFD,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAuNjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -2,12 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useRef, useCallback } from 'react';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
import { useThree, useFrame } from '@react-three/fiber';
|
|
5
|
-
import { useMaterialApplication } from '../hooks/useMaterialApplication.js';
|
|
6
5
|
import { useSkySystem } from '../hooks/useSkySystem.js';
|
|
7
6
|
import { useAnimationEvents } from '../hooks/useAnimationEvents.js';
|
|
8
7
|
import { useNumericAnimation } from '../hooks/useNumericAnimation.js';
|
|
9
|
-
import {
|
|
10
|
-
import { useMouseHandlers } from '../hooks/useMouseHandlers.js';
|
|
8
|
+
import { calculateTimeProgress, applyEasing, gsapEasingMap, interpolateValue, interpolateMouseMoveProperty, } from '@ntalmagor/3drize-core';
|
|
11
9
|
const CLOUD_COLORS = {
|
|
12
10
|
night: new THREE.Color(0.1, 0.1, 0.2),
|
|
13
11
|
sunrise: new THREE.Color(0.8, 0.4, 0.4),
|
|
@@ -22,20 +20,101 @@ const DEFAULT_MATERIAL = {
|
|
|
22
20
|
u_cameraPos: [0, 0, 0],
|
|
23
21
|
u_cloudColor: [1.0, 1.0, 1.0],
|
|
24
22
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
// =============================================================================
|
|
24
|
+
// Per-domain helpers (clouds-specific writes for the `clouds` domain)
|
|
25
|
+
// =============================================================================
|
|
26
|
+
function applyCloudsKeyframeAnimations(animations, startValuesCache, config, override, currentTime) {
|
|
27
|
+
if (!animations?.length)
|
|
28
|
+
return;
|
|
29
|
+
override.speed = undefined; // reset before each pass
|
|
30
|
+
for (const anim of animations) {
|
|
31
|
+
const { property, to, duration, ease, loop = false, yoyo = false, active } = anim;
|
|
32
|
+
if (!active || to === undefined)
|
|
33
|
+
continue;
|
|
34
|
+
if (property !== 'speed')
|
|
35
|
+
continue;
|
|
36
|
+
let from = anim.from;
|
|
37
|
+
if (from === undefined) {
|
|
38
|
+
from = startValuesCache[property] ??= (config.speed ?? 1);
|
|
39
|
+
}
|
|
40
|
+
let p = calculateTimeProgress(currentTime, duration, yoyo, loop);
|
|
41
|
+
if (ease) {
|
|
42
|
+
const fn = gsapEasingMap[ease] || ease;
|
|
43
|
+
p = applyEasing(fn, p);
|
|
44
|
+
}
|
|
45
|
+
override.speed = interpolateValue(property, from, to, p);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function applyCloudsMouseMove(properties, config, override, pointer) {
|
|
49
|
+
if (!properties?.length)
|
|
50
|
+
return;
|
|
51
|
+
override.speed = undefined;
|
|
52
|
+
for (const { property, enabled, propertySettings } of properties) {
|
|
53
|
+
if (!enabled || property !== 'speed')
|
|
54
|
+
continue;
|
|
55
|
+
const { axis = 'both', sensitivity = 1, inverted = false, min, max } = propertySettings || {};
|
|
56
|
+
const base = config.speed ?? 1;
|
|
57
|
+
override.speed = interpolateMouseMoveProperty(base, min, max, pointer, axis, sensitivity, inverted);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Project legacy flat `handlers.onMouseMove.properties[]` shape into per-domain
|
|
61
|
+
// buckets so we can route it through the new handlers without a save migration.
|
|
62
|
+
function projectLegacyHandlersToDomain(legacy) {
|
|
63
|
+
const transform = [];
|
|
64
|
+
const material = [];
|
|
65
|
+
const clouds = [];
|
|
66
|
+
if (!legacy)
|
|
67
|
+
return { transform, material, clouds };
|
|
68
|
+
for (const cfg of legacy) {
|
|
69
|
+
const enabledP = { property: cfg.property, enabled: cfg.enabled ?? true, propertySettings: cfg.propertySettings };
|
|
70
|
+
if (cfg.property === 'speed')
|
|
71
|
+
clouds.push(enabledP);
|
|
72
|
+
else if (cfg.property === 'position' || cfg.property === 'rotation' || cfg.property === 'scale')
|
|
73
|
+
transform.push(enabledP);
|
|
74
|
+
else
|
|
75
|
+
material.push(enabledP);
|
|
76
|
+
}
|
|
77
|
+
return { transform, material, clouds };
|
|
78
|
+
}
|
|
79
|
+
// =============================================================================
|
|
80
|
+
// MAIN COMPONENT
|
|
81
|
+
// =============================================================================
|
|
82
|
+
const defaultTimeSettings = {
|
|
83
|
+
enabled: false,
|
|
84
|
+
timescale: 1,
|
|
85
|
+
timeOfDay: 12,
|
|
86
|
+
syncWithRealTime: false,
|
|
87
|
+
autoAnimate: false,
|
|
88
|
+
};
|
|
89
|
+
const Clouds = ({ settings, timeSettings = defaultTimeSettings }) => {
|
|
90
|
+
const visible = settings.meshSettings.visible ?? true;
|
|
91
|
+
const meshSettings = settings.meshSettings;
|
|
92
|
+
const config = settings.config;
|
|
93
|
+
const materialSettings = settings.materialSettings;
|
|
94
|
+
const position = meshSettings.position;
|
|
95
|
+
const scale = meshSettings.scale;
|
|
96
|
+
// console.log(config.speed)
|
|
97
|
+
const baseSpeed = config.speed ?? 1;
|
|
98
|
+
// console.log(baseSpeed)
|
|
99
|
+
const height = position[1];
|
|
100
|
+
const planeSize = config?.planeSize || [10000, 10000];
|
|
101
|
+
const planeSegments = config?.planeSegments || 64;
|
|
28
102
|
const meshRef = useRef(null);
|
|
29
103
|
const cloudAnimTime = useRef(0);
|
|
30
104
|
const { camera } = useThree();
|
|
31
|
-
const { interpolateProperty } = useMouseHandlers();
|
|
32
105
|
const cloudColorRef = useRef(new THREE.Color(1, 1, 1));
|
|
33
106
|
const targetCloudColorRef = useRef(new THREE.Color(1, 1, 1));
|
|
107
|
+
// Sequence-driven numeric anims (legacy `useAnimationEvents` path)
|
|
34
108
|
const numericOverrideRef = useRef(null);
|
|
35
|
-
const mouseOverrideRef = useRef({});
|
|
36
109
|
const { animateNumeric } = useNumericAnimation();
|
|
37
|
-
|
|
38
|
-
|
|
110
|
+
// Per-domain animation + mouseMove overrides
|
|
111
|
+
const animatedOverrideRef = useRef({});
|
|
112
|
+
const mouseOverrideRef = useRef({});
|
|
113
|
+
// Keyframe-animation start-value caches (one per domain that uses them)
|
|
114
|
+
const transformAnimCacheRef = useRef({});
|
|
115
|
+
const materialAnimCacheRef = useRef({});
|
|
116
|
+
const cloudsAnimCacheRef = useRef({});
|
|
117
|
+
// useMaterialApplication(visible ? (meshRef.current as any) : null, materialSettings, true);
|
|
39
118
|
const handleTimeUpdate = useCallback((state) => {
|
|
40
119
|
const { normalizedTime, isDaytime, delta } = state;
|
|
41
120
|
if (isDaytime) {
|
|
@@ -66,6 +145,7 @@ const Clouds = ({ settings, timeSettings, }) => {
|
|
|
66
145
|
onTimeUpdate: handleTimeUpdate,
|
|
67
146
|
enabled: visible,
|
|
68
147
|
});
|
|
148
|
+
// Legacy sequence-driven `speed`/`scale` anims via `useAnimationEvents`
|
|
69
149
|
useAnimationEvents({
|
|
70
150
|
onStepStart: (event) => {
|
|
71
151
|
if (!event.step?.transitions)
|
|
@@ -75,20 +155,18 @@ const Clouds = ({ settings, timeSettings, }) => {
|
|
|
75
155
|
continue;
|
|
76
156
|
const toProps = transition.properties.to || {};
|
|
77
157
|
const fromProps = transition.properties.from || {};
|
|
78
|
-
|
|
79
|
-
if (toProps.visible !== undefined) {
|
|
158
|
+
if (toProps.visible !== undefined)
|
|
80
159
|
meshRef.current.visible = toProps.visible;
|
|
81
|
-
|
|
82
|
-
// numeric: speed, scale
|
|
83
|
-
const CLOUDS_NUMERIC_KEYS = ['speed', 'scale'];
|
|
160
|
+
const KEYS = ['speed', 'scale'];
|
|
84
161
|
const from = {};
|
|
85
162
|
const to = {};
|
|
86
|
-
for (const
|
|
87
|
-
const toVal = toProps[
|
|
163
|
+
for (const k of KEYS) {
|
|
164
|
+
const toVal = toProps[k];
|
|
88
165
|
if (toVal === undefined)
|
|
89
166
|
continue;
|
|
90
|
-
to[
|
|
91
|
-
|
|
167
|
+
to[k] = toVal;
|
|
168
|
+
const sourceFallback = k === 'speed' ? baseSpeed : scale;
|
|
169
|
+
from[k] = fromProps[k] ?? sourceFallback;
|
|
92
170
|
}
|
|
93
171
|
if (Object.keys(to).length > 0) {
|
|
94
172
|
animateNumeric(from, to, (updated) => {
|
|
@@ -100,44 +178,69 @@ const Clouds = ({ settings, timeSettings, }) => {
|
|
|
100
178
|
}
|
|
101
179
|
},
|
|
102
180
|
});
|
|
103
|
-
const handleMouseMove = (mouse) => {
|
|
104
|
-
if (!handlers?.onMouseMove?.enabled)
|
|
105
|
-
return;
|
|
106
|
-
if (!handlers.onMouseMove.properties.length)
|
|
107
|
-
return;
|
|
108
|
-
if (!meshRef.current)
|
|
109
|
-
return;
|
|
110
|
-
handlers.onMouseMove.properties.forEach((cfg) => {
|
|
111
|
-
const { property, propertySettings } = cfg;
|
|
112
|
-
const { min: minValue, max: maxValue, axis, sensitivity = 1, inverted = false } = propertySettings;
|
|
113
|
-
if (property === 'speed' || property === 'scale') {
|
|
114
|
-
const key = property;
|
|
115
|
-
const baseValue = settings[key];
|
|
116
|
-
if (baseValue === undefined)
|
|
117
|
-
return;
|
|
118
|
-
const interpolated = interpolateProperty(baseValue, minValue, maxValue, mouse, axis, sensitivity, inverted);
|
|
119
|
-
mouseOverrideRef.current[key] = interpolated;
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
const baseValue = settings.materialSettings?.[property];
|
|
123
|
-
if (baseValue === undefined)
|
|
124
|
-
return;
|
|
125
|
-
const interpolated = interpolateProperty(baseValue, minValue, maxValue, mouse, axis, sensitivity, inverted);
|
|
126
|
-
applySingleProperty(meshRef.current.material, property, interpolated);
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
181
|
useFrame((state) => {
|
|
130
|
-
|
|
182
|
+
const mesh = meshRef.current;
|
|
183
|
+
if (!mesh || !mesh.visible || !mesh.material)
|
|
131
184
|
return;
|
|
132
|
-
const material =
|
|
185
|
+
const material = mesh.material;
|
|
133
186
|
const uniforms = material?.uniforms;
|
|
134
187
|
if (!uniforms)
|
|
135
188
|
return;
|
|
136
|
-
const
|
|
189
|
+
const now = Date.now();
|
|
190
|
+
const pointer = state.pointer;
|
|
191
|
+
// ── PER-DOMAIN ANIMATIONS ────────────────────────────────────────────────
|
|
192
|
+
const mouseMove = settings.mouseMove;
|
|
193
|
+
// const isPerDomain = mm && ('transform' in mm || 'material' in mm || 'edges' in mm || 'light' in mm || 'clouds' in mm);
|
|
194
|
+
// transform: position / rotation / scale
|
|
195
|
+
// const transformAnims = settings.animations?.transform?.animations;
|
|
196
|
+
// if (transformAnims?.length) {
|
|
197
|
+
// handleTransformAnimations(
|
|
198
|
+
// { object: mesh, meshSettings: meshSettings as any, pathIsActive: false },
|
|
199
|
+
// transformAnims,
|
|
200
|
+
// now,
|
|
201
|
+
// false,
|
|
202
|
+
// );
|
|
203
|
+
// }
|
|
204
|
+
// // material: shader uniforms
|
|
205
|
+
// const materialAnims = settings.animations?.material?.animations;
|
|
206
|
+
// if (materialAnims?.length) {
|
|
207
|
+
// handleMaterialAnimations(
|
|
208
|
+
// { object: mesh, materialSettings: materialSettings as any, startValuesCache: materialAnimCacheRef.current },
|
|
209
|
+
// materialAnims,
|
|
210
|
+
// now,
|
|
211
|
+
// false,
|
|
212
|
+
// );
|
|
213
|
+
// }
|
|
214
|
+
// clouds: speed
|
|
215
|
+
applyCloudsKeyframeAnimations(settings.animations?.clouds?.animations, cloudsAnimCacheRef.current, config, animatedOverrideRef.current, now);
|
|
216
|
+
// ── PER-DOMAIN MOUSE-MOVE ─────────────────────────────────────────────────
|
|
217
|
+
if (mouseMove) {
|
|
218
|
+
const perDomain = mouseMove;
|
|
219
|
+
// if (perDomain.transform?.enabled && perDomain.transform.properties?.length) {
|
|
220
|
+
// handleTransformMouseMove(
|
|
221
|
+
// { object: mesh, meshSettings: meshSettings as any },
|
|
222
|
+
// perDomain.transform.properties,
|
|
223
|
+
// pointer,
|
|
224
|
+
// );
|
|
225
|
+
// }
|
|
226
|
+
// if (perDomain.material?.enabled && perDomain.material.properties?.length) {
|
|
227
|
+
// handleMaterialMouseMove(
|
|
228
|
+
// { object: mesh, materialSettings: materialSettings as any },
|
|
229
|
+
// perDomain.material.properties,
|
|
230
|
+
// pointer,
|
|
231
|
+
// );
|
|
232
|
+
// }
|
|
233
|
+
applyCloudsMouseMove(perDomain.clouds?.enabled ? perDomain.clouds.properties : undefined, config, mouseOverrideRef.current, pointer);
|
|
234
|
+
}
|
|
235
|
+
// ── EFFECTIVE SPEED + UNIFORM UPDATES ─────────────────────────────────────
|
|
236
|
+
const effectiveSpeed = animatedOverrideRef.current.speed
|
|
237
|
+
?? numericOverrideRef.current?.speed
|
|
137
238
|
?? mouseOverrideRef.current.speed
|
|
138
|
-
??
|
|
239
|
+
?? baseSpeed;
|
|
240
|
+
// console.log(effectiveSpeed)
|
|
241
|
+
// console.log(effectiveSpeed)
|
|
139
242
|
cloudAnimTime.current += 0.02 * effectiveSpeed;
|
|
140
|
-
|
|
243
|
+
// console.log(cloudAnimTime.current)
|
|
141
244
|
if (uniforms.u_time)
|
|
142
245
|
uniforms.u_time.value = cloudAnimTime.current;
|
|
143
246
|
if (uniforms.u_cameraPos) {
|
|
@@ -160,14 +263,16 @@ const Clouds = ({ settings, timeSettings, }) => {
|
|
|
160
263
|
? uniforms.u_sunPosition.value.copy(sunDirection)
|
|
161
264
|
: (uniforms.u_sunPosition.value = sunDirection.clone());
|
|
162
265
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
meshRef.current.scale.setScalar(effectiveScale);
|
|
266
|
+
// Apply scale override (sequence-driven path only — per-domain transform anims
|
|
267
|
+
// already mutate mesh.scale through handleTransformAnimations).
|
|
268
|
+
if (numericOverrideRef.current?.scale !== undefined) {
|
|
269
|
+
mesh.scale.setScalar(numericOverrideRef.current.scale);
|
|
168
270
|
}
|
|
169
271
|
});
|
|
170
|
-
|
|
171
|
-
|
|
272
|
+
return (_jsx("mesh", { ref: meshRef, name: "SkyClouds", userData: { id: '3drise-clouds' },
|
|
273
|
+
// position={[0, height, 0]}
|
|
274
|
+
// rotation={[Math.PI / 2, 0, 0]}
|
|
275
|
+
// scale={scale}
|
|
276
|
+
renderOrder: -1, frustumCulled: false, visible: visible, children: _jsx("planeGeometry", { args: [planeSize[0], planeSize[1], planeSegments, planeSegments] }) }));
|
|
172
277
|
};
|
|
173
278
|
export default Clouds;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreatedObject.d.ts","sourceRoot":"","sources":["../../src/components/CreatedObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAG,qBAAqB,EAAkC,MAAM,wBAAwB,CAAC;AAQrG,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAWrD,UAAU,kBAAkB;IAC1B,aAAa,EAAE,qBAAqB,CAAC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAElH;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"CreatedObject.d.ts","sourceRoot":"","sources":["../../src/components/CreatedObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAG,qBAAqB,EAAkC,MAAM,wBAAwB,CAAC;AAQrG,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAWrD,UAAU,kBAAkB;IAC1B,aAAa,EAAE,qBAAqB,CAAC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAElH;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA0J9C,CAAC;AAIH,eAAe,aAAa,CAAC"}
|
|
@@ -15,7 +15,7 @@ const CreatedObject = memo(({ createdObject, children, shouldApply3driseMaterial
|
|
|
15
15
|
// const { handleObjectClick: contextHandleObjectClick } = useSceneClick();
|
|
16
16
|
const meshRef = useRef(null);
|
|
17
17
|
const transformRef = useRef(null);
|
|
18
|
-
const baseColorRef = useRef(("color" in createdObject.materialSettings && createdObject.materialSettings.color) || '#ffffff');
|
|
18
|
+
// const baseColorRef = useRef<string>(("color" in createdObject.materialSettings && createdObject.materialSettings.color) || '#ffffff');
|
|
19
19
|
// const [hovered, setHovered] = useState(false);
|
|
20
20
|
const [animatedTransform, setAnimatedTransform] = useState({
|
|
21
21
|
position: createdObject.meshSettings.position,
|
|
@@ -85,10 +85,6 @@ const CreatedObject = memo(({ createdObject, children, shouldApply3driseMaterial
|
|
|
85
85
|
e.stopPropagation();
|
|
86
86
|
};
|
|
87
87
|
const anchorEnabled = createdObject.meshSettings.anchor && createdObject.meshSettings.anchor.enabled;
|
|
88
|
-
// console.log("createdObject.meshSettings", createdObject.meshSettings)
|
|
89
|
-
// console.log("Rendered CreatedObject:", createdObject.rigidBodySettings);
|
|
90
|
-
const stateKey = createdObject.meshSettings.name;
|
|
91
|
-
// console.log({stateKey})
|
|
92
88
|
return (_jsx(AnimatedObject
|
|
93
89
|
// animationId={createdObject.animationId || ''}
|
|
94
90
|
, {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
export interface EarthProps {
|
|
4
|
+
sunPosition?: [number, number, number];
|
|
5
|
+
position?: [number, number, number];
|
|
6
|
+
scale?: number;
|
|
7
|
+
radius?: number;
|
|
8
|
+
segments?: number;
|
|
9
|
+
enableRotation?: boolean;
|
|
10
|
+
rotationSpeed?: number;
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
atmosphereDayColor?: THREE.ColorRepresentation;
|
|
13
|
+
atmosphereTwilightColor?: THREE.ColorRepresentation;
|
|
14
|
+
onMeshReady?: (mesh: THREE.Mesh) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const Earth: React.FC<EarthProps>;
|
|
17
|
+
export default Earth;
|
|
18
|
+
//# sourceMappingURL=Earth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Earth.d.ts","sourceRoot":"","sources":["../../src/components/Earth.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kBAAkB,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC;IAC/C,uBAAuB,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC;IACpD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;CAC1C;AAED,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAkF/B,CAAC;AAGF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useMemo, useCallback, useEffect } from 'react';
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
import { useFrame } from '@react-three/fiber';
|
|
5
|
+
import { useTexture } from '@react-three/drei';
|
|
6
|
+
const EARTH_CDN_BASE = 'https://3d-rise.sfo3.cdn.digitaloceanspaces.com/app/images/earth';
|
|
7
|
+
const EARTH_DAY_URL = `${EARTH_CDN_BASE}/earth_day_4096.jpg`;
|
|
8
|
+
const EARTH_NIGHT_URL = `${EARTH_CDN_BASE}/earth_night_4096.jpg`;
|
|
9
|
+
const EARTH_BUMP_ROUGHNESS_CLOUDS_URL = `${EARTH_CDN_BASE}/earth_bump_roughness_clouds_4096.jpg`;
|
|
10
|
+
const Earth = ({ sunPosition = [0, 0, 3], position = [0, 0, 0], scale = 1, radius = 1, segments = 64, enableRotation = true, rotationSpeed = 0.025, visible = true, atmosphereDayColor = '#4db2ff', atmosphereTwilightColor = '#bc490b', onMeshReady, }) => {
|
|
11
|
+
const globeRef = useRef(null);
|
|
12
|
+
const globeMatRef = useRef(null);
|
|
13
|
+
const atmosphereMatRef = useRef(null);
|
|
14
|
+
const [dayMap, nightMap, bumpRoughnessClouds] = useTexture([
|
|
15
|
+
EARTH_DAY_URL,
|
|
16
|
+
EARTH_NIGHT_URL,
|
|
17
|
+
EARTH_BUMP_ROUGHNESS_CLOUDS_URL,
|
|
18
|
+
]);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
dayMap.colorSpace = THREE.SRGBColorSpace;
|
|
21
|
+
nightMap.colorSpace = THREE.SRGBColorSpace;
|
|
22
|
+
dayMap.anisotropy = 8;
|
|
23
|
+
nightMap.anisotropy = 8;
|
|
24
|
+
bumpRoughnessClouds.anisotropy = 8;
|
|
25
|
+
}, [dayMap, nightMap, bumpRoughnessClouds]);
|
|
26
|
+
const sunDirection = useMemo(() => new THREE.Vector3(sunPosition[0], sunPosition[1], sunPosition[2]).normalize(), [sunPosition]);
|
|
27
|
+
const dayColor = useMemo(() => new THREE.Color(atmosphereDayColor), [atmosphereDayColor]);
|
|
28
|
+
const twilightColor = useMemo(() => new THREE.Color(atmosphereTwilightColor), [atmosphereTwilightColor]);
|
|
29
|
+
const handleGlobeRef = useCallback((mesh) => {
|
|
30
|
+
if (mesh) {
|
|
31
|
+
globeRef.current = mesh;
|
|
32
|
+
onMeshReady?.(mesh);
|
|
33
|
+
}
|
|
34
|
+
}, [onMeshReady]);
|
|
35
|
+
useFrame((_, delta) => {
|
|
36
|
+
if (enableRotation && globeRef.current) {
|
|
37
|
+
globeRef.current.rotation.y += delta * rotationSpeed;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return (_jsxs("group", { position: position, scale: scale, visible: visible, userData: { id: '3drise-earth' }, children: [_jsxs("mesh", { ref: handleGlobeRef, children: [_jsx("sphereGeometry", { args: [radius, segments, segments] }), _jsx("earthMaterial", { ref: globeMatRef, uDayMap: dayMap, uNightMap: nightMap, uBumpRoughnessClouds: bumpRoughnessClouds, uSunDirection: sunDirection, uAtmosphereDayColor: dayColor, uAtmosphereTwilightColor: twilightColor })] }), _jsxs("mesh", { scale: 1.04, children: [_jsx("sphereGeometry", { args: [radius, segments, segments] }), _jsx("earthAtmosphereMaterial", { ref: atmosphereMatRef, transparent: true, side: THREE.BackSide, depthWrite: false, uSunDirection: sunDirection, uAtmosphereDayColor: dayColor, uAtmosphereTwilightColor: twilightColor })] })] }));
|
|
41
|
+
};
|
|
42
|
+
Earth.displayName = 'Earth';
|
|
43
|
+
export default Earth;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Frame.d.ts","sourceRoot":"","sources":["../../src/components/Frame.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAmC,QAAQ,EAAsB,MAAM,OAAO,CAAC;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAgB,MAAM,wBAAwB,CAAC;AACjG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMrE,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,cAAc,EAAE,qBAAqB,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,iBAAiB,CAAC,EAAE,CAClB,aAAa,EAAE,qBAAqB,EACpC,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC1C;AAED,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,GAAG,EACH,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,SAAoB,EACpB,aAAa,EACb,gBAAqB,EACrB,YAAiB,EACjB,cAAc,EACd,IAAI,EACJ,gBAAgB,EAChB,QAAQ,EACR,iBAAiB,GAClB,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"Frame.d.ts","sourceRoot":"","sources":["../../src/components/Frame.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAmC,QAAQ,EAAsB,MAAM,OAAO,CAAC;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAgB,MAAM,wBAAwB,CAAC;AACjG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMrE,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,cAAc,EAAE,qBAAqB,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,iBAAiB,CAAC,EAAE,CAClB,aAAa,EAAE,qBAAqB,EACpC,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC1C;AAED,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,GAAG,EACH,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,SAAoB,EACpB,aAAa,EACb,gBAAqB,EACrB,YAAiB,EACjB,cAAc,EACd,IAAI,EACJ,gBAAgB,EAChB,QAAQ,EACR,iBAAiB,GAClB,EAAE,UAAU,kDAuFZ"}
|
package/dist/components/Frame.js
CHANGED
|
@@ -48,5 +48,7 @@ export default function Frame({ url, isActive, createdObject, position, rotation
|
|
|
48
48
|
};
|
|
49
49
|
if (!texture)
|
|
50
50
|
return null;
|
|
51
|
-
return (_jsx("mesh", { name: url, ref: frameRef, position: position, rotation: rotation, scale: scale, raycast: () => null, onPointerEnter: handlePointerEnter, onPointerLeave: handlePointerLeave, onClick: onClick,
|
|
51
|
+
return (_jsx("mesh", { name: url, ref: frameRef, position: position, rotation: rotation, scale: scale, raycast: () => null, onPointerEnter: handlePointerEnter, onPointerLeave: handlePointerLeave, onClick: onClick, userData: {
|
|
52
|
+
url,
|
|
53
|
+
}, children: children ? children : (_jsxs(_Fragment, { children: [_jsx(FrameGeometry, { shapeType: 'rectangle', layoutSettings: layoutSettings, scale: layoutSettings.outerFrameScale }), _jsx(MaterialLibrary, { materialSettings: materialSettings }), showFront && (_jsx(FrameImage, { ref: imageRef, texture: texture, shapeType: 'rectangle', position: [0, 0, 0.02] })), showBack && (_jsx(FrameImage, { texture: texture, shapeType: 'rectangle', position: [0, 0, -0.02], rotation: [0, Math.PI, 0], isBack: true }))] })) }));
|
|
52
54
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import Stars from './Stars.js';
|
|
3
|
-
import ShootingStars from './ShootingStars.js';
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
4
2
|
const Galaxy = ({ settings, timeSettings, sunSystemEnabled }) => {
|
|
5
3
|
// if (!settings.visible) return null;
|
|
6
|
-
return (
|
|
4
|
+
return (_jsx(_Fragment, {}));
|
|
7
5
|
};
|
|
8
6
|
export default Galaxy;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CreatedObjectSettings } from '@ntalmagor/3drize-core';
|
|
3
|
+
export interface GlyphsProps {
|
|
4
|
+
settings: CreatedObjectSettings;
|
|
5
|
+
}
|
|
6
|
+
declare const Glyphs: React.FC<GlyphsProps>;
|
|
7
|
+
export default Glyphs;
|
|
8
|
+
//# sourceMappingURL=Glyphs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Glyphs.d.ts","sourceRoot":"","sources":["../../src/components/Glyphs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAGlD,OAAO,KAAK,EAAE,qBAAqB,EAAgB,MAAM,wBAAwB,CAAC;AAGlF,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,qBAAqB,CAAC;CACjC;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA0DjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo } from 'react';
|
|
3
|
+
import { useFrame } from '@react-three/fiber';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { GlyphRingMaterial } from '@ntalmagor/3drize-core';
|
|
6
|
+
const Glyphs = ({ settings }) => {
|
|
7
|
+
const config = settings.config;
|
|
8
|
+
// The ring sits at r=0.55 within UV space, so the plane must span 2 * ringRadius / 0.55
|
|
9
|
+
// for the ring's outer edge to land at the configured `ringRadius` in world units.
|
|
10
|
+
const planeSize = useMemo(() => {
|
|
11
|
+
const r = Math.max(0.05, config.ringRadius ?? 1);
|
|
12
|
+
return (2 * r) / 0.55;
|
|
13
|
+
}, [config.ringRadius]);
|
|
14
|
+
const geometry = useMemo(() => new THREE.PlaneGeometry(planeSize, planeSize, 1, 1), [planeSize]);
|
|
15
|
+
const material = useMemo(() => {
|
|
16
|
+
const m = new GlyphRingMaterial();
|
|
17
|
+
m.transparent = true;
|
|
18
|
+
m.depthWrite = false;
|
|
19
|
+
m.side = THREE.DoubleSide;
|
|
20
|
+
m.blending = THREE.AdditiveBlending;
|
|
21
|
+
return m;
|
|
22
|
+
}, []);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const u = material.uniforms;
|
|
25
|
+
u.uRingColor.value.set(config.ringColor ?? '#88ccff');
|
|
26
|
+
u.uGlyphsColor.value.set(config.glyphsColor ?? '#88ccff');
|
|
27
|
+
u.uShadesMultiplier.value = config.shadesMultiplier ?? 0.0;
|
|
28
|
+
u.uHoverColor.value.set(config.hoverColor ?? '#ffffff');
|
|
29
|
+
u.uHoverRadius.value = config.hoverRadius ?? 0.3;
|
|
30
|
+
u.uHoverIntensity.value = config.hoverIntensity ?? 0.0;
|
|
31
|
+
u.uGlyphCount.value = Math.max(3, config.glyphCount ?? 12);
|
|
32
|
+
u.uMorphSpeed.value = config.morphSpeed ?? 0.4;
|
|
33
|
+
u.uIntensity.value = config.intensity ?? 1.5;
|
|
34
|
+
u.uOpacity.value = config.opacity ?? 1.0;
|
|
35
|
+
}, [
|
|
36
|
+
config.ringColor,
|
|
37
|
+
config.glyphsColor,
|
|
38
|
+
config.shadesMultiplier,
|
|
39
|
+
config.hoverColor,
|
|
40
|
+
config.hoverRadius,
|
|
41
|
+
config.hoverIntensity,
|
|
42
|
+
config.glyphCount,
|
|
43
|
+
config.morphSpeed,
|
|
44
|
+
config.intensity,
|
|
45
|
+
config.opacity,
|
|
46
|
+
material,
|
|
47
|
+
]);
|
|
48
|
+
useEffect(() => () => { geometry.dispose(); material.dispose(); }, [geometry, material]);
|
|
49
|
+
useFrame((state, delta) => {
|
|
50
|
+
material.uniforms.uTime.value = state.clock.getElapsedTime();
|
|
51
|
+
const rotSpeed = config.rotationSpeed ?? 0.5;
|
|
52
|
+
material.uniforms.uRotation.value += delta * rotSpeed * 0.15;
|
|
53
|
+
});
|
|
54
|
+
if (!settings.meshSettings.visible)
|
|
55
|
+
return null;
|
|
56
|
+
return _jsx("mesh", { geometry: geometry, material: material, frustumCulled: false });
|
|
57
|
+
};
|
|
58
|
+
export default Glyphs;
|
|
@@ -14,7 +14,7 @@ const cleanColor = (color) => {
|
|
|
14
14
|
}
|
|
15
15
|
return color;
|
|
16
16
|
};
|
|
17
|
-
const GridHelper = ({ cellSize = 1, cellThickness = 1, cellColor = '#000000', sectionSize = 10, sectionThickness = 1.5, sectionColor = '#000000', followCamera = false, infiniteGrid = true, fadeDistance = 30, fadeStrength = 1, fadeFrom = 0, side = THREE.
|
|
17
|
+
const GridHelper = ({ cellSize = 1, cellThickness = 1, cellColor = '#000000', sectionSize = 10, sectionThickness = 1.5, sectionColor = '#000000', followCamera = false, infiniteGrid = true, fadeDistance = 30, fadeStrength = 1, fadeFrom = 0, side = THREE.DoubleSide, position = [0, 0, 0], rotation = [0, 0, 0], visible = true, device = 'desktop', }) => {
|
|
18
18
|
const gridRef = useRef(null);
|
|
19
19
|
const targetY = useRef(position[1]);
|
|
20
20
|
const responsiveScale = useMemo(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Moon.d.ts","sourceRoot":"","sources":["../../src/components/Moon.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
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"}
|