@newkrok/nape-js 3.3.21 → 3.3.22

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.js CHANGED
@@ -8137,6 +8137,440 @@ _ZPP_ColArbiter.CIRCLE = 2;
8137
8137
  _ZPP_ColArbiter.zpp_pool = null;
8138
8138
  var ZPP_ColArbiter = _ZPP_ColArbiter;
8139
8139
 
8140
+ // src/native/constraint/ZPP_Constraint.ts
8141
+ var _ZPP_Constraint = class _ZPP_Constraint {
8142
+ constructor() {
8143
+ // --- Instance fields ---
8144
+ this.outer = null;
8145
+ this.id = 0;
8146
+ this.userData = null;
8147
+ this.compound = null;
8148
+ this.space = null;
8149
+ this.active = false;
8150
+ this.stiff = false;
8151
+ this.frequency = 0;
8152
+ this.damping = 0;
8153
+ this.maxForce = 0;
8154
+ this.maxError = 0;
8155
+ this.breakUnderForce = false;
8156
+ this.breakUnderError = false;
8157
+ this.removeOnBreak = false;
8158
+ this.component = null;
8159
+ this.ignore = false;
8160
+ this.__velocity = false;
8161
+ this.cbTypes = null;
8162
+ this.cbSet = null;
8163
+ this.wrap_cbTypes = null;
8164
+ this.pre_dt = -1;
8165
+ this.__class__ = _ZPP_Constraint;
8166
+ this._initBase();
8167
+ }
8168
+ /**
8169
+ * Initialise base constraint fields.
8170
+ * Extracted into a separate method because compiled joint subclasses
8171
+ * call `ZPP_Constraint.call(this)` — ES classes can't be invoked that
8172
+ * way, so the compiled wrapper delegates to this method instead.
8173
+ */
8174
+ _initBase() {
8175
+ const zpp = _ZPP_Constraint._zpp;
8176
+ this.id = ZPP_ID.Constraint();
8177
+ this.stiff = true;
8178
+ this.active = true;
8179
+ this.ignore = false;
8180
+ this.frequency = 10;
8181
+ this.damping = 1;
8182
+ this.maxForce = Infinity;
8183
+ this.maxError = Infinity;
8184
+ this.breakUnderForce = false;
8185
+ this.removeOnBreak = true;
8186
+ this.pre_dt = -1;
8187
+ this.cbTypes = new zpp.util.ZNPList_ZPP_CbType();
8188
+ }
8189
+ // --- Stub methods (overridden by subclasses) ---
8190
+ clear() {
8191
+ }
8192
+ activeBodies() {
8193
+ }
8194
+ inactiveBodies() {
8195
+ }
8196
+ clearcache() {
8197
+ }
8198
+ validate() {
8199
+ }
8200
+ wake_connected() {
8201
+ }
8202
+ forest() {
8203
+ }
8204
+ broken() {
8205
+ }
8206
+ warmStart() {
8207
+ }
8208
+ draw(_g) {
8209
+ }
8210
+ pair_exists(_id, _di) {
8211
+ return false;
8212
+ }
8213
+ preStep(_dt) {
8214
+ return false;
8215
+ }
8216
+ applyImpulseVel() {
8217
+ return false;
8218
+ }
8219
+ applyImpulsePos() {
8220
+ return false;
8221
+ }
8222
+ copy(_dict, _todo) {
8223
+ return null;
8224
+ }
8225
+ // --- Mid-step guard ---
8226
+ immutable_midstep(name) {
8227
+ if (this.space != null && this.space.midstep) {
8228
+ throw new Error(
8229
+ "Error: Constraint::" + name + " cannot be set during space step()"
8230
+ );
8231
+ }
8232
+ }
8233
+ // --- Callback types management ---
8234
+ setupcbTypes() {
8235
+ const zpp = _ZPP_Constraint._zpp;
8236
+ this.wrap_cbTypes = zpp.util.ZPP_CbTypeList.get(this.cbTypes);
8237
+ this.wrap_cbTypes.zpp_inner.adder = this.wrap_cbTypes_adder.bind(this);
8238
+ this.wrap_cbTypes.zpp_inner.subber = this.wrap_cbTypes_subber.bind(this);
8239
+ this.wrap_cbTypes.zpp_inner.dontremove = true;
8240
+ this.wrap_cbTypes.zpp_inner._modifiable = this.immutable_cbTypes.bind(this);
8241
+ }
8242
+ immutable_cbTypes() {
8243
+ this.immutable_midstep("Constraint::cbTypes");
8244
+ }
8245
+ wrap_cbTypes_subber(pcb) {
8246
+ const cb = pcb.zpp_inner;
8247
+ if (this.cbTypes.has(cb)) {
8248
+ if (this.space != null) {
8249
+ this.dealloc_cbSet();
8250
+ cb.constraints.remove(this);
8251
+ }
8252
+ this.cbTypes.remove(cb);
8253
+ if (this.space != null) {
8254
+ this.alloc_cbSet();
8255
+ this.wake();
8256
+ }
8257
+ }
8258
+ }
8259
+ wrap_cbTypes_adder(cb) {
8260
+ this.insert_cbtype(cb.zpp_inner);
8261
+ return false;
8262
+ }
8263
+ insert_cbtype(cb) {
8264
+ const zpp = _ZPP_Constraint._zpp;
8265
+ if (!this.cbTypes.has(cb)) {
8266
+ if (this.space != null) {
8267
+ this.dealloc_cbSet();
8268
+ cb.constraints.add(this);
8269
+ }
8270
+ let pre = null;
8271
+ let cx_ite = this.cbTypes.head;
8272
+ while (cx_ite != null) {
8273
+ const j = cx_ite.elt;
8274
+ if (cb.id < j.id) {
8275
+ break;
8276
+ }
8277
+ pre = cx_ite;
8278
+ cx_ite = cx_ite.next;
8279
+ }
8280
+ const _this = this.cbTypes;
8281
+ let ret;
8282
+ if (zpp.util.ZNPNode_ZPP_CbType.zpp_pool == null) {
8283
+ ret = new zpp.util.ZNPNode_ZPP_CbType();
8284
+ } else {
8285
+ ret = zpp.util.ZNPNode_ZPP_CbType.zpp_pool;
8286
+ zpp.util.ZNPNode_ZPP_CbType.zpp_pool = ret.next;
8287
+ ret.next = null;
8288
+ }
8289
+ ret.elt = cb;
8290
+ const temp = ret;
8291
+ if (pre == null) {
8292
+ temp.next = _this.head;
8293
+ _this.head = temp;
8294
+ } else {
8295
+ temp.next = pre.next;
8296
+ pre.next = temp;
8297
+ }
8298
+ _this.pushmod = _this.modified = true;
8299
+ _this.length++;
8300
+ if (this.space != null) {
8301
+ this.alloc_cbSet();
8302
+ this.wake();
8303
+ }
8304
+ }
8305
+ }
8306
+ // --- CbSet management ---
8307
+ alloc_cbSet() {
8308
+ if ((this.cbSet = this.space.cbsets.get(this.cbTypes)) != null) {
8309
+ this.cbSet.count++;
8310
+ this.cbSet.constraints.add(this);
8311
+ }
8312
+ }
8313
+ dealloc_cbSet() {
8314
+ const zpp = _ZPP_Constraint._zpp;
8315
+ if (this.cbSet != null) {
8316
+ this.cbSet.constraints.remove(this);
8317
+ if (--this.cbSet.count == 0) {
8318
+ this.space.cbsets.remove(this.cbSet);
8319
+ const o = this.cbSet;
8320
+ o.listeners.clear();
8321
+ o.zip_listeners = true;
8322
+ o.bodylisteners.clear();
8323
+ o.zip_bodylisteners = true;
8324
+ o.conlisteners.clear();
8325
+ o.zip_conlisteners = true;
8326
+ while (o.cbTypes.head != null) {
8327
+ const cb = o.cbTypes.pop_unsafe();
8328
+ cb.cbsets.remove(o);
8329
+ }
8330
+ o.next = zpp.callbacks.ZPP_CbSet.zpp_pool;
8331
+ zpp.callbacks.ZPP_CbSet.zpp_pool = o;
8332
+ }
8333
+ this.cbSet = null;
8334
+ }
8335
+ }
8336
+ // --- Activation / space integration ---
8337
+ activate() {
8338
+ if (this.space != null) {
8339
+ this.activeInSpace();
8340
+ }
8341
+ }
8342
+ deactivate() {
8343
+ if (this.space != null) {
8344
+ this.inactiveOrOutSpace();
8345
+ }
8346
+ }
8347
+ addedToSpace() {
8348
+ if (this.active) {
8349
+ this.activeInSpace();
8350
+ }
8351
+ this.activeBodies();
8352
+ let cx_ite = this.cbTypes.head;
8353
+ while (cx_ite != null) {
8354
+ const cb = cx_ite.elt;
8355
+ cb.constraints.add(this);
8356
+ cx_ite = cx_ite.next;
8357
+ }
8358
+ }
8359
+ removedFromSpace() {
8360
+ if (this.active) {
8361
+ this.inactiveOrOutSpace();
8362
+ }
8363
+ this.inactiveBodies();
8364
+ let cx_ite = this.cbTypes.head;
8365
+ while (cx_ite != null) {
8366
+ const cb = cx_ite.elt;
8367
+ cb.constraints.remove(this);
8368
+ cx_ite = cx_ite.next;
8369
+ }
8370
+ }
8371
+ activeInSpace() {
8372
+ const zpp = _ZPP_Constraint._zpp;
8373
+ this.alloc_cbSet();
8374
+ if (zpp.space.ZPP_Component.zpp_pool == null) {
8375
+ this.component = new zpp.space.ZPP_Component();
8376
+ } else {
8377
+ this.component = zpp.space.ZPP_Component.zpp_pool;
8378
+ zpp.space.ZPP_Component.zpp_pool = this.component.next;
8379
+ this.component.next = null;
8380
+ }
8381
+ this.component.isBody = false;
8382
+ this.component.constraint = this;
8383
+ }
8384
+ inactiveOrOutSpace() {
8385
+ const zpp = _ZPP_Constraint._zpp;
8386
+ this.dealloc_cbSet();
8387
+ const o = this.component;
8388
+ o.body = null;
8389
+ o.constraint = null;
8390
+ o.next = zpp.space.ZPP_Component.zpp_pool;
8391
+ zpp.space.ZPP_Component.zpp_pool = o;
8392
+ this.component = null;
8393
+ }
8394
+ // --- Wake ---
8395
+ wake() {
8396
+ if (this.space != null) {
8397
+ this.space.wake_constraint(this);
8398
+ }
8399
+ }
8400
+ // --- Copy support ---
8401
+ copyto(ret) {
8402
+ const nape46 = _ZPP_Constraint._nape;
8403
+ const me = this.outer;
8404
+ if (me.zpp_inner.wrap_cbTypes == null) {
8405
+ me.zpp_inner.setupcbTypes();
8406
+ }
8407
+ const cbList = me.zpp_inner.wrap_cbTypes;
8408
+ cbList.zpp_inner.valmod();
8409
+ const _g = nape46.callbacks.CbTypeIterator.get(cbList);
8410
+ while (true) {
8411
+ _g.zpp_inner.zpp_inner.valmod();
8412
+ const _this1 = _g.zpp_inner;
8413
+ _this1.zpp_inner.valmod();
8414
+ if (_this1.zpp_inner.zip_length) {
8415
+ _this1.zpp_inner.zip_length = false;
8416
+ _this1.zpp_inner.user_length = _this1.zpp_inner.inner.length;
8417
+ }
8418
+ const length = _this1.zpp_inner.user_length;
8419
+ _g.zpp_critical = true;
8420
+ let tmp;
8421
+ if (_g.zpp_i < length) {
8422
+ tmp = true;
8423
+ } else {
8424
+ _g.zpp_next = nape46.callbacks.CbTypeIterator.zpp_pool;
8425
+ nape46.callbacks.CbTypeIterator.zpp_pool = _g;
8426
+ _g.zpp_inner = null;
8427
+ tmp = false;
8428
+ }
8429
+ if (!tmp) {
8430
+ break;
8431
+ }
8432
+ _g.zpp_critical = false;
8433
+ const cb = _g.zpp_inner.at(_g.zpp_i++);
8434
+ if (ret.zpp_inner.wrap_cbTypes == null) {
8435
+ ret.zpp_inner.setupcbTypes();
8436
+ }
8437
+ const _this2 = ret.zpp_inner.wrap_cbTypes;
8438
+ if (_this2.zpp_inner.reverse_flag) {
8439
+ _this2.push(cb);
8440
+ } else {
8441
+ _this2.unshift(cb);
8442
+ }
8443
+ }
8444
+ ret.zpp_inner.removeOnBreak = me.zpp_inner.removeOnBreak;
8445
+ const breakUnderError = me.zpp_inner.breakUnderError;
8446
+ if (ret.zpp_inner.breakUnderError != breakUnderError) {
8447
+ ret.zpp_inner.breakUnderError = breakUnderError;
8448
+ ret.zpp_inner.wake();
8449
+ }
8450
+ const breakUnderForce = me.zpp_inner.breakUnderForce;
8451
+ if (ret.zpp_inner.breakUnderForce != breakUnderForce) {
8452
+ ret.zpp_inner.breakUnderForce = breakUnderForce;
8453
+ ret.zpp_inner.wake();
8454
+ }
8455
+ const maxError = me.zpp_inner.maxError;
8456
+ if (maxError !== maxError) {
8457
+ throw new Error("Error: Constraint::maxError cannot be NaN");
8458
+ }
8459
+ if (maxError < 0) {
8460
+ throw new Error("Error: Constraint::maxError must be >=0");
8461
+ }
8462
+ if (ret.zpp_inner.maxError != maxError) {
8463
+ ret.zpp_inner.maxError = maxError;
8464
+ ret.zpp_inner.wake();
8465
+ }
8466
+ const maxForce = me.zpp_inner.maxForce;
8467
+ if (maxForce !== maxForce) {
8468
+ throw new Error("Error: Constraint::maxForce cannot be NaN");
8469
+ }
8470
+ if (maxForce < 0) {
8471
+ throw new Error("Error: Constraint::maxForce must be >=0");
8472
+ }
8473
+ if (ret.zpp_inner.maxForce != maxForce) {
8474
+ ret.zpp_inner.maxForce = maxForce;
8475
+ ret.zpp_inner.wake();
8476
+ }
8477
+ const damping = me.zpp_inner.damping;
8478
+ if (damping !== damping) {
8479
+ throw new Error("Error: Constraint::Damping cannot be Nan");
8480
+ }
8481
+ if (damping < 0) {
8482
+ throw new Error("Error: Constraint::Damping must be >=0");
8483
+ }
8484
+ if (ret.zpp_inner.damping != damping) {
8485
+ ret.zpp_inner.damping = damping;
8486
+ if (!ret.zpp_inner.stiff) {
8487
+ ret.zpp_inner.wake();
8488
+ }
8489
+ }
8490
+ const frequency = me.zpp_inner.frequency;
8491
+ if (frequency !== frequency) {
8492
+ throw new Error("Error: Constraint::Frequency cannot be NaN");
8493
+ }
8494
+ if (frequency <= 0) {
8495
+ throw new Error("Error: Constraint::Frequency must be >0");
8496
+ }
8497
+ if (ret.zpp_inner.frequency != frequency) {
8498
+ ret.zpp_inner.frequency = frequency;
8499
+ if (!ret.zpp_inner.stiff) {
8500
+ ret.zpp_inner.wake();
8501
+ }
8502
+ }
8503
+ const stiff = me.zpp_inner.stiff;
8504
+ if (ret.zpp_inner.stiff != stiff) {
8505
+ ret.zpp_inner.stiff = stiff;
8506
+ ret.zpp_inner.wake();
8507
+ }
8508
+ const ignore = me.zpp_inner.ignore;
8509
+ if (ret.zpp_inner.ignore != ignore) {
8510
+ ret.zpp_inner.ignore = ignore;
8511
+ ret.zpp_inner.wake();
8512
+ }
8513
+ const active = me.zpp_inner.active;
8514
+ if (ret.zpp_inner.active != active) {
8515
+ if (ret.zpp_inner.component != null) {
8516
+ ret.zpp_inner.component.woken = false;
8517
+ }
8518
+ ret.zpp_inner.clearcache();
8519
+ if (active) {
8520
+ ret.zpp_inner.active = active;
8521
+ ret.zpp_inner.activate();
8522
+ if (ret.zpp_inner.space != null) {
8523
+ if (ret.zpp_inner.component != null) {
8524
+ ret.zpp_inner.component.sleeping = true;
8525
+ }
8526
+ ret.zpp_inner.space.wake_constraint(ret.zpp_inner, true);
8527
+ }
8528
+ } else {
8529
+ if (ret.zpp_inner.space != null) {
8530
+ ret.zpp_inner.wake();
8531
+ ret.zpp_inner.space.live_constraints.remove(ret.zpp_inner);
8532
+ }
8533
+ ret.zpp_inner.active = active;
8534
+ ret.zpp_inner.deactivate();
8535
+ }
8536
+ }
8537
+ }
8538
+ };
8539
+ // --- Static: Haxe metadata ---
8540
+ _ZPP_Constraint.__name__ = ["zpp_nape", "constraint", "ZPP_Constraint"];
8541
+ /**
8542
+ * Namespace references, set by the compiled module after import.
8543
+ * _nape = the `nape` public namespace (for CbTypeIterator in copyto)
8544
+ * _zpp = the `zpp_nape` internal namespace (for ZNPList_*, ZPP_CbSet, etc.)
8545
+ */
8546
+ _ZPP_Constraint._nape = null;
8547
+ _ZPP_Constraint._zpp = null;
8548
+ var ZPP_Constraint = _ZPP_Constraint;
8549
+
8550
+ // src/native/constraint/ZPP_CopyHelper.ts
8551
+ var _ZPP_CopyHelper = class _ZPP_CopyHelper {
8552
+ constructor() {
8553
+ this.id = 0;
8554
+ this.bc = null;
8555
+ this.cb = null;
8556
+ this.__class__ = _ZPP_CopyHelper;
8557
+ }
8558
+ static dict(id, bc) {
8559
+ const ret = new _ZPP_CopyHelper();
8560
+ ret.id = id;
8561
+ ret.bc = bc;
8562
+ return ret;
8563
+ }
8564
+ static todo(id, cb) {
8565
+ const ret = new _ZPP_CopyHelper();
8566
+ ret.id = id;
8567
+ ret.cb = cb;
8568
+ return ret;
8569
+ }
8570
+ };
8571
+ _ZPP_CopyHelper.__name__ = ["zpp_nape", "constraint", "ZPP_CopyHelper"];
8572
+ var ZPP_CopyHelper = _ZPP_CopyHelper;
8573
+
8140
8574
  // src/core/nape-compiled.js
8141
8575
  var _nape;
8142
8576
  var define = function(factory) {
@@ -28914,409 +29348,17 @@ define(function() {
28914
29348
  zpp_nape.callbacks.ZPP_OptionType = $hxClasses["zpp_nape.callbacks.ZPP_OptionType"] = ZPP_OptionType;
28915
29349
  zpp_nape.callbacks.ZPP_OptionType.prototype.__class__ = zpp_nape.callbacks.ZPP_OptionType;
28916
29350
  if (!zpp_nape.constraint) zpp_nape.constraint = {};
29351
+ ZPP_Constraint._nape = nape46;
29352
+ ZPP_Constraint._zpp = zpp_nape;
28917
29353
  zpp_nape.constraint.ZPP_Constraint = $hxClasses["zpp_nape.constraint.ZPP_Constraint"] = function() {
28918
- this.pre_dt = 0;
28919
- this.wrap_cbTypes = null;
28920
- this.cbSet = null;
28921
- this.cbTypes = null;
28922
- this.__velocity = false;
28923
- this.ignore = false;
28924
- this.component = null;
28925
- this.removeOnBreak = false;
28926
- this.breakUnderError = false;
28927
- this.breakUnderForce = false;
28928
- this.maxError = 0;
28929
- this.maxForce = 0;
28930
- this.damping = 0;
28931
- this.frequency = 0;
28932
- this.stiff = false;
28933
- this.active = false;
28934
- this.space = null;
28935
- this.compound = null;
28936
- this.userData = null;
28937
- this.id = 0;
28938
- this.outer = null;
28939
- this.__velocity = false;
28940
- this.id = zpp_nape.ZPP_ID.Constraint();
28941
- this.stiff = true;
28942
- this.active = true;
28943
- this.ignore = false;
28944
- this.frequency = 10;
28945
- this.damping = 1;
28946
- this.maxForce = Infinity;
28947
- this.maxError = Infinity;
28948
- this.breakUnderForce = false;
28949
- this.removeOnBreak = true;
28950
- this.pre_dt = -1;
28951
- this.cbTypes = new zpp_nape.util.ZNPList_ZPP_CbType();
28952
- };
28953
- zpp_nape.constraint.ZPP_Constraint.__name__ = [
28954
- "zpp_nape",
28955
- "constraint",
28956
- "ZPP_Constraint"
28957
- ];
28958
- zpp_nape.constraint.ZPP_Constraint.prototype.outer = null;
28959
- zpp_nape.constraint.ZPP_Constraint.prototype.clear = function() {
28960
- };
28961
- zpp_nape.constraint.ZPP_Constraint.prototype.id = null;
28962
- zpp_nape.constraint.ZPP_Constraint.prototype.userData = null;
28963
- zpp_nape.constraint.ZPP_Constraint.prototype.compound = null;
28964
- zpp_nape.constraint.ZPP_Constraint.prototype.space = null;
28965
- zpp_nape.constraint.ZPP_Constraint.prototype.active = null;
28966
- zpp_nape.constraint.ZPP_Constraint.prototype.stiff = null;
28967
- zpp_nape.constraint.ZPP_Constraint.prototype.frequency = null;
28968
- zpp_nape.constraint.ZPP_Constraint.prototype.damping = null;
28969
- zpp_nape.constraint.ZPP_Constraint.prototype.maxForce = null;
28970
- zpp_nape.constraint.ZPP_Constraint.prototype.maxError = null;
28971
- zpp_nape.constraint.ZPP_Constraint.prototype.breakUnderForce = null;
28972
- zpp_nape.constraint.ZPP_Constraint.prototype.breakUnderError = null;
28973
- zpp_nape.constraint.ZPP_Constraint.prototype.removeOnBreak = null;
28974
- zpp_nape.constraint.ZPP_Constraint.prototype.component = null;
28975
- zpp_nape.constraint.ZPP_Constraint.prototype.ignore = null;
28976
- zpp_nape.constraint.ZPP_Constraint.prototype.__velocity = null;
28977
- zpp_nape.constraint.ZPP_Constraint.prototype.immutable_midstep = function(name) {
28978
- if (this.space != null && this.space.midstep) {
28979
- throw new js._Boot.HaxeError(
28980
- "Error: Constraint::" + name + " cannot be set during space step()"
28981
- );
28982
- }
28983
- };
28984
- zpp_nape.constraint.ZPP_Constraint.prototype.cbTypes = null;
28985
- zpp_nape.constraint.ZPP_Constraint.prototype.cbSet = null;
28986
- zpp_nape.constraint.ZPP_Constraint.prototype.wrap_cbTypes = null;
28987
- zpp_nape.constraint.ZPP_Constraint.prototype.setupcbTypes = function() {
28988
- this.wrap_cbTypes = zpp_nape.util.ZPP_CbTypeList.get(this.cbTypes);
28989
- this.wrap_cbTypes.zpp_inner.adder = $bind(this, this.wrap_cbTypes_adder);
28990
- this.wrap_cbTypes.zpp_inner.subber = $bind(this, this.wrap_cbTypes_subber);
28991
- this.wrap_cbTypes.zpp_inner.dontremove = true;
28992
- this.wrap_cbTypes.zpp_inner._modifiable = $bind(
28993
- this,
28994
- this.immutable_cbTypes
28995
- );
28996
- };
28997
- zpp_nape.constraint.ZPP_Constraint.prototype.immutable_cbTypes = function() {
28998
- this.immutable_midstep("Constraint::cbTypes");
28999
- };
29000
- zpp_nape.constraint.ZPP_Constraint.prototype.wrap_cbTypes_subber = function(pcb) {
29001
- var cb = pcb.zpp_inner;
29002
- if (this.cbTypes.has(cb)) {
29003
- if (this.space != null) {
29004
- this.dealloc_cbSet();
29005
- cb.constraints.remove(this);
29006
- }
29007
- this.cbTypes.remove(cb);
29008
- if (this.space != null) {
29009
- this.alloc_cbSet();
29010
- this.wake();
29011
- }
29012
- }
29013
- };
29014
- zpp_nape.constraint.ZPP_Constraint.prototype.wrap_cbTypes_adder = function(cb) {
29015
- this.insert_cbtype(cb.zpp_inner);
29016
- return false;
29017
- };
29018
- zpp_nape.constraint.ZPP_Constraint.prototype.insert_cbtype = function(cb) {
29019
- if (!this.cbTypes.has(cb)) {
29020
- if (this.space != null) {
29021
- this.dealloc_cbSet();
29022
- cb.constraints.add(this);
29023
- }
29024
- var pre = null;
29025
- var cx_ite = this.cbTypes.head;
29026
- while (cx_ite != null) {
29027
- var j = cx_ite.elt;
29028
- if (cb.id < j.id) {
29029
- break;
29030
- }
29031
- pre = cx_ite;
29032
- cx_ite = cx_ite.next;
29033
- }
29034
- var _this = this.cbTypes;
29035
- var ret;
29036
- if (zpp_nape.util.ZNPNode_ZPP_CbType.zpp_pool == null) {
29037
- ret = new zpp_nape.util.ZNPNode_ZPP_CbType();
29038
- } else {
29039
- ret = zpp_nape.util.ZNPNode_ZPP_CbType.zpp_pool;
29040
- zpp_nape.util.ZNPNode_ZPP_CbType.zpp_pool = ret.next;
29041
- ret.next = null;
29042
- }
29043
- ret.elt = cb;
29044
- var temp = ret;
29045
- if (pre == null) {
29046
- temp.next = _this.head;
29047
- _this.head = temp;
29048
- } else {
29049
- temp.next = pre.next;
29050
- pre.next = temp;
29051
- }
29052
- _this.pushmod = _this.modified = true;
29053
- _this.length++;
29054
- if (this.space != null) {
29055
- this.alloc_cbSet();
29056
- this.wake();
29057
- }
29058
- }
29059
- };
29060
- zpp_nape.constraint.ZPP_Constraint.prototype.alloc_cbSet = function() {
29061
- if ((this.cbSet = this.space.cbsets.get(this.cbTypes)) != null) {
29062
- this.cbSet.count++;
29063
- this.cbSet.constraints.add(this);
29064
- }
29065
- };
29066
- zpp_nape.constraint.ZPP_Constraint.prototype.dealloc_cbSet = function() {
29067
- if (this.cbSet != null) {
29068
- this.cbSet.constraints.remove(this);
29069
- if (--this.cbSet.count == 0) {
29070
- this.space.cbsets.remove(this.cbSet);
29071
- var o = this.cbSet;
29072
- o.listeners.clear();
29073
- o.zip_listeners = true;
29074
- o.bodylisteners.clear();
29075
- o.zip_bodylisteners = true;
29076
- o.conlisteners.clear();
29077
- o.zip_conlisteners = true;
29078
- while (o.cbTypes.head != null) {
29079
- var cb = o.cbTypes.pop_unsafe();
29080
- cb.cbsets.remove(o);
29081
- }
29082
- o.next = zpp_nape.callbacks.ZPP_CbSet.zpp_pool;
29083
- zpp_nape.callbacks.ZPP_CbSet.zpp_pool = o;
29084
- }
29085
- this.cbSet = null;
29086
- }
29087
- };
29088
- zpp_nape.constraint.ZPP_Constraint.prototype.activate = function() {
29089
- if (this.space != null) {
29090
- this.activeInSpace();
29091
- }
29092
- };
29093
- zpp_nape.constraint.ZPP_Constraint.prototype.deactivate = function() {
29094
- if (this.space != null) {
29095
- this.inactiveOrOutSpace();
29096
- }
29097
- };
29098
- zpp_nape.constraint.ZPP_Constraint.prototype.addedToSpace = function() {
29099
- if (this.active) {
29100
- this.activeInSpace();
29101
- }
29102
- this.activeBodies();
29103
- var cx_ite = this.cbTypes.head;
29104
- while (cx_ite != null) {
29105
- var cb = cx_ite.elt;
29106
- cb.constraints.add(this);
29107
- cx_ite = cx_ite.next;
29108
- }
29109
- };
29110
- zpp_nape.constraint.ZPP_Constraint.prototype.removedFromSpace = function() {
29111
- if (this.active) {
29112
- this.inactiveOrOutSpace();
29113
- }
29114
- this.inactiveBodies();
29115
- var cx_ite = this.cbTypes.head;
29116
- while (cx_ite != null) {
29117
- var cb = cx_ite.elt;
29118
- cb.constraints.remove(this);
29119
- cx_ite = cx_ite.next;
29120
- }
29121
- };
29122
- zpp_nape.constraint.ZPP_Constraint.prototype.activeInSpace = function() {
29123
- this.alloc_cbSet();
29124
- if (zpp_nape.space.ZPP_Component.zpp_pool == null) {
29125
- this.component = new zpp_nape.space.ZPP_Component();
29126
- } else {
29127
- this.component = zpp_nape.space.ZPP_Component.zpp_pool;
29128
- zpp_nape.space.ZPP_Component.zpp_pool = this.component.next;
29129
- this.component.next = null;
29130
- }
29131
- this.component.isBody = false;
29132
- this.component.constraint = this;
29133
- };
29134
- zpp_nape.constraint.ZPP_Constraint.prototype.inactiveOrOutSpace = function() {
29135
- this.dealloc_cbSet();
29136
- var o = this.component;
29137
- o.body = null;
29138
- o.constraint = null;
29139
- o.next = zpp_nape.space.ZPP_Component.zpp_pool;
29140
- zpp_nape.space.ZPP_Component.zpp_pool = o;
29141
- this.component = null;
29142
- };
29143
- zpp_nape.constraint.ZPP_Constraint.prototype.activeBodies = function() {
29144
- };
29145
- zpp_nape.constraint.ZPP_Constraint.prototype.inactiveBodies = function() {
29146
- };
29147
- zpp_nape.constraint.ZPP_Constraint.prototype.clearcache = function() {
29148
- };
29149
- zpp_nape.constraint.ZPP_Constraint.prototype.validate = function() {
29150
- };
29151
- zpp_nape.constraint.ZPP_Constraint.prototype.wake_connected = function() {
29152
- };
29153
- zpp_nape.constraint.ZPP_Constraint.prototype.forest = function() {
29154
- };
29155
- zpp_nape.constraint.ZPP_Constraint.prototype.pair_exists = function(id, di) {
29156
- return false;
29157
- };
29158
- zpp_nape.constraint.ZPP_Constraint.prototype.broken = function() {
29159
- };
29160
- zpp_nape.constraint.ZPP_Constraint.prototype.warmStart = function() {
29161
- };
29162
- zpp_nape.constraint.ZPP_Constraint.prototype.pre_dt = null;
29163
- zpp_nape.constraint.ZPP_Constraint.prototype.preStep = function(dt) {
29164
- return false;
29165
- };
29166
- zpp_nape.constraint.ZPP_Constraint.prototype.applyImpulseVel = function() {
29167
- return false;
29354
+ ZPP_Constraint.prototype._initBase.call(this);
29168
29355
  };
29169
- zpp_nape.constraint.ZPP_Constraint.prototype.applyImpulsePos = function() {
29170
- return false;
29171
- };
29172
- zpp_nape.constraint.ZPP_Constraint.prototype.wake = function() {
29173
- if (this.space != null) {
29174
- this.space.wake_constraint(this);
29175
- }
29176
- };
29177
- zpp_nape.constraint.ZPP_Constraint.prototype.draw = function(g) {
29178
- };
29179
- zpp_nape.constraint.ZPP_Constraint.prototype.copy = function(dict, todo) {
29180
- return null;
29181
- };
29182
- zpp_nape.constraint.ZPP_Constraint.prototype.copyto = function(ret) {
29183
- var me = this.outer;
29184
- if (me.zpp_inner.wrap_cbTypes == null) {
29185
- me.zpp_inner.setupcbTypes();
29186
- }
29187
- var _this = me.zpp_inner.wrap_cbTypes;
29188
- _this.zpp_inner.valmod();
29189
- var _g = nape46.callbacks.CbTypeIterator.get(_this);
29190
- while (true) {
29191
- _g.zpp_inner.zpp_inner.valmod();
29192
- var _this1 = _g.zpp_inner;
29193
- _this1.zpp_inner.valmod();
29194
- if (_this1.zpp_inner.zip_length) {
29195
- _this1.zpp_inner.zip_length = false;
29196
- _this1.zpp_inner.user_length = _this1.zpp_inner.inner.length;
29197
- }
29198
- var length = _this1.zpp_inner.user_length;
29199
- _g.zpp_critical = true;
29200
- var tmp;
29201
- if (_g.zpp_i < length) {
29202
- tmp = true;
29203
- } else {
29204
- _g.zpp_next = nape46.callbacks.CbTypeIterator.zpp_pool;
29205
- nape46.callbacks.CbTypeIterator.zpp_pool = _g;
29206
- _g.zpp_inner = null;
29207
- tmp = false;
29208
- }
29209
- if (!tmp) {
29210
- break;
29211
- }
29212
- _g.zpp_critical = false;
29213
- var cb = _g.zpp_inner.at(_g.zpp_i++);
29214
- if (ret.zpp_inner.wrap_cbTypes == null) {
29215
- ret.zpp_inner.setupcbTypes();
29216
- }
29217
- var _this2 = ret.zpp_inner.wrap_cbTypes;
29218
- if (_this2.zpp_inner.reverse_flag) {
29219
- _this2.push(cb);
29220
- } else {
29221
- _this2.unshift(cb);
29222
- }
29223
- }
29224
- ret.zpp_inner.removeOnBreak = me.zpp_inner.removeOnBreak;
29225
- var breakUnderError = me.zpp_inner.breakUnderError;
29226
- if (ret.zpp_inner.breakUnderError != breakUnderError) {
29227
- ret.zpp_inner.breakUnderError = breakUnderError;
29228
- ret.zpp_inner.wake();
29229
- }
29230
- var breakUnderForce = me.zpp_inner.breakUnderForce;
29231
- if (ret.zpp_inner.breakUnderForce != breakUnderForce) {
29232
- ret.zpp_inner.breakUnderForce = breakUnderForce;
29233
- ret.zpp_inner.wake();
29234
- }
29235
- var maxError = me.zpp_inner.maxError;
29236
- if (maxError != maxError) {
29237
- throw new js._Boot.HaxeError("Error: Constraint::maxError cannot be NaN");
29238
- }
29239
- if (maxError < 0) {
29240
- throw new js._Boot.HaxeError("Error: Constraint::maxError must be >=0");
29241
- }
29242
- if (ret.zpp_inner.maxError != maxError) {
29243
- ret.zpp_inner.maxError = maxError;
29244
- ret.zpp_inner.wake();
29245
- }
29246
- var maxForce = me.zpp_inner.maxForce;
29247
- if (maxForce != maxForce) {
29248
- throw new js._Boot.HaxeError("Error: Constraint::maxForce cannot be NaN");
29249
- }
29250
- if (maxForce < 0) {
29251
- throw new js._Boot.HaxeError("Error: Constraint::maxForce must be >=0");
29252
- }
29253
- if (ret.zpp_inner.maxForce != maxForce) {
29254
- ret.zpp_inner.maxForce = maxForce;
29255
- ret.zpp_inner.wake();
29356
+ Object.getOwnPropertyNames(ZPP_Constraint.prototype).forEach(function(k2) {
29357
+ if (k2 !== "constructor") {
29358
+ zpp_nape.constraint.ZPP_Constraint.prototype[k2] = ZPP_Constraint.prototype[k2];
29256
29359
  }
29257
- var damping = me.zpp_inner.damping;
29258
- if (damping != damping) {
29259
- throw new js._Boot.HaxeError("Error: Constraint::Damping cannot be Nan");
29260
- }
29261
- if (damping < 0) {
29262
- throw new js._Boot.HaxeError("Error: Constraint::Damping must be >=0");
29263
- }
29264
- if (ret.zpp_inner.damping != damping) {
29265
- ret.zpp_inner.damping = damping;
29266
- if (!ret.zpp_inner.stiff) {
29267
- ret.zpp_inner.wake();
29268
- }
29269
- }
29270
- var frequency = me.zpp_inner.frequency;
29271
- if (frequency != frequency) {
29272
- throw new js._Boot.HaxeError(
29273
- "Error: Constraint::Frequency cannot be NaN"
29274
- );
29275
- }
29276
- if (frequency <= 0) {
29277
- throw new js._Boot.HaxeError("Error: Constraint::Frequency must be >0");
29278
- }
29279
- if (ret.zpp_inner.frequency != frequency) {
29280
- ret.zpp_inner.frequency = frequency;
29281
- if (!ret.zpp_inner.stiff) {
29282
- ret.zpp_inner.wake();
29283
- }
29284
- }
29285
- var stiff = me.zpp_inner.stiff;
29286
- if (ret.zpp_inner.stiff != stiff) {
29287
- ret.zpp_inner.stiff = stiff;
29288
- ret.zpp_inner.wake();
29289
- }
29290
- var ignore = me.zpp_inner.ignore;
29291
- if (ret.zpp_inner.ignore != ignore) {
29292
- ret.zpp_inner.ignore = ignore;
29293
- ret.zpp_inner.wake();
29294
- }
29295
- var active = me.zpp_inner.active;
29296
- if (ret.zpp_inner.active != active) {
29297
- if (ret.zpp_inner.component != null) {
29298
- ret.zpp_inner.component.woken = false;
29299
- }
29300
- ret.zpp_inner.clearcache();
29301
- if (active) {
29302
- ret.zpp_inner.active = active;
29303
- ret.zpp_inner.activate();
29304
- if (ret.zpp_inner.space != null) {
29305
- if (ret.zpp_inner.component != null) {
29306
- ret.zpp_inner.component.sleeping = true;
29307
- }
29308
- ret.zpp_inner.space.wake_constraint(ret.zpp_inner, true);
29309
- }
29310
- } else {
29311
- if (ret.zpp_inner.space != null) {
29312
- ret.zpp_inner.wake();
29313
- ret.zpp_inner.space.live_constraints.remove(ret.zpp_inner);
29314
- }
29315
- ret.zpp_inner.active = active;
29316
- ret.zpp_inner.deactivate();
29317
- }
29318
- }
29319
- };
29360
+ });
29361
+ zpp_nape.constraint.ZPP_Constraint.__name__ = ZPP_Constraint.__name__;
29320
29362
  zpp_nape.constraint.ZPP_Constraint.prototype.__class__ = zpp_nape.constraint.ZPP_Constraint;
29321
29363
  zpp_nape.constraint.ZPP_AngleJoint = $hxClasses["zpp_nape.constraint.ZPP_AngleJoint"] = function() {
29322
29364
  this.stepped = false;
@@ -29778,31 +29820,7 @@ define(function() {
29778
29820
  zpp_nape.constraint.ZPP_AngleJoint.prototype.draw = function(g) {
29779
29821
  };
29780
29822
  zpp_nape.constraint.ZPP_AngleJoint.prototype.__class__ = zpp_nape.constraint.ZPP_AngleJoint;
29781
- zpp_nape.constraint.ZPP_CopyHelper = $hxClasses["zpp_nape.constraint.ZPP_CopyHelper"] = function() {
29782
- this.cb = null;
29783
- this.bc = null;
29784
- this.id = 0;
29785
- };
29786
- zpp_nape.constraint.ZPP_CopyHelper.__name__ = [
29787
- "zpp_nape",
29788
- "constraint",
29789
- "ZPP_CopyHelper"
29790
- ];
29791
- zpp_nape.constraint.ZPP_CopyHelper.dict = function(id, bc) {
29792
- var ret = new zpp_nape.constraint.ZPP_CopyHelper();
29793
- ret.id = id;
29794
- ret.bc = bc;
29795
- return ret;
29796
- };
29797
- zpp_nape.constraint.ZPP_CopyHelper.todo = function(id, cb) {
29798
- var ret = new zpp_nape.constraint.ZPP_CopyHelper();
29799
- ret.id = id;
29800
- ret.cb = cb;
29801
- return ret;
29802
- };
29803
- zpp_nape.constraint.ZPP_CopyHelper.prototype.id = null;
29804
- zpp_nape.constraint.ZPP_CopyHelper.prototype.bc = null;
29805
- zpp_nape.constraint.ZPP_CopyHelper.prototype.cb = null;
29823
+ zpp_nape.constraint.ZPP_CopyHelper = $hxClasses["zpp_nape.constraint.ZPP_CopyHelper"] = ZPP_CopyHelper;
29806
29824
  zpp_nape.constraint.ZPP_CopyHelper.prototype.__class__ = zpp_nape.constraint.ZPP_CopyHelper;
29807
29825
  zpp_nape.constraint.ZPP_DistanceJoint = $hxClasses["zpp_nape.constraint.ZPP_DistanceJoint"] = function() {
29808
29826
  this.stepped = false;
@@ -90244,7 +90262,7 @@ var PulleyJoint = class _PulleyJoint extends Constraint {
90244
90262
  };
90245
90263
 
90246
90264
  // src/index.ts
90247
- var VERSION = "3.3.20";
90265
+ var VERSION = "3.3.21";
90248
90266
  export {
90249
90267
  AABB,
90250
90268
  AngleJoint,