@3driseai/3drise-viewer 0.1.2 → 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 +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 +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,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } 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 * as THREE from 'three';
|
|
5
6
|
import { SparklesBurstMaterial } from '@3driseai/3drise-core';
|
|
6
|
-
const SparklesBurst = ({ config, boundingRadius }) => {
|
|
7
|
+
const SparklesBurst = ({ config, boundingRadius, onObjectReady, onObjectDispose }) => {
|
|
7
8
|
// console.log("Rendering SparklesBurst with config:", config, "and boundingRadius:", boundingRadius);
|
|
8
9
|
const planeSize = useMemo(() => Math.max(0.05, config.scale ?? 2.5), [config.scale]);
|
|
9
10
|
const geometry = useMemo(() => new THREE.PlaneGeometry(planeSize, planeSize, 1, 1), [planeSize]);
|
|
@@ -40,6 +41,8 @@ const SparklesBurst = ({ config, boundingRadius }) => {
|
|
|
40
41
|
// Track elapsed time JS-side so loop on/off toggles cleanly without
|
|
41
42
|
// depending on the global clock for the progress phase.
|
|
42
43
|
const startRef = useRef(null);
|
|
44
|
+
const rootRef = useRef(null);
|
|
45
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
43
46
|
// Reset start when loop toggles so behaviour is predictable.
|
|
44
47
|
useEffect(() => { startRef.current = null; }, [config.loop, config.durationMs]);
|
|
45
48
|
useFrame((state) => {
|
|
@@ -57,6 +60,6 @@ const SparklesBurst = ({ config, boundingRadius }) => {
|
|
|
57
60
|
});
|
|
58
61
|
if (!config.enabled)
|
|
59
62
|
return null;
|
|
60
|
-
return _jsx("mesh", { geometry: geometry, material: material, frustumCulled: false });
|
|
63
|
+
return _jsx("mesh", { ref: rootRef, geometry: geometry, material: material, frustumCulled: false });
|
|
61
64
|
};
|
|
62
65
|
export default SparklesBurst;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import { BufferGeometry } from 'three';
|
|
2
|
-
import type { Object3D } from 'three';
|
|
3
3
|
import React from "react";
|
|
4
4
|
import type { CreatedObjectSettings } from "@3driseai/3drise-core";
|
|
5
5
|
import type { TimeSettings } from "@3driseai/3drise-core";
|
|
6
|
-
export interface StarsProps {
|
|
6
|
+
export interface StarsProps extends ObjectReadyProps {
|
|
7
7
|
settings: CreatedObjectSettings;
|
|
8
8
|
timeSettings?: TimeSettings;
|
|
9
9
|
sunSystemEnabled?: boolean;
|
|
10
|
-
onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void;
|
|
11
10
|
}
|
|
12
11
|
export declare function generateStarsGeometry(count: number): BufferGeometry;
|
|
13
12
|
declare const Stars: React.FC<StarsProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stars.d.ts","sourceRoot":"","sources":["../../src/components/Stars.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Stars.d.ts","sourceRoot":"","sources":["../../src/components/Stars.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAA4C,MAAM,OAAO,CAAC;AAQjF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAChD,QAAQ,EAAE,qBAAqB,CAAC;IAChC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAOD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAuDnE;AAYD,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAwK/B,CAAC;AACF,eAAe,KAAK,CAAC"}
|
package/dist/components/Stars.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, useMemo, useCallback, useState, useEffect } from 'react';
|
|
3
4
|
import { BufferGeometry, BufferAttribute, AdditiveBlending, Color } from 'three';
|
|
4
5
|
import { useFrame } from '@react-three/fiber';
|
|
@@ -78,8 +79,9 @@ const DEFAULT_TIME_SETTINGS = {
|
|
|
78
79
|
autoAnimate: false,
|
|
79
80
|
syncWithRealTime: false,
|
|
80
81
|
};
|
|
81
|
-
const Stars = ({ settings, timeSettings, sunSystemEnabled = false, onObjectReady }) => {
|
|
82
|
+
const Stars = ({ settings, timeSettings, sunSystemEnabled = false, onObjectReady, onObjectDispose }) => {
|
|
82
83
|
const pointsRef = useRef(null);
|
|
84
|
+
useObjectReady(pointsRef, settings, onObjectReady, onObjectDispose);
|
|
83
85
|
const materialRef = useRef(null);
|
|
84
86
|
const { meshSettings, config, animations, mouseMove } = settings;
|
|
85
87
|
const { position, rotation, scale, visible } = meshSettings;
|
|
@@ -102,7 +104,6 @@ const Stars = ({ settings, timeSettings, sunSystemEnabled = false, onObjectReady
|
|
|
102
104
|
});
|
|
103
105
|
const geometry = useMemo(() => generateStarsGeometry(count), [count]);
|
|
104
106
|
useEffect(() => {
|
|
105
|
-
onObjectReady && onObjectReady(settings, pointsRef.current);
|
|
106
107
|
return () => { geometry.dispose(); };
|
|
107
108
|
}, [geometry]);
|
|
108
109
|
useEffect(() => {
|
package/dist/components/Sun.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
type
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
2
|
+
type SunProps = ObjectReadyProps & {
|
|
2
3
|
/** Radius of the sun core. Default 1. */
|
|
3
4
|
radius?: number;
|
|
4
5
|
/** Corona shell size relative to the core. Default 1.25. */
|
|
@@ -10,6 +11,6 @@ type SunProps = {
|
|
|
10
11
|
/** Uniform overrides for SunFlareMaterial. */
|
|
11
12
|
flareUniforms?: Record<string, any>;
|
|
12
13
|
};
|
|
13
|
-
export default function Sun({ radius, coronaScale, coreUniforms, coronaUniforms, flareUniforms, }: SunProps): import("react").JSX.Element;
|
|
14
|
+
export default function Sun({ radius, coronaScale, coreUniforms, coronaUniforms, flareUniforms, onObjectReady, onObjectDispose, }: SunProps): import("react").JSX.Element;
|
|
14
15
|
export {};
|
|
15
16
|
//# sourceMappingURL=Sun.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sun.d.ts","sourceRoot":"","sources":["../../src/components/Sun.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Sun.d.ts","sourceRoot":"","sources":["../../src/components/Sun.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,KAAK,QAAQ,GAAG,gBAAgB,GAAG;IAC/B,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACvC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,GAAG,CAAC,EAAE,MAAU,EAAE,WAAkB,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,GAAG,EAAE,QAAQ,+BAIrJ"}
|
package/dist/components/Sun.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
4
|
// import { ReactNode } from "react";
|
|
3
5
|
import SunCore from "./SunCore.js";
|
|
4
|
-
import Corona from "./Corona.js";
|
|
5
|
-
export default function Sun({ radius = 1, coronaScale = 1.25, coreUniforms, coronaUniforms, flareUniforms, }) {
|
|
6
|
-
|
|
6
|
+
import Corona from "./effects/Corona.js";
|
|
7
|
+
export default function Sun({ radius = 1, coronaScale = 1.25, coreUniforms, coronaUniforms, flareUniforms, onObjectReady, onObjectDispose, }) {
|
|
8
|
+
const rootRef = useRef(null);
|
|
9
|
+
useObjectReady(rootRef, { radius, coronaScale }, onObjectReady, onObjectDispose);
|
|
10
|
+
return (_jsxs("group", { ref: rootRef, children: [_jsx(SunCore, { radius: radius, uniforms: coreUniforms }), _jsx(Corona, { radius: radius, shellScale: coronaScale, uniforms: coronaUniforms }), _jsx("pointLight", { color: "#ffa544", intensity: 6, distance: 60, decay: 1.6 })] }));
|
|
7
11
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import type * as THREE from "three";
|
|
2
3
|
declare global {
|
|
3
4
|
namespace JSX {
|
|
@@ -6,7 +7,7 @@ declare global {
|
|
|
6
7
|
}
|
|
7
8
|
}
|
|
8
9
|
}
|
|
9
|
-
export type SunCoreProps = {
|
|
10
|
+
export type SunCoreProps = ObjectReadyProps & {
|
|
10
11
|
/** Radius of the core. Default 1. */
|
|
11
12
|
radius?: number;
|
|
12
13
|
/** Self-rotation speed in rad/s. Default 0.02. */
|
|
@@ -14,5 +15,5 @@ export type SunCoreProps = {
|
|
|
14
15
|
/** Uniform overrides for SunCoreMaterial (u_speed, u_cellScale, u_color1..5, ...). */
|
|
15
16
|
uniforms?: Record<string, number | THREE.Vector3 | number[]>;
|
|
16
17
|
};
|
|
17
|
-
export default function SunCore({ radius, rotationSpeed, uniforms }: SunCoreProps): import("react").JSX.Element;
|
|
18
|
+
export default function SunCore({ radius, rotationSpeed, uniforms, onObjectReady, onObjectDispose }: SunCoreProps): import("react").JSX.Element;
|
|
18
19
|
//# sourceMappingURL=SunCore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SunCore.d.ts","sourceRoot":"","sources":["../../src/components/SunCore.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SunCore.d.ts","sourceRoot":"","sources":["../../src/components/SunCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAGpC,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,GAAG,CAAC;QACV,UAAU,iBAAiB;YACvB,eAAe,EAAE,GAAG,CAAC;SACxB;KACJ;CACJ;AAED,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG;IAC1C,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,EAAE,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,MAAU,EAAE,aAAoB,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,YAAY,+BAW3H"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
3
|
import { useRef } from "react";
|
|
3
4
|
import { useFrame } from "@react-three/fiber";
|
|
4
|
-
export default function SunCore({ radius = 1, rotationSpeed = 0.02, uniforms }) {
|
|
5
|
+
export default function SunCore({ radius = 1, rotationSpeed = 0.02, uniforms, onObjectReady, onObjectDispose }) {
|
|
5
6
|
const meshRef = useRef(null);
|
|
7
|
+
useObjectReady(meshRef, { radius, rotationSpeed, uniforms }, onObjectReady, onObjectDispose);
|
|
6
8
|
// drei's shaderMaterial exposes each uniform as a property on the instance.
|
|
7
9
|
const matRef = useRef(null);
|
|
8
10
|
useFrame((_, delta) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import * as THREE from 'three';
|
|
2
3
|
import React from "react";
|
|
3
4
|
import type { TimeSettings } from "@3driseai/3drise-core";
|
|
4
|
-
export interface SunLightProps {
|
|
5
|
+
export interface SunLightProps extends ObjectReadyProps {
|
|
5
6
|
visible?: boolean;
|
|
6
7
|
timeSettings: TimeSettings;
|
|
7
8
|
targetPosition?: THREE.Vector3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SunLight.d.ts","sourceRoot":"","sources":["../../src/components/SunLight.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"SunLight.d.ts","sourceRoot":"","sources":["../../src/components/SunLight.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACnD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAaD,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA0CrC,CAAC;AACF,eAAe,QAAQ,CAAC"}
|
|
@@ -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, useCallback } from 'react';
|
|
3
4
|
import * as THREE from 'three';
|
|
4
5
|
import { useSkySystem } from '../hooks/useSkySystem.js';
|
|
@@ -12,8 +13,9 @@ const SUNRISE = 6;
|
|
|
12
13
|
const SUNSET = 21;
|
|
13
14
|
const DARKNESS_START = 20.42;
|
|
14
15
|
const DARKNESS_END = 6.58;
|
|
15
|
-
const SunLight = ({ visible = true, timeSettings, targetPosition = new THREE.Vector3(0, 0, 0), shadowDistance = 300, intensity: intensityMultiplier = 1, castShadow = true, shadowMapSize = 2048, }) => {
|
|
16
|
+
const SunLight = ({ visible = true, timeSettings, targetPosition = new THREE.Vector3(0, 0, 0), shadowDistance = 300, intensity: intensityMultiplier = 1, castShadow = true, shadowMapSize = 2048, onObjectReady, onObjectDispose, }) => {
|
|
16
17
|
const lightRef = useRef(null);
|
|
18
|
+
useObjectReady(lightRef, { visible, timeSettings, intensity: intensityMultiplier, castShadow, shadowMapSize }, onObjectReady, onObjectDispose);
|
|
17
19
|
const colorRef = useRef(new THREE.Color(0xffe5b0));
|
|
18
20
|
const targetColorRef = useRef(new THREE.Color(0xffe5b0));
|
|
19
21
|
const intensityRef = useRef(1);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import type { TextSettings } from '@3driseai/3drise-core';
|
|
2
3
|
import React from "react";
|
|
3
|
-
export interface Text2DProps {
|
|
4
|
+
export interface Text2DProps extends ObjectReadyProps {
|
|
4
5
|
textSettings: TextSettings;
|
|
5
6
|
onTextClick?: (textSettings: TextSettings) => void;
|
|
6
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text2D.d.ts","sourceRoot":"","sources":["../../src/components/Text2D.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Text2D.d.ts","sourceRoot":"","sources":["../../src/components/Text2D.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAM7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACjD,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;CACtD;AAGD,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAgDjC,CAAC;AACF,eAAe,MAAM,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
2
3
|
import { useRef, useState, useCallback, useMemo } from 'react';
|
|
3
4
|
import { useFrame } from '@react-three/fiber';
|
|
4
5
|
import { Text, useCursor } from '@react-three/drei';
|
|
5
6
|
import { createDefaultEffectState, applyTransformEffects } from '@3driseai/3drise-core';
|
|
6
7
|
import { fontManager } from '@3driseai/3drise-core';
|
|
7
8
|
import { getTextEffectProps } from '../utils/textEffects.js';
|
|
8
|
-
const Text2D = ({ textSettings, onTextClick }) => {
|
|
9
|
+
const Text2D = ({ textSettings, onTextClick, onObjectReady, onObjectDispose }) => {
|
|
9
10
|
const groupRef = useRef(null);
|
|
11
|
+
useObjectReady(groupRef, textSettings, onObjectReady, onObjectDispose);
|
|
10
12
|
const textRef = useRef(null);
|
|
11
13
|
const [hovered, setHovered] = useState(false);
|
|
12
14
|
const [clicked, setClicked] = useState(false);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import React from "react";
|
|
2
3
|
import type { TextSettings } from "@3driseai/3drise-core";
|
|
3
4
|
import type { LetterData } from "./Letter";
|
|
4
|
-
export interface Text3DProps {
|
|
5
|
+
export interface Text3DProps extends ObjectReadyProps {
|
|
5
6
|
textSettings: TextSettings;
|
|
6
7
|
onLetterClick?: (letterData: LetterData) => void;
|
|
7
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text3D.d.ts","sourceRoot":"","sources":["../../src/components/Text3D.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Text3D.d.ts","sourceRoot":"","sources":["../../src/components/Text3D.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACjD,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;CACpD;AAGD,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAIjC,CAAC;AACF,eAAe,MAAM,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import Letters from './Letters.js';
|
|
3
|
-
const Text3D = ({ textSettings, onLetterClick }) => {
|
|
3
|
+
const Text3D = ({ textSettings, onLetterClick, onObjectReady, onObjectDispose }) => {
|
|
4
4
|
const { config, materialSettings } = textSettings;
|
|
5
5
|
const { text } = config;
|
|
6
|
-
return (_jsx(Letters, { text: text, config: config, materialSettings: materialSettings, hoverSettings: { sensitivity: 0.5, applyToChildren: false }, transformEffects: textSettings.animations?.transform?.effects || [], onLetterClick: onLetterClick }));
|
|
6
|
+
return (_jsx(Letters, { text: text, config: config, materialSettings: materialSettings, hoverSettings: { sensitivity: 0.5, applyToChildren: false }, transformEffects: textSettings.animations?.transform?.effects || [], onLetterClick: onLetterClick, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }));
|
|
7
7
|
};
|
|
8
8
|
export default Text3D;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
3
|
import type { BufferGeometry } from "three";
|
|
3
4
|
import type { ThreeElements } from "@react-three/fiber";
|
|
4
|
-
export interface VolumePointsProps extends Omit<ThreeElements['points'], 'geometry'
|
|
5
|
+
export interface VolumePointsProps extends Omit<ThreeElements['points'], 'geometry'>, ObjectReadyProps {
|
|
5
6
|
/** Any closed host geometry to fill with interior points. */
|
|
6
7
|
geometry: BufferGeometry;
|
|
7
8
|
/** Target number of interior points. */
|
|
@@ -15,5 +16,5 @@ export interface VolumePointsProps extends Omit<ThreeElements['points'], 'geomet
|
|
|
15
16
|
*/
|
|
16
17
|
children?: ReactNode;
|
|
17
18
|
}
|
|
18
|
-
export declare function VolumePoints({ geometry, count, oversample, children, ...props }: VolumePointsProps): import("react").JSX.Element;
|
|
19
|
+
export declare function VolumePoints({ geometry, count, oversample, children, onObjectReady, onObjectDispose, ...props }: VolumePointsProps): import("react").JSX.Element;
|
|
19
20
|
//# sourceMappingURL=VolumePoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VolumePoints.d.ts","sourceRoot":"","sources":["../../src/components/VolumePoints.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VolumePoints.d.ts","sourceRoot":"","sources":["../../src/components/VolumePoints.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,EAAE,gBAAgB;IAClG,6DAA6D;IAC7D,QAAQ,EAAE,cAAc,CAAC;IACzB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AAGD,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,KAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,+BAOzI"}
|
|
@@ -1,8 +1,12 @@
|
|
|
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 { useVolumePoints } from '../hooks/useVolumePoints.js';
|
|
3
|
-
export function VolumePoints({ geometry, count = 8000, oversample, children, ...props }) {
|
|
5
|
+
export function VolumePoints({ geometry, count = 8000, oversample, children, onObjectReady, onObjectDispose, ...props }) {
|
|
6
|
+
const rootRef = useRef(null);
|
|
7
|
+
useObjectReady(rootRef, { count, oversample }, onObjectReady, onObjectDispose);
|
|
4
8
|
const pointsGeometry = useVolumePoints(geometry, count, { oversample });
|
|
5
9
|
if (!pointsGeometry)
|
|
6
10
|
return null;
|
|
7
|
-
return (_jsx("points", { geometry: pointsGeometry, ...props, children: children ?? _jsx("pointsMaterial", { size: 0.02, sizeAttenuation: true }) }));
|
|
11
|
+
return (_jsx("points", { ref: rootRef, geometry: pointsGeometry, ...props, children: children ?? _jsx("pointsMaterial", { size: 0.02, sizeAttenuation: true }) }));
|
|
8
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuraCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/AuraCursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuraCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/AuraCursor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAyB3D,CAAC;AACF,eAAe,UAAU,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
2
3
|
import { useMemo, useRef } from 'react';
|
|
3
4
|
import { useFrame } from '@react-three/fiber';
|
|
4
5
|
import AuraEffect from '../effects/AuraEffect.js';
|
|
5
|
-
const AuraCursor = ({ config, worldPosRef, idleMsRef, }) => {
|
|
6
|
+
const AuraCursor = ({ config, worldPosRef, idleMsRef, onObjectReady, onObjectDispose, }) => {
|
|
6
7
|
const groupRef = useRef(null);
|
|
8
|
+
useObjectReady(groupRef, config, onObjectReady, onObjectDispose);
|
|
7
9
|
const auraConfig = useMemo(() => ({
|
|
8
10
|
enabled: true,
|
|
9
11
|
intensity: config.intensity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuroraCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/AuroraCursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuroraCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/AuroraCursor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAsE1D,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAuI/D,CAAC;AACF,eAAe,YAAY,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
2
3
|
import { useEffect, useMemo, useRef } from 'react';
|
|
3
4
|
import { useFrame, useThree } from '@react-three/fiber';
|
|
4
5
|
import * as THREE from 'three';
|
|
@@ -70,7 +71,7 @@ const fragmentShader = /* glsl */ `
|
|
|
70
71
|
gl_FragColor = vec4(aurora, alpha);
|
|
71
72
|
}
|
|
72
73
|
`;
|
|
73
|
-
const AuroraCursor = ({ config, worldPosRef, hoverRef, idleMsRef, }) => {
|
|
74
|
+
const AuroraCursor = ({ config, worldPosRef, hoverRef, idleMsRef, onObjectReady, onObjectDispose, }) => {
|
|
74
75
|
const N = Math.min(MAX_TRAIL, Math.max(4, config.trailLength));
|
|
75
76
|
const { camera } = useThree();
|
|
76
77
|
// History positions (newest at index 0, oldest at N-1)
|
|
@@ -132,6 +133,8 @@ const AuroraCursor = ({ config, worldPosRef, hoverRef, idleMsRef, }) => {
|
|
|
132
133
|
}, [config.color, config.opacity, config.flowSpeed, material]);
|
|
133
134
|
useEffect(() => () => { geometry.dispose(); material.dispose(); }, [geometry, material]);
|
|
134
135
|
const firstFrame = useRef(true);
|
|
136
|
+
const rootRef = useRef(null);
|
|
137
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
135
138
|
const tmpTangent = useMemo(() => new THREE.Vector3(), []);
|
|
136
139
|
const tmpToCam = useMemo(() => new THREE.Vector3(), []);
|
|
137
140
|
const tmpSide = useMemo(() => new THREE.Vector3(), []);
|
|
@@ -202,6 +205,6 @@ const AuroraCursor = ({ config, worldPosRef, hoverRef, idleMsRef, }) => {
|
|
|
202
205
|
geometry.attributes.aT.needsUpdate = true;
|
|
203
206
|
geometry.setDrawRange(0, (N - 1) * 6);
|
|
204
207
|
});
|
|
205
|
-
return _jsx("mesh", { geometry: geometry, material: material, frustumCulled: false });
|
|
208
|
+
return _jsx("mesh", { ref: rootRef, geometry: geometry, material: material, frustumCulled: false });
|
|
206
209
|
};
|
|
207
210
|
export default AuroraCursor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BubblesCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/BubblesCursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BubblesCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/BubblesCursor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AA6E1D,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAyGjE,CAAC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } 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 * as THREE from 'three';
|
|
@@ -77,7 +78,7 @@ const pointsFragmentShader = /* glsl */ `
|
|
|
77
78
|
gl_FragColor = vec4(col * (1.0 + spec + popFlash), alpha);
|
|
78
79
|
}
|
|
79
80
|
`;
|
|
80
|
-
const BubblesCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef, }) => {
|
|
81
|
+
const BubblesCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef, onObjectReady, onObjectDispose, }) => {
|
|
81
82
|
const positions = useMemo(() => new Float32Array(MAX_BUBBLES * 3), []);
|
|
82
83
|
const velocities = useMemo(() => new Float32Array(MAX_BUBBLES * 3), []);
|
|
83
84
|
const ages = useMemo(() => new Float32Array(MAX_BUBBLES), []);
|
|
@@ -119,6 +120,8 @@ const BubblesCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef,
|
|
|
119
120
|
}, [config.color, config.scale, config.opacity, config.iridescence, material]);
|
|
120
121
|
useEffect(() => () => { geometry.dispose(); material.dispose(); }, [geometry, material]);
|
|
121
122
|
const spawnAccum = useRef(0);
|
|
123
|
+
const rootRef = useRef(null);
|
|
124
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
122
125
|
const startTime = useRef(0);
|
|
123
126
|
useFrame((state, delta) => {
|
|
124
127
|
material.uniforms.uTime.value = state.clock.getElapsedTime();
|
|
@@ -179,6 +182,6 @@ const BubblesCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef,
|
|
|
179
182
|
geometry.attributes.aBaseSize.needsUpdate = true;
|
|
180
183
|
geometry.attributes.aPhase.needsUpdate = true;
|
|
181
184
|
});
|
|
182
|
-
return _jsx("points", { geometry: geometry, material: material, frustumCulled: false });
|
|
185
|
+
return _jsx("points", { ref: rootRef, geometry: geometry, material: material, frustumCulled: false });
|
|
183
186
|
};
|
|
184
187
|
export default BubblesCursor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CometCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/CometCursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CometCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/CometCursor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AA2D1D,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAqI7D,CAAC;AACF,eAAe,WAAW,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
2
3
|
import { useEffect, useMemo, useRef } from 'react';
|
|
3
4
|
import { useFrame } from '@react-three/fiber';
|
|
4
5
|
import * as THREE from 'three';
|
|
@@ -59,8 +60,10 @@ const impactVert = /* glsl */ `
|
|
|
59
60
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
60
61
|
}
|
|
61
62
|
`;
|
|
62
|
-
const CometCursor = ({ config, worldPosRef, hoverRef, idleMsRef, }) => {
|
|
63
|
+
const CometCursor = ({ config, worldPosRef, hoverRef, idleMsRef, onObjectReady, onObjectDispose, }) => {
|
|
63
64
|
// Packed newest-first layout: slot 0 = newest, slot count-1 = oldest.
|
|
65
|
+
const ref = useRef(null);
|
|
66
|
+
useObjectReady(ref, config, onObjectReady, onObjectDispose);
|
|
64
67
|
const positions = useMemo(() => new Float32Array(MAX_TRAIL * 3), []);
|
|
65
68
|
const indices = useMemo(() => {
|
|
66
69
|
const arr = new Float32Array(MAX_TRAIL);
|
|
@@ -186,6 +189,6 @@ const CometCursor = ({ config, worldPosRef, hoverRef, idleMsRef, }) => {
|
|
|
186
189
|
impact.visible = impactOpacity.current > 0.005;
|
|
187
190
|
}
|
|
188
191
|
});
|
|
189
|
-
return (_jsxs(
|
|
192
|
+
return (_jsxs("group", { ref: ref, children: [_jsx("points", { geometry: geometry, material: material, frustumCulled: false }), _jsx("mesh", { ref: impactRef, geometry: impactGeom, material: impactMat, visible: false })] }));
|
|
190
193
|
};
|
|
191
194
|
export default CometCursor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrosshairCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/CrosshairCursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CrosshairCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/CrosshairCursor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAe1D,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAqIrE,CAAC;AACF,eAAe,eAAe,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
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 * as THREE from 'three';
|
|
@@ -15,8 +16,10 @@ function hasValidPositions(geo) {
|
|
|
15
16
|
}
|
|
16
17
|
return true;
|
|
17
18
|
}
|
|
18
|
-
const CrosshairCursor = ({ config, worldPosRef, hoverRef, idleMsRef, }) => {
|
|
19
|
+
const CrosshairCursor = ({ config, worldPosRef, hoverRef, idleMsRef, onObjectReady, onObjectDispose, }) => {
|
|
19
20
|
// Billboarded reticle group (ring + ticks)
|
|
21
|
+
const ref = useRef(null);
|
|
22
|
+
useObjectReady(ref, config, onObjectReady, onObjectDispose);
|
|
20
23
|
const reticleRef = useRef(null);
|
|
21
24
|
const ringRef = useRef(null);
|
|
22
25
|
// World-space outline group (NOT billboarded) for the hovered object outline
|
|
@@ -137,6 +140,6 @@ const CrosshairCursor = ({ config, worldPosRef, hoverRef, idleMsRef, }) => {
|
|
|
137
140
|
ringMat.opacity = config.opacity * (0.4 + 0.6 * idleFactor);
|
|
138
141
|
tickMat.opacity = config.opacity * (0.4 + 0.6 * idleFactor);
|
|
139
142
|
});
|
|
140
|
-
return (_jsxs(
|
|
143
|
+
return (_jsxs("group", { ref: ref, children: [_jsxs("group", { ref: reticleRef, children: [_jsx("mesh", { ref: ringRef, geometry: ringGeom, material: ringMat }), _jsx("lineSegments", { geometry: tickGeom, material: tickMat })] }), _jsx("group", { ref: outlineGroupRef, children: _jsx("lineSegments", { ref: outlineRef, material: outlineMat, visible: false }) })] }));
|
|
141
144
|
};
|
|
142
145
|
export default CrosshairCursor;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import type { ClickActionConfig } from "@3driseai/3drise-core";
|
|
3
|
-
export interface CursorActionsProps {
|
|
4
|
+
export interface CursorActionsProps extends ObjectReadyProps {
|
|
4
5
|
clickActions?: ClickActionConfig[];
|
|
5
6
|
}
|
|
6
7
|
declare const CursorActions: React.FC<CursorActionsProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorActions.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/CursorActions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CursorActions.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/CursorActions.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAA4B,MAAM,OAAO,CAAC;AAYjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IACxD,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACtC;AAWD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsG/C,CAAC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
2
3
|
import React, { useEffect, useRef } from 'react';
|
|
3
4
|
import { useFrame, useThree } from '@react-three/fiber';
|
|
4
5
|
import * as THREE from 'three';
|
|
@@ -19,12 +20,13 @@ const CLICK_PLANE_DISTANCE = 8;
|
|
|
19
20
|
// orthographic (no fov) as a sensible fallback.
|
|
20
21
|
const ORTHO_FALLBACK_HALF_HEIGHT = CLICK_PLANE_DISTANCE * 0.5;
|
|
21
22
|
let clickIdCounter = 0;
|
|
22
|
-
const CursorActions = ({ clickActions = [] }) => {
|
|
23
|
+
const CursorActions = ({ clickActions = [], onObjectReady, onObjectDispose }) => {
|
|
23
24
|
const { camera, gl } = useThree();
|
|
24
25
|
// Group that mirrors the camera each frame so any child rendered inside it
|
|
25
26
|
// appears at a fixed offset from the camera in world space — i.e., as if it
|
|
26
27
|
// were a 2D HUD overlay anchored to the screen.
|
|
27
28
|
const followGroupRef = useRef(null);
|
|
29
|
+
useObjectReady(followGroupRef, clickActions, onObjectReady, onObjectDispose);
|
|
28
30
|
// Pending one-shot click action instances. Each entry maps to one rendered
|
|
29
31
|
// child that self-disposes via onDone.
|
|
30
32
|
const [pendingClicks, setPendingClicks] = React.useState([]);
|
|
@@ -99,23 +101,23 @@ const CursorActions = ({ clickActions = [] }) => {
|
|
|
99
101
|
// position in screen-anchored space.
|
|
100
102
|
switch (ca.type) {
|
|
101
103
|
case 'shockwave':
|
|
102
|
-
return _jsx(ShockwaveAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id) }, pc.id);
|
|
104
|
+
return _jsx(ShockwaveAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id), onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, pc.id);
|
|
103
105
|
case 'sparklesBurst':
|
|
104
|
-
return _jsx(SparklesBurstAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id) }, pc.id);
|
|
106
|
+
return _jsx(SparklesBurstAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id), onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, pc.id);
|
|
105
107
|
case 'boltFlash':
|
|
106
|
-
return _jsx(BoltFlashAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id) }, pc.id);
|
|
108
|
+
return _jsx(BoltFlashAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id), onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, pc.id);
|
|
107
109
|
case 'plasmaBomb':
|
|
108
|
-
return _jsx(PlasmaBombAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id) }, pc.id);
|
|
110
|
+
return _jsx(PlasmaBombAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id), onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, pc.id);
|
|
109
111
|
case 'realityTear':
|
|
110
|
-
return _jsx(RealityTearAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id) }, pc.id);
|
|
112
|
+
return _jsx(RealityTearAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id), onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, pc.id);
|
|
111
113
|
case 'implosion':
|
|
112
|
-
return _jsx(ImplosionAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id) }, pc.id);
|
|
114
|
+
return _jsx(ImplosionAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id), onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, pc.id);
|
|
113
115
|
case 'voronoiFracture':
|
|
114
|
-
return _jsx(VoronoiFractureAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id) }, pc.id);
|
|
116
|
+
return _jsx(VoronoiFractureAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id), onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, pc.id);
|
|
115
117
|
case 'phaseShift':
|
|
116
|
-
return _jsx(PhaseShiftAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id) }, pc.id);
|
|
118
|
+
return _jsx(PhaseShiftAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id), onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, pc.id);
|
|
117
119
|
case 'glyphInscription':
|
|
118
|
-
return _jsx(GlyphInscriptionAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id) }, pc.id);
|
|
120
|
+
return _jsx(GlyphInscriptionAction, { worldPos: pc.localPos, config: ca, onDone: () => removeClick(pc.id), onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, pc.id);
|
|
119
121
|
default:
|
|
120
122
|
return null;
|
|
121
123
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
1
2
|
import React from "react";
|
|
2
3
|
import type { CursorConfig, ClickActionConfig } from "@3driseai/3drise-core";
|
|
3
4
|
export type { CursorTypeProps } from './CursorEffects';
|
|
4
|
-
export interface CursorControllerProps {
|
|
5
|
+
export interface CursorControllerProps extends ObjectReadyProps {
|
|
5
6
|
effects?: CursorConfig[];
|
|
6
7
|
clickActions?: ClickActionConfig[];
|
|
7
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorController.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/CursorController.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CursorController.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/CursorController.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC3D,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACtC;AAGD,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAAqS,CAAC;AAC5V,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import CursorEffects from './CursorEffects.js';
|
|
3
3
|
import CursorActions from './CursorActions.js';
|
|
4
|
-
const CursorController = ({ effects = [], clickActions = [], }) => (_jsxs(_Fragment, { children: [_jsx(CursorEffects, { effects: effects }), _jsx(CursorActions, { clickActions: clickActions })] }));
|
|
4
|
+
const CursorController = ({ effects = [], clickActions = [], onObjectReady, onObjectDispose, }) => (_jsxs(_Fragment, { children: [_jsx(CursorEffects, { effects: effects, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }), _jsx(CursorActions, { clickActions: clickActions, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })] }));
|
|
5
5
|
export default CursorController;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
1
2
|
import * as THREE from 'three';
|
|
2
3
|
import React from "react";
|
|
3
4
|
import type { CursorConfig } from "@3driseai/3drise-core";
|
|
4
|
-
export interface CursorTypeProps<C extends CursorConfig = CursorConfig> {
|
|
5
|
+
export interface CursorTypeProps<C extends CursorConfig = CursorConfig> extends ObjectReadyProps {
|
|
5
6
|
config: C;
|
|
6
7
|
worldPosRef: React.RefObject<THREE.Vector3>;
|
|
7
8
|
velocityRef: React.RefObject<THREE.Vector3>;
|
|
8
9
|
hoverRef: React.RefObject<THREE.Intersection | null>;
|
|
9
10
|
idleMsRef: React.RefObject<number>;
|
|
10
11
|
}
|
|
11
|
-
export interface CursorEffectsProps {
|
|
12
|
+
export interface CursorEffectsProps extends ObjectReadyProps {
|
|
12
13
|
effects?: CursorConfig[];
|
|
13
14
|
}
|
|
14
15
|
declare const CursorEffects: React.FC<CursorEffectsProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorEffects.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/CursorEffects.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CursorEffects.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/CursorEffects.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CAAE,SAAQ,gBAAgB;IAC5F,MAAM,EAAE,CAAC,CAAC;IACV,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5C,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IACrD,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IACxD,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;CAC5B;AAWD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAoF/C,CAAC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -24,7 +24,7 @@ const createTickState = () => ({
|
|
|
24
24
|
idleMsRef: { current: 0 },
|
|
25
25
|
firstFrameRef: { current: true },
|
|
26
26
|
});
|
|
27
|
-
const CursorEffects = ({ effects = [] }) => {
|
|
27
|
+
const CursorEffects = ({ effects = [], onObjectReady, onObjectDispose }) => {
|
|
28
28
|
const { camera, gl, scene, raycaster, pointer } = useThree();
|
|
29
29
|
// Per-effect ref bundles. Indexed by effect position. Grows/shrinks as the
|
|
30
30
|
// effects array length changes, but individual entries are stable so the
|
|
@@ -83,6 +83,8 @@ const CursorEffects = ({ effects = [] }) => {
|
|
|
83
83
|
if (!s)
|
|
84
84
|
return null;
|
|
85
85
|
const shared = {
|
|
86
|
+
onObjectReady,
|
|
87
|
+
onObjectDispose,
|
|
86
88
|
worldPosRef: s.worldPosRef,
|
|
87
89
|
velocityRef: s.velocityRef,
|
|
88
90
|
hoverRef: s.hoverRef,
|