@nice2dev/ui-3d 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/cjs/core/i18n.js +3 -3
  2. package/dist/cjs/dance/DanceBridge.js +13 -13
  3. package/dist/cjs/dance/DanceScoreEngine.js +8 -8
  4. package/dist/cjs/dance/PoseDetector.js +20 -20
  5. package/dist/cjs/material/NiceMaterialEditor.js +19 -19
  6. package/dist/cjs/model/ModelEditorLeftPanel.js +3 -3
  7. package/dist/cjs/model/ModelEditorMenuBar.js +2 -2
  8. package/dist/cjs/model/ModelEditorRightPanel.js +2 -2
  9. package/dist/cjs/model/ModelEditorSubComponents.js +3 -3
  10. package/dist/cjs/model/ModelEditorTimeline.js +3 -3
  11. package/dist/cjs/model/ModelEditorToolbar.js +2 -2
  12. package/dist/cjs/model/ModelEditorViewport.js +2 -2
  13. package/dist/cjs/model/ModelViewer.js +8 -8
  14. package/dist/cjs/model/NiceArmatureEditor.js +18 -18
  15. package/dist/cjs/model/NiceMorphTargetEditor.js +18 -18
  16. package/dist/cjs/model/NiceOctree.js +16 -16
  17. package/dist/cjs/model/NicePhysicsSimulation.js +24 -24
  18. package/dist/cjs/model/NiceProceduralGeometry.js +8 -8
  19. package/dist/cjs/model/NiceTerrainEditor.js +19 -19
  20. package/dist/cjs/model/NiceWeightPainter.js +14 -14
  21. package/dist/cjs/model/NiceXRPreview.js +18 -18
  22. package/dist/cjs/model/useModelEditor.js +127 -127
  23. package/dist/cjs/model/useModelViewer.js +61 -61
  24. package/dist/cjs/particle/NiceParticleEditor.js +11 -11
  25. package/dist/cjs/rendering/NiceCascadedShadows.js +12 -12
  26. package/dist/cjs/rendering/NiceRenderExport.js +5 -5
  27. package/dist/cjs/rendering/NiceSSAO.js +18 -18
  28. package/dist/cjs/rendering/NiceSSR.js +14 -14
  29. package/dist/cjs/rendering/NiceWebGPURenderer.js +21 -21
  30. package/dist/cjs/ui/dist/index.js +26566 -19233
  31. package/dist/cjs/ui/dist/index.js.map +1 -1
  32. package/dist/cjs/uv/NiceUVEditor.js +24 -24
  33. package/dist/esm/model/ModelEditorLeftPanel.js +5 -5
  34. package/dist/esm/model/ModelEditorMenuBar.js +5 -5
  35. package/dist/esm/model/ModelEditorRightPanel.js +17 -17
  36. package/dist/esm/model/ModelEditorSubComponents.js +6 -6
  37. package/dist/esm/model/ModelEditorTimeline.js +5 -5
  38. package/dist/esm/model/ModelEditorToolbar.js +4 -4
  39. package/dist/esm/model/ModelEditorViewport.js +2 -2
  40. package/dist/esm/model/ModelViewer.js +5 -5
  41. package/dist/esm/ui/dist/index.js +25913 -18601
  42. package/dist/esm/ui/dist/index.js.map +1 -1
  43. package/package.json +2 -2
@@ -2,7 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var THREE = require('three');
5
- var Ae = require('react');
5
+ var Ve = require('react');
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -24,12 +24,12 @@ function _interopNamespaceDefault(e) {
24
24
  var THREE__namespace = /*#__PURE__*/_interopNamespaceDefault(THREE);
25
25
 
26
26
  function useArmatureEditor(skeleton, scene, onBoneSelect) {
27
- const [bones, setBones] = Ae.useState([]);
28
- const [selectedBoneId, setSelectedBoneId] = Ae.useState(null);
29
- const [savedPoses, setSavedPoses] = Ae.useState([]);
30
- const helperRef = Ae.useRef(null);
27
+ const [bones, setBones] = Ve.useState([]);
28
+ const [selectedBoneId, setSelectedBoneId] = Ve.useState(null);
29
+ const [savedPoses, setSavedPoses] = Ve.useState([]);
30
+ const helperRef = Ve.useRef(null);
31
31
  // Build bone info tree from skeleton
32
- Ae.useEffect(() => {
32
+ Ve.useEffect(() => {
33
33
  if (!skeleton) {
34
34
  setBones([]);
35
35
  return;
@@ -52,7 +52,7 @@ function useArmatureEditor(skeleton, scene, onBoneSelect) {
52
52
  setBones(boneInfos);
53
53
  }, [skeleton]);
54
54
  // Create skeleton helper for visualization
55
- Ae.useEffect(() => {
55
+ Ve.useEffect(() => {
56
56
  var _a;
57
57
  if (!skeleton || !scene)
58
58
  return;
@@ -69,12 +69,12 @@ function useArmatureEditor(skeleton, scene, onBoneSelect) {
69
69
  helperRef.current = null;
70
70
  };
71
71
  }, [skeleton, scene]);
72
- const selectBone = Ae.useCallback((id) => {
72
+ const selectBone = Ve.useCallback((id) => {
73
73
  setSelectedBoneId(id);
74
74
  const bone = id ? (skeleton === null || skeleton === void 0 ? void 0 : skeleton.bones.find((b) => b.uuid === id)) || null : null;
75
75
  onBoneSelect === null || onBoneSelect === void 0 ? void 0 : onBoneSelect(bone);
76
76
  }, [skeleton, onBoneSelect]);
77
- const setBonePosition = Ae.useCallback((id, pos) => {
77
+ const setBonePosition = Ve.useCallback((id, pos) => {
78
78
  const bone = skeleton === null || skeleton === void 0 ? void 0 : skeleton.bones.find((b) => b.uuid === id);
79
79
  if (bone) {
80
80
  bone.position.copy(pos);
@@ -82,7 +82,7 @@ function useArmatureEditor(skeleton, scene, onBoneSelect) {
82
82
  setBones((prev) => prev.map((b) => (b.id === id ? { ...b, localPosition: pos.clone() } : b)));
83
83
  }
84
84
  }, [skeleton]);
85
- const setBoneRotation = Ae.useCallback((id, rot) => {
85
+ const setBoneRotation = Ve.useCallback((id, rot) => {
86
86
  const bone = skeleton === null || skeleton === void 0 ? void 0 : skeleton.bones.find((b) => b.uuid === id);
87
87
  if (bone) {
88
88
  bone.rotation.copy(rot);
@@ -90,7 +90,7 @@ function useArmatureEditor(skeleton, scene, onBoneSelect) {
90
90
  setBones((prev) => prev.map((b) => (b.id === id ? { ...b, localRotation: rot.clone() } : b)));
91
91
  }
92
92
  }, [skeleton]);
93
- const addBone = Ae.useCallback((parentId, name) => {
93
+ const addBone = Ve.useCallback((parentId, name) => {
94
94
  const parent = skeleton === null || skeleton === void 0 ? void 0 : skeleton.bones.find((b) => b.uuid === parentId);
95
95
  const newBone = new THREE__namespace.Bone();
96
96
  newBone.name = name;
@@ -119,7 +119,7 @@ function useArmatureEditor(skeleton, scene, onBoneSelect) {
119
119
  ]);
120
120
  return newBone;
121
121
  }, [skeleton]);
122
- const removeBone = Ae.useCallback((id) => {
122
+ const removeBone = Ve.useCallback((id) => {
123
123
  const bone = skeleton === null || skeleton === void 0 ? void 0 : skeleton.bones.find((b) => b.uuid === id);
124
124
  if (!bone)
125
125
  return;
@@ -139,7 +139,7 @@ function useArmatureEditor(skeleton, scene, onBoneSelect) {
139
139
  if (selectedBoneId === id)
140
140
  setSelectedBoneId(null);
141
141
  }, [skeleton, selectedBoneId]);
142
- const savePose = Ae.useCallback((name) => {
142
+ const savePose = Ve.useCallback((name) => {
143
143
  const transforms = new Map();
144
144
  if (skeleton) {
145
145
  for (const bone of skeleton.bones) {
@@ -159,7 +159,7 @@ function useArmatureEditor(skeleton, scene, onBoneSelect) {
159
159
  setSavedPoses((prev) => [...prev, pose]);
160
160
  return pose;
161
161
  }, [skeleton]);
162
- const loadPose = Ae.useCallback((pose) => {
162
+ const loadPose = Ve.useCallback((pose) => {
163
163
  if (!skeleton)
164
164
  return;
165
165
  for (const bone of skeleton.bones) {
@@ -178,7 +178,7 @@ function useArmatureEditor(skeleton, scene, onBoneSelect) {
178
178
  localScale: b.bone.scale.clone(),
179
179
  })));
180
180
  }, [skeleton]);
181
- const resetPose = Ae.useCallback(() => {
181
+ const resetPose = Ve.useCallback(() => {
182
182
  if (!skeleton)
183
183
  return;
184
184
  for (const bone of skeleton.bones) {
@@ -216,9 +216,9 @@ function useArmatureEditor(skeleton, scene, onBoneSelect) {
216
216
  /* ── Component ── */
217
217
  const NiceArmatureEditor = ({ skeleton, skinnedMesh, scene, camera, onBoneSelect, onPoseChange, className = '', }) => {
218
218
  const { bones, selectedBoneId, selectBone, setBonePosition, setBoneRotation, addBone, removeBone, savePose, loadPose, resetPose, savedPoses, skeletonHelper, } = useArmatureEditor(skeleton, scene, onBoneSelect);
219
- const [newBoneName, setNewBoneName] = Ae.useState('');
220
- const selectedBone = Ae.useMemo(() => bones.find((b) => b.id === selectedBoneId), [bones, selectedBoneId]);
221
- const rootBones = Ae.useMemo(() => bones.filter((b) => !b.parentId), [bones]);
219
+ const [newBoneName, setNewBoneName] = Ve.useState('');
220
+ const selectedBone = Ve.useMemo(() => bones.find((b) => b.id === selectedBoneId), [bones, selectedBoneId]);
221
+ const rootBones = Ve.useMemo(() => bones.filter((b) => !b.parentId), [bones]);
222
222
  const renderBoneTree = (boneInfo, depth = 0) => {
223
223
  const isSelected = boneInfo.id === selectedBoneId;
224
224
  const childBones = bones.filter((b) => b.parentId === boneInfo.id);
@@ -2,7 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var THREE = require('three');
5
- var Ae = require('react');
5
+ var Ve = require('react');
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -25,14 +25,14 @@ var THREE__namespace = /*#__PURE__*/_interopNamespaceDefault(THREE);
25
25
 
26
26
  /* ── Hook ── */
27
27
  function useMorphTargetEditor(mesh, onInfluenceChange) {
28
- const [targets, setTargets] = Ae.useState([]);
29
- const [animations, setAnimations] = Ae.useState([]);
30
- const [isAnimating, setIsAnimating] = Ae.useState(false);
31
- const animFrameRef = Ae.useRef(0);
32
- const animStartRef = Ae.useRef(0);
33
- const activeAnimRef = Ae.useRef(null);
28
+ const [targets, setTargets] = Ve.useState([]);
29
+ const [animations, setAnimations] = Ve.useState([]);
30
+ const [isAnimating, setIsAnimating] = Ve.useState(false);
31
+ const animFrameRef = Ve.useRef(0);
32
+ const animStartRef = Ve.useRef(0);
33
+ const activeAnimRef = Ve.useRef(null);
34
34
  // Sync targets from mesh
35
- Ae.useEffect(() => {
35
+ Ve.useEffect(() => {
36
36
  if (!mesh || !mesh.morphTargetDictionary || !mesh.morphTargetInfluences) {
37
37
  setTargets([]);
38
38
  return;
@@ -50,14 +50,14 @@ function useMorphTargetEditor(mesh, onInfluenceChange) {
50
50
  list.sort((a, b) => a.index - b.index);
51
51
  setTargets(list);
52
52
  }, [mesh]);
53
- const setInfluence = Ae.useCallback((index, value) => {
53
+ const setInfluence = Ve.useCallback((index, value) => {
54
54
  if (!(mesh === null || mesh === void 0 ? void 0 : mesh.morphTargetInfluences))
55
55
  return;
56
56
  mesh.morphTargetInfluences[index] = value;
57
57
  setTargets((prev) => prev.map((t) => (t.index === index ? { ...t, influence: value } : t)));
58
58
  onInfluenceChange === null || onInfluenceChange === void 0 ? void 0 : onInfluenceChange(mesh, index, value);
59
59
  }, [mesh, onInfluenceChange]);
60
- const createMorphTarget = Ae.useCallback((name) => {
60
+ const createMorphTarget = Ve.useCallback((name) => {
61
61
  if (!mesh)
62
62
  return;
63
63
  const geometry = mesh.geometry;
@@ -87,7 +87,7 @@ function useMorphTargetEditor(mesh, onInfluenceChange) {
87
87
  mesh.updateMorphTargets();
88
88
  setTargets((prev) => [...prev, { name, index: newIndex, influence: 0 }]);
89
89
  }, [mesh]);
90
- const deleteMorphTarget = Ae.useCallback((index) => {
90
+ const deleteMorphTarget = Ve.useCallback((index) => {
91
91
  if (!mesh)
92
92
  return;
93
93
  const geometry = mesh.geometry;
@@ -111,13 +111,13 @@ function useMorphTargetEditor(mesh, onInfluenceChange) {
111
111
  influence: influences[idx],
112
112
  })));
113
113
  }, [mesh]);
114
- const resetAllInfluences = Ae.useCallback(() => {
114
+ const resetAllInfluences = Ve.useCallback(() => {
115
115
  if (!(mesh === null || mesh === void 0 ? void 0 : mesh.morphTargetInfluences))
116
116
  return;
117
117
  mesh.morphTargetInfluences.fill(0);
118
118
  setTargets((prev) => prev.map((t) => ({ ...t, influence: 0 })));
119
119
  }, [mesh]);
120
- const startAnimation = Ae.useCallback((animation) => {
120
+ const startAnimation = Ve.useCallback((animation) => {
121
121
  if (!(mesh === null || mesh === void 0 ? void 0 : mesh.morphTargetInfluences))
122
122
  return;
123
123
  activeAnimRef.current = animation;
@@ -159,18 +159,18 @@ function useMorphTargetEditor(mesh, onInfluenceChange) {
159
159
  };
160
160
  animFrameRef.current = requestAnimationFrame(animate);
161
161
  }, [mesh]);
162
- const stopAnimation = Ae.useCallback(() => {
162
+ const stopAnimation = Ve.useCallback(() => {
163
163
  activeAnimRef.current = null;
164
164
  setIsAnimating(false);
165
165
  cancelAnimationFrame(animFrameRef.current);
166
166
  }, []);
167
- Ae.useEffect(() => {
167
+ Ve.useEffect(() => {
168
168
  return () => cancelAnimationFrame(animFrameRef.current);
169
169
  }, []);
170
- const addAnimation = Ae.useCallback((animation) => {
170
+ const addAnimation = Ve.useCallback((animation) => {
171
171
  setAnimations((prev) => [...prev, animation]);
172
172
  }, []);
173
- const removeAnimation = Ae.useCallback((name) => {
173
+ const removeAnimation = Ve.useCallback((name) => {
174
174
  setAnimations((prev) => prev.filter((a) => a.name !== name));
175
175
  }, []);
176
176
  return {
@@ -190,7 +190,7 @@ function useMorphTargetEditor(mesh, onInfluenceChange) {
190
190
  /* ── Component ── */
191
191
  const NiceMorphTargetEditor = ({ mesh, onInfluenceChange, className = '', }) => {
192
192
  const { targets, setInfluence, createMorphTarget, deleteMorphTarget, resetAllInfluences, isAnimating, startAnimation, stopAnimation, animations, addAnimation, removeAnimation, } = useMorphTargetEditor(mesh, onInfluenceChange);
193
- const [newName, setNewName] = Ae.useState('');
193
+ const [newName, setNewName] = Ve.useState('');
194
194
  const handleCreate = () => {
195
195
  const name = newName.trim();
196
196
  if (!name)
@@ -2,7 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var THREE = require('three');
5
- var Ae = require('react');
5
+ var Ve = require('react');
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -208,12 +208,12 @@ function buildDebugVisualization(node, group, maxDepth) {
208
208
  }
209
209
  /* ── Hook ── */
210
210
  function useOctree(scene, configOverride) {
211
- const config = Ae.useMemo(() => ({ ...DEFAULT_CONFIG, ...configOverride }), [configOverride]);
212
- const [root, setRoot] = Ae.useState(null);
213
- const [showDebug, setShowDebug] = Ae.useState(false);
214
- const [stats, setStats] = Ae.useState({ nodeCount: 0, objectCount: 0 });
215
- const debugGroup = Ae.useRef(new THREE__namespace.Group());
216
- Ae.useEffect(() => {
211
+ const config = Ve.useMemo(() => ({ ...DEFAULT_CONFIG, ...configOverride }), [configOverride]);
212
+ const [root, setRoot] = Ve.useState(null);
213
+ const [showDebug, setShowDebug] = Ve.useState(false);
214
+ const [stats, setStats] = Ve.useState({ nodeCount: 0, objectCount: 0 });
215
+ const debugGroup = Ve.useRef(new THREE__namespace.Group());
216
+ Ve.useEffect(() => {
217
217
  if (!scene)
218
218
  return;
219
219
  debugGroup.current.name = '__octree_debug__';
@@ -224,7 +224,7 @@ function useOctree(scene, configOverride) {
224
224
  scene.remove(debugGroup.current);
225
225
  };
226
226
  }, [scene, showDebug]);
227
- const refreshDebug = Ae.useCallback((rootNode) => {
227
+ const refreshDebug = Ve.useCallback((rootNode) => {
228
228
  // Clear existing debug
229
229
  while (debugGroup.current.children.length) {
230
230
  const child = debugGroup.current.children[0];
@@ -234,7 +234,7 @@ function useOctree(scene, configOverride) {
234
234
  buildDebugVisualization(rootNode, debugGroup.current, config.maxDepth);
235
235
  }
236
236
  }, [showDebug, config.maxDepth]);
237
- const build = Ae.useCallback(() => {
237
+ const build = Ve.useCallback(() => {
238
238
  if (!scene)
239
239
  return;
240
240
  // Compute scene bounds
@@ -264,26 +264,26 @@ function useOctree(scene, configOverride) {
264
264
  setStats({ nodeCount: countNodes(rootNode), objectCount: countObjects(rootNode) });
265
265
  refreshDebug(rootNode);
266
266
  }, [scene, config, refreshDebug]);
267
- const insert = Ae.useCallback((object) => {
267
+ const insert = Ve.useCallback((object) => {
268
268
  if (!root)
269
269
  return;
270
270
  insertObject(root, object, config);
271
271
  setStats({ nodeCount: countNodes(root), objectCount: countObjects(root) });
272
272
  refreshDebug(root);
273
273
  }, [root, config, refreshDebug]);
274
- const remove = Ae.useCallback((object) => {
274
+ const remove = Ve.useCallback((object) => {
275
275
  if (!root)
276
276
  return;
277
277
  removeObject(root, object);
278
278
  setStats({ nodeCount: countNodes(root), objectCount: countObjects(root) });
279
279
  }, [root]);
280
- const update = Ae.useCallback((object) => {
280
+ const update = Ve.useCallback((object) => {
281
281
  if (!root)
282
282
  return;
283
283
  removeObject(root, object);
284
284
  insertObject(root, object, config);
285
285
  }, [root, config]);
286
- const raycast = Ae.useCallback((raycaster) => {
286
+ const raycast = Ve.useCallback((raycaster) => {
287
287
  if (!root)
288
288
  return [];
289
289
  const results = [];
@@ -291,7 +291,7 @@ function useOctree(scene, configOverride) {
291
291
  results.sort((a, b) => a.distance - b.distance);
292
292
  return results;
293
293
  }, [root]);
294
- const frustumCull = Ae.useCallback((camera) => {
294
+ const frustumCull = Ve.useCallback((camera) => {
295
295
  if (!root)
296
296
  return [];
297
297
  const frustum = new THREE__namespace.Frustum();
@@ -302,7 +302,7 @@ function useOctree(scene, configOverride) {
302
302
  frustumCullNode(root, frustum, results);
303
303
  return results;
304
304
  }, [root]);
305
- const nearestNeighbor = Ae.useCallback((point, maxDistance = Infinity) => {
305
+ const nearestNeighbor = Ve.useCallback((point, maxDistance = Infinity) => {
306
306
  if (!root)
307
307
  return null;
308
308
  const best = { object: null, dist: maxDistance };
@@ -327,7 +327,7 @@ function useOctree(scene, configOverride) {
327
327
  /* ── Component ── */
328
328
  const NiceOctree = ({ scene, config, showDebug: initialShowDebug, className = '', }) => {
329
329
  const octree = useOctree(scene, config);
330
- Ae.useEffect(() => {
330
+ Ve.useEffect(() => {
331
331
  if (initialShowDebug !== undefined)
332
332
  octree.setShowDebug(initialShowDebug);
333
333
  }, [initialShowDebug]);
@@ -2,7 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var THREE = require('three');
5
- var Ae = require('react');
5
+ var Ve = require('react');
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -45,21 +45,21 @@ function computeAABB(object) {
45
45
  let bodyIdCounter = 0;
46
46
  let jointIdCounter = 0;
47
47
  function usePhysicsSimulation(scene, onSimulationStep) {
48
- const [worldConfig, setWorldConfigState] = Ae.useState({
48
+ const [worldConfig, setWorldConfigState] = Ve.useState({
49
49
  gravity: new THREE__namespace.Vector3(0, -9.81, 0),
50
50
  timestep: 1 / 60,
51
51
  maxSubsteps: 4,
52
52
  });
53
- const [bodies, setBodies] = Ae.useState([]);
54
- const [joints, setJoints] = Ae.useState([]);
55
- const [isRunning, setIsRunning] = Ae.useState(false);
56
- const [debugDraw, setDebugDraw] = Ae.useState(false);
57
- const internalBodies = Ae.useRef(new Map());
58
- const debugGroup = Ae.useRef(new THREE__namespace.Group());
59
- const animFrameId = Ae.useRef(0);
60
- const lastTime = Ae.useRef(0);
53
+ const [bodies, setBodies] = Ve.useState([]);
54
+ const [joints, setJoints] = Ve.useState([]);
55
+ const [isRunning, setIsRunning] = Ve.useState(false);
56
+ const [debugDraw, setDebugDraw] = Ve.useState(false);
57
+ const internalBodies = Ve.useRef(new Map());
58
+ const debugGroup = Ve.useRef(new THREE__namespace.Group());
59
+ const animFrameId = Ve.useRef(0);
60
+ const lastTime = Ve.useRef(0);
61
61
  // Debug wireframe colliders
62
- Ae.useEffect(() => {
62
+ Ve.useEffect(() => {
63
63
  if (!scene)
64
64
  return;
65
65
  debugGroup.current.name = '__physics_debug__';
@@ -70,10 +70,10 @@ function usePhysicsSimulation(scene, onSimulationStep) {
70
70
  scene.remove(debugGroup.current);
71
71
  };
72
72
  }, [scene, debugDraw]);
73
- const setWorldConfig = Ae.useCallback((partial) => {
73
+ const setWorldConfig = Ve.useCallback((partial) => {
74
74
  setWorldConfigState((prev) => ({ ...prev, ...partial }));
75
75
  }, []);
76
- const addBody = Ae.useCallback((object) => {
76
+ const addBody = Ve.useCallback((object) => {
77
77
  const id = `phys_${++bodyIdCounter}`;
78
78
  const desc = {
79
79
  id,
@@ -105,7 +105,7 @@ function usePhysicsSimulation(scene, onSimulationStep) {
105
105
  }
106
106
  return desc;
107
107
  }, [debugDraw]);
108
- const removeBody = Ae.useCallback((id) => {
108
+ const removeBody = Ve.useCallback((id) => {
109
109
  internalBodies.current.delete(id);
110
110
  setBodies((prev) => prev.filter((b) => b.id !== id));
111
111
  // Remove debug wireframe
@@ -113,23 +113,23 @@ function usePhysicsSimulation(scene, onSimulationStep) {
113
113
  if (debugObj)
114
114
  debugGroup.current.remove(debugObj);
115
115
  }, []);
116
- const updateBody = Ae.useCallback((id, partial) => {
116
+ const updateBody = Ve.useCallback((id, partial) => {
117
117
  const internal = internalBodies.current.get(id);
118
118
  if (internal) {
119
119
  Object.assign(internal.desc, partial);
120
120
  }
121
121
  setBodies((prev) => prev.map((b) => (b.id === id ? { ...b, ...partial } : b)));
122
122
  }, []);
123
- const addJoint = Ae.useCallback((joint) => {
123
+ const addJoint = Ve.useCallback((joint) => {
124
124
  const id = `joint_${++jointIdCounter}`;
125
125
  setJoints((prev) => [...prev, { ...joint, id }]);
126
126
  }, []);
127
- const removeJoint = Ae.useCallback((id) => {
127
+ const removeJoint = Ve.useCallback((id) => {
128
128
  setJoints((prev) => prev.filter((j) => j.id !== id));
129
129
  }, []);
130
- const getBodyForObject = Ae.useCallback((objectName) => bodies.find((b) => b.objectName === objectName), [bodies]);
130
+ const getBodyForObject = Ve.useCallback((objectName) => bodies.find((b) => b.objectName === objectName), [bodies]);
131
131
  // Simplified physics step (Euler integration with collision detection)
132
- const simulationStep = Ae.useCallback((dt) => {
132
+ const simulationStep = Ve.useCallback((dt) => {
133
133
  const gravity = worldConfig.gravity;
134
134
  internalBodies.current.forEach((body) => {
135
135
  if (body.desc.bodyType !== 'dynamic')
@@ -196,7 +196,7 @@ function usePhysicsSimulation(scene, onSimulationStep) {
196
196
  onSimulationStep === null || onSimulationStep === void 0 ? void 0 : onSimulationStep(dt);
197
197
  }, [worldConfig.gravity, onSimulationStep]);
198
198
  // Animation loop
199
- Ae.useEffect(() => {
199
+ Ve.useEffect(() => {
200
200
  if (!isRunning)
201
201
  return;
202
202
  lastTime.current = performance.now();
@@ -213,12 +213,12 @@ function usePhysicsSimulation(scene, onSimulationStep) {
213
213
  animFrameId.current = requestAnimationFrame(loop);
214
214
  return () => cancelAnimationFrame(animFrameId.current);
215
215
  }, [isRunning, simulationStep, worldConfig.timestep, worldConfig.maxSubsteps]);
216
- const play = Ae.useCallback(() => setIsRunning(true), []);
217
- const pause = Ae.useCallback(() => setIsRunning(false), []);
218
- const step = Ae.useCallback(() => {
216
+ const play = Ve.useCallback(() => setIsRunning(true), []);
217
+ const pause = Ve.useCallback(() => setIsRunning(false), []);
218
+ const step = Ve.useCallback(() => {
219
219
  simulationStep(worldConfig.timestep);
220
220
  }, [simulationStep, worldConfig.timestep]);
221
- const reset = Ae.useCallback(() => {
221
+ const reset = Ve.useCallback(() => {
222
222
  setIsRunning(false);
223
223
  internalBodies.current.forEach((body) => {
224
224
  body.object.position.copy(body.initialPosition);
@@ -2,7 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var THREE = require('three');
5
- var Ae = require('react');
5
+ var Ve = require('react');
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -213,13 +213,13 @@ const DEFAULT_PIPE = {
213
213
  };
214
214
  const DEFAULT_GEAR = { innerRadius: 0.5, outerRadius: 2, teeth: 12, toothDepth: 0.3, thickness: 0.4 };
215
215
  function useProceduralGeometry(scene, onGenerated) {
216
- const [type, setType] = Ae.useState('tree');
217
- const [treeParams, setTreeParams] = Ae.useState(DEFAULT_TREE);
218
- const [rockParams, setRockParams] = Ae.useState(DEFAULT_ROCK);
219
- const [buildingParams, setBuildingParams] = Ae.useState(DEFAULT_BUILDING);
220
- const [pipeParams, setPipeParams] = Ae.useState(DEFAULT_PIPE);
221
- const [gearParams, setGearParams] = Ae.useState(DEFAULT_GEAR);
222
- const generate = Ae.useCallback(() => {
216
+ const [type, setType] = Ve.useState('tree');
217
+ const [treeParams, setTreeParams] = Ve.useState(DEFAULT_TREE);
218
+ const [rockParams, setRockParams] = Ve.useState(DEFAULT_ROCK);
219
+ const [buildingParams, setBuildingParams] = Ve.useState(DEFAULT_BUILDING);
220
+ const [pipeParams, setPipeParams] = Ve.useState(DEFAULT_PIPE);
221
+ const [gearParams, setGearParams] = Ve.useState(DEFAULT_GEAR);
222
+ const generate = Ve.useCallback(() => {
223
223
  if (!scene)
224
224
  return;
225
225
  let result;
@@ -2,7 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var THREE = require('three');
5
- var Ae = require('react');
5
+ var Ve = require('react');
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -42,25 +42,25 @@ function fractalNoise(x, z, octaves, persistence, lacunarity, rng) {
42
42
  }
43
43
  /* ── Hook ── */
44
44
  function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 100, segments: 128, maxHeight: 20 }, onTerrainChange) {
45
- const [brush, setBrushState] = Ae.useState({
45
+ const [brush, setBrushState] = Ve.useState({
46
46
  mode: 'raise',
47
47
  radius: 5,
48
48
  strength: 0.3,
49
49
  falloff: 'smooth',
50
50
  });
51
- const [isPainting, setIsPainting] = Ae.useState(false);
52
- const [textureLayers, setTextureLayers] = Ae.useState([
51
+ const [isPainting, setIsPainting] = Ve.useState(false);
52
+ const [textureLayers, setTextureLayers] = Ve.useState([
53
53
  { name: 'Grass', texture: null, scale: 10 },
54
54
  { name: 'Rock', texture: null, scale: 8 },
55
55
  { name: 'Sand', texture: null, scale: 12 },
56
56
  { name: 'Snow', texture: null, scale: 10 },
57
57
  ]);
58
- const [activeTextureLayer, setActiveTextureLayer] = Ae.useState(0);
59
- const terrainRef = Ae.useRef(null);
60
- const splatMapRef = Ae.useRef(null);
61
- const raycaster = Ae.useRef(new THREE__namespace.Raycaster());
58
+ const [activeTextureLayer, setActiveTextureLayer] = Ve.useState(0);
59
+ const terrainRef = Ve.useRef(null);
60
+ const splatMapRef = Ve.useRef(null);
61
+ const raycaster = Ve.useRef(new THREE__namespace.Raycaster());
62
62
  // Create terrain mesh
63
- Ae.useEffect(() => {
63
+ Ve.useEffect(() => {
64
64
  if (!scene)
65
65
  return;
66
66
  const geometry = new THREE__namespace.PlaneGeometry(config.width, config.depth, config.segments, config.segments);
@@ -90,10 +90,10 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
90
90
  material.dispose();
91
91
  };
92
92
  }, [scene, config.width, config.depth, config.segments]);
93
- const setBrush = Ae.useCallback((partial) => {
93
+ const setBrush = Ve.useCallback((partial) => {
94
94
  setBrushState((prev) => ({ ...prev, ...partial }));
95
95
  }, []);
96
- const applyBrushAtPoint = Ae.useCallback((point) => {
96
+ const applyBrushAtPoint = Ve.useCallback((point) => {
97
97
  const mesh = terrainRef.current;
98
98
  if (!mesh)
99
99
  return;
@@ -185,7 +185,7 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
185
185
  onTerrainChange === null || onTerrainChange === void 0 ? void 0 : onTerrainChange(mesh);
186
186
  }, [brush, config.segments, activeTextureLayer, onTerrainChange]);
187
187
  // Mouse handling
188
- Ae.useEffect(() => {
188
+ Ve.useEffect(() => {
189
189
  if (!canvas || !camera || !isPainting)
190
190
  return;
191
191
  const onPointerMove = (e) => {
@@ -203,7 +203,7 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
203
203
  canvas.addEventListener('pointermove', onPointerMove);
204
204
  return () => canvas.removeEventListener('pointermove', onPointerMove);
205
205
  }, [canvas, camera, isPainting, applyBrushAtPoint]);
206
- const generateFlat = Ae.useCallback(() => {
206
+ const generateFlat = Ve.useCallback(() => {
207
207
  const mesh = terrainRef.current;
208
208
  if (!mesh)
209
209
  return;
@@ -215,7 +215,7 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
215
215
  mesh.geometry.computeVertexNormals();
216
216
  onTerrainChange === null || onTerrainChange === void 0 ? void 0 : onTerrainChange(mesh);
217
217
  }, [onTerrainChange]);
218
- const generateNoise = Ae.useCallback((octaves = 6, persistence = 0.5, lacunarity = 2.0) => {
218
+ const generateNoise = Ve.useCallback((octaves = 6, persistence = 0.5, lacunarity = 2.0) => {
219
219
  const mesh = terrainRef.current;
220
220
  if (!mesh)
221
221
  return;
@@ -230,7 +230,7 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
230
230
  mesh.geometry.computeVertexNormals();
231
231
  onTerrainChange === null || onTerrainChange === void 0 ? void 0 : onTerrainChange(mesh);
232
232
  }, [config, onTerrainChange]);
233
- const importHeightmap = Ae.useCallback((image) => {
233
+ const importHeightmap = Ve.useCallback((image) => {
234
234
  const mesh = terrainRef.current;
235
235
  if (!mesh)
236
236
  return;
@@ -257,7 +257,7 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
257
257
  mesh.geometry.computeVertexNormals();
258
258
  onTerrainChange === null || onTerrainChange === void 0 ? void 0 : onTerrainChange(mesh);
259
259
  }, [config, onTerrainChange]);
260
- const exportHeightmap = Ae.useCallback(() => {
260
+ const exportHeightmap = Ve.useCallback(() => {
261
261
  const mesh = terrainRef.current;
262
262
  if (!mesh)
263
263
  return null;
@@ -290,7 +290,7 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
290
290
  ctx.putImageData(imageData, 0, 0);
291
291
  return exportCanvas;
292
292
  }, [config.segments]);
293
- const setTextureLayer = Ae.useCallback((index, partial) => {
293
+ const setTextureLayer = Ve.useCallback((index, partial) => {
294
294
  setTextureLayers((prev) => prev.map((l, i) => (i === index ? { ...l, ...partial } : l)));
295
295
  }, []);
296
296
  return {
@@ -320,8 +320,8 @@ const NiceTerrainEditor = ({ scene, camera, canvas, config: configProp, onTerrai
320
320
  ...configProp,
321
321
  };
322
322
  const { brush, setBrush, isPainting, startPainting, stopPainting, generateFlat, generateNoise, exportHeightmap, textureLayers, setTextureLayer, activeTextureLayer, setActiveTextureLayer, } = useTerrainEditor(scene, camera, canvas, config, onTerrainChange);
323
- const [noiseOctaves, setNoiseOctaves] = Ae.useState(6);
324
- const [noisePersistence, setNoisePersistence] = Ae.useState(0.5);
323
+ const [noiseOctaves, setNoiseOctaves] = Ve.useState(6);
324
+ const [noisePersistence, setNoisePersistence] = Ve.useState(0.5);
325
325
  return (jsxRuntime.jsxs("div", { className: `nice-terrain-editor ${className}`, style: { display: 'grid', gap: 8, fontSize: 13 }, children: [jsxRuntime.jsx("strong", { children: "Terrain Editor" }), jsxRuntime.jsxs("fieldset", { style: { border: '1px solid var(--border, #e2e8f0)', borderRadius: 6, padding: 4, display: 'flex', flexWrap: 'wrap', gap: 2 }, children: [jsxRuntime.jsx("legend", { style: { fontSize: 11 }, children: "Brush" }), ['raise', 'lower', 'flatten', 'smooth', 'noise', 'paint'].map((m) => (jsxRuntime.jsx("button", { type: "button", onClick: () => setBrush({ mode: m }), style: {
326
326
  padding: '3px 6px', fontSize: 11, cursor: 'pointer', borderRadius: 4,
327
327
  border: '1px solid var(--border, #e2e8f0)',