@woosh/meep-engine 2.120.0 → 2.120.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 (107) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/src/core/binary/FLOAT32_MAX.d.ts +2 -0
  4. package/src/core/binary/FLOAT32_MAX.d.ts.map +1 -0
  5. package/src/core/binary/FLOAT32_MAX.js +1 -0
  6. package/src/core/collection/RingBuffer.d.ts +2 -3
  7. package/src/core/collection/RingBuffer.d.ts.map +1 -1
  8. package/src/core/collection/RingBuffer.js +9 -4
  9. package/src/core/color/Color.d.ts.map +1 -1
  10. package/src/core/color/Color.js +15 -1
  11. package/src/core/geom/Vector4.d.ts.map +1 -1
  12. package/src/core/geom/Vector4.js +32 -0
  13. package/src/core/geom/mat2/M2_IDENTITY.d.ts +6 -0
  14. package/src/core/geom/mat2/M2_IDENTITY.d.ts.map +1 -0
  15. package/src/core/geom/mat2/M2_IDENTITY.js +8 -0
  16. package/src/core/geom/mat2/m2_is_diagonal.d.ts +8 -0
  17. package/src/core/geom/mat2/m2_is_diagonal.d.ts.map +1 -0
  18. package/src/core/geom/mat2/m2_is_diagonal.js +9 -0
  19. package/src/core/geom/mat2/m2_is_orthogonal.d.ts +8 -0
  20. package/src/core/geom/mat2/m2_is_orthogonal.d.ts.map +1 -0
  21. package/src/core/geom/mat2/m2_is_orthogonal.js +23 -0
  22. package/src/core/geom/mat2/m2_transpose.d.ts +9 -0
  23. package/src/core/geom/mat2/m2_transpose.d.ts.map +1 -0
  24. package/src/core/geom/mat2/m2_transpose.js +17 -0
  25. package/src/core/graph/graph_compute_adjacency_matrix.d.ts +7 -5
  26. package/src/core/graph/graph_compute_adjacency_matrix.d.ts.map +1 -1
  27. package/src/core/graph/graph_compute_adjacency_matrix.js +11 -5
  28. package/src/core/graph/graph_compute_distance_matrix.d.ts.map +1 -1
  29. package/src/core/graph/graph_compute_distance_matrix.js +30 -56
  30. package/src/core/graph/graph_compute_laplacian_matrix.d.ts +6 -6
  31. package/src/core/graph/graph_compute_laplacian_matrix.js +6 -6
  32. package/src/core/json/abstractJSONDeserializer.d.ts.map +1 -1
  33. package/src/core/json/abstractJSONDeserializer.js +7 -1
  34. package/src/core/math/bell_membership_function.d.ts.map +1 -1
  35. package/src/core/math/bell_membership_function.js +6 -1
  36. package/src/core/math/linalg/m2/m2_polar_decomp.d.ts +19 -0
  37. package/src/core/math/linalg/m2/m2_polar_decomp.d.ts.map +1 -0
  38. package/src/core/math/linalg/m2/m2_polar_decomp.js +27 -0
  39. package/src/core/math/linalg/m2/m2_polar_decomp_noS.d.ts +15 -0
  40. package/src/core/math/linalg/m2/m2_polar_decomp_noS.d.ts.map +1 -0
  41. package/src/core/math/linalg/m2/m2_polar_decomp_noS.js +32 -0
  42. package/src/core/math/linalg/m2/m2_svd.d.ts +19 -0
  43. package/src/core/math/linalg/m2/m2_svd.d.ts.map +1 -0
  44. package/src/core/math/linalg/m2/m2_svd.js +96 -0
  45. package/src/core/math/linalg/solve_linear_system_GEPP_2x2.d.ts +1 -1
  46. package/src/core/math/linalg/solve_linear_system_GEPP_2x2.js +1 -1
  47. package/src/core/model/node-graph/node/NodeDescription.d.ts.map +1 -1
  48. package/src/core/model/node-graph/node/NodeDescription.js +14 -0
  49. package/src/core/model/node-graph/type/DataType.d.ts.map +1 -1
  50. package/src/core/model/node-graph/type/DataType.js +4 -0
  51. package/src/core/process/WatchDog.d.ts +41 -12
  52. package/src/core/process/WatchDog.d.ts.map +1 -1
  53. package/src/core/process/WatchDog.js +47 -16
  54. package/src/engine/development/performance/RingBufferMetric.d.ts +1 -1
  55. package/src/engine/development/performance/RingBufferMetric.d.ts.map +1 -1
  56. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSerializationAdapter.js +3 -3
  57. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSerializationUpgrader_0_1.d.ts +4 -0
  58. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSerializationUpgrader_0_1.d.ts.map +1 -0
  59. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSerializationUpgrader_0_1.js +24 -0
  60. package/src/engine/ecs/terrain/ecs/splat/SplatMapping.d.ts.map +1 -1
  61. package/src/engine/ecs/terrain/ecs/splat/SplatMapping.js +3 -9
  62. package/src/engine/ecs/terrain/overlay/TerrainOverlay.d.ts.map +1 -1
  63. package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +14 -8
  64. package/src/engine/ecs/transform/Transform.d.ts +5 -1
  65. package/src/engine/ecs/transform/Transform.d.ts.map +1 -1
  66. package/src/engine/ecs/transform/Transform.js +5 -1
  67. package/src/engine/intelligence/blackboard/BlackboardStack.d.ts +1 -1
  68. package/src/engine/intelligence/blackboard/BlackboardStack.js +1 -1
  69. package/src/engine/navigation/ecs/path_following/PathFollowerSerializationAdapter.d.ts.map +1 -1
  70. package/src/engine/navigation/ecs/path_following/PathFollowerSerializationAdapter.js +3 -1
  71. package/src/engine/navigation/ecs/path_following/PathFollowerSerializationUpgrader_2_3.d.ts.map +1 -1
  72. package/src/engine/navigation/ecs/path_following/PathFollowerSerializationUpgrader_2_3.js +3 -7
  73. package/src/engine/navigation/ecs/path_following/PathFollowerSerializationUpgrader_3_4.d.ts +5 -0
  74. package/src/engine/navigation/ecs/path_following/PathFollowerSerializationUpgrader_3_4.d.ts.map +1 -0
  75. package/src/engine/navigation/ecs/path_following/PathFollowerSerializationUpgrader_3_4.js +19 -0
  76. package/src/engine/physics/mls-mpm/MLS_MPM.d.ts +1 -1
  77. package/src/engine/physics/mls-mpm/MLS_MPM.d.ts.map +1 -1
  78. package/src/engine/physics/mls-mpm/MLS_MPM.js +9 -114
  79. package/src/engine/physics/mls-mpm/README.md +5 -0
  80. package/src/engine/physics/ammo/Body.js +0 -103
  81. package/src/engine/physics/ammo/PhysicsWorker.d.ts +0 -72
  82. package/src/engine/physics/ammo/PhysicsWorker.d.ts.map +0 -1
  83. package/src/engine/physics/ammo/PhysicsWorker.js +0 -437
  84. package/src/engine/physics/ammo/World.d.ts +0 -68
  85. package/src/engine/physics/ammo/World.d.ts.map +0 -1
  86. package/src/engine/physics/ammo/World.js +0 -336
  87. package/src/engine/physics/ammo/shapes/BoxShape.d.ts +0 -10
  88. package/src/engine/physics/ammo/shapes/BoxShape.d.ts.map +0 -1
  89. package/src/engine/physics/ammo/shapes/BoxShape.js +0 -11
  90. package/src/engine/physics/ammo/shapes/CapsuleShape.d.ts +0 -9
  91. package/src/engine/physics/ammo/shapes/CapsuleShape.d.ts.map +0 -1
  92. package/src/engine/physics/ammo/shapes/CapsuleShape.js +0 -10
  93. package/src/engine/physics/ammo/shapes/MeshShape.d.ts +0 -8
  94. package/src/engine/physics/ammo/shapes/MeshShape.d.ts.map +0 -1
  95. package/src/engine/physics/ammo/shapes/MeshShape.js +0 -9
  96. package/src/engine/physics/ammo/shapes/PlaneShape.d.ts +0 -11
  97. package/src/engine/physics/ammo/shapes/PlaneShape.d.ts.map +0 -1
  98. package/src/engine/physics/ammo/shapes/PlaneShape.js +0 -14
  99. package/src/engine/physics/ammo/shapes/Shape.d.ts +0 -7
  100. package/src/engine/physics/ammo/shapes/Shape.d.ts.map +0 -1
  101. package/src/engine/physics/ammo/shapes/Shape.js +0 -9
  102. package/src/engine/physics/ammo/shapes/SphereShape.d.ts +0 -8
  103. package/src/engine/physics/ammo/shapes/SphereShape.d.ts.map +0 -1
  104. package/src/engine/physics/ammo/shapes/SphereShape.js +0 -9
  105. package/src/engine/physics/cannon/CannonJSPhysicsSystem.d.ts +0 -15
  106. package/src/engine/physics/cannon/CannonJSPhysicsSystem.d.ts.map +0 -1
  107. package/src/engine/physics/cannon/CannonJSPhysicsSystem.js +0 -196
@@ -1,437 +0,0 @@
1
-
2
- let Module = {
3
- TOTAL_MEMORY: 20 * 1024 * 1024,
4
- ALLOW_MEMORY_GROWTH: 1
5
- };
6
- /**
7
- * Bullet enumerations
8
- */
9
- const btRigidBodyFlags = {
10
- BT_DISABLE_WORLD_GRAVITY: 1,
11
- BT_ENABLE_GYROPSCOPIC_FORCE: 2
12
- };
13
- const CollisionFlags = {
14
- CF_STATIC_OBJECT: 1,
15
- CF_KINEMATIC_OBJECT: 2,
16
- CF_NO_CONTACT_RESPONSE: 4,
17
- CF_CUSTOM_MATERIAL_CALLBACK: 8,
18
- CF_CHARACTER_OBJECT: 16,
19
- CF_DISABLE_VISUALIZE_OBJECT: 32,
20
- CF_DISABLE_SPU_COLLISION_PROCESSING: 64
21
- };
22
- importScripts('../../../lib/ammo.src');
23
-
24
- // Bullet-interfacing code
25
- // Build the broadphase
26
- const broadphase = new Ammo.btDbvtBroadphase();
27
-
28
- // Set up the collision configuration and dispatcher
29
- const collisionConfiguration = new Ammo.btDefaultCollisionConfiguration();
30
- const dispatcher = new Ammo.btCollisionDispatcher(collisionConfiguration);
31
-
32
- // The actual physics solver
33
- const solver = new Ammo.btSequentialImpulseConstraintSolver();
34
-
35
- // The world.
36
- const dynamicsWorld = new Ammo.btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
37
- const globalGravity = new Ammo.btVector3(0, -10, 0);
38
- dynamicsWorld.setGravity(globalGravity);
39
- //add tick callback
40
- Ammo.Runtime = Runtime || Ammo.Runtime;
41
- const simulationTickCallbackPointer = Ammo.Runtime.addFunction(simulationTickCallback);
42
- dynamicsWorld.setInternalTickCallback(simulationTickCallbackPointer);
43
- //Runtime.removeFunction(pointer);
44
-
45
-
46
- const bodies = [];
47
- const shapes = [];
48
- const transform = new Ammo.btTransform();
49
- /**
50
- * @type {Array<Array>}
51
- */
52
- const collisions = [];
53
- let simulationStepInProgress = false;
54
-
55
- function registerCollision(body1, body2, contactPoint) {
56
-
57
- const id1 = body1.__towers_id;
58
- const id2 = body2.__towers_id;
59
- let collision1 = collisions[id1];
60
- let collision2 = collisions[id2];
61
- if (!collision1) {
62
- collision1 = collisions[id1] = [];
63
- }
64
- if (!collision2) {
65
- collision2 = collisions[id2] = [];
66
- }
67
- let contact = collision1[id2];
68
- if (contact == null) {
69
- collision1[id2] = contactPoint;
70
- }
71
- contact = collision2[id1];
72
- if (contact == null) {
73
- collision2[id1] = contactPoint;
74
- }
75
- }
76
-
77
- function getElementByTowersId(id, collection) {
78
-
79
- for (let i = 0; i < collection.length; i++) {
80
- const element = collection[i];
81
- if (element.__towers_id == id) {
82
- return element;
83
- }
84
- }
85
- return null;
86
- }
87
-
88
- function getShapeById(id) {
89
-
90
- return getElementByTowersId(id, shapes);
91
- }
92
-
93
- function getBodyById(id) {
94
-
95
- return getElementByTowersId(id, bodies);
96
- }
97
-
98
- function btVector3ToJSON(vector) {
99
-
100
- return {
101
- x: vector.x(),
102
- y: vector.y(),
103
- z: vector.z()
104
- };
105
- }
106
-
107
- function write_btVector3(ptr, value) {
108
- ptr.setX(value.x);
109
- ptr.setY(value.y);
110
- ptr.setZ(value.z);
111
- }
112
-
113
- function write_btVector4(ptr, value) {
114
- ptr.setX(value.x);
115
- ptr.setY(value.y);
116
- ptr.setZ(value.z);
117
- ptr.setW(value.w);
118
- }
119
-
120
- function btQuaternionToJSON(q) {
121
-
122
- return {
123
- x: q.x(),
124
- y: q.y(),
125
- z: q.z(),
126
- w: q.w()
127
- };
128
- }
129
-
130
- function make_btVector3(json) {
131
-
132
- return new Ammo.btVector3(json.x, json.y, json.z);
133
- }
134
-
135
- function make_btQuaternion(json) {
136
-
137
- return new Ammo.btQuaternion(json.x, json.y, json.z, json.w);
138
- }
139
-
140
- function threeGeometryTobtTriangleMesh(geometry) {
141
-
142
- const threeFaces = geometry.faces;
143
- const triMesh = new Ammo.btTriangleMesh();
144
- const vertices = geometry.vertices.map(function (v) {
145
- return new Ammo.btVector3(v.x, v.y, v.z);
146
- });
147
-
148
- threeFaces.forEach(function (face) {
149
- const a = vertices[face.a];
150
- const b = vertices[face.b];
151
- const c = vertices[face.c];
152
- triMesh.addTriangle(a, b, c);
153
- });
154
- return triMesh;
155
- }
156
-
157
- /**
158
- * This will be called every simulation tick, including sub-steps. Collision detection is done inside this function
159
- * @param world
160
- * @param timeStep
161
- */
162
- function simulationTickCallback(world, timeStep) {
163
-
164
- //collision information extraction
165
- const numManifolds = dispatcher.getNumManifolds();
166
- for (let i = 0; i < numManifolds; i++) {
167
- const contactManifold = dispatcher.getManifoldByIndexInternal(i);
168
- const body0 = contactManifold.getBody0();
169
- const body1 = contactManifold.getBody1();
170
- const numContacts = contactManifold.getNumContacts();
171
- for (let j = 0; j < numContacts; j++) {
172
- const pt = contactManifold.getContactPoint(j);
173
- //intersection
174
- const ptA = pt.getPositionWorldOnA();
175
- let ptB = pt.getPositionWorldOnB();
176
- // console.log("hit!");
177
- //wrap pointers
178
- const b0 = Ammo.wrapPointer(body0, Ammo.btRigidBody);
179
- const b1 = Ammo.wrapPointer(body1, Ammo.btRigidBody);
180
- registerCollision(b0, b1, btVector3ToJSON(ptA));
181
- // postMessage({method: "collision", a: b0.__towers_id, b: b1.__towers_id});
182
- }
183
- }
184
- //send out collisions
185
-
186
- // console.log("world: "+world+", timeStep: "+timeStep);
187
- }
188
-
189
- const api = {};
190
- api.addShape = function (options) {
191
-
192
- let shape = null;
193
- switch (options.type) {
194
- case "sphere":
195
- shape = new Ammo.btSphereShape(options.radius);
196
- break;
197
- case "mesh":
198
- const triMesh = threeGeometryTobtTriangleMesh(options.mesh);
199
- shape = new Ammo.btBvhTriangleMeshShape(triMesh, true);
200
- break;
201
- case "plane":
202
- shape = new Ammo.btStaticPlaneShape(new Ammo.btVector3(options.x, options.y, options.z), options.w);
203
- break;
204
- case "box":
205
- shape = new Ammo.btBoxShape(new Ammo.btVector3(options.x, options.y, options.z));
206
- break;
207
- case "capsule":
208
- shape = new Ammo.btCapsuleShape(options.raidus, options.height);
209
- break;
210
- default :
211
- //unsupported type
212
- break;
213
- }
214
- if (shape != null) {
215
- shape.__towers_id = options.id;
216
- shapes.push(shape);
217
- // console.log("shape " + options.id + " added", options);
218
- }
219
- };
220
- api.addBody = function (options) {
221
-
222
- //defaults
223
- const position = options.position || { x: 0, y: 0, z: 0 };
224
- const rotation = options.rotation || { x: 0, y: 0, z: 0, w: 1 };
225
- const mass = options.mass || 0;
226
- const shapeId = options.shape;
227
- //prepare shape
228
- const shape = getShapeById(shapeId);
229
- const inertia = new Ammo.btVector3(0, 0, 0);
230
- if (mass != 0) {
231
- //dynamic
232
- shape.calculateLocalInertia(mass, inertia);
233
- }
234
- //prepare transform
235
- const btPosition = make_btVector3(position);
236
- const btQuaternion = new Ammo.btQuaternion(rotation.x, rotation.y, rotation.z, rotation.w);
237
- const transform = new Ammo.btTransform(btQuaternion, btPosition);
238
- //motion state
239
- const motionState = new Ammo.btDefaultMotionState(transform);
240
- const constructionInfo = new Ammo.btRigidBodyConstructionInfo(mass, motionState, shape, inertia);
241
- //create the body
242
- const body = new Ammo.btRigidBody(constructionInfo);
243
- if (options.friction && options.friction != 0) {
244
- body.setFriction(options.friction);
245
- }
246
- //linear velocity
247
- const linearVelocity = options.linearVelocity;
248
- if (linearVelocity) {
249
- body.setLinearVelocity(make_btVector3(linearVelocity));
250
- }
251
- //angular factor, affecting impulses and forces
252
- const angularFactor = options.angularFactor;
253
- if (angularFactor && (angularFactor.x != 1 || angularFactor.y != 1 || angularFactor.z != 1)) {
254
- body.setAngularFactor(make_btVector3(angularFactor));
255
- }
256
- //custom gravity
257
- const gravity = options.gravity;
258
- if (gravity) {
259
- body.setFlags(btRigidBodyFlags.BT_DISABLE_WORLD_GRAVITY);
260
- }
261
- const disableCollisionResponse = options.disableCollisionResponse;
262
- if (disableCollisionResponse) {
263
- body.setCollisionFlags(body.getCollisionFlags() | CollisionFlags.CF_NO_CONTACT_RESPONSE);
264
- }
265
- dynamicsWorld.addRigidBody(body);
266
- body.__towers_id = options.id;
267
- bodies.push(body);
268
- };
269
- api.removeBody = function (options) {
270
-
271
- const body = getBodyById(options.id);
272
- dynamicsWorld.removeRigidBody(body);
273
- Ammo.destroy(body); //clean up
274
- bodies.splice(bodies.indexOf(body), 1); //remove from array
275
- };
276
- api.writeBodyAttributes = function (options) {
277
-
278
- for (let i = 0; i < options.length; i++) {
279
- const obj = options[i];
280
- const body = getBodyById(obj.id);
281
- const attributes = obj.attributes;
282
- let t, v3, v4;
283
- for (let prop in attributes) {
284
- if (!attributes.hasOwnProperty(prop)) {
285
- continue;
286
- }
287
- const value = attributes[prop];
288
- switch (prop) {
289
- case "linearVelocity":
290
- // body.setLinearVelocity(make_btVector3(value));
291
- v3 = body.getLinearVelocity();
292
- write_btVector3(v3, value);
293
- break;
294
- case "position":
295
- t = body.getWorldTransform();
296
- v3 = t.getOrigin();
297
- write_btVector3(v3, value);
298
- // t.setOrigin(make_btVector3(value));
299
- break;
300
- case "rotation":
301
- t = body.getWorldTransform();
302
- v4 = t.getRotation();
303
- write_btVector4(v4, value);
304
- // t.setRotation(make_btQuaternion(value));
305
- break;
306
- default :
307
- console.warn("unknown body property " + prop);
308
- }
309
- //
310
- }
311
- body.activate(); //wake up the body
312
- }
313
- };
314
-
315
- const raytest_from = new Ammo.btVector3(0, 0, 0),
316
- raytest_to = new Ammo.btVector3(0, 0, 0);
317
- api.rayTest = function (options) {
318
- const from = options.from;
319
- const to = options.to;
320
- write_btVector3(raytest_from, from);
321
- write_btVector3(raytest_to, to);
322
- const cb = new Ammo.ClosestRayResultCallback(raytest_from, raytest_to);
323
- dynamicsWorld.rayTest(raytest_from, raytest_to, cb);
324
- if (cb.hasHit()) {
325
- const hitPointWorld = cb.get_m_hitPointWorld();
326
- let hitNormalWorld = cb.get_m_hitNormalWorld();
327
- // Do some clever stuff here
328
- postMessage({ method: "rayHit", point: btVector3ToJSON(hitPointWorld) });
329
- } else {
330
- postMessage({ method: "rayMiss" });
331
- }
332
- Ammo.destroy(cb);
333
- };
334
- api.rayCast = function (options) {
335
- const from = options.from;
336
- const to = options.to;
337
- write_btVector3(raytest_from, from);
338
- write_btVector3(raytest_to, to);
339
- const cb = new Ammo.btCollisionWorld.AllHitsRayResultCallback(raytest_from, raytest_to);
340
- const points = [];
341
- if (cb.hasHit()) {
342
- const hitPointWorld = cb.get_m_hitPointWorld();
343
- // var hitNormalWorld = cb.get_m_hitNormalWorld();
344
- // Do some clever stuff here
345
- const length = hitPointWorld.size();
346
- for (let i = 0; i < length; i++) {
347
- const at = hitPointWorld.at(i);
348
- points.push(btVector3ToJSON(at));
349
- }
350
- } else {
351
- }
352
-
353
- destroy(cb);
354
- postMessage({ method: "rayCast", points: points });
355
- };
356
-
357
- function sendCollisions() {
358
- const count = collisions.reduce(function (prev, val) {
359
- return prev + val.length;
360
- }, 0);
361
- const i = count * 2;
362
- const data = new Int32Array(i);
363
- collisions.forEach(function (val, id1) {
364
- val.forEach(function (v, id2) {
365
- data[--i] = id1;
366
- data[--i] = id2;
367
- });
368
- });
369
- postMessage({ method: "collisions", pairs: data }, [data.buffer]);
370
- }
371
-
372
- api.simulate = function (delta) {
373
-
374
- const substeps = 2;
375
- //reset collision matrix
376
- collisions = [];
377
- //tell simulation world to perform step
378
- dynamicsWorld.stepSimulation(delta, substeps);
379
- const ids = new Int32Array(bodies.length);
380
- const states = new Float32Array(bodies.length * 10);
381
- bodies.forEach(function (body, index) {
382
- body.getMotionState().getWorldTransform(transform);
383
- const origin = transform.getOrigin();
384
- const rotation = transform.getRotation();
385
- const id = body.__towers_id;
386
- const linearVelocity = body.getLinearVelocity();
387
- ids[index] = id;
388
- const j = (index * 10);
389
- //position
390
- states[j] = origin.x();
391
- states[j + 1] = origin.y();
392
- states[j + 2] = origin.z();
393
- //rotation
394
- states[j + 3] = rotation.x();
395
- states[j + 4] = rotation.y();
396
- states[j + 5] = rotation.z();
397
- states[j + 6] = rotation.w();
398
- //velocity
399
- states[j + 7] = linearVelocity.x();
400
- states[j + 8] = linearVelocity.y();
401
- states[j + 9] = linearVelocity.z();
402
- // the reason for mapping is the fact that JS will use map internally for our contacts array, but when passing
403
- // out - it will end up as a large sparse array, and that would take a lot of memory
404
- // var bodyCollisions = collisions[body.__towers_id];
405
- // if (bodyCollisions) {
406
- // var contacts = info.collisions = [];
407
- // bodyCollisions.forEach(function (val, key) {
408
- // contacts.push({t: key, p: val});
409
- // });
410
- // }
411
- // message.push(info);
412
- });
413
- postMessage({ method: "updateState", ids: ids, states: states }, [ids.buffer, states.buffer]);
414
- sendCollisions();
415
- };
416
- api.applyCentralImpulse = function (data) {
417
-
418
- for (let i = 0; i < data.length; i++) {
419
- const pair = data[i];
420
- const id = pair.id;
421
- const value = pair.value;
422
- const body = getBodyById(id);
423
- body.applyCentralImpulse(make_btVector3(value));
424
- body.activate();
425
- }
426
- };
427
- onmessage = function (event) {
428
- const data = event.data;
429
- const method = api[data.method];
430
- if (method) {
431
- method(data.options);
432
- } else {
433
- console.error(data.method, "is not a supported method");
434
- }
435
- };
436
-
437
- postMessage({ method: "workerReady", options: null });
@@ -1,68 +0,0 @@
1
- export default World;
2
- declare class World {
3
- constructor(readyCallback: any);
4
- worker: Worker;
5
- shapeIdPool: IdPool;
6
- bodyIdPool: IdPool;
7
- /**
8
- *
9
- * @type {Shape[]}
10
- */
11
- shapes: Shape[];
12
- bodies: Body[];
13
- __updateCallbacks: any[];
14
- __raytestCallbacks: any[];
15
- __raycastCallbacks: any[];
16
- __stepDoneCallbacks: any[];
17
- /**
18
- *
19
- * @param {number} id
20
- * @returns {Body}
21
- */
22
- getBodyById(id: number): Body;
23
- /**
24
- *
25
- * @param {Array} update
26
- */
27
- updateBodies(update: any[]): void;
28
- /**
29
- *
30
- * @param {Shape} shape
31
- */
32
- addShape(shape: Shape): void;
33
- /**
34
- *
35
- * @param {Body} body
36
- */
37
- addBody(body: Body): void;
38
- /**
39
- *
40
- * @param {Body} body
41
- */
42
- removeBody(body: Body): void;
43
- sendImpulses(): void;
44
- writeChangedAttributes(): void;
45
- /**
46
- *
47
- * @param {Vector3} from
48
- * @param {Vector3} to
49
- * @param {function<Vector3>} callback
50
- */
51
- rayTest(from: Vector3, to: Vector3, callback: any): void;
52
- /**
53
- *
54
- * @param {Vector3} from
55
- * @param {Vector3} to
56
- * @param {function} callback
57
- */
58
- rayCast(from: Vector3, to: Vector3, callback: Function): void;
59
- /**
60
- *
61
- * @param {number} delta
62
- * @param {function} callback
63
- */
64
- simulate(delta: number, callback: Function): void;
65
- }
66
- import IdPool from '../../../core/IdPool.js';
67
- import Vector3 from "../../../core/geom/Vector3.js";
68
- //# sourceMappingURL=World.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"World.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/ammo/World.js"],"names":[],"mappings":";AAYA;IACI,gCA8FC;IA7FG,eAA8D;IAC9D,oBAA+B;IAC/B,mBAA8B;IAE9B;;;OAGG;IACH,QAFU,KAAK,EAAE,CAED;IAMD,QAFL,IAAI,EAAE,CAEe;IAC/B,yBAA2B;IACF,0BAA4B;IAC5B,0BAA4B;IAC3B,2BAA6B;IA6E3D;;;;OAIG;IACH,gBAHW,MAAM,GACJ,IAAI,CAKhB;IAED;;;OAGG;IACH,kCAoCC;IAED;;;OAGG;IACH,gBAFW,KAAK,QAQf;IAED;;;OAGG;IACH,cAFW,IAAI,QAgCd;IAED;;;OAGG;IACH,iBAFW,IAAI,QAad;IAED,qBAyBC;IAED,+BA8BC;IAED;;;;;OAKG;IACH,cAJW,OAAO,MACP,OAAO,uBAWjB;IAED;;;;;OAKG;IACH,cAJW,OAAO,MACP,OAAO,4BAWjB;IAED;;;;OAIG;IACH,gBAHW,MAAM,4BAYhB;CACJ;mBA3UkB,yBAAyB;oBADxB,+BAA+B"}