@ntalmagor/3drize-viewer 0.1.25 → 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.js +18 -10
- package/dist/components/CreatedObject.js +1 -1
- 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/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 +23 -5
- 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/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +2 -1
- package/dist/components/SkySystem.d.ts.map +1 -1
- package/dist/components/SkySystem.js +2 -2
- package/dist/components/Skybox.js +1 -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/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/hooks/useContinuousEffects.js +2 -7
- package/dist/hooks/useMeshController.d.ts.map +1 -1
- package/dist/hooks/useMeshController.js +78 -28
- package/dist/hooks/useSequenceAnimation.d.ts.map +1 -1
- package/dist/hooks/useSequenceAnimation.js +38 -17
- 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;
|
|
@@ -5,7 +5,7 @@ import { useThree, useFrame } from '@react-three/fiber';
|
|
|
5
5
|
import { useSkySystem } from '../hooks/useSkySystem.js';
|
|
6
6
|
import { useAnimationEvents } from '../hooks/useAnimationEvents.js';
|
|
7
7
|
import { useNumericAnimation } from '../hooks/useNumericAnimation.js';
|
|
8
|
-
import { calculateTimeProgress, applyEasing, gsapEasingMap, interpolateValue,
|
|
8
|
+
import { calculateTimeProgress, applyEasing, gsapEasingMap, interpolateValue, interpolateMouseMoveProperty, } from '@ntalmagor/3drize-core';
|
|
9
9
|
const CLOUD_COLORS = {
|
|
10
10
|
night: new THREE.Color(0.1, 0.1, 0.2),
|
|
11
11
|
sunrise: new THREE.Color(0.8, 0.4, 0.4),
|
|
@@ -189,7 +189,7 @@ const Clouds = ({ settings, timeSettings = defaultTimeSettings }) => {
|
|
|
189
189
|
const now = Date.now();
|
|
190
190
|
const pointer = state.pointer;
|
|
191
191
|
// ── PER-DOMAIN ANIMATIONS ────────────────────────────────────────────────
|
|
192
|
-
const
|
|
192
|
+
const mouseMove = settings.mouseMove;
|
|
193
193
|
// const isPerDomain = mm && ('transform' in mm || 'material' in mm || 'edges' in mm || 'light' in mm || 'clouds' in mm);
|
|
194
194
|
// transform: position / rotation / scale
|
|
195
195
|
// const transformAnims = settings.animations?.transform?.animations;
|
|
@@ -214,14 +214,22 @@ const Clouds = ({ settings, timeSettings = defaultTimeSettings }) => {
|
|
|
214
214
|
// clouds: speed
|
|
215
215
|
applyCloudsKeyframeAnimations(settings.animations?.clouds?.animations, cloudsAnimCacheRef.current, config, animatedOverrideRef.current, now);
|
|
216
216
|
// ── PER-DOMAIN MOUSE-MOVE ─────────────────────────────────────────────────
|
|
217
|
-
if (
|
|
218
|
-
const perDomain =
|
|
219
|
-
if (perDomain.transform?.enabled && perDomain.transform.properties?.length) {
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
+
// }
|
|
225
233
|
applyCloudsMouseMove(perDomain.clouds?.enabled ? perDomain.clouds.properties : undefined, config, mouseOverrideRef.current, pointer);
|
|
226
234
|
}
|
|
227
235
|
// ── EFFECTIVE SPEED + UNIFORM UPDATES ─────────────────────────────────────
|
|
@@ -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,
|
|
@@ -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;
|
|
@@ -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"}
|
package/dist/components/Moon.js
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useCallback } from 'react';
|
|
2
|
+
import { useRef, useEffect, useState, useCallback } from 'react';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
import { useFrame } from '@react-three/fiber';
|
|
5
|
-
import { useTexture } from '@react-three/drei';
|
|
6
5
|
export { defaultMoonSettings } from '@ntalmagor/3drize-core';
|
|
7
|
-
const MOON_TEXTURE_URL =
|
|
6
|
+
const MOON_TEXTURE_URL = "https://3d-rise.sfo3.cdn.digitaloceanspaces.com/app/images/moon_1024.jpg";
|
|
8
7
|
const Moon = ({ settings, sunPosition, onMeshReady }) => {
|
|
9
8
|
const meshRef = useRef(null);
|
|
10
9
|
const lightRef = useRef(null);
|
|
11
10
|
const targetRef = useRef(null);
|
|
12
|
-
const texture =
|
|
11
|
+
const [texture, setTexture] = useState(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const loader = new THREE.TextureLoader();
|
|
14
|
+
loader.setCrossOrigin('anonymous');
|
|
15
|
+
let cancelled = false;
|
|
16
|
+
loader.load(MOON_TEXTURE_URL, (loaded) => {
|
|
17
|
+
console.log("Moon texture loaded:", loaded);
|
|
18
|
+
if (!cancelled)
|
|
19
|
+
setTexture(loaded);
|
|
20
|
+
}, undefined, () => {
|
|
21
|
+
// Silently ignore — moon renders as a plain lit sphere if the texture fails.
|
|
22
|
+
});
|
|
23
|
+
return () => {
|
|
24
|
+
cancelled = true;
|
|
25
|
+
};
|
|
26
|
+
}, []);
|
|
13
27
|
const s = settings ?? {
|
|
14
28
|
visible: true,
|
|
15
|
-
position: [0,
|
|
29
|
+
position: [0, 0, 0],
|
|
16
30
|
scale: 3,
|
|
17
31
|
rotation: [0, 0, 0.5],
|
|
18
32
|
emissiveIntensity: 0.3,
|
|
@@ -46,7 +60,7 @@ const Moon = ({ settings, sunPosition, onMeshReady }) => {
|
|
|
46
60
|
}
|
|
47
61
|
});
|
|
48
62
|
const moonPos = sunPosition ?? s.position;
|
|
49
|
-
return (_jsxs("group", { userData: { id: '3drise-moon' }, children: [_jsx("object3D", { ref: targetRef, position: moonPos }), _jsx("directionalLight", { ref: lightRef, intensity: 2, color: 0xffffff, target: targetRef.current ?? undefined }), _jsxs("mesh", { ref: handleMeshRef, position: moonPos, rotation: s.rotation, scale: s.scale, visible: s.visible, children: [_jsx("sphereGeometry", { args: [
|
|
63
|
+
return (_jsxs("group", { userData: { id: '3drise-moon' }, children: [_jsx("object3D", { ref: targetRef, position: moonPos }), _jsx("directionalLight", { ref: lightRef, intensity: 2, color: 0xffffff, target: targetRef.current ?? undefined }), _jsxs("mesh", { ref: handleMeshRef, position: moonPos, rotation: s.rotation, scale: s.scale, visible: s.visible, children: [_jsx("sphereGeometry", { args: [1, 32, 32] }), _jsx("meshPhongMaterial", { color: 0xb2b2b2, normalMap: texture, shininess: 0 })] })] }));
|
|
50
64
|
};
|
|
51
65
|
Moon.displayName = 'Moon';
|
|
52
66
|
export default Moon;
|
|
@@ -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,
|
|
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"}
|
|
@@ -15,6 +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";
|
|
21
|
+
// Types whose React component instantiates and drives its own ShaderMaterial.
|
|
22
|
+
// useMaterialApplication would otherwise traverse the mesh tree and replace
|
|
23
|
+
// that material with a registry-default instance, breaking config-driven
|
|
24
|
+
// uniform updates (e.g. only ringRadius worked on glyphs because that drives
|
|
25
|
+
// geometry, not the material).
|
|
26
|
+
const SELF_MANAGED_MATERIAL = new Set([
|
|
27
|
+
'bubbles',
|
|
28
|
+
'glyphs',
|
|
29
|
+
'sparklesBurst',
|
|
30
|
+
// 'moon'
|
|
31
|
+
]);
|
|
18
32
|
// const EffectsLayer: React.FC<{ effects: CreatedObjectSettings['effects'] }> = ({ effects }) =>
|
|
19
33
|
// effects?.length ? (
|
|
20
34
|
// <>
|
|
@@ -25,7 +39,8 @@ import Rain from "./Rain.js";
|
|
|
25
39
|
// ) : null;
|
|
26
40
|
const GroupWithChildren = ({ createdObject, children, cameraSettings, onObjectReady, handleObjectClick, renderObject }) => {
|
|
27
41
|
const isGroup = createdObject.type === 'group';
|
|
28
|
-
|
|
42
|
+
const selfManagedMaterial = SELF_MANAGED_MATERIAL.has(createdObject.type);
|
|
43
|
+
return (_jsxs(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !isGroup && !selfManagedMaterial, children: [!isGroup && renderObject(createdObject, handleObjectClick), children.map(childNode => (_jsx(ObjectNode, { node: childNode, cameraSettings: cameraSettings, handleObjectClick: handleObjectClick, onObjectReady: onObjectReady }, childNode.objectId)))] }, createdObject.id));
|
|
29
44
|
};
|
|
30
45
|
const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick }) => {
|
|
31
46
|
const { children, createdObject } = node;
|
|
@@ -56,8 +71,8 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick })
|
|
|
56
71
|
const particlesSettings = obj;
|
|
57
72
|
return (_jsxs(_Fragment, { children: [particlesSettings.config?.particles && (_jsx(ParticlesR3f, { particlesSettings: particlesSettings, cameraFov: cameraSettings.fov, duration: 1, transitionSettings: particlesSettings.meshSettings })), particlesSettings.config?.paths && (_jsx(Lines, { createdObject: particlesSettings }))] }));
|
|
58
73
|
},
|
|
59
|
-
path: (obj, cameraSettings, onObjectReady) => (_jsx(PathRenderer, { pathSettings: obj.config
|
|
60
|
-
grid: (obj, cameraSettings, onObjectReady) => (_jsx(GridHelper, { ...obj.config })),
|
|
74
|
+
path: (obj, cameraSettings, onObjectReady) => (_jsx(PathRenderer, { pathSettings: obj.config }, obj.id)),
|
|
75
|
+
grid: (obj, cameraSettings, onObjectReady) => (_jsx(GridHelper, { ...obj.config, side: 2 })),
|
|
61
76
|
effect: (obj) => (_jsx(EffectsGenerator, { settings: {
|
|
62
77
|
enabled: true,
|
|
63
78
|
config: obj.config,
|
|
@@ -65,6 +80,9 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick })
|
|
|
65
80
|
gallery: (obj, cameraSettings, onObjectReady) => (_jsx(GalleryLayout, { createdObject: obj, handleObjectClick: handleObjectClick })),
|
|
66
81
|
light: (obj, cameraSettings, onObjectReady) => (_jsx(LightObject, { createdObject: obj })),
|
|
67
82
|
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 })),
|
|
68
86
|
}), [handleObjectClick]);
|
|
69
87
|
if (!createdObject) {
|
|
70
88
|
console.warn(`createdObject not found.`);
|
|
@@ -74,13 +92,13 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick })
|
|
|
74
92
|
const hasChildren = children.length > 0;
|
|
75
93
|
const shouldRenderAsGroup = hasChildren || createdObject.type === 'group' || createdObject.type === 'effect';
|
|
76
94
|
const renderObject = useCallback((obj, handleObjectClick) => {
|
|
77
|
-
console.log('Rendering object:', obj);
|
|
95
|
+
// console.log('Rendering object:', obj);
|
|
78
96
|
const renderer = renderers[obj.type];
|
|
79
97
|
return renderer?.(obj, cameraSettings, onObjectReady) ?? null;
|
|
80
98
|
}, [cameraSettings, onObjectReady, renderers]);
|
|
81
99
|
const renderedObject = shouldRenderAsGroup
|
|
82
100
|
? _jsx(GroupWithChildren, { createdObject: createdObject, children: children, cameraSettings: cameraSettings, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick, renderObject: renderObject })
|
|
83
|
-
: _jsx(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick, children: renderObject(createdObject) }, createdObject.id);
|
|
101
|
+
: _jsx(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !SELF_MANAGED_MATERIAL.has(createdObject.type), children: renderObject(createdObject) }, createdObject.id);
|
|
84
102
|
// createdObject.effects
|
|
85
103
|
// ? <>
|
|
86
104
|
// {renderObject(createdObject)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathRenderer.d.ts","sourceRoot":"","sources":["../../src/components/PathRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,wBAAwB,CAAC;AAIvE,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,UAAU,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PathRenderer.d.ts","sourceRoot":"","sources":["../../src/components/PathRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,wBAAwB,CAAC;AAIvE,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,UAAU,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAqE7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -3,7 +3,10 @@ import { useMemo } from 'react';
|
|
|
3
3
|
import { Sphere, Line } from '@react-three/drei';
|
|
4
4
|
import { smoothPathCorners, createPathSpline, sampleSplinePoints } from '@ntalmagor/3drize-core';
|
|
5
5
|
import PathGeometry from './PathGeometry.js';
|
|
6
|
-
const PathRenderer = ({ pathSettings, color = '#ffa500', showPoints = true, showLine = true, showCurve = true,
|
|
6
|
+
const PathRenderer = ({ pathSettings, color = '#ffa500', showPoints = true, showLine = true, showCurve = true, }) => {
|
|
7
|
+
console.log("Rendering Path with settings:", pathSettings);
|
|
8
|
+
const pointSize = pathSettings.pointSize ?? 0.1;
|
|
9
|
+
const lineWidth = pathSettings.lineWidth ?? 2;
|
|
7
10
|
const points = pathSettings?.points || [];
|
|
8
11
|
const curve = pathSettings?.curve ?? 1;
|
|
9
12
|
const smoothCorners = pathSettings?.smoothCorners ?? 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectLoader.d.ts","sourceRoot":"","sources":["../../src/components/ProjectLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAQ,EAAE,KAAK,qBAAqB,EAAkB,KAAK,WAAW,EAAwB,MAAM,wBAAwB,CAAC;AAG7H,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,KAAK,YAAY,GAAG;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACtG,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAChD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACvD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"ProjectLoader.d.ts","sourceRoot":"","sources":["../../src/components/ProjectLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAQ,EAAE,KAAK,qBAAqB,EAAkB,KAAK,WAAW,EAAwB,MAAM,wBAAwB,CAAC;AAG7H,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,KAAK,YAAY,GAAG;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACtG,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAChD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACvD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAwGzC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -61,13 +61,7 @@ const ProjectLoader = ({ projectId, onObjectClick, onObjectHover, onElementClick
|
|
|
61
61
|
catch (assetError) {
|
|
62
62
|
console.error('[useLoadProject] Failed to load model assets, continuing with project load:', assetError);
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
...obj.userData,
|
|
67
|
-
id: obj.id,
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
meshController.createMeshes(meshes);
|
|
64
|
+
meshController.createObjects(meshObjects);
|
|
71
65
|
console.log("PROJECT LOAD COMPLETE");
|
|
72
66
|
setProject(responseData);
|
|
73
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneBuilder.d.ts","sourceRoot":"","sources":["../../src/components/SceneBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,KAAK,EAEV,iBAAiB,EAQlB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"SceneBuilder.d.ts","sourceRoot":"","sources":["../../src/components/SceneBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,KAAK,EAEV,iBAAiB,EAQlB,MAAM,wBAAwB,CAAC;AAWhC,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA+M7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -7,6 +7,7 @@ import LightsManager from "./LightsManager.js";
|
|
|
7
7
|
import EnvironmentManager from "./EnvironmentManager.js";
|
|
8
8
|
import CameraController from "./CameraController.js";
|
|
9
9
|
import ObjectsRenderer from "./ObjectsRenderer.js";
|
|
10
|
+
import CursorController from "./cursor/CursorController.js";
|
|
10
11
|
import { Physics } from "@react-three/rapier";
|
|
11
12
|
const SceneBuilder = ({ project, width = "100%", height = "100vh", style = {}, className = "", onSceneInitialized, onUiElementClick, onObjectClick, }) => {
|
|
12
13
|
const sceneSettings = (project.sceneSettingsData || {});
|
|
@@ -127,6 +128,6 @@ const SceneBuilder = ({ project, width = "100%", height = "100vh", style = {}, c
|
|
|
127
128
|
if (onSceneInitialized) {
|
|
128
129
|
onSceneInitialized();
|
|
129
130
|
}
|
|
130
|
-
}, children: _jsxs(Physics, { gravity: physicsSettings.gravity, paused: !physicsSettings.enabled, debug: physicsSettings.debug, children: [_jsx(LightsManager, { config: lighting[0] }), environment && _jsx(EnvironmentManager, { environment: environment, timeSettings: timeSettings }), _jsx(CameraController, { settings: camera }), _jsx(ObjectsRenderer, { cameraSettings: camera, generalObjectSettings: generalObjectSettings, createdObjects: sceneObjects, onObjectsReady: undefined, sequences: animationSequences, handleObjectClick: onObjectClick ? (object, ref, event) => onObjectClick(object, ref, event) : undefined })] }) }) }));
|
|
131
|
+
}, children: _jsxs(Physics, { gravity: physicsSettings.gravity, paused: !physicsSettings.enabled, debug: physicsSettings.debug, children: [_jsx(LightsManager, { config: lighting[0] }), environment && _jsx(EnvironmentManager, { environment: environment, timeSettings: timeSettings }), _jsx(CameraController, { settings: camera }), _jsx(ObjectsRenderer, { cameraSettings: camera, generalObjectSettings: generalObjectSettings, createdObjects: sceneObjects, onObjectsReady: undefined, sequences: animationSequences, handleObjectClick: onObjectClick ? (object, ref, event) => onObjectClick(object, ref, event) : undefined }), _jsx(CursorController, { effects: project.cursor?.effects, clickActions: project.cursor?.clickActions })] }) }) }));
|
|
131
132
|
};
|
|
132
133
|
export default SceneBuilder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkySystem.d.ts","sourceRoot":"","sources":["../../src/components/SkySystem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8E,MAAM,OAAO,CAAC;AACnG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACpH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,KAAK,CAAC,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,sBAAsB,CAAC,EAAE,gBAAgB,CAAC;IAC1C,qBAAqB,CAAC,EAAE,WAAW,CAAC;IACpC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,QAAA,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"SkySystem.d.ts","sourceRoot":"","sources":["../../src/components/SkySystem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8E,MAAM,OAAO,CAAC;AACnG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACpH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,KAAK,CAAC,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,sBAAsB,CAAC,EAAE,gBAAgB,CAAC;IAC1C,qBAAqB,CAAC,EAAE,WAAW,CAAC;IACpC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,QAAA,MAAM,SAAS,qFAyGb,CAAC;AAIH,eAAe,SAAS,CAAC"}
|
|
@@ -8,7 +8,7 @@ import Lensflare from './Lensflare.js';
|
|
|
8
8
|
import SunLight from './SunLight.js';
|
|
9
9
|
import SkyController from './SkyController.js';
|
|
10
10
|
import SceneFog from './SceneFog.js';
|
|
11
|
-
const SkySystem = forwardRef(({ timeSettings, visible = true, sunSystemVisible = false, sunSize = 1, moonSize = 1, skyboxScale =
|
|
11
|
+
const SkySystem = forwardRef(({ timeSettings, visible = true, sunSystemVisible = false, sunSize = 1, moonSize = 1, skyboxScale = 1000, sunIntensity = 1, castShadow = true, shadowMapSize = 2048, playerPosition = new THREE.Vector3(0, 0, 0), starsSettings, cloudsSettings, cloudsMaterialSettings, skyControllerSettings, rainSettings, fogSettings, onTimeOfDayChange, onTimeUpdate, }, ref) => {
|
|
12
12
|
const previousTimeOfDayRef = useRef(null);
|
|
13
13
|
useImperativeHandle(ref, () => ({
|
|
14
14
|
setTime: (h, m) => skySystemManager.setTime(h, m),
|
|
@@ -40,7 +40,7 @@ const SkySystem = forwardRef(({ timeSettings, visible = true, sunSystemVisible =
|
|
|
40
40
|
});
|
|
41
41
|
if (!visible)
|
|
42
42
|
return null;
|
|
43
|
-
return (_jsxs("group", { children: [skyControllerSettings && !sunSystemVisible && (_jsx(SkyController, { settings: skyControllerSettings, timeSettings: timeSettings })), sunSystemVisible && (_jsxs(_Fragment, { children: [_jsx(Skybox, { visible: true, scale: skyboxScale, sunSize: sunSize, moonSize: moonSize, timeSettings: timeSettings }), _jsx(Lensflare, { visible: true, intensity: sunIntensity, timeSettings: timeSettings }), _jsx(SunLight, { visible: true, timeSettings: timeSettings, targetPosition: playerPosition, intensity: sunIntensity, castShadow: castShadow, shadowMapSize: shadowMapSize })] })), fogSettings && (_jsx(SceneFog, { fog: fogSettings }))] }));
|
|
43
|
+
return (_jsxs("group", { children: [skyControllerSettings && !sunSystemVisible && (_jsx(SkyController, { settings: skyControllerSettings, timeSettings: timeSettings, scale: skyboxScale })), sunSystemVisible && (_jsxs(_Fragment, { children: [_jsx(Skybox, { visible: true, scale: skyboxScale, sunSize: sunSize, moonSize: moonSize, timeSettings: timeSettings }), _jsx(Lensflare, { visible: true, intensity: sunIntensity, timeSettings: timeSettings }), _jsx(SunLight, { visible: true, timeSettings: timeSettings, targetPosition: playerPosition, intensity: sunIntensity, castShadow: castShadow, shadowMapSize: shadowMapSize })] })), fogSettings && (_jsx(SceneFog, { fog: fogSettings }))] }));
|
|
44
44
|
});
|
|
45
45
|
SkySystem.displayName = 'SkySystem';
|
|
46
46
|
export default SkySystem;
|
|
@@ -86,7 +86,7 @@ const Skybox = ({ visible = true, scale = 100000, sunSize = 1, moonSize = 1, tim
|
|
|
86
86
|
});
|
|
87
87
|
if (!visible)
|
|
88
88
|
return null;
|
|
89
|
-
console.log(sunSize)
|
|
89
|
+
// console.log(sunSize)
|
|
90
90
|
return (_jsxs("mesh", { scale: scale, children: [_jsx("boxGeometry", { args: [1, 1, 1] }), _jsx("skyboxMaterial", { ref: materialRef, side: THREE.BackSide, depthWrite: false, fog: false })] }));
|
|
91
91
|
};
|
|
92
92
|
export default Skybox;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CreatedObjectSettings } from '@ntalmagor/3drize-core';
|
|
3
|
+
export interface SparklesBurstProps {
|
|
4
|
+
settings: CreatedObjectSettings;
|
|
5
|
+
}
|
|
6
|
+
declare const SparklesBurst: React.FC<SparklesBurstProps>;
|
|
7
|
+
export default SparklesBurst;
|
|
8
|
+
//# sourceMappingURL=SparklesBurst.d.ts.map
|
|
@@ -0,0 +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"}
|