@3driseai/3drise-viewer 0.1.1 → 0.1.3
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 -1
- package/dist/components/CreatedObject.d.ts +2 -2
- package/dist/components/CreatedObject.d.ts.map +1 -1
- package/dist/components/CreatedObject.js +5 -6
- 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 +4 -6
- package/dist/components/GeometryShape.d.ts.map +1 -1
- package/dist/components/GeometryShape.js +50 -31
- 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 +29 -24
- 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 +2 -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 +3 -2
- package/dist/components/cursor/CursorEffects.d.ts.map +1 -1
- package/dist/components/cursor/CursorEffects.js +3 -1
- 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 +1 -1
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
3
|
import { useEffect, useRef } from 'react';
|
|
3
4
|
import { useThree } from '@react-three/fiber';
|
|
4
5
|
import { useLightShadow } from '../hooks/useLightShadow.js';
|
|
5
6
|
import { useLightAnimation } from '../hooks/useLightAnimation.js';
|
|
6
7
|
import { useLightMouseMove } from '../hooks/useLightMouseMove.js';
|
|
7
|
-
const DirectionalLightR3F = ({ config, animations, mouseMove }) => {
|
|
8
|
+
const DirectionalLightR3F = ({ config, animations, mouseMove, settings, onObjectReady, onObjectDispose }) => {
|
|
8
9
|
const lightRef = useRef(null);
|
|
10
|
+
useObjectReady(lightRef, settings, onObjectReady, onObjectDispose);
|
|
9
11
|
useLightShadow(lightRef, config.shadow);
|
|
10
12
|
useLightAnimation(lightRef, animations);
|
|
11
13
|
useLightMouseMove(lightRef, mouseMove, { lightConfig: config });
|
|
12
14
|
return (_jsx("directionalLight", { ref: lightRef, color: config.color || '#ffffff', intensity: config.intensity ?? 1 }));
|
|
13
15
|
};
|
|
14
|
-
const SpotLightR3F = ({ config, animations, mouseMove }) => {
|
|
16
|
+
const SpotLightR3F = ({ config, animations, mouseMove, settings, onObjectReady, onObjectDispose }) => {
|
|
15
17
|
const { scene } = useThree();
|
|
16
18
|
const lightRef = useRef(null);
|
|
19
|
+
useObjectReady(lightRef, settings, onObjectReady, onObjectDispose);
|
|
17
20
|
const targetRef = useRef(null);
|
|
18
21
|
const [tx, ty, tz] = config.targetPosition ?? [0, 0, 0];
|
|
19
22
|
useEffect(() => {
|
|
@@ -38,14 +41,15 @@ const SpotLightR3F = ({ config, animations, mouseMove }) => {
|
|
|
38
41
|
useLightMouseMove(lightRef, mouseMove, { lightConfig: config });
|
|
39
42
|
return (_jsx("spotLight", { ref: lightRef, color: config.color || '#ffffff', intensity: config.intensity ?? 1, angle: config.angle ?? Math.PI / 4, penumbra: config.penumbra ?? 0.1, decay: config.decay ?? 1, distance: config.distance ?? 0 }));
|
|
40
43
|
};
|
|
41
|
-
const PointLightR3F = ({ config, animations, mouseMove }) => {
|
|
44
|
+
const PointLightR3F = ({ config, animations, mouseMove, settings, onObjectReady, onObjectDispose }) => {
|
|
42
45
|
const lightRef = useRef(null);
|
|
46
|
+
useObjectReady(lightRef, settings, onObjectReady, onObjectDispose);
|
|
43
47
|
useLightShadow(lightRef, config.shadow);
|
|
44
48
|
useLightAnimation(lightRef, animations);
|
|
45
49
|
useLightMouseMove(lightRef, mouseMove, { lightConfig: config });
|
|
46
50
|
return (_jsx("pointLight", { ref: lightRef, color: config.color || '#ffffff', intensity: config.intensity ?? 1, decay: config.decay ?? 1, distance: config.distance ?? 0 }));
|
|
47
51
|
};
|
|
48
|
-
const LightObject = ({ createdObject }) => {
|
|
52
|
+
const LightObject = ({ createdObject, onObjectReady, onObjectDispose }) => {
|
|
49
53
|
const config = createdObject.config;
|
|
50
54
|
if (!config || config.enabled === false)
|
|
51
55
|
return null;
|
|
@@ -53,11 +57,11 @@ const LightObject = ({ createdObject }) => {
|
|
|
53
57
|
const mouseMove = createdObject.mouseMove?.light;
|
|
54
58
|
switch (config.type) {
|
|
55
59
|
case 'directional':
|
|
56
|
-
return _jsx(DirectionalLightR3F, { config: config, animations: animations, mouseMove: mouseMove });
|
|
60
|
+
return _jsx(DirectionalLightR3F, { config: config, animations: animations, mouseMove: mouseMove, settings: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
|
|
57
61
|
case 'spot':
|
|
58
|
-
return _jsx(SpotLightR3F, { config: config, animations: animations, mouseMove: mouseMove });
|
|
62
|
+
return _jsx(SpotLightR3F, { config: config, animations: animations, mouseMove: mouseMove, settings: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
|
|
59
63
|
case 'point':
|
|
60
|
-
return _jsx(PointLightR3F, { config: config, animations: animations, mouseMove: mouseMove });
|
|
64
|
+
return _jsx(PointLightR3F, { config: config, animations: animations, mouseMove: mouseMove, settings: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
|
|
61
65
|
default:
|
|
62
66
|
return null;
|
|
63
67
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import type { SceneLightConfig } from '@3driseai/3drise-core';
|
|
2
3
|
import React from "react";
|
|
3
|
-
export interface LightsManagerProps {
|
|
4
|
+
export interface LightsManagerProps extends ObjectReadyProps {
|
|
4
5
|
config: SceneLightConfig;
|
|
5
6
|
}
|
|
6
7
|
declare const LightsManager: React.FC<LightsManagerProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightsManager.d.ts","sourceRoot":"","sources":["../../src/components/LightsManager.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LightsManager.d.ts","sourceRoot":"","sources":["../../src/components/LightsManager.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IACxD,MAAM,EAAE,gBAAgB,CAAC;CAC5B;AAID,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAmG/C,CAAC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
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 } from 'react';
|
|
3
4
|
import { useFrame, useThree } from '@react-three/fiber';
|
|
4
5
|
import { createSunPosition } from '@3driseai/3drise-core';
|
|
5
6
|
import { Color, } from 'three';
|
|
6
7
|
import { useLightAnimation } from '../hooks/useLightAnimation.js';
|
|
7
8
|
const SUN_DISTANCE = 100;
|
|
8
|
-
const LightsManager = ({ config }) => {
|
|
9
|
+
const LightsManager = ({ config, onObjectReady, onObjectDispose }) => {
|
|
9
10
|
const { scene } = useThree();
|
|
10
11
|
const ambientLightRef = useRef(null);
|
|
12
|
+
const rootRef = useRef(null);
|
|
13
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
11
14
|
const sunLightRef = useRef(null);
|
|
12
15
|
const ambientConfig = config.ambient;
|
|
13
16
|
const sunConfig = config.sun;
|
|
@@ -99,6 +102,6 @@ const LightsManager = ({ config }) => {
|
|
|
99
102
|
sunLightRef.current.position.set(sunPosition.x * SUN_DISTANCE, sunPosition.y * SUN_DISTANCE, sunPosition.z * SUN_DISTANCE);
|
|
100
103
|
}
|
|
101
104
|
});
|
|
102
|
-
return (_jsxs(
|
|
105
|
+
return (_jsxs("group", { ref: rootRef, children: [_jsx("ambientLight", { ref: ambientLightRef, color: ambientConfig?.color, intensity: ambientConfig?.intensity, visible: ambientConfig?.enabled }), _jsx("directionalLight", { visible: sunConfig?.enabled, ref: sunLightRef, color: sunConfig?.color || '#ffffff', intensity: sunConfig?.intensity ?? 1, castShadow: config.enableShadows ?? true })] }));
|
|
103
106
|
};
|
|
104
107
|
export default LightsManager;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import type { ParticlesSettings } from '@3driseai/3drise-core';
|
|
2
3
|
import React from "react";
|
|
3
|
-
interface LinesProps {
|
|
4
|
+
interface LinesProps extends ObjectReadyProps {
|
|
4
5
|
createdObject: ParticlesSettings;
|
|
5
6
|
transitionSettings?: Record<string, any>;
|
|
6
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lines.d.ts","sourceRoot":"","sources":["../../src/components/Lines.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Lines.d.ts","sourceRoot":"","sources":["../../src/components/Lines.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,UAAU,UAAW,SAAQ,gBAAgB;IACzC,aAAa,EAAE,iBAAiB,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5C;AAGD,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAa/B,CAAC;AACF,eAAe,KAAK,CAAC"}
|
package/dist/components/Lines.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { PositionsCreator } from '@3driseai/3drise-core';
|
|
4
4
|
import Path from './Path.js';
|
|
5
|
-
const Lines = ({ createdObject, transitionSettings }) => {
|
|
5
|
+
const Lines = ({ createdObject, transitionSettings, onObjectReady, onObjectDispose }) => {
|
|
6
6
|
if (!createdObject)
|
|
7
7
|
return null;
|
|
8
8
|
const { config } = createdObject;
|
|
@@ -14,6 +14,6 @@ const Lines = ({ createdObject, transitionSettings }) => {
|
|
|
14
14
|
: config.shapeType;
|
|
15
15
|
const curves = useMemo(() => PositionsCreator.generatePaths(config.shapeType), [config.shapeType]);
|
|
16
16
|
const targetCurves = useMemo(() => PositionsCreator.generatePaths(targetShape), [targetShape]);
|
|
17
|
-
return (_jsx(_Fragment, { children: curves.map((currentCurve, index) => (_jsx(Path, { curve: currentCurve, targetCurve: targetCurves[index % targetCurves.length], duration: 1, color: color }, `path-${index}`))) }));
|
|
17
|
+
return (_jsx(_Fragment, { children: curves.map((currentCurve, index) => (_jsx(Path, { curve: currentCurve, targetCurve: targetCurves[index % targetCurves.length], duration: 1, color: color, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, `path-${index}`))) }));
|
|
18
18
|
};
|
|
19
19
|
export default Lines;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { MoonSettings } from "@3driseai/3drise-core";
|
|
4
|
-
export interface MoonProps {
|
|
4
|
+
export interface MoonProps extends ObjectReadyProps {
|
|
5
5
|
settings?: MoonSettings;
|
|
6
6
|
sunPosition?: [number, number, number];
|
|
7
|
-
onMeshReady?: (mesh: Mesh) => void;
|
|
8
7
|
}
|
|
9
8
|
export type { MoonSettings };
|
|
10
9
|
export { defaultMoonSettings } from '@3driseai/3drise-core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Moon.d.ts","sourceRoot":"","sources":["../../src/components/Moon.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Moon.d.ts","sourceRoot":"","sources":["../../src/components/Moon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IAC/C,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED,YAAY,EAAE,YAAY,EAAE,CAAC;AAG7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CA0D7B,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/dist/components/Moon.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
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, useState, useCallback } from 'react';
|
|
3
4
|
import { TextureLoader, Vector3 } from 'three';
|
|
4
5
|
import { useFrame } from '@react-three/fiber';
|
|
5
6
|
export { defaultMoonSettings } from '@3driseai/3drise-core';
|
|
6
7
|
const MOON_TEXTURE_URL = "https://3d-rise.sfo3.cdn.digitaloceanspaces.com/app/images/moon_1024.jpg";
|
|
7
|
-
const Moon = ({ settings, sunPosition,
|
|
8
|
+
const Moon = ({ settings, sunPosition, onObjectReady, onObjectDispose }) => {
|
|
8
9
|
const meshRef = useRef(null);
|
|
10
|
+
const rootRef = useRef(null);
|
|
11
|
+
useObjectReady(rootRef, settings, onObjectReady, onObjectDispose);
|
|
9
12
|
const lightRef = useRef(null);
|
|
10
13
|
const targetRef = useRef(null);
|
|
11
14
|
const [texture, setTexture] = useState(null);
|
|
@@ -37,9 +40,8 @@ const Moon = ({ settings, sunPosition, onMeshReady }) => {
|
|
|
37
40
|
const handleMeshRef = useCallback((mesh) => {
|
|
38
41
|
if (mesh) {
|
|
39
42
|
meshRef.current = mesh;
|
|
40
|
-
onMeshReady?.(mesh);
|
|
41
43
|
}
|
|
42
|
-
}, [
|
|
44
|
+
}, []);
|
|
43
45
|
useFrame((state) => {
|
|
44
46
|
const moonPos = sunPosition ?? s.position;
|
|
45
47
|
if (meshRef.current && s.enableOrbit) {
|
|
@@ -60,7 +62,7 @@ const Moon = ({ settings, sunPosition, onMeshReady }) => {
|
|
|
60
62
|
}
|
|
61
63
|
});
|
|
62
64
|
const moonPos = sunPosition ?? s.position;
|
|
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 })] })] }));
|
|
65
|
+
return (_jsxs("group", { ref: rootRef, 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 })] })] }));
|
|
64
66
|
};
|
|
65
67
|
Moon.displayName = 'Moon';
|
|
66
68
|
export default Moon;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import type { ThreeElements } from '@react-three/fiber';
|
|
2
3
|
import type { MyGridConfig } from '@3driseai/3drise-core';
|
|
3
|
-
export interface MyGridProps {
|
|
4
|
+
export interface MyGridProps extends ObjectReadyProps {
|
|
4
5
|
config?: MyGridConfig;
|
|
5
6
|
groupProps?: ThreeElements['group'];
|
|
6
7
|
}
|
|
@@ -10,6 +11,6 @@ export interface MyGridProps {
|
|
|
10
11
|
* and any preset/serialization layer.
|
|
11
12
|
*/
|
|
12
13
|
export declare const defaultMyGridConfig: MyGridConfig;
|
|
13
|
-
export declare function MyGrid({ config, groupProps }: MyGridProps): import("react").JSX.Element;
|
|
14
|
+
export declare function MyGrid({ config, groupProps, onObjectReady, onObjectDispose }: MyGridProps): import("react").JSX.Element;
|
|
14
15
|
export default MyGrid;
|
|
15
16
|
//# sourceMappingURL=MyGrid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MyGrid.d.ts","sourceRoot":"","sources":["../../src/components/MyGrid.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MyGrid.d.ts","sourceRoot":"","sources":["../../src/components/MyGrid.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACjD,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACvC;AAID;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,YAuBjC,CAAC;AACF,wBAAgB,MAAM,CAAC,EAAE,MAA4B,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,WAAW,+BAoC/G;AACD,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 { useMemo, useRef } from 'react';
|
|
3
4
|
import * as THREE from 'three';
|
|
4
5
|
import { useFrame } from '@react-three/fiber';
|
|
@@ -34,8 +35,10 @@ export const defaultMyGridConfig = {
|
|
|
34
35
|
bgOpacity: 0,
|
|
35
36
|
followMouse: false,
|
|
36
37
|
};
|
|
37
|
-
export function MyGrid({ config = defaultMyGridConfig, groupProps }) {
|
|
38
|
+
export function MyGrid({ config = defaultMyGridConfig, groupProps, onObjectReady, onObjectDispose }) {
|
|
38
39
|
const matRef = useRef(null);
|
|
40
|
+
const rootRef = useRef(null);
|
|
41
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
39
42
|
const meshRef = useRef(null);
|
|
40
43
|
const { cellSize, size, segments, flat, lineMode, cellMode, lineWidth, sectionSize, sectionWidth, animSpeed, animScale, animIntensity, fadeDistance, fadeStrength, displace, lineColor, sectionColor, cellColor, glowColor, bgColor, bgOpacity, followMouse, } = config;
|
|
41
44
|
const segs = segments ?? (displace > 0 ? Math.max(64, Math.ceil(size / cellSize) * 2) : 1);
|
|
@@ -67,6 +70,6 @@ export function MyGrid({ config = defaultMyGridConfig, groupProps }) {
|
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
});
|
|
70
|
-
return (_jsx("group", { ...groupProps, children: _jsxs("mesh", { ref: meshRef, rotation: flat ? [-Math.PI / 2, 0, 0] : [0, 0, 0], children: [_jsx("planeGeometry", { args: [size, size, segs, segs] }), _jsx("myGridMaterial", { ref: matRef, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending, side: THREE.DoubleSide, u_cellSize: cellSize, u_lineWidth: lineWidth, u_sectionSize: sectionSize, u_sectionWidth: sectionWidth, u_lineMode: lineMode, u_cellMode: cellMode, u_animSpeed: animSpeed, u_animScale: animScale, u_animIntensity: animIntensity, u_fadeDistance: fade, u_fadeStrength: fadeStrength, u_displace: displace, u_lineColor: colors.line, u_sectionColor: colors.section, u_cellColor: colors.cell, u_glowColor: colors.glow, u_bgColor: colors.bg, u_bgOpacity: bgOpacity }, MyGridMaterial.key)] }) }));
|
|
73
|
+
return (_jsx("group", { ref: rootRef, ...groupProps, children: _jsxs("mesh", { ref: meshRef, rotation: flat ? [-Math.PI / 2, 0, 0] : [0, 0, 0], children: [_jsx("planeGeometry", { args: [size, size, segs, segs] }), _jsx("myGridMaterial", { ref: matRef, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending, side: THREE.DoubleSide, u_cellSize: cellSize, u_lineWidth: lineWidth, u_sectionSize: sectionSize, u_sectionWidth: sectionWidth, u_lineMode: lineMode, u_cellMode: cellMode, u_animSpeed: animSpeed, u_animScale: animScale, u_animIntensity: animIntensity, u_fadeDistance: fade, u_fadeStrength: fadeStrength, u_displace: displace, u_lineColor: colors.line, u_sectionColor: colors.section, u_cellColor: colors.cell, u_glowColor: colors.glow, u_bgColor: colors.bg, u_bgOpacity: bgOpacity }, MyGridMaterial.key)] }) }));
|
|
71
74
|
}
|
|
72
75
|
export default MyGrid;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from "../types/objectReady";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { Object3D } from "three";
|
|
3
4
|
import type { CameraState, CreatedObjectSettings, ObjectTreeNode } from "@3driseai/3drise-core";
|
|
4
5
|
import { type ThreeEvent } from "@react-three/fiber";
|
|
5
|
-
type ObjectNodeProps = {
|
|
6
|
+
type ObjectNodeProps = ObjectReadyProps & {
|
|
6
7
|
node: ObjectTreeNode;
|
|
7
8
|
cameraSettings: CameraState;
|
|
8
|
-
onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void;
|
|
9
9
|
handleObjectClick?: (object: CreatedObjectSettings, ref: Object3D, event: ThreeEvent<MouseEvent>) => void;
|
|
10
10
|
};
|
|
11
11
|
declare const ObjectNode: React.FC<ObjectNodeProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,KAAK,eAAe,GAAG;
|
|
1
|
+
{"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,KAAK,eAAe,GAAG,gBAAgB,GAAG;IACtC,IAAI,EAAE,cAAc,CAAC;IACrB,cAAc,EAAE,WAAW,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7G,CAAC;AA8BF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA4GzC,CAAC;AACF,eAAe,UAAU,CAAC"}
|
|
@@ -35,18 +35,24 @@ const SELF_MANAGED_MATERIAL = new Set([
|
|
|
35
35
|
// ))}
|
|
36
36
|
// </>
|
|
37
37
|
// ) : null;
|
|
38
|
-
const GroupWithChildren = ({ createdObject, children, cameraSettings, onObjectReady, handleObjectClick, renderObject }) => {
|
|
38
|
+
const GroupWithChildren = ({ createdObject, children, cameraSettings, onObjectReady, onObjectDispose, handleObjectClick, renderObject }) => {
|
|
39
39
|
const isGroup = createdObject.type === 'group';
|
|
40
40
|
const selfManagedMaterial = SELF_MANAGED_MATERIAL.has(createdObject.type);
|
|
41
|
-
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));
|
|
41
|
+
return (_jsxs(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !isGroup && !selfManagedMaterial, children: [!isGroup && renderObject(createdObject, handleObjectClick), children.map(childNode => (_jsx(ObjectNode, { node: childNode, cameraSettings: cameraSettings, handleObjectClick: handleObjectClick, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, childNode.objectId)))] }, createdObject.id));
|
|
42
42
|
};
|
|
43
|
-
const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick }) => {
|
|
43
|
+
const ObjectNode = ({ node, cameraSettings, onObjectReady, onObjectDispose, handleObjectClick }) => {
|
|
44
44
|
const { children, createdObject } = node;
|
|
45
45
|
// console.log(createdObject.meshSettings.name, createdObject.actions, createdObject.mouseMove)
|
|
46
|
+
// Children describe themselves with their own settings; the scene above
|
|
47
|
+
// knows them by the node's createdObject, so relabel on the way up.
|
|
48
|
+
const relabel = useCallback((obj) => ({
|
|
49
|
+
onObjectReady: (_object, ref) => onObjectReady && onObjectReady(obj, ref),
|
|
50
|
+
onObjectDispose: (_object, ref) => onObjectDispose && onObjectDispose(obj, ref),
|
|
51
|
+
}), [onObjectReady, onObjectDispose]);
|
|
46
52
|
// Specialized renderers for each object type
|
|
47
53
|
const renderers = useMemo(() => ({
|
|
48
54
|
group: () => null,
|
|
49
|
-
mesh: (obj, cameraSettings, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick }, obj.id)),
|
|
55
|
+
mesh: (obj, cameraSettings, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick }, obj.id)),
|
|
50
56
|
// water: (obj: CreatedObjectSettings, cameraSettings: CameraState, onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void) => (
|
|
51
57
|
// <Ocean
|
|
52
58
|
// settings={obj}
|
|
@@ -62,7 +68,7 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick })
|
|
|
62
68
|
// settings={obj}
|
|
63
69
|
// />
|
|
64
70
|
// ),
|
|
65
|
-
model: (obj, cameraSettings, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick }, obj.id)),
|
|
71
|
+
model: (obj, cameraSettings, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick }, obj.id)),
|
|
66
72
|
// custom_primitive: (obj: CreatedObjectSettings, cameraSettings: CameraState, onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void) => (
|
|
67
73
|
// <CustomPrimitive
|
|
68
74
|
// key={obj.id}
|
|
@@ -74,24 +80,24 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick })
|
|
|
74
80
|
text: (obj, cameraSettings, onObjectReady) => {
|
|
75
81
|
const renderMode = obj.config?.renderMode ?? 'bitmap';
|
|
76
82
|
return (_jsx(_Fragment, { children: renderMode === 'text3d'
|
|
77
|
-
? _jsx(Text3D, { textSettings: obj })
|
|
78
|
-
: _jsx(Text2D, { textSettings: obj }) }));
|
|
83
|
+
? _jsx(Text3D, { textSettings: obj, ...relabel(obj) })
|
|
84
|
+
: _jsx(Text2D, { textSettings: obj, ...relabel(obj) }) }));
|
|
79
85
|
},
|
|
80
86
|
particles: (obj, cameraSettings, onObjectReady) => {
|
|
81
87
|
const particlesSettings = obj;
|
|
82
|
-
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 }))] }));
|
|
88
|
+
return (_jsxs(_Fragment, { children: [particlesSettings.config?.particles && (_jsx(ParticlesR3f, { particlesSettings: particlesSettings, cameraFov: cameraSettings.fov, duration: 1, transitionSettings: particlesSettings.meshSettings, ...relabel(obj) })), particlesSettings.config?.paths && (_jsx(Lines, { createdObject: particlesSettings, ...relabel(obj) }))] }));
|
|
83
89
|
},
|
|
84
|
-
path: (obj, cameraSettings, onObjectReady) => (_jsx(PathRenderer, { pathSettings: obj.config }, obj.id)),
|
|
90
|
+
path: (obj, cameraSettings, onObjectReady) => (_jsx(PathRenderer, { pathSettings: obj.config, ...relabel(obj) }, obj.id)),
|
|
85
91
|
grid: (obj, cameraSettings, onObjectReady) => (
|
|
86
92
|
// <GridHelper {...(obj.config as GridConfig)} side={2} />
|
|
87
|
-
_jsx(GridGenerator, { config: obj.config })),
|
|
93
|
+
_jsx(GridGenerator, { config: obj.config, ...relabel(obj) })),
|
|
88
94
|
effect: (obj) => (_jsx(EffectsGenerator, { settings: {
|
|
89
95
|
config: obj.config,
|
|
90
|
-
} }, obj.id)),
|
|
91
|
-
gallery: (obj, cameraSettings, onObjectReady) => (_jsx(GalleryLayout, { createdObject: obj, handleObjectClick: handleObjectClick })),
|
|
92
|
-
light: (obj, cameraSettings, onObjectReady) => (_jsx(LightObject, { createdObject: obj })),
|
|
93
|
-
environment: (obj, cameraSettings, onObjectReady) => (_jsx(EnvironmentObject, { createdObject: obj })),
|
|
94
|
-
space: (obj, cameraSettings, onObjectReady) => (_jsx(Galaxy, { createdObject: obj, onObjectReady: onObjectReady })),
|
|
96
|
+
}, ...relabel(obj) }, obj.id)),
|
|
97
|
+
gallery: (obj, cameraSettings, onObjectReady) => (_jsx(GalleryLayout, { createdObject: obj, handleObjectClick: handleObjectClick, ...relabel(obj) })),
|
|
98
|
+
light: (obj, cameraSettings, onObjectReady) => (_jsx(LightObject, { createdObject: obj, ...relabel(obj) })),
|
|
99
|
+
environment: (obj, cameraSettings, onObjectReady) => (_jsx(EnvironmentObject, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })),
|
|
100
|
+
space: (obj, cameraSettings, onObjectReady) => (_jsx(Galaxy, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })),
|
|
95
101
|
// rain: (obj: CreatedObjectSettings, cameraSettings: CameraState, onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void) => (
|
|
96
102
|
// <Rain
|
|
97
103
|
// settings={obj}
|
|
@@ -112,22 +118,21 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick })
|
|
|
112
118
|
// settings={obj.config as ShootingStarsSettings}
|
|
113
119
|
// />
|
|
114
120
|
// ),
|
|
115
|
-
}), [handleObjectClick]);
|
|
121
|
+
}), [handleObjectClick, onObjectReady, onObjectDispose, relabel]);
|
|
122
|
+
const renderObject = useCallback((obj, handleObjectClick) => {
|
|
123
|
+
// console.log('Rendering object:', obj);
|
|
124
|
+
const renderer = renderers[obj.type];
|
|
125
|
+
return renderer?.(obj, cameraSettings, onObjectReady) ?? null;
|
|
126
|
+
}, [cameraSettings, onObjectReady, renderers]);
|
|
116
127
|
if (!createdObject) {
|
|
117
128
|
console.warn(`createdObject not found.`);
|
|
118
129
|
return null;
|
|
119
130
|
}
|
|
120
|
-
const meshSettings = createdObject.meshSettings;
|
|
121
131
|
const hasChildren = children.length > 0;
|
|
122
132
|
const shouldRenderAsGroup = hasChildren || createdObject.type === 'group' || createdObject.type === 'effect';
|
|
123
|
-
const renderObject = useCallback((obj, handleObjectClick) => {
|
|
124
|
-
// console.log('Rendering object:', obj);
|
|
125
|
-
const renderer = renderers[obj.type];
|
|
126
|
-
return renderer?.(obj, cameraSettings, onObjectReady) ?? null;
|
|
127
|
-
}, [cameraSettings, onObjectReady, renderers]);
|
|
128
133
|
const renderedObject = shouldRenderAsGroup
|
|
129
|
-
? _jsx(GroupWithChildren, { createdObject: createdObject, children: children, cameraSettings: cameraSettings, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick, renderObject: renderObject })
|
|
130
|
-
: _jsx(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !SELF_MANAGED_MATERIAL.has(createdObject.type), children: renderObject(createdObject) }, createdObject.id);
|
|
134
|
+
? _jsx(GroupWithChildren, { createdObject: createdObject, children: children, cameraSettings: cameraSettings, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, renderObject: renderObject })
|
|
135
|
+
: _jsx(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !SELF_MANAGED_MATERIAL.has(createdObject.type), children: renderObject(createdObject) }, createdObject.id);
|
|
131
136
|
// createdObject.effects
|
|
132
137
|
// ? <>
|
|
133
138
|
// {renderObject(createdObject)}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { Object3D } from "three";
|
|
3
4
|
import type { CameraState, CreatedObjectSettings } from "@3driseai/3drise-core";
|
|
4
5
|
import { type ThreeEvent } from "@react-three/fiber";
|
|
5
|
-
type ObjectNodeApiProps = {
|
|
6
|
+
type ObjectNodeApiProps = ObjectReadyProps & {
|
|
6
7
|
objectId: string;
|
|
7
8
|
cameraSettings: CameraState;
|
|
8
|
-
onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void;
|
|
9
9
|
handleObjectClick?: (object: CreatedObjectSettings, ref: Object3D, event: ThreeEvent<MouseEvent>) => void;
|
|
10
10
|
};
|
|
11
11
|
declare const ObjectNodeApi: React.FC<ObjectNodeApiProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectNodeApi.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNodeApi.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,KAAK,kBAAkB,GAAG;
|
|
1
|
+
{"version":3,"file":"ObjectNodeApi.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNodeApi.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,KAAK,kBAAkB,GAAG,gBAAgB,GAAG;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,WAAW,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7G,CAAC;AAGF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAW/C,CAAC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';
|
|
|
3
3
|
// import { apiFetch } from '../utils/apiFetch';
|
|
4
4
|
import ObjectNode from './ObjectNode.js';
|
|
5
5
|
import { dataCenterServer } from '../constants.js';
|
|
6
|
-
const ObjectNodeApi = ({ objectId, cameraSettings, onObjectReady, handleObjectClick }) => {
|
|
6
|
+
const ObjectNodeApi = ({ objectId, cameraSettings, onObjectReady, onObjectDispose, handleObjectClick }) => {
|
|
7
7
|
const [node, setNode] = useState(null);
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
fetch(`${dataCenterServer}scene-objects/${objectId}/tree`)
|
|
@@ -13,6 +13,6 @@ const ObjectNodeApi = ({ objectId, cameraSettings, onObjectReady, handleObjectCl
|
|
|
13
13
|
}, [objectId]);
|
|
14
14
|
if (!node)
|
|
15
15
|
return null;
|
|
16
|
-
return (_jsx(ObjectNode, { node: node, cameraSettings: cameraSettings, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick }));
|
|
16
|
+
return (_jsx(ObjectNode, { node: node, cameraSettings: cameraSettings, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick }));
|
|
17
17
|
};
|
|
18
18
|
export default ObjectNodeApi;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { AnimationSequence, GeneralObjectSettings, CameraState, CreatedObjectSettings } from '@3driseai/3drise-core';
|
|
2
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
2
3
|
import React from "react";
|
|
3
4
|
import { Object3D } from "three";
|
|
4
5
|
import { type ThreeEvent } from "@react-three/fiber";
|
|
5
|
-
interface ObjectsRendererProps {
|
|
6
|
+
interface ObjectsRendererProps extends ObjectReadyProps {
|
|
6
7
|
cameraSettings: CameraState;
|
|
7
8
|
generalObjectSettings: GeneralObjectSettings;
|
|
8
9
|
createdObjects: CreatedObjectSettings[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectsRenderer.d.ts","sourceRoot":"","sources":["../../src/components/ObjectsRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ObjectsRenderer.d.ts","sourceRoot":"","sources":["../../src/components/ObjectsRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAI1H,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,UAAU,oBAAqB,SAAQ,gBAAgB;IACnD,cAAc,EAAE,WAAW,CAAC;IAC5B,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,cAAc,EAAE,qBAAqB,EAAE,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC1G,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACnC;AAGD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA6ClD,CAAC;AAEH,eAAe,eAAe,CAAC"}
|
|
@@ -3,17 +3,28 @@ import { memo, useRef, useCallback, useMemo } from 'react';
|
|
|
3
3
|
import { buildObjectTree } from '@3driseai/3drise-core';
|
|
4
4
|
import ObjectNode from './ObjectNode.js';
|
|
5
5
|
import useInteraction from '../hooks/useInteraction.js';
|
|
6
|
-
|
|
6
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
7
|
+
const ObjectsRenderer = memo(({ cameraSettings, createdObjects, generalObjectSettings, onObjectsReady, onObjectReady, onObjectDispose, handleObjectClick, sequences = [], }) => {
|
|
7
8
|
const groupRef = useRef(null);
|
|
8
9
|
const objectsTree = useMemo(() => buildObjectTree(createdObjects), [createdObjects]);
|
|
9
10
|
const readyObjectsCount = useRef(0);
|
|
10
|
-
|
|
11
|
+
// Count for the aggregate onObjectsReady signal, then forward the event up.
|
|
12
|
+
// Previously this callback counted and dropped the (object, ref) pair, which
|
|
13
|
+
// is why nothing above ObjectsRenderer ever received an object ref.
|
|
14
|
+
const handleObjectReady = useCallback((object, ref) => {
|
|
11
15
|
readyObjectsCount.current += 1;
|
|
12
16
|
if (readyObjectsCount.current === objectsTree.length) {
|
|
13
17
|
console.log("All objects are ready!");
|
|
14
18
|
onObjectsReady && onObjectsReady();
|
|
15
19
|
}
|
|
16
|
-
|
|
20
|
+
onObjectReady && onObjectReady(object, ref);
|
|
21
|
+
}, [objectsTree.length, onObjectsReady, onObjectReady]);
|
|
22
|
+
const handleObjectDispose = useCallback((object, ref) => {
|
|
23
|
+
readyObjectsCount.current = Math.max(0, readyObjectsCount.current - 1);
|
|
24
|
+
onObjectDispose && onObjectDispose(object, ref);
|
|
25
|
+
}, [onObjectDispose]);
|
|
26
|
+
// The wrapper group itself is an Object3D the parent may want to transform.
|
|
27
|
+
useObjectReady(groupRef, generalObjectSettings, onObjectReady, onObjectDispose);
|
|
17
28
|
function filterInteractionsByEvent(interactions, mouseEvent) {
|
|
18
29
|
if (!interactions)
|
|
19
30
|
return [];
|
|
@@ -34,7 +45,7 @@ const ObjectsRenderer = memo(({ cameraSettings, createdObjects, generalObjectSet
|
|
|
34
45
|
handleObjectClick(createdObject, ref, event);
|
|
35
46
|
}
|
|
36
47
|
};
|
|
37
|
-
return (_jsx("group", { ref: groupRef, name: "main-objects", position: generalObjectSettings.meshSettings.position, rotation: generalObjectSettings.meshSettings.rotation, scale: generalObjectSettings.meshSettings.scale, children: objectsTree.map(node => (_jsx(ObjectNode, { node: node, cameraSettings: cameraSettings, onObjectReady:
|
|
48
|
+
return (_jsx("group", { ref: groupRef, name: "main-objects", position: generalObjectSettings.meshSettings.position, rotation: generalObjectSettings.meshSettings.rotation, scale: generalObjectSettings.meshSettings.scale, children: objectsTree.map(node => (_jsx(ObjectNode, { node: node, cameraSettings: cameraSettings, onObjectReady: handleObjectReady, onObjectDispose: handleObjectDispose, handleObjectClick: handleObjectClickHandler }, node.objectId))) }));
|
|
38
49
|
});
|
|
39
50
|
ObjectsRenderer.displayName = 'ObjectsRenderer';
|
|
40
51
|
export default ObjectsRenderer;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { CreatedObjectSettings, CameraState, GeneralObjectSettings } from "@3driseai/3drise-core";
|
|
3
4
|
import { type ThreeEvent } from "@react-three/fiber";
|
|
4
5
|
import { Object3D } from "three";
|
|
5
|
-
export interface ObjectsRendererApiProps {
|
|
6
|
+
export interface ObjectsRendererApiProps extends ObjectReadyProps {
|
|
6
7
|
objectIds: string[];
|
|
7
8
|
cameraSettings: CameraState;
|
|
8
9
|
generalObjectSettings: GeneralObjectSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectsRendererApi.d.ts","sourceRoot":"","sources":["../../src/components/ObjectsRendererApi.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ObjectsRendererApi.d.ts","sourceRoot":"","sources":["../../src/components/ObjectsRendererApi.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC7D,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,WAAW,CAAC;IAC5B,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC1G,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAGD;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAyDzD,CAAC;AACF,eAAe,kBAAkB,CAAC"}
|
|
@@ -15,7 +15,7 @@ import ObjectsRenderer from './ObjectsRenderer.js';
|
|
|
15
15
|
* apiBaseUrl="http://localhost:3001"
|
|
16
16
|
* />
|
|
17
17
|
*/
|
|
18
|
-
const ObjectsRendererApi = ({ objectIds, cameraSettings, generalObjectSettings, apiBaseUrl = 'http://localhost:3001', onObjectsReady, handleObjectClick, onError, onLoading, }) => {
|
|
18
|
+
const ObjectsRendererApi = ({ objectIds, cameraSettings, generalObjectSettings, apiBaseUrl = 'http://localhost:3001', onObjectsReady, handleObjectClick, onError, onLoading, onObjectReady, onObjectDispose, }) => {
|
|
19
19
|
const [createdObjects, setCreatedObjects] = useState([]);
|
|
20
20
|
const [isLoading, setIsLoading] = useState(true);
|
|
21
21
|
const [error, setError] = useState(null);
|
|
@@ -71,6 +71,6 @@ const ObjectsRendererApi = ({ objectIds, cameraSettings, generalObjectSettings,
|
|
|
71
71
|
console.error('ObjectsRendererApi Error:', error);
|
|
72
72
|
return (_jsx("group", { children: _jsxs("mesh", { position: [0, 0, 0], children: [_jsx("sphereGeometry", { args: [0.5, 32, 32] }), _jsx("meshStandardMaterial", { color: 0xff0000, wireframe: true })] }) }));
|
|
73
73
|
}
|
|
74
|
-
return (_jsx(ObjectsRenderer, { cameraSettings: cameraSettings, createdObjects: createdObjects, generalObjectSettings: generalObjectSettings, onObjectsReady: onObjectsReady, handleObjectClick: handleObjectClick }));
|
|
74
|
+
return (_jsx(ObjectsRenderer, { cameraSettings: cameraSettings, createdObjects: createdObjects, generalObjectSettings: generalObjectSettings, onObjectsReady: onObjectsReady, handleObjectClick: handleObjectClick, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }));
|
|
75
75
|
};
|
|
76
76
|
export default ObjectsRendererApi;
|
|
@@ -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 OceanProps {
|
|
4
|
+
export interface OceanProps extends ObjectReadyProps {
|
|
4
5
|
settings: CreatedObjectSettings;
|
|
5
6
|
}
|
|
6
7
|
declare const Ocean: React.FC<OceanProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ocean.d.ts","sourceRoot":"","sources":["../../src/components/Ocean.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Ocean.d.ts","sourceRoot":"","sources":["../../src/components/Ocean.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAU7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAChD,QAAQ,EAAE,qBAAqB,CAAC;CACnC;AAGD,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA8J/B,CAAC;AACF,eAAe,KAAK,CAAC"}
|
package/dist/components/Ocean.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
3
|
import { useRef, useState } from 'react';
|
|
3
4
|
import * as THREE from 'three';
|
|
4
5
|
import { useFrame } from '@react-three/fiber';
|
|
@@ -8,8 +9,9 @@ import { useWaterReflections } from '../hooks/useWaterReflections.js';
|
|
|
8
9
|
import { useAnimationEvents } from '../hooks/useAnimationEvents.js';
|
|
9
10
|
import { useNumericAnimation } from '../hooks/useNumericAnimation.js';
|
|
10
11
|
import { handleTransformAnimations, handleMaterialAnimations, handleTransformMouseMove, handleMaterialMouseMove, } from '@3driseai/3drise-core';
|
|
11
|
-
const Ocean = ({ settings }) => {
|
|
12
|
+
const Ocean = ({ settings, onObjectReady, onObjectDispose }) => {
|
|
12
13
|
const meshRef = useRef(null);
|
|
14
|
+
useObjectReady(meshRef, settings, onObjectReady, onObjectDispose);
|
|
13
15
|
const uniformOverrideRef = useRef(null);
|
|
14
16
|
const matAnimCacheRef = useRef({});
|
|
15
17
|
const [meshVisible, setMeshVisible] = useState(null);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import { Line } from '@react-three/drei';
|
|
2
3
|
import type { ComponentProps } from "react";
|
|
3
4
|
import type { BufferGeometry } from "three";
|
|
4
5
|
import { OutlineMode } from "./extractOutline";
|
|
5
6
|
type DreiLineProps = ComponentProps<typeof Line>;
|
|
6
|
-
export interface OutlineProps extends Omit<DreiLineProps, 'points' | 'segments' | 'ref' | 'geometry'
|
|
7
|
+
export interface OutlineProps extends Omit<DreiLineProps, 'points' | 'segments' | 'ref' | 'geometry'>, ObjectReadyProps {
|
|
7
8
|
/** Any host geometry to outline. */
|
|
8
9
|
geometry: BufferGeometry;
|
|
9
10
|
/** '3d' = feature edges (uses `angle`), '2d' = flat front-plane profile. */
|
|
@@ -16,6 +17,6 @@ export interface OutlineProps extends Omit<DreiLineProps, 'points' | 'segments'
|
|
|
16
17
|
* handled by drei's <Line>. Color / lineWidth / dashed are forwarded straight
|
|
17
18
|
* through, so the parent owns all appearance.
|
|
18
19
|
*/
|
|
19
|
-
export declare function Outline({ geometry, mode, angle, ...lineProps }: OutlineProps): import("react").JSX.Element;
|
|
20
|
+
export declare function Outline({ geometry, mode, angle, onObjectReady, onObjectDispose, ...lineProps }: OutlineProps): import("react").JSX.Element;
|
|
20
21
|
export {};
|
|
21
22
|
//# sourceMappingURL=Outline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Outline.d.ts","sourceRoot":"","sources":["../../src/components/Outline.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Outline.d.ts","sourceRoot":"","sources":["../../src/components/Outline.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,KAAK,aAAa,GAAG,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC;AAEjD,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,UAAU,GAAG,KAAK,GAAG,UAAU,CAAC,EAAE,gBAAgB;IACnH,oCAAoC;IACpC,QAAQ,EAAE,cAAc,CAAC;IACzB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAW,EAAE,KAAU,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,SAAS,EAAE,EAAE,YAAY,+BAOxH"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
4
|
import { Line } from '@react-three/drei';
|
|
3
5
|
import { useOutline } from '../hooks/useOutline.js';
|
|
4
6
|
/**
|
|
@@ -6,9 +8,11 @@ import { useOutline } from '../hooks/useOutline.js';
|
|
|
6
8
|
* handled by drei's <Line>. Color / lineWidth / dashed are forwarded straight
|
|
7
9
|
* through, so the parent owns all appearance.
|
|
8
10
|
*/
|
|
9
|
-
export function Outline({ geometry, mode = '3d', angle = 18, ...lineProps }) {
|
|
11
|
+
export function Outline({ geometry, mode = '3d', angle = 18, onObjectReady, onObjectDispose, ...lineProps }) {
|
|
10
12
|
const points = useOutline(geometry, mode, angle);
|
|
13
|
+
const rootRef = useRef(null);
|
|
14
|
+
useObjectReady(rootRef, { mode, angle }, onObjectReady, onObjectDispose);
|
|
11
15
|
if (points.length === 0)
|
|
12
16
|
return null;
|
|
13
|
-
return _jsx(Line, { points: points, segments: true, ...lineProps });
|
|
17
|
+
return _jsx(Line, { ref: rootRef, points: points, segments: true, ...lineProps });
|
|
14
18
|
}
|