@3driseai/3drise-viewer 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AnimatedObject.d.ts +2 -1
- package/dist/components/AnimatedObject.d.ts.map +1 -1
- package/dist/components/AnimatedObject.js +11 -3
- package/dist/components/Bubbles.d.ts +2 -1
- package/dist/components/Bubbles.d.ts.map +1 -1
- package/dist/components/Bubbles.js +5 -2
- package/dist/components/CameraController.d.ts +9 -1
- package/dist/components/CameraController.d.ts.map +1 -1
- package/dist/components/CameraController.js +12 -1
- package/dist/components/Clouds.d.ts +2 -1
- package/dist/components/Clouds.d.ts.map +1 -1
- package/dist/components/Clouds.js +3 -1
- package/dist/components/CreatedObject.d.ts +2 -2
- package/dist/components/CreatedObject.d.ts.map +1 -1
- package/dist/components/CreatedObject.js +5 -6
- package/dist/components/CustomPrimitive.d.ts +2 -2
- package/dist/components/CustomPrimitive.d.ts.map +1 -1
- package/dist/components/CustomPrimitive.js +6 -2
- package/dist/components/Earth.d.ts +2 -4
- package/dist/components/Earth.d.ts.map +1 -1
- package/dist/components/Earth.js +6 -4
- package/dist/components/EffectsGenerator.d.ts +2 -1
- package/dist/components/EffectsGenerator.d.ts.map +1 -1
- package/dist/components/EffectsGenerator.js +26 -25
- package/dist/components/EffectsGroup.d.ts +2 -1
- package/dist/components/EffectsGroup.d.ts.map +1 -1
- package/dist/components/EffectsGroup.js +7 -2
- package/dist/components/EnvironmentManager.js +2 -2
- package/dist/components/EnvironmentObject.d.ts +2 -1
- package/dist/components/EnvironmentObject.d.ts.map +1 -1
- package/dist/components/EnvironmentObject.js +2 -2
- package/dist/components/Frame.d.ts +3 -2
- package/dist/components/Frame.d.ts.map +1 -1
- package/dist/components/Frame.js +3 -1
- package/dist/components/Galaxy.d.ts +2 -3
- package/dist/components/Galaxy.d.ts.map +1 -1
- package/dist/components/Galaxy.js +10 -10
- package/dist/components/GalleryLayout.d.ts +2 -1
- package/dist/components/GalleryLayout.d.ts.map +1 -1
- package/dist/components/GalleryLayout.js +3 -1
- package/dist/components/GeometryShape.d.ts +4 -6
- package/dist/components/GeometryShape.d.ts.map +1 -1
- package/dist/components/GeometryShape.js +50 -31
- package/dist/components/Glyphs.d.ts +2 -1
- package/dist/components/Glyphs.d.ts.map +1 -1
- package/dist/components/Glyphs.js +6 -2
- package/dist/components/GridHelper.d.ts +2 -1
- package/dist/components/GridHelper.d.ts.map +1 -1
- package/dist/components/GridHelper.js +3 -1
- package/dist/components/GridsGenerator.d.ts +2 -1
- package/dist/components/GridsGenerator.d.ts.map +1 -1
- package/dist/components/GridsGenerator.js +12 -4
- package/dist/components/HdrPlaylistRenderer.d.ts +2 -1
- package/dist/components/HdrPlaylistRenderer.d.ts.map +1 -1
- package/dist/components/HdrPlaylistRenderer.js +3 -1
- package/dist/components/Lensflare.d.ts +2 -1
- package/dist/components/Lensflare.d.ts.map +1 -1
- package/dist/components/Lensflare.js +3 -1
- package/dist/components/Letter.d.ts +3 -2
- package/dist/components/Letter.d.ts.map +1 -1
- package/dist/components/Letter.js +3 -1
- package/dist/components/Letters.d.ts +3 -2
- package/dist/components/Letters.d.ts.map +1 -1
- package/dist/components/Letters.js +3 -1
- package/dist/components/LightObject.d.ts +2 -1
- package/dist/components/LightObject.d.ts.map +1 -1
- package/dist/components/LightObject.js +11 -7
- package/dist/components/LightsManager.d.ts +2 -1
- package/dist/components/LightsManager.d.ts.map +1 -1
- package/dist/components/LightsManager.js +6 -3
- package/dist/components/Lines.d.ts +2 -1
- package/dist/components/Lines.d.ts.map +1 -1
- package/dist/components/Lines.js +2 -2
- package/dist/components/Moon.d.ts +2 -3
- package/dist/components/Moon.d.ts.map +1 -1
- package/dist/components/Moon.js +6 -4
- package/dist/components/MyGrid.d.ts +3 -2
- package/dist/components/MyGrid.d.ts.map +1 -1
- package/dist/components/MyGrid.js +5 -2
- package/dist/components/ObjectNode.d.ts +2 -2
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +29 -24
- package/dist/components/ObjectNodeApi.d.ts +2 -2
- package/dist/components/ObjectNodeApi.d.ts.map +1 -1
- package/dist/components/ObjectNodeApi.js +2 -2
- package/dist/components/ObjectsRenderer.d.ts +2 -1
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +15 -4
- package/dist/components/ObjectsRendererApi.d.ts +2 -1
- package/dist/components/ObjectsRendererApi.d.ts.map +1 -1
- package/dist/components/ObjectsRendererApi.js +2 -2
- package/dist/components/Ocean.d.ts +2 -1
- package/dist/components/Ocean.d.ts.map +1 -1
- package/dist/components/Ocean.js +3 -1
- package/dist/components/Outline.d.ts +3 -2
- package/dist/components/Outline.d.ts.map +1 -1
- package/dist/components/Outline.js +6 -2
- package/dist/components/ParticlesR3f.d.ts +2 -1
- package/dist/components/ParticlesR3f.d.ts.map +1 -1
- package/dist/components/ParticlesR3f.js +3 -1
- package/dist/components/Path.d.ts +2 -1
- package/dist/components/Path.d.ts.map +1 -1
- package/dist/components/Path.js +14 -3
- package/dist/components/PathGeometry.d.ts +2 -1
- package/dist/components/PathGeometry.d.ts.map +1 -1
- package/dist/components/PathGeometry.js +6 -2
- package/dist/components/PathRenderer.d.ts +2 -1
- package/dist/components/PathRenderer.d.ts.map +1 -1
- package/dist/components/PathRenderer.js +6 -2
- package/dist/components/Planet.d.ts +2 -3
- package/dist/components/Planet.d.ts.map +1 -1
- package/dist/components/Planet.js +6 -4
- package/dist/components/PointCloud.d.ts +2 -1
- package/dist/components/PointCloud.d.ts.map +1 -1
- package/dist/components/PointCloud.js +3 -1
- package/dist/components/ProjectLoader.d.ts +2 -1
- package/dist/components/ProjectLoader.d.ts.map +1 -1
- package/dist/components/ProjectLoader.js +6 -3
- package/dist/components/Rain.d.ts +2 -1
- package/dist/components/Rain.d.ts.map +1 -1
- package/dist/components/Rain.js +7 -1
- package/dist/components/SceneBuilder.d.ts +2 -1
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +2 -2
- package/dist/components/ShootingStar.d.ts +2 -1
- package/dist/components/ShootingStar.d.ts.map +1 -1
- package/dist/components/ShootingStar.js +5 -2
- package/dist/components/ShootingStars.d.ts +2 -1
- package/dist/components/ShootingStars.d.ts.map +1 -1
- package/dist/components/ShootingStars.js +2 -2
- package/dist/components/SkyController.d.ts +3 -2
- package/dist/components/SkyController.d.ts.map +1 -1
- package/dist/components/SkyController.js +9 -6
- package/dist/components/SkyMesh.d.ts +2 -3
- package/dist/components/SkyMesh.d.ts.map +1 -1
- package/dist/components/SkyMesh.js +3 -5
- package/dist/components/SkySystem.d.ts +2 -1
- package/dist/components/SkySystem.d.ts.map +1 -1
- package/dist/components/SkySystem.js +6 -2
- package/dist/components/Skybox.d.ts +2 -1
- package/dist/components/Skybox.d.ts.map +1 -1
- package/dist/components/Skybox.js +5 -2
- package/dist/components/SolarSystem.d.ts +2 -4
- package/dist/components/SolarSystem.d.ts.map +1 -1
- package/dist/components/SolarSystem.js +3 -1
- package/dist/components/SparklesBurst.d.ts +2 -1
- package/dist/components/SparklesBurst.d.ts.map +1 -1
- package/dist/components/SparklesBurst.js +5 -2
- package/dist/components/Stars.d.ts +2 -3
- package/dist/components/Stars.d.ts.map +1 -1
- package/dist/components/Stars.js +3 -2
- package/dist/components/Sun.d.ts +3 -2
- package/dist/components/Sun.d.ts.map +1 -1
- package/dist/components/Sun.js +7 -3
- package/dist/components/SunCore.d.ts +3 -2
- package/dist/components/SunCore.d.ts.map +1 -1
- package/dist/components/SunCore.js +3 -1
- package/dist/components/SunLight.d.ts +2 -1
- package/dist/components/SunLight.d.ts.map +1 -1
- package/dist/components/SunLight.js +3 -1
- package/dist/components/Text2D.d.ts +2 -1
- package/dist/components/Text2D.d.ts.map +1 -1
- package/dist/components/Text2D.js +3 -1
- package/dist/components/Text3D.d.ts +2 -1
- package/dist/components/Text3D.d.ts.map +1 -1
- package/dist/components/Text3D.js +2 -2
- package/dist/components/VolumePoints.d.ts +3 -2
- package/dist/components/VolumePoints.d.ts.map +1 -1
- package/dist/components/VolumePoints.js +6 -2
- package/dist/components/cursor/AuraCursor.d.ts.map +1 -1
- package/dist/components/cursor/AuraCursor.js +3 -1
- package/dist/components/cursor/AuroraCursor.d.ts.map +1 -1
- package/dist/components/cursor/AuroraCursor.js +5 -2
- package/dist/components/cursor/BubblesCursor.d.ts.map +1 -1
- package/dist/components/cursor/BubblesCursor.js +5 -2
- package/dist/components/cursor/CometCursor.d.ts.map +1 -1
- package/dist/components/cursor/CometCursor.js +6 -3
- package/dist/components/cursor/CrosshairCursor.d.ts.map +1 -1
- package/dist/components/cursor/CrosshairCursor.js +6 -3
- package/dist/components/cursor/CursorActions.d.ts +2 -1
- package/dist/components/cursor/CursorActions.d.ts.map +1 -1
- package/dist/components/cursor/CursorActions.js +12 -10
- package/dist/components/cursor/CursorController.d.ts +2 -1
- package/dist/components/cursor/CursorController.d.ts.map +1 -1
- package/dist/components/cursor/CursorController.js +1 -1
- package/dist/components/cursor/CursorEffects.d.ts +3 -2
- package/dist/components/cursor/CursorEffects.d.ts.map +1 -1
- package/dist/components/cursor/CursorEffects.js +3 -1
- package/dist/components/cursor/FerrofluidCursor.d.ts.map +1 -1
- package/dist/components/cursor/FerrofluidCursor.js +3 -1
- package/dist/components/cursor/GlyphRingCursor.d.ts.map +1 -1
- package/dist/components/cursor/GlyphRingCursor.js +3 -1
- package/dist/components/cursor/LightningCursor.d.ts.map +1 -1
- package/dist/components/cursor/LightningCursor.js +3 -1
- package/dist/components/cursor/LiquidMetalCursor.d.ts.map +1 -1
- package/dist/components/cursor/LiquidMetalCursor.js +3 -1
- package/dist/components/cursor/OrbCursor.d.ts.map +1 -1
- package/dist/components/cursor/OrbCursor.js +3 -1
- package/dist/components/cursor/PlasmaWhipCursor.d.ts.map +1 -1
- package/dist/components/cursor/PlasmaWhipCursor.js +3 -1
- package/dist/components/cursor/SparklesCursor.d.ts.map +1 -1
- package/dist/components/cursor/SparklesCursor.js +5 -2
- package/dist/components/cursor/TeslaCursor.d.ts.map +1 -1
- package/dist/components/cursor/TeslaCursor.js +6 -9
- package/dist/components/cursor/clickActions/BoltFlashAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/BoltFlashAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/BoltFlashAction.js +5 -2
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.js +3 -1
- package/dist/components/cursor/clickActions/ImplosionAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/ImplosionAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/ImplosionAction.js +3 -1
- package/dist/components/cursor/clickActions/PhaseShiftAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/PhaseShiftAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/PhaseShiftAction.js +5 -2
- package/dist/components/cursor/clickActions/PlasmaBombAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/PlasmaBombAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/PlasmaBombAction.js +5 -2
- package/dist/components/cursor/clickActions/RealityTearAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/RealityTearAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/RealityTearAction.js +3 -1
- package/dist/components/cursor/clickActions/ShockwaveAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/ShockwaveAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/ShockwaveAction.js +5 -2
- package/dist/components/cursor/clickActions/SparklesBurstAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/SparklesBurstAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/SparklesBurstAction.js +3 -1
- package/dist/components/cursor/clickActions/VoronoiFractureAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/VoronoiFractureAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/VoronoiFractureAction.js +3 -1
- package/dist/components/cursor/clickActions/index.d.ts +11 -0
- package/dist/components/cursor/clickActions/index.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/index.js +10 -0
- package/dist/components/cursor/index.d.ts +21 -0
- package/dist/components/cursor/index.d.ts.map +1 -0
- package/dist/components/cursor/index.js +19 -0
- package/dist/components/effects/AuraEffect.d.ts +2 -1
- package/dist/components/effects/AuraEffect.d.ts.map +1 -1
- package/dist/components/effects/AuraEffect.js +5 -2
- package/dist/components/effects/AuroraEffect.d.ts +2 -1
- package/dist/components/effects/AuroraEffect.d.ts.map +1 -1
- package/dist/components/effects/AuroraEffect.js +3 -1
- package/dist/components/effects/BlackHoleEffect.d.ts +2 -1
- package/dist/components/effects/BlackHoleEffect.d.ts.map +1 -1
- package/dist/components/effects/BlackHoleEffect.js +3 -1
- package/dist/components/effects/ConstellationEffect.d.ts +2 -1
- package/dist/components/effects/ConstellationEffect.d.ts.map +1 -1
- package/dist/components/effects/ConstellationEffect.js +3 -1
- package/dist/components/effects/Corona.d.ts +19 -0
- package/dist/components/effects/Corona.d.ts.map +1 -0
- package/dist/components/effects/Corona.js +15 -0
- package/dist/components/effects/DataStreamEffect.d.ts +2 -1
- package/dist/components/effects/DataStreamEffect.d.ts.map +1 -1
- package/dist/components/effects/DataStreamEffect.js +5 -2
- package/dist/components/effects/DnaHelixEffect.d.ts +2 -1
- package/dist/components/effects/DnaHelixEffect.d.ts.map +1 -1
- package/dist/components/effects/DnaHelixEffect.js +3 -1
- package/dist/components/effects/Fire.d.ts +3 -2
- package/dist/components/effects/Fire.d.ts.map +1 -1
- package/dist/components/effects/Fire.js +3 -1
- package/dist/components/effects/FireEffect.d.ts +2 -1
- package/dist/components/effects/FireEffect.d.ts.map +1 -1
- package/dist/components/effects/FireEffect.js +5 -2
- package/dist/components/effects/Flares.d.ts +25 -0
- package/dist/components/effects/Flares.d.ts.map +1 -0
- package/dist/components/effects/Flares.js +136 -0
- package/dist/components/effects/ForcefieldEffect.d.ts +2 -1
- package/dist/components/effects/ForcefieldEffect.d.ts.map +1 -1
- package/dist/components/effects/ForcefieldEffect.js +3 -1
- package/dist/components/effects/HologramEffect.d.ts +2 -1
- package/dist/components/effects/HologramEffect.d.ts.map +1 -1
- package/dist/components/effects/HologramEffect.js +5 -2
- package/dist/components/effects/IceCrystalsEffect.d.ts +2 -1
- package/dist/components/effects/IceCrystalsEffect.d.ts.map +1 -1
- package/dist/components/effects/IceCrystalsEffect.js +3 -1
- package/dist/components/effects/LightningEffect.d.ts +2 -1
- package/dist/components/effects/LightningEffect.d.ts.map +1 -1
- package/dist/components/effects/LightningEffect.js +5 -2
- package/dist/components/effects/MoleculesEffect.d.ts +2 -1
- package/dist/components/effects/MoleculesEffect.d.ts.map +1 -1
- package/dist/components/effects/MoleculesEffect.js +5 -2
- package/dist/components/effects/NeuralNetworkEffect.d.ts +2 -1
- package/dist/components/effects/NeuralNetworkEffect.d.ts.map +1 -1
- package/dist/components/effects/NeuralNetworkEffect.js +3 -1
- package/dist/components/effects/OrbEffect.d.ts +2 -1
- package/dist/components/effects/OrbEffect.d.ts.map +1 -1
- package/dist/components/effects/OrbEffect.js +5 -2
- package/dist/components/effects/PortalEffect.d.ts +2 -1
- package/dist/components/effects/PortalEffect.d.ts.map +1 -1
- package/dist/components/effects/PortalEffect.js +5 -2
- package/dist/components/effects/ShockwaveEffect.d.ts +2 -1
- package/dist/components/effects/ShockwaveEffect.d.ts.map +1 -1
- package/dist/components/effects/ShockwaveEffect.js +5 -2
- package/dist/components/effects/SmokePlumeEffect.d.ts +2 -1
- package/dist/components/effects/SmokePlumeEffect.d.ts.map +1 -1
- package/dist/components/effects/SmokePlumeEffect.js +5 -2
- package/dist/components/effects/SmokeRibbon.d.ts +3 -2
- package/dist/components/effects/SmokeRibbon.d.ts.map +1 -1
- package/dist/components/effects/SmokeRibbon.js +5 -2
- package/dist/components/effects/SmokeRingEffect.d.ts +2 -1
- package/dist/components/effects/SmokeRingEffect.d.ts.map +1 -1
- package/dist/components/effects/SmokeRingEffect.js +5 -2
- package/dist/components/effects/VolumetricFogEffect.d.ts +2 -1
- package/dist/components/effects/VolumetricFogEffect.d.ts.map +1 -1
- package/dist/components/effects/VolumetricFogEffect.js +5 -2
- package/dist/components/effects/index.d.ts +28 -0
- package/dist/components/effects/index.d.ts.map +1 -0
- package/dist/components/effects/index.js +24 -0
- package/dist/components/index.d.ts +112 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +77 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/hooks/index.d.ts +55 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +46 -1
- package/dist/hooks/useObjectReady.d.ts +29 -0
- package/dist/hooks/useObjectReady.d.ts.map +1 -0
- package/dist/hooks/useObjectReady.js +59 -0
- package/dist/index.d.ts +4 -135
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -108
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/objectReady.d.ts +24 -0
- package/dist/types/objectReady.d.ts.map +1 -0
- package/dist/types/objectReady.js +1 -0
- package/package.json +1 -1
|
@@ -1,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,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FerrofluidCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/FerrofluidCursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FerrofluidCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/FerrofluidCursor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAiGvE,CAAC;AACF,eAAe,gBAAgB,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 { useEffect, useMemo, useRef } from 'react';
|
|
3
4
|
import { useFrame } from '@react-three/fiber';
|
|
4
5
|
import * as THREE from 'three';
|
|
5
|
-
const FerrofluidCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef, }) => {
|
|
6
|
+
const FerrofluidCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef, onObjectReady, onObjectDispose, }) => {
|
|
6
7
|
const groupRef = useRef(null);
|
|
8
|
+
useObjectReady(groupRef, config, onObjectReady, onObjectDispose);
|
|
7
9
|
// Base sphere geometry (kept for original vertex positions)
|
|
8
10
|
const { geometry, basePositions } = useMemo(() => {
|
|
9
11
|
const baseRadius = 0.15 * config.scale;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlyphRingCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/GlyphRingCursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GlyphRingCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/GlyphRingCursor.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;AAyE1D,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,qBAAqB,CAAC,CA+CrE,CAAC;AACF,eAAe,eAAe,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';
|
|
@@ -73,8 +74,9 @@ const fragmentShader = /* glsl */ `
|
|
|
73
74
|
gl_FragColor = vec4(col, alpha);
|
|
74
75
|
}
|
|
75
76
|
`;
|
|
76
|
-
const GlyphRingCursor = ({ config, worldPosRef, hoverRef, idleMsRef, }) => {
|
|
77
|
+
const GlyphRingCursor = ({ config, worldPosRef, hoverRef, idleMsRef, onObjectReady, onObjectDispose, }) => {
|
|
77
78
|
const meshRef = useRef(null);
|
|
79
|
+
useObjectReady(meshRef, config, onObjectReady, onObjectDispose);
|
|
78
80
|
const { camera } = useThree();
|
|
79
81
|
const hoverSmooth = useRef(0);
|
|
80
82
|
const radius = Math.max(0.3, config.ringRadius * config.scale);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightningCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/LightningCursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LightningCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/LightningCursor.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,CAuBrE,CAAC;AACF,eAAe,eAAe,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 LightningEffect from '../effects/LightningEffect.js';
|
|
5
|
-
const LightningCursor = ({ config, worldPosRef, }) => {
|
|
6
|
+
const LightningCursor = ({ config, worldPosRef, onObjectReady, onObjectDispose, }) => {
|
|
6
7
|
const groupRef = useRef(null);
|
|
8
|
+
useObjectReady(groupRef, config, onObjectReady, onObjectDispose);
|
|
7
9
|
const lightningConfig = useMemo(() => ({
|
|
8
10
|
enabled: true,
|
|
9
11
|
intensity: config.intensity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidMetalCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/LiquidMetalCursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LiquidMetalCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/LiquidMetalCursor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,uBAAuB,CAAC,CAwDzE,CAAC;AACF,eAAe,iBAAiB,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 { useEffect, useMemo, useRef } from 'react';
|
|
3
4
|
import { useFrame } from '@react-three/fiber';
|
|
4
5
|
import * as THREE from 'three';
|
|
5
|
-
const LiquidMetalCursor = ({ config, worldPosRef, velocityRef, }) => {
|
|
6
|
+
const LiquidMetalCursor = ({ config, worldPosRef, velocityRef, onObjectReady, onObjectDispose, }) => {
|
|
6
7
|
const groupRef = useRef(null);
|
|
8
|
+
useObjectReady(groupRef, config, onObjectReady, onObjectDispose);
|
|
7
9
|
const meshRef = useRef(null);
|
|
8
10
|
const geometry = useMemo(() => new THREE.IcosahedronGeometry(0.18, 4), []);
|
|
9
11
|
const basePositions = useMemo(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrbCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/OrbCursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OrbCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/OrbCursor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,eAAe,CAAC,CA2BzD,CAAC;AACF,eAAe,SAAS,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 OrbEffect from '../effects/OrbEffect.js';
|
|
5
|
-
const OrbCursor = ({ config, worldPosRef, idleMsRef, }) => {
|
|
6
|
+
const OrbCursor = ({ config, worldPosRef, idleMsRef, onObjectReady, onObjectDispose, }) => {
|
|
6
7
|
const groupRef = useRef(null);
|
|
8
|
+
useObjectReady(groupRef, config, onObjectReady, onObjectDispose);
|
|
7
9
|
const orbConfig = useMemo(() => ({
|
|
8
10
|
enabled: true,
|
|
9
11
|
intensity: config.intensity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlasmaWhipCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/PlasmaWhipCursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PlasmaWhipCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/PlasmaWhipCursor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAiE1D,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAkEvE,CAAC;AACF,eAAe,gBAAgB,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';
|
|
@@ -65,7 +66,7 @@ const fragmentShader = /* glsl */ `
|
|
|
65
66
|
gl_FragColor = vec4(col, alpha);
|
|
66
67
|
}
|
|
67
68
|
`;
|
|
68
|
-
const PlasmaWhipCursor = ({ config, worldPosRef, hoverRef, idleMsRef, }) => {
|
|
69
|
+
const PlasmaWhipCursor = ({ config, worldPosRef, hoverRef, idleMsRef, onObjectReady, onObjectDispose, }) => {
|
|
69
70
|
const N = Math.min(MAX_POINTS, Math.max(4, config.pointCount));
|
|
70
71
|
const history = useMemo(() => {
|
|
71
72
|
const arr = [];
|
|
@@ -74,6 +75,7 @@ const PlasmaWhipCursor = ({ config, worldPosRef, hoverRef, idleMsRef, }) => {
|
|
|
74
75
|
return arr;
|
|
75
76
|
}, []);
|
|
76
77
|
const meshRef = useRef(null);
|
|
78
|
+
useObjectReady(meshRef, config, onObjectReady, onObjectDispose);
|
|
77
79
|
const geometryRef = useRef(null);
|
|
78
80
|
const firstFrame = useRef(true);
|
|
79
81
|
const material = useMemo(() => new THREE.ShaderMaterial({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SparklesCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/SparklesCursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SparklesCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/SparklesCursor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAkC1D,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAmHnE,CAAC;AACF,eAAe,cAAc,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';
|
|
@@ -34,7 +35,7 @@ const fragmentShader = /* glsl */ `
|
|
|
34
35
|
gl_FragColor = vec4(col, alpha);
|
|
35
36
|
}
|
|
36
37
|
`;
|
|
37
|
-
const SparklesCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef, }) => {
|
|
38
|
+
const SparklesCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef, onObjectReady, onObjectDispose, }) => {
|
|
38
39
|
const positions = useMemo(() => new Float32Array(MAX_PARTICLES * 3), []);
|
|
39
40
|
const velocities = useMemo(() => new Float32Array(MAX_PARTICLES * 3), []);
|
|
40
41
|
const ages = useMemo(() => new Float32Array(MAX_PARTICLES), []);
|
|
@@ -77,6 +78,8 @@ const SparklesCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef,
|
|
|
77
78
|
}, [geometry, material]);
|
|
78
79
|
const lastSpawnPos = useRef(new THREE.Vector3());
|
|
79
80
|
const spawnAccum = useRef(0);
|
|
81
|
+
const rootRef = useRef(null);
|
|
82
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
80
83
|
const firstFrame = useRef(true);
|
|
81
84
|
useFrame((_, delta) => {
|
|
82
85
|
const wp = worldPosRef.current;
|
|
@@ -146,6 +149,6 @@ const SparklesCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef,
|
|
|
146
149
|
geometry.attributes.position.needsUpdate = true;
|
|
147
150
|
geometry.attributes.aAge.needsUpdate = true;
|
|
148
151
|
});
|
|
149
|
-
return _jsx("points", { geometry: geometry, material: material, frustumCulled: false });
|
|
152
|
+
return _jsx("points", { ref: rootRef, geometry: geometry, material: material, frustumCulled: false });
|
|
150
153
|
};
|
|
151
154
|
export default SparklesCursor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TeslaCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/TeslaCursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TeslaCursor.d.ts","sourceRoot":"","sources":["../../../src/components/cursor/TeslaCursor.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;AAqF1D,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAsI7D,CAAC;AACF,eAAe,WAAW,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
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';
|
|
5
6
|
const MAX_HISTORY = 36;
|
|
6
7
|
const TUBULAR_RES = 120;
|
|
7
8
|
const RADIAL_RES = 6;
|
|
8
|
-
// ── Source point shader ─────────────────────────────────────────────────────
|
|
9
9
|
const sourceVertex = /* glsl */ `
|
|
10
10
|
uniform float uSize;
|
|
11
11
|
uniform float uShine;
|
|
@@ -34,9 +34,6 @@ const sourceFragment = /* glsl */ `
|
|
|
34
34
|
gl_FragColor = vec4(col, alpha);
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
|
-
// ── Tesla bolt shader ───────────────────────────────────────────────────────
|
|
38
|
-
// vUv.x: 0 at tail, 1 at source (cursor). uv.y wraps the tube.
|
|
39
|
-
// Energy packets travel from source (1) toward tail (0).
|
|
40
37
|
const trailVertex = /* glsl */ `
|
|
41
38
|
varying vec2 vUv;
|
|
42
39
|
void main() {
|
|
@@ -88,8 +85,9 @@ const trailFragment = /* glsl */ `
|
|
|
88
85
|
gl_FragColor = vec4(col, alpha);
|
|
89
86
|
}
|
|
90
87
|
`;
|
|
91
|
-
const TeslaCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef, }) => {
|
|
92
|
-
|
|
88
|
+
const TeslaCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef, onObjectReady, onObjectDispose, }) => {
|
|
89
|
+
const ref = useRef(null);
|
|
90
|
+
useObjectReady(ref, config, onObjectReady, onObjectDispose);
|
|
93
91
|
const sourceGeom = useMemo(() => {
|
|
94
92
|
const g = new THREE.BufferGeometry();
|
|
95
93
|
g.setAttribute('position', new THREE.BufferAttribute(new Float32Array([0, 0, 0]), 3));
|
|
@@ -108,7 +106,6 @@ const TeslaCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef, })
|
|
|
108
106
|
depthWrite: false,
|
|
109
107
|
blending: THREE.AdditiveBlending,
|
|
110
108
|
}), []);
|
|
111
|
-
// ── Trail tube ───────────────────────────────────────────────────────────
|
|
112
109
|
const trailMeshRef = useRef(null);
|
|
113
110
|
const trailGeomRef = useRef(null);
|
|
114
111
|
const trailMat = useMemo(() => new THREE.ShaderMaterial({
|
|
@@ -218,6 +215,6 @@ const TeslaCursor = ({ config, worldPosRef, velocityRef, hoverRef, idleMsRef, })
|
|
|
218
215
|
trailGeomRef.current.dispose();
|
|
219
216
|
trailGeomRef.current = newGeo;
|
|
220
217
|
});
|
|
221
|
-
return (_jsxs(
|
|
218
|
+
return (_jsxs("group", { ref: ref, children: [_jsx("points", { geometry: sourceGeom, material: sourceMat, frustumCulled: false }), _jsx("mesh", { ref: trailMeshRef, material: trailMat, frustumCulled: false })] }));
|
|
222
219
|
};
|
|
223
220
|
export default TeslaCursor;
|
|
@@ -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 { ClickActionConfig } from "@3driseai/3drise-core";
|
|
4
|
-
interface BoltFlashActionProps {
|
|
5
|
+
interface BoltFlashActionProps extends ObjectReadyProps {
|
|
5
6
|
worldPos: THREE.Vector3;
|
|
6
7
|
config: ClickActionConfig;
|
|
7
8
|
onDone: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoltFlashAction.d.ts","sourceRoot":"","sources":["../../../../src/components/cursor/clickActions/BoltFlashAction.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BoltFlashAction.d.ts","sourceRoot":"","sources":["../../../../src/components/cursor/clickActions/BoltFlashAction.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,UAAU,oBAAqB,SAAQ,gBAAgB;IACnD,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC;IACxB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AA6BD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAgCnD,CAAC;AACF,eAAe,eAAe,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';
|
|
@@ -28,8 +29,10 @@ const vertexShader = /* glsl */ `
|
|
|
28
29
|
gl_Position = projectionMatrix * mv;
|
|
29
30
|
}
|
|
30
31
|
`;
|
|
31
|
-
const BoltFlashAction = ({ worldPos, config, onDone }) => {
|
|
32
|
+
const BoltFlashAction = ({ worldPos, config, onDone, onObjectReady, onObjectDispose }) => {
|
|
32
33
|
const startRef = useRef(null);
|
|
34
|
+
const rootRef = useRef(null);
|
|
35
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
33
36
|
const { geometry, material } = useMemo(() => {
|
|
34
37
|
const g = new THREE.BufferGeometry();
|
|
35
38
|
g.setAttribute('position', new THREE.BufferAttribute(new Float32Array([0, 0, 0]), 3));
|
|
@@ -57,6 +60,6 @@ const BoltFlashAction = ({ worldPos, config, onDone }) => {
|
|
|
57
60
|
if (p >= 1)
|
|
58
61
|
onDone();
|
|
59
62
|
});
|
|
60
|
-
return _jsx("points", { position: worldPos, geometry: geometry, material: material, frustumCulled: false });
|
|
63
|
+
return _jsx("points", { ref: rootRef, position: worldPos, geometry: geometry, material: material, frustumCulled: false });
|
|
61
64
|
};
|
|
62
65
|
export default BoltFlashAction;
|
|
@@ -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 { GlyphInscriptionActionConfig } from "@3driseai/3drise-core";
|
|
4
|
-
interface GlyphInscriptionActionProps {
|
|
5
|
+
interface GlyphInscriptionActionProps extends ObjectReadyProps {
|
|
5
6
|
worldPos: THREE.Vector3;
|
|
6
7
|
config: GlyphInscriptionActionConfig;
|
|
7
8
|
onDone: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlyphInscriptionAction.d.ts","sourceRoot":"","sources":["../../../../src/components/cursor/clickActions/GlyphInscriptionAction.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GlyphInscriptionAction.d.ts","sourceRoot":"","sources":["../../../../src/components/cursor/clickActions/GlyphInscriptionAction.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC1E,UAAU,2BAA4B,SAAQ,gBAAgB;IAC1D,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC;IACxB,MAAM,EAAE,4BAA4B,CAAC;IACrC,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AA6ED,QAAA,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAmCjE,CAAC;AACF,eAAe,sBAAsB,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';
|
|
@@ -76,9 +77,10 @@ const fragmentShader = /* glsl */ `
|
|
|
76
77
|
gl_FragColor = vec4(col, alpha);
|
|
77
78
|
}
|
|
78
79
|
`;
|
|
79
|
-
const GlyphInscriptionAction = ({ worldPos, config, onDone }) => {
|
|
80
|
+
const GlyphInscriptionAction = ({ worldPos, config, onDone, onObjectReady, onObjectDispose }) => {
|
|
80
81
|
const startRef = useRef(null);
|
|
81
82
|
const meshRef = useRef(null);
|
|
83
|
+
useObjectReady(meshRef, config, onObjectReady, onObjectDispose);
|
|
82
84
|
const { camera, clock } = useThree();
|
|
83
85
|
const geometry = useMemo(() => new THREE.PlaneGeometry(2, 2, 1, 1), []);
|
|
84
86
|
const material = useMemo(() => new THREE.ShaderMaterial({
|
|
@@ -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 { ImplosionActionConfig } from "@3driseai/3drise-core";
|
|
4
|
-
interface ImplosionActionProps {
|
|
5
|
+
interface ImplosionActionProps extends ObjectReadyProps {
|
|
5
6
|
worldPos: THREE.Vector3;
|
|
6
7
|
config: ImplosionActionConfig;
|
|
7
8
|
onDone: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImplosionAction.d.ts","sourceRoot":"","sources":["../../../../src/components/cursor/clickActions/ImplosionAction.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ImplosionAction.d.ts","sourceRoot":"","sources":["../../../../src/components/cursor/clickActions/ImplosionAction.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,UAAU,oBAAqB,SAAQ,gBAAgB;IACnD,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC;IACxB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AA0DD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAiCnD,CAAC;AACF,eAAe,eAAe,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';
|
|
@@ -57,9 +58,10 @@ const fragmentShader = /* glsl */ `
|
|
|
57
58
|
gl_FragColor = vec4(col, alpha);
|
|
58
59
|
}
|
|
59
60
|
`;
|
|
60
|
-
const ImplosionAction = ({ worldPos, config, onDone }) => {
|
|
61
|
+
const ImplosionAction = ({ worldPos, config, onDone, onObjectReady, onObjectDispose }) => {
|
|
61
62
|
const startRef = useRef(null);
|
|
62
63
|
const meshRef = useRef(null);
|
|
64
|
+
useObjectReady(meshRef, config, onObjectReady, onObjectDispose);
|
|
63
65
|
const { camera } = useThree();
|
|
64
66
|
const size = (config.scale ?? 1) * 2.5;
|
|
65
67
|
const geometry = useMemo(() => new THREE.PlaneGeometry(size, size, 1, 1), [size]);
|
|
@@ -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 { PhaseShiftActionConfig } from "@3driseai/3drise-core";
|
|
4
|
-
interface PhaseShiftActionProps {
|
|
5
|
+
interface PhaseShiftActionProps extends ObjectReadyProps {
|
|
5
6
|
worldPos: THREE.Vector3;
|
|
6
7
|
config: PhaseShiftActionConfig;
|
|
7
8
|
onDone: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhaseShiftAction.d.ts","sourceRoot":"","sources":["../../../../src/components/cursor/clickActions/PhaseShiftAction.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PhaseShiftAction.d.ts","sourceRoot":"","sources":["../../../../src/components/cursor/clickActions/PhaseShiftAction.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,UAAU,qBAAsB,SAAQ,gBAAgB;IACpD,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC;IACxB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AAsCD,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAgCrD,CAAC;AACF,eAAe,gBAAgB,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';
|
|
@@ -37,8 +38,10 @@ const fragmentShader = /* glsl */ `
|
|
|
37
38
|
gl_FragColor = vec4(col * (1.0 + fade * 0.4), alpha);
|
|
38
39
|
}
|
|
39
40
|
`;
|
|
40
|
-
const PhaseShiftAction = ({ worldPos, config, onDone }) => {
|
|
41
|
+
const PhaseShiftAction = ({ worldPos, config, onDone, onObjectReady, onObjectDispose }) => {
|
|
41
42
|
const startRef = useRef(null);
|
|
43
|
+
const rootRef = useRef(null);
|
|
44
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
42
45
|
const { clock } = useThree();
|
|
43
46
|
const geometry = useMemo(() => new THREE.SphereGeometry(1, 36, 24), []);
|
|
44
47
|
const material = useMemo(() => new THREE.ShaderMaterial({
|
|
@@ -66,6 +69,6 @@ const PhaseShiftAction = ({ worldPos, config, onDone }) => {
|
|
|
66
69
|
if (p >= 1)
|
|
67
70
|
onDone();
|
|
68
71
|
});
|
|
69
|
-
return _jsx("mesh", { position: worldPos, geometry: geometry, material: material });
|
|
72
|
+
return _jsx("mesh", { ref: rootRef, position: worldPos, geometry: geometry, material: material });
|
|
70
73
|
};
|
|
71
74
|
export default PhaseShiftAction;
|
|
@@ -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 { PlasmaBombActionConfig } from "@3driseai/3drise-core";
|
|
4
|
-
interface PlasmaBombActionProps {
|
|
5
|
+
interface PlasmaBombActionProps extends ObjectReadyProps {
|
|
5
6
|
worldPos: THREE.Vector3;
|
|
6
7
|
config: PlasmaBombActionConfig;
|
|
7
8
|
onDone: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlasmaBombAction.d.ts","sourceRoot":"","sources":["../../../../src/components/cursor/clickActions/PlasmaBombAction.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PlasmaBombAction.d.ts","sourceRoot":"","sources":["../../../../src/components/cursor/clickActions/PlasmaBombAction.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,UAAU,qBAAsB,SAAQ,gBAAgB;IACpD,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC;IACxB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AA+DD,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAkCrD,CAAC;AACF,eAAe,gBAAgB,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';
|
|
@@ -62,8 +63,10 @@ const fragmentShader = /* glsl */ `
|
|
|
62
63
|
gl_FragColor = vec4(plasma * (1.0 + corona * 0.5), alpha);
|
|
63
64
|
}
|
|
64
65
|
`;
|
|
65
|
-
const PlasmaBombAction = ({ worldPos, config, onDone }) => {
|
|
66
|
+
const PlasmaBombAction = ({ worldPos, config, onDone, onObjectReady, onObjectDispose }) => {
|
|
66
67
|
const startRef = useRef(null);
|
|
68
|
+
const rootRef = useRef(null);
|
|
69
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
67
70
|
const { clock } = useThree();
|
|
68
71
|
const tubeRadius = (config.ringWidth ?? 0.08);
|
|
69
72
|
const geometry = useMemo(() => new THREE.TorusGeometry(1, tubeRadius, 16, 96), [tubeRadius]);
|
|
@@ -93,6 +96,6 @@ const PlasmaBombAction = ({ worldPos, config, onDone }) => {
|
|
|
93
96
|
if (p >= 1)
|
|
94
97
|
onDone();
|
|
95
98
|
});
|
|
96
|
-
return (_jsx("mesh", { position: worldPos, rotation: [-Math.PI / 2, 0, 0], geometry: geometry, material: material }));
|
|
99
|
+
return (_jsx("mesh", { ref: rootRef, position: worldPos, rotation: [-Math.PI / 2, 0, 0], geometry: geometry, material: material }));
|
|
97
100
|
};
|
|
98
101
|
export default PlasmaBombAction;
|
|
@@ -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 { RealityTearActionConfig } from "@3driseai/3drise-core";
|
|
4
|
-
interface RealityTearActionProps {
|
|
5
|
+
interface RealityTearActionProps extends ObjectReadyProps {
|
|
5
6
|
worldPos: THREE.Vector3;
|
|
6
7
|
config: RealityTearActionConfig;
|
|
7
8
|
onDone: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealityTearAction.d.ts","sourceRoot":"","sources":["../../../../src/components/cursor/clickActions/RealityTearAction.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RealityTearAction.d.ts","sourceRoot":"","sources":["../../../../src/components/cursor/clickActions/RealityTearAction.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,UAAU,sBAAuB,SAAQ,gBAAgB;IACrD,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC;IACxB,MAAM,EAAE,uBAAuB,CAAC;IAChC,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AAgDD,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA0CvD,CAAC;AACF,eAAe,iBAAiB,CAAC"}
|