@ntalmagor/3drize-viewer 0.1.16 → 0.1.18

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.
Files changed (97) hide show
  1. package/dist/components/AnimatedObject.d.ts.map +1 -1
  2. package/dist/components/AnimatedObject.js +12 -74
  3. package/dist/components/CameraController.d.ts +1 -1
  4. package/dist/components/CameraController.d.ts.map +1 -1
  5. package/dist/components/CameraController.js +52 -15
  6. package/dist/components/Clouds.d.ts +2 -7
  7. package/dist/components/Clouds.d.ts.map +1 -1
  8. package/dist/components/Clouds.js +90 -14
  9. package/dist/components/CreatedObject.d.ts.map +1 -1
  10. package/dist/components/CreatedObject.js +7 -16
  11. package/dist/components/CustomPrimitive.d.ts.map +1 -1
  12. package/dist/components/CustomPrimitive.js +2 -33
  13. package/dist/components/EnvironmentManager.d.ts +2 -2
  14. package/dist/components/EnvironmentManager.d.ts.map +1 -1
  15. package/dist/components/EnvironmentManager.js +36 -5
  16. package/dist/components/Galaxy.js +1 -2
  17. package/dist/components/Letter.js +1 -1
  18. package/dist/components/LoadingIndicator.d.ts +1 -1
  19. package/dist/components/LoadingIndicator.d.ts.map +1 -1
  20. package/dist/components/LoadingIndicator.js +4 -141
  21. package/dist/components/ObjectNode.d.ts.map +1 -1
  22. package/dist/components/ObjectNode.js +3 -5
  23. package/dist/components/Ocean.d.ts.map +1 -1
  24. package/dist/components/Ocean.js +111 -67
  25. package/dist/components/ParticlesR3f.d.ts +0 -5
  26. package/dist/components/ParticlesR3f.d.ts.map +1 -1
  27. package/dist/components/ParticlesR3f.js +41 -12
  28. package/dist/components/ProductionScene.d.ts.map +1 -1
  29. package/dist/components/ProductionScene.js +3 -5
  30. package/dist/components/ProjectLoader.d.ts.map +1 -1
  31. package/dist/components/ProjectLoader.js +5 -19
  32. package/dist/components/Rain.js +1 -1
  33. package/dist/components/RiseLogo.d.ts +19 -0
  34. package/dist/components/RiseLogo.d.ts.map +1 -0
  35. package/dist/components/RiseLogo.js +75 -0
  36. package/dist/components/SceneBuilder.d.ts.map +1 -1
  37. package/dist/components/SceneBuilder.js +74 -48
  38. package/dist/components/ShootingStar.js +1 -1
  39. package/dist/components/SkyController.d.ts.map +1 -1
  40. package/dist/components/SkyController.js +61 -12
  41. package/dist/components/SkyMesh.js +3 -3
  42. package/dist/components/SkySystem.d.ts.map +1 -1
  43. package/dist/components/SkySystem.js +1 -1
  44. package/dist/components/Skybox.d.ts +1 -1
  45. package/dist/components/Skybox.d.ts.map +1 -1
  46. package/dist/components/Skybox.js +1 -1
  47. package/dist/components/Stars.d.ts +1 -1
  48. package/dist/components/Stars.d.ts.map +1 -1
  49. package/dist/components/Stars.js +90 -16
  50. package/dist/constants.d.ts +1 -1
  51. package/dist/constants.d.ts.map +1 -1
  52. package/dist/constants.js +1 -3
  53. package/dist/hooks/use3driseShader.d.ts +17 -0
  54. package/dist/hooks/use3driseShader.d.ts.map +1 -0
  55. package/dist/hooks/use3driseShader.js +100 -0
  56. package/dist/hooks/useContinuousEffects.d.ts.map +1 -1
  57. package/dist/hooks/useContinuousEffects.js +2 -0
  58. package/dist/hooks/useInteractionEffects.d.ts.map +1 -1
  59. package/dist/hooks/useInteractionEffects.js +10 -14
  60. package/dist/hooks/useMaterialApplication.d.ts +1 -6
  61. package/dist/hooks/useMaterialApplication.d.ts.map +1 -1
  62. package/dist/hooks/useMaterialApplication.js +8 -37
  63. package/dist/hooks/useMeshController.d.ts.map +1 -1
  64. package/dist/hooks/useMeshController.js +0 -38
  65. package/dist/hooks/useNumericAnimation.d.ts +5 -0
  66. package/dist/hooks/useNumericAnimation.d.ts.map +1 -0
  67. package/dist/hooks/useNumericAnimation.js +42 -0
  68. package/dist/hooks/useObjectAnimation.d.ts.map +1 -1
  69. package/dist/hooks/useObjectAnimation.js +17 -9
  70. package/dist/hooks/usePathAnimation.d.ts.map +1 -1
  71. package/dist/hooks/usePathAnimation.js +10 -0
  72. package/dist/hooks/useSequenceAnimation.d.ts.map +1 -1
  73. package/dist/hooks/useSequenceAnimation.js +88 -107
  74. package/dist/hooks/useSkyAnimation.d.ts +8 -9
  75. package/dist/hooks/useSkyAnimation.d.ts.map +1 -1
  76. package/dist/hooks/useSkyAnimation.js +17 -27
  77. package/dist/hooks/useSkySystem.js +1 -0
  78. package/dist/hooks/useSkyUniforms.d.ts +1 -1
  79. package/dist/hooks/useSkyUniforms.d.ts.map +1 -1
  80. package/dist/hooks/useSkyUniforms.js +20 -7
  81. package/dist/hooks/useWaterReflections.d.ts.map +1 -1
  82. package/dist/hooks/useWaterReflections.js +12 -5
  83. package/dist/index.d.ts +3 -9
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +3 -7
  86. package/dist/shaders/ShaderEffectsMaterial.d.ts +98 -150
  87. package/dist/shaders/ShaderEffectsMaterial.d.ts.map +1 -1
  88. package/dist/shaders/ShaderEffectsMaterial.js +216 -240
  89. package/dist/shaders/effects/EffectsVertexFunctions.glsl.d.ts +1 -1
  90. package/dist/shaders/effects/EffectsVertexFunctions.glsl.d.ts.map +1 -1
  91. package/dist/shaders/effects/EffectsVertexFunctions.glsl.js +93 -145
  92. package/dist/utils/materialUtils.d.ts +23 -0
  93. package/dist/utils/materialUtils.d.ts.map +1 -0
  94. package/dist/utils/materialUtils.js +81 -0
  95. package/dist/utils/shaderUtils.d.ts.map +1 -1
  96. package/dist/utils/shaderUtils.js +98 -92
  97. package/package.json +2 -2
@@ -1 +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,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACjH,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,CA+JvD,CAAC;AAGH,eAAe,cAAc,CAAC"}
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;AAMvG,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,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACjH,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,CAuGvD,CAAC;AAGH,eAAe,cAAc,CAAC"}
@@ -3,6 +3,7 @@ import { useRef, useEffect, useCallback, memo } from 'react';
3
3
  import { usePathAnimation } from '../hooks/usePathAnimation.js';
4
4
  import EffectsGroup from './EffectsGroup.js';
5
5
  import { useObjectAnimation } from '../hooks/useObjectAnimation.js';
6
+ import { hasHoverAnimation } from '../utils/hasHoverAnimation.js';
6
7
  export const AnimatedObject = memo(({ stateKey, transitionSettings, createdObject,
7
8
  // speed = 1,
8
9
  visible = true, children, parentRef, handleObjectClick, onPointerEnter, onPointerLeave, anchor, hovered = false, animateMaterial = true,
@@ -15,6 +16,8 @@ visible = true, children, parentRef, handleObjectClick, onPointerEnter, onPointe
15
16
  const stepDuration = useRef(1);
16
17
  const stepEase = useRef('linear');
17
18
  const animProgress = useRef(0);
19
+ const hasHoverFunctionalities = hasHoverAnimation(createdObject.animations);
20
+ const hasMouseInteraction = createdObject.interactions && createdObject.interactions.actions.length > 0;
18
21
  const baseRef = useRef({ position: [...position], scale: [...scale], rotation: [...rotation] });
19
22
  const targetRef = useRef({
20
23
  position: targetPosition ? [...targetPosition] : [...position],
@@ -43,85 +46,20 @@ visible = true, children, parentRef, handleObjectClick, onPointerEnter, onPointe
43
46
  animProgress.current = 0;
44
47
  }, [position, scale, rotation, targetPosition, targetScale, targetRotation]);
45
48
  useEffect(() => { syncTransform(); }, [position, scale, rotation, targetPosition, targetScale, targetRotation]);
46
- // useAnimationEvents({
47
- // onStepStart: (event) => {
48
- // console.log('Received animation event:', event);
49
- // if (!event.step?.transitions) return;
50
- // const d = event.step.duration || 1;
51
- // for (const { state, properties, pathId } of event.step.transitions) {
52
- // console.log(`Animation event for state: ${state}, object stateKey: ${stateKey}`);
53
- // if (state !== stateKey) continue;
54
- // if (properties.to.visible === false) {
55
- // if (groupRef.current) groupRef.current.visible = false;
56
- // } else {
57
- // if (groupRef.current) groupRef.current.visible = true;
58
- // stepDuration.current = d;
59
- // stepEase.current = event.step.ease || 'linear';
60
- // animationStartTime.current = performance.now();
61
- // animProgress.current = 0;
62
- // if (pathId) {
63
- // startPathAnimation(pathId, d, { ease: stepEase.current });
64
- // } else {
65
- // const cur = targetRef.current;
66
- // baseRef.current = {
67
- // position: (properties.from?.position ? [...properties.from.position] : cur.position) as [number, number, number],
68
- // rotation: (properties.from?.rotation ? [...properties.from.rotation] : cur.rotation) as [number, number, number],
69
- // scale: (properties.from?.scale ? [...properties.from.scale] : cur.scale) as [number, number, number],
70
- // };
71
- // targetRef.current = {
72
- // position: (properties.to?.position ? [...properties.to.position] : cur.position) as [number, number, number],
73
- // rotation: (properties.to?.rotation ? [...properties.to.rotation] : cur.rotation) as [number, number, number],
74
- // scale: (properties.to?.scale ? [...properties.to.scale] : cur.scale) as [number, number, number],
75
- // };
76
- // }
77
- // }
78
- // }
79
- // },
80
- // });
81
- // const applyTransformProgress = useCallback(() => {
82
- // const obj = groupRef.current;
83
- // if (!obj || animationStartTime.current === null) return;
84
- // const p = AnimationsManager.getProgressFromTime(
85
- // animationStartTime.current,
86
- // stepDuration.current,
87
- // stepEase.current,
88
- // );
89
- // animProgress.current = p;
90
- // const b = baseRef.current, t = targetRef.current;
91
- // obj.position.set(
92
- // b.position[0] + (t.position[0] - b.position[0]) * p,
93
- // b.position[1] + (t.position[1] - b.position[1]) * p,
94
- // b.position[2] + (t.position[2] - b.position[2]) * p,
95
- // );
96
- // obj.scale.set(
97
- // b.scale[0] + (t.scale[0] - b.scale[0]) * p,
98
- // b.scale[1] + (t.scale[1] - b.scale[1]) * p,
99
- // b.scale[2] + (t.scale[2] - b.scale[2]) * p,
100
- // );
101
- // obj.rotation.set(
102
- // b.rotation[0] + (t.rotation[0] - b.rotation[0]) * p,
103
- // b.rotation[1] + (t.rotation[1] - b.rotation[1]) * p,
104
- // b.rotation[2] + (t.rotation[2] - b.rotation[2]) * p,
105
- // );
106
- // }, []);
107
- // useFrame((_state, delta) => {
108
- // if (!visible || !groupRef.current) return;
109
- // if (animProgress.current < 1) {
110
- // if (isPathAnimating()) {
111
- // const still = updatePathAnimation(delta, groupRef.current);
112
- // if (!still) { animProgress.current = 1; animationStartTime.current = null; }
113
- // } else if (animationStartTime.current !== null) {
114
- // applyTransformProgress();
115
- // }
116
- // }
117
- // if (anchor) applyAnchorSettings(anchor, groupRef.current, rotation);
118
- // });
119
49
  const onClick = (e) => {
120
50
  if (handleObjectClick && groupRef.current) {
51
+ e.stopPropagation();
121
52
  handleObjectClick(createdObject, groupRef.current, e);
122
53
  }
123
54
  };
124
- 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 })] }) }));
55
+ // console.log("AnimatedObject render", { name: createdObject.meshSettings.name, id: createdObject.id, hovered, hasHoverFunctionalities })
56
+ if (createdObject.type === 'particles' || createdObject.type === 'gallery' || (!hasHoverFunctionalities && !hasMouseInteraction)) {
57
+ return _jsx(_Fragment, { children: _jsxs("group", { ref: groupRef, position: position, scale: scale, rotation: rotation, visible: visible, onClick: onClick,
58
+ // onPointerEnter={onPointerEnter}
59
+ // onPointerLeave={onPointerLeave}
60
+ name: createdObject.meshSettings.name, userData: { id: createdObject.id }, children: [children, _jsx(EffectsGroup, { createdObject: createdObject })] }) });
61
+ }
62
+ return (_jsx(_Fragment, { children: _jsxs("group", { ref: groupRef, position: position, scale: scale, rotation: rotation, visible: visible, onClick: onClick, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, name: createdObject.meshSettings.name, userData: { id: createdObject.id }, children: [children, _jsx(EffectsGroup, { createdObject: createdObject })] }) }));
125
63
  });
126
64
  AnimatedObject.displayName = 'AnimatedObject';
127
65
  export default AnimatedObject;
@@ -1,9 +1,9 @@
1
1
  import type { CameraState } from '@ntalmagor/3drize-core';
2
2
  interface CameraControllerProps {
3
+ settings: CameraState;
3
4
  enableAutoAnimation?: boolean;
4
5
  animationDuration?: number;
5
6
  animationEase?: string;
6
- settings: CameraState;
7
7
  }
8
8
  export declare const CameraController: React.FC<CameraControllerProps>;
9
9
  export default CameraController;
@@ -1 +1 @@
1
- {"version":3,"file":"CameraController.d.ts","sourceRoot":"","sources":["../../src/components/CameraController.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAiC,MAAM,wBAAwB,CAAC;AAGzF,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,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA2I5D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"CameraController.d.ts","sourceRoot":"","sources":["../../src/components/CameraController.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAiD,MAAM,wBAAwB,CAAC;AAIzG,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,WAAW,CAAA;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsM5D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,14 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import { useEffect, useRef } from 'react';
2
3
  import { useFrame, useThree } from '@react-three/fiber';
3
4
  import { useCameraAnimation } from '../hooks/useCameraAnimation.js';
4
5
  import { cameraManager } from '../utils/CameraSingleton.js';
5
6
  import { useAnimationEvents } from '../hooks/useAnimationEvents.js';
6
7
  import { usePathAnimation } from '../hooks/usePathAnimation.js';
7
- export const CameraController = ({ enableAutoAnimation = true, animationDuration = 1, animationEase = "power2.out", settings }) => {
8
+ import { OrbitControls } from "@react-three/drei";
9
+ export const CameraController = ({ enableAutoAnimation = true, animationDuration = 1, animationEase = "power2.out", settings, }) => {
8
10
  const { camera, set } = useThree();
9
11
  const cameraRef = useRef(camera);
10
12
  const transformAnimationProgress = useRef(0);
11
- const { position, orientation, fov, near, far } = settings;
13
+ const controlsRef = useRef(null);
14
+ const { position, orientation, fov, near, far, controls } = settings;
15
+ const initialControls = useRef(controls);
12
16
  const { startPathAnimation, updatePathAnimation, isAnimating: isPathAnimating, } = usePathAnimation();
13
17
  // Use camera animation hook for animated transitions (via events)
14
18
  const { animateCamera, animateHandlers, isAnimating } = useCameraAnimation({
@@ -43,6 +47,27 @@ export const CameraController = ({ enableAutoAnimation = true, animationDuration
43
47
  console.log("CameraController: Synced position/orientation", position, orientation);
44
48
  }
45
49
  }, [position, orientation]);
50
+ // Sync controls config changes imperatively via ref (after initial mount)
51
+ useEffect(() => {
52
+ const orbitControls = controlsRef.current;
53
+ if (!orbitControls)
54
+ return;
55
+ orbitControls.enabled = controls.enabled;
56
+ orbitControls.target.set(controls.target[0], controls.target[1], controls.target[2]);
57
+ orbitControls.enablePan = controls.enablePan;
58
+ orbitControls.enableRotate = controls.enableRotate;
59
+ orbitControls.autoRotate = controls.autoRotate;
60
+ orbitControls.autoRotateSpeed = controls.autoRotateSpeed;
61
+ orbitControls.zoomSpeed = controls.zoomSpeed;
62
+ orbitControls.panSpeed = controls.panSpeed;
63
+ orbitControls.rotateSpeed = controls.rotateSpeed;
64
+ orbitControls.minDistance = controls.minDistance;
65
+ orbitControls.maxDistance = controls.maxDistance;
66
+ orbitControls.minPolarAngle = controls.minPolarAngle ?? -Infinity;
67
+ orbitControls.maxPolarAngle = controls.maxPolarAngle ?? Infinity;
68
+ orbitControls.minAzimuthAngle = controls.minAzimuthAngle ?? -Infinity;
69
+ orbitControls.maxAzimuthAngle = controls.maxAzimuthAngle ?? Infinity;
70
+ }, [controls]);
46
71
  // Sync camera projection settings from state
47
72
  useEffect(() => {
48
73
  const cam = cameraRef.current;
@@ -68,22 +93,15 @@ export const CameraController = ({ enableAutoAnimation = true, animationDuration
68
93
  // Handle animation events (step-based animations)
69
94
  useAnimationEvents({
70
95
  onStepStart: (event) => {
71
- console.log('Camera controller - Step started:', event.step);
96
+ // console.log('Camera controller - Step started:', event.step);
72
97
  if (event.step?.transitions) {
73
98
  const stepDuration = event.step.duration || 1;
74
99
  event.step.transitions.forEach((transition) => {
75
100
  const { state, properties, pathId } = transition;
76
101
  if (state === 'camera') {
102
+ // console.log('Camera transition detected. Starting animation to new camera state:', properties);
77
103
  isInAnimatedTransition.current = true;
78
- const targetSettings = {
79
- fov: properties.to.fov,
80
- near: properties.to.near,
81
- far: properties.to.far,
82
- };
83
- if (!pathId) {
84
- targetSettings.position = properties.to.position;
85
- }
86
- else {
104
+ if (pathId) {
87
105
  const offset = camera
88
106
  ? [camera.position.x, camera.position.y, camera.position.z]
89
107
  : [0, 0, 0];
@@ -94,15 +112,31 @@ export const CameraController = ({ enableAutoAnimation = true, animationDuration
94
112
  });
95
113
  transformAnimationProgress.current = 0;
96
114
  }
97
- console.log("Animating camera to:", targetSettings, "over duration:", stepDuration);
115
+ // console.log("Animating camera to:", targetSettings, "over duration:", stepDuration);
116
+ const startSettings = properties.from ?
117
+ {
118
+ position: properties.from.position,
119
+ // orientation: properties.from.orientation,
120
+ } : {
121
+ position: camera.position,
122
+ // orientation: camera.rotation,
123
+ };
124
+ const targetSettings = properties.to;
125
+ // console.log("Starting camera animation from:", startSettings);
126
+ // startSettings.position && camera.position.set(startSettings.position[0], startSettings.position[1], startSettings.position[2]);
127
+ // camera.rotation.set(startSettings.orientation[0], startSettings.orientation[1], startSettings.orientation[2]);
98
128
  animateCamera(targetSettings, stepDuration, event.step?.ease, properties.to.target)
99
129
  .then(() => {
100
130
  isInAnimatedTransition.current = false;
131
+ if (properties.to.target) {
132
+ controlsRef.current?.target.set(properties.to.target[0], properties.to.target[1], properties.to.target[2]);
133
+ }
134
+ ;
101
135
  });
102
136
  }
103
137
  });
104
138
  }
105
- },
139
+ }
106
140
  });
107
141
  // Frame loop for path animations and mouse handlers
108
142
  useFrame((state, delta) => {
@@ -116,6 +150,9 @@ export const CameraController = ({ enableAutoAnimation = true, animationDuration
116
150
  animateHandlers(state.pointer);
117
151
  }
118
152
  });
119
- return null;
153
+ const ic = initialControls.current;
154
+ return _jsx(OrbitControls, { ref: controlsRef, makeDefault: true, enabled: ic.enabled,
155
+ // target={new Vector3(...ic.target)}
156
+ enablePan: ic.enablePan, enableRotate: ic.enableRotate, autoRotate: ic.autoRotate, autoRotateSpeed: ic.autoRotateSpeed, zoomSpeed: ic.zoomSpeed, panSpeed: ic.panSpeed, rotateSpeed: ic.rotateSpeed, minDistance: ic.minDistance, maxDistance: ic.maxDistance, minPolarAngle: ic.minPolarAngle ?? -Infinity, maxPolarAngle: ic.maxPolarAngle ?? Infinity, minAzimuthAngle: ic.minAzimuthAngle ?? -Infinity, maxAzimuthAngle: ic.maxAzimuthAngle ?? Infinity });
120
157
  };
121
158
  export default CameraController;
@@ -1,12 +1,7 @@
1
1
  import React from 'react';
2
- import type { MaterialSettings } from '@ntalmagor/3drize-core';
3
- import type { TimeSettings } from '@ntalmagor/3drize-core';
2
+ import type { CloudsSettings, TimeSettings } from '@ntalmagor/3drize-core';
4
3
  export interface CloudsProps {
5
- visible?: boolean;
6
- scale?: number;
7
- height?: number;
8
- speed?: number;
9
- materialSettings?: MaterialSettings;
4
+ settings: CloudsSettings;
10
5
  timeSettings: TimeSettings;
11
6
  }
12
7
  declare const Clouds: React.FC<CloudsProps>;
@@ -1 +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,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAkB3D,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"}
1
+ {"version":3,"file":"Clouds.d.ts","sourceRoot":"","sources":["../../src/components/Clouds.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAOnD,OAAO,KAAK,EAAE,cAAc,EAAoB,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAoB7F,MAAM,WAAW,WAAW;IAE1B,QAAQ,EAAE,cAAc,CAAA;IACxB,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAmLjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,9 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useRef, useState, useCallback } from 'react';
2
+ import { useRef, useCallback } from 'react';
3
3
  import * as THREE from 'three';
4
4
  import { useThree, useFrame } from '@react-three/fiber';
5
5
  import { useMaterialApplication } from '../hooks/useMaterialApplication.js';
6
6
  import { useSkySystem } from '../hooks/useSkySystem.js';
7
+ import { useAnimationEvents } from '../hooks/useAnimationEvents.js';
8
+ import { useNumericAnimation } from '../hooks/useNumericAnimation.js';
9
+ import { applySingleProperty } from '@ntalmagor/3drize-core';
10
+ import { useMouseHandlers } from '../hooks/useMouseHandlers.js';
7
11
  const CLOUD_COLORS = {
8
12
  night: new THREE.Color(0.1, 0.1, 0.2),
9
13
  sunrise: new THREE.Color(0.8, 0.4, 0.4),
@@ -18,17 +22,20 @@ const DEFAULT_MATERIAL = {
18
22
  u_cameraPos: [0, 0, 0],
19
23
  u_cloudColor: [1.0, 1.0, 1.0],
20
24
  };
21
- const Clouds = ({ visible = true, scale = 1, height = 400, speed = 1, materialSettings, timeSettings, }) => {
22
- const [meshNode, setMeshNode] = useState(null);
25
+ const Clouds = ({ settings, timeSettings, }) => {
26
+ const { visible = true, position = [0, 400, 0], scale = 15000, speed = 1, materialSettings = DEFAULT_MATERIAL, handlers } = settings;
27
+ const height = position?.[1] ?? 400;
28
+ const meshRef = useRef(null);
23
29
  const cloudAnimTime = useRef(0);
24
30
  const { camera } = useThree();
31
+ const { interpolateProperty } = useMouseHandlers();
25
32
  const cloudColorRef = useRef(new THREE.Color(1, 1, 1));
26
33
  const targetCloudColorRef = useRef(new THREE.Color(1, 1, 1));
27
- const meshRefCallback = useCallback((node) => {
28
- setMeshNode(node);
29
- }, []);
34
+ const numericOverrideRef = useRef(null);
35
+ const mouseOverrideRef = useRef({});
36
+ const { animateNumeric } = useNumericAnimation();
30
37
  const effectiveMaterialSettings = materialSettings ?? DEFAULT_MATERIAL;
31
- useMaterialApplication(meshNode, effectiveMaterialSettings, true);
38
+ useMaterialApplication(meshRef.current, effectiveMaterialSettings, true);
32
39
  const handleTimeUpdate = useCallback((state) => {
33
40
  const { normalizedTime, isDaytime, delta } = state;
34
41
  if (isDaytime) {
@@ -59,14 +66,78 @@ const Clouds = ({ visible = true, scale = 1, height = 400, speed = 1, materialSe
59
66
  onTimeUpdate: handleTimeUpdate,
60
67
  enabled: visible,
61
68
  });
62
- useFrame(() => {
63
- if (!visible || !meshNode?.material)
69
+ useAnimationEvents({
70
+ onStepStart: (event) => {
71
+ if (!event.step?.transitions)
72
+ return;
73
+ for (const transition of event.step.transitions) {
74
+ if (transition.state !== 'clouds' || !meshRef.current)
75
+ continue;
76
+ const toProps = transition.properties.to || {};
77
+ const fromProps = transition.properties.from || {};
78
+ // visible — immediate boolean switch on the Three.js mesh
79
+ if (toProps.visible !== undefined) {
80
+ meshRef.current.visible = toProps.visible;
81
+ }
82
+ // numeric: speed, scale
83
+ const CLOUDS_NUMERIC_KEYS = ['speed', 'scale'];
84
+ const from = {};
85
+ const to = {};
86
+ for (const key of CLOUDS_NUMERIC_KEYS) {
87
+ const toVal = toProps[key];
88
+ if (toVal === undefined)
89
+ continue;
90
+ to[key] = toVal;
91
+ from[key] = fromProps[key] ?? settings[key] ?? toVal;
92
+ }
93
+ if (Object.keys(to).length > 0) {
94
+ animateNumeric(from, to, (updated) => {
95
+ numericOverrideRef.current = { ...numericOverrideRef.current, ...updated };
96
+ }, () => {
97
+ numericOverrideRef.current = null;
98
+ }, event.step?.duration);
99
+ }
100
+ }
101
+ },
102
+ });
103
+ const handleMouseMove = (mouse) => {
104
+ if (!handlers?.onMouseMove?.enabled)
105
+ return;
106
+ if (!handlers.onMouseMove.properties.length)
64
107
  return;
65
- const material = meshNode.material;
108
+ if (!meshRef.current)
109
+ return;
110
+ handlers.onMouseMove.properties.forEach((cfg) => {
111
+ const { property, propertySettings } = cfg;
112
+ const { min: minValue, max: maxValue, axis, sensitivity = 1, inverted = false } = propertySettings;
113
+ if (property === 'speed' || property === 'scale') {
114
+ const key = property;
115
+ const baseValue = settings[key];
116
+ if (baseValue === undefined)
117
+ return;
118
+ const interpolated = interpolateProperty(baseValue, minValue, maxValue, mouse, axis, sensitivity, inverted);
119
+ mouseOverrideRef.current[key] = interpolated;
120
+ return;
121
+ }
122
+ const baseValue = settings.materialSettings?.[property];
123
+ if (baseValue === undefined)
124
+ return;
125
+ const interpolated = interpolateProperty(baseValue, minValue, maxValue, mouse, axis, sensitivity, inverted);
126
+ applySingleProperty(meshRef.current.material, property, interpolated);
127
+ });
128
+ };
129
+ useFrame((state) => {
130
+ if ((meshRef.current && !meshRef.current.visible) || !meshRef.current?.material)
131
+ return;
132
+ const material = meshRef.current.material;
66
133
  const uniforms = material?.uniforms;
67
134
  if (!uniforms)
68
135
  return;
69
- cloudAnimTime.current += 0.02 * speed;
136
+ const effectiveSpeed = numericOverrideRef.current?.speed
137
+ ?? mouseOverrideRef.current.speed
138
+ ?? speed;
139
+ cloudAnimTime.current += 0.02 * effectiveSpeed;
140
+ const mouse = state.pointer;
70
141
  if (uniforms.u_time)
71
142
  uniforms.u_time.value = cloudAnimTime.current;
72
143
  if (uniforms.u_cameraPos) {
@@ -89,9 +160,14 @@ const Clouds = ({ visible = true, scale = 1, height = 400, speed = 1, materialSe
89
160
  ? uniforms.u_sunPosition.value.copy(sunDirection)
90
161
  : (uniforms.u_sunPosition.value = sunDirection.clone());
91
162
  }
163
+ handleMouseMove(mouse);
164
+ const effectiveScale = numericOverrideRef.current?.scale
165
+ ?? mouseOverrideRef.current.scale;
166
+ if (effectiveScale !== undefined) {
167
+ meshRef.current.scale.setScalar(effectiveScale);
168
+ }
92
169
  });
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] }) }));
170
+ // if (!visible) return null;
171
+ return (_jsx("mesh", { ref: meshRef, name: "SkyClouds", userData: { id: '3drise-clouds' }, position: [0, height, 0], rotation: [Math.PI / 2, 0, 0], scale: scale, renderOrder: -1, frustumCulled: false, visible: visible, children: _jsx("planeGeometry", { args: [2, 2] }) }));
96
172
  };
97
173
  export default Clouds;
@@ -1 +1 @@
1
- {"version":3,"file":"CreatedObject.d.ts","sourceRoot":"","sources":["../../src/components/CreatedObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAG,qBAAqB,EAAkC,MAAM,wBAAwB,CAAC;AAOrG,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAWrD,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;IACvE,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAElH;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAiK9C,CAAC;AAIH,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"CreatedObject.d.ts","sourceRoot":"","sources":["../../src/components/CreatedObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAG,qBAAqB,EAAkC,MAAM,wBAAwB,CAAC;AAOrG,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAWrD,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;IACvE,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAElH;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAwJ9C,CAAC;AAIH,eAAe,aAAa,CAAC"}
@@ -60,14 +60,17 @@ const CreatedObject = memo(({ createdObject, children, shouldApply3driseMaterial
60
60
  // Check if this should use the new MaterialLibrary system for Drei materials
61
61
  // console.log(object)
62
62
  const handleObjectEnter = (e) => {
63
- // console.log(e.eventObject)
63
+ // console.log(e)
64
64
  // Only handle if this is the actual mesh group, not a child
65
65
  if (e.eventObject !== meshRef.current)
66
66
  return;
67
67
  if (createdObject.type === 'particles' || createdObject.type === 'gallery')
68
68
  return;
69
- e.stopPropagation();
69
+ // e.stopPropagation();
70
70
  handlePointerEnter(e);
71
+ if (createdObject.interactions) {
72
+ document.body.style.cursor = 'pointer';
73
+ }
71
74
  };
72
75
  const handleObjectLeave = (e) => {
73
76
  // Only handle if this is the actual mesh group, not a child
@@ -76,21 +79,9 @@ const CreatedObject = memo(({ createdObject, children, shouldApply3driseMaterial
76
79
  if (createdObject.type === 'particles' || createdObject.type === 'gallery')
77
80
  return;
78
81
  handlePointerLeave();
82
+ document.body.style.cursor = 'auto';
79
83
  e.stopPropagation();
80
84
  };
81
- const onClick = (e) => {
82
- console.log('[1] CreatedObject.handleObjectClick:', createdObject.id, createdObject.meshSettings?.name);
83
- // if (createdObject.type === 'gallery') {
84
- // e.stopPropagation();
85
- // return
86
- // }
87
- // contextHandleObjectClick(
88
- // createdObject,
89
- // meshRef.current,
90
- // [0, 0, 0],
91
- // e
92
- // );
93
- };
94
85
  const anchorEnabled = createdObject.meshSettings.anchor && createdObject.meshSettings.anchor.enabled;
95
86
  // console.log("createdObject.meshSettings", createdObject.meshSettings)
96
87
  // console.log("Rendered CreatedObject:", createdObject.rigidBodySettings);
@@ -105,7 +96,7 @@ const CreatedObject = memo(({ createdObject, children, shouldApply3driseMaterial
105
96
  position: anchorEnabled ? [anchoredPosition.x, anchoredPosition.y, anchoredPosition.z] : animatedTransform.position
106
97
  }, createdObject: createdObject,
107
98
  // animateMaterial={!useDreiMaterials}
108
- parentRef: meshRef, visible: createdObject.meshSettings.visible, handleObjectClick: 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'
99
+ parentRef: meshRef, visible: createdObject.meshSettings.visible, handleObjectClick: handleObjectClick, onPointerEnter: handleObjectEnter, onPointerLeave: e => handleObjectLeave(e), hovered: hovered, children: createdObject.rigidBodySettings?.enabled ? (_jsx(RigidBody, { type: createdObject.rigidBodySettings?.type || 'dynamic', mass: createdObject.rigidBodySettings?.mass || 1, colliders: createdObject.userData?.type === 'plane'
109
100
  ? 'cuboid' // Force box collider for planes
110
101
  : undefined // Auto-detect for others
111
102
  , 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) }));
@@ -1 +1 @@
1
- {"version":3,"file":"CustomPrimitive.d.ts","sourceRoot":"","sources":["../../src/components/CustomPrimitive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAoB,KAAK,qBAAqB,EAI5B,MAAM,wBAAwB,CAAC;AAIxD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOrD,UAAU,oBAAoB;IAC5B,aAAa,EAAE,qBAAqB,CAAC;IACrC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAClH;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqHlD,CAAC;AAIH,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"CustomPrimitive.d.ts","sourceRoot":"","sources":["../../src/components/CustomPrimitive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAoB,KAAK,qBAAqB,EAI5B,MAAM,wBAAwB,CAAC;AAIxD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOrD,UAAU,oBAAoB;IAC5B,aAAa,EAAE,qBAAqB,CAAC;IACrC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAClH;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA6ElD,CAAC;AAIH,eAAe,eAAe,CAAC"}
@@ -1,13 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { useRef, useEffect, memo, useState } from "react";
3
- import { ObjectManager, createDefaultEffectState, applyTransformEffects } from "@ntalmagor/3drize-core";
3
+ import { ObjectManager } from "@ntalmagor/3drize-core";
4
4
  // import ObjectManager from "~/utils/ObjectManager";
5
5
  import { useMaterialApplication } from "../hooks/useMaterialApplication.js";
6
- import { useFrame } from "@react-three/fiber";
7
6
  import MaterialLibrary from "./MaterialLibrary.js";
8
7
  // import type { AnimatedTransform } from "~/types/mesh";
9
8
  import CreatedObject from "./CreatedObject.js";
10
- import { useFrameEffects } from "../hooks/useFrameEffects.js";
11
9
  const CustomPrimitive = memo(({ createdObject, onObjectReady, handleObjectClick, }) => {
12
10
  // const { handleObjectClick } = useSceneClick();
13
11
  // console.log("Rendering CustomPrimitive with settings:", createdObject.name, createdObject);
@@ -19,7 +17,7 @@ const CustomPrimitive = memo(({ createdObject, onObjectReady, handleObjectClick,
19
17
  scale: createdObject.meshSettings.scale,
20
18
  });
21
19
  // Initialize transform controls
22
- const { handlePointerEnter, handlePointerLeave, hovered } = useFrameEffects(true);
20
+ // const { handlePointerEnter, handlePointerLeave, hovered } = useFrameEffects(true);
23
21
  useEffect(() => {
24
22
  setAnimatedTransform({
25
23
  position: createdObject.meshSettings.position,
@@ -27,45 +25,16 @@ const CustomPrimitive = memo(({ createdObject, onObjectReady, handleObjectClick,
27
25
  scale: createdObject.meshSettings.scale,
28
26
  });
29
27
  }, [createdObject.meshSettings.position, createdObject.meshSettings.rotation, createdObject.meshSettings.scale]);
30
- // Derive material flags before any early return so hooks are always called in the same order
31
28
  const useDreiMaterials = createdObject.materialSettings.materialType === "advanced";
32
29
  const apply3driseMaterials = !useDreiMaterials;
33
- // Hide the model until the 3drise material is applied to prevent a flash of original GLTF materials.
34
- // If no 3drise material variant is set, or Drei materials are used, show immediately.
35
30
  const willApplyMaterial = apply3driseMaterials && !!createdObject.materialSettings.materialVariant;
36
31
  const [materialReady, setMaterialReady] = useState(!willApplyMaterial);
37
- // Get the actual Three.js object from ObjectManager
38
32
  const obj = ObjectManager.getObject(createdObject.id);
39
- // console.log("CustomPrimitive - Retrieved object from ObjectManager:", obj);
40
- // Apply material directly to obj.object (always non-null when obj exists, available before the
41
- // outer group ref is committed) so the material is ready on the first visible frame.
42
33
  useMaterialApplication(obj?.object ?? null, createdObject.materialSettings, apply3driseMaterials, () => setMaterialReady(true));
43
34
  if (!obj) {
44
35
  // console.warn(`CustomPrimitive - Object with ID ${createdObject.id} not found.`);
45
36
  return null;
46
37
  }
47
- // const { sensitivity = 0.5, applyToChildren = false } = createdObject.interactions. || {};
48
- const sensitivity = 0.5;
49
- const applyToChildren = false;
50
- const clicked = false;
51
- const transformEffects = createdObject.animations?.transform?.effects || []; // Array of effects from transform domain
52
- const enabledTransformEffects = transformEffects.filter(e => e.enabled);
53
- // console.log(isSelected)
54
- useFrame((state, dt) => {
55
- if (!meshRef.current || !applyToChildren)
56
- return;
57
- const time = state.clock.elapsedTime;
58
- // Initialize effect state if needed
59
- if (!effectStateRef.current && meshRef.current) {
60
- effectStateRef.current = createDefaultEffectState(meshRef.current);
61
- }
62
- // Apply transform effects from new continuous structure (multiple effects)
63
- if (enabledTransformEffects.length > 0 && effectStateRef.current) {
64
- applyTransformEffects(meshRef.current, enabledTransformEffects, // Pass array of enabled effects
65
- time, dt, effectStateRef.current, hovered, clicked, sensitivity);
66
- }
67
- });
68
- const geometry = obj.object.geometry;
69
38
  return (
70
39
  // <Select enabled={isSelected}>
71
40
  _jsx(CreatedObject, { createdObject: createdObject, shouldApply3driseMaterial: false, handleObjectClick: handleObjectClick, onObjectReady: (object, ref) => {
@@ -1,7 +1,7 @@
1
1
  import { type SkySystemRef, type SkySystemProps } from './SkySystem';
2
- import type { HdrSettings } from '@ntalmagor/3drize-core';
2
+ import type { EnvironmentConfig } from '@ntalmagor/3drize-core';
3
3
  export interface EnvironmentManagerProps extends SkySystemProps {
4
- hdrSettings?: HdrSettings;
4
+ environment?: EnvironmentConfig;
5
5
  cubeCameraResolution?: number;
6
6
  }
7
7
  declare const EnvironmentManager: import("react").ForwardRefExoticComponent<EnvironmentManagerProps & import("react").RefAttributes<SkySystemRef>>;
@@ -1 +1 @@
1
- {"version":3,"file":"EnvironmentManager.d.ts","sourceRoot":"","sources":["../../src/components/EnvironmentManager.tsx"],"names":[],"mappings":"AAGA,OAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAEhF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC7D,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,QAAA,MAAM,kBAAkB,kHAoGtB,CAAC;AAIH,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"EnvironmentManager.d.ts","sourceRoot":"","sources":["../../src/components/EnvironmentManager.tsx"],"names":[],"mappings":"AAIA,OAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAEhF,OAAO,KAAK,EAAE,iBAAiB,EAAe,MAAM,wBAAwB,CAAC;AAG7E,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC7D,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,QAAA,MAAM,kBAAkB,kHAkHtB,CAAC;AAIH,eAAe,kBAAkB,CAAC"}