@3driseai/3drise-viewer 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AnimatedObject.d.ts +2 -1
- package/dist/components/AnimatedObject.d.ts.map +1 -1
- package/dist/components/AnimatedObject.js +11 -3
- package/dist/components/Bubbles.d.ts +2 -1
- package/dist/components/Bubbles.d.ts.map +1 -1
- package/dist/components/Bubbles.js +5 -2
- package/dist/components/CameraController.d.ts +9 -1
- package/dist/components/CameraController.d.ts.map +1 -1
- package/dist/components/CameraController.js +12 -1
- package/dist/components/Clouds.d.ts +2 -1
- package/dist/components/Clouds.d.ts.map +1 -1
- package/dist/components/Clouds.js +3 -4
- package/dist/components/CreatedObject.d.ts +2 -2
- package/dist/components/CreatedObject.d.ts.map +1 -1
- package/dist/components/CreatedObject.js +5 -10
- package/dist/components/CustomPrimitive.d.ts +2 -2
- package/dist/components/CustomPrimitive.d.ts.map +1 -1
- package/dist/components/CustomPrimitive.js +6 -2
- package/dist/components/Earth.d.ts +2 -4
- package/dist/components/Earth.d.ts.map +1 -1
- package/dist/components/Earth.js +6 -4
- package/dist/components/EffectsGenerator.d.ts +2 -1
- package/dist/components/EffectsGenerator.d.ts.map +1 -1
- package/dist/components/EffectsGenerator.js +26 -25
- package/dist/components/EffectsGroup.d.ts +2 -1
- package/dist/components/EffectsGroup.d.ts.map +1 -1
- package/dist/components/EffectsGroup.js +7 -2
- package/dist/components/EnvironmentManager.js +2 -2
- package/dist/components/EnvironmentObject.d.ts +2 -1
- package/dist/components/EnvironmentObject.d.ts.map +1 -1
- package/dist/components/EnvironmentObject.js +2 -2
- package/dist/components/Frame.d.ts +3 -2
- package/dist/components/Frame.d.ts.map +1 -1
- package/dist/components/Frame.js +3 -1
- package/dist/components/Galaxy.d.ts +2 -3
- package/dist/components/Galaxy.d.ts.map +1 -1
- package/dist/components/Galaxy.js +10 -10
- package/dist/components/GalleryLayout.d.ts +2 -1
- package/dist/components/GalleryLayout.d.ts.map +1 -1
- package/dist/components/GalleryLayout.js +3 -1
- package/dist/components/GeometryShape.d.ts +3 -2
- package/dist/components/GeometryShape.d.ts.map +1 -1
- package/dist/components/GeometryShape.js +17 -6
- package/dist/components/Glyphs.d.ts +2 -1
- package/dist/components/Glyphs.d.ts.map +1 -1
- package/dist/components/Glyphs.js +6 -2
- package/dist/components/GridHelper.d.ts +2 -1
- package/dist/components/GridHelper.d.ts.map +1 -1
- package/dist/components/GridHelper.js +3 -1
- package/dist/components/GridsGenerator.d.ts +2 -1
- package/dist/components/GridsGenerator.d.ts.map +1 -1
- package/dist/components/GridsGenerator.js +12 -4
- package/dist/components/HdrPlaylistRenderer.d.ts +2 -1
- package/dist/components/HdrPlaylistRenderer.d.ts.map +1 -1
- package/dist/components/HdrPlaylistRenderer.js +3 -1
- package/dist/components/Lensflare.d.ts +2 -1
- package/dist/components/Lensflare.d.ts.map +1 -1
- package/dist/components/Lensflare.js +3 -1
- package/dist/components/Letter.d.ts +3 -2
- package/dist/components/Letter.d.ts.map +1 -1
- package/dist/components/Letter.js +3 -1
- package/dist/components/Letters.d.ts +3 -2
- package/dist/components/Letters.d.ts.map +1 -1
- package/dist/components/Letters.js +3 -1
- package/dist/components/LightObject.d.ts +2 -1
- package/dist/components/LightObject.d.ts.map +1 -1
- package/dist/components/LightObject.js +11 -7
- package/dist/components/LightsManager.d.ts +2 -1
- package/dist/components/LightsManager.d.ts.map +1 -1
- package/dist/components/LightsManager.js +6 -3
- package/dist/components/Lines.d.ts +2 -1
- package/dist/components/Lines.d.ts.map +1 -1
- package/dist/components/Lines.js +2 -2
- package/dist/components/Moon.d.ts +2 -3
- package/dist/components/Moon.d.ts.map +1 -1
- package/dist/components/Moon.js +6 -4
- package/dist/components/MyGrid.d.ts +3 -2
- package/dist/components/MyGrid.d.ts.map +1 -1
- package/dist/components/MyGrid.js +5 -2
- package/dist/components/ObjectNode.d.ts +2 -2
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +30 -30
- package/dist/components/ObjectNodeApi.d.ts +2 -2
- package/dist/components/ObjectNodeApi.d.ts.map +1 -1
- package/dist/components/ObjectNodeApi.js +2 -2
- package/dist/components/ObjectsRenderer.d.ts +2 -1
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +15 -4
- package/dist/components/ObjectsRendererApi.d.ts +2 -1
- package/dist/components/ObjectsRendererApi.d.ts.map +1 -1
- package/dist/components/ObjectsRendererApi.js +2 -2
- package/dist/components/Ocean.d.ts +2 -1
- package/dist/components/Ocean.d.ts.map +1 -1
- package/dist/components/Ocean.js +3 -1
- package/dist/components/Outline.d.ts +3 -2
- package/dist/components/Outline.d.ts.map +1 -1
- package/dist/components/Outline.js +6 -2
- package/dist/components/ParticlesR3f.d.ts +2 -1
- package/dist/components/ParticlesR3f.d.ts.map +1 -1
- package/dist/components/ParticlesR3f.js +3 -1
- package/dist/components/Path.d.ts +2 -1
- package/dist/components/Path.d.ts.map +1 -1
- package/dist/components/Path.js +14 -3
- package/dist/components/PathGeometry.d.ts +2 -1
- package/dist/components/PathGeometry.d.ts.map +1 -1
- package/dist/components/PathGeometry.js +6 -2
- package/dist/components/PathRenderer.d.ts +2 -1
- package/dist/components/PathRenderer.d.ts.map +1 -1
- package/dist/components/PathRenderer.js +6 -2
- package/dist/components/Planet.d.ts +2 -3
- package/dist/components/Planet.d.ts.map +1 -1
- package/dist/components/Planet.js +6 -4
- package/dist/components/PointCloud.d.ts +2 -1
- package/dist/components/PointCloud.d.ts.map +1 -1
- package/dist/components/PointCloud.js +3 -1
- package/dist/components/ProjectLoader.d.ts +2 -1
- package/dist/components/ProjectLoader.d.ts.map +1 -1
- package/dist/components/ProjectLoader.js +6 -3
- package/dist/components/Rain.d.ts +2 -1
- package/dist/components/Rain.d.ts.map +1 -1
- package/dist/components/Rain.js +7 -1
- package/dist/components/SceneBuilder.d.ts +2 -1
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +2 -2
- package/dist/components/ShootingStar.d.ts +2 -1
- package/dist/components/ShootingStar.d.ts.map +1 -1
- package/dist/components/ShootingStar.js +5 -2
- package/dist/components/ShootingStars.d.ts +2 -1
- package/dist/components/ShootingStars.d.ts.map +1 -1
- package/dist/components/ShootingStars.js +2 -2
- package/dist/components/SkyController.d.ts +3 -2
- package/dist/components/SkyController.d.ts.map +1 -1
- package/dist/components/SkyController.js +9 -6
- package/dist/components/SkyMesh.d.ts +2 -3
- package/dist/components/SkyMesh.d.ts.map +1 -1
- package/dist/components/SkyMesh.js +3 -5
- package/dist/components/SkySystem.d.ts +2 -1
- package/dist/components/SkySystem.d.ts.map +1 -1
- package/dist/components/SkySystem.js +6 -2
- package/dist/components/Skybox.d.ts +2 -1
- package/dist/components/Skybox.d.ts.map +1 -1
- package/dist/components/Skybox.js +5 -2
- package/dist/components/SolarSystem.d.ts +2 -4
- package/dist/components/SolarSystem.d.ts.map +1 -1
- package/dist/components/SolarSystem.js +3 -1
- package/dist/components/SparklesBurst.d.ts +2 -1
- package/dist/components/SparklesBurst.d.ts.map +1 -1
- package/dist/components/SparklesBurst.js +5 -2
- package/dist/components/Stars.d.ts +2 -3
- package/dist/components/Stars.d.ts.map +1 -1
- package/dist/components/Stars.js +3 -2
- package/dist/components/Sun.d.ts +3 -2
- package/dist/components/Sun.d.ts.map +1 -1
- package/dist/components/Sun.js +7 -3
- package/dist/components/SunCore.d.ts +3 -2
- package/dist/components/SunCore.d.ts.map +1 -1
- package/dist/components/SunCore.js +3 -1
- package/dist/components/SunLight.d.ts +2 -1
- package/dist/components/SunLight.d.ts.map +1 -1
- package/dist/components/SunLight.js +3 -1
- package/dist/components/Text2D.d.ts +2 -1
- package/dist/components/Text2D.d.ts.map +1 -1
- package/dist/components/Text2D.js +3 -1
- package/dist/components/Text3D.d.ts +2 -1
- package/dist/components/Text3D.d.ts.map +1 -1
- package/dist/components/Text3D.js +2 -2
- package/dist/components/VolumePoints.d.ts +3 -2
- package/dist/components/VolumePoints.d.ts.map +1 -1
- package/dist/components/VolumePoints.js +6 -2
- package/dist/components/cursor/AuraCursor.d.ts.map +1 -1
- package/dist/components/cursor/AuraCursor.js +3 -1
- package/dist/components/cursor/AuroraCursor.d.ts.map +1 -1
- package/dist/components/cursor/AuroraCursor.js +5 -2
- package/dist/components/cursor/BubblesCursor.d.ts.map +1 -1
- package/dist/components/cursor/BubblesCursor.js +5 -2
- package/dist/components/cursor/CometCursor.d.ts.map +1 -1
- package/dist/components/cursor/CometCursor.js +6 -3
- package/dist/components/cursor/CrosshairCursor.d.ts.map +1 -1
- package/dist/components/cursor/CrosshairCursor.js +6 -3
- package/dist/components/cursor/CursorActions.d.ts +2 -1
- package/dist/components/cursor/CursorActions.d.ts.map +1 -1
- package/dist/components/cursor/CursorActions.js +12 -10
- package/dist/components/cursor/CursorController.d.ts +4 -1
- package/dist/components/cursor/CursorController.d.ts.map +1 -1
- package/dist/components/cursor/CursorController.js +1 -1
- package/dist/components/cursor/CursorEffects.d.ts +4 -2
- package/dist/components/cursor/CursorEffects.d.ts.map +1 -1
- package/dist/components/cursor/CursorEffects.js +6 -2
- package/dist/components/cursor/FerrofluidCursor.d.ts.map +1 -1
- package/dist/components/cursor/FerrofluidCursor.js +3 -1
- package/dist/components/cursor/GlyphRingCursor.d.ts.map +1 -1
- package/dist/components/cursor/GlyphRingCursor.js +3 -1
- package/dist/components/cursor/LightningCursor.d.ts.map +1 -1
- package/dist/components/cursor/LightningCursor.js +3 -1
- package/dist/components/cursor/LiquidMetalCursor.d.ts.map +1 -1
- package/dist/components/cursor/LiquidMetalCursor.js +3 -1
- package/dist/components/cursor/OrbCursor.d.ts.map +1 -1
- package/dist/components/cursor/OrbCursor.js +3 -1
- package/dist/components/cursor/PlasmaWhipCursor.d.ts.map +1 -1
- package/dist/components/cursor/PlasmaWhipCursor.js +3 -1
- package/dist/components/cursor/SparklesCursor.d.ts.map +1 -1
- package/dist/components/cursor/SparklesCursor.js +5 -2
- package/dist/components/cursor/TeslaCursor.d.ts.map +1 -1
- package/dist/components/cursor/TeslaCursor.js +6 -9
- package/dist/components/cursor/clickActions/BoltFlashAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/BoltFlashAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/BoltFlashAction.js +5 -2
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.js +3 -1
- package/dist/components/cursor/clickActions/ImplosionAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/ImplosionAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/ImplosionAction.js +3 -1
- package/dist/components/cursor/clickActions/PhaseShiftAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/PhaseShiftAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/PhaseShiftAction.js +5 -2
- package/dist/components/cursor/clickActions/PlasmaBombAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/PlasmaBombAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/PlasmaBombAction.js +5 -2
- package/dist/components/cursor/clickActions/RealityTearAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/RealityTearAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/RealityTearAction.js +3 -1
- package/dist/components/cursor/clickActions/ShockwaveAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/ShockwaveAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/ShockwaveAction.js +5 -2
- package/dist/components/cursor/clickActions/SparklesBurstAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/SparklesBurstAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/SparklesBurstAction.js +3 -1
- package/dist/components/cursor/clickActions/VoronoiFractureAction.d.ts +2 -1
- package/dist/components/cursor/clickActions/VoronoiFractureAction.d.ts.map +1 -1
- package/dist/components/cursor/clickActions/VoronoiFractureAction.js +3 -1
- package/dist/components/cursor/clickActions/index.d.ts +11 -0
- package/dist/components/cursor/clickActions/index.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/index.js +10 -0
- package/dist/components/cursor/index.d.ts +21 -0
- package/dist/components/cursor/index.d.ts.map +1 -0
- package/dist/components/cursor/index.js +19 -0
- package/dist/components/effects/AuraEffect.d.ts +2 -1
- package/dist/components/effects/AuraEffect.d.ts.map +1 -1
- package/dist/components/effects/AuraEffect.js +5 -2
- package/dist/components/effects/AuroraEffect.d.ts +2 -1
- package/dist/components/effects/AuroraEffect.d.ts.map +1 -1
- package/dist/components/effects/AuroraEffect.js +3 -1
- package/dist/components/effects/BlackHoleEffect.d.ts +2 -1
- package/dist/components/effects/BlackHoleEffect.d.ts.map +1 -1
- package/dist/components/effects/BlackHoleEffect.js +3 -1
- package/dist/components/effects/ConstellationEffect.d.ts +2 -1
- package/dist/components/effects/ConstellationEffect.d.ts.map +1 -1
- package/dist/components/effects/ConstellationEffect.js +3 -1
- package/dist/components/effects/Corona.d.ts +19 -0
- package/dist/components/effects/Corona.d.ts.map +1 -0
- package/dist/components/effects/Corona.js +15 -0
- package/dist/components/effects/DataStreamEffect.d.ts +2 -1
- package/dist/components/effects/DataStreamEffect.d.ts.map +1 -1
- package/dist/components/effects/DataStreamEffect.js +5 -2
- package/dist/components/effects/DnaHelixEffect.d.ts +2 -1
- package/dist/components/effects/DnaHelixEffect.d.ts.map +1 -1
- package/dist/components/effects/DnaHelixEffect.js +3 -1
- package/dist/components/effects/Fire.d.ts +3 -2
- package/dist/components/effects/Fire.d.ts.map +1 -1
- package/dist/components/effects/Fire.js +3 -1
- package/dist/components/effects/FireEffect.d.ts +2 -1
- package/dist/components/effects/FireEffect.d.ts.map +1 -1
- package/dist/components/effects/FireEffect.js +5 -2
- package/dist/components/effects/Flares.d.ts +25 -0
- package/dist/components/effects/Flares.d.ts.map +1 -0
- package/dist/components/effects/Flares.js +136 -0
- package/dist/components/effects/ForcefieldEffect.d.ts +2 -1
- package/dist/components/effects/ForcefieldEffect.d.ts.map +1 -1
- package/dist/components/effects/ForcefieldEffect.js +3 -1
- package/dist/components/effects/HologramEffect.d.ts +2 -1
- package/dist/components/effects/HologramEffect.d.ts.map +1 -1
- package/dist/components/effects/HologramEffect.js +5 -2
- package/dist/components/effects/IceCrystalsEffect.d.ts +2 -1
- package/dist/components/effects/IceCrystalsEffect.d.ts.map +1 -1
- package/dist/components/effects/IceCrystalsEffect.js +3 -1
- package/dist/components/effects/LightningEffect.d.ts +2 -1
- package/dist/components/effects/LightningEffect.d.ts.map +1 -1
- package/dist/components/effects/LightningEffect.js +5 -2
- package/dist/components/effects/MoleculesEffect.d.ts +2 -1
- package/dist/components/effects/MoleculesEffect.d.ts.map +1 -1
- package/dist/components/effects/MoleculesEffect.js +5 -2
- package/dist/components/effects/NeuralNetworkEffect.d.ts +2 -1
- package/dist/components/effects/NeuralNetworkEffect.d.ts.map +1 -1
- package/dist/components/effects/NeuralNetworkEffect.js +3 -1
- package/dist/components/effects/OrbEffect.d.ts +2 -1
- package/dist/components/effects/OrbEffect.d.ts.map +1 -1
- package/dist/components/effects/OrbEffect.js +5 -2
- package/dist/components/effects/PortalEffect.d.ts +2 -1
- package/dist/components/effects/PortalEffect.d.ts.map +1 -1
- package/dist/components/effects/PortalEffect.js +5 -2
- package/dist/components/effects/ShockwaveEffect.d.ts +2 -1
- package/dist/components/effects/ShockwaveEffect.d.ts.map +1 -1
- package/dist/components/effects/ShockwaveEffect.js +5 -2
- package/dist/components/effects/SmokePlumeEffect.d.ts +2 -1
- package/dist/components/effects/SmokePlumeEffect.d.ts.map +1 -1
- package/dist/components/effects/SmokePlumeEffect.js +5 -2
- package/dist/components/effects/SmokeRibbon.d.ts +3 -2
- package/dist/components/effects/SmokeRibbon.d.ts.map +1 -1
- package/dist/components/effects/SmokeRibbon.js +5 -2
- package/dist/components/effects/SmokeRingEffect.d.ts +2 -1
- package/dist/components/effects/SmokeRingEffect.d.ts.map +1 -1
- package/dist/components/effects/SmokeRingEffect.js +5 -2
- package/dist/components/effects/VolumetricFogEffect.d.ts +2 -1
- package/dist/components/effects/VolumetricFogEffect.d.ts.map +1 -1
- package/dist/components/effects/VolumetricFogEffect.js +5 -2
- package/dist/components/effects/index.d.ts +28 -0
- package/dist/components/effects/index.d.ts.map +1 -0
- package/dist/components/effects/index.js +24 -0
- package/dist/components/index.d.ts +112 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +77 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/hooks/index.d.ts +55 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +46 -1
- package/dist/hooks/useObjectReady.d.ts +29 -0
- package/dist/hooks/useObjectReady.d.ts.map +1 -0
- package/dist/hooks/useObjectReady.js +59 -0
- package/dist/index.d.ts +4 -135
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -108
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/objectReady.d.ts +24 -0
- package/dist/types/objectReady.d.ts.map +1 -0
- package/dist/types/objectReady.js +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
3
|
+
import { useFrame, useThree } from "@react-three/fiber";
|
|
4
|
+
import { WebGLRenderTarget, MeshBasicMaterial, AdditiveBlending, Box3, Sphere, Vector3, Vector2, Quaternion, Color, Object3D } from "three";
|
|
5
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
6
|
+
const tmpBox = new Box3();
|
|
7
|
+
const tmpSphere = new Sphere();
|
|
8
|
+
const tmpVec = new Vector3();
|
|
9
|
+
const tmpVec2 = new Vector2();
|
|
10
|
+
const tmpQuat = new Quaternion();
|
|
11
|
+
const tmpRight = new Vector3();
|
|
12
|
+
const tmpColor = new Color();
|
|
13
|
+
export default function Flares({ hostRef, config, uniforms, animations, onObjectReady, onObjectDispose }) {
|
|
14
|
+
const { gl, scene } = useThree();
|
|
15
|
+
const anchorRef = useRef(null);
|
|
16
|
+
useObjectReady(anchorRef, config, onObjectReady, onObjectDispose);
|
|
17
|
+
const meshRef = useRef(null);
|
|
18
|
+
const matRef = useRef(null);
|
|
19
|
+
const { radius, padding = 1.2, fitKey, shooting, maskResolution = 512, maskLayer = 31 } = config;
|
|
20
|
+
const maskTarget = useMemo(() => hostRef
|
|
21
|
+
? new WebGLRenderTarget(maskResolution, maskResolution, {
|
|
22
|
+
depthBuffer: true,
|
|
23
|
+
stencilBuffer: false,
|
|
24
|
+
samples: 4 // MSAA mask (WebGL2) -> smooth silhouette edges
|
|
25
|
+
})
|
|
26
|
+
: null, [hostRef, maskResolution]);
|
|
27
|
+
const maskMaterial = useMemo(() => new MeshBasicMaterial({ color: 0xffffff }), []);
|
|
28
|
+
useEffect(() => () => maskTarget?.dispose(), [maskTarget]);
|
|
29
|
+
// Fit the billboard to the host object + tag the host for the mask pass.
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const anchor = anchorRef.current;
|
|
32
|
+
const mesh = meshRef.current;
|
|
33
|
+
if (!anchor || !mesh)
|
|
34
|
+
return;
|
|
35
|
+
const host = hostRef && hostRef instanceof Object3D ? hostRef : anchor;
|
|
36
|
+
// Silhouette mode: tag every host node (except us) with the mask layer.
|
|
37
|
+
if (hostRef && host) {
|
|
38
|
+
host.traverse((o) => o.layers.enable(maskLayer));
|
|
39
|
+
anchor.traverse((o) => o.layers.disable(maskLayer));
|
|
40
|
+
}
|
|
41
|
+
if (radius !== undefined) {
|
|
42
|
+
anchor.position.set(0, 0, 0);
|
|
43
|
+
mesh.scale.setScalar(radius * padding);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (!host)
|
|
47
|
+
return;
|
|
48
|
+
// Bounding box of every sibling except ourselves (world space).
|
|
49
|
+
tmpBox.makeEmpty();
|
|
50
|
+
let hasGeometry = false;
|
|
51
|
+
for (const child of host.children) {
|
|
52
|
+
if (child === anchor)
|
|
53
|
+
continue;
|
|
54
|
+
const childBox = new Box3().setFromObject(child);
|
|
55
|
+
if (!childBox.isEmpty()) {
|
|
56
|
+
tmpBox.union(childBox);
|
|
57
|
+
hasGeometry = true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Host itself may be a mesh (Flares nested directly inside it).
|
|
61
|
+
if (host.geometry) {
|
|
62
|
+
const g = host.geometry;
|
|
63
|
+
if (!g.boundingBox)
|
|
64
|
+
g.computeBoundingBox();
|
|
65
|
+
if (g.boundingBox) {
|
|
66
|
+
tmpBox.union(g.boundingBox.clone().applyMatrix4(host.matrixWorld));
|
|
67
|
+
hasGeometry = true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (!hasGeometry)
|
|
71
|
+
return;
|
|
72
|
+
tmpBox.getBoundingSphere(tmpSphere);
|
|
73
|
+
host.updateWorldMatrix(true, false);
|
|
74
|
+
const localCenter = host.worldToLocal(tmpSphere.center.clone());
|
|
75
|
+
host.getWorldScale(tmpVec);
|
|
76
|
+
const worldScale = Math.max(tmpVec.x, tmpVec.y, tmpVec.z) || 1;
|
|
77
|
+
anchor.position.copy(localCenter);
|
|
78
|
+
mesh.scale.setScalar((tmpSphere.radius / worldScale) * padding);
|
|
79
|
+
}, [radius, padding, fitKey, hostRef, maskLayer]);
|
|
80
|
+
useFrame(({ camera: cam }, delta) => {
|
|
81
|
+
const mat = matRef.current;
|
|
82
|
+
const mesh = meshRef.current;
|
|
83
|
+
if (mat)
|
|
84
|
+
mat.u_time += delta;
|
|
85
|
+
// World-space billboard: compensate for inherited rotation.
|
|
86
|
+
if (mesh && hostRef) {
|
|
87
|
+
hostRef.getWorldQuaternion(tmpQuat).invert();
|
|
88
|
+
mesh.quaternion.copy(tmpQuat).multiply(cam.quaternion);
|
|
89
|
+
}
|
|
90
|
+
// --- Silhouette mask pass: render only the host, white on black. ---
|
|
91
|
+
if (hostRef && maskTarget && mat && mesh) {
|
|
92
|
+
const prevOverride = scene.overrideMaterial;
|
|
93
|
+
const prevBackground = scene.background;
|
|
94
|
+
const prevTarget = gl.getRenderTarget();
|
|
95
|
+
const prevLayers = cam.layers.mask;
|
|
96
|
+
gl.getClearColor(tmpColor);
|
|
97
|
+
const prevClearAlpha = gl.getClearAlpha();
|
|
98
|
+
scene.overrideMaterial = maskMaterial;
|
|
99
|
+
scene.background = null;
|
|
100
|
+
cam.layers.set(maskLayer);
|
|
101
|
+
gl.setRenderTarget(maskTarget);
|
|
102
|
+
gl.setClearColor(0x000000, 1);
|
|
103
|
+
gl.clear();
|
|
104
|
+
gl.render(scene, cam);
|
|
105
|
+
gl.setRenderTarget(prevTarget);
|
|
106
|
+
gl.setClearColor(tmpColor, prevClearAlpha);
|
|
107
|
+
scene.overrideMaterial = prevOverride;
|
|
108
|
+
scene.background = prevBackground;
|
|
109
|
+
cam.layers.mask = prevLayers;
|
|
110
|
+
// Feed the shader: mask, buffer size, host center in screen UV.
|
|
111
|
+
mat.u_mask = maskTarget.texture;
|
|
112
|
+
gl.getDrawingBufferSize(tmpVec2);
|
|
113
|
+
mat.u_resolution.set(tmpVec2.x, tmpVec2.y);
|
|
114
|
+
const anchor = anchorRef.current;
|
|
115
|
+
anchor.getWorldPosition(tmpVec).project(cam);
|
|
116
|
+
const cx = tmpVec.x * 0.5 + 0.5;
|
|
117
|
+
const cy = tmpVec.y * 0.5 + 0.5;
|
|
118
|
+
mat.u_center.set(cx, cy);
|
|
119
|
+
// Bounding-silhouette radius in aspect-corrected screen UV: project a
|
|
120
|
+
// point one limb-unit to the camera's right of the center.
|
|
121
|
+
mesh.getWorldScale(tmpVec);
|
|
122
|
+
const worldLimb = Math.max(tmpVec.x, tmpVec.y, tmpVec.z);
|
|
123
|
+
tmpRight.setFromMatrixColumn(cam.matrixWorld, 0).multiplyScalar(worldLimb);
|
|
124
|
+
anchor.getWorldPosition(tmpVec).add(tmpRight).project(cam);
|
|
125
|
+
const aspect = tmpVec2.x / tmpVec2.y;
|
|
126
|
+
const dx = (tmpVec.x * 0.5 + 0.5 - cx) * aspect;
|
|
127
|
+
const dy = tmpVec.y * 0.5 + 0.5 - cy;
|
|
128
|
+
mat.u_limbScreen = Math.max(Math.hypot(dx, dy), 1e-4);
|
|
129
|
+
mat.u_maskEnabled = 1;
|
|
130
|
+
}
|
|
131
|
+
else if (mat) {
|
|
132
|
+
mat.u_maskEnabled = 0;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
return (_jsx("group", { ref: anchorRef, children: _jsxs("mesh", { ref: meshRef, renderOrder: 2, children: [_jsx("planeGeometry", { args: [4.4, 4.4] }), _jsx("flareMaterial", { ref: matRef, transparent: true, depthWrite: false, depthTest: !hostRef && !shooting, blending: AdditiveBlending, u_shootEnabled: shooting ? 1 : 0, ...uniforms })] }) }));
|
|
136
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ForcefieldConfig, AnimationOptions } from "@3driseai/3drise-core";
|
|
3
|
-
|
|
3
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
+
interface ForcefieldEffectProps extends ObjectReadyProps {
|
|
4
5
|
boundingRadius: number;
|
|
5
6
|
config: ForcefieldConfig;
|
|
6
7
|
animations?: AnimationOptions[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForcefieldEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/ForcefieldEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ForcefieldEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/ForcefieldEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,UAAU,qBAAsB,SAAQ,gBAAgB;IACpD,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC;AA6ED,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAoDrD,CAAC;AACF,eAAe,gBAAgB,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { useRef, useMemo } from 'react';
|
|
|
3
3
|
import { useFrame } from '@react-three/fiber';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAnimations.js';
|
|
6
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
6
7
|
const shieldVert = /* glsl */ `
|
|
7
8
|
varying vec3 vNormal;
|
|
8
9
|
varying vec3 vWorldPos;
|
|
@@ -77,10 +78,11 @@ const shieldFrag = /* glsl */ `
|
|
|
77
78
|
gl_FragColor = vec4(col + uRimColor * ripple * 0.3, alpha);
|
|
78
79
|
}
|
|
79
80
|
`;
|
|
80
|
-
const ForcefieldEffect = ({ boundingRadius, config, animations }) => {
|
|
81
|
+
const ForcefieldEffect = ({ boundingRadius, config, animations, onObjectReady, onObjectDispose }) => {
|
|
81
82
|
const { hexSize, rippleEnabled, shieldColor, rimColor, opacity, speed, intensity } = config;
|
|
82
83
|
const startValuesCacheRef = useRef({});
|
|
83
84
|
const meshRef = useRef(null);
|
|
85
|
+
useObjectReady(meshRef, config, onObjectReady, onObjectDispose);
|
|
84
86
|
const hitSlot = useRef(0);
|
|
85
87
|
const nextHit = useRef(0);
|
|
86
88
|
const mat = useMemo(() => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { HologramConfig, AnimationOptions } from "@3driseai/3drise-core";
|
|
3
|
-
|
|
3
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
+
interface HologramEffectProps extends ObjectReadyProps {
|
|
4
5
|
boundingRadius: number;
|
|
5
6
|
config: HologramConfig;
|
|
6
7
|
animations?: AnimationOptions[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HologramEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/HologramEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"HologramEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/HologramEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,UAAU,mBAAoB,SAAQ,gBAAgB;IAClD,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC;AAqFD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAwDjD,CAAC;AACF,eAAe,cAAc,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { useRef, useMemo } from 'react';
|
|
|
3
3
|
import { useFrame } from '@react-three/fiber';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAnimations.js';
|
|
6
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
6
7
|
// Single rich shader handles scanlines, grid, RGB aberration, interference fringes, flicker
|
|
7
8
|
const vertexShader = /* glsl */ `
|
|
8
9
|
varying vec2 vUv;
|
|
@@ -85,9 +86,11 @@ const fragmentShader = /* glsl */ `
|
|
|
85
86
|
gl_FragColor = vec4(hologramColor + uColor * fringe, intensity * uOpacity);
|
|
86
87
|
}
|
|
87
88
|
`;
|
|
88
|
-
const HologramEffect = ({ boundingRadius, config, animations }) => {
|
|
89
|
+
const HologramEffect = ({ boundingRadius, config, animations, onObjectReady, onObjectDispose }) => {
|
|
89
90
|
const { scanlineCount, scanSpeed, scanColor, gridEnabled, flickerAmount, glitchEnabled, opacity, speed, intensity } = config;
|
|
90
91
|
const startValuesCacheRef = useRef({});
|
|
92
|
+
const rootRef = useRef(null);
|
|
93
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
91
94
|
const meshRefs = useRef([]);
|
|
92
95
|
const colorVec = useMemo(() => {
|
|
93
96
|
const c = new THREE.Color(scanColor);
|
|
@@ -135,7 +138,7 @@ const HologramEffect = ({ boundingRadius, config, animations }) => {
|
|
|
135
138
|
applyGenerativeAnimations(materials, animations, startValuesCacheRef.current, Date.now(), false);
|
|
136
139
|
}
|
|
137
140
|
});
|
|
138
|
-
return (_jsx("group", { children: Array.from({ length: scanlineCount }, (_, i) => {
|
|
141
|
+
return (_jsx("group", { ref: rootRef, children: Array.from({ length: scanlineCount }, (_, i) => {
|
|
139
142
|
const y = -boundingRadius * 1.25 + i * stepY;
|
|
140
143
|
return (_jsx("mesh", { ref: el => { meshRefs.current[i] = el; }, material: materials[i], position: [0, y, 0], rotation: [-Math.PI / 2, 0, 0], children: _jsx("planeGeometry", { args: [planeSize, planeSize, 2, 2] }) }, i));
|
|
141
144
|
}) }));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { IceCrystalsConfig, AnimationOptions } from "@3driseai/3drise-core";
|
|
3
|
-
|
|
3
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
+
interface IceCrystalsEffectProps extends ObjectReadyProps {
|
|
4
5
|
boundingRadius: number;
|
|
5
6
|
config: IceCrystalsConfig;
|
|
6
7
|
animations?: AnimationOptions[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IceCrystalsEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/IceCrystalsEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"IceCrystalsEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/IceCrystalsEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,UAAU,sBAAuB,SAAQ,gBAAgB;IACrD,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC;AAmED,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAwHvD,CAAC;AACF,eAAe,iBAAiB,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { useRef, useMemo } from 'react';
|
|
|
3
3
|
import { useFrame } from '@react-three/fiber';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAnimations.js';
|
|
6
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
6
7
|
// ── Crystal spike shader ──────────────────────────────────────────────────────
|
|
7
8
|
const spikeVert = /* glsl */ `
|
|
8
9
|
varying vec3 vNormal;
|
|
@@ -67,10 +68,11 @@ const frostFrag = /* glsl */ `
|
|
|
67
68
|
gl_FragColor = vec4(0.85, 0.95, 1.0, g * vA * uOpacity);
|
|
68
69
|
}
|
|
69
70
|
`;
|
|
70
|
-
const IceCrystalsEffect = ({ boundingRadius, config, animations }) => {
|
|
71
|
+
const IceCrystalsEffect = ({ boundingRadius, config, animations, onObjectReady, onObjectDispose }) => {
|
|
71
72
|
const { spikeCount, spikeLength, frostEnabled, iceColor, pulseSpeed, opacity, intensity } = config;
|
|
72
73
|
const startValuesCacheRef = useRef({});
|
|
73
74
|
const groupRef = useRef(null);
|
|
75
|
+
useObjectReady(groupRef, config, onObjectReady, onObjectDispose);
|
|
74
76
|
const timeRef = useRef(0);
|
|
75
77
|
const r = boundingRadius;
|
|
76
78
|
const N = Math.max(10, Math.min(spikeCount, 60));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { LightningConfig, AnimationOptions } from "@3driseai/3drise-core";
|
|
3
|
-
|
|
3
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
+
interface LightningEffectProps extends ObjectReadyProps {
|
|
4
5
|
boundingRadius: number;
|
|
5
6
|
config: LightningConfig;
|
|
6
7
|
animations?: AnimationOptions[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightningEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/LightningEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"LightningEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/LightningEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,UAAU,oBAAqB,SAAQ,gBAAgB;IACnD,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC;AAsDD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAwLnD,CAAC;AACF,eAAe,eAAe,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { useRef, useMemo } from 'react';
|
|
|
3
3
|
import { useFrame } from '@react-three/fiber';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAnimations.js';
|
|
6
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
6
7
|
// ── Seeded LCG RNG — deterministic, no Math.random ───────────────────────────
|
|
7
8
|
function makeRng(seed) {
|
|
8
9
|
let s = (seed * 1664525 + 1013904223) >>> 0;
|
|
@@ -54,9 +55,11 @@ const glowFrag = /* glsl */ `
|
|
|
54
55
|
}
|
|
55
56
|
`;
|
|
56
57
|
const FADE_DUR = 0.22;
|
|
57
|
-
const LightningEffect = ({ boundingRadius, config, animations }) => {
|
|
58
|
+
const LightningEffect = ({ boundingRadius, config, animations, onObjectReady, onObjectDispose }) => {
|
|
58
59
|
const { boltCount, branchDepth, color, glowColor, opacity, speed, intensity, strikeRadius } = config;
|
|
59
60
|
const startValuesCacheRef = useRef({});
|
|
61
|
+
const rootRef = useRef(null);
|
|
62
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
60
63
|
const depth = Math.min(Math.max(branchDepth, 2), 6);
|
|
61
64
|
const N = Math.pow(2, depth) + 1; // vertex count: 5, 9, 17, 33, 65
|
|
62
65
|
const coreCol = useMemo(() => new THREE.Color(color), [color]);
|
|
@@ -235,6 +238,6 @@ const LightningEffect = ({ boundingRadius, config, animations }) => {
|
|
|
235
238
|
const lineObjects = useMemo(() => bolts.map(bolt => new THREE.Line(bolt.lineGeo, lineMat)),
|
|
236
239
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
237
240
|
[bolts, lineMat]);
|
|
238
|
-
return (_jsx("group", { children: lineObjects.map((lineObj, bi) => (_jsxs("group", { children: [_jsx("primitive", { object: lineObj }), _jsx("points", { geometry: bolts[bi].pointGeo, material: glowMats[bi] })] }, bi))) }));
|
|
241
|
+
return (_jsx("group", { ref: rootRef, children: lineObjects.map((lineObj, bi) => (_jsxs("group", { children: [_jsx("primitive", { object: lineObj }), _jsx("points", { geometry: bolts[bi].pointGeo, material: glowMats[bi] })] }, bi))) }));
|
|
239
242
|
};
|
|
240
243
|
export default LightningEffect;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MoleculesConfig, AnimationOptions } from '@3driseai/3drise-core';
|
|
2
2
|
import React from "react";
|
|
3
|
-
|
|
3
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
+
interface MoleculesEffectProps extends ObjectReadyProps {
|
|
4
5
|
boundingRadius: number;
|
|
5
6
|
config: MoleculesConfig;
|
|
6
7
|
animations?: AnimationOptions[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoleculesEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/MoleculesEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MoleculesEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/MoleculesEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,UAAU,oBAAqB,SAAQ,gBAAgB;IACnD,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC;AA+CD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA2HnD,CAAC;AACF,eAAe,eAAe,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { useFrame } from '@react-three/fiber';
|
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { getShaderByName } from '@3driseai/3drise-core';
|
|
6
6
|
import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAnimations.js';
|
|
7
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
7
8
|
// Glowing node points at each atom position
|
|
8
9
|
// const nodeVertShader = /* glsl */`
|
|
9
10
|
// attribute float aPhase;
|
|
@@ -48,9 +49,11 @@ import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAn
|
|
|
48
49
|
// gl_FragColor = vec4(col, vAlpha * uOpacity * (glow + spike * 0.6 + core));
|
|
49
50
|
// }
|
|
50
51
|
// `;
|
|
51
|
-
const MoleculesEffect = ({ boundingRadius, config, animations }) => {
|
|
52
|
+
const MoleculesEffect = ({ boundingRadius, config, animations, onObjectReady, onObjectDispose }) => {
|
|
52
53
|
const { atomCount, orbitRadius, atomSize, showBonds, opacity, speed, intensity } = config;
|
|
53
54
|
const startValuesCacheRef = useRef({});
|
|
55
|
+
const rootRef = useRef(null);
|
|
56
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
54
57
|
const shaderData = getShaderByName('Molecules');
|
|
55
58
|
const tRef = useRef(new Float32Array(atomCount));
|
|
56
59
|
const r = boundingRadius * orbitRadius;
|
|
@@ -168,6 +171,6 @@ const MoleculesEffect = ({ boundingRadius, config, animations }) => {
|
|
|
168
171
|
applyGenerativeAnimations([nodeMat, bondMat], animations, startValuesCacheRef.current, Date.now(), false);
|
|
169
172
|
}
|
|
170
173
|
});
|
|
171
|
-
return (_jsxs("group", { name: "MoleculesEffect", children: [_jsx("points", { geometry: nodeGeo, material: nodeMat }), showBonds && (_jsx("lineSegments", { geometry: bondGeo, material: bondMat }))] }));
|
|
174
|
+
return (_jsxs("group", { ref: rootRef, name: "MoleculesEffect", children: [_jsx("points", { geometry: nodeGeo, material: nodeMat }), showBonds && (_jsx("lineSegments", { geometry: bondGeo, material: bondMat }))] }));
|
|
172
175
|
};
|
|
173
176
|
export default MoleculesEffect;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { NeuralNetworkConfig, AnimationOptions } from "@3driseai/3drise-core";
|
|
3
|
-
|
|
3
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
+
interface NeuralNetworkEffectProps extends ObjectReadyProps {
|
|
4
5
|
boundingRadius: number;
|
|
5
6
|
config: NeuralNetworkConfig;
|
|
6
7
|
animations?: AnimationOptions[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeuralNetworkEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/NeuralNetworkEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"NeuralNetworkEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/NeuralNetworkEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,UAAU,wBAAyB,SAAQ,gBAAgB;IACvD,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC;AA6BD,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA4J3D,CAAC;AACF,eAAe,mBAAmB,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { useRef, useMemo } from 'react';
|
|
|
3
3
|
import { useFrame } from '@react-three/fiber';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAnimations.js';
|
|
6
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
6
7
|
// Glow sprite for pulse signals and node flashes
|
|
7
8
|
const pulseVert = /* glsl */ `
|
|
8
9
|
attribute float aBright;
|
|
@@ -29,10 +30,11 @@ const pulseFrag = /* glsl */ `
|
|
|
29
30
|
}
|
|
30
31
|
`;
|
|
31
32
|
const MAX_PULSES = 4;
|
|
32
|
-
const NeuralNetworkEffect = ({ boundingRadius, config, animations }) => {
|
|
33
|
+
const NeuralNetworkEffect = ({ boundingRadius, config, animations, onObjectReady, onObjectDispose }) => {
|
|
33
34
|
const { nodeCount, signalSpeed, nodeColor, pulseColor, orbitSpeed, opacity, speed, intensity } = config;
|
|
34
35
|
const startValuesCacheRef = useRef({});
|
|
35
36
|
const groupRef = useRef(null);
|
|
37
|
+
useObjectReady(groupRef, config, onObjectReady, onObjectDispose);
|
|
36
38
|
// Node orbit state
|
|
37
39
|
const orbitAngles = useRef(new Float32Array(0));
|
|
38
40
|
const pulses = useRef([]);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { OrbConfig, AnimationOptions } from "@3driseai/3drise-core";
|
|
3
|
-
|
|
3
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
+
interface OrbEffectProps extends ObjectReadyProps {
|
|
4
5
|
boundingRadius: number;
|
|
5
6
|
config: OrbConfig;
|
|
6
7
|
animations?: AnimationOptions[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrbEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/OrbEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"OrbEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/OrbEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,UAAU,cAAe,SAAQ,gBAAgB;IAC7C,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC;AAqLD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA4GvC,CAAC;AACF,eAAe,SAAS,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { useRef, useMemo } from 'react';
|
|
|
3
3
|
import { useFrame } from '@react-three/fiber';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAnimations.js';
|
|
6
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
6
7
|
// ── Shared vert (normal + viewDir) ────────────────────────────────────────────
|
|
7
8
|
const sharedVert = /* glsl */ `
|
|
8
9
|
varying vec3 vNormal;
|
|
@@ -181,9 +182,11 @@ const coronaFrag = /* glsl */ `
|
|
|
181
182
|
gl_FragColor = vec4(col * (1.0 + pulse), alpha);
|
|
182
183
|
}
|
|
183
184
|
`;
|
|
184
|
-
const OrbEffect = ({ boundingRadius, config, animations }) => {
|
|
185
|
+
const OrbEffect = ({ boundingRadius, config, animations, onObjectReady, onObjectDispose }) => {
|
|
185
186
|
const { coreSize, glowLayers, innerColor, outerColor, coronaEnabled, coronaColor, noiseAmount, pulseSpeed, opacity, speed, intensity } = config;
|
|
186
187
|
const startValuesCacheRef = useRef({});
|
|
188
|
+
const rootRef = useRef(null);
|
|
189
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
187
190
|
const innerColorVec = useMemo(() => { const c = new THREE.Color(innerColor); return new THREE.Vector3(c.r, c.g, c.b); }, [innerColor]);
|
|
188
191
|
const outerColorVec = useMemo(() => { const c = new THREE.Color(outerColor); return new THREE.Vector3(c.r, c.g, c.b); }, [outerColor]);
|
|
189
192
|
const coronaColorVec = useMemo(() => { const c = new THREE.Color(coronaColor); return new THREE.Vector3(c.r, c.g, c.b); }, [coronaColor]);
|
|
@@ -282,7 +285,7 @@ const OrbEffect = ({ boundingRadius, config, animations }) => {
|
|
|
282
285
|
}
|
|
283
286
|
});
|
|
284
287
|
const glowR = coreR * (3.5 + glowLayers * 0.6);
|
|
285
|
-
return (_jsxs("group", { children: [_jsx("mesh", { material: coreMat, children: _jsx("sphereGeometry", { args: [coreR, 48, 48] }) }), Array.from({ length: glowLayers }, (_, i) => {
|
|
288
|
+
return (_jsxs("group", { ref: rootRef, children: [_jsx("mesh", { material: coreMat, children: _jsx("sphereGeometry", { args: [coreR, 48, 48] }) }), Array.from({ length: glowLayers }, (_, i) => {
|
|
286
289
|
const layerT = glowLayers > 1 ? i / (glowLayers - 1) : 0;
|
|
287
290
|
const r = coreR * (1.35 + layerT * layerT * 1.8);
|
|
288
291
|
return (_jsx("mesh", { material: shellMats[i], children: _jsx("sphereGeometry", { args: [r, 40, 40] }) }, i));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { PortalConfig, AnimationOptions } from "@3driseai/3drise-core";
|
|
3
|
-
|
|
3
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
+
interface PortalEffectProps extends ObjectReadyProps {
|
|
4
5
|
boundingRadius: number;
|
|
5
6
|
config: PortalConfig;
|
|
6
7
|
animations?: AnimationOptions[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortalEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/PortalEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"PortalEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/PortalEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,UAAU,iBAAkB,SAAQ,gBAAgB;IAChD,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC;AAgHD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA6E7C,CAAC;AACF,eAAe,YAAY,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { useRef, useMemo } from 'react';
|
|
|
3
3
|
import { useFrame } from '@react-three/fiber';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAnimations.js';
|
|
6
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
6
7
|
// Multi-layer vortex disc
|
|
7
8
|
const discVertShader = /* glsl */ `
|
|
8
9
|
varying vec2 vUv;
|
|
@@ -112,9 +113,11 @@ const dustFragShader = /* glsl */ `
|
|
|
112
113
|
gl_FragColor = vec4(uColor, vAlpha * uOpacity * glow);
|
|
113
114
|
}
|
|
114
115
|
`;
|
|
115
|
-
const PortalEffect = ({ boundingRadius, config, animations }) => {
|
|
116
|
+
const PortalEffect = ({ boundingRadius, config, animations, onObjectReady, onObjectDispose }) => {
|
|
116
117
|
const { radius, spiralTurns, innerGlowColor, outerGlowColor, rotationSpeed, particleRingEnabled, particleCount, opacity, speed, intensity } = config;
|
|
117
118
|
const startValuesCacheRef = useRef({});
|
|
119
|
+
const rootRef = useRef(null);
|
|
120
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
118
121
|
const r = boundingRadius * radius;
|
|
119
122
|
const innerColorVec = useMemo(() => { const c = new THREE.Color(innerGlowColor); return new THREE.Vector3(c.r, c.g, c.b); }, [innerGlowColor]);
|
|
120
123
|
const outerColorVec = useMemo(() => { const c = new THREE.Color(outerGlowColor); return new THREE.Vector3(c.r, c.g, c.b); }, [outerGlowColor]);
|
|
@@ -186,6 +189,6 @@ const PortalEffect = ({ boundingRadius, config, animations }) => {
|
|
|
186
189
|
applyGenerativeAnimations([discMaterial, dustMat], animations, startValuesCacheRef.current, Date.now(), false);
|
|
187
190
|
}
|
|
188
191
|
});
|
|
189
|
-
return (_jsxs("group", { rotation: [-Math.PI / 2, 0, 0], position: [0, -boundingRadius * 0.75, 0], children: [_jsx("mesh", { material: discMaterial, children: _jsx("circleGeometry", { args: [r, 80] }) }), particleRingEnabled && (_jsx("points", { geometry: dustGeo, material: dustMat }))] }));
|
|
192
|
+
return (_jsxs("group", { ref: rootRef, rotation: [-Math.PI / 2, 0, 0], position: [0, -boundingRadius * 0.75, 0], children: [_jsx("mesh", { material: discMaterial, children: _jsx("circleGeometry", { args: [r, 80] }) }), particleRingEnabled && (_jsx("points", { geometry: dustGeo, material: dustMat }))] }));
|
|
190
193
|
};
|
|
191
194
|
export default PortalEffect;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ShockwaveConfig, AnimationOptions } from "@3driseai/3drise-core";
|
|
3
|
-
|
|
3
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
+
interface ShockwaveEffectProps extends ObjectReadyProps {
|
|
4
5
|
boundingRadius: number;
|
|
5
6
|
config: ShockwaveConfig;
|
|
6
7
|
animations?: AnimationOptions[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShockwaveEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/ShockwaveEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ShockwaveEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/ShockwaveEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,UAAU,oBAAqB,SAAQ,gBAAgB;IACnD,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC;AAkFD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA4EnD,CAAC;AACF,eAAe,eAAe,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { useRef, useMemo, useEffect } from 'react';
|
|
|
3
3
|
import { useFrame } from '@react-three/fiber';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAnimations.js';
|
|
6
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
6
7
|
// Ring vertex — organic warp + vertical ripple
|
|
7
8
|
const vertexShader = /* glsl */ `
|
|
8
9
|
uniform float uProgress;
|
|
@@ -82,9 +83,11 @@ const flashVert = /* glsl */ `
|
|
|
82
83
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
83
84
|
}
|
|
84
85
|
`;
|
|
85
|
-
const ShockwaveEffect = ({ boundingRadius, config, animations }) => {
|
|
86
|
+
const ShockwaveEffect = ({ boundingRadius, config, animations, onObjectReady, onObjectDispose }) => {
|
|
86
87
|
const { ringCount, expansionRadius, thickness, intervalSeconds, color, rimColor, opacity, speed, intensity } = config;
|
|
87
88
|
const startValuesCacheRef = useRef({});
|
|
89
|
+
const rootRef = useRef(null);
|
|
90
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
88
91
|
const meshRefs = useRef([]);
|
|
89
92
|
const flashRefs = useRef([]);
|
|
90
93
|
const makeRingStates = (count, interval) => Array.from({ length: count }, (_, i) => ({
|
|
@@ -155,6 +158,6 @@ const ShockwaveEffect = ({ boundingRadius, config, animations }) => {
|
|
|
155
158
|
}
|
|
156
159
|
});
|
|
157
160
|
const flashR = radius * 1.05;
|
|
158
|
-
return (_jsx("group", { children: Array.from({ length: ringCount }, (_, i) => (_jsxs("group", { children: [_jsx("mesh", { ref: el => { meshRefs.current[i] = el; }, material: materials[i], rotation: [-Math.PI / 2, 0, 0], children: _jsx("torusGeometry", { args: [radius, thickness * intensity, 10, 80] }) }), _jsx("mesh", { ref: el => { flashRefs.current[i] = el; }, material: flashMaterials[i], rotation: [-Math.PI / 2, 0, 0], children: _jsx("circleGeometry", { args: [flashR, 48] }) })] }, i))) }));
|
|
161
|
+
return (_jsx("group", { ref: rootRef, children: Array.from({ length: ringCount }, (_, i) => (_jsxs("group", { children: [_jsx("mesh", { ref: el => { meshRefs.current[i] = el; }, material: materials[i], rotation: [-Math.PI / 2, 0, 0], children: _jsx("torusGeometry", { args: [radius, thickness * intensity, 10, 80] }) }), _jsx("mesh", { ref: el => { flashRefs.current[i] = el; }, material: flashMaterials[i], rotation: [-Math.PI / 2, 0, 0], children: _jsx("circleGeometry", { args: [flashR, 48] }) })] }, i))) }));
|
|
159
162
|
};
|
|
160
163
|
export default ShockwaveEffect;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { SmokePlumeConfig, AnimationOptions } from "@3driseai/3drise-core";
|
|
3
|
-
|
|
3
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
+
interface SmokePlumeEffectProps extends ObjectReadyProps {
|
|
4
5
|
boundingRadius: number;
|
|
5
6
|
config: SmokePlumeConfig;
|
|
6
7
|
animations?: AnimationOptions[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmokePlumeEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/SmokePlumeEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"SmokePlumeEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/SmokePlumeEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,UAAU,qBAAsB,SAAQ,gBAAgB;IACpD,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC;AA6ED,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA8DrD,CAAC;AACF,eAAe,gBAAgB,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { useRef, useMemo } from 'react';
|
|
|
3
3
|
import { useFrame } from '@react-three/fiber';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAnimations.js';
|
|
6
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
6
7
|
// ── Fully GPU-animated smoke puff vertex shader ───────────────────────────────
|
|
7
8
|
// Each particle has a lifetime t ∈ [0,1). It rises, expands, and billows.
|
|
8
9
|
// All motion driven by u_time — zero CPU writes per frame.
|
|
@@ -77,9 +78,11 @@ const smokeFrag = /* glsl */ `
|
|
|
77
78
|
gl_FragColor = vec4(col, g * vAlpha * uOpacity);
|
|
78
79
|
}
|
|
79
80
|
`;
|
|
80
|
-
const SmokePlumeEffect = ({ boundingRadius, config, animations }) => {
|
|
81
|
+
const SmokePlumeEffect = ({ boundingRadius, config, animations, onObjectReady, onObjectDispose }) => {
|
|
81
82
|
const { particleCount, height, spread, smokeColor, turbulence, opacity, speed, intensity } = config;
|
|
82
83
|
const startValuesCacheRef = useRef({});
|
|
84
|
+
const rootRef = useRef(null);
|
|
85
|
+
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
83
86
|
const h = boundingRadius * height;
|
|
84
87
|
const s = boundingRadius * spread;
|
|
85
88
|
const { geo, mat } = useMemo(() => {
|
|
@@ -136,6 +139,6 @@ const SmokePlumeEffect = ({ boundingRadius, config, animations }) => {
|
|
|
136
139
|
applyGenerativeAnimations([mat], animations, startValuesCacheRef.current, Date.now(), false);
|
|
137
140
|
}
|
|
138
141
|
});
|
|
139
|
-
return _jsx("points", { geometry: geo, material: mat });
|
|
142
|
+
return _jsx("points", { ref: rootRef, geometry: geo, material: mat });
|
|
140
143
|
};
|
|
141
144
|
export default SmokePlumeEffect;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SmokeRibbonConfig } from '@3driseai/3drise-core';
|
|
2
|
-
|
|
2
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
3
|
+
export interface SmokeRibbonProps extends ObjectReadyProps {
|
|
3
4
|
config?: SmokeRibbonConfig;
|
|
4
5
|
boundingRadius?: number;
|
|
5
6
|
}
|
|
@@ -8,6 +9,6 @@ export interface SmokeRibbonProps {
|
|
|
8
9
|
*
|
|
9
10
|
* <SmokeRibbon position={[0, 0, 0]} config={{ planes: 2, twistStart: 0.2 }} />
|
|
10
11
|
*/
|
|
11
|
-
declare const SmokeRibbon: ({ config, boundingRadius, ...groupProps }: SmokeRibbonProps) => import("react").JSX.Element;
|
|
12
|
+
declare const SmokeRibbon: ({ config, boundingRadius, onObjectReady, onObjectDispose, ...groupProps }: SmokeRibbonProps) => import("react").JSX.Element;
|
|
12
13
|
export default SmokeRibbon;
|
|
13
14
|
//# sourceMappingURL=SmokeRibbon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmokeRibbon.d.ts","sourceRoot":"","sources":["../../../src/components/effects/SmokeRibbon.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"SmokeRibbon.d.ts","sourceRoot":"","sources":["../../../src/components/effects/SmokeRibbon.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACtD,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;GAIG;AACH,QAAA,MAAM,WAAW,GAAI,2EAAoF,gBAAgB,gCA2DxH,CAAC;AACF,eAAe,WAAW,CAAC"}
|