@galacean/engine-physics-physx 1.3.10 → 1.3.11
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 +12 -59
- 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 +12 -59
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +12 -59
- package/dist/module.js +11 -58
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/DisorderedArray.d.ts +0 -18
package/dist/browser.js
CHANGED
|
@@ -30,52 +30,6 @@
|
|
|
30
30
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* High-performance unordered array, delete uses exchange method to improve performance, internal capacity only increases.
|
|
35
|
-
*/ var DisorderedArray = /*#__PURE__*/ function() {
|
|
36
|
-
function DisorderedArray(count) {
|
|
37
|
-
if (count === void 0) count = 0;
|
|
38
|
-
this.length = 0;
|
|
39
|
-
this._elements = new Array(count);
|
|
40
|
-
}
|
|
41
|
-
var _proto = DisorderedArray.prototype;
|
|
42
|
-
_proto.add = function add(element) {
|
|
43
|
-
if (this.length === this._elements.length) this._elements.push(element);
|
|
44
|
-
else this._elements[this.length] = element;
|
|
45
|
-
this.length++;
|
|
46
|
-
};
|
|
47
|
-
_proto.delete = function _delete(element) {
|
|
48
|
-
//TODO: It can be optimized for custom binary search and other algorithms, currently this._elements>=this.length wastes performance.
|
|
49
|
-
var index = this._elements.indexOf(element);
|
|
50
|
-
this.deleteByIndex(index);
|
|
51
|
-
};
|
|
52
|
-
_proto.get = function get(index) {
|
|
53
|
-
if (index >= this.length) {
|
|
54
|
-
throw "Index is out of range.";
|
|
55
|
-
}
|
|
56
|
-
return this._elements[index];
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
* @param index
|
|
61
|
-
* @returns The replaced item is used to reset its index.
|
|
62
|
-
*/ _proto.deleteByIndex = function deleteByIndex(index) {
|
|
63
|
-
var elements = this._elements;
|
|
64
|
-
var end = null;
|
|
65
|
-
var lastIndex = this.length - 1;
|
|
66
|
-
if (index !== lastIndex) {
|
|
67
|
-
end = elements[lastIndex];
|
|
68
|
-
elements[index] = end;
|
|
69
|
-
}
|
|
70
|
-
this.length--;
|
|
71
|
-
return end;
|
|
72
|
-
};
|
|
73
|
-
_proto.garbageCollection = function garbageCollection() {
|
|
74
|
-
this._elements.length = this.length;
|
|
75
|
-
};
|
|
76
|
-
return DisorderedArray;
|
|
77
|
-
}();
|
|
78
|
-
|
|
79
33
|
var ShapeFlag;
|
|
80
34
|
(function(ShapeFlag) {
|
|
81
35
|
ShapeFlag[ShapeFlag[/** The shape will partake in collision in the physical simulation. */ "SIMULATION_SHAPE"] = 1] = "SIMULATION_SHAPE";
|
|
@@ -86,7 +40,7 @@
|
|
|
86
40
|
* Abstract class for collider shapes.
|
|
87
41
|
*/ var PhysXColliderShape = /*#__PURE__*/ function() {
|
|
88
42
|
function PhysXColliderShape(physXPhysics) {
|
|
89
|
-
/** @internal */ this._controllers = new DisorderedArray();
|
|
43
|
+
/** @internal */ this._controllers = new engine.DisorderedArray();
|
|
90
44
|
this._worldScale = new engine.Vector3(1, 1, 1);
|
|
91
45
|
this._position = new engine.Vector3();
|
|
92
46
|
this._rotation = null;
|
|
@@ -778,7 +732,7 @@
|
|
|
778
732
|
function PhysXPhysicsScene(physXPhysics, physicsManager, onContactEnter, onContactExit, onContactStay, onTriggerEnter, onTriggerExit, onTriggerStay) {
|
|
779
733
|
var _this = this;
|
|
780
734
|
/** @internal */ this._pxControllerManager = null;
|
|
781
|
-
this._currentEvents = new DisorderedArray();
|
|
735
|
+
this._currentEvents = new engine.DisorderedArray();
|
|
782
736
|
this._eventPool = [];
|
|
783
737
|
this._physXPhysics = physXPhysics;
|
|
784
738
|
this._physXManager = physicsManager;
|
|
@@ -843,8 +797,7 @@
|
|
|
843
797
|
var _this = this, eventPool = _this._eventPool, currentEvents = _this._currentEvents;
|
|
844
798
|
var id = colliderShape._id;
|
|
845
799
|
var _this__physXManager = this._physXManager, eventMap = _this__physXManager._eventMap;
|
|
846
|
-
|
|
847
|
-
var event = currentEvents.get(i);
|
|
800
|
+
currentEvents.forEach(function(event, i) {
|
|
848
801
|
if (event.index1 == id) {
|
|
849
802
|
currentEvents.deleteByIndex(i);
|
|
850
803
|
eventPool.push(event);
|
|
@@ -854,7 +807,7 @@
|
|
|
854
807
|
// If the shape is big index, should clear from the small index shape subMap
|
|
855
808
|
eventMap[event.index1][id] = undefined;
|
|
856
809
|
}
|
|
857
|
-
}
|
|
810
|
+
});
|
|
858
811
|
delete eventMap[id];
|
|
859
812
|
};
|
|
860
813
|
/**
|
|
@@ -949,20 +902,20 @@
|
|
|
949
902
|
return event;
|
|
950
903
|
};
|
|
951
904
|
_proto._fireEvent = function _fireEvent() {
|
|
952
|
-
var _this = this
|
|
953
|
-
|
|
954
|
-
|
|
905
|
+
var _this = this;
|
|
906
|
+
var _this1 = this, eventPool = _this1._eventPool, currentEvents = _this1._currentEvents;
|
|
907
|
+
currentEvents.forEach(function(event, i) {
|
|
955
908
|
if (event.state == 0) {
|
|
956
|
-
|
|
909
|
+
_this._onTriggerEnter(event.index1, event.index2);
|
|
957
910
|
event.state = 1;
|
|
958
911
|
} else if (event.state == 1) {
|
|
959
|
-
|
|
912
|
+
_this._onTriggerStay(event.index1, event.index2);
|
|
960
913
|
} else if (event.state == 2) {
|
|
961
|
-
this._onTriggerExit(event.index1, event.index2);
|
|
962
914
|
currentEvents.deleteByIndex(i);
|
|
915
|
+
_this._onTriggerExit(event.index1, event.index2);
|
|
963
916
|
eventPool.push(event);
|
|
964
917
|
}
|
|
965
|
-
}
|
|
918
|
+
});
|
|
966
919
|
};
|
|
967
920
|
return PhysXPhysicsScene;
|
|
968
921
|
}();
|
|
@@ -1445,7 +1398,7 @@
|
|
|
1445
1398
|
})(InitializeState || (InitializeState = {}));
|
|
1446
1399
|
|
|
1447
1400
|
//@ts-ignore
|
|
1448
|
-
var version = "1.3.
|
|
1401
|
+
var version = "1.3.11";
|
|
1449
1402
|
console.log("Galacean PhysX version: " + version);
|
|
1450
1403
|
|
|
1451
1404
|
exports.PhysXPhysics = PhysXPhysics;
|