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