@ntalmagor/3drize-viewer 0.1.2
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 +22 -0
- package/dist/components/AnimatedObject.d.ts.map +1 -0
- package/dist/components/AnimatedObject.js +121 -0
- package/dist/components/CameraController.d.ts +16 -0
- package/dist/components/CameraController.d.ts.map +1 -0
- package/dist/components/CameraController.js +132 -0
- package/dist/components/Clouds.d.ts +14 -0
- package/dist/components/Clouds.d.ts.map +1 -0
- package/dist/components/Clouds.js +97 -0
- package/dist/components/CreatedObject.d.ts +12 -0
- package/dist/components/CreatedObject.d.ts.map +1 -0
- package/dist/components/CreatedObject.js +139 -0
- package/dist/components/CustomPrimitive.d.ts +12 -0
- package/dist/components/CustomPrimitive.d.ts.map +1 -0
- package/dist/components/CustomPrimitive.js +80 -0
- package/dist/components/EffectsGenerator.d.ts +10 -0
- package/dist/components/EffectsGenerator.d.ts.map +1 -0
- package/dist/components/EffectsGenerator.js +59 -0
- package/dist/components/EffectsGroup.d.ts +8 -0
- package/dist/components/EffectsGroup.d.ts.map +1 -0
- package/dist/components/EffectsGroup.js +8 -0
- package/dist/components/EnvironmentManager.d.ts +9 -0
- package/dist/components/EnvironmentManager.d.ts.map +1 -0
- package/dist/components/EnvironmentManager.js +47 -0
- package/dist/components/Frame.d.ts +26 -0
- package/dist/components/Frame.d.ts.map +1 -0
- package/dist/components/Frame.js +50 -0
- package/dist/components/FrameGeometry.d.ts +10 -0
- package/dist/components/FrameGeometry.d.ts.map +1 -0
- package/dist/components/FrameGeometry.js +17 -0
- package/dist/components/FrameImage.d.ts +14 -0
- package/dist/components/FrameImage.d.ts.map +1 -0
- package/dist/components/FrameImage.js +15 -0
- package/dist/components/Galaxy.d.ts +8 -0
- package/dist/components/Galaxy.d.ts.map +1 -0
- package/dist/components/Galaxy.js +9 -0
- package/dist/components/GalleryLayout.d.ts +10 -0
- package/dist/components/GalleryLayout.d.ts.map +1 -0
- package/dist/components/GalleryLayout.js +18 -0
- package/dist/components/GridHelper.d.ts +23 -0
- package/dist/components/GridHelper.d.ts.map +1 -0
- package/dist/components/GridHelper.js +38 -0
- package/dist/components/ImageGeometry.d.ts +14 -0
- package/dist/components/ImageGeometry.d.ts.map +1 -0
- package/dist/components/ImageGeometry.js +62 -0
- package/dist/components/Lensflare.d.ts +12 -0
- package/dist/components/Lensflare.d.ts.map +1 -0
- package/dist/components/Lensflare.js +66 -0
- package/dist/components/Letter.d.ts +20 -0
- package/dist/components/Letter.d.ts.map +1 -0
- package/dist/components/Letter.js +83 -0
- package/dist/components/Letters.d.ts +16 -0
- package/dist/components/Letters.d.ts.map +1 -0
- package/dist/components/Letters.js +18 -0
- package/dist/components/LightsManager.d.ts +9 -0
- package/dist/components/LightsManager.d.ts.map +1 -0
- package/dist/components/LightsManager.js +121 -0
- package/dist/components/Lines.d.ts +9 -0
- package/dist/components/Lines.d.ts.map +1 -0
- package/dist/components/Lines.js +19 -0
- package/dist/components/LoadingIndicator.d.ts +10 -0
- package/dist/components/LoadingIndicator.d.ts.map +1 -0
- package/dist/components/LoadingIndicator.js +143 -0
- package/dist/components/MaterialLibrary.d.ts +9 -0
- package/dist/components/MaterialLibrary.d.ts.map +1 -0
- package/dist/components/MaterialLibrary.js +57 -0
- package/dist/components/Moon.d.ts +13 -0
- package/dist/components/Moon.d.ts.map +1 -0
- package/dist/components/Moon.js +52 -0
- package/dist/components/ObjectNode.d.ts +11 -0
- package/dist/components/ObjectNode.d.ts.map +1 -0
- package/dist/components/ObjectNode.js +61 -0
- package/dist/components/ObjectsRenderer.d.ts +11 -0
- package/dist/components/ObjectsRenderer.d.ts.map +1 -0
- package/dist/components/ObjectsRenderer.js +19 -0
- package/dist/components/Ocean.d.ts +8 -0
- package/dist/components/Ocean.d.ts.map +1 -0
- package/dist/components/Ocean.js +111 -0
- package/dist/components/ParticlesR3f.d.ts +16 -0
- package/dist/components/ParticlesR3f.d.ts.map +1 -0
- package/dist/components/ParticlesR3f.js +66 -0
- package/dist/components/Path.d.ts +13 -0
- package/dist/components/Path.d.ts.map +1 -0
- package/dist/components/Path.js +41 -0
- package/dist/components/PathGeometry.d.ts +11 -0
- package/dist/components/PathGeometry.d.ts.map +1 -0
- package/dist/components/PathGeometry.js +109 -0
- package/dist/components/PathRenderer.d.ts +14 -0
- package/dist/components/PathRenderer.d.ts.map +1 -0
- package/dist/components/PathRenderer.js +33 -0
- package/dist/components/ProductionScene.d.ts +29 -0
- package/dist/components/ProductionScene.d.ts.map +1 -0
- package/dist/components/ProductionScene.js +18 -0
- package/dist/components/ProjectLoader.d.ts +14 -0
- package/dist/components/ProjectLoader.d.ts.map +1 -0
- package/dist/components/ProjectLoader.js +76 -0
- package/dist/components/Rain.d.ts +8 -0
- package/dist/components/Rain.d.ts.map +1 -0
- package/dist/components/Rain.js +133 -0
- package/dist/components/SceneBuilder.d.ts +5 -0
- package/dist/components/SceneBuilder.d.ts.map +1 -0
- package/dist/components/SceneBuilder.js +104 -0
- package/dist/components/SceneFog.d.ts +8 -0
- package/dist/components/SceneFog.d.ts.map +1 -0
- package/dist/components/SceneFog.js +19 -0
- package/dist/components/ShootingStar.d.ts +16 -0
- package/dist/components/ShootingStar.d.ts.map +1 -0
- package/dist/components/ShootingStar.js +92 -0
- package/dist/components/ShootingStars.d.ts +8 -0
- package/dist/components/ShootingStars.d.ts.map +1 -0
- package/dist/components/ShootingStars.js +40 -0
- package/dist/components/SkyController.d.ts +10 -0
- package/dist/components/SkyController.d.ts.map +1 -0
- package/dist/components/SkyController.js +159 -0
- package/dist/components/SkyMesh.d.ts +11 -0
- package/dist/components/SkyMesh.d.ts.map +1 -0
- package/dist/components/SkyMesh.js +36 -0
- package/dist/components/SkySystem.d.ts +34 -0
- package/dist/components/SkySystem.d.ts.map +1 -0
- package/dist/components/SkySystem.js +47 -0
- package/dist/components/Skybox.d.ts +12 -0
- package/dist/components/Skybox.d.ts.map +1 -0
- package/dist/components/Skybox.js +79 -0
- package/dist/components/Stars.d.ts +14 -0
- package/dist/components/Stars.d.ts.map +1 -0
- package/dist/components/Stars.js +165 -0
- package/dist/components/SunLight.d.ts +15 -0
- package/dist/components/SunLight.d.ts.map +1 -0
- package/dist/components/SunLight.js +57 -0
- package/dist/components/Text2D.d.ts +9 -0
- package/dist/components/Text2D.d.ts.map +1 -0
- package/dist/components/Text2D.js +56 -0
- package/dist/components/Text3D.d.ts +10 -0
- package/dist/components/Text3D.d.ts.map +1 -0
- package/dist/components/Text3D.js +8 -0
- package/dist/components/effects/AuraEffect.d.ts +10 -0
- package/dist/components/effects/AuraEffect.d.ts.map +1 -0
- package/dist/components/effects/AuraEffect.js +127 -0
- package/dist/components/effects/AuroraEffect.d.ts +10 -0
- package/dist/components/effects/AuroraEffect.d.ts.map +1 -0
- package/dist/components/effects/AuroraEffect.js +112 -0
- package/dist/components/effects/BlackHoleEffect.d.ts +10 -0
- package/dist/components/effects/BlackHoleEffect.d.ts.map +1 -0
- package/dist/components/effects/BlackHoleEffect.js +193 -0
- package/dist/components/effects/ConstellationEffect.d.ts +10 -0
- package/dist/components/effects/ConstellationEffect.d.ts.map +1 -0
- package/dist/components/effects/ConstellationEffect.js +189 -0
- package/dist/components/effects/DataStreamEffect.d.ts +10 -0
- package/dist/components/effects/DataStreamEffect.d.ts.map +1 -0
- package/dist/components/effects/DataStreamEffect.js +138 -0
- package/dist/components/effects/DnaHelixEffect.d.ts +10 -0
- package/dist/components/effects/DnaHelixEffect.d.ts.map +1 -0
- package/dist/components/effects/DnaHelixEffect.js +311 -0
- package/dist/components/effects/FireEffect.d.ts +10 -0
- package/dist/components/effects/FireEffect.d.ts.map +1 -0
- package/dist/components/effects/FireEffect.js +194 -0
- package/dist/components/effects/ForcefieldEffect.d.ts +10 -0
- package/dist/components/effects/ForcefieldEffect.d.ts.map +1 -0
- package/dist/components/effects/ForcefieldEffect.js +132 -0
- package/dist/components/effects/HologramEffect.d.ts +10 -0
- package/dist/components/effects/HologramEffect.d.ts.map +1 -0
- package/dist/components/effects/HologramEffect.js +143 -0
- package/dist/components/effects/IceCrystalsEffect.d.ts +10 -0
- package/dist/components/effects/IceCrystalsEffect.d.ts.map +1 -0
- package/dist/components/effects/IceCrystalsEffect.js +190 -0
- package/dist/components/effects/LightningEffect.d.ts +10 -0
- package/dist/components/effects/LightningEffect.d.ts.map +1 -0
- package/dist/components/effects/LightningEffect.js +240 -0
- package/dist/components/effects/MoleculesEffect.d.ts +10 -0
- package/dist/components/effects/MoleculesEffect.d.ts.map +1 -0
- package/dist/components/effects/MoleculesEffect.js +179 -0
- package/dist/components/effects/NeuralNetworkEffect.d.ts +10 -0
- package/dist/components/effects/NeuralNetworkEffect.d.ts.map +1 -0
- package/dist/components/effects/NeuralNetworkEffect.js +188 -0
- package/dist/components/effects/OrbEffect.d.ts +10 -0
- package/dist/components/effects/OrbEffect.d.ts.map +1 -0
- package/dist/components/effects/OrbEffect.js +291 -0
- package/dist/components/effects/PortalEffect.d.ts +10 -0
- package/dist/components/effects/PortalEffect.d.ts.map +1 -0
- package/dist/components/effects/PortalEffect.js +191 -0
- package/dist/components/effects/ShockwaveEffect.d.ts +10 -0
- package/dist/components/effects/ShockwaveEffect.d.ts.map +1 -0
- package/dist/components/effects/ShockwaveEffect.js +159 -0
- package/dist/components/effects/SmokePlumeEffect.d.ts +10 -0
- package/dist/components/effects/SmokePlumeEffect.d.ts.map +1 -0
- package/dist/components/effects/SmokePlumeEffect.js +141 -0
- package/dist/components/effects/SmokeRingEffect.d.ts +10 -0
- package/dist/components/effects/SmokeRingEffect.d.ts.map +1 -0
- package/dist/components/effects/SmokeRingEffect.js +158 -0
- package/dist/components/effects/VolumetricFogEffect.d.ts +10 -0
- package/dist/components/effects/VolumetricFogEffect.d.ts.map +1 -0
- package/dist/components/effects/VolumetricFogEffect.js +111 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useAnimationEvents.d.ts +10 -0
- package/dist/hooks/useAnimationEvents.d.ts.map +1 -0
- package/dist/hooks/useAnimationEvents.js +28 -0
- package/dist/hooks/useCameraAnimation.d.ts +35 -0
- package/dist/hooks/useCameraAnimation.d.ts.map +1 -0
- package/dist/hooks/useCameraAnimation.js +268 -0
- package/dist/hooks/useContinuousEffects.d.ts +15 -0
- package/dist/hooks/useContinuousEffects.d.ts.map +1 -0
- package/dist/hooks/useContinuousEffects.js +173 -0
- package/dist/hooks/useCubeCamera.d.ts +19 -0
- package/dist/hooks/useCubeCamera.d.ts.map +1 -0
- package/dist/hooks/useCubeCamera.js +73 -0
- package/dist/hooks/useEnvironmentEffects.d.ts +12 -0
- package/dist/hooks/useEnvironmentEffects.d.ts.map +1 -0
- package/dist/hooks/useEnvironmentEffects.js +22 -0
- package/dist/hooks/useFrameEffects.d.ts +6 -0
- package/dist/hooks/useFrameEffects.d.ts.map +1 -0
- package/dist/hooks/useFrameEffects.js +19 -0
- package/dist/hooks/useInteractionEffects.d.ts +11 -0
- package/dist/hooks/useInteractionEffects.d.ts.map +1 -0
- package/dist/hooks/useInteractionEffects.js +35 -0
- package/dist/hooks/useKey.d.ts +26 -0
- package/dist/hooks/useKey.d.ts.map +1 -0
- package/dist/hooks/useKey.js +73 -0
- package/dist/hooks/useLightHandlers.d.ts +14 -0
- package/dist/hooks/useLightHandlers.d.ts.map +1 -0
- package/dist/hooks/useLightHandlers.js +116 -0
- package/dist/hooks/useMaterialApplication.d.ts +9 -0
- package/dist/hooks/useMaterialApplication.d.ts.map +1 -0
- package/dist/hooks/useMaterialApplication.js +113 -0
- package/dist/hooks/useMaterialOptions.d.ts +13 -0
- package/dist/hooks/useMaterialOptions.d.ts.map +1 -0
- package/dist/hooks/useMaterialOptions.js +110 -0
- package/dist/hooks/useMaterialUniforms.d.ts +18 -0
- package/dist/hooks/useMaterialUniforms.d.ts.map +1 -0
- package/dist/hooks/useMaterialUniforms.js +96 -0
- package/dist/hooks/useMeshController.d.ts +3 -0
- package/dist/hooks/useMeshController.d.ts.map +1 -0
- package/dist/hooks/useMeshController.js +152 -0
- package/dist/hooks/useMouseHandlers.d.ts +8 -0
- package/dist/hooks/useMouseHandlers.d.ts.map +1 -0
- package/dist/hooks/useMouseHandlers.js +47 -0
- package/dist/hooks/useObjectAnimation.d.ts +13 -0
- package/dist/hooks/useObjectAnimation.d.ts.map +1 -0
- package/dist/hooks/useObjectAnimation.js +11 -0
- package/dist/hooks/useObjectEdges.d.ts +4 -0
- package/dist/hooks/useObjectEdges.d.ts.map +1 -0
- package/dist/hooks/useObjectEdges.js +199 -0
- package/dist/hooks/useOrbitControls.d.ts +7 -0
- package/dist/hooks/useOrbitControls.d.ts.map +1 -0
- package/dist/hooks/useOrbitControls.js +9 -0
- package/dist/hooks/useParticlePositions.d.ts +19 -0
- package/dist/hooks/useParticlePositions.d.ts.map +1 -0
- package/dist/hooks/useParticlePositions.js +56 -0
- package/dist/hooks/useParticlesColors.d.ts +14 -0
- package/dist/hooks/useParticlesColors.d.ts.map +1 -0
- package/dist/hooks/useParticlesColors.js +27 -0
- package/dist/hooks/useParticlesTextures.d.ts +10 -0
- package/dist/hooks/useParticlesTextures.d.ts.map +1 -0
- package/dist/hooks/useParticlesTextures.js +23 -0
- package/dist/hooks/usePathAnimation.d.ts +26 -0
- package/dist/hooks/usePathAnimation.d.ts.map +1 -0
- package/dist/hooks/usePathAnimation.js +120 -0
- package/dist/hooks/useSkyAnimation.d.ts +14 -0
- package/dist/hooks/useSkyAnimation.d.ts.map +1 -0
- package/dist/hooks/useSkyAnimation.js +46 -0
- package/dist/hooks/useSkySystem.d.ts +26 -0
- package/dist/hooks/useSkySystem.d.ts.map +1 -0
- package/dist/hooks/useSkySystem.js +57 -0
- package/dist/hooks/useSkyUniforms.d.ts +18 -0
- package/dist/hooks/useSkyUniforms.d.ts.map +1 -0
- package/dist/hooks/useSkyUniforms.js +59 -0
- package/dist/hooks/useTransformControls.d.ts +6 -0
- package/dist/hooks/useTransformControls.d.ts.map +1 -0
- package/dist/hooks/useTransformControls.js +111 -0
- package/dist/hooks/useWaterEnvironment.d.ts +5 -0
- package/dist/hooks/useWaterEnvironment.d.ts.map +1 -0
- package/dist/hooks/useWaterEnvironment.js +27 -0
- package/dist/hooks/useWaterReflections.d.ts +17 -0
- package/dist/hooks/useWaterReflections.d.ts.map +1 -0
- package/dist/hooks/useWaterReflections.js +77 -0
- package/dist/index.d.ts +140 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -0
- package/dist/services/AnimationsManager.d.ts +33 -0
- package/dist/services/AnimationsManager.d.ts.map +1 -0
- package/dist/services/AnimationsManager.js +58 -0
- package/dist/services/FontManager.d.ts +32 -0
- package/dist/services/FontManager.d.ts.map +1 -0
- package/dist/services/FontManager.js +76 -0
- package/dist/services/TexturesManager.d.ts +17 -0
- package/dist/services/TexturesManager.d.ts.map +1 -0
- package/dist/services/TexturesManager.js +48 -0
- package/dist/shaders/RainMaterial.d.ts +34 -0
- package/dist/shaders/RainMaterial.d.ts.map +1 -0
- package/dist/shaders/RainMaterial.js +56 -0
- package/dist/shaders/ShaderEffectsMaterial.d.ts +279 -0
- package/dist/shaders/ShaderEffectsMaterial.d.ts.map +1 -0
- package/dist/shaders/ShaderEffectsMaterial.js +257 -0
- package/dist/shaders/ShootingStarMaterial.d.ts +14 -0
- package/dist/shaders/ShootingStarMaterial.d.ts.map +1 -0
- package/dist/shaders/ShootingStarMaterial.js +33 -0
- package/dist/shaders/SkyboxMaterial.d.ts +38 -0
- package/dist/shaders/SkyboxMaterial.d.ts.map +1 -0
- package/dist/shaders/SkyboxMaterial.js +57 -0
- package/dist/shaders/effects/EffectsVertexFunctions.glsl.d.ts +2 -0
- package/dist/shaders/effects/EffectsVertexFunctions.glsl.d.ts.map +1 -0
- package/dist/shaders/effects/EffectsVertexFunctions.glsl.js +167 -0
- package/dist/utils/CameraSingleton.d.ts +35 -0
- package/dist/utils/CameraSingleton.d.ts.map +1 -0
- package/dist/utils/CameraSingleton.js +178 -0
- package/dist/utils/anchorUtils.d.ts +10 -0
- package/dist/utils/anchorUtils.d.ts.map +1 -0
- package/dist/utils/anchorUtils.js +13 -0
- package/dist/utils/frameAnimations.d.ts +49 -0
- package/dist/utils/frameAnimations.d.ts.map +1 -0
- package/dist/utils/frameAnimations.js +213 -0
- package/dist/utils/handleGenerativeEffectsAnimations.d.ts +5 -0
- package/dist/utils/handleGenerativeEffectsAnimations.d.ts.map +1 -0
- package/dist/utils/handleGenerativeEffectsAnimations.js +268 -0
- package/dist/utils/hasHoverAnimation.d.ts +3 -0
- package/dist/utils/hasHoverAnimation.d.ts.map +1 -0
- package/dist/utils/hasHoverAnimation.js +15 -0
- package/dist/utils/particleAnimations.d.ts +3 -0
- package/dist/utils/particleAnimations.d.ts.map +1 -0
- package/dist/utils/particleAnimations.js +17 -0
- package/dist/utils/sceneQuery.d.ts +9 -0
- package/dist/utils/sceneQuery.d.ts.map +1 -0
- package/dist/utils/sceneQuery.js +22 -0
- package/dist/utils/shaderUtils.d.ts +6 -0
- package/dist/utils/shaderUtils.d.ts.map +1 -0
- package/dist/utils/shaderUtils.js +145 -0
- package/dist/utils/textEffects.d.ts +31 -0
- package/dist/utils/textEffects.d.ts.map +1 -0
- package/dist/utils/textEffects.js +61 -0
- package/dist/utils/utils3d.d.ts +7 -0
- package/dist/utils/utils3d.d.ts.map +1 -0
- package/dist/utils/utils3d.js +34 -0
- package/package.json +43 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Object3D } from 'three';
|
|
3
|
+
import type { ThreeEvent } from '@react-three/fiber';
|
|
4
|
+
import type { AnimatedTransform, AnchorSettings, CreatedObjectSettings } from '@ntalmagor/3drize-core';
|
|
5
|
+
export interface AnimatedObjectProps {
|
|
6
|
+
stateKey: string;
|
|
7
|
+
transitionSettings: AnimatedTransform;
|
|
8
|
+
createdObject: CreatedObjectSettings;
|
|
9
|
+
speed?: number;
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
parentRef?: React.RefObject<Object3D>;
|
|
13
|
+
onClick?: (e: ThreeEvent<MouseEvent>) => void;
|
|
14
|
+
onPointerEnter?: (e: ThreeEvent<PointerEvent>) => void;
|
|
15
|
+
onPointerLeave?: (e: ThreeEvent<PointerEvent>) => void;
|
|
16
|
+
anchor?: AnchorSettings | null;
|
|
17
|
+
hovered?: boolean;
|
|
18
|
+
animateMaterial?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const AnimatedObject: React.FC<AnimatedObjectProps>;
|
|
21
|
+
export default AnimatedObject;
|
|
22
|
+
//# sourceMappingURL=AnimatedObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimatedObject.d.ts","sourceRoot":"","sources":["../../src/components/AnimatedObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAEpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAQvG,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,iBAAiB,CAAC;IACtC,aAAa,EAAE,qBAAqB,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC9C,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IACvD,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IACvD,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;CAE3B;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAsJvD,CAAC;AAGH,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useEffect, useCallback, memo } from 'react';
|
|
3
|
+
import { useFrame } from '@react-three/fiber';
|
|
4
|
+
import { useAnimationEvents } from '../hooks/useAnimationEvents';
|
|
5
|
+
import { usePathAnimation } from '../hooks/usePathAnimation';
|
|
6
|
+
import AnimationsManager from '../../../core/src/services/AnimationsManager';
|
|
7
|
+
import { applyAnchorSettings } from '../utils/anchorUtils';
|
|
8
|
+
import EffectsGroup from './EffectsGroup';
|
|
9
|
+
import { useObjectAnimation } from '../hooks/useObjectAnimation';
|
|
10
|
+
export const AnimatedObject = memo(({ stateKey, transitionSettings, createdObject,
|
|
11
|
+
// speed = 1,
|
|
12
|
+
visible = true, children, parentRef, onClick, onPointerEnter, onPointerLeave, anchor, hovered = false, animateMaterial = true,
|
|
13
|
+
// isActive = false,
|
|
14
|
+
}) => {
|
|
15
|
+
const internalRef = useRef(null);
|
|
16
|
+
const groupRef = parentRef ?? internalRef;
|
|
17
|
+
const { position, scale, rotation, targetPosition, targetScale, targetRotation } = transitionSettings;
|
|
18
|
+
const animationStartTime = useRef(null);
|
|
19
|
+
const stepDuration = useRef(1);
|
|
20
|
+
const stepEase = useRef('linear');
|
|
21
|
+
const animProgress = useRef(0);
|
|
22
|
+
const baseRef = useRef({ position: [...position], scale: [...scale], rotation: [...rotation] });
|
|
23
|
+
const targetRef = useRef({
|
|
24
|
+
position: targetPosition ? [...targetPosition] : [...position],
|
|
25
|
+
scale: targetScale ? [...targetScale] : [...scale],
|
|
26
|
+
rotation: targetRotation ? [...targetRotation] : [...rotation],
|
|
27
|
+
});
|
|
28
|
+
useObjectAnimation(createdObject, animateMaterial, {
|
|
29
|
+
enabled: createdObject.type !== 'gallery', //
|
|
30
|
+
hovered,
|
|
31
|
+
});
|
|
32
|
+
const { startPathAnimation, updatePathAnimation, isAnimating: isPathAnimating } = usePathAnimation();
|
|
33
|
+
const syncTransform = useCallback(() => {
|
|
34
|
+
const obj = groupRef.current;
|
|
35
|
+
if (!obj)
|
|
36
|
+
return;
|
|
37
|
+
baseRef.current = { position: [...position], scale: [...scale], rotation: [...rotation] };
|
|
38
|
+
targetRef.current = {
|
|
39
|
+
position: targetPosition ? [...targetPosition] : [...position],
|
|
40
|
+
scale: targetScale ? [...targetScale] : [...scale],
|
|
41
|
+
rotation: targetRotation ? [...targetRotation] : [...rotation],
|
|
42
|
+
};
|
|
43
|
+
obj.position.set(...position);
|
|
44
|
+
obj.scale.set(...scale);
|
|
45
|
+
obj.rotation.set(...rotation);
|
|
46
|
+
if (targetPosition || targetScale || targetRotation)
|
|
47
|
+
animProgress.current = 0;
|
|
48
|
+
}, [position, scale, rotation, targetPosition, targetScale, targetRotation]);
|
|
49
|
+
useEffect(() => { syncTransform(); }, [position, scale, rotation, targetPosition, targetScale, targetRotation]);
|
|
50
|
+
useAnimationEvents({
|
|
51
|
+
onStepStart: (event) => {
|
|
52
|
+
if (!event.step?.transitions)
|
|
53
|
+
return;
|
|
54
|
+
const d = event.step.duration || 1;
|
|
55
|
+
for (const { state, properties, pathId } of event.step.transitions) {
|
|
56
|
+
if (state !== stateKey)
|
|
57
|
+
continue;
|
|
58
|
+
if (properties.to.visible === false) {
|
|
59
|
+
if (groupRef.current)
|
|
60
|
+
groupRef.current.visible = false;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
if (groupRef.current)
|
|
64
|
+
groupRef.current.visible = true;
|
|
65
|
+
stepDuration.current = d;
|
|
66
|
+
stepEase.current = event.step.ease || 'linear';
|
|
67
|
+
animationStartTime.current = performance.now();
|
|
68
|
+
animProgress.current = 0;
|
|
69
|
+
if (pathId) {
|
|
70
|
+
startPathAnimation(pathId, d, { ease: stepEase.current });
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const cur = targetRef.current;
|
|
74
|
+
baseRef.current = {
|
|
75
|
+
position: (properties.from?.position ? [...properties.from.position] : cur.position),
|
|
76
|
+
rotation: (properties.from?.rotation ? [...properties.from.rotation] : cur.rotation),
|
|
77
|
+
scale: (properties.from?.scale ? [...properties.from.scale] : cur.scale),
|
|
78
|
+
};
|
|
79
|
+
targetRef.current = {
|
|
80
|
+
position: (properties.to?.position ? [...properties.to.position] : cur.position),
|
|
81
|
+
rotation: (properties.to?.rotation ? [...properties.to.rotation] : cur.rotation),
|
|
82
|
+
scale: (properties.to?.scale ? [...properties.to.scale] : cur.scale),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
const applyTransformProgress = useCallback(() => {
|
|
90
|
+
const obj = groupRef.current;
|
|
91
|
+
if (!obj || animationStartTime.current === null)
|
|
92
|
+
return;
|
|
93
|
+
const p = AnimationsManager.getProgressFromTime(animationStartTime.current, stepDuration.current, stepEase.current);
|
|
94
|
+
animProgress.current = p;
|
|
95
|
+
const b = baseRef.current, t = targetRef.current;
|
|
96
|
+
obj.position.set(b.position[0] + (t.position[0] - b.position[0]) * p, b.position[1] + (t.position[1] - b.position[1]) * p, b.position[2] + (t.position[2] - b.position[2]) * p);
|
|
97
|
+
obj.scale.set(b.scale[0] + (t.scale[0] - b.scale[0]) * p, b.scale[1] + (t.scale[1] - b.scale[1]) * p, b.scale[2] + (t.scale[2] - b.scale[2]) * p);
|
|
98
|
+
obj.rotation.set(b.rotation[0] + (t.rotation[0] - b.rotation[0]) * p, b.rotation[1] + (t.rotation[1] - b.rotation[1]) * p, b.rotation[2] + (t.rotation[2] - b.rotation[2]) * p);
|
|
99
|
+
}, []);
|
|
100
|
+
useFrame((_state, delta) => {
|
|
101
|
+
if (!visible || !groupRef.current)
|
|
102
|
+
return;
|
|
103
|
+
if (animProgress.current < 1) {
|
|
104
|
+
if (isPathAnimating()) {
|
|
105
|
+
const still = updatePathAnimation(delta, groupRef.current);
|
|
106
|
+
if (!still) {
|
|
107
|
+
animProgress.current = 1;
|
|
108
|
+
animationStartTime.current = null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else if (animationStartTime.current !== null) {
|
|
112
|
+
applyTransformProgress();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (anchor)
|
|
116
|
+
applyAnchorSettings(anchor, groupRef.current, rotation);
|
|
117
|
+
});
|
|
118
|
+
return (_jsx(_Fragment, { children: _jsxs("group", { ref: groupRef, position: position, scale: scale, rotation: rotation, visible: visible, onClick: (e) => { e.stopPropagation(); onClick?.(e); }, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, name: createdObject.meshSettings.name, userData: { id: createdObject.id }, children: [children, _jsx(EffectsGroup, { createdObject: createdObject })] }) }));
|
|
119
|
+
});
|
|
120
|
+
AnimatedObject.displayName = 'AnimatedObject';
|
|
121
|
+
export default AnimatedObject;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CameraState } from '@ntalmagor/3drize-core';
|
|
2
|
+
interface CameraControllerProps {
|
|
3
|
+
enableAutoAnimation?: boolean;
|
|
4
|
+
animationDuration?: number;
|
|
5
|
+
animationEase?: string;
|
|
6
|
+
settings: CameraState;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* CameraController - React Three Fiber component that syncs camera with Redux state
|
|
10
|
+
* This component should be placed inside the Canvas component
|
|
11
|
+
*
|
|
12
|
+
* Simplified: Just applies state to camera. Animation is handled via useAnimationEvents.
|
|
13
|
+
*/
|
|
14
|
+
export declare const CameraController: React.FC<CameraControllerProps>;
|
|
15
|
+
export default CameraController;
|
|
16
|
+
//# sourceMappingURL=CameraController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CameraController.d.ts","sourceRoot":"","sources":["../../src/components/CameraController.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAiC,MAAM,wBAAwB,CAAC;AAKzF,UAAU,qBAAqB;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,WAAW,CAAA;CACtB;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA+I5D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { useFrame, useThree } from '@react-three/fiber';
|
|
3
|
+
import { useDispatch } from 'react-redux';
|
|
4
|
+
import { useCameraAnimation } from '../hooks/useCameraAnimation';
|
|
5
|
+
import { cameraManager } from '../utils/CameraSingleton';
|
|
6
|
+
import { useAnimationEvents } from '../hooks/useAnimationEvents';
|
|
7
|
+
import { usePathAnimation } from '../hooks/usePathAnimation';
|
|
8
|
+
/**
|
|
9
|
+
* CameraController - React Three Fiber component that syncs camera with Redux state
|
|
10
|
+
* This component should be placed inside the Canvas component
|
|
11
|
+
*
|
|
12
|
+
* Simplified: Just applies state to camera. Animation is handled via useAnimationEvents.
|
|
13
|
+
*/
|
|
14
|
+
export const CameraController = ({ enableAutoAnimation = true, animationDuration = 1, animationEase = "power2.out", settings }) => {
|
|
15
|
+
const { camera, set } = useThree();
|
|
16
|
+
const dispatch = useDispatch();
|
|
17
|
+
const cameraRef = useRef(camera);
|
|
18
|
+
const transformAnimationProgress = useRef(0);
|
|
19
|
+
// Redux selectors
|
|
20
|
+
const { position, orientation, fov, near, far } = settings;
|
|
21
|
+
const { startPathAnimation, updatePathAnimation, isAnimating: isPathAnimating, } = usePathAnimation();
|
|
22
|
+
// Use camera animation hook for animated transitions (via events)
|
|
23
|
+
const { animateCamera, animateHandlers, isAnimating } = useCameraAnimation({
|
|
24
|
+
autoAnimate: false,
|
|
25
|
+
defaultDuration: animationDuration,
|
|
26
|
+
defaultEase: animationEase
|
|
27
|
+
});
|
|
28
|
+
// Track if currently in an animated transition
|
|
29
|
+
const isInAnimatedTransition = useRef(false);
|
|
30
|
+
// Register camera with singleton on mount and when camera changes
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
cameraRef.current = camera;
|
|
33
|
+
set({ camera: cameraRef.current });
|
|
34
|
+
cameraManager.setCamera(cameraRef.current);
|
|
35
|
+
}, [camera, set]);
|
|
36
|
+
// Sync camera position and orientation from state (only when not animating)
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (isInAnimatedTransition.current || isAnimating())
|
|
39
|
+
return;
|
|
40
|
+
const cam = cameraRef.current;
|
|
41
|
+
if (!cam)
|
|
42
|
+
return;
|
|
43
|
+
// Check if camera is already synced
|
|
44
|
+
if (!cameraManager.isSynced(position, orientation)) {
|
|
45
|
+
cam.position.set(...position);
|
|
46
|
+
if (orientation.length === 4) {
|
|
47
|
+
cam.quaternion.set(...orientation);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
cam.rotation.set(orientation[0], orientation[1], orientation[2]);
|
|
51
|
+
}
|
|
52
|
+
console.log("CameraController: Synced position/orientation", position, orientation);
|
|
53
|
+
}
|
|
54
|
+
}, [position, orientation]);
|
|
55
|
+
// Sync camera projection settings from state
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const cam = cameraRef.current;
|
|
58
|
+
if (!cam)
|
|
59
|
+
return;
|
|
60
|
+
let needsUpdate = false;
|
|
61
|
+
if (cam.fov !== fov) {
|
|
62
|
+
cam.fov = fov;
|
|
63
|
+
needsUpdate = true;
|
|
64
|
+
}
|
|
65
|
+
if (cam.near !== near) {
|
|
66
|
+
cam.near = near;
|
|
67
|
+
needsUpdate = true;
|
|
68
|
+
}
|
|
69
|
+
if (cam.far !== far) {
|
|
70
|
+
cam.far = far;
|
|
71
|
+
needsUpdate = true;
|
|
72
|
+
}
|
|
73
|
+
if (needsUpdate) {
|
|
74
|
+
cam.updateProjectionMatrix();
|
|
75
|
+
}
|
|
76
|
+
}, [fov, near, far]);
|
|
77
|
+
// Handle animation events (step-based animations)
|
|
78
|
+
useAnimationEvents({
|
|
79
|
+
onStepStart: (event) => {
|
|
80
|
+
console.log('Camera controller - Step started:', event.step);
|
|
81
|
+
if (event.step?.transitions) {
|
|
82
|
+
const stepDuration = event.step.duration || 1;
|
|
83
|
+
event.step.transitions.forEach((transition) => {
|
|
84
|
+
const { state, properties, pathId } = transition;
|
|
85
|
+
if (state === 'camera') {
|
|
86
|
+
isInAnimatedTransition.current = true;
|
|
87
|
+
// dispatch(setControls({ enablePan: false, enableRotate: false, enableZoom: false }));
|
|
88
|
+
const targetSettings = {
|
|
89
|
+
fov: properties.to.fov,
|
|
90
|
+
near: properties.to.near,
|
|
91
|
+
far: properties.to.far,
|
|
92
|
+
};
|
|
93
|
+
if (!pathId) {
|
|
94
|
+
targetSettings.position = properties.to.position;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
const offset = camera
|
|
98
|
+
? [camera.position.x, camera.position.y, camera.position.z]
|
|
99
|
+
: [0, 0, 0];
|
|
100
|
+
console.log(`Starting path animation with ID ${pathId} and offset`, offset);
|
|
101
|
+
startPathAnimation(pathId, stepDuration, {
|
|
102
|
+
offset,
|
|
103
|
+
applyRotation: false
|
|
104
|
+
});
|
|
105
|
+
transformAnimationProgress.current = 0;
|
|
106
|
+
}
|
|
107
|
+
console.log("Animating camera to:", targetSettings, "over duration:", stepDuration);
|
|
108
|
+
animateCamera(targetSettings, stepDuration, event.step?.ease, properties.to.target)
|
|
109
|
+
.then(() => {
|
|
110
|
+
isInAnimatedTransition.current = false;
|
|
111
|
+
// dispatch(setControls({ enablePan: true, enableRotate: true, enableZoom: true, target: properties.to.target || undefined }));
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
// Frame loop for path animations and mouse handlers
|
|
119
|
+
useFrame((state, delta) => {
|
|
120
|
+
if (isPathAnimating()) {
|
|
121
|
+
const stillAnimating = updatePathAnimation(delta, camera);
|
|
122
|
+
if (!stillAnimating) {
|
|
123
|
+
transformAnimationProgress.current = 1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
animateHandlers(state.pointer);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
return null;
|
|
131
|
+
};
|
|
132
|
+
export default CameraController;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MaterialSettings } from '../../../core/src/types/materials';
|
|
3
|
+
import type { TimeSettings } from '../../../core/src/types/scene3d';
|
|
4
|
+
export interface CloudsProps {
|
|
5
|
+
visible?: boolean;
|
|
6
|
+
scale?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
speed?: number;
|
|
9
|
+
materialSettings?: MaterialSettings;
|
|
10
|
+
timeSettings: TimeSettings;
|
|
11
|
+
}
|
|
12
|
+
declare const Clouds: React.FC<CloudsProps>;
|
|
13
|
+
export default Clouds;
|
|
14
|
+
//# sourceMappingURL=Clouds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Clouds.d.ts","sourceRoot":"","sources":["../../src/components/Clouds.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAK7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAkBpE,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAwGjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState, useCallback } from 'react';
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
import { useThree, useFrame } from '@react-three/fiber';
|
|
5
|
+
import { useMaterialApplication } from '../hooks/useMaterialApplication';
|
|
6
|
+
import { useSkySystem } from '../hooks/useSkySystem';
|
|
7
|
+
const CLOUD_COLORS = {
|
|
8
|
+
night: new THREE.Color(0.1, 0.1, 0.2),
|
|
9
|
+
sunrise: new THREE.Color(0.8, 0.4, 0.4),
|
|
10
|
+
midday: new THREE.Color(1.0, 1.0, 1.0),
|
|
11
|
+
sunset: new THREE.Color(0.8, 0.3, 0.3),
|
|
12
|
+
};
|
|
13
|
+
const DEFAULT_MATERIAL = {
|
|
14
|
+
materialType: 'clouds',
|
|
15
|
+
materialVariant: 'Sky Clouds Bright',
|
|
16
|
+
u_time: 0,
|
|
17
|
+
u_resolution: [800, 600],
|
|
18
|
+
u_cameraPos: [0, 0, 0],
|
|
19
|
+
u_cloudColor: [1.0, 1.0, 1.0],
|
|
20
|
+
};
|
|
21
|
+
const Clouds = ({ visible = true, scale = 1, height = 400, speed = 1, materialSettings, timeSettings, }) => {
|
|
22
|
+
const [meshNode, setMeshNode] = useState(null);
|
|
23
|
+
const cloudAnimTime = useRef(0);
|
|
24
|
+
const { camera } = useThree();
|
|
25
|
+
const cloudColorRef = useRef(new THREE.Color(1, 1, 1));
|
|
26
|
+
const targetCloudColorRef = useRef(new THREE.Color(1, 1, 1));
|
|
27
|
+
const meshRefCallback = useCallback((node) => {
|
|
28
|
+
setMeshNode(node);
|
|
29
|
+
}, []);
|
|
30
|
+
const effectiveMaterialSettings = materialSettings ?? DEFAULT_MATERIAL;
|
|
31
|
+
useMaterialApplication(meshNode, effectiveMaterialSettings, true);
|
|
32
|
+
const handleTimeUpdate = useCallback((state) => {
|
|
33
|
+
const { normalizedTime, isDaytime, delta } = state;
|
|
34
|
+
if (isDaytime) {
|
|
35
|
+
if (normalizedTime <= 0.15) {
|
|
36
|
+
targetCloudColorRef.current.lerpColors(CLOUD_COLORS.night, CLOUD_COLORS.sunrise, normalizedTime / 0.15);
|
|
37
|
+
}
|
|
38
|
+
else if (normalizedTime <= 0.25) {
|
|
39
|
+
targetCloudColorRef.current.lerpColors(CLOUD_COLORS.sunrise, CLOUD_COLORS.midday, (normalizedTime - 0.15) / 0.10);
|
|
40
|
+
}
|
|
41
|
+
else if (normalizedTime <= 0.75) {
|
|
42
|
+
targetCloudColorRef.current.copy(CLOUD_COLORS.midday);
|
|
43
|
+
}
|
|
44
|
+
else if (normalizedTime <= 0.85) {
|
|
45
|
+
targetCloudColorRef.current.lerpColors(CLOUD_COLORS.midday, CLOUD_COLORS.sunset, (normalizedTime - 0.75) / 0.10);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
targetCloudColorRef.current.lerpColors(CLOUD_COLORS.sunset, CLOUD_COLORS.night, (normalizedTime - 0.85) / 0.15);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
targetCloudColorRef.current.copy(CLOUD_COLORS.night);
|
|
53
|
+
}
|
|
54
|
+
const colorLerpSpeed = Math.min(1, 2.0 * (delta || 0.016));
|
|
55
|
+
cloudColorRef.current.lerp(targetCloudColorRef.current, colorLerpSpeed);
|
|
56
|
+
}, []);
|
|
57
|
+
const { sunDirection } = useSkySystem({
|
|
58
|
+
timeSettings,
|
|
59
|
+
onTimeUpdate: handleTimeUpdate,
|
|
60
|
+
enabled: visible,
|
|
61
|
+
});
|
|
62
|
+
useFrame(() => {
|
|
63
|
+
if (!visible || !meshNode?.material)
|
|
64
|
+
return;
|
|
65
|
+
const material = meshNode.material;
|
|
66
|
+
const uniforms = material?.uniforms;
|
|
67
|
+
if (!uniforms)
|
|
68
|
+
return;
|
|
69
|
+
cloudAnimTime.current += 0.02 * speed;
|
|
70
|
+
if (uniforms.u_time)
|
|
71
|
+
uniforms.u_time.value = cloudAnimTime.current;
|
|
72
|
+
if (uniforms.u_cameraPos) {
|
|
73
|
+
uniforms.u_cameraPos.value?.copy
|
|
74
|
+
? uniforms.u_cameraPos.value.copy(camera.position)
|
|
75
|
+
: (uniforms.u_cameraPos.value = camera.position.clone());
|
|
76
|
+
}
|
|
77
|
+
if (uniforms.u_cloudColor) {
|
|
78
|
+
uniforms.u_cloudColor.value?.copy
|
|
79
|
+
? uniforms.u_cloudColor.value.copy(cloudColorRef.current)
|
|
80
|
+
: (uniforms.u_cloudColor.value = cloudColorRef.current.clone());
|
|
81
|
+
}
|
|
82
|
+
if (uniforms.u_resolution) {
|
|
83
|
+
uniforms.u_resolution.value?.set
|
|
84
|
+
? uniforms.u_resolution.value.set(window.innerWidth, window.innerHeight)
|
|
85
|
+
: (uniforms.u_resolution.value = new THREE.Vector2(window.innerWidth, window.innerHeight));
|
|
86
|
+
}
|
|
87
|
+
if (uniforms.u_sunPosition && sunDirection) {
|
|
88
|
+
uniforms.u_sunPosition.value?.copy
|
|
89
|
+
? uniforms.u_sunPosition.value.copy(sunDirection)
|
|
90
|
+
: (uniforms.u_sunPosition.value = sunDirection.clone());
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
if (!visible)
|
|
94
|
+
return null;
|
|
95
|
+
return (_jsx("mesh", { ref: meshRefCallback, name: "SkyClouds", userData: { id: '3drise-clouds' }, position: [0, height, 0], rotation: [Math.PI / 2, 0, 0], scale: scale, renderOrder: -1, frustumCulled: false, children: _jsx("planeGeometry", { args: [2, 2] }) }));
|
|
96
|
+
};
|
|
97
|
+
export default Clouds;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CreatedObjectSettings } from "@ntalmagor/3drize-core";
|
|
3
|
+
import { Object3D } from "three";
|
|
4
|
+
interface CreatedObjectProps {
|
|
5
|
+
createdObject: CreatedObjectSettings;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
shouldApply3driseMaterial?: boolean;
|
|
8
|
+
onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const CreatedObject: React.FC<CreatedObjectProps>;
|
|
11
|
+
export default CreatedObject;
|
|
12
|
+
//# sourceMappingURL=CreatedObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreatedObject.d.ts","sourceRoot":"","sources":["../../src/components/CreatedObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAGjE,OAAO,KAAK,EAAe,qBAAqB,EAAkC,MAAM,wBAAwB,CAAC;AAOjH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAoBjC,UAAU,kBAAkB;IAC1B,aAAa,EAAE,qBAAqB,CAAC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;CAExE;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAuL9C,CAAC;AAIH,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useEffect, useState, memo } from "react";
|
|
3
|
+
import { useDispatch } from "react-redux";
|
|
4
|
+
import { DEFAULT_EDGES_SETTINGS } from "@ntalmagor/3drize-core";
|
|
5
|
+
import { useMaterialApplication } from "../hooks/useMaterialApplication";
|
|
6
|
+
import { useTransformControls } from "../hooks/useTransformControls";
|
|
7
|
+
import { RigidBody } from '@react-three/rapier';
|
|
8
|
+
import { cameraManager } from "../utils/CameraSingleton";
|
|
9
|
+
import AnimatedObject from "./AnimatedObject";
|
|
10
|
+
import { useFrameEffects } from "../hooks/useFrameEffects";
|
|
11
|
+
// import { useSceneClick } from "~/contextProviders/SceneClickContext";
|
|
12
|
+
import { useObjectEdges } from "../hooks/useObjectEdges";
|
|
13
|
+
const CreatedObject = memo(({ createdObject, children, shouldApply3driseMaterial = true, onObjectReady, }) => {
|
|
14
|
+
const isSelected = false;
|
|
15
|
+
// const isSelected = useObjectSelection(createdObject.id);
|
|
16
|
+
// const { handleObjectClick: contextHandleObjectClick } = useSceneClick();
|
|
17
|
+
const dispatch = useDispatch();
|
|
18
|
+
const meshRef = useRef(null);
|
|
19
|
+
const transformRef = useRef(null);
|
|
20
|
+
const baseColorRef = useRef(("color" in createdObject.materialSettings && createdObject.materialSettings.color) || '#ffffff');
|
|
21
|
+
// const [hovered, setHovered] = useState(false);
|
|
22
|
+
const [animatedTransform, setAnimatedTransform] = useState({
|
|
23
|
+
position: createdObject.meshSettings.position,
|
|
24
|
+
rotation: createdObject.meshSettings.rotation,
|
|
25
|
+
scale: createdObject.meshSettings.scale,
|
|
26
|
+
});
|
|
27
|
+
// Initialize transform controls
|
|
28
|
+
const { controllersRef } = useTransformControls();
|
|
29
|
+
const { handlePointerEnter, handlePointerLeave, hovered } = useFrameEffects(isSelected);
|
|
30
|
+
const [mountedObject, setMountedObject] = useState(null);
|
|
31
|
+
useObjectEdges(meshRef.current, createdObject.edgesSettings ?? DEFAULT_EDGES_SETTINGS);
|
|
32
|
+
// useObjectGenerativeEffects(mountedObject, createdObject.effects);
|
|
33
|
+
useMaterialApplication(meshRef.current, createdObject.materialSettings, shouldApply3driseMaterial);
|
|
34
|
+
const anchoredPosition = cameraManager.getAnchorPosition(createdObject.meshSettings.anchor?.anchor || 'center', 0, createdObject.meshSettings.anchor?.offset || { y: 0, x: 0, z: 0 }, createdObject.meshSettings.anchor?.padding || 0);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (meshRef.current) {
|
|
37
|
+
meshRef.current.userData.id = createdObject.id;
|
|
38
|
+
onObjectReady && onObjectReady(createdObject, meshRef.current);
|
|
39
|
+
}
|
|
40
|
+
return () => {
|
|
41
|
+
};
|
|
42
|
+
}, [meshRef.current]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (transformRef.current && isSelected) {
|
|
45
|
+
controllersRef.current.set(createdObject.id.toString(), transformRef.current);
|
|
46
|
+
// console.log('Transform controls registered for object:', createdObject.id, createdObject.name);
|
|
47
|
+
}
|
|
48
|
+
return () => {
|
|
49
|
+
controllersRef.current.delete(createdObject.id.toString());
|
|
50
|
+
// console.log('Transform controls unregistered for object:', createdObject.id, createdObject.name);
|
|
51
|
+
};
|
|
52
|
+
}, [createdObject.id, isSelected]);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
setAnimatedTransform({
|
|
55
|
+
position: createdObject.meshSettings.position,
|
|
56
|
+
rotation: createdObject.meshSettings.rotation,
|
|
57
|
+
scale: createdObject.meshSettings.scale,
|
|
58
|
+
});
|
|
59
|
+
}, [createdObject.meshSettings.position, createdObject.meshSettings.rotation, createdObject.meshSettings.scale]);
|
|
60
|
+
// const [noiseTexture, setNoiseTexture] = useState<Texture | null>(null);
|
|
61
|
+
const isTransforming = useRef(false);
|
|
62
|
+
// useMaterialApplication(obj.object, createdObject.materialSettings);
|
|
63
|
+
// Check if this should use the new MaterialLibrary system for Drei materials
|
|
64
|
+
// console.log(object)
|
|
65
|
+
const handleObjectEnter = (e) => {
|
|
66
|
+
// console.log(e.eventObject)
|
|
67
|
+
// Only handle if this is the actual mesh group, not a child
|
|
68
|
+
if (e.eventObject !== meshRef.current)
|
|
69
|
+
return;
|
|
70
|
+
if (createdObject.type === 'particles' || createdObject.type === 'gallery')
|
|
71
|
+
return;
|
|
72
|
+
e.stopPropagation();
|
|
73
|
+
handlePointerEnter(e);
|
|
74
|
+
};
|
|
75
|
+
const handleObjectLeave = (e) => {
|
|
76
|
+
// Only handle if this is the actual mesh group, not a child
|
|
77
|
+
if (e.eventObject !== meshRef.current)
|
|
78
|
+
return;
|
|
79
|
+
if (createdObject.type === 'particles' || createdObject.type === 'gallery')
|
|
80
|
+
return;
|
|
81
|
+
handlePointerLeave();
|
|
82
|
+
e.stopPropagation();
|
|
83
|
+
};
|
|
84
|
+
const handleObjectClick = (e) => {
|
|
85
|
+
console.log('[1] CreatedObject.handleObjectClick:', createdObject.id, createdObject.meshSettings?.name);
|
|
86
|
+
if (createdObject.type === 'gallery') {
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
// contextHandleObjectClick(
|
|
91
|
+
// createdObject,
|
|
92
|
+
// meshRef.current,
|
|
93
|
+
// [0, 0, 0],
|
|
94
|
+
// e
|
|
95
|
+
// );
|
|
96
|
+
};
|
|
97
|
+
const handleTransformStart = () => {
|
|
98
|
+
console.log('Transform started for object:', createdObject.id);
|
|
99
|
+
isTransforming.current = true;
|
|
100
|
+
};
|
|
101
|
+
const handleTransformEnd = () => {
|
|
102
|
+
isTransforming.current = false;
|
|
103
|
+
if (meshRef.current) {
|
|
104
|
+
console.log('Transform ended for object:', createdObject.id);
|
|
105
|
+
const updatedSettings = {
|
|
106
|
+
...createdObject,
|
|
107
|
+
meshSettings: {
|
|
108
|
+
...createdObject.meshSettings,
|
|
109
|
+
position: [meshRef.current.position.x, meshRef.current.position.y, meshRef.current.position.z],
|
|
110
|
+
rotation: [meshRef.current.rotation.x, meshRef.current.rotation.y, meshRef.current.rotation.z],
|
|
111
|
+
scale: [meshRef.current.scale.x, meshRef.current.scale.y, meshRef.current.scale.z]
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
// Here you could update the Redux store with final position/rotation/scale
|
|
115
|
+
// dispatch(updateObjectSettingsById(updatedSettings))
|
|
116
|
+
// updateObjectSettings && updateObjectSettings();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const anchorEnabled = createdObject.meshSettings.anchor && createdObject.meshSettings.anchor.enabled;
|
|
120
|
+
// console.log("createdObject.meshSettings", createdObject.meshSettings)
|
|
121
|
+
// console.log("Rendered CreatedObject:", createdObject.rigidBodySettings);
|
|
122
|
+
const stateKey = createdObject.meshSettings.name;
|
|
123
|
+
// console.log({stateKey})
|
|
124
|
+
return (_jsx(AnimatedObject
|
|
125
|
+
// animationId={createdObject.animationId || ''}
|
|
126
|
+
, {
|
|
127
|
+
// animationId={createdObject.animationId || ''}
|
|
128
|
+
stateKey: createdObject.id, transitionSettings: {
|
|
129
|
+
...animatedTransform,
|
|
130
|
+
position: anchorEnabled ? [anchoredPosition.x, anchoredPosition.y, anchoredPosition.z] : animatedTransform.position
|
|
131
|
+
}, createdObject: createdObject,
|
|
132
|
+
// animateMaterial={!useDreiMaterials}
|
|
133
|
+
parentRef: meshRef, visible: createdObject.meshSettings.visible, onClick: handleObjectClick, onPointerEnter: handleObjectEnter, onPointerLeave: e => handleObjectLeave(e), children: createdObject.rigidBodySettings?.enabled ? (_jsx(RigidBody, { type: createdObject.rigidBodySettings?.type || 'dynamic', mass: createdObject.rigidBodySettings?.mass || 1, colliders: createdObject.userData?.type === 'plane'
|
|
134
|
+
? 'cuboid' // Force box collider for planes
|
|
135
|
+
: undefined // Auto-detect for others
|
|
136
|
+
, friction: createdObject.rigidBodySettings?.friction, restitution: createdObject.rigidBodySettings?.restitution, gravityScale: createdObject.rigidBodySettings?.gravityScale ?? 1, linearDamping: createdObject.rigidBodySettings?.linearDamping ?? 0.01, angularDamping: createdObject.rigidBodySettings?.angularDamping ?? 0.01, children: children })) : (children) }));
|
|
137
|
+
});
|
|
138
|
+
CreatedObject.displayName = 'CreatedObject';
|
|
139
|
+
export default CreatedObject;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type CameraState, type CreatedObjectSettings } from "@ntalmagor/3drize-core";
|
|
3
|
+
import { Object3D } from "three";
|
|
4
|
+
interface CustomPrimitiveProps {
|
|
5
|
+
createdObject: CreatedObjectSettings;
|
|
6
|
+
cameraSettings: CameraState;
|
|
7
|
+
updateObjectSettings?: (updatedSettings: CreatedObjectSettings) => void;
|
|
8
|
+
onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const CustomPrimitive: React.FC<CustomPrimitiveProps>;
|
|
11
|
+
export default CustomPrimitive;
|
|
12
|
+
//# sourceMappingURL=CustomPrimitive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomPrimitive.d.ts","sourceRoot":"","sources":["../../src/components/CustomPrimitive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,qBAAqB,EAI5B,MAAM,wBAAwB,CAAC;AAIxD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAajC,UAAU,oBAAoB;IAC5B,aAAa,EAAE,qBAAqB,CAAC;IACrC,cAAc,EAAE,WAAW,CAAA;IAC3B,oBAAoB,CAAC,EAAE,CAAC,eAAe,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACxE,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;CACxE;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsHlD,CAAC;AAIH,eAAe,eAAe,CAAC"}
|