@zephyr3d/editor 0.3.0 → 0.3.1

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 (48) hide show
  1. package/README.md +143 -0
  2. package/dist/assets/{index-BaUzUcND.js → index-IISR7uQv.js} +1 -1
  3. package/dist/assistant/zephyr-types-index.json +1 -1
  4. package/dist/index.html +2 -2
  5. package/dist/modules/zephyr3d_backend-webgpu.js.map +1 -1
  6. package/dist/modules/zephyr3d_imgui.js +3 -3
  7. package/dist/modules/zephyr3d_imgui.js.map +1 -1
  8. package/dist/modules/zephyr3d_scene.js +1439 -1439
  9. package/dist/modules/zephyr3d_scene.js.map +1 -1
  10. package/dist/vendor/zephyr3d/backend-webgpu/dist/bindgroup_webgpu.js.map +1 -1
  11. package/dist/vendor/zephyr3d/backend-webgpu/dist/buffer_webgpu.js.map +1 -1
  12. package/dist/vendor/zephyr3d/backend-webgpu/dist/commandqueue.js.map +1 -1
  13. package/dist/vendor/zephyr3d/backend-webgpu/dist/uploadringbuffer.js.map +1 -1
  14. package/dist/vendor/zephyr3d/imgui/dist/imgui_impl.js.map +1 -1
  15. package/dist/vendor/zephyr3d/imgui/dist/renderer.js +3 -3
  16. package/dist/vendor/zephyr3d/imgui/dist/renderer.js.map +1 -1
  17. package/dist/vendor/zephyr3d/scene/dist/animation/animationset.js +135 -135
  18. package/dist/vendor/zephyr3d/scene/dist/animation/animationset.js.map +1 -1
  19. package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics/controller.js +146 -146
  20. package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics/controller.js.map +1 -1
  21. package/dist/vendor/zephyr3d/scene/dist/animation/spring/spring_system.js +75 -75
  22. package/dist/vendor/zephyr3d/scene/dist/animation/spring/spring_system.js.map +1 -1
  23. package/dist/vendor/zephyr3d/scene/dist/camera/camera.js +184 -184
  24. package/dist/vendor/zephyr3d/scene/dist/camera/camera.js.map +1 -1
  25. package/dist/vendor/zephyr3d/scene/dist/material/material.js +288 -288
  26. package/dist/vendor/zephyr3d/scene/dist/material/material.js.map +1 -1
  27. package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/history_resource_manager.js +93 -93
  28. package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/history_resource_manager.js.map +1 -1
  29. package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/history_resources.js +3 -3
  30. package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/history_resources.js.map +1 -1
  31. package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/types.js +22 -22
  32. package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/types.js.map +1 -1
  33. package/dist/vendor/zephyr3d/scene/dist/utility/blueprint/material/ir.js +489 -489
  34. package/dist/vendor/zephyr3d/scene/dist/utility/blueprint/material/ir.js.map +1 -1
  35. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/animation.js.map +1 -1
  36. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/camera.js.map +1 -1
  37. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/common.js.map +1 -1
  38. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/light.js.map +1 -1
  39. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/material.js.map +1 -1
  40. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/mesh.js.map +1 -1
  41. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/node.js.map +1 -1
  42. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/particle.js.map +1 -1
  43. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/primitive.js.map +1 -1
  44. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/scene.js.map +1 -1
  45. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/terrain.js.map +1 -1
  46. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/types.js +4 -4
  47. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/types.js.map +1 -1
  48. package/package.json +1 -1
@@ -7,11 +7,11 @@ const MAX_ACCUMULATED_SIMULATION_TIME = 1 / 20;
7
7
  const MAX_SIMULATION_STEPS_PER_UPDATE = Math.max(1, Math.ceil(MAX_ACCUMULATED_SIMULATION_TIME / FIXED_SIMULATION_TIME_STEP));
8
8
  const DEFAULT_PARTICLE_TARGET_SMOOTHING_TIME = 1 / 30;
9
9
  const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
10
- /**
11
- * Physics engine for spring-based particle simulation
12
- * Uses Verlet integration and iterative constraint solving
13
- *
14
- * @public
10
+ /**
11
+ * Physics engine for spring-based particle simulation
12
+ * Uses Verlet integration and iterative constraint solving
13
+ *
14
+ * @public
15
15
  */ class SpringSystem {
16
16
  _chain;
17
17
  _iterations;
@@ -57,9 +57,9 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
57
57
  this._smoothedCapsuleEndpoints = new WeakMap();
58
58
  this._smoothedPlaneData = new WeakMap();
59
59
  }
60
- /**
61
- * Updates the physics simulation
62
- * @param deltaTime - Time step in seconds
60
+ /**
61
+ * Updates the physics simulation
62
+ * @param deltaTime - Time step in seconds
63
63
  */ update(deltaTime) {
64
64
  const frameDt = Math.min(Math.max(Number(deltaTime) || 0, 0), MAX_ACCUMULATED_SIMULATION_TIME);
65
65
  if (frameDt <= 0) {
@@ -136,8 +136,8 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
136
136
  this.solveCollisions(inputDeltaTime);
137
137
  }
138
138
  }
139
- /**
140
- * Updates fixed particles to match their scene node positions
139
+ /**
140
+ * Updates fixed particles to match their scene node positions
141
141
  */ updateFixedParticles(deltaTime) {
142
142
  const blend = this.getTemporalBlendFactor(deltaTime, DEFAULT_PARTICLE_TARGET_SMOOTHING_TIME);
143
143
  for (const particle of this._chain.particles){
@@ -165,9 +165,9 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
165
165
  }
166
166
  }
167
167
  }
168
- /**
169
- * Solves pose preservation (long-range attachment to animated pose).
170
- * This keeps strands close to authored shape while preserving dynamic movement.
168
+ /**
169
+ * Solves pose preservation (long-range attachment to animated pose).
170
+ * This keeps strands close to authored shape while preserving dynamic movement.
171
171
  */ solvePosePreservation(totalIterations) {
172
172
  if (this._poseFollowRoot <= 0 && this._poseFollowTip <= 0) {
173
173
  return;
@@ -200,9 +200,9 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
200
200
  lerp(a, b, t) {
201
201
  return a + (b - a) * t;
202
202
  }
203
- /**
204
- * Calculates global rotation parameters from fixed particle movements
205
- * Uses position history to estimate rotation center
203
+ /**
204
+ * Calculates global rotation parameters from fixed particle movements
205
+ * Uses position history to estimate rotation center
206
206
  */ calculateGlobalRotation(dt) {
207
207
  // Collect fixed particles with movement
208
208
  const fixedParticles = [];
@@ -260,9 +260,9 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
260
260
  omega: sumOmega
261
261
  };
262
262
  }
263
- /**
264
- * Estimates rotation center from a single particle's position history
265
- * Uses circular motion fitting
263
+ /**
264
+ * Estimates rotation center from a single particle's position history
265
+ * Uses circular motion fitting
266
266
  */ estimateRotationCenterFromHistory(particle, currentVelocity) {
267
267
  const history = particle.positionHistory;
268
268
  if (!history || history.length < 3) {
@@ -298,9 +298,9 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
298
298
  const center = this.calculateCircleCenter(p1, p2, p3);
299
299
  return center;
300
300
  }
301
- /**
302
- * Calculates the center of a circle passing through 3 points
303
- * Uses perpendicular bisector method
301
+ /**
302
+ * Calculates the center of a circle passing through 3 points
303
+ * Uses perpendicular bisector method
304
304
  */ calculateCircleCenter(p1, p2, p3) {
305
305
  // Midpoints
306
306
  const mid12 = Vector3.scale(Vector3.add(p1, p2, new Vector3()), 0.5, new Vector3());
@@ -337,8 +337,8 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
337
337
  // Fallback: use centroid
338
338
  return Vector3.scale(Vector3.add(Vector3.add(p1, p2, new Vector3()), p3, new Vector3()), 1.0 / 3.0, new Vector3());
339
339
  }
340
- /**
341
- * Calculates inertial acceleration for a particle in a rotating reference frame
340
+ /**
341
+ * Calculates inertial acceleration for a particle in a rotating reference frame
342
342
  */ calculateInertialAcceleration(particle, rotationCenter, angularVelocity, particleVelocity, centrifugalScale, coriolisScale) {
343
343
  // Vector from rotation center to particle
344
344
  const r = Vector3.sub(particle.position, rotationCenter, new Vector3());
@@ -355,10 +355,10 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
355
355
  const totalAccel = Vector3.add(centrifugalAccel, coriolisAccel, new Vector3());
356
356
  return totalAccel;
357
357
  }
358
- /**
359
- * Solves a single spring constraint using XPBD (Extended Position-Based Dynamics).
360
- *
361
- * Reference: Müller et al., "Detailed Rigid Body Simulation with Extended Position Based Dynamics", 2020.
358
+ /**
359
+ * Solves a single spring constraint using XPBD (Extended Position-Based Dynamics).
360
+ *
361
+ * Reference: Müller et al., "Detailed Rigid Body Simulation with Extended Position Based Dynamics", 2020.
362
362
  */ solveConstraintXPBD(constraint, dt) {
363
363
  const pA = this._chain.particles[constraint.particleA];
364
364
  const pB = this._chain.particles[constraint.particleB];
@@ -391,8 +391,8 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
391
391
  Vector3.add(pB.position, Vector3.scale(n, wB * deltaLambda, new Vector3()), pB.position);
392
392
  }
393
393
  }
394
- /**
395
- * Solves a single spring constraint (Verlet / PBD)
394
+ /**
395
+ * Solves a single spring constraint (Verlet / PBD)
396
396
  */ solveConstraint(constraint) {
397
397
  const pA = this._chain.particles[constraint.particleA];
398
398
  const pB = this._chain.particles[constraint.particleB];
@@ -413,8 +413,8 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
413
413
  Vector3.sub(pB.position, correction, pB.position);
414
414
  }
415
415
  }
416
- /**
417
- * Solves collisions for all particles
416
+ /**
417
+ * Solves collisions for all particles
418
418
  */ solveCollisions(deltaTime) {
419
419
  // Update dynamic colliders from their nodes
420
420
  const blend = this.getTemporalBlendFactor(deltaTime, DEFAULT_COLLIDER_SMOOTHING_TIME);
@@ -487,9 +487,9 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
487
487
  }
488
488
  }
489
489
  }
490
- /**
491
- * Applies simulation results to scene nodes
492
- * @param weight - Blend weight [0-1] (default: 1.0)
490
+ /**
491
+ * Applies simulation results to scene nodes
492
+ * @param weight - Blend weight [0-1] (default: 1.0)
493
493
  */ applyToNodes(weight = 1.0) {
494
494
  for(let i = 0; i < this._chain.particles.length - 1; i++){
495
495
  const particle = this._chain.particles[i];
@@ -537,8 +537,8 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
537
537
  }
538
538
  }
539
539
  }
540
- /**
541
- * Resets the simulation to initial state
540
+ /**
541
+ * Resets the simulation to initial state
542
542
  */ reset() {
543
543
  this._chain.reset();
544
544
  for (const particle of this._chain.particles){
@@ -554,61 +554,61 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
554
554
  this._smoothedCapsuleEndpoints = new WeakMap();
555
555
  this._smoothedPlaneData = new WeakMap();
556
556
  }
557
- /**
558
- * Gets the spring chain
557
+ /**
558
+ * Gets the spring chain
559
559
  */ get chain() {
560
560
  return this._chain;
561
561
  }
562
- /**
563
- * Gets the current gravity
562
+ /**
563
+ * Gets the current gravity
564
564
  */ get gravity() {
565
565
  return this._gravity;
566
566
  }
567
567
  set gravity(gravity) {
568
568
  this._gravity.set(gravity);
569
569
  }
570
- /**
571
- * Gets the current wind
570
+ /**
571
+ * Gets the current wind
572
572
  */ get wind() {
573
573
  return this._wind;
574
574
  }
575
575
  set wind(wind) {
576
576
  this._wind.set(wind);
577
577
  }
578
- /**
579
- * Gets the number of iterations
578
+ /**
579
+ * Gets the number of iterations
580
580
  */ get iterations() {
581
581
  return this._iterations;
582
582
  }
583
583
  set iterations(count) {
584
584
  this._iterations = Math.max(1, count);
585
585
  }
586
- /**
587
- * Gets whether inertial forces are enabled
586
+ /**
587
+ * Gets whether inertial forces are enabled
588
588
  */ get enableInertialForces() {
589
589
  return this._enableInertialForces;
590
590
  }
591
591
  set enableInertialForces(enabled) {
592
592
  this._enableInertialForces = enabled;
593
593
  }
594
- /**
595
- * Gets the centrifugal force scale
594
+ /**
595
+ * Gets the centrifugal force scale
596
596
  */ get centrifugalScale() {
597
597
  return this._centrifugalScale;
598
598
  }
599
599
  set centrifugalScale(scale) {
600
600
  this._centrifugalScale = Math.max(0, scale);
601
601
  }
602
- /**
603
- * Gets the Coriolis force scale
602
+ /**
603
+ * Gets the Coriolis force scale
604
604
  */ get coriolisScale() {
605
605
  return this._coriolisScale;
606
606
  }
607
607
  set coriolisScale(scale) {
608
608
  this._coriolisScale = Math.max(0, scale);
609
609
  }
610
- /**
611
- * Gets the constraint solver type
610
+ /**
611
+ * Gets the constraint solver type
612
612
  */ get solver() {
613
613
  return this._solver;
614
614
  }
@@ -622,8 +622,8 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
622
622
  }
623
623
  }
624
624
  }
625
- /**
626
- * Gets pose preservation strength [0-1]
625
+ /**
626
+ * Gets pose preservation strength [0-1]
627
627
  */ get poseFollow() {
628
628
  return this._poseFollow;
629
629
  }
@@ -633,8 +633,8 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
633
633
  this._poseFollowRoot = v;
634
634
  this._poseFollowTip = v;
635
635
  }
636
- /**
637
- * Gets max allowed deviation from animated pose
636
+ /**
637
+ * Gets max allowed deviation from animated pose
638
638
  */ get maxPoseOffset() {
639
639
  return this._maxPoseOffset;
640
640
  }
@@ -644,56 +644,56 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
644
644
  this._maxPoseOffsetRoot = v;
645
645
  this._maxPoseOffsetTip = v;
646
646
  }
647
- /**
648
- * Gets root pose follow strength [0-1]
647
+ /**
648
+ * Gets root pose follow strength [0-1]
649
649
  */ get poseFollowRoot() {
650
650
  return this._poseFollowRoot;
651
651
  }
652
652
  set poseFollowRoot(value) {
653
653
  this._poseFollowRoot = Math.max(0, Math.min(1, value));
654
654
  }
655
- /**
656
- * Gets tip pose follow strength [0-1]
655
+ /**
656
+ * Gets tip pose follow strength [0-1]
657
657
  */ get poseFollowTip() {
658
658
  return this._poseFollowTip;
659
659
  }
660
660
  set poseFollowTip(value) {
661
661
  this._poseFollowTip = Math.max(0, Math.min(1, value));
662
662
  }
663
- /**
664
- * Gets exponent for root-to-tip interpolation
663
+ /**
664
+ * Gets exponent for root-to-tip interpolation
665
665
  */ get poseFollowExponent() {
666
666
  return this._poseFollowExponent;
667
667
  }
668
668
  set poseFollowExponent(value) {
669
669
  this._poseFollowExponent = Math.max(0.1, value);
670
670
  }
671
- /**
672
- * Gets root max allowed deviation from animated pose
671
+ /**
672
+ * Gets root max allowed deviation from animated pose
673
673
  */ get maxPoseOffsetRoot() {
674
674
  return this._maxPoseOffsetRoot;
675
675
  }
676
676
  set maxPoseOffsetRoot(value) {
677
677
  this._maxPoseOffsetRoot = Math.max(0, value);
678
678
  }
679
- /**
680
- * Gets tip max allowed deviation from animated pose
679
+ /**
680
+ * Gets tip max allowed deviation from animated pose
681
681
  */ get maxPoseOffsetTip() {
682
682
  return this._maxPoseOffsetTip;
683
683
  }
684
684
  set maxPoseOffsetTip(value) {
685
685
  this._maxPoseOffsetTip = Math.max(0, value);
686
686
  }
687
- /**
688
- * Adds a collider to the system
687
+ /**
688
+ * Adds a collider to the system
689
689
  */ addCollider(collider) {
690
690
  this._colliders.push(collider);
691
691
  this._smoothedSphereCenters = new WeakMap();
692
692
  this._smoothedCapsuleEndpoints = new WeakMap();
693
693
  this._smoothedPlaneData = new WeakMap();
694
694
  }
695
- /**
696
- * Removes a collider from the system
695
+ /**
696
+ * Removes a collider from the system
697
697
  */ removeCollider(collider) {
698
698
  const index = this._colliders.indexOf(collider);
699
699
  if (index >= 0) {
@@ -705,16 +705,16 @@ const DEFAULT_COLLIDER_SMOOTHING_TIME = 1 / 30;
705
705
  }
706
706
  return false;
707
707
  }
708
- /**
709
- * Clears all colliders
708
+ /**
709
+ * Clears all colliders
710
710
  */ clearColliders() {
711
711
  this._colliders = [];
712
712
  this._smoothedSphereCenters = new WeakMap();
713
713
  this._smoothedCapsuleEndpoints = new WeakMap();
714
714
  this._smoothedPlaneData = new WeakMap();
715
715
  }
716
- /**
717
- * Gets all colliders
716
+ /**
717
+ * Gets all colliders
718
718
  */ get colliders() {
719
719
  return this._colliders;
720
720
  }