@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
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;AA0BF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA4GzC,CAAC;AACF,eAAe,UAAU,CAAC"}
|
|
@@ -13,16 +13,11 @@ import LightObject from "./LightObject.js";
|
|
|
13
13
|
import EnvironmentObject from "./EnvironmentObject.js";
|
|
14
14
|
import Galaxy from "./Galaxy.js";
|
|
15
15
|
import GridGenerator from "./GridsGenerator.js";
|
|
16
|
-
// Types whose React component instantiates and drives its own ShaderMaterial.
|
|
17
|
-
// useMaterialApplication would otherwise traverse the mesh tree and replace
|
|
18
|
-
// that material with a registry-default instance, breaking config-driven
|
|
19
|
-
// uniform updates (e.g. only ringRadius worked on glyphs because that drives
|
|
20
|
-
// geometry, not the material).
|
|
21
16
|
const SELF_MANAGED_MATERIAL = new Set([
|
|
22
17
|
'effect',
|
|
23
18
|
// 'gallery',
|
|
24
19
|
'earth',
|
|
25
|
-
'
|
|
20
|
+
'space',
|
|
26
21
|
'shootingStars',
|
|
27
22
|
'grid',
|
|
28
23
|
// 'moon'
|
|
@@ -35,18 +30,24 @@ const SELF_MANAGED_MATERIAL = new Set([
|
|
|
35
30
|
// ))}
|
|
36
31
|
// </>
|
|
37
32
|
// ) : null;
|
|
38
|
-
const GroupWithChildren = ({ createdObject, children, cameraSettings, onObjectReady, handleObjectClick, renderObject }) => {
|
|
33
|
+
const GroupWithChildren = ({ createdObject, children, cameraSettings, onObjectReady, onObjectDispose, handleObjectClick, renderObject }) => {
|
|
39
34
|
const isGroup = createdObject.type === 'group';
|
|
40
35
|
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));
|
|
36
|
+
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
37
|
};
|
|
43
|
-
const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick }) => {
|
|
38
|
+
const ObjectNode = ({ node, cameraSettings, onObjectReady, onObjectDispose, handleObjectClick }) => {
|
|
44
39
|
const { children, createdObject } = node;
|
|
45
40
|
// console.log(createdObject.meshSettings.name, createdObject.actions, createdObject.mouseMove)
|
|
41
|
+
// Children describe themselves with their own settings; the scene above
|
|
42
|
+
// knows them by the node's createdObject, so relabel on the way up.
|
|
43
|
+
const relabel = useCallback((obj) => ({
|
|
44
|
+
onObjectReady: (_object, ref) => onObjectReady && onObjectReady(obj, ref),
|
|
45
|
+
onObjectDispose: (_object, ref) => onObjectDispose && onObjectDispose(obj, ref),
|
|
46
|
+
}), [onObjectReady, onObjectDispose]);
|
|
46
47
|
// Specialized renderers for each object type
|
|
47
48
|
const renderers = useMemo(() => ({
|
|
48
49
|
group: () => null,
|
|
49
|
-
mesh: (obj, cameraSettings, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick }, obj.id)),
|
|
50
|
+
mesh: (obj, cameraSettings, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick }, obj.id)),
|
|
50
51
|
// water: (obj: CreatedObjectSettings, cameraSettings: CameraState, onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void) => (
|
|
51
52
|
// <Ocean
|
|
52
53
|
// settings={obj}
|
|
@@ -62,7 +63,7 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick })
|
|
|
62
63
|
// settings={obj}
|
|
63
64
|
// />
|
|
64
65
|
// ),
|
|
65
|
-
model: (obj, cameraSettings, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick }, obj.id)),
|
|
66
|
+
model: (obj, cameraSettings, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick }, obj.id)),
|
|
66
67
|
// custom_primitive: (obj: CreatedObjectSettings, cameraSettings: CameraState, onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void) => (
|
|
67
68
|
// <CustomPrimitive
|
|
68
69
|
// key={obj.id}
|
|
@@ -74,24 +75,24 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick })
|
|
|
74
75
|
text: (obj, cameraSettings, onObjectReady) => {
|
|
75
76
|
const renderMode = obj.config?.renderMode ?? 'bitmap';
|
|
76
77
|
return (_jsx(_Fragment, { children: renderMode === 'text3d'
|
|
77
|
-
? _jsx(Text3D, { textSettings: obj })
|
|
78
|
-
: _jsx(Text2D, { textSettings: obj }) }));
|
|
78
|
+
? _jsx(Text3D, { textSettings: obj, ...relabel(obj) })
|
|
79
|
+
: _jsx(Text2D, { textSettings: obj, ...relabel(obj) }) }));
|
|
79
80
|
},
|
|
80
81
|
particles: (obj, cameraSettings, onObjectReady) => {
|
|
81
82
|
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 }))] }));
|
|
83
|
+
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
84
|
},
|
|
84
|
-
path: (obj, cameraSettings, onObjectReady) => (_jsx(PathRenderer, { pathSettings: obj.config }, obj.id)),
|
|
85
|
+
path: (obj, cameraSettings, onObjectReady) => (_jsx(PathRenderer, { pathSettings: obj.config, ...relabel(obj) }, obj.id)),
|
|
85
86
|
grid: (obj, cameraSettings, onObjectReady) => (
|
|
86
87
|
// <GridHelper {...(obj.config as GridConfig)} side={2} />
|
|
87
|
-
_jsx(GridGenerator, { config: obj.config })),
|
|
88
|
+
_jsx(GridGenerator, { config: obj.config, ...relabel(obj) })),
|
|
88
89
|
effect: (obj) => (_jsx(EffectsGenerator, { settings: {
|
|
89
90
|
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 })),
|
|
91
|
+
}, ...relabel(obj) }, obj.id)),
|
|
92
|
+
gallery: (obj, cameraSettings, onObjectReady) => (_jsx(GalleryLayout, { createdObject: obj, handleObjectClick: handleObjectClick, ...relabel(obj) })),
|
|
93
|
+
light: (obj, cameraSettings, onObjectReady) => (_jsx(LightObject, { createdObject: obj, ...relabel(obj) })),
|
|
94
|
+
environment: (obj, cameraSettings, onObjectReady) => (_jsx(EnvironmentObject, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })),
|
|
95
|
+
space: (obj, cameraSettings, onObjectReady) => (_jsx(Galaxy, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })),
|
|
95
96
|
// rain: (obj: CreatedObjectSettings, cameraSettings: CameraState, onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void) => (
|
|
96
97
|
// <Rain
|
|
97
98
|
// settings={obj}
|
|
@@ -112,22 +113,21 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick })
|
|
|
112
113
|
// settings={obj.config as ShootingStarsSettings}
|
|
113
114
|
// />
|
|
114
115
|
// ),
|
|
115
|
-
}), [handleObjectClick]);
|
|
116
|
+
}), [handleObjectClick, onObjectReady, onObjectDispose, relabel]);
|
|
117
|
+
const renderObject = useCallback((obj, handleObjectClick) => {
|
|
118
|
+
// console.log('Rendering object:', obj);
|
|
119
|
+
const renderer = renderers[obj.type];
|
|
120
|
+
return renderer?.(obj, cameraSettings, onObjectReady) ?? null;
|
|
121
|
+
}, [cameraSettings, onObjectReady, renderers]);
|
|
116
122
|
if (!createdObject) {
|
|
117
123
|
console.warn(`createdObject not found.`);
|
|
118
124
|
return null;
|
|
119
125
|
}
|
|
120
|
-
const meshSettings = createdObject.meshSettings;
|
|
121
126
|
const hasChildren = children.length > 0;
|
|
122
127
|
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
128
|
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);
|
|
129
|
+
? _jsx(GroupWithChildren, { createdObject: createdObject, children: children, cameraSettings: cameraSettings, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, renderObject: renderObject })
|
|
130
|
+
: _jsx(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !SELF_MANAGED_MATERIAL.has(createdObject.type), children: renderObject(createdObject) }, createdObject.id);
|
|
131
131
|
// createdObject.effects
|
|
132
132
|
// ? <>
|
|
133
133
|
// {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
|
}
|
|
@@ -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 ParticlesR3fProps {
|
|
4
|
+
interface ParticlesR3fProps extends ObjectReadyProps {
|
|
4
5
|
particlesSettings: ParticlesSettings;
|
|
5
6
|
cameraFov?: number;
|
|
6
7
|
duration?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParticlesR3f.d.ts","sourceRoot":"","sources":["../../src/components/ParticlesR3f.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ParticlesR3f.d.ts","sourceRoot":"","sources":["../../src/components/ParticlesR3f.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAO7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,UAAU,iBAAkB,SAAQ,gBAAgB;IAChD,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChD;AAMD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAkG7C,CAAC;AACF,eAAe,YAAY,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 { useParticlePositions } from '../hooks/useParticlePositions.js';
|
|
@@ -9,9 +10,10 @@ import { update3driseShaderUniforms } from '../hooks/use3driseShader.js';
|
|
|
9
10
|
function normalizeEffects(raw) {
|
|
10
11
|
return Array.isArray(raw) ? raw : [];
|
|
11
12
|
}
|
|
12
|
-
const ParticlesR3f = ({ particlesSettings, duration = 1, transitionSettings, }) => {
|
|
13
|
+
const ParticlesR3f = ({ particlesSettings, duration = 1, transitionSettings, onObjectReady, onObjectDispose, }) => {
|
|
13
14
|
const materialRef = useRef(null);
|
|
14
15
|
const pointsRef = useRef(null);
|
|
16
|
+
useObjectReady(pointsRef, particlesSettings, onObjectReady, onObjectDispose);
|
|
15
17
|
const { name, config, meshSettings } = particlesSettings;
|
|
16
18
|
const { count, shapeType, outlines, texture } = config;
|
|
17
19
|
const color = particlesSettings.materialSettings && 'color' in particlesSettings.materialSettings
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import React from "react";
|
|
2
3
|
import type { CatmullRomCurve3 } from "three";
|
|
3
|
-
interface PathProps {
|
|
4
|
+
interface PathProps extends ObjectReadyProps {
|
|
4
5
|
curve: CatmullRomCurve3;
|
|
5
6
|
targetCurve: CatmullRomCurve3;
|
|
6
7
|
duration?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Path.d.ts","sourceRoot":"","sources":["../../src/components/Path.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Path.d.ts","sourceRoot":"","sources":["../../src/components/Path.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9C,UAAU,SAAU,SAAQ,gBAAgB;IACxC,KAAK,EAAE,gBAAgB,CAAC;IACxB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAqD7B,CAAC;AACF,eAAe,IAAI,CAAC"}
|
package/dist/components/Path.js
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useEffect } from 'react';
|
|
3
3
|
import { useFrame } from '@react-three/fiber';
|
|
4
|
-
|
|
4
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
5
|
+
const Path = ({ curve, targetCurve, duration = 1, color = '#4c00ff', opacity = 1, tubeRadius = 0.001, onObjectReady, onObjectDispose, }) => {
|
|
5
6
|
const tubeRef = useRef(null);
|
|
6
7
|
const targetTubeRef = useRef(null);
|
|
7
8
|
const meshRef = useRef(null);
|
|
9
|
+
const rootRef = useRef(null);
|
|
10
|
+
useObjectReady(rootRef, { curve, targetCurve, duration, color, opacity, tubeRadius }, onObjectReady, onObjectDispose);
|
|
8
11
|
const animationProgress = useRef(0);
|
|
9
12
|
const basePositions = useRef(null);
|
|
10
13
|
const speed = 1 / duration;
|
|
14
|
+
useObjectReady(meshRef, {
|
|
15
|
+
curve,
|
|
16
|
+
targetCurve,
|
|
17
|
+
duration,
|
|
18
|
+
color,
|
|
19
|
+
opacity,
|
|
20
|
+
tubeRadius,
|
|
21
|
+
}, onObjectReady, onObjectDispose);
|
|
11
22
|
useEffect(() => {
|
|
12
23
|
if (tubeRef.current) {
|
|
13
24
|
basePositions.current = new Float32Array(tubeRef.current.attributes.position.array);
|
|
@@ -36,6 +47,6 @@ const Path = ({ curve, targetCurve, duration = 1, color = '#4c00ff', opacity = 1
|
|
|
36
47
|
animationProgress.current = progress;
|
|
37
48
|
currentPosAttr.needsUpdate = true;
|
|
38
49
|
});
|
|
39
|
-
return (_jsxs(
|
|
50
|
+
return (_jsxs("group", { ref: rootRef, children: [_jsxs("mesh", { ref: meshRef, children: [_jsx("tubeGeometry", { ref: tubeRef, args: [curve, 64, tubeRadius, 8, false] }), _jsx("meshBasicMaterial", { color: color, transparent: opacity < 1, opacity: opacity })] }), _jsx("mesh", { position: [0, -1000, 0], children: _jsx("tubeGeometry", { ref: targetTubeRef, args: [targetCurve, 64, tubeRadius, 8, false] }) })] }));
|
|
40
51
|
};
|
|
41
52
|
export default Path;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import type { PathGeometrySettings, Vector3Array } from '@3driseai/3drise-core';
|
|
2
3
|
import React from "react";
|
|
3
|
-
interface PathGeometryProps {
|
|
4
|
+
interface PathGeometryProps extends ObjectReadyProps {
|
|
4
5
|
points: Vector3Array[];
|
|
5
6
|
curve: number;
|
|
6
7
|
smoothCorners?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathGeometry.d.ts","sourceRoot":"","sources":["../../src/components/PathGeometry.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PathGeometry.d.ts","sourceRoot":"","sources":["../../src/components/PathGeometry.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,UAAU,iBAAkB,SAAQ,gBAAgB;IAChD,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,oBAAoB,CAAC;CAClC;AAGD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAwG7C,CAAC;AACF,eAAe,YAAY,CAAC"}
|