@newkrok/nape-js 3.3.0 → 3.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.
- package/dist/index.cjs +4582 -4890
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +274 -22
- package/dist/index.d.ts +274 -22
- package/dist/index.js +4582 -4890
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -163,15 +163,88 @@ declare class NapeList<T> implements Iterable<T> {
|
|
|
163
163
|
toString(): string;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
/**
|
|
167
|
+
* ZPP_Material — Internal material representation for the nape physics engine.
|
|
168
|
+
*
|
|
169
|
+
* Stores physical material properties (friction, elasticity, density) and
|
|
170
|
+
* manages the list of shapes that reference this material for invalidation.
|
|
171
|
+
*
|
|
172
|
+
* Converted from nape-compiled.js lines 87523–87601, 135477–135481.
|
|
173
|
+
*/
|
|
174
|
+
type Any$3 = any;
|
|
175
|
+
declare class ZPP_Material {
|
|
176
|
+
static zpp_pool: ZPP_Material | null;
|
|
177
|
+
static WAKE: number;
|
|
178
|
+
static PROPS: number;
|
|
179
|
+
static ANGDRAG: number;
|
|
180
|
+
static ARBITERS: number;
|
|
181
|
+
static __name__: string[];
|
|
182
|
+
/**
|
|
183
|
+
* Namespace references, set by the compiled module after import.
|
|
184
|
+
* _nape = the `nape` public namespace (for wrapper creation)
|
|
185
|
+
* _zpp = the `zpp_nape` internal namespace (for ZNPList_ZPP_Shape)
|
|
186
|
+
*/
|
|
187
|
+
static _nape: Any$3;
|
|
188
|
+
static _zpp: Any$3;
|
|
189
|
+
/**
|
|
190
|
+
* Wrapper factory callback, registered by the modernized Material class.
|
|
191
|
+
* When set, wrapper() uses this instead of creating a compiled Material.
|
|
192
|
+
*/
|
|
193
|
+
static _wrapFn: ((zpp: ZPP_Material) => Any$3) | null;
|
|
194
|
+
elasticity: number;
|
|
195
|
+
dynamicFriction: number;
|
|
196
|
+
staticFriction: number;
|
|
197
|
+
density: number;
|
|
198
|
+
rollingFriction: number;
|
|
199
|
+
shapes: Any$3;
|
|
200
|
+
wrap_shapes: Any$3;
|
|
201
|
+
outer: Any$3;
|
|
202
|
+
userData: Any$3;
|
|
203
|
+
next: ZPP_Material | null;
|
|
204
|
+
__class__: Any$3;
|
|
205
|
+
constructor();
|
|
206
|
+
/** Create/return the public nape.phys.Material wrapper for this internal object. */
|
|
207
|
+
wrapper(): Any$3;
|
|
208
|
+
/** Called when this object is returned to the pool. */
|
|
209
|
+
free(): void;
|
|
210
|
+
/** Called when this object is taken from the pool. */
|
|
211
|
+
alloc(): void;
|
|
212
|
+
/** Initialize the shapes list (called during feature construction). */
|
|
213
|
+
feature_cons(): void;
|
|
214
|
+
/** Register a shape that uses this material. */
|
|
215
|
+
addShape(shape: Any$3): void;
|
|
216
|
+
/** Unregister a shape that no longer uses this material. */
|
|
217
|
+
remShape(shape: Any$3): void;
|
|
218
|
+
/** Create a copy with the same property values. */
|
|
219
|
+
copy(): ZPP_Material;
|
|
220
|
+
/** Copy all property values from another ZPP_Material. */
|
|
221
|
+
set(x: ZPP_Material): void;
|
|
222
|
+
/** Notify all shapes using this material that properties changed. */
|
|
223
|
+
invalidate(x: number): void;
|
|
224
|
+
}
|
|
225
|
+
|
|
166
226
|
/**
|
|
167
227
|
* Physical material properties applied to shapes.
|
|
228
|
+
*
|
|
229
|
+
* Controls elasticity (bounciness), friction coefficients, density, and
|
|
230
|
+
* rolling friction. Internally wraps a ZPP_Material and is registered as
|
|
231
|
+
* the public `nape.phys.Material` class in the compiled namespace.
|
|
232
|
+
*
|
|
233
|
+
* Converted from nape-compiled.js lines 38254–38573.
|
|
168
234
|
*/
|
|
169
235
|
declare class Material {
|
|
170
|
-
|
|
171
|
-
|
|
236
|
+
static __name__: string[];
|
|
237
|
+
/** @internal The internal ZPP_Material this wrapper owns. */
|
|
238
|
+
zpp_inner: ZPP_Material;
|
|
239
|
+
/**
|
|
240
|
+
* Backward-compatible accessor — returns `this` so that compiled engine
|
|
241
|
+
* code that receives `material._inner` can still access `zpp_inner`.
|
|
242
|
+
* @internal
|
|
243
|
+
*/
|
|
244
|
+
get _inner(): NapeInner;
|
|
172
245
|
constructor(elasticity?: number, dynamicFriction?: number, staticFriction?: number, density?: number, rollingFriction?: number);
|
|
173
|
-
/** @internal */
|
|
174
|
-
static _wrap(inner:
|
|
246
|
+
/** @internal Wrap a ZPP_Material (or legacy compiled Material) with caching. */
|
|
247
|
+
static _wrap(inner: any): Material;
|
|
175
248
|
get elasticity(): number;
|
|
176
249
|
set elasticity(value: number);
|
|
177
250
|
get dynamicFriction(): number;
|
|
@@ -185,38 +258,163 @@ declare class Material {
|
|
|
185
258
|
get userData(): Record<string, unknown>;
|
|
186
259
|
copy(): Material;
|
|
187
260
|
toString(): string;
|
|
261
|
+
static wood(): Material;
|
|
262
|
+
static steel(): Material;
|
|
263
|
+
static ice(): Material;
|
|
264
|
+
static rubber(): Material;
|
|
265
|
+
static glass(): Material;
|
|
266
|
+
static sand(): Material;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* ZPP_FluidProperties — Internal fluid properties for the nape physics engine.
|
|
271
|
+
*
|
|
272
|
+
* Stores density, viscosity, and per-fluid gravity override.
|
|
273
|
+
* Manages the list of shapes that reference these properties for invalidation.
|
|
274
|
+
*
|
|
275
|
+
* Converted from nape-compiled.js lines 87335–87523, 135403.
|
|
276
|
+
*/
|
|
277
|
+
type Any$2 = any;
|
|
278
|
+
declare class ZPP_FluidProperties {
|
|
279
|
+
static zpp_pool: ZPP_FluidProperties | null;
|
|
280
|
+
static __name__: string[];
|
|
281
|
+
static _nape: Any$2;
|
|
282
|
+
static _zpp: Any$2;
|
|
283
|
+
static _wrapFn: ((zpp: ZPP_FluidProperties) => Any$2) | null;
|
|
284
|
+
viscosity: number;
|
|
285
|
+
density: number;
|
|
286
|
+
gravityx: number;
|
|
287
|
+
gravityy: number;
|
|
288
|
+
wrap_gravity: Any$2;
|
|
289
|
+
shapes: Any$2;
|
|
290
|
+
wrap_shapes: Any$2;
|
|
291
|
+
outer: Any$2;
|
|
292
|
+
userData: Any$2;
|
|
293
|
+
next: ZPP_FluidProperties | null;
|
|
294
|
+
__class__: Any$2;
|
|
295
|
+
constructor();
|
|
296
|
+
/** Create/return the public nape.phys.FluidProperties wrapper. */
|
|
297
|
+
wrapper(): Any$2;
|
|
298
|
+
free(): void;
|
|
299
|
+
alloc(): void;
|
|
300
|
+
feature_cons(): void;
|
|
301
|
+
addShape(shape: Any$2): void;
|
|
302
|
+
remShape(shape: Any$2): void;
|
|
303
|
+
/** Copy with object pooling. */
|
|
304
|
+
copy(): ZPP_FluidProperties;
|
|
305
|
+
/** Called when gravity Vec2 wrapper is invalidated (user set new gravity). */
|
|
306
|
+
gravity_invalidate(x: Any$2): void;
|
|
307
|
+
/** Sync the gravity Vec2 wrapper with internal values. */
|
|
308
|
+
gravity_validate(): void;
|
|
309
|
+
/** Lazily create and return the gravity Vec2 wrapper. */
|
|
310
|
+
getgravity(): void;
|
|
311
|
+
/** Notify all shapes that fluid properties changed. */
|
|
312
|
+
invalidate(): void;
|
|
188
313
|
}
|
|
189
314
|
|
|
190
315
|
/**
|
|
191
316
|
* Fluid properties for shapes that act as fluid regions.
|
|
317
|
+
*
|
|
318
|
+
* Controls density, viscosity, and per-fluid gravity override.
|
|
319
|
+
* Internally wraps a ZPP_FluidProperties and is registered as
|
|
320
|
+
* the public `nape.phys.FluidProperties` class in the compiled namespace.
|
|
321
|
+
*
|
|
322
|
+
* Converted from nape-compiled.js lines 37002–37511.
|
|
192
323
|
*/
|
|
193
324
|
declare class FluidProperties {
|
|
194
|
-
|
|
195
|
-
|
|
325
|
+
static __name__: string[];
|
|
326
|
+
/** @internal The internal ZPP_FluidProperties this wrapper owns. */
|
|
327
|
+
zpp_inner: ZPP_FluidProperties;
|
|
328
|
+
/**
|
|
329
|
+
* Backward-compatible accessor — returns `this` so that compiled engine
|
|
330
|
+
* code that receives `fluidProps._inner` can still access `zpp_inner`.
|
|
331
|
+
* @internal
|
|
332
|
+
*/
|
|
333
|
+
get _inner(): NapeInner;
|
|
196
334
|
constructor(density?: number, viscosity?: number);
|
|
197
|
-
/** @internal */
|
|
198
|
-
static _wrap(inner:
|
|
335
|
+
/** @internal Wrap a ZPP_FluidProperties (or legacy compiled FluidProperties) with caching. */
|
|
336
|
+
static _wrap(inner: any): FluidProperties;
|
|
199
337
|
get density(): number;
|
|
200
338
|
set density(value: number);
|
|
201
339
|
get viscosity(): number;
|
|
202
340
|
set viscosity(value: number);
|
|
203
|
-
get gravity():
|
|
204
|
-
set gravity(
|
|
341
|
+
get gravity(): any;
|
|
342
|
+
set gravity(gravity: any);
|
|
205
343
|
get userData(): Record<string, unknown>;
|
|
344
|
+
get shapes(): any;
|
|
206
345
|
copy(): FluidProperties;
|
|
207
346
|
toString(): string;
|
|
208
347
|
}
|
|
209
348
|
|
|
349
|
+
/**
|
|
350
|
+
* ZPP_InteractionFilter — Internal interaction filter for the nape physics engine.
|
|
351
|
+
*
|
|
352
|
+
* Stores collision/sensor/fluid group and mask bitmasks that determine
|
|
353
|
+
* which shapes interact with each other.
|
|
354
|
+
*
|
|
355
|
+
* Converted from nape-compiled.js lines 63255–63366, 135329.
|
|
356
|
+
*/
|
|
357
|
+
type Any$1 = any;
|
|
358
|
+
declare class ZPP_InteractionFilter {
|
|
359
|
+
static zpp_pool: ZPP_InteractionFilter | null;
|
|
360
|
+
static __name__: string[];
|
|
361
|
+
static _nape: Any$1;
|
|
362
|
+
static _zpp: Any$1;
|
|
363
|
+
static _wrapFn: ((zpp: ZPP_InteractionFilter) => Any$1) | null;
|
|
364
|
+
collisionGroup: number;
|
|
365
|
+
collisionMask: number;
|
|
366
|
+
sensorGroup: number;
|
|
367
|
+
sensorMask: number;
|
|
368
|
+
fluidGroup: number;
|
|
369
|
+
fluidMask: number;
|
|
370
|
+
shapes: Any$1;
|
|
371
|
+
wrap_shapes: Any$1;
|
|
372
|
+
outer: Any$1;
|
|
373
|
+
userData: Any$1;
|
|
374
|
+
next: ZPP_InteractionFilter | null;
|
|
375
|
+
__class__: Any$1;
|
|
376
|
+
constructor();
|
|
377
|
+
/** Create/return the public nape.dynamics.InteractionFilter wrapper. */
|
|
378
|
+
wrapper(): Any$1;
|
|
379
|
+
free(): void;
|
|
380
|
+
alloc(): void;
|
|
381
|
+
feature_cons(): void;
|
|
382
|
+
addShape(shape: Any$1): void;
|
|
383
|
+
remShape(shape: Any$1): void;
|
|
384
|
+
/** Create a copy with object pooling. */
|
|
385
|
+
copy(): ZPP_InteractionFilter;
|
|
386
|
+
/** Test whether two filters allow collision between their shapes. */
|
|
387
|
+
shouldCollide(x: ZPP_InteractionFilter): boolean;
|
|
388
|
+
/** Test whether two filters allow sensor interaction. */
|
|
389
|
+
shouldSense(x: ZPP_InteractionFilter): boolean;
|
|
390
|
+
/** Test whether two filters allow fluid interaction. */
|
|
391
|
+
shouldFlow(x: ZPP_InteractionFilter): boolean;
|
|
392
|
+
/** Notify all shapes that the filter changed. */
|
|
393
|
+
invalidate(): void;
|
|
394
|
+
}
|
|
395
|
+
|
|
210
396
|
/**
|
|
211
397
|
* Bit-mask based interaction filter for controlling which shapes
|
|
212
398
|
* collide, sense, or interact as fluids.
|
|
399
|
+
*
|
|
400
|
+
* Internally wraps a ZPP_InteractionFilter and is registered as
|
|
401
|
+
* the public `nape.dynamics.InteractionFilter` class in the compiled namespace.
|
|
402
|
+
*
|
|
403
|
+
* Converted from nape-compiled.js lines 14361–14640.
|
|
213
404
|
*/
|
|
214
405
|
declare class InteractionFilter {
|
|
215
|
-
|
|
216
|
-
|
|
406
|
+
static __name__: string[];
|
|
407
|
+
/** @internal The internal ZPP_InteractionFilter this wrapper owns. */
|
|
408
|
+
zpp_inner: ZPP_InteractionFilter;
|
|
409
|
+
/**
|
|
410
|
+
* Backward-compatible accessor — returns `this` so that compiled engine
|
|
411
|
+
* code that receives `filter._inner` can still access `zpp_inner`.
|
|
412
|
+
* @internal
|
|
413
|
+
*/
|
|
414
|
+
get _inner(): NapeInner;
|
|
217
415
|
constructor(collisionGroup?: number, collisionMask?: number, sensorGroup?: number, sensorMask?: number, fluidGroup?: number, fluidMask?: number);
|
|
218
|
-
/** @internal */
|
|
219
|
-
static _wrap(inner:
|
|
416
|
+
/** @internal Wrap a ZPP_InteractionFilter (or legacy compiled InteractionFilter) with caching. */
|
|
417
|
+
static _wrap(inner: any): InteractionFilter;
|
|
220
418
|
get collisionGroup(): number;
|
|
221
419
|
set collisionGroup(value: number);
|
|
222
420
|
get collisionMask(): number;
|
|
@@ -230,9 +428,10 @@ declare class InteractionFilter {
|
|
|
230
428
|
get fluidMask(): number;
|
|
231
429
|
set fluidMask(value: number);
|
|
232
430
|
get userData(): Record<string, unknown>;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
431
|
+
get shapes(): any;
|
|
432
|
+
shouldCollide(filter: InteractionFilter): boolean;
|
|
433
|
+
shouldSense(filter: InteractionFilter): boolean;
|
|
434
|
+
shouldFlow(filter: InteractionFilter): boolean;
|
|
236
435
|
copy(): InteractionFilter;
|
|
237
436
|
toString(): string;
|
|
238
437
|
}
|
|
@@ -555,20 +754,73 @@ declare class Polygon extends Shape {
|
|
|
555
754
|
validity(): NapeInner;
|
|
556
755
|
}
|
|
557
756
|
|
|
757
|
+
/**
|
|
758
|
+
* ZPP_InteractionGroup — Internal interaction group for the nape physics engine.
|
|
759
|
+
*
|
|
760
|
+
* Hierarchical groups that can override interaction filters. When two shapes
|
|
761
|
+
* share a common group with `ignore = true`, their interaction is suppressed.
|
|
762
|
+
*
|
|
763
|
+
* Converted from nape-compiled.js lines 63367–63463, 135330–135331.
|
|
764
|
+
*/
|
|
765
|
+
type Any = any;
|
|
766
|
+
declare class ZPP_InteractionGroup {
|
|
767
|
+
static SHAPE: number;
|
|
768
|
+
static BODY: number;
|
|
769
|
+
static __name__: string[];
|
|
770
|
+
static _zpp: Any;
|
|
771
|
+
static _wrapFn: ((zpp: ZPP_InteractionGroup) => Any) | null;
|
|
772
|
+
outer: Any;
|
|
773
|
+
ignore: boolean;
|
|
774
|
+
group: ZPP_InteractionGroup | null;
|
|
775
|
+
groups: Any;
|
|
776
|
+
wrap_groups: Any;
|
|
777
|
+
interactors: Any;
|
|
778
|
+
wrap_interactors: Any;
|
|
779
|
+
depth: number;
|
|
780
|
+
__class__: Any;
|
|
781
|
+
constructor();
|
|
782
|
+
/** Set or change the parent group. */
|
|
783
|
+
setGroup(group: ZPP_InteractionGroup | null): void;
|
|
784
|
+
/** Wake all interactors and propagate to child groups. */
|
|
785
|
+
invalidate(force?: boolean): void;
|
|
786
|
+
/** Add a child group. */
|
|
787
|
+
addGroup(group: ZPP_InteractionGroup): void;
|
|
788
|
+
/** Remove a child group. */
|
|
789
|
+
remGroup(group: ZPP_InteractionGroup): void;
|
|
790
|
+
/** Register an interactor in this group. */
|
|
791
|
+
addInteractor(intx: Any): void;
|
|
792
|
+
/** Unregister an interactor from this group. */
|
|
793
|
+
remInteractor(intx: Any, flag?: number): void;
|
|
794
|
+
}
|
|
795
|
+
|
|
558
796
|
/**
|
|
559
797
|
* Hierarchical interaction group for controlling interactions
|
|
560
798
|
* between sets of interactors.
|
|
799
|
+
*
|
|
800
|
+
* Internally wraps a ZPP_InteractionGroup and is registered as
|
|
801
|
+
* the public `nape.dynamics.InteractionGroup` class in the compiled namespace.
|
|
802
|
+
*
|
|
803
|
+
* Converted from nape-compiled.js lines 14641–14733.
|
|
561
804
|
*/
|
|
562
805
|
declare class InteractionGroup {
|
|
563
|
-
|
|
564
|
-
|
|
806
|
+
static __name__: string[];
|
|
807
|
+
/** @internal The internal ZPP_InteractionGroup this wrapper owns. */
|
|
808
|
+
zpp_inner: ZPP_InteractionGroup;
|
|
809
|
+
/**
|
|
810
|
+
* Backward-compatible accessor — returns `this` so that compiled engine
|
|
811
|
+
* code that receives `group._inner` can still access `zpp_inner`.
|
|
812
|
+
* @internal
|
|
813
|
+
*/
|
|
814
|
+
get _inner(): NapeInner;
|
|
565
815
|
constructor(ignore?: boolean);
|
|
566
|
-
/** @internal */
|
|
567
|
-
static _wrap(inner:
|
|
568
|
-
get group(): InteractionGroup;
|
|
816
|
+
/** @internal Wrap a ZPP_InteractionGroup (or legacy compiled InteractionGroup) with caching. */
|
|
817
|
+
static _wrap(inner: any): InteractionGroup;
|
|
818
|
+
get group(): InteractionGroup | null;
|
|
569
819
|
set group(value: InteractionGroup | null);
|
|
570
820
|
get ignore(): boolean;
|
|
571
821
|
set ignore(value: boolean);
|
|
822
|
+
get interactors(): any;
|
|
823
|
+
get groups(): any;
|
|
572
824
|
toString(): string;
|
|
573
825
|
}
|
|
574
826
|
|