@3driseai/3drise-viewer 0.1.2 → 0.1.4
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/AnimatedObject.d.ts +2 -1
- package/dist/components/AnimatedObject.d.ts.map +1 -1
- package/dist/components/AnimatedObject.js +11 -3
- package/dist/components/Bubbles.d.ts +2 -1
- package/dist/components/Bubbles.d.ts.map +1 -1
- package/dist/components/Bubbles.js +5 -2
- package/dist/components/CameraController.d.ts +9 -1
- package/dist/components/CameraController.d.ts.map +1 -1
- package/dist/components/CameraController.js +12 -1
- package/dist/components/Clouds.d.ts +2 -1
- package/dist/components/Clouds.d.ts.map +1 -1
- package/dist/components/Clouds.js +3 -4
- package/dist/components/CreatedObject.d.ts +2 -2
- package/dist/components/CreatedObject.d.ts.map +1 -1
- package/dist/components/CreatedObject.js +5 -10
- package/dist/components/CustomPrimitive.d.ts +2 -2
- package/dist/components/CustomPrimitive.d.ts.map +1 -1
- package/dist/components/CustomPrimitive.js +6 -2
- package/dist/components/Earth.d.ts +2 -4
- package/dist/components/Earth.d.ts.map +1 -1
- package/dist/components/Earth.js +6 -4
- package/dist/components/EffectsGenerator.d.ts +2 -1
- package/dist/components/EffectsGenerator.d.ts.map +1 -1
- package/dist/components/EffectsGenerator.js +26 -25
- package/dist/components/EffectsGroup.d.ts +2 -1
- package/dist/components/EffectsGroup.d.ts.map +1 -1
- package/dist/components/EffectsGroup.js +7 -2
- package/dist/components/EnvironmentManager.js +2 -2
- package/dist/components/EnvironmentObject.d.ts +2 -1
- package/dist/components/EnvironmentObject.d.ts.map +1 -1
- package/dist/components/EnvironmentObject.js +2 -2
- package/dist/components/Frame.d.ts +3 -2
- package/dist/components/Frame.d.ts.map +1 -1
- package/dist/components/Frame.js +3 -1
- package/dist/components/Galaxy.d.ts +2 -3
- package/dist/components/Galaxy.d.ts.map +1 -1
- package/dist/components/Galaxy.js +10 -10
- package/dist/components/GalleryLayout.d.ts +2 -1
- package/dist/components/GalleryLayout.d.ts.map +1 -1
- package/dist/components/GalleryLayout.js +3 -1
- package/dist/components/GeometryShape.d.ts +3 -2
- package/dist/components/GeometryShape.d.ts.map +1 -1
- package/dist/components/GeometryShape.js +17 -6
- package/dist/components/Glyphs.d.ts +2 -1
- package/dist/components/Glyphs.d.ts.map +1 -1
- package/dist/components/Glyphs.js +6 -2
- package/dist/components/GridHelper.d.ts +2 -1
- package/dist/components/GridHelper.d.ts.map +1 -1
- package/dist/components/GridHelper.js +3 -1
- package/dist/components/GridsGenerator.d.ts +2 -1
- package/dist/components/GridsGenerator.d.ts.map +1 -1
- package/dist/components/GridsGenerator.js +12 -4
- package/dist/components/HdrPlaylistRenderer.d.ts +2 -1
- package/dist/components/HdrPlaylistRenderer.d.ts.map +1 -1
- package/dist/components/HdrPlaylistRenderer.js +3 -1
- package/dist/components/Lensflare.d.ts +2 -1
- package/dist/components/Lensflare.d.ts.map +1 -1
- package/dist/components/Lensflare.js +3 -1
- package/dist/components/Letter.d.ts +3 -2
- package/dist/components/Letter.d.ts.map +1 -1
- package/dist/components/Letter.js +3 -1
- package/dist/components/Letters.d.ts +3 -2
- package/dist/components/Letters.d.ts.map +1 -1
- package/dist/components/Letters.js +3 -1
- package/dist/components/LightObject.d.ts +2 -1
- package/dist/components/LightObject.d.ts.map +1 -1
- package/dist/components/LightObject.js +11 -7
- package/dist/components/LightsManager.d.ts +2 -1
- package/dist/components/LightsManager.d.ts.map +1 -1
- package/dist/components/LightsManager.js +6 -3
- package/dist/components/Lines.d.ts +2 -1
- package/dist/components/Lines.d.ts.map +1 -1
- package/dist/components/Lines.js +2 -2
- package/dist/components/Moon.d.ts +2 -3
- package/dist/components/Moon.d.ts.map +1 -1
- package/dist/components/Moon.js +6 -4
- package/dist/components/MyGrid.d.ts +3 -2
- package/dist/components/MyGrid.d.ts.map +1 -1
- package/dist/components/MyGrid.js +5 -2
- package/dist/components/ObjectNode.d.ts +2 -2
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +30 -30
- package/dist/components/ObjectNodeApi.d.ts +2 -2
- package/dist/components/ObjectNodeApi.d.ts.map +1 -1
- package/dist/components/ObjectNodeApi.js +2 -2
- package/dist/components/ObjectsRenderer.d.ts +2 -1
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +15 -4
- package/dist/components/ObjectsRendererApi.d.ts +2 -1
- package/dist/components/ObjectsRendererApi.d.ts.map +1 -1
- package/dist/components/ObjectsRendererApi.js +2 -2
- package/dist/components/Ocean.d.ts +2 -1
- package/dist/components/Ocean.d.ts.map +1 -1
- package/dist/components/Ocean.js +3 -1
- package/dist/components/Outline.d.ts +3 -2
- package/dist/components/Outline.d.ts.map +1 -1
- package/dist/components/Outline.js +6 -2
- package/dist/components/ParticlesR3f.d.ts +2 -1
- package/dist/components/ParticlesR3f.d.ts.map +1 -1
- package/dist/components/ParticlesR3f.js +3 -1
- package/dist/components/Path.d.ts +2 -1
- package/dist/components/Path.d.ts.map +1 -1
- package/dist/components/Path.js +14 -3
- package/dist/components/PathGeometry.d.ts +2 -1
- package/dist/components/PathGeometry.d.ts.map +1 -1
- package/dist/components/PathGeometry.js +6 -2
- package/dist/components/PathRenderer.d.ts +2 -1
- package/dist/components/PathRenderer.d.ts.map +1 -1
- package/dist/components/PathRenderer.js +6 -2
- package/dist/components/Planet.d.ts +2 -3
- package/dist/components/Planet.d.ts.map +1 -1
- package/dist/components/Planet.js +6 -4
- package/dist/components/PointCloud.d.ts +2 -1
- package/dist/components/PointCloud.d.ts.map +1 -1
- package/dist/components/PointCloud.js +3 -1
- package/dist/components/ProjectLoader.d.ts +2 -1
- package/dist/components/ProjectLoader.d.ts.map +1 -1
- package/dist/components/ProjectLoader.js +6 -3
- package/dist/components/Rain.d.ts +2 -1
- package/dist/components/Rain.d.ts.map +1 -1
- package/dist/components/Rain.js +7 -1
- package/dist/components/SceneBuilder.d.ts +2 -1
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +2 -2
- package/dist/components/ShootingStar.d.ts +2 -1
- package/dist/components/ShootingStar.d.ts.map +1 -1
- package/dist/components/ShootingStar.js +5 -2
- package/dist/components/ShootingStars.d.ts +2 -1
- package/dist/components/ShootingStars.d.ts.map +1 -1
- package/dist/components/ShootingStars.js +2 -2
- package/dist/components/SkyController.d.ts +3 -2
- package/dist/components/SkyController.d.ts.map +1 -1
- package/dist/components/SkyController.js +9 -6
- package/dist/components/SkyMesh.d.ts +2 -3
- package/dist/components/SkyMesh.d.ts.map +1 -1
- package/dist/components/SkyMesh.js +3 -5
- package/dist/components/SkySystem.d.ts +2 -1
- package/dist/components/SkySystem.d.ts.map +1 -1
- package/dist/components/SkySystem.js +6 -2
- package/dist/components/Skybox.d.ts +2 -1
- package/dist/components/Skybox.d.ts.map +1 -1
- package/dist/components/Skybox.js +5 -2
- package/dist/components/SolarSystem.d.ts +2 -4
- package/dist/components/SolarSystem.d.ts.map +1 -1
- package/dist/components/SolarSystem.js +3 -1
- package/dist/components/SparklesBurst.d.ts +2 -1
- package/dist/components/SparklesBurst.d.ts.map +1 -1
- package/dist/components/SparklesBurst.js +5 -2
- package/dist/components/Stars.d.ts +2 -3
- package/dist/components/Stars.d.ts.map +1 -1
- package/dist/components/Stars.js +3 -2
- package/dist/components/Sun.d.ts +3 -2
- package/dist/components/Sun.d.ts.map +1 -1
- package/dist/components/Sun.js +7 -3
- package/dist/components/SunCore.d.ts +3 -2
- package/dist/components/SunCore.d.ts.map +1 -1
- package/dist/components/SunCore.js +3 -1
- package/dist/components/SunLight.d.ts +2 -1
- package/dist/components/SunLight.d.ts.map +1 -1
- package/dist/components/SunLight.js +3 -1
- package/dist/components/Text2D.d.ts +2 -1
- package/dist/components/Text2D.d.ts.map +1 -1
- package/dist/components/Text2D.js +3 -1
- package/dist/components/Text3D.d.ts +2 -1
- package/dist/components/Text3D.d.ts.map +1 -1
- package/dist/components/Text3D.js +2 -2
- package/dist/components/VolumePoints.d.ts +3 -2
- package/dist/components/VolumePoints.d.ts.map +1 -1
- package/dist/components/VolumePoints.js +6 -2
- package/dist/components/cursor/AuraCursor.d.ts.map +1 -1
- package/dist/components/cursor/AuraCursor.js +3 -1
- package/dist/components/cursor/AuroraCursor.d.ts.map +1 -1
- package/dist/components/cursor/AuroraCursor.js +5 -2
- package/dist/components/cursor/BubblesCursor.d.ts.map +1 -1
- package/dist/components/cursor/BubblesCursor.js +5 -2
- package/dist/components/cursor/CometCursor.d.ts.map +1 -1
- package/dist/components/cursor/CometCursor.js +6 -3
- package/dist/components/cursor/CrosshairCursor.d.ts.map +1 -1
- package/dist/components/cursor/CrosshairCursor.js +6 -3
- package/dist/components/cursor/CursorActions.d.ts +2 -1
- package/dist/components/cursor/CursorActions.d.ts.map +1 -1
- package/dist/components/cursor/CursorActions.js +12 -10
- package/dist/components/cursor/CursorController.d.ts +4 -1
- package/dist/components/cursor/CursorController.d.ts.map +1 -1
- package/dist/components/cursor/CursorController.js +1 -1
- package/dist/components/cursor/CursorEffects.d.ts +4 -2
- package/dist/components/cursor/CursorEffects.d.ts.map +1 -1
- package/dist/components/cursor/CursorEffects.js +6 -2
- package/dist/components/cursor/FerrofluidCursor.d.ts.map +1 -1
- package/dist/components/cursor/FerrofluidCursor.js +3 -1
- package/dist/components/cursor/GlyphRingCursor.d.ts.map +1 -1
- package/dist/components/cursor/GlyphRingCursor.js +3 -1
- package/dist/components/cursor/LightningCursor.d.ts.map +1 -1
- package/dist/components/cursor/LightningCursor.js +3 -1
- package/dist/components/cursor/LiquidMetalCursor.d.ts.map +1 -1
- package/dist/components/cursor/LiquidMetalCursor.js +3 -1
- package/dist/components/cursor/OrbCursor.d.ts.map +1 -1
- package/dist/components/cursor/OrbCursor.js +3 -1
- package/dist/components/cursor/PlasmaWhipCursor.d.ts.map +1 -1
- package/dist/components/cursor/PlasmaWhipCursor.js +3 -1
- package/dist/components/cursor/SparklesCursor.d.ts.map +1 -1
- package/dist/components/cursor/SparklesCursor.js +5 -2
- package/dist/components/cursor/TeslaCursor.d.ts.map +1 -1
- package/dist/components/cursor/TeslaCursor.js +6 -9
- package/dist/components/cursor/clickActions/BoltFlashAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/BoltFlashAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/BoltFlashAction.js +5 -2
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.js +3 -1
- package/dist/components/cursor/clickActions/ImplosionAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/ImplosionAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/ImplosionAction.js +3 -1
- package/dist/components/cursor/clickActions/PhaseShiftAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/PhaseShiftAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/PhaseShiftAction.js +5 -2
- package/dist/components/cursor/clickActions/PlasmaBombAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/PlasmaBombAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/PlasmaBombAction.js +5 -2
- package/dist/components/cursor/clickActions/RealityTearAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/RealityTearAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/RealityTearAction.js +3 -1
- package/dist/components/cursor/clickActions/ShockwaveAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/ShockwaveAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/ShockwaveAction.js +5 -2
- package/dist/components/cursor/clickActions/SparklesBurstAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/SparklesBurstAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/SparklesBurstAction.js +3 -1
- package/dist/components/cursor/clickActions/VoronoiFractureAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/VoronoiFractureAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/VoronoiFractureAction.js +3 -1
- package/dist/components/cursor/clickActions/index.d.ts +11 -0
- package/dist/components/cursor/clickActions/index.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/index.js +10 -0
- package/dist/components/cursor/index.d.ts +21 -0
- package/dist/components/cursor/index.d.ts.map +1 -0
- package/dist/components/cursor/index.js +19 -0
- package/dist/components/effects/AuraEffect.d.ts +2 -1
- package/dist/components/effects/AuraEffect.d.ts.map +1 -1
- package/dist/components/effects/AuraEffect.js +5 -2
- package/dist/components/effects/AuroraEffect.d.ts +2 -1
- package/dist/components/effects/AuroraEffect.d.ts.map +1 -1
- package/dist/components/effects/AuroraEffect.js +3 -1
- package/dist/components/effects/BlackHoleEffect.d.ts +2 -1
- package/dist/components/effects/BlackHoleEffect.d.ts.map +1 -1
- package/dist/components/effects/BlackHoleEffect.js +3 -1
- package/dist/components/effects/ConstellationEffect.d.ts +2 -1
- package/dist/components/effects/ConstellationEffect.d.ts.map +1 -1
- package/dist/components/effects/ConstellationEffect.js +3 -1
- package/dist/components/effects/Corona.d.ts +19 -0
- package/dist/components/effects/Corona.d.ts.map +1 -0
- package/dist/components/effects/Corona.js +15 -0
- package/dist/components/effects/DataStreamEffect.d.ts +2 -1
- package/dist/components/effects/DataStreamEffect.d.ts.map +1 -1
- package/dist/components/effects/DataStreamEffect.js +5 -2
- package/dist/components/effects/DnaHelixEffect.d.ts +2 -1
- package/dist/components/effects/DnaHelixEffect.d.ts.map +1 -1
- package/dist/components/effects/DnaHelixEffect.js +3 -1
- package/dist/components/effects/Fire.d.ts +3 -2
- package/dist/components/effects/Fire.d.ts.map +1 -1
- package/dist/components/effects/Fire.js +3 -1
- package/dist/components/effects/FireEffect.d.ts +2 -1
- package/dist/components/effects/FireEffect.d.ts.map +1 -1
- package/dist/components/effects/FireEffect.js +5 -2
- package/dist/components/effects/Flares.d.ts +25 -0
- package/dist/components/effects/Flares.d.ts.map +1 -0
- package/dist/components/effects/Flares.js +136 -0
- package/dist/components/effects/ForcefieldEffect.d.ts +2 -1
- package/dist/components/effects/ForcefieldEffect.d.ts.map +1 -1
- package/dist/components/effects/ForcefieldEffect.js +3 -1
- package/dist/components/effects/HologramEffect.d.ts +2 -1
- package/dist/components/effects/HologramEffect.d.ts.map +1 -1
- package/dist/components/effects/HologramEffect.js +5 -2
- package/dist/components/effects/IceCrystalsEffect.d.ts +2 -1
- package/dist/components/effects/IceCrystalsEffect.d.ts.map +1 -1
- package/dist/components/effects/IceCrystalsEffect.js +3 -1
- package/dist/components/effects/LightningEffect.d.ts +2 -1
- package/dist/components/effects/LightningEffect.d.ts.map +1 -1
- package/dist/components/effects/LightningEffect.js +5 -2
- package/dist/components/effects/MoleculesEffect.d.ts +2 -1
- package/dist/components/effects/MoleculesEffect.d.ts.map +1 -1
- package/dist/components/effects/MoleculesEffect.js +5 -2
- package/dist/components/effects/NeuralNetworkEffect.d.ts +2 -1
- package/dist/components/effects/NeuralNetworkEffect.d.ts.map +1 -1
- package/dist/components/effects/NeuralNetworkEffect.js +3 -1
- package/dist/components/effects/OrbEffect.d.ts +2 -1
- package/dist/components/effects/OrbEffect.d.ts.map +1 -1
- package/dist/components/effects/OrbEffect.js +5 -2
- package/dist/components/effects/PortalEffect.d.ts +2 -1
- package/dist/components/effects/PortalEffect.d.ts.map +1 -1
- package/dist/components/effects/PortalEffect.js +5 -2
- package/dist/components/effects/ShockwaveEffect.d.ts +2 -1
- package/dist/components/effects/ShockwaveEffect.d.ts.map +1 -1
- package/dist/components/effects/ShockwaveEffect.js +5 -2
- package/dist/components/effects/SmokePlumeEffect.d.ts +2 -1
- package/dist/components/effects/SmokePlumeEffect.d.ts.map +1 -1
- package/dist/components/effects/SmokePlumeEffect.js +5 -2
- package/dist/components/effects/SmokeRibbon.d.ts +3 -2
- package/dist/components/effects/SmokeRibbon.d.ts.map +1 -1
- package/dist/components/effects/SmokeRibbon.js +5 -2
- package/dist/components/effects/SmokeRingEffect.d.ts +2 -1
- package/dist/components/effects/SmokeRingEffect.d.ts.map +1 -1
- package/dist/components/effects/SmokeRingEffect.js +5 -2
- package/dist/components/effects/VolumetricFogEffect.d.ts +2 -1
- package/dist/components/effects/VolumetricFogEffect.d.ts.map +1 -1
- package/dist/components/effects/VolumetricFogEffect.js +5 -2
- package/dist/components/effects/index.d.ts +28 -0
- package/dist/components/effects/index.d.ts.map +1 -0
- package/dist/components/effects/index.js +24 -0
- package/dist/components/index.d.ts +112 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +77 -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/index.d.ts +55 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +46 -1
- package/dist/hooks/useObjectReady.d.ts +29 -0
- package/dist/hooks/useObjectReady.d.ts.map +1 -0
- package/dist/hooks/useObjectReady.js +59 -0
- package/dist/index.d.ts +4 -135
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -108
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/objectReady.d.ts +24 -0
- package/dist/types/objectReady.d.ts.map +1 -0
- package/dist/types/objectReady.js +1 -0
- package/package.json +3 -3
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
4
|
import { useMemo } from 'react';
|
|
3
5
|
import * as THREE from 'three';
|
|
4
6
|
import { Line } from '@react-three/drei';
|
|
5
7
|
import { smoothPathCorners, createPathSpline } from '@3driseai/3drise-core';
|
|
6
|
-
const PathGeometry = ({ points, curve, smoothCorners = 0, geometry, }) => {
|
|
8
|
+
const PathGeometry = ({ points, curve, smoothCorners = 0, geometry, onObjectReady, onObjectDispose, }) => {
|
|
9
|
+
const rootRef = useRef(null);
|
|
10
|
+
useObjectReady(rootRef, geometry, onObjectReady, onObjectDispose);
|
|
7
11
|
const { type, width = 2, radius = 0.5, segments = 8, numLanes = 0, color = '#555555', dividerColor = '#ffffff' } = geometry;
|
|
8
12
|
const smoothedPoints = useMemo(() => smoothPathCorners(points, smoothCorners), [points, smoothCorners]);
|
|
9
13
|
const spline = useMemo(() => {
|
|
@@ -104,6 +108,6 @@ const PathGeometry = ({ points, curve, smoothCorners = 0, geometry, }) => {
|
|
|
104
108
|
}, [spline, type, width, numLanes, points.length]);
|
|
105
109
|
if (!spline || type === 'none')
|
|
106
110
|
return null;
|
|
107
|
-
return (_jsxs("group", { children: [type === 'tube' && tubeGeometry && (_jsx("mesh", { geometry: tubeGeometry, children: _jsx("meshStandardMaterial", { color: color, side: THREE.DoubleSide }) })), type === 'road' && roadGeometry && (_jsx("mesh", { geometry: roadGeometry, children: _jsx("meshStandardMaterial", { color: color, side: THREE.DoubleSide }) })), type === 'road' && laneDividerLines?.map((line, index) => (_jsx(Line, { points: line, color: dividerColor, lineWidth: 2, dashed: index !== 0, dashSize: 0.5, gapSize: 0.3, raycast: () => null }, `lane-${index}`))), type === 'walls' && wallsGeometry && (_jsx("mesh", { geometry: wallsGeometry, children: _jsx("meshStandardMaterial", { color: color, side: THREE.DoubleSide }) }))] }));
|
|
111
|
+
return (_jsxs("group", { ref: rootRef, children: [type === 'tube' && tubeGeometry && (_jsx("mesh", { geometry: tubeGeometry, children: _jsx("meshStandardMaterial", { color: color, side: THREE.DoubleSide }) })), type === 'road' && roadGeometry && (_jsx("mesh", { geometry: roadGeometry, children: _jsx("meshStandardMaterial", { color: color, side: THREE.DoubleSide }) })), type === 'road' && laneDividerLines?.map((line, index) => (_jsx(Line, { points: line, color: dividerColor, lineWidth: 2, dashed: index !== 0, dashSize: 0.5, gapSize: 0.3, raycast: () => null }, `lane-${index}`))), type === 'walls' && wallsGeometry && (_jsx("mesh", { geometry: wallsGeometry, children: _jsx("meshStandardMaterial", { color: color, side: THREE.DoubleSide }) }))] }));
|
|
108
112
|
};
|
|
109
113
|
export default PathGeometry;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import type { PathConfig } from '@3driseai/3drise-core';
|
|
2
3
|
import React from "react";
|
|
3
|
-
export interface PathRendererProps {
|
|
4
|
+
export interface PathRendererProps extends ObjectReadyProps {
|
|
4
5
|
pathSettings: PathConfig;
|
|
5
6
|
color?: string;
|
|
6
7
|
showPoints?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathRenderer.d.ts","sourceRoot":"","sources":["../../src/components/PathRenderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PathRenderer.d.ts","sourceRoot":"","sources":["../../src/components/PathRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACvD,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;CACvB;AAGD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA+B7C,CAAC;AACF,eAAe,YAAY,CAAC"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
4
|
import { useMemo } from 'react';
|
|
3
5
|
import { Sphere, Line } from '@react-three/drei';
|
|
4
6
|
import { smoothPathCorners, createPathSpline, sampleSplinePoints } from '@3driseai/3drise-core';
|
|
5
7
|
import PathGeometry from './PathGeometry.js';
|
|
6
|
-
const PathRenderer = ({ pathSettings, color = '#ffa500', showPoints = true, showLine = true, showCurve = true, }) => {
|
|
8
|
+
const PathRenderer = ({ pathSettings, color = '#ffa500', showPoints = true, showLine = true, showCurve = true, onObjectReady, onObjectDispose, }) => {
|
|
9
|
+
const rootRef = useRef(null);
|
|
10
|
+
useObjectReady(rootRef, pathSettings, onObjectReady, onObjectDispose);
|
|
7
11
|
console.log("Rendering Path with settings:", pathSettings);
|
|
8
12
|
const pointSize = pathSettings.pointSize ?? 0.1;
|
|
9
13
|
const lineWidth = pathSettings.lineWidth ?? 2;
|
|
@@ -31,6 +35,6 @@ const PathRenderer = ({ pathSettings, color = '#ffa500', showPoints = true, show
|
|
|
31
35
|
}, [points, smoothedPoints, curve, smoothCorners, showCurve, hasCurve, hasSmoothCorners]);
|
|
32
36
|
if (points.length === 0)
|
|
33
37
|
return null;
|
|
34
|
-
return (_jsxs("group", { children: [showPoints && points.map((point, index) => (_jsxs("group", { position: point, children: [_jsx(Sphere, { args: [pointSize, 16, 16], children: _jsx("meshStandardMaterial", { color: color, emissive: color, emissiveIntensity: 0.5, toneMapped: false }) }), _jsx(Sphere, { args: [pointSize * 0.33, 8, 8], position: [0, pointSize * 1.67, 0], children: _jsx("meshBasicMaterial", { color: "#ffffff" }) })] }, `path-point-${index}`))), showLine && points.length > 1 && !hasCurve && !hasSmoothCorners && (_jsx(Line, { points: points, color: color, lineWidth: lineWidth, raycast: () => null })), showCurve && curvePoints && curvePoints.length > 1 && (_jsx(Line, { points: curvePoints, color: color, lineWidth: lineWidth, raycast: () => null })), showLine && showCurve && (hasCurve || hasSmoothCorners) && points.length > 1 && (_jsx(Line, { points: points, color: color, lineWidth: 1, dashed: true, dashSize: 0.1, gapSize: 0.1, raycast: () => null })), geometry && geometry.type !== 'none' && points.length >= 2 && (_jsx(PathGeometry, { points: points, curve: curve, smoothCorners: smoothCorners, geometry: geometry }))] }));
|
|
38
|
+
return (_jsxs("group", { ref: rootRef, children: [showPoints && points.map((point, index) => (_jsxs("group", { position: point, children: [_jsx(Sphere, { args: [pointSize, 16, 16], children: _jsx("meshStandardMaterial", { color: color, emissive: color, emissiveIntensity: 0.5, toneMapped: false }) }), _jsx(Sphere, { args: [pointSize * 0.33, 8, 8], position: [0, pointSize * 1.67, 0], children: _jsx("meshBasicMaterial", { color: "#ffffff" }) })] }, `path-point-${index}`))), showLine && points.length > 1 && !hasCurve && !hasSmoothCorners && (_jsx(Line, { points: points, color: color, lineWidth: lineWidth, raycast: () => null })), showCurve && curvePoints && curvePoints.length > 1 && (_jsx(Line, { points: curvePoints, color: color, lineWidth: lineWidth, raycast: () => null })), showLine && showCurve && (hasCurve || hasSmoothCorners) && points.length > 1 && (_jsx(Line, { points: points, color: color, lineWidth: 1, dashed: true, dashSize: 0.1, gapSize: 0.1, raycast: () => null })), geometry && geometry.type !== 'none' && points.length >= 2 && (_jsx(PathGeometry, { points: points, curve: curve, smoothCorners: smoothCorners, geometry: geometry }))] }));
|
|
35
39
|
};
|
|
36
40
|
export default PathRenderer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
2
2
|
import React from "react";
|
|
3
3
|
export type PlanetType = 'moon' | 'sun' | 'mercury' | 'venus' | 'mars' | 'jupiter' | 'saturn' | 'uranus' | 'neptune';
|
|
4
|
-
export interface PlanetProps {
|
|
4
|
+
export interface PlanetProps extends ObjectReadyProps {
|
|
5
5
|
type?: PlanetType;
|
|
6
6
|
position?: [number, number, number];
|
|
7
7
|
scale?: number;
|
|
@@ -9,7 +9,6 @@ export interface PlanetProps {
|
|
|
9
9
|
visible?: boolean;
|
|
10
10
|
emissiveIntensity?: number;
|
|
11
11
|
shininess?: number;
|
|
12
|
-
onMeshReady?: (mesh: Mesh) => void;
|
|
13
12
|
}
|
|
14
13
|
declare const Planet: React.FC<PlanetProps>;
|
|
15
14
|
export default Planet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Planet.d.ts","sourceRoot":"","sources":["../../src/components/Planet.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Planet.d.ts","sourceRoot":"","sources":["../../src/components/Planet.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErH,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACjD,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AA0CD,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAejC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
3
|
import { useRef, useEffect, useMemo, useCallback } from 'react';
|
|
3
4
|
import { RingGeometry, DoubleSide, Vector3, SRGBColorSpace, } from 'three';
|
|
4
5
|
import { useTexture } from '@react-three/drei';
|
|
@@ -41,8 +42,10 @@ const SaturnRing = () => {
|
|
|
41
42
|
const ringGeometry = useMemo(() => createRingGeometry(RING_INNER, RING_OUTER), []);
|
|
42
43
|
return (_jsx("mesh", { geometry: ringGeometry, rotation: [-Math.PI / 2, 0, 0], children: _jsx("meshBasicMaterial", { map: ringTexture, alphaMap: ringTexture, transparent: true, side: DoubleSide, depthWrite: false }) }));
|
|
43
44
|
};
|
|
44
|
-
const Planet = ({ type = 'moon', position = [0, 0, 0], scale = 5, rotation = [0, 0, 0], visible = true, emissiveIntensity = 0, shininess = 30,
|
|
45
|
+
const Planet = ({ type = 'moon', position = [0, 0, 0], scale = 5, rotation = [0, 0, 0], visible = true, emissiveIntensity = 0, shininess = 30, onObjectReady, onObjectDispose, }) => {
|
|
45
46
|
const meshRef = useRef(null);
|
|
47
|
+
const rootRef = useRef(null);
|
|
48
|
+
useObjectReady(rootRef, { type, position, rotation, scale, visible, emissiveIntensity, shininess }, onObjectReady, onObjectDispose);
|
|
46
49
|
const texture = useTexture(PLANET_TEXTURES[type]);
|
|
47
50
|
useEffect(() => {
|
|
48
51
|
texture.colorSpace = SRGBColorSpace;
|
|
@@ -51,10 +54,9 @@ const Planet = ({ type = 'moon', position = [0, 0, 0], scale = 5, rotation = [0,
|
|
|
51
54
|
const handleMeshRef = useCallback((mesh) => {
|
|
52
55
|
if (mesh) {
|
|
53
56
|
meshRef.current = mesh;
|
|
54
|
-
onMeshReady?.(mesh);
|
|
55
57
|
}
|
|
56
|
-
}, [
|
|
57
|
-
return (_jsxs("group", { userData: { id: `3drise-planet-${type}` }, position: position, rotation: rotation, scale: scale, visible: visible, children: [_jsxs("mesh", { ref: handleMeshRef, children: [_jsx("sphereGeometry", { args: [1, 64, 64] }), _jsx("meshPhongMaterial", { map: texture, color: '#ffffff', emissive: '#ffffff', emissiveMap: texture, emissiveIntensity: emissiveIntensity, shininess: shininess })] }), type === 'saturn' && _jsx(SaturnRing, {})] }));
|
|
58
|
+
}, []);
|
|
59
|
+
return (_jsxs("group", { ref: rootRef, userData: { id: `3drise-planet-${type}` }, position: position, rotation: rotation, scale: scale, visible: visible, children: [_jsxs("mesh", { ref: handleMeshRef, children: [_jsx("sphereGeometry", { args: [1, 64, 64] }), _jsx("meshPhongMaterial", { map: texture, color: '#ffffff', emissive: '#ffffff', emissiveMap: texture, emissiveIntensity: emissiveIntensity, shininess: shininess })] }), type === 'saturn' && _jsx(SaturnRing, {})] }));
|
|
58
60
|
};
|
|
59
61
|
Planet.displayName = 'Planet';
|
|
60
62
|
export default Planet;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import type { MaterialSettings, ObjectAnimations } from '@3driseai/3drise-core';
|
|
2
3
|
import React from "react";
|
|
3
|
-
interface PointCloudProps {
|
|
4
|
+
interface PointCloudProps extends ObjectReadyProps {
|
|
4
5
|
positions: Float32Array;
|
|
5
6
|
materialSettings: MaterialSettings;
|
|
6
7
|
animations?: ObjectAnimations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointCloud.d.ts","sourceRoot":"","sources":["../../src/components/PointCloud.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PointCloud.d.ts","sourceRoot":"","sources":["../../src/components/PointCloud.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAM7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,UAAU,eAAgB,SAAQ,gBAAgB;IAC9C,SAAS,EAAE,YAAY,CAAC;IACxB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,UAAU,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAyBD,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmFzC,CAAC;AACF,eAAe,UAAU,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
3
|
import { useEffect, useMemo, useRef } from 'react';
|
|
3
4
|
import { useFrame } from '@react-three/fiber';
|
|
4
5
|
import { useParticlesColors } from '../hooks/useParticlesColors.js';
|
|
@@ -27,9 +28,10 @@ function generateUVsFromPositions(positions) {
|
|
|
27
28
|
}
|
|
28
29
|
return uvs;
|
|
29
30
|
}
|
|
30
|
-
const PointCloud = ({ positions, materialSettings, animations, }) => {
|
|
31
|
+
const PointCloud = ({ positions, materialSettings, animations, onObjectReady, onObjectDispose, }) => {
|
|
31
32
|
const materialRef = useRef(null);
|
|
32
33
|
const pointsRef = useRef(null);
|
|
34
|
+
useObjectReady(pointsRef, materialSettings, onObjectReady, onObjectDispose);
|
|
33
35
|
const color = materialSettings && 'color' in materialSettings
|
|
34
36
|
? materialSettings.color
|
|
35
37
|
: '#ffffff';
|
|
@@ -2,7 +2,8 @@ import type { CreatedObjectSettings, HtmlElement } from '@3driseai/3drise-core';
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Object3D } from "three";
|
|
4
4
|
import { type ThreeEvent } from "@react-three/fiber";
|
|
5
|
-
type
|
|
5
|
+
import type { ObjectReadyProps } from "../types/objectReady";
|
|
6
|
+
type ProjectProps = ObjectReadyProps & {
|
|
6
7
|
projectId: string;
|
|
7
8
|
loadingIndicator?: React.ReactNode;
|
|
8
9
|
onObjectClick?: (object: CreatedObjectSettings, ref: Object3D, event: ThreeEvent<MouseEvent>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectLoader.d.ts","sourceRoot":"","sources":["../../src/components/ProjectLoader.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,KAAK,YAAY,GAAG;
|
|
1
|
+
{"version":3,"file":"ProjectLoader.d.ts","sourceRoot":"","sources":["../../src/components/ProjectLoader.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,KAAK,YAAY,GAAG,gBAAgB,GAAG;IACnC,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;AAIF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA+EzC,CAAC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { loadAssets, } from "@3driseai/3drise-core";
|
|
|
6
6
|
import LoadingIndicator from "./LoadingIndicator.js";
|
|
7
7
|
import { useMeshController } from "../hooks/useMeshController.js";
|
|
8
8
|
const PROJECT_LOADER_DEBUG_PREFIX = '[ProjectLoaderDebug]';
|
|
9
|
-
const ProjectLoader = ({ projectId, onObjectClick, onObjectHover, onElementClick, onElementHover, onSceneInitialized, loadingIndicator = _jsx(LoadingIndicator, { text: "Loading project...", fullScreen: true, animate: true }) }) => {
|
|
9
|
+
const ProjectLoader = ({ projectId, onObjectClick, onObjectHover, onElementClick, onElementHover, onSceneInitialized, onObjectReady, onObjectDispose, loadingIndicator = _jsx(LoadingIndicator, { text: "Loading project...", fullScreen: true, animate: true }) }) => {
|
|
10
10
|
const [project, setProject] = useState(null);
|
|
11
11
|
const meshController = useMeshController();
|
|
12
12
|
useEffect(() => {
|
|
@@ -61,7 +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
|
-
meshController.createObjects(meshObjects);
|
|
64
|
+
// meshController.createObjects(meshObjects);
|
|
65
65
|
console.log("PROJECT LOAD COMPLETE");
|
|
66
66
|
setProject(responseData);
|
|
67
67
|
}
|
|
@@ -80,6 +80,9 @@ const ProjectLoader = ({ projectId, onObjectClick, onObjectHover, onElementClick
|
|
|
80
80
|
flexDirection: 'column', gap: '1rem'
|
|
81
81
|
}, children: loadingIndicator });
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
console.log(PROJECT_LOADER_DEBUG_PREFIX, 'Rendering SceneBuilder with project', {
|
|
84
|
+
project
|
|
85
|
+
});
|
|
86
|
+
return _jsx(_Fragment, { children: _jsx(SceneBuilder, { project: project, onSceneInitialized: onSceneInitialized, onUiElementClick: onElementClick, onUiElementHover: onElementHover, onObjectClick: onObjectClick, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }) });
|
|
84
87
|
};
|
|
85
88
|
export default ProjectLoader;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import type { CreatedObjectSettings } from '@3driseai/3drise-core';
|
|
2
3
|
import React from "react";
|
|
3
|
-
export interface RainProps {
|
|
4
|
+
export interface RainProps extends ObjectReadyProps {
|
|
4
5
|
settings: CreatedObjectSettings;
|
|
5
6
|
}
|
|
6
7
|
declare const Rain: React.FC<RainProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rain.d.ts","sourceRoot":"","sources":["../../src/components/Rain.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Rain.d.ts","sourceRoot":"","sources":["../../src/components/Rain.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAM7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IAC/C,QAAQ,EAAE,qBAAqB,CAAC;CACnC;AA+ED,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAqL7B,CAAC;AACF,eAAe,IAAI,CAAC"}
|
package/dist/components/Rain.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useObjectReadyReporter } from '../hooks/useObjectReady.js';
|
|
1
2
|
import { useEffect, useRef, useMemo } from 'react';
|
|
2
3
|
import * as THREE from 'three';
|
|
3
4
|
import { useThree, useFrame } from '@react-three/fiber';
|
|
@@ -79,8 +80,9 @@ function applyRainOverridesToUniforms(material, overrides) {
|
|
|
79
80
|
// =============================================================================
|
|
80
81
|
// MAIN COMPONENT
|
|
81
82
|
// =============================================================================
|
|
82
|
-
const Rain = ({ settings }) => {
|
|
83
|
+
const Rain = ({ settings, onObjectReady, onObjectDispose }) => {
|
|
83
84
|
const { scene } = useThree();
|
|
85
|
+
const { report, reportDisposed } = useObjectReadyReporter(settings, onObjectReady, onObjectDispose);
|
|
84
86
|
const materialRef = useRef(null);
|
|
85
87
|
const geometryRef = useRef(null);
|
|
86
88
|
const pointsRef = useRef(null);
|
|
@@ -136,11 +138,15 @@ const Rain = ({ settings }) => {
|
|
|
136
138
|
velocitiesRef.current = velocities;
|
|
137
139
|
if (meshSettings.visible)
|
|
138
140
|
scene.add(points);
|
|
141
|
+
// Reported whether or not it is currently in the scene — the parent gets
|
|
142
|
+
// the object; visibility is a separate concern handled below.
|
|
143
|
+
report(points);
|
|
139
144
|
return () => {
|
|
140
145
|
if (pointsRef.current)
|
|
141
146
|
scene.remove(pointsRef.current);
|
|
142
147
|
geometry.dispose();
|
|
143
148
|
material.dispose();
|
|
149
|
+
reportDisposed(points);
|
|
144
150
|
};
|
|
145
151
|
}, [particleCount, areaSize]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
146
152
|
useEffect(() => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SceneBuilderProps } from '@3driseai/3drise-core';
|
|
2
2
|
import React from "react";
|
|
3
|
-
|
|
3
|
+
import type { ObjectReadyProps } from "../types/objectReady";
|
|
4
|
+
declare const SceneBuilder: React.FC<SceneBuilderProps & ObjectReadyProps>;
|
|
4
5
|
export default SceneBuilder;
|
|
5
6
|
//# sourceMappingURL=SceneBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneBuilder.d.ts","sourceRoot":"","sources":["../../src/components/SceneBuilder.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAQ/D,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SceneBuilder.d.ts","sourceRoot":"","sources":["../../src/components/SceneBuilder.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAQ/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,GAAG,gBAAgB,CAgIhE,CAAC;AACF,eAAe,YAAY,CAAC"}
|
|
@@ -9,7 +9,7 @@ import CameraController from "./CameraController.js";
|
|
|
9
9
|
import ObjectsRenderer from "./ObjectsRenderer.js";
|
|
10
10
|
import CursorController from "./cursor/CursorController.js";
|
|
11
11
|
import { Physics } from "@react-three/rapier";
|
|
12
|
-
const SceneBuilder = ({ project, width = "100%", height = "100vh", style = {}, className = "", onSceneInitialized, onUiElementClick, onObjectClick, }) => {
|
|
12
|
+
const SceneBuilder = ({ project, width = "100%", height = "100vh", style = {}, className = "", onSceneInitialized, onUiElementClick, onObjectClick, onObjectReady, onObjectDispose, }) => {
|
|
13
13
|
const sceneSettings = (project.sceneSettingsData || {});
|
|
14
14
|
// const meshController = useMeshController();
|
|
15
15
|
const [isThreeJsMounted, setIsThreeJsMounted] = useState(false);
|
|
@@ -128,6 +128,6 @@ const SceneBuilder = ({ project, width = "100%", height = "100vh", style = {}, c
|
|
|
128
128
|
if (onSceneInitialized) {
|
|
129
129
|
onSceneInitialized();
|
|
130
130
|
}
|
|
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
|
+
}, children: _jsxs(Physics, { gravity: physicsSettings.gravity, paused: !physicsSettings.enabled, debug: physicsSettings.debug, children: [_jsx(LightsManager, { config: lighting[0], onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }), environment && _jsx(EnvironmentManager, { environment: environment, timeSettings: timeSettings, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }), _jsx(CameraController, { settings: camera, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }), _jsx(ObjectsRenderer, { cameraSettings: camera, generalObjectSettings: generalObjectSettings, createdObjects: sceneObjects, onObjectsReady: undefined, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, sequences: animationSequences, handleObjectClick: onObjectClick ? (object, ref, event) => onObjectClick(object, ref, event) : undefined }), _jsx(CursorController, { effects: project.cursor?.effects, clickActions: project.cursor?.clickActions, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })] }) }) }));
|
|
132
132
|
};
|
|
133
133
|
export default SceneBuilder;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import React from "react";
|
|
2
|
-
export interface ShootingStarProps {
|
|
3
|
+
export interface ShootingStarProps extends ObjectReadyProps {
|
|
3
4
|
position?: [number, number, number];
|
|
4
5
|
direction?: [number, number, number];
|
|
5
6
|
speed?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShootingStar.d.ts","sourceRoot":"","sources":["../../src/components/ShootingStar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ShootingStar.d.ts","sourceRoot":"","sources":["../../src/components/ShootingStar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACvD,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAGD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAuF7C,CAAC;AACF,eAAe,YAAY,CAAC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
3
|
import { useRef, useMemo, useEffect } from 'react';
|
|
3
4
|
import { useFrame } from '@react-three/fiber';
|
|
4
5
|
import { Vector3, BufferGeometry, BufferAttribute, AdditiveBlending, Color } from 'three';
|
|
5
6
|
import { ShootingStarMaterial } from '@3driseai/3drise-core';
|
|
6
|
-
const ShootingStar = ({ position = [0, 0, 0], direction = [1, -1, 0], speed = 0.05, color = '#ffffff', trailLength = 30, size = 0.1, opacity = 1.0, onComplete, maxDistance = 50, followMouse = true, }) => {
|
|
7
|
+
const ShootingStar = ({ position = [0, 0, 0], direction = [1, -1, 0], speed = 0.05, color = '#ffffff', trailLength = 30, size = 0.1, opacity = 1.0, onComplete, maxDistance = 50, followMouse = true, onObjectReady, onObjectDispose, }) => {
|
|
7
8
|
const starRef = useRef(null);
|
|
9
|
+
const rootRef = useRef(null);
|
|
10
|
+
useObjectReady(rootRef, { position, direction, speed, color, size, opacity, maxDistance, followMouse }, onObjectReady, onObjectDispose);
|
|
8
11
|
const glowRef = useRef(null);
|
|
9
12
|
const trailRef = useRef(null);
|
|
10
13
|
const materialRef = useRef(null);
|
|
@@ -87,6 +90,6 @@ const ShootingStar = ({ position = [0, 0, 0], direction = [1, -1, 0], speed = 0.
|
|
|
87
90
|
if (distanceTraveled.current > maxDistance)
|
|
88
91
|
onComplete?.();
|
|
89
92
|
});
|
|
90
|
-
return (_jsxs("group", { children: [_jsx("lineSegments", { ref: trailRef, geometry: trailGeometry, children: _jsx("shootingStarMaterial", { ref: materialRef, attach: "material", transparent: true, blending: AdditiveBlending, depthWrite: false, color: new Color(color), opacity: opacity }, ShootingStarMaterial.key) }), _jsxs("mesh", { ref: starRef, children: [_jsx("sphereGeometry", { args: [size, 8, 8] }), _jsx("meshBasicMaterial", { ref: starMaterialRef, color: color, transparent: true, opacity: opacity, blending: AdditiveBlending, depthWrite: false }), _jsxs("mesh", { ref: glowRef, children: [_jsx("sphereGeometry", { args: [size * 2, 8, 8] }), _jsx("meshBasicMaterial", { ref: glowMaterialRef, color: color, transparent: true, opacity: opacity * 0.3, blending: AdditiveBlending, depthWrite: false })] })] })] }));
|
|
93
|
+
return (_jsxs("group", { ref: rootRef, children: [_jsx("lineSegments", { ref: trailRef, geometry: trailGeometry, children: _jsx("shootingStarMaterial", { ref: materialRef, attach: "material", transparent: true, blending: AdditiveBlending, depthWrite: false, color: new Color(color), opacity: opacity }, ShootingStarMaterial.key) }), _jsxs("mesh", { ref: starRef, children: [_jsx("sphereGeometry", { args: [size, 8, 8] }), _jsx("meshBasicMaterial", { ref: starMaterialRef, color: color, transparent: true, opacity: opacity, blending: AdditiveBlending, depthWrite: false }), _jsxs("mesh", { ref: glowRef, children: [_jsx("sphereGeometry", { args: [size * 2, 8, 8] }), _jsx("meshBasicMaterial", { ref: glowMaterialRef, color: color, transparent: true, opacity: opacity * 0.3, blending: AdditiveBlending, depthWrite: false })] })] })] }));
|
|
91
94
|
};
|
|
92
95
|
export default ShootingStar;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import type { ShootingStarsSettings } from '@3driseai/3drise-core';
|
|
2
3
|
import React from "react";
|
|
3
|
-
export interface ShootingStarsProps {
|
|
4
|
+
export interface ShootingStarsProps extends ObjectReadyProps {
|
|
4
5
|
settings: ShootingStarsSettings;
|
|
5
6
|
}
|
|
6
7
|
declare const ShootingStars: React.FC<ShootingStarsProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShootingStars.d.ts","sourceRoot":"","sources":["../../src/components/ShootingStars.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ShootingStars.d.ts","sourceRoot":"","sources":["../../src/components/ShootingStars.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IACxD,QAAQ,EAAE,qBAAqB,CAAC;CACnC;AAGD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAmC/C,CAAC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useRef, useState, useEffect, useCallback } from 'react';
|
|
3
3
|
import { generateShootingStar, generateShootingStars } from '@3driseai/3drise-core';
|
|
4
4
|
import ShootingStar from './ShootingStar.js';
|
|
5
|
-
const ShootingStars = ({ settings }) => {
|
|
5
|
+
const ShootingStars = ({ settings, onObjectReady, onObjectDispose }) => {
|
|
6
6
|
const [shootingStars, setShootingStars] = useState(() => {
|
|
7
7
|
if (settings?.enabled)
|
|
8
8
|
return generateShootingStars(settings.count, settings);
|
|
@@ -36,6 +36,6 @@ const ShootingStars = ({ settings }) => {
|
|
|
36
36
|
if (!settings?.enabled)
|
|
37
37
|
return null;
|
|
38
38
|
console.log("Rendering ShootingStars with settings:", settings, "and shootingStars:", shootingStars);
|
|
39
|
-
return (_jsx(_Fragment, { children: shootingStars.map(star => (_jsx(ShootingStar, { position: star.position, direction: star.direction, speed: star.speed, color: star.color, trailLength: star.trailLength, size: 0.08, opacity: 0.9, maxDistance: star.length, onComplete: () => handleComplete(star.id), followMouse: settings.followMouse }, star.id))) }));
|
|
39
|
+
return (_jsx(_Fragment, { children: shootingStars.map(star => (_jsx(ShootingStar, { position: star.position, direction: star.direction, speed: star.speed, color: star.color, trailLength: star.trailLength, size: 0.08, opacity: 0.9, maxDistance: star.length, onComplete: () => handleComplete(star.id), followMouse: settings.followMouse, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, star.id))) }));
|
|
40
40
|
};
|
|
41
41
|
export default ShootingStars;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import type { SkySettings, TimeSettings } from '@3driseai/3drise-core';
|
|
2
|
-
export interface SkyControllerProps {
|
|
3
|
+
export interface SkyControllerProps extends ObjectReadyProps {
|
|
3
4
|
settings: SkySettings;
|
|
4
5
|
timeSettings: TimeSettings;
|
|
5
6
|
scale?: number;
|
|
6
7
|
onSettingsChange?: (settings: SkySettings) => void;
|
|
7
8
|
}
|
|
8
|
-
declare function SkyController({ settings, timeSettings, scale, onSettingsChange, }: SkyControllerProps): any;
|
|
9
|
+
declare function SkyController({ settings, timeSettings, scale, onSettingsChange, onObjectReady, onObjectDispose, }: SkyControllerProps): any;
|
|
9
10
|
export default SkyController;
|
|
10
11
|
//# sourceMappingURL=SkyController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkyController.d.ts","sourceRoot":"","sources":["../../src/components/SkyController.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SkyController.d.ts","sourceRoot":"","sources":["../../src/components/SkyController.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAS7D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEvE,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IACxD,QAAQ,EAAE,WAAW,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,KAAK,IAAI,CAAC;CACtD;AAED,iBAAS,aAAa,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,GAAG,EAAE,kBAAkB,GA2K8H,GAAG,CACtQ;AA6BD,eAAe,aAAa,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
3
|
import { useRef, useEffect, useCallback } from 'react';
|
|
3
4
|
import { useFrame } from '@react-three/fiber';
|
|
4
5
|
import { useAnimationEvents } from '../hooks/useAnimationEvents.js';
|
|
@@ -8,8 +9,10 @@ import { useSkySystem } from '../hooks/useSkySystem.js';
|
|
|
8
9
|
import { findById } from '../utils/sceneQuery.js';
|
|
9
10
|
import { cubeCameraManager } from '@3driseai/3drise-core';
|
|
10
11
|
import SkyMesh from './SkyMesh.js';
|
|
11
|
-
function SkyController({ settings, timeSettings, scale = 1000, onSettingsChange, }) {
|
|
12
|
+
function SkyController({ settings, timeSettings, scale = 1000, onSettingsChange, onObjectReady, onObjectDispose, }) {
|
|
12
13
|
const skyRef = useRef(null);
|
|
14
|
+
const rootRef = useRef(null);
|
|
15
|
+
useObjectReady(rootRef, settings, onObjectReady, onObjectDispose);
|
|
13
16
|
const sunLightRef = useRef(null);
|
|
14
17
|
const isAnimatingRef = useRef(false);
|
|
15
18
|
const previousSettings = useRef(null);
|
|
@@ -83,11 +86,12 @@ function SkyController({ settings, timeSettings, scale = 1000, onSettingsChange,
|
|
|
83
86
|
onTimeUpdate: handleTimeUpdate,
|
|
84
87
|
enabled: settings.visible && timeSettings.enabled,
|
|
85
88
|
});
|
|
86
|
-
const
|
|
89
|
+
const handleSkyMeshReady = useCallback((object, mesh) => {
|
|
87
90
|
skyRef.current = mesh;
|
|
88
91
|
updateUniforms(settings);
|
|
89
92
|
previousSettings.current = { ...settings };
|
|
90
|
-
|
|
93
|
+
onObjectReady && onObjectReady(object, mesh);
|
|
94
|
+
}, [settings, updateUniforms, onObjectReady]);
|
|
91
95
|
const toggleSky = useCallback((show) => {
|
|
92
96
|
if (!skyRef.current)
|
|
93
97
|
return;
|
|
@@ -175,9 +179,8 @@ function SkyController({ settings, timeSettings, scale = 1000, onSettingsChange,
|
|
|
175
179
|
useFrame((state) => {
|
|
176
180
|
handleMouseMove({ x: state.pointer.x, y: state.pointer.y });
|
|
177
181
|
});
|
|
178
|
-
return (_jsxs(
|
|
182
|
+
return (_jsxs("group", { ref: rootRef, children: [_jsx(SkyMesh, { ref: skyRef, settings: settings, scale: scale, onObjectReady: handleSkyMeshReady, onObjectDispose: onObjectDispose }), settings.visible && (_jsx("directionalLight", { ref: sunLightRef, color: "#ffffff", intensity: 1, castShadow: true }))] }));
|
|
179
183
|
}
|
|
180
|
-
// ─── Atmospheric parameter calculation ───────────────────────────────────────
|
|
181
184
|
function calculateSkyParamsForTime(timeInHours) {
|
|
182
185
|
const nightParams = { turbidity: 0.5, rayleigh: 0.1, mieCoefficient: 0.001, mieDirectionalG: 0.8 };
|
|
183
186
|
const sunriseParams = { turbidity: 4, rayleigh: 3, mieCoefficient: 0.01, mieDirectionalG: 0.9 };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
2
2
|
import type { SkySettings } from "@3driseai/3drise-core";
|
|
3
|
-
export interface SkyMeshProps {
|
|
3
|
+
export interface SkyMeshProps extends ObjectReadyProps {
|
|
4
4
|
settings: SkySettings;
|
|
5
5
|
scale?: number;
|
|
6
|
-
onMeshReady?: (mesh: Mesh) => void;
|
|
7
6
|
}
|
|
8
7
|
declare const SkyMesh: any;
|
|
9
8
|
export default SkyMesh;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkyMesh.d.ts","sourceRoot":"","sources":["../../src/components/SkyMesh.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SkyMesh.d.ts","sourceRoot":"","sources":["../../src/components/SkyMesh.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IAClD,QAAQ,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,QAAA,MAAM,OAAO,EA2BP,GAAI,CAAC;AAEX,eAAe,OAAO,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
3
|
import React, { useRef, useMemo, useEffect } from 'react';
|
|
3
4
|
import { Sky } from 'three/examples/jsm/objects/Sky.js';
|
|
4
|
-
const SkyMesh = React.forwardRef(({ settings, scale = 1000,
|
|
5
|
+
const SkyMesh = React.forwardRef(({ settings, scale = 1000, onObjectReady, onObjectDispose }, ref) => {
|
|
5
6
|
const meshRef = useRef(null);
|
|
7
|
+
useObjectReady(meshRef, settings, onObjectReady, onObjectDispose);
|
|
6
8
|
const skyObject = useMemo(() => {
|
|
7
9
|
const sky = new Sky();
|
|
8
10
|
sky.scale.setScalar(scale);
|
|
@@ -19,10 +21,6 @@ const SkyMesh = React.forwardRef(({ settings, scale = 1000, onMeshReady }, ref)
|
|
|
19
21
|
}
|
|
20
22
|
};
|
|
21
23
|
}, [skyObject]);
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (meshRef.current && onMeshReady)
|
|
24
|
-
onMeshReady(meshRef.current);
|
|
25
|
-
}, [onMeshReady]);
|
|
26
24
|
const combinedRef = (node) => {
|
|
27
25
|
meshRef.current = node;
|
|
28
26
|
if (typeof ref === 'function')
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import * as THREE from 'three';
|
|
2
3
|
import type { TimeSettings, StarsSettings, CloudsSettings, SkySettings, RainSettings, FogSettings, MaterialSettings } from '@3driseai/3drise-core';
|
|
3
4
|
import React from "react";
|
|
@@ -7,7 +8,7 @@ export interface SkySystemRef {
|
|
|
7
8
|
getTimeOfDay: () => string;
|
|
8
9
|
getSunDirection: () => THREE.Vector3;
|
|
9
10
|
}
|
|
10
|
-
export interface SkySystemProps {
|
|
11
|
+
export interface SkySystemProps extends ObjectReadyProps {
|
|
11
12
|
timeSettings: TimeSettings;
|
|
12
13
|
visible?: boolean;
|
|
13
14
|
sunSystemVisible?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkySystem.d.ts","sourceRoot":"","sources":["../../src/components/SkySystem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAMnJ,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,YAAY;IACzB,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;CACxC;AAED,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"SkySystem.d.ts","sourceRoot":"","sources":["../../src/components/SkySystem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAMnJ,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,YAAY;IACzB,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;CACxC;AAED,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACpD,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;CAC9C;AAGD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,yBAAyB,CAAC,cAAc,GAAG,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,CAoCjG,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
3
|
import { useEffect, useLayoutEffect, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
3
4
|
import * as THREE from 'three';
|
|
4
5
|
import { useFrame } from '@react-three/fiber';
|
|
@@ -8,8 +9,11 @@ import Lensflare from './Lensflare.js';
|
|
|
8
9
|
import SunLight from './SunLight.js';
|
|
9
10
|
import SkyController from './SkyController.js';
|
|
10
11
|
import SceneFog from './SceneFog.js';
|
|
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
|
+
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, onObjectReady, onObjectDispose, }, ref) => {
|
|
12
13
|
const previousTimeOfDayRef = useRef(null);
|
|
14
|
+
const rootRef = useRef(null);
|
|
15
|
+
const ready = { onObjectReady, onObjectDispose };
|
|
16
|
+
useObjectReady(rootRef, { timeSettings, sunSystemVisible, skyboxScale, sunIntensity, skyControllerSettings, fogSettings }, onObjectReady, onObjectDispose);
|
|
13
17
|
useImperativeHandle(ref, () => ({
|
|
14
18
|
setTime: (h, m) => skySystemManager.setTime(h, m),
|
|
15
19
|
getTime: () => skySystemManager.getTime(),
|
|
@@ -40,7 +44,7 @@ const SkySystem = forwardRef(({ timeSettings, visible = true, sunSystemVisible =
|
|
|
40
44
|
});
|
|
41
45
|
if (!visible)
|
|
42
46
|
return null;
|
|
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 }))] }));
|
|
47
|
+
return (_jsxs("group", { ref: rootRef, children: [skyControllerSettings && !sunSystemVisible && (_jsx(SkyController, { settings: skyControllerSettings, timeSettings: timeSettings, scale: skyboxScale, ...ready })), sunSystemVisible && (_jsxs(_Fragment, { children: [_jsx(Skybox, { visible: true, scale: skyboxScale, sunSize: sunSize, moonSize: moonSize, timeSettings: timeSettings, ...ready }), _jsx(Lensflare, { visible: true, intensity: sunIntensity, timeSettings: timeSettings, ...ready }), _jsx(SunLight, { visible: true, timeSettings: timeSettings, targetPosition: playerPosition, intensity: sunIntensity, castShadow: castShadow, shadowMapSize: shadowMapSize, ...ready })] })), fogSettings && (_jsx(SceneFog, { fog: fogSettings }))] }));
|
|
44
48
|
});
|
|
45
49
|
SkySystem.displayName = 'SkySystem';
|
|
46
50
|
export default SkySystem;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import type { TimeSettings } from '@3driseai/3drise-core';
|
|
2
3
|
import React from "react";
|
|
3
|
-
export interface SkyboxProps {
|
|
4
|
+
export interface SkyboxProps extends ObjectReadyProps {
|
|
4
5
|
visible?: boolean;
|
|
5
6
|
scale?: number;
|
|
6
7
|
sunSize?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skybox.d.ts","sourceRoot":"","sources":["../../src/components/Skybox.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Skybox.d.ts","sourceRoot":"","sources":["../../src/components/Skybox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,YAAY,CAAC;CAC9B;AAkDD,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAsCjC,CAAC;AACF,eAAe,MAAM,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
3
|
import { useRef, useCallback, useEffect } from 'react';
|
|
3
4
|
import * as THREE from 'three';
|
|
4
5
|
import { useSkySystem } from '../hooks/useSkySystem.js';
|
|
@@ -52,8 +53,10 @@ function sampleSkyKeyframes(timeInHours, outHorizon, outHigh, outSun) {
|
|
|
52
53
|
outHigh.copy(last.high);
|
|
53
54
|
outSun.copy(last.sun);
|
|
54
55
|
}
|
|
55
|
-
const Skybox = ({ visible = true, scale = 100000, sunSize = 1, moonSize = 1, timeSettings, }) => {
|
|
56
|
+
const Skybox = ({ visible = true, scale = 100000, sunSize = 1, moonSize = 1, timeSettings, onObjectReady, onObjectDispose, }) => {
|
|
56
57
|
const materialRef = useRef(null);
|
|
58
|
+
const rootRef = useRef(null);
|
|
59
|
+
useObjectReady(rootRef, { visible, scale, sunSize, moonSize, timeSettings }, onObjectReady, onObjectDispose);
|
|
57
60
|
const sunColorRef = useRef(new THREE.Color(0xffe5b0));
|
|
58
61
|
const skyColorLowRef = useRef(new THREE.Color(0x6fa2ef));
|
|
59
62
|
const skyColorHighRef = useRef(new THREE.Color(0x2053ff));
|
|
@@ -87,6 +90,6 @@ const Skybox = ({ visible = true, scale = 100000, sunSize = 1, moonSize = 1, tim
|
|
|
87
90
|
if (!visible)
|
|
88
91
|
return null;
|
|
89
92
|
// console.log(sunSize)
|
|
90
|
-
return (_jsxs("mesh", { scale: scale, children: [_jsx("boxGeometry", { args: [1, 1, 1] }), _jsx("skyboxMaterial", { ref: materialRef, side: THREE.BackSide, depthWrite: false, fog: false })] }));
|
|
93
|
+
return (_jsxs("mesh", { ref: rootRef, scale: scale, children: [_jsx("boxGeometry", { args: [1, 1, 1] }), _jsx("skyboxMaterial", { ref: materialRef, side: THREE.BackSide, depthWrite: false, fog: false })] }));
|
|
91
94
|
};
|
|
92
95
|
export default Skybox;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { SolarSystemConfig } from "@3driseai/3drise-core";
|
|
4
|
-
declare const SolarSystem: React.FC<SolarSystemConfig &
|
|
5
|
-
onObjectReady?: (ref: Group) => void;
|
|
6
|
-
}>;
|
|
4
|
+
declare const SolarSystem: React.FC<SolarSystemConfig & ObjectReadyProps>;
|
|
7
5
|
export default SolarSystem;
|
|
8
6
|
//# sourceMappingURL=SolarSystem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolarSystem.d.ts","sourceRoot":"","sources":["../../src/components/SolarSystem.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SolarSystem.d.ts","sourceRoot":"","sources":["../../src/components/SolarSystem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAQ7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAiD1D,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,GAAG,gBAAgB,CAqB/D,CAAC;AAEF,eAAe,WAAW,CAAC"}
|