@newkrok/nape-js 3.3.21 → 3.3.23

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/index.cjs CHANGED
@@ -8224,6 +8224,440 @@ _ZPP_ColArbiter.CIRCLE = 2;
8224
8224
  _ZPP_ColArbiter.zpp_pool = null;
8225
8225
  var ZPP_ColArbiter = _ZPP_ColArbiter;
8226
8226
 
8227
+ // src/native/constraint/ZPP_Constraint.ts
8228
+ var _ZPP_Constraint = class _ZPP_Constraint {
8229
+ constructor() {
8230
+ // --- Instance fields ---
8231
+ this.outer = null;
8232
+ this.id = 0;
8233
+ this.userData = null;
8234
+ this.compound = null;
8235
+ this.space = null;
8236
+ this.active = false;
8237
+ this.stiff = false;
8238
+ this.frequency = 0;
8239
+ this.damping = 0;
8240
+ this.maxForce = 0;
8241
+ this.maxError = 0;
8242
+ this.breakUnderForce = false;
8243
+ this.breakUnderError = false;
8244
+ this.removeOnBreak = false;
8245
+ this.component = null;
8246
+ this.ignore = false;
8247
+ this.__velocity = false;
8248
+ this.cbTypes = null;
8249
+ this.cbSet = null;
8250
+ this.wrap_cbTypes = null;
8251
+ this.pre_dt = -1;
8252
+ this.__class__ = _ZPP_Constraint;
8253
+ this._initBase();
8254
+ }
8255
+ /**
8256
+ * Initialise base constraint fields.
8257
+ * Extracted into a separate method because compiled joint subclasses
8258
+ * call `ZPP_Constraint.call(this)` — ES classes can't be invoked that
8259
+ * way, so the compiled wrapper delegates to this method instead.
8260
+ */
8261
+ _initBase() {
8262
+ const zpp = _ZPP_Constraint._zpp;
8263
+ this.id = ZPP_ID.Constraint();
8264
+ this.stiff = true;
8265
+ this.active = true;
8266
+ this.ignore = false;
8267
+ this.frequency = 10;
8268
+ this.damping = 1;
8269
+ this.maxForce = Infinity;
8270
+ this.maxError = Infinity;
8271
+ this.breakUnderForce = false;
8272
+ this.removeOnBreak = true;
8273
+ this.pre_dt = -1;
8274
+ this.cbTypes = new zpp.util.ZNPList_ZPP_CbType();
8275
+ }
8276
+ // --- Stub methods (overridden by subclasses) ---
8277
+ clear() {
8278
+ }
8279
+ activeBodies() {
8280
+ }
8281
+ inactiveBodies() {
8282
+ }
8283
+ clearcache() {
8284
+ }
8285
+ validate() {
8286
+ }
8287
+ wake_connected() {
8288
+ }
8289
+ forest() {
8290
+ }
8291
+ broken() {
8292
+ }
8293
+ warmStart() {
8294
+ }
8295
+ draw(_g) {
8296
+ }
8297
+ pair_exists(_id, _di) {
8298
+ return false;
8299
+ }
8300
+ preStep(_dt) {
8301
+ return false;
8302
+ }
8303
+ applyImpulseVel() {
8304
+ return false;
8305
+ }
8306
+ applyImpulsePos() {
8307
+ return false;
8308
+ }
8309
+ copy(_dict, _todo) {
8310
+ return null;
8311
+ }
8312
+ // --- Mid-step guard ---
8313
+ immutable_midstep(name) {
8314
+ if (this.space != null && this.space.midstep) {
8315
+ throw new Error(
8316
+ "Error: Constraint::" + name + " cannot be set during space step()"
8317
+ );
8318
+ }
8319
+ }
8320
+ // --- Callback types management ---
8321
+ setupcbTypes() {
8322
+ const zpp = _ZPP_Constraint._zpp;
8323
+ this.wrap_cbTypes = zpp.util.ZPP_CbTypeList.get(this.cbTypes);
8324
+ this.wrap_cbTypes.zpp_inner.adder = this.wrap_cbTypes_adder.bind(this);
8325
+ this.wrap_cbTypes.zpp_inner.subber = this.wrap_cbTypes_subber.bind(this);
8326
+ this.wrap_cbTypes.zpp_inner.dontremove = true;
8327
+ this.wrap_cbTypes.zpp_inner._modifiable = this.immutable_cbTypes.bind(this);
8328
+ }
8329
+ immutable_cbTypes() {
8330
+ this.immutable_midstep("Constraint::cbTypes");
8331
+ }
8332
+ wrap_cbTypes_subber(pcb) {
8333
+ const cb = pcb.zpp_inner;
8334
+ if (this.cbTypes.has(cb)) {
8335
+ if (this.space != null) {
8336
+ this.dealloc_cbSet();
8337
+ cb.constraints.remove(this);
8338
+ }
8339
+ this.cbTypes.remove(cb);
8340
+ if (this.space != null) {
8341
+ this.alloc_cbSet();
8342
+ this.wake();
8343
+ }
8344
+ }
8345
+ }
8346
+ wrap_cbTypes_adder(cb) {
8347
+ this.insert_cbtype(cb.zpp_inner);
8348
+ return false;
8349
+ }
8350
+ insert_cbtype(cb) {
8351
+ const zpp = _ZPP_Constraint._zpp;
8352
+ if (!this.cbTypes.has(cb)) {
8353
+ if (this.space != null) {
8354
+ this.dealloc_cbSet();
8355
+ cb.constraints.add(this);
8356
+ }
8357
+ let pre = null;
8358
+ let cx_ite = this.cbTypes.head;
8359
+ while (cx_ite != null) {
8360
+ const j = cx_ite.elt;
8361
+ if (cb.id < j.id) {
8362
+ break;
8363
+ }
8364
+ pre = cx_ite;
8365
+ cx_ite = cx_ite.next;
8366
+ }
8367
+ const _this = this.cbTypes;
8368
+ let ret;
8369
+ if (zpp.util.ZNPNode_ZPP_CbType.zpp_pool == null) {
8370
+ ret = new zpp.util.ZNPNode_ZPP_CbType();
8371
+ } else {
8372
+ ret = zpp.util.ZNPNode_ZPP_CbType.zpp_pool;
8373
+ zpp.util.ZNPNode_ZPP_CbType.zpp_pool = ret.next;
8374
+ ret.next = null;
8375
+ }
8376
+ ret.elt = cb;
8377
+ const temp = ret;
8378
+ if (pre == null) {
8379
+ temp.next = _this.head;
8380
+ _this.head = temp;
8381
+ } else {
8382
+ temp.next = pre.next;
8383
+ pre.next = temp;
8384
+ }
8385
+ _this.pushmod = _this.modified = true;
8386
+ _this.length++;
8387
+ if (this.space != null) {
8388
+ this.alloc_cbSet();
8389
+ this.wake();
8390
+ }
8391
+ }
8392
+ }
8393
+ // --- CbSet management ---
8394
+ alloc_cbSet() {
8395
+ if ((this.cbSet = this.space.cbsets.get(this.cbTypes)) != null) {
8396
+ this.cbSet.count++;
8397
+ this.cbSet.constraints.add(this);
8398
+ }
8399
+ }
8400
+ dealloc_cbSet() {
8401
+ const zpp = _ZPP_Constraint._zpp;
8402
+ if (this.cbSet != null) {
8403
+ this.cbSet.constraints.remove(this);
8404
+ if (--this.cbSet.count == 0) {
8405
+ this.space.cbsets.remove(this.cbSet);
8406
+ const o = this.cbSet;
8407
+ o.listeners.clear();
8408
+ o.zip_listeners = true;
8409
+ o.bodylisteners.clear();
8410
+ o.zip_bodylisteners = true;
8411
+ o.conlisteners.clear();
8412
+ o.zip_conlisteners = true;
8413
+ while (o.cbTypes.head != null) {
8414
+ const cb = o.cbTypes.pop_unsafe();
8415
+ cb.cbsets.remove(o);
8416
+ }
8417
+ o.next = zpp.callbacks.ZPP_CbSet.zpp_pool;
8418
+ zpp.callbacks.ZPP_CbSet.zpp_pool = o;
8419
+ }
8420
+ this.cbSet = null;
8421
+ }
8422
+ }
8423
+ // --- Activation / space integration ---
8424
+ activate() {
8425
+ if (this.space != null) {
8426
+ this.activeInSpace();
8427
+ }
8428
+ }
8429
+ deactivate() {
8430
+ if (this.space != null) {
8431
+ this.inactiveOrOutSpace();
8432
+ }
8433
+ }
8434
+ addedToSpace() {
8435
+ if (this.active) {
8436
+ this.activeInSpace();
8437
+ }
8438
+ this.activeBodies();
8439
+ let cx_ite = this.cbTypes.head;
8440
+ while (cx_ite != null) {
8441
+ const cb = cx_ite.elt;
8442
+ cb.constraints.add(this);
8443
+ cx_ite = cx_ite.next;
8444
+ }
8445
+ }
8446
+ removedFromSpace() {
8447
+ if (this.active) {
8448
+ this.inactiveOrOutSpace();
8449
+ }
8450
+ this.inactiveBodies();
8451
+ let cx_ite = this.cbTypes.head;
8452
+ while (cx_ite != null) {
8453
+ const cb = cx_ite.elt;
8454
+ cb.constraints.remove(this);
8455
+ cx_ite = cx_ite.next;
8456
+ }
8457
+ }
8458
+ activeInSpace() {
8459
+ const zpp = _ZPP_Constraint._zpp;
8460
+ this.alloc_cbSet();
8461
+ if (zpp.space.ZPP_Component.zpp_pool == null) {
8462
+ this.component = new zpp.space.ZPP_Component();
8463
+ } else {
8464
+ this.component = zpp.space.ZPP_Component.zpp_pool;
8465
+ zpp.space.ZPP_Component.zpp_pool = this.component.next;
8466
+ this.component.next = null;
8467
+ }
8468
+ this.component.isBody = false;
8469
+ this.component.constraint = this;
8470
+ }
8471
+ inactiveOrOutSpace() {
8472
+ const zpp = _ZPP_Constraint._zpp;
8473
+ this.dealloc_cbSet();
8474
+ const o = this.component;
8475
+ o.body = null;
8476
+ o.constraint = null;
8477
+ o.next = zpp.space.ZPP_Component.zpp_pool;
8478
+ zpp.space.ZPP_Component.zpp_pool = o;
8479
+ this.component = null;
8480
+ }
8481
+ // --- Wake ---
8482
+ wake() {
8483
+ if (this.space != null) {
8484
+ this.space.wake_constraint(this);
8485
+ }
8486
+ }
8487
+ // --- Copy support ---
8488
+ copyto(ret) {
8489
+ const nape46 = _ZPP_Constraint._nape;
8490
+ const me = this.outer;
8491
+ if (me.zpp_inner.wrap_cbTypes == null) {
8492
+ me.zpp_inner.setupcbTypes();
8493
+ }
8494
+ const cbList = me.zpp_inner.wrap_cbTypes;
8495
+ cbList.zpp_inner.valmod();
8496
+ const _g = nape46.callbacks.CbTypeIterator.get(cbList);
8497
+ while (true) {
8498
+ _g.zpp_inner.zpp_inner.valmod();
8499
+ const _this1 = _g.zpp_inner;
8500
+ _this1.zpp_inner.valmod();
8501
+ if (_this1.zpp_inner.zip_length) {
8502
+ _this1.zpp_inner.zip_length = false;
8503
+ _this1.zpp_inner.user_length = _this1.zpp_inner.inner.length;
8504
+ }
8505
+ const length = _this1.zpp_inner.user_length;
8506
+ _g.zpp_critical = true;
8507
+ let tmp;
8508
+ if (_g.zpp_i < length) {
8509
+ tmp = true;
8510
+ } else {
8511
+ _g.zpp_next = nape46.callbacks.CbTypeIterator.zpp_pool;
8512
+ nape46.callbacks.CbTypeIterator.zpp_pool = _g;
8513
+ _g.zpp_inner = null;
8514
+ tmp = false;
8515
+ }
8516
+ if (!tmp) {
8517
+ break;
8518
+ }
8519
+ _g.zpp_critical = false;
8520
+ const cb = _g.zpp_inner.at(_g.zpp_i++);
8521
+ if (ret.zpp_inner.wrap_cbTypes == null) {
8522
+ ret.zpp_inner.setupcbTypes();
8523
+ }
8524
+ const _this2 = ret.zpp_inner.wrap_cbTypes;
8525
+ if (_this2.zpp_inner.reverse_flag) {
8526
+ _this2.push(cb);
8527
+ } else {
8528
+ _this2.unshift(cb);
8529
+ }
8530
+ }
8531
+ ret.zpp_inner.removeOnBreak = me.zpp_inner.removeOnBreak;
8532
+ const breakUnderError = me.zpp_inner.breakUnderError;
8533
+ if (ret.zpp_inner.breakUnderError != breakUnderError) {
8534
+ ret.zpp_inner.breakUnderError = breakUnderError;
8535
+ ret.zpp_inner.wake();
8536
+ }
8537
+ const breakUnderForce = me.zpp_inner.breakUnderForce;
8538
+ if (ret.zpp_inner.breakUnderForce != breakUnderForce) {
8539
+ ret.zpp_inner.breakUnderForce = breakUnderForce;
8540
+ ret.zpp_inner.wake();
8541
+ }
8542
+ const maxError = me.zpp_inner.maxError;
8543
+ if (maxError !== maxError) {
8544
+ throw new Error("Error: Constraint::maxError cannot be NaN");
8545
+ }
8546
+ if (maxError < 0) {
8547
+ throw new Error("Error: Constraint::maxError must be >=0");
8548
+ }
8549
+ if (ret.zpp_inner.maxError != maxError) {
8550
+ ret.zpp_inner.maxError = maxError;
8551
+ ret.zpp_inner.wake();
8552
+ }
8553
+ const maxForce = me.zpp_inner.maxForce;
8554
+ if (maxForce !== maxForce) {
8555
+ throw new Error("Error: Constraint::maxForce cannot be NaN");
8556
+ }
8557
+ if (maxForce < 0) {
8558
+ throw new Error("Error: Constraint::maxForce must be >=0");
8559
+ }
8560
+ if (ret.zpp_inner.maxForce != maxForce) {
8561
+ ret.zpp_inner.maxForce = maxForce;
8562
+ ret.zpp_inner.wake();
8563
+ }
8564
+ const damping = me.zpp_inner.damping;
8565
+ if (damping !== damping) {
8566
+ throw new Error("Error: Constraint::Damping cannot be Nan");
8567
+ }
8568
+ if (damping < 0) {
8569
+ throw new Error("Error: Constraint::Damping must be >=0");
8570
+ }
8571
+ if (ret.zpp_inner.damping != damping) {
8572
+ ret.zpp_inner.damping = damping;
8573
+ if (!ret.zpp_inner.stiff) {
8574
+ ret.zpp_inner.wake();
8575
+ }
8576
+ }
8577
+ const frequency = me.zpp_inner.frequency;
8578
+ if (frequency !== frequency) {
8579
+ throw new Error("Error: Constraint::Frequency cannot be NaN");
8580
+ }
8581
+ if (frequency <= 0) {
8582
+ throw new Error("Error: Constraint::Frequency must be >0");
8583
+ }
8584
+ if (ret.zpp_inner.frequency != frequency) {
8585
+ ret.zpp_inner.frequency = frequency;
8586
+ if (!ret.zpp_inner.stiff) {
8587
+ ret.zpp_inner.wake();
8588
+ }
8589
+ }
8590
+ const stiff = me.zpp_inner.stiff;
8591
+ if (ret.zpp_inner.stiff != stiff) {
8592
+ ret.zpp_inner.stiff = stiff;
8593
+ ret.zpp_inner.wake();
8594
+ }
8595
+ const ignore = me.zpp_inner.ignore;
8596
+ if (ret.zpp_inner.ignore != ignore) {
8597
+ ret.zpp_inner.ignore = ignore;
8598
+ ret.zpp_inner.wake();
8599
+ }
8600
+ const active = me.zpp_inner.active;
8601
+ if (ret.zpp_inner.active != active) {
8602
+ if (ret.zpp_inner.component != null) {
8603
+ ret.zpp_inner.component.woken = false;
8604
+ }
8605
+ ret.zpp_inner.clearcache();
8606
+ if (active) {
8607
+ ret.zpp_inner.active = active;
8608
+ ret.zpp_inner.activate();
8609
+ if (ret.zpp_inner.space != null) {
8610
+ if (ret.zpp_inner.component != null) {
8611
+ ret.zpp_inner.component.sleeping = true;
8612
+ }
8613
+ ret.zpp_inner.space.wake_constraint(ret.zpp_inner, true);
8614
+ }
8615
+ } else {
8616
+ if (ret.zpp_inner.space != null) {
8617
+ ret.zpp_inner.wake();
8618
+ ret.zpp_inner.space.live_constraints.remove(ret.zpp_inner);
8619
+ }
8620
+ ret.zpp_inner.active = active;
8621
+ ret.zpp_inner.deactivate();
8622
+ }
8623
+ }
8624
+ }
8625
+ };
8626
+ // --- Static: Haxe metadata ---
8627
+ _ZPP_Constraint.__name__ = ["zpp_nape", "constraint", "ZPP_Constraint"];
8628
+ /**
8629
+ * Namespace references, set by the compiled module after import.
8630
+ * _nape = the `nape` public namespace (for CbTypeIterator in copyto)
8631
+ * _zpp = the `zpp_nape` internal namespace (for ZNPList_*, ZPP_CbSet, etc.)
8632
+ */
8633
+ _ZPP_Constraint._nape = null;
8634
+ _ZPP_Constraint._zpp = null;
8635
+ var ZPP_Constraint = _ZPP_Constraint;
8636
+
8637
+ // src/native/constraint/ZPP_CopyHelper.ts
8638
+ var _ZPP_CopyHelper = class _ZPP_CopyHelper {
8639
+ constructor() {
8640
+ this.id = 0;
8641
+ this.bc = null;
8642
+ this.cb = null;
8643
+ this.__class__ = _ZPP_CopyHelper;
8644
+ }
8645
+ static dict(id, bc) {
8646
+ const ret = new _ZPP_CopyHelper();
8647
+ ret.id = id;
8648
+ ret.bc = bc;
8649
+ return ret;
8650
+ }
8651
+ static todo(id, cb) {
8652
+ const ret = new _ZPP_CopyHelper();
8653
+ ret.id = id;
8654
+ ret.cb = cb;
8655
+ return ret;
8656
+ }
8657
+ };
8658
+ _ZPP_CopyHelper.__name__ = ["zpp_nape", "constraint", "ZPP_CopyHelper"];
8659
+ var ZPP_CopyHelper = _ZPP_CopyHelper;
8660
+
8227
8661
  // src/core/nape-compiled.js
8228
8662
  var _nape;
8229
8663
  var define = function(factory) {
@@ -29001,409 +29435,17 @@ define(function() {
29001
29435
  zpp_nape.callbacks.ZPP_OptionType = $hxClasses["zpp_nape.callbacks.ZPP_OptionType"] = ZPP_OptionType;
29002
29436
  zpp_nape.callbacks.ZPP_OptionType.prototype.__class__ = zpp_nape.callbacks.ZPP_OptionType;
29003
29437
  if (!zpp_nape.constraint) zpp_nape.constraint = {};
29438
+ ZPP_Constraint._nape = nape46;
29439
+ ZPP_Constraint._zpp = zpp_nape;
29004
29440
  zpp_nape.constraint.ZPP_Constraint = $hxClasses["zpp_nape.constraint.ZPP_Constraint"] = function() {
29005
- this.pre_dt = 0;
29006
- this.wrap_cbTypes = null;
29007
- this.cbSet = null;
29008
- this.cbTypes = null;
29009
- this.__velocity = false;
29010
- this.ignore = false;
29011
- this.component = null;
29012
- this.removeOnBreak = false;
29013
- this.breakUnderError = false;
29014
- this.breakUnderForce = false;
29015
- this.maxError = 0;
29016
- this.maxForce = 0;
29017
- this.damping = 0;
29018
- this.frequency = 0;
29019
- this.stiff = false;
29020
- this.active = false;
29021
- this.space = null;
29022
- this.compound = null;
29023
- this.userData = null;
29024
- this.id = 0;
29025
- this.outer = null;
29026
- this.__velocity = false;
29027
- this.id = zpp_nape.ZPP_ID.Constraint();
29028
- this.stiff = true;
29029
- this.active = true;
29030
- this.ignore = false;
29031
- this.frequency = 10;
29032
- this.damping = 1;
29033
- this.maxForce = Infinity;
29034
- this.maxError = Infinity;
29035
- this.breakUnderForce = false;
29036
- this.removeOnBreak = true;
29037
- this.pre_dt = -1;
29038
- this.cbTypes = new zpp_nape.util.ZNPList_ZPP_CbType();
29039
- };
29040
- zpp_nape.constraint.ZPP_Constraint.__name__ = [
29041
- "zpp_nape",
29042
- "constraint",
29043
- "ZPP_Constraint"
29044
- ];
29045
- zpp_nape.constraint.ZPP_Constraint.prototype.outer = null;
29046
- zpp_nape.constraint.ZPP_Constraint.prototype.clear = function() {
29047
- };
29048
- zpp_nape.constraint.ZPP_Constraint.prototype.id = null;
29049
- zpp_nape.constraint.ZPP_Constraint.prototype.userData = null;
29050
- zpp_nape.constraint.ZPP_Constraint.prototype.compound = null;
29051
- zpp_nape.constraint.ZPP_Constraint.prototype.space = null;
29052
- zpp_nape.constraint.ZPP_Constraint.prototype.active = null;
29053
- zpp_nape.constraint.ZPP_Constraint.prototype.stiff = null;
29054
- zpp_nape.constraint.ZPP_Constraint.prototype.frequency = null;
29055
- zpp_nape.constraint.ZPP_Constraint.prototype.damping = null;
29056
- zpp_nape.constraint.ZPP_Constraint.prototype.maxForce = null;
29057
- zpp_nape.constraint.ZPP_Constraint.prototype.maxError = null;
29058
- zpp_nape.constraint.ZPP_Constraint.prototype.breakUnderForce = null;
29059
- zpp_nape.constraint.ZPP_Constraint.prototype.breakUnderError = null;
29060
- zpp_nape.constraint.ZPP_Constraint.prototype.removeOnBreak = null;
29061
- zpp_nape.constraint.ZPP_Constraint.prototype.component = null;
29062
- zpp_nape.constraint.ZPP_Constraint.prototype.ignore = null;
29063
- zpp_nape.constraint.ZPP_Constraint.prototype.__velocity = null;
29064
- zpp_nape.constraint.ZPP_Constraint.prototype.immutable_midstep = function(name) {
29065
- if (this.space != null && this.space.midstep) {
29066
- throw new js._Boot.HaxeError(
29067
- "Error: Constraint::" + name + " cannot be set during space step()"
29068
- );
29069
- }
29070
- };
29071
- zpp_nape.constraint.ZPP_Constraint.prototype.cbTypes = null;
29072
- zpp_nape.constraint.ZPP_Constraint.prototype.cbSet = null;
29073
- zpp_nape.constraint.ZPP_Constraint.prototype.wrap_cbTypes = null;
29074
- zpp_nape.constraint.ZPP_Constraint.prototype.setupcbTypes = function() {
29075
- this.wrap_cbTypes = zpp_nape.util.ZPP_CbTypeList.get(this.cbTypes);
29076
- this.wrap_cbTypes.zpp_inner.adder = $bind(this, this.wrap_cbTypes_adder);
29077
- this.wrap_cbTypes.zpp_inner.subber = $bind(this, this.wrap_cbTypes_subber);
29078
- this.wrap_cbTypes.zpp_inner.dontremove = true;
29079
- this.wrap_cbTypes.zpp_inner._modifiable = $bind(
29080
- this,
29081
- this.immutable_cbTypes
29082
- );
29083
- };
29084
- zpp_nape.constraint.ZPP_Constraint.prototype.immutable_cbTypes = function() {
29085
- this.immutable_midstep("Constraint::cbTypes");
29086
- };
29087
- zpp_nape.constraint.ZPP_Constraint.prototype.wrap_cbTypes_subber = function(pcb) {
29088
- var cb = pcb.zpp_inner;
29089
- if (this.cbTypes.has(cb)) {
29090
- if (this.space != null) {
29091
- this.dealloc_cbSet();
29092
- cb.constraints.remove(this);
29093
- }
29094
- this.cbTypes.remove(cb);
29095
- if (this.space != null) {
29096
- this.alloc_cbSet();
29097
- this.wake();
29098
- }
29099
- }
29100
- };
29101
- zpp_nape.constraint.ZPP_Constraint.prototype.wrap_cbTypes_adder = function(cb) {
29102
- this.insert_cbtype(cb.zpp_inner);
29103
- return false;
29104
- };
29105
- zpp_nape.constraint.ZPP_Constraint.prototype.insert_cbtype = function(cb) {
29106
- if (!this.cbTypes.has(cb)) {
29107
- if (this.space != null) {
29108
- this.dealloc_cbSet();
29109
- cb.constraints.add(this);
29110
- }
29111
- var pre = null;
29112
- var cx_ite = this.cbTypes.head;
29113
- while (cx_ite != null) {
29114
- var j = cx_ite.elt;
29115
- if (cb.id < j.id) {
29116
- break;
29117
- }
29118
- pre = cx_ite;
29119
- cx_ite = cx_ite.next;
29120
- }
29121
- var _this = this.cbTypes;
29122
- var ret;
29123
- if (zpp_nape.util.ZNPNode_ZPP_CbType.zpp_pool == null) {
29124
- ret = new zpp_nape.util.ZNPNode_ZPP_CbType();
29125
- } else {
29126
- ret = zpp_nape.util.ZNPNode_ZPP_CbType.zpp_pool;
29127
- zpp_nape.util.ZNPNode_ZPP_CbType.zpp_pool = ret.next;
29128
- ret.next = null;
29129
- }
29130
- ret.elt = cb;
29131
- var temp = ret;
29132
- if (pre == null) {
29133
- temp.next = _this.head;
29134
- _this.head = temp;
29135
- } else {
29136
- temp.next = pre.next;
29137
- pre.next = temp;
29138
- }
29139
- _this.pushmod = _this.modified = true;
29140
- _this.length++;
29141
- if (this.space != null) {
29142
- this.alloc_cbSet();
29143
- this.wake();
29144
- }
29145
- }
29146
- };
29147
- zpp_nape.constraint.ZPP_Constraint.prototype.alloc_cbSet = function() {
29148
- if ((this.cbSet = this.space.cbsets.get(this.cbTypes)) != null) {
29149
- this.cbSet.count++;
29150
- this.cbSet.constraints.add(this);
29151
- }
29152
- };
29153
- zpp_nape.constraint.ZPP_Constraint.prototype.dealloc_cbSet = function() {
29154
- if (this.cbSet != null) {
29155
- this.cbSet.constraints.remove(this);
29156
- if (--this.cbSet.count == 0) {
29157
- this.space.cbsets.remove(this.cbSet);
29158
- var o = this.cbSet;
29159
- o.listeners.clear();
29160
- o.zip_listeners = true;
29161
- o.bodylisteners.clear();
29162
- o.zip_bodylisteners = true;
29163
- o.conlisteners.clear();
29164
- o.zip_conlisteners = true;
29165
- while (o.cbTypes.head != null) {
29166
- var cb = o.cbTypes.pop_unsafe();
29167
- cb.cbsets.remove(o);
29168
- }
29169
- o.next = zpp_nape.callbacks.ZPP_CbSet.zpp_pool;
29170
- zpp_nape.callbacks.ZPP_CbSet.zpp_pool = o;
29171
- }
29172
- this.cbSet = null;
29173
- }
29174
- };
29175
- zpp_nape.constraint.ZPP_Constraint.prototype.activate = function() {
29176
- if (this.space != null) {
29177
- this.activeInSpace();
29178
- }
29179
- };
29180
- zpp_nape.constraint.ZPP_Constraint.prototype.deactivate = function() {
29181
- if (this.space != null) {
29182
- this.inactiveOrOutSpace();
29183
- }
29184
- };
29185
- zpp_nape.constraint.ZPP_Constraint.prototype.addedToSpace = function() {
29186
- if (this.active) {
29187
- this.activeInSpace();
29188
- }
29189
- this.activeBodies();
29190
- var cx_ite = this.cbTypes.head;
29191
- while (cx_ite != null) {
29192
- var cb = cx_ite.elt;
29193
- cb.constraints.add(this);
29194
- cx_ite = cx_ite.next;
29195
- }
29196
- };
29197
- zpp_nape.constraint.ZPP_Constraint.prototype.removedFromSpace = function() {
29198
- if (this.active) {
29199
- this.inactiveOrOutSpace();
29200
- }
29201
- this.inactiveBodies();
29202
- var cx_ite = this.cbTypes.head;
29203
- while (cx_ite != null) {
29204
- var cb = cx_ite.elt;
29205
- cb.constraints.remove(this);
29206
- cx_ite = cx_ite.next;
29207
- }
29208
- };
29209
- zpp_nape.constraint.ZPP_Constraint.prototype.activeInSpace = function() {
29210
- this.alloc_cbSet();
29211
- if (zpp_nape.space.ZPP_Component.zpp_pool == null) {
29212
- this.component = new zpp_nape.space.ZPP_Component();
29213
- } else {
29214
- this.component = zpp_nape.space.ZPP_Component.zpp_pool;
29215
- zpp_nape.space.ZPP_Component.zpp_pool = this.component.next;
29216
- this.component.next = null;
29217
- }
29218
- this.component.isBody = false;
29219
- this.component.constraint = this;
29220
- };
29221
- zpp_nape.constraint.ZPP_Constraint.prototype.inactiveOrOutSpace = function() {
29222
- this.dealloc_cbSet();
29223
- var o = this.component;
29224
- o.body = null;
29225
- o.constraint = null;
29226
- o.next = zpp_nape.space.ZPP_Component.zpp_pool;
29227
- zpp_nape.space.ZPP_Component.zpp_pool = o;
29228
- this.component = null;
29229
- };
29230
- zpp_nape.constraint.ZPP_Constraint.prototype.activeBodies = function() {
29231
- };
29232
- zpp_nape.constraint.ZPP_Constraint.prototype.inactiveBodies = function() {
29233
- };
29234
- zpp_nape.constraint.ZPP_Constraint.prototype.clearcache = function() {
29235
- };
29236
- zpp_nape.constraint.ZPP_Constraint.prototype.validate = function() {
29237
- };
29238
- zpp_nape.constraint.ZPP_Constraint.prototype.wake_connected = function() {
29239
- };
29240
- zpp_nape.constraint.ZPP_Constraint.prototype.forest = function() {
29241
- };
29242
- zpp_nape.constraint.ZPP_Constraint.prototype.pair_exists = function(id, di) {
29243
- return false;
29244
- };
29245
- zpp_nape.constraint.ZPP_Constraint.prototype.broken = function() {
29246
- };
29247
- zpp_nape.constraint.ZPP_Constraint.prototype.warmStart = function() {
29248
- };
29249
- zpp_nape.constraint.ZPP_Constraint.prototype.pre_dt = null;
29250
- zpp_nape.constraint.ZPP_Constraint.prototype.preStep = function(dt) {
29251
- return false;
29252
- };
29253
- zpp_nape.constraint.ZPP_Constraint.prototype.applyImpulseVel = function() {
29254
- return false;
29441
+ ZPP_Constraint.prototype._initBase.call(this);
29255
29442
  };
29256
- zpp_nape.constraint.ZPP_Constraint.prototype.applyImpulsePos = function() {
29257
- return false;
29258
- };
29259
- zpp_nape.constraint.ZPP_Constraint.prototype.wake = function() {
29260
- if (this.space != null) {
29261
- this.space.wake_constraint(this);
29262
- }
29263
- };
29264
- zpp_nape.constraint.ZPP_Constraint.prototype.draw = function(g) {
29265
- };
29266
- zpp_nape.constraint.ZPP_Constraint.prototype.copy = function(dict, todo) {
29267
- return null;
29268
- };
29269
- zpp_nape.constraint.ZPP_Constraint.prototype.copyto = function(ret) {
29270
- var me = this.outer;
29271
- if (me.zpp_inner.wrap_cbTypes == null) {
29272
- me.zpp_inner.setupcbTypes();
29273
- }
29274
- var _this = me.zpp_inner.wrap_cbTypes;
29275
- _this.zpp_inner.valmod();
29276
- var _g = nape46.callbacks.CbTypeIterator.get(_this);
29277
- while (true) {
29278
- _g.zpp_inner.zpp_inner.valmod();
29279
- var _this1 = _g.zpp_inner;
29280
- _this1.zpp_inner.valmod();
29281
- if (_this1.zpp_inner.zip_length) {
29282
- _this1.zpp_inner.zip_length = false;
29283
- _this1.zpp_inner.user_length = _this1.zpp_inner.inner.length;
29284
- }
29285
- var length = _this1.zpp_inner.user_length;
29286
- _g.zpp_critical = true;
29287
- var tmp;
29288
- if (_g.zpp_i < length) {
29289
- tmp = true;
29290
- } else {
29291
- _g.zpp_next = nape46.callbacks.CbTypeIterator.zpp_pool;
29292
- nape46.callbacks.CbTypeIterator.zpp_pool = _g;
29293
- _g.zpp_inner = null;
29294
- tmp = false;
29295
- }
29296
- if (!tmp) {
29297
- break;
29298
- }
29299
- _g.zpp_critical = false;
29300
- var cb = _g.zpp_inner.at(_g.zpp_i++);
29301
- if (ret.zpp_inner.wrap_cbTypes == null) {
29302
- ret.zpp_inner.setupcbTypes();
29303
- }
29304
- var _this2 = ret.zpp_inner.wrap_cbTypes;
29305
- if (_this2.zpp_inner.reverse_flag) {
29306
- _this2.push(cb);
29307
- } else {
29308
- _this2.unshift(cb);
29309
- }
29310
- }
29311
- ret.zpp_inner.removeOnBreak = me.zpp_inner.removeOnBreak;
29312
- var breakUnderError = me.zpp_inner.breakUnderError;
29313
- if (ret.zpp_inner.breakUnderError != breakUnderError) {
29314
- ret.zpp_inner.breakUnderError = breakUnderError;
29315
- ret.zpp_inner.wake();
29316
- }
29317
- var breakUnderForce = me.zpp_inner.breakUnderForce;
29318
- if (ret.zpp_inner.breakUnderForce != breakUnderForce) {
29319
- ret.zpp_inner.breakUnderForce = breakUnderForce;
29320
- ret.zpp_inner.wake();
29321
- }
29322
- var maxError = me.zpp_inner.maxError;
29323
- if (maxError != maxError) {
29324
- throw new js._Boot.HaxeError("Error: Constraint::maxError cannot be NaN");
29325
- }
29326
- if (maxError < 0) {
29327
- throw new js._Boot.HaxeError("Error: Constraint::maxError must be >=0");
29328
- }
29329
- if (ret.zpp_inner.maxError != maxError) {
29330
- ret.zpp_inner.maxError = maxError;
29331
- ret.zpp_inner.wake();
29332
- }
29333
- var maxForce = me.zpp_inner.maxForce;
29334
- if (maxForce != maxForce) {
29335
- throw new js._Boot.HaxeError("Error: Constraint::maxForce cannot be NaN");
29336
- }
29337
- if (maxForce < 0) {
29338
- throw new js._Boot.HaxeError("Error: Constraint::maxForce must be >=0");
29339
- }
29340
- if (ret.zpp_inner.maxForce != maxForce) {
29341
- ret.zpp_inner.maxForce = maxForce;
29342
- ret.zpp_inner.wake();
29443
+ Object.getOwnPropertyNames(ZPP_Constraint.prototype).forEach(function(k2) {
29444
+ if (k2 !== "constructor") {
29445
+ zpp_nape.constraint.ZPP_Constraint.prototype[k2] = ZPP_Constraint.prototype[k2];
29343
29446
  }
29344
- var damping = me.zpp_inner.damping;
29345
- if (damping != damping) {
29346
- throw new js._Boot.HaxeError("Error: Constraint::Damping cannot be Nan");
29347
- }
29348
- if (damping < 0) {
29349
- throw new js._Boot.HaxeError("Error: Constraint::Damping must be >=0");
29350
- }
29351
- if (ret.zpp_inner.damping != damping) {
29352
- ret.zpp_inner.damping = damping;
29353
- if (!ret.zpp_inner.stiff) {
29354
- ret.zpp_inner.wake();
29355
- }
29356
- }
29357
- var frequency = me.zpp_inner.frequency;
29358
- if (frequency != frequency) {
29359
- throw new js._Boot.HaxeError(
29360
- "Error: Constraint::Frequency cannot be NaN"
29361
- );
29362
- }
29363
- if (frequency <= 0) {
29364
- throw new js._Boot.HaxeError("Error: Constraint::Frequency must be >0");
29365
- }
29366
- if (ret.zpp_inner.frequency != frequency) {
29367
- ret.zpp_inner.frequency = frequency;
29368
- if (!ret.zpp_inner.stiff) {
29369
- ret.zpp_inner.wake();
29370
- }
29371
- }
29372
- var stiff = me.zpp_inner.stiff;
29373
- if (ret.zpp_inner.stiff != stiff) {
29374
- ret.zpp_inner.stiff = stiff;
29375
- ret.zpp_inner.wake();
29376
- }
29377
- var ignore = me.zpp_inner.ignore;
29378
- if (ret.zpp_inner.ignore != ignore) {
29379
- ret.zpp_inner.ignore = ignore;
29380
- ret.zpp_inner.wake();
29381
- }
29382
- var active = me.zpp_inner.active;
29383
- if (ret.zpp_inner.active != active) {
29384
- if (ret.zpp_inner.component != null) {
29385
- ret.zpp_inner.component.woken = false;
29386
- }
29387
- ret.zpp_inner.clearcache();
29388
- if (active) {
29389
- ret.zpp_inner.active = active;
29390
- ret.zpp_inner.activate();
29391
- if (ret.zpp_inner.space != null) {
29392
- if (ret.zpp_inner.component != null) {
29393
- ret.zpp_inner.component.sleeping = true;
29394
- }
29395
- ret.zpp_inner.space.wake_constraint(ret.zpp_inner, true);
29396
- }
29397
- } else {
29398
- if (ret.zpp_inner.space != null) {
29399
- ret.zpp_inner.wake();
29400
- ret.zpp_inner.space.live_constraints.remove(ret.zpp_inner);
29401
- }
29402
- ret.zpp_inner.active = active;
29403
- ret.zpp_inner.deactivate();
29404
- }
29405
- }
29406
- };
29447
+ });
29448
+ zpp_nape.constraint.ZPP_Constraint.__name__ = ZPP_Constraint.__name__;
29407
29449
  zpp_nape.constraint.ZPP_Constraint.prototype.__class__ = zpp_nape.constraint.ZPP_Constraint;
29408
29450
  zpp_nape.constraint.ZPP_AngleJoint = $hxClasses["zpp_nape.constraint.ZPP_AngleJoint"] = function() {
29409
29451
  this.stepped = false;
@@ -29865,31 +29907,7 @@ define(function() {
29865
29907
  zpp_nape.constraint.ZPP_AngleJoint.prototype.draw = function(g) {
29866
29908
  };
29867
29909
  zpp_nape.constraint.ZPP_AngleJoint.prototype.__class__ = zpp_nape.constraint.ZPP_AngleJoint;
29868
- zpp_nape.constraint.ZPP_CopyHelper = $hxClasses["zpp_nape.constraint.ZPP_CopyHelper"] = function() {
29869
- this.cb = null;
29870
- this.bc = null;
29871
- this.id = 0;
29872
- };
29873
- zpp_nape.constraint.ZPP_CopyHelper.__name__ = [
29874
- "zpp_nape",
29875
- "constraint",
29876
- "ZPP_CopyHelper"
29877
- ];
29878
- zpp_nape.constraint.ZPP_CopyHelper.dict = function(id, bc) {
29879
- var ret = new zpp_nape.constraint.ZPP_CopyHelper();
29880
- ret.id = id;
29881
- ret.bc = bc;
29882
- return ret;
29883
- };
29884
- zpp_nape.constraint.ZPP_CopyHelper.todo = function(id, cb) {
29885
- var ret = new zpp_nape.constraint.ZPP_CopyHelper();
29886
- ret.id = id;
29887
- ret.cb = cb;
29888
- return ret;
29889
- };
29890
- zpp_nape.constraint.ZPP_CopyHelper.prototype.id = null;
29891
- zpp_nape.constraint.ZPP_CopyHelper.prototype.bc = null;
29892
- zpp_nape.constraint.ZPP_CopyHelper.prototype.cb = null;
29910
+ zpp_nape.constraint.ZPP_CopyHelper = $hxClasses["zpp_nape.constraint.ZPP_CopyHelper"] = ZPP_CopyHelper;
29893
29911
  zpp_nape.constraint.ZPP_CopyHelper.prototype.__class__ = zpp_nape.constraint.ZPP_CopyHelper;
29894
29912
  zpp_nape.constraint.ZPP_DistanceJoint = $hxClasses["zpp_nape.constraint.ZPP_DistanceJoint"] = function() {
29895
29913
  this.stepped = false;
@@ -90331,7 +90349,7 @@ var PulleyJoint = class _PulleyJoint extends Constraint {
90331
90349
  };
90332
90350
 
90333
90351
  // src/index.ts
90334
- var VERSION = "3.3.20";
90352
+ var VERSION = "3.3.22";
90335
90353
  // Annotate the CommonJS export names for ESM import in node:
90336
90354
  0 && (module.exports = {
90337
90355
  AABB,