@galacean/engine-physics-physx 1.3.23 → 1.4.0-alpha.0
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/browser.js +60 -140
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/main.js +60 -140
- package/dist/main.js.map +1 -1
- package/dist/module.js +53 -134
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/dist/miniprogram.js +0 -1406
package/dist/browser.js
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
} else return left instanceof right;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
function _type_of(obj) {
|
|
14
|
+
"@swc/helpers - typeof";
|
|
15
|
+
|
|
16
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
function _set_prototype_of(o, p) {
|
|
14
20
|
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
15
21
|
o.__proto__ = p;
|
|
@@ -30,12 +36,6 @@
|
|
|
30
36
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
31
37
|
}
|
|
32
38
|
|
|
33
|
-
var ShapeFlag;
|
|
34
|
-
(function(ShapeFlag) {
|
|
35
|
-
ShapeFlag[ShapeFlag[/** The shape will partake in collision in the physical simulation. */ "SIMULATION_SHAPE"] = 1] = "SIMULATION_SHAPE";
|
|
36
|
-
ShapeFlag[ShapeFlag[/** The shape will partake in scene queries (ray casts, overlap tests, sweeps, ...). */ "SCENE_QUERY_SHAPE"] = 2] = "SCENE_QUERY_SHAPE";
|
|
37
|
-
ShapeFlag[ShapeFlag[/** The shape is a trigger which can send reports whenever other shapes enter/leave its volume. */ "TRIGGER_SHAPE"] = 4] = "TRIGGER_SHAPE";
|
|
38
|
-
})(ShapeFlag || (ShapeFlag = {}));
|
|
39
39
|
/**
|
|
40
40
|
* Abstract class for collider shapes.
|
|
41
41
|
*/ var PhysXColliderShape = /*#__PURE__*/ function() {
|
|
@@ -133,25 +133,19 @@
|
|
|
133
133
|
};
|
|
134
134
|
return PhysXColliderShape;
|
|
135
135
|
}();
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
translation: new engine.Vector3(),
|
|
142
|
-
rotation: null
|
|
143
|
-
};
|
|
144
|
-
})();
|
|
136
|
+
PhysXColliderShape.halfSqrt = 0.70710678118655;
|
|
137
|
+
PhysXColliderShape.transform = {
|
|
138
|
+
translation: new engine.Vector3(),
|
|
139
|
+
rotation: null
|
|
140
|
+
};
|
|
145
141
|
|
|
146
142
|
/**
|
|
147
143
|
* Box collider shape in PhysX.
|
|
148
|
-
*/ var PhysXBoxColliderShape = /*#__PURE__*/ function(
|
|
149
|
-
_inherits(PhysXBoxColliderShape,
|
|
144
|
+
*/ var PhysXBoxColliderShape = /*#__PURE__*/ function(PhysXColliderShape) {
|
|
145
|
+
_inherits(PhysXBoxColliderShape, PhysXColliderShape);
|
|
150
146
|
function PhysXBoxColliderShape(physXPhysics, uniqueID, size, material) {
|
|
151
147
|
var _this;
|
|
152
|
-
_this =
|
|
153
|
-
/** @internal */ _this._halfSize = new engine.Vector3();
|
|
154
|
-
_this._sizeScale = new engine.Vector3(1, 1, 1);
|
|
148
|
+
_this = PhysXColliderShape.call(this, physXPhysics) || this, /** @internal */ _this._halfSize = new engine.Vector3(), _this._sizeScale = new engine.Vector3(1, 1, 1);
|
|
155
149
|
var halfSize = _this._halfSize;
|
|
156
150
|
halfSize.set(size.x * 0.5, size.y * 0.5, size.z * 0.5);
|
|
157
151
|
_this._pxGeometry = new physXPhysics._physX.PxBoxGeometry(halfSize.x, halfSize.y, halfSize.z);
|
|
@@ -174,7 +168,7 @@
|
|
|
174
168
|
/**
|
|
175
169
|
* {@inheritDoc IColliderShape.setWorldScale }
|
|
176
170
|
*/ _proto.setWorldScale = function setWorldScale(scale) {
|
|
177
|
-
|
|
171
|
+
PhysXColliderShape.prototype.setWorldScale.call(this, scale);
|
|
178
172
|
this._sizeScale.set(Math.abs(scale.x), Math.abs(scale.y), Math.abs(scale.z));
|
|
179
173
|
var tempExtents = PhysXBoxColliderShape._tempHalfExtents;
|
|
180
174
|
engine.Vector3.multiply(this._halfSize, this._sizeScale, tempExtents);
|
|
@@ -195,9 +189,7 @@
|
|
|
195
189
|
};
|
|
196
190
|
return PhysXBoxColliderShape;
|
|
197
191
|
}(PhysXColliderShape);
|
|
198
|
-
(
|
|
199
|
-
PhysXBoxColliderShape._tempHalfExtents = new engine.Vector3();
|
|
200
|
-
})();
|
|
192
|
+
PhysXBoxColliderShape._tempHalfExtents = new engine.Vector3();
|
|
201
193
|
|
|
202
194
|
/**
|
|
203
195
|
* Capsule collider shape in PhysX.
|
|
@@ -205,9 +197,7 @@
|
|
|
205
197
|
_inherits(PhysXCapsuleColliderShape, PhysXColliderShape1);
|
|
206
198
|
function PhysXCapsuleColliderShape(physXPhysics, uniqueID, radius, height, material) {
|
|
207
199
|
var _this;
|
|
208
|
-
_this = PhysXColliderShape1.call(this, physXPhysics) || this;
|
|
209
|
-
_this._upAxis = /** Up axis is Y. */ 1;
|
|
210
|
-
_this._sizeScale = new engine.Vector3(1, 1, 1);
|
|
200
|
+
_this = PhysXColliderShape1.call(this, physXPhysics) || this, _this._upAxis = 1, _this._sizeScale = new engine.Vector3(1, 1, 1);
|
|
211
201
|
_this._radius = radius;
|
|
212
202
|
_this._halfHeight = height * 0.5;
|
|
213
203
|
_this._axis = new engine.Quaternion(0, 0, PhysXColliderShape.halfSqrt, PhysXColliderShape.halfSqrt);
|
|
@@ -224,13 +214,13 @@
|
|
|
224
214
|
this._radius = value;
|
|
225
215
|
var sizeScale = this._sizeScale;
|
|
226
216
|
switch(this._upAxis){
|
|
227
|
-
case
|
|
217
|
+
case 0:
|
|
228
218
|
this._pxGeometry.radius = this._radius * Math.max(sizeScale.y, sizeScale.z);
|
|
229
219
|
break;
|
|
230
220
|
case 1:
|
|
231
221
|
this._pxGeometry.radius = this._radius * Math.max(sizeScale.x, sizeScale.z);
|
|
232
222
|
break;
|
|
233
|
-
case
|
|
223
|
+
case 2:
|
|
234
224
|
this._pxGeometry.radius = this._radius * Math.max(sizeScale.x, sizeScale.y);
|
|
235
225
|
break;
|
|
236
226
|
}
|
|
@@ -324,14 +314,6 @@
|
|
|
324
314
|
};
|
|
325
315
|
return PhysXCapsuleColliderShape;
|
|
326
316
|
}(PhysXColliderShape);
|
|
327
|
-
var /**
|
|
328
|
-
* The up axis of the collider shape.
|
|
329
|
-
*/ ColliderShapeUpAxis;
|
|
330
|
-
(function(ColliderShapeUpAxis) {
|
|
331
|
-
ColliderShapeUpAxis[ColliderShapeUpAxis["X"] = 0] = "X";
|
|
332
|
-
ColliderShapeUpAxis[ColliderShapeUpAxis["Y"] = 1] = "Y";
|
|
333
|
-
ColliderShapeUpAxis[ColliderShapeUpAxis["Z"] = 2] = "Z";
|
|
334
|
-
})(ColliderShapeUpAxis || (ColliderShapeUpAxis = {}));
|
|
335
317
|
|
|
336
318
|
/**
|
|
337
319
|
* Base class for character controllers.
|
|
@@ -451,9 +433,7 @@
|
|
|
451
433
|
};
|
|
452
434
|
return PhysXCharacterController;
|
|
453
435
|
}();
|
|
454
|
-
(
|
|
455
|
-
PhysXCharacterController._tempVec = new engine.Vector3();
|
|
456
|
-
})();
|
|
436
|
+
PhysXCharacterController._tempVec = new engine.Vector3();
|
|
457
437
|
|
|
458
438
|
/**
|
|
459
439
|
* Abstract class of physical collider.
|
|
@@ -499,27 +479,18 @@
|
|
|
499
479
|
};
|
|
500
480
|
return PhysXCollider;
|
|
501
481
|
}();
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
};
|
|
507
|
-
})();
|
|
482
|
+
PhysXCollider._tempTransform = {
|
|
483
|
+
translation: null,
|
|
484
|
+
rotation: null
|
|
485
|
+
};
|
|
508
486
|
|
|
509
|
-
var CollisionDetectionMode;
|
|
510
|
-
(function(CollisionDetectionMode) {
|
|
511
|
-
CollisionDetectionMode[CollisionDetectionMode[/** Continuous collision detection is off for this dynamic collider. */ "Discrete"] = 0] = "Discrete";
|
|
512
|
-
CollisionDetectionMode[CollisionDetectionMode[/** Continuous collision detection is on for colliding with static mesh geometry. */ "Continuous"] = 1] = "Continuous";
|
|
513
|
-
CollisionDetectionMode[CollisionDetectionMode[/** Continuous collision detection is on for colliding with static and dynamic geometry. */ "ContinuousDynamic"] = 2] = "ContinuousDynamic";
|
|
514
|
-
CollisionDetectionMode[CollisionDetectionMode[/** Speculative continuous collision detection is on for static and dynamic geometries */ "ContinuousSpeculative"] = 3] = "ContinuousSpeculative";
|
|
515
|
-
})(CollisionDetectionMode || (CollisionDetectionMode = {}));
|
|
516
487
|
/**
|
|
517
488
|
* A dynamic collider can act with self-defined movement or physical force
|
|
518
|
-
*/ var PhysXDynamicCollider = /*#__PURE__*/ function(
|
|
519
|
-
_inherits(PhysXDynamicCollider,
|
|
489
|
+
*/ var PhysXDynamicCollider = /*#__PURE__*/ function(PhysXCollider) {
|
|
490
|
+
_inherits(PhysXDynamicCollider, PhysXCollider);
|
|
520
491
|
function PhysXDynamicCollider(physXPhysics, position, rotation) {
|
|
521
492
|
var _this;
|
|
522
|
-
_this =
|
|
493
|
+
_this = PhysXCollider.call(this, physXPhysics) || this;
|
|
523
494
|
var transform = _this._transform(position, rotation);
|
|
524
495
|
_this._pxActor = physXPhysics._pxPhysics.createRigidDynamic(transform);
|
|
525
496
|
return _this;
|
|
@@ -662,12 +633,8 @@
|
|
|
662
633
|
};
|
|
663
634
|
return PhysXDynamicCollider;
|
|
664
635
|
}(PhysXCollider);
|
|
665
|
-
(
|
|
666
|
-
|
|
667
|
-
})();
|
|
668
|
-
(function() {
|
|
669
|
-
PhysXDynamicCollider._tempRotation = new engine.Quaternion();
|
|
670
|
-
})();
|
|
636
|
+
PhysXDynamicCollider._tempTranslation = new engine.Vector3();
|
|
637
|
+
PhysXDynamicCollider._tempRotation = new engine.Quaternion();
|
|
671
638
|
|
|
672
639
|
var PhysXPhysicsManager = function PhysXPhysicsManager() {
|
|
673
640
|
/** @internal */ this._eventMap = {};
|
|
@@ -716,15 +683,6 @@
|
|
|
716
683
|
};
|
|
717
684
|
return PhysXPhysicsMaterial;
|
|
718
685
|
}();
|
|
719
|
-
var /**
|
|
720
|
-
* Describes how physics materials of the colliding objects are combined.
|
|
721
|
-
*/ CombineMode;
|
|
722
|
-
(function(CombineMode) {
|
|
723
|
-
CombineMode[CombineMode[/** Averages the friction/bounce of the two colliding materials. */ "Average"] = 0] = "Average";
|
|
724
|
-
CombineMode[CombineMode[/** Uses the smaller friction/bounce of the two colliding materials. */ "Minimum"] = 1] = "Minimum";
|
|
725
|
-
CombineMode[CombineMode[/** Multiplies the friction/bounce of the two colliding materials. */ "Multiply"] = 2] = "Multiply";
|
|
726
|
-
CombineMode[CombineMode[/** Uses the larger friction/bounce of the two colliding materials. */ "Maximum"] = 3] = "Maximum";
|
|
727
|
-
})(CombineMode || (CombineMode = {}));
|
|
728
686
|
|
|
729
687
|
/**
|
|
730
688
|
* A manager is a collection of colliders and constraints which can interact.
|
|
@@ -919,31 +877,8 @@
|
|
|
919
877
|
};
|
|
920
878
|
return PhysXPhysicsScene;
|
|
921
879
|
}();
|
|
922
|
-
(
|
|
923
|
-
|
|
924
|
-
})();
|
|
925
|
-
(function() {
|
|
926
|
-
PhysXPhysicsScene._tempNormal = new engine.Vector3();
|
|
927
|
-
})();
|
|
928
|
-
var /**
|
|
929
|
-
* Filtering flags for scene queries.
|
|
930
|
-
*/ QueryFlag;
|
|
931
|
-
(function(QueryFlag) {
|
|
932
|
-
QueryFlag[QueryFlag["STATIC"] = 1] = "STATIC";
|
|
933
|
-
QueryFlag[QueryFlag["DYNAMIC"] = 2] = "DYNAMIC";
|
|
934
|
-
QueryFlag[QueryFlag["PRE_FILTER"] = 4] = "PRE_FILTER";
|
|
935
|
-
QueryFlag[QueryFlag["POST_FILTER"] = 8] = "POST_FILTER";
|
|
936
|
-
QueryFlag[QueryFlag["ANY_HIT"] = 16] = "ANY_HIT";
|
|
937
|
-
QueryFlag[QueryFlag["NO_BLOCK"] = 32] = "NO_BLOCK";
|
|
938
|
-
})(QueryFlag || (QueryFlag = {}));
|
|
939
|
-
var /**
|
|
940
|
-
* Physics state
|
|
941
|
-
*/ TriggerEventState;
|
|
942
|
-
(function(TriggerEventState) {
|
|
943
|
-
TriggerEventState[TriggerEventState["Enter"] = 0] = "Enter";
|
|
944
|
-
TriggerEventState[TriggerEventState["Stay"] = 1] = "Stay";
|
|
945
|
-
TriggerEventState[TriggerEventState["Exit"] = 2] = "Exit";
|
|
946
|
-
})(TriggerEventState || (TriggerEventState = {}));
|
|
880
|
+
PhysXPhysicsScene._tempPosition = new engine.Vector3();
|
|
881
|
+
PhysXPhysicsScene._tempNormal = new engine.Vector3();
|
|
947
882
|
/**
|
|
948
883
|
* Trigger event to store interactive object ids and state.
|
|
949
884
|
*/ var TriggerEvent = function TriggerEvent(index1, index2) {
|
|
@@ -954,11 +889,11 @@
|
|
|
954
889
|
/**
|
|
955
890
|
* A static collider component that will not move.
|
|
956
891
|
* @remarks Mostly used for object which always stays at the same place and never moves around.
|
|
957
|
-
*/ var PhysXStaticCollider = /*#__PURE__*/ function(
|
|
958
|
-
_inherits(PhysXStaticCollider,
|
|
892
|
+
*/ var PhysXStaticCollider = /*#__PURE__*/ function(PhysXCollider) {
|
|
893
|
+
_inherits(PhysXStaticCollider, PhysXCollider);
|
|
959
894
|
function PhysXStaticCollider(physXPhysics, position, rotation) {
|
|
960
895
|
var _this;
|
|
961
|
-
_this =
|
|
896
|
+
_this = PhysXCollider.call(this, physXPhysics) || this;
|
|
962
897
|
_this._pxActor = physXPhysics._pxPhysics.createRigidStatic(_this._transform(position, rotation));
|
|
963
898
|
return _this;
|
|
964
899
|
}
|
|
@@ -967,12 +902,12 @@
|
|
|
967
902
|
|
|
968
903
|
/**
|
|
969
904
|
* PhysX runtime mode.
|
|
970
|
-
*/
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
PhysXRuntimeMode
|
|
975
|
-
}
|
|
905
|
+
*/ var PhysXRuntimeMode = /*#__PURE__*/ function(PhysXRuntimeMode) {
|
|
906
|
+
/** Use webAssembly mode first, if WebAssembly mode is not supported, roll back to JavaScript mode. */ PhysXRuntimeMode[PhysXRuntimeMode["Auto"] = 0] = "Auto";
|
|
907
|
+
/** WebAssembly mode. */ PhysXRuntimeMode[PhysXRuntimeMode["WebAssembly"] = 1] = "WebAssembly";
|
|
908
|
+
/** JavaScript mode. */ PhysXRuntimeMode[PhysXRuntimeMode["JavaScript"] = 2] = "JavaScript";
|
|
909
|
+
return PhysXRuntimeMode;
|
|
910
|
+
}({});
|
|
976
911
|
|
|
977
912
|
/**
|
|
978
913
|
* a base interface providing common functionality for PhysX joints
|
|
@@ -987,8 +922,8 @@
|
|
|
987
922
|
/**
|
|
988
923
|
* {@inheritDoc IJoint.setConnectedCollider }
|
|
989
924
|
*/ _proto.setConnectedCollider = function setConnectedCollider(value) {
|
|
990
|
-
var
|
|
991
|
-
this._pxJoint.setActors((
|
|
925
|
+
var _this__collider;
|
|
926
|
+
this._pxJoint.setActors((value == null ? void 0 : value._pxActor) || null, ((_this__collider = this._collider) == null ? void 0 : _this__collider._pxActor) || null);
|
|
992
927
|
};
|
|
993
928
|
/**
|
|
994
929
|
* {@inheritDoc IJoint.setConnectedAnchor }
|
|
@@ -1038,15 +973,9 @@
|
|
|
1038
973
|
};
|
|
1039
974
|
return PhysXJoint;
|
|
1040
975
|
}();
|
|
1041
|
-
(
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
(function() {
|
|
1045
|
-
PhysXJoint._defaultVec = new engine.Vector3();
|
|
1046
|
-
})();
|
|
1047
|
-
(function() {
|
|
1048
|
-
PhysXJoint._defaultQuat = new engine.Quaternion();
|
|
1049
|
-
})();
|
|
976
|
+
PhysXJoint._xAxis = new engine.Vector3(1, 0, 0);
|
|
977
|
+
PhysXJoint._defaultVec = new engine.Vector3();
|
|
978
|
+
PhysXJoint._defaultQuat = new engine.Quaternion();
|
|
1050
979
|
|
|
1051
980
|
/**
|
|
1052
981
|
* A fixed joint permits no relative movement between two colliders. ie the bodies are glued together.
|
|
@@ -1068,9 +997,7 @@
|
|
|
1068
997
|
_inherits(PhysXHingeJoint, PhysXJoint1);
|
|
1069
998
|
function PhysXHingeJoint(physXPhysics, collider) {
|
|
1070
999
|
var _this;
|
|
1071
|
-
_this = PhysXJoint1.call(this, physXPhysics) || this;
|
|
1072
|
-
_this._axisRotationQuaternion = new engine.Quaternion();
|
|
1073
|
-
_this._swingOffset = new engine.Vector3();
|
|
1000
|
+
_this = PhysXJoint1.call(this, physXPhysics) || this, _this._axisRotationQuaternion = new engine.Quaternion(), _this._swingOffset = new engine.Vector3();
|
|
1074
1001
|
_this._collider = collider;
|
|
1075
1002
|
_this._pxJoint = physXPhysics._pxPhysics.createRevoluteJoint(null, PhysXJoint._defaultVec, PhysXJoint._defaultQuat, collider._pxActor, PhysXJoint._defaultVec, PhysXJoint._defaultQuat);
|
|
1076
1003
|
return _this;
|
|
@@ -1144,8 +1071,7 @@
|
|
|
1144
1071
|
_inherits(PhysXSpringJoint, PhysXJoint1);
|
|
1145
1072
|
function PhysXSpringJoint(physXPhysics, collider) {
|
|
1146
1073
|
var _this;
|
|
1147
|
-
_this = PhysXJoint1.call(this, physXPhysics) || this;
|
|
1148
|
-
_this._swingOffset = new engine.Vector3();
|
|
1074
|
+
_this = PhysXJoint1.call(this, physXPhysics) || this, _this._swingOffset = new engine.Vector3();
|
|
1149
1075
|
_this._collider = collider;
|
|
1150
1076
|
_this._pxJoint = physXPhysics._pxPhysics.createDistanceJoint(null, PhysXJoint._defaultVec, PhysXJoint._defaultQuat, collider._pxActor, PhysXJoint._defaultVec, PhysXJoint._defaultQuat);
|
|
1151
1077
|
_this._pxJoint.setDistanceJointFlag(2, true); // enable max distance;
|
|
@@ -1207,12 +1133,11 @@
|
|
|
1207
1133
|
|
|
1208
1134
|
/**
|
|
1209
1135
|
* Sphere collider shape in PhysX.
|
|
1210
|
-
*/ var PhysXSphereColliderShape = /*#__PURE__*/ function(
|
|
1211
|
-
_inherits(PhysXSphereColliderShape,
|
|
1136
|
+
*/ var PhysXSphereColliderShape = /*#__PURE__*/ function(PhysXColliderShape) {
|
|
1137
|
+
_inherits(PhysXSphereColliderShape, PhysXColliderShape);
|
|
1212
1138
|
function PhysXSphereColliderShape(physXPhysics, uniqueID, radius, material) {
|
|
1213
1139
|
var _this;
|
|
1214
|
-
_this =
|
|
1215
|
-
_this._maxScale = 1;
|
|
1140
|
+
_this = PhysXColliderShape.call(this, physXPhysics) || this, _this._maxScale = 1;
|
|
1216
1141
|
_this._radius = radius;
|
|
1217
1142
|
_this._pxGeometry = new physXPhysics._physX.PxSphereGeometry(_this._radius * _this._maxScale);
|
|
1218
1143
|
_this._initialize(material, uniqueID);
|
|
@@ -1230,7 +1155,7 @@
|
|
|
1230
1155
|
/**
|
|
1231
1156
|
* {@inheritDoc IColliderShape.setWorldScale }
|
|
1232
1157
|
*/ _proto.setWorldScale = function setWorldScale(scale) {
|
|
1233
|
-
|
|
1158
|
+
PhysXColliderShape.prototype.setWorldScale.call(this, scale);
|
|
1234
1159
|
this._maxScale = Math.max(Math.abs(scale.x), Math.abs(scale.y), Math.abs(scale.z));
|
|
1235
1160
|
this._pxGeometry.radius = this._radius * this._maxScale;
|
|
1236
1161
|
this._pxShape.setGeometry(this._pxGeometry);
|
|
@@ -1242,7 +1167,7 @@
|
|
|
1242
1167
|
* PhysX object creation.
|
|
1243
1168
|
*/ var PhysXPhysics = /*#__PURE__*/ function() {
|
|
1244
1169
|
function PhysXPhysics(runtimeMode) {
|
|
1245
|
-
if (runtimeMode === void 0) runtimeMode =
|
|
1170
|
+
if (runtimeMode === void 0) runtimeMode = PhysXRuntimeMode.Auto;
|
|
1246
1171
|
this._initializeState = 0;
|
|
1247
1172
|
this._runTimeMode = runtimeMode;
|
|
1248
1173
|
}
|
|
@@ -1265,10 +1190,10 @@
|
|
|
1265
1190
|
script.async = true;
|
|
1266
1191
|
script.onload = resolve;
|
|
1267
1192
|
script.onerror = reject;
|
|
1268
|
-
if (runtimeMode ==
|
|
1193
|
+
if (runtimeMode == PhysXRuntimeMode.Auto) {
|
|
1269
1194
|
var supported = function() {
|
|
1270
1195
|
try {
|
|
1271
|
-
if (typeof WebAssembly === "object" && typeof WebAssembly.instantiate === "function") {
|
|
1196
|
+
if ((typeof WebAssembly === "undefined" ? "undefined" : _type_of(WebAssembly)) === "object" && typeof WebAssembly.instantiate === "function") {
|
|
1272
1197
|
var module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
|
|
1273
1198
|
if (_instanceof(module, WebAssembly.Module)) return _instanceof(new WebAssembly.Instance(module), WebAssembly.Instance);
|
|
1274
1199
|
}
|
|
@@ -1276,14 +1201,14 @@
|
|
|
1276
1201
|
return false;
|
|
1277
1202
|
}();
|
|
1278
1203
|
if (supported) {
|
|
1279
|
-
runtimeMode =
|
|
1204
|
+
runtimeMode = PhysXRuntimeMode.WebAssembly;
|
|
1280
1205
|
} else {
|
|
1281
|
-
runtimeMode =
|
|
1206
|
+
runtimeMode = PhysXRuntimeMode.JavaScript;
|
|
1282
1207
|
}
|
|
1283
1208
|
}
|
|
1284
|
-
if (runtimeMode ==
|
|
1209
|
+
if (runtimeMode == PhysXRuntimeMode.JavaScript) {
|
|
1285
1210
|
script.src = "https://mdn.alipayobjects.com/rms/afts/file/A*rnDeR58NNGoAAAAAAAAAAAAAARQnAQ/physx.release.js.js";
|
|
1286
|
-
} else if (runtimeMode ==
|
|
1211
|
+
} else if (runtimeMode == PhysXRuntimeMode.WebAssembly) {
|
|
1287
1212
|
script.src = "https://mdn.alipayobjects.com/rms/afts/file/A*nA97QLQehRMAAAAAAAAAAAAAARQnAQ/physx.release.js";
|
|
1288
1213
|
}
|
|
1289
1214
|
});
|
|
@@ -1390,18 +1315,13 @@
|
|
|
1390
1315
|
};
|
|
1391
1316
|
return PhysXPhysics;
|
|
1392
1317
|
}();
|
|
1393
|
-
var InitializeState;
|
|
1394
|
-
(function(InitializeState) {
|
|
1395
|
-
InitializeState[InitializeState["Uninitialized"] = 0] = "Uninitialized";
|
|
1396
|
-
InitializeState[InitializeState["Initializing"] = 1] = "Initializing";
|
|
1397
|
-
InitializeState[InitializeState["Initialized"] = 2] = "Initialized";
|
|
1398
|
-
})(InitializeState || (InitializeState = {}));
|
|
1399
1318
|
|
|
1400
1319
|
//@ts-ignore
|
|
1401
|
-
var version = "1.
|
|
1320
|
+
var version = "1.4.0-alpha.0";
|
|
1402
1321
|
console.log("Galacean PhysX version: " + version);
|
|
1403
1322
|
|
|
1404
1323
|
exports.PhysXPhysics = PhysXPhysics;
|
|
1324
|
+
exports.PhysXRuntimeMode = PhysXRuntimeMode;
|
|
1405
1325
|
exports.version = version;
|
|
1406
1326
|
|
|
1407
1327
|
Object.defineProperty(exports, '__esModule', { value: true });
|