@galacean/engine-core 1.4.0-beta.2 → 1.4.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/main.js +70 -46
- package/dist/main.js.map +1 -1
- package/dist/module.js +70 -46
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/physics/ContactPoint.d.ts +1 -1
- package/types/physics/joint/HingeJoint.d.ts +2 -1
- package/types/physics/joint/Joint.d.ts +1 -1
- package/types/ui/UIUtils.d.ts +3 -1
package/dist/main.js
CHANGED
|
@@ -5865,8 +5865,6 @@ exports.Camera = /*#__PURE__*/ function(Component) {
|
|
|
5865
5865
|
//@ts-ignore
|
|
5866
5866
|
this._viewport._onValueChanged = null;
|
|
5867
5867
|
this.engine.canvas._sizeUpdateFlagManager.removeListener(this._onPixelViewportChanged);
|
|
5868
|
-
this._updateFlagManager = null;
|
|
5869
|
-
this._entity = null;
|
|
5870
5868
|
this._globalShaderMacro = null;
|
|
5871
5869
|
this._frustum = null;
|
|
5872
5870
|
this._renderPipeline = null;
|
|
@@ -10263,7 +10261,6 @@ exports.Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10263
10261
|
var material = materials[i];
|
|
10264
10262
|
material && this._addResourceReferCount(material, -1);
|
|
10265
10263
|
}
|
|
10266
|
-
this._entity = null;
|
|
10267
10264
|
this._globalShaderMacro = null;
|
|
10268
10265
|
this._bounds = null;
|
|
10269
10266
|
this._materials = null;
|
|
@@ -17620,7 +17617,6 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17620
17617
|
this._setParent(null);
|
|
17621
17618
|
}
|
|
17622
17619
|
this.isActive = false;
|
|
17623
|
-
this._updateFlagManager = null;
|
|
17624
17620
|
};
|
|
17625
17621
|
/**
|
|
17626
17622
|
* @internal
|
|
@@ -20765,7 +20761,7 @@ exports.Collider = __decorate([
|
|
|
20765
20761
|
* Describes a contact point where the collision occurs.
|
|
20766
20762
|
*/ var ContactPoint = function ContactPoint() {
|
|
20767
20763
|
/** The position of the contact point between the shapes, in world space. */ this.position = new engineMath.Vector3();
|
|
20768
|
-
/** The normal of the contacting surfaces at the contact point. The normal direction points from the
|
|
20764
|
+
/** The normal of the contacting surfaces at the contact point. The normal direction points from the other shape to the self shape. */ this.normal = new engineMath.Vector3();
|
|
20769
20765
|
/** The impulse applied at the contact point, in world space. Divide by the simulation time step to get a force value. */ this.impulse = new engineMath.Vector3();
|
|
20770
20766
|
};
|
|
20771
20767
|
|
|
@@ -20783,7 +20779,8 @@ exports.Collider = __decorate([
|
|
|
20783
20779
|
* You need to obtain the actual number of contact points from the function's return value.
|
|
20784
20780
|
*/ _proto.getContacts = function getContacts(outContacts) {
|
|
20785
20781
|
var nativeCollision = this._nativeCollision;
|
|
20786
|
-
var
|
|
20782
|
+
var smallerShapeId = Math.min(nativeCollision.shape0Id, nativeCollision.shape1Id);
|
|
20783
|
+
var factor = this.shape.id === smallerShapeId ? 1 : -1;
|
|
20787
20784
|
var nativeContactPoints = nativeCollision.getContacts();
|
|
20788
20785
|
var length = nativeContactPoints.size();
|
|
20789
20786
|
for(var i = 0; i < length; i++){
|
|
@@ -21844,9 +21841,9 @@ exports.Joint = /*#__PURE__*/ function(Component) {
|
|
|
21844
21841
|
_this = Component.call(this, entity) || this, _this._colliderInfo = new JointColliderInfo(), _this._connectedColliderInfo = new JointColliderInfo(), _this._force = Infinity, _this._torque = Infinity, _this._automaticConnectedAnchor = true;
|
|
21845
21842
|
//@ts-ignore
|
|
21846
21843
|
_this._colliderInfo.anchor._onValueChanged = _this._updateActualAnchor.bind(_this, 1);
|
|
21847
|
-
_this.
|
|
21844
|
+
_this._handleConnectedAnchorChanged = _this._handleConnectedAnchorChanged.bind(_this);
|
|
21848
21845
|
//@ts-ignore
|
|
21849
|
-
_this._connectedColliderInfo.anchor._onValueChanged = _this.
|
|
21846
|
+
_this._connectedColliderInfo.anchor._onValueChanged = _this._handleConnectedAnchorChanged.bind(_this);
|
|
21850
21847
|
_this._onSelfTransformChanged = _this._onSelfTransformChanged.bind(_this);
|
|
21851
21848
|
_this._onConnectedTransformChanged = _this._onConnectedTransformChanged.bind(_this);
|
|
21852
21849
|
// @ts-ignore
|
|
@@ -21892,6 +21889,8 @@ exports.Joint = /*#__PURE__*/ function(Component) {
|
|
|
21892
21889
|
var connectedAnchor = connectedColliderInfo.anchor;
|
|
21893
21890
|
var connectedActualAnchor = connectedColliderInfo.actualAnchor;
|
|
21894
21891
|
var connectedCollider = connectedColliderInfo.collider;
|
|
21892
|
+
// @ts-ignore
|
|
21893
|
+
connectedAnchor._onValueChanged = null;
|
|
21895
21894
|
if (connectedCollider) {
|
|
21896
21895
|
var _connectedCollider_entity_transform = connectedCollider.entity.transform, connectedPos = _connectedCollider_entity_transform.worldPosition, connectedWorldScale = _connectedCollider_entity_transform.lossyWorldScale;
|
|
21897
21896
|
engineMath.Vector3.subtract(selfPos, connectedPos, Joint._tempVector3);
|
|
@@ -21901,6 +21900,16 @@ exports.Joint = /*#__PURE__*/ function(Component) {
|
|
|
21901
21900
|
engineMath.Vector3.add(selfPos, selfActualAnchor, connectedActualAnchor);
|
|
21902
21901
|
connectedAnchor.copyFrom(connectedActualAnchor);
|
|
21903
21902
|
}
|
|
21903
|
+
// @ts-ignore
|
|
21904
|
+
connectedAnchor._onValueChanged = this._handleConnectedAnchorChanged;
|
|
21905
|
+
this._updateActualAnchor(2);
|
|
21906
|
+
};
|
|
21907
|
+
_proto._handleConnectedAnchorChanged = function _handleConnectedAnchorChanged() {
|
|
21908
|
+
if (this._automaticConnectedAnchor) {
|
|
21909
|
+
console.warn("Cannot set connectedAnchor when automaticConnectedAnchor is true.");
|
|
21910
|
+
} else {
|
|
21911
|
+
this._updateActualAnchor(2);
|
|
21912
|
+
}
|
|
21904
21913
|
};
|
|
21905
21914
|
_proto._onSelfTransformChanged = function _onSelfTransformChanged(type) {
|
|
21906
21915
|
if (type & TransformModifyFlags.WorldScale) {
|
|
@@ -21980,25 +21989,12 @@ exports.Joint = /*#__PURE__*/ function(Component) {
|
|
|
21980
21989
|
* @remarks If connectedCollider is set, this anchor is relative offset, or the anchor is world position.
|
|
21981
21990
|
* The connectedAnchor is automatically calculated, if you want to set it manually, please set automaticConnectedAnchor to false
|
|
21982
21991
|
*/ function get() {
|
|
21983
|
-
|
|
21984
|
-
if (this._automaticConnectedAnchor) {
|
|
21985
|
-
//@ts-ignore
|
|
21986
|
-
connectedColliderAnchor._onValueChanged = null;
|
|
21987
|
-
this._calculateConnectedAnchor();
|
|
21988
|
-
//@ts-ignore
|
|
21989
|
-
connectedColliderAnchor._onValueChanged = this._updateConnectedActualAnchor;
|
|
21990
|
-
}
|
|
21991
|
-
return connectedColliderAnchor;
|
|
21992
|
+
return this._connectedColliderInfo.anchor;
|
|
21992
21993
|
},
|
|
21993
21994
|
set: function set(value) {
|
|
21994
|
-
if (this._automaticConnectedAnchor) {
|
|
21995
|
-
console.warn("Cannot set connectedAnchor when automaticConnectedAnchor is true.");
|
|
21996
|
-
return;
|
|
21997
|
-
}
|
|
21998
21995
|
var connectedAnchor = this._connectedColliderInfo.anchor;
|
|
21999
21996
|
if (value !== connectedAnchor) {
|
|
22000
21997
|
connectedAnchor.copyFrom(value);
|
|
22001
|
-
this._updateActualAnchor(2);
|
|
22002
21998
|
}
|
|
22003
21999
|
}
|
|
22004
22000
|
},
|
|
@@ -22119,7 +22115,7 @@ __decorate([
|
|
|
22119
22115
|
], exports.Joint.prototype, "_nativeJoint", void 0);
|
|
22120
22116
|
__decorate([
|
|
22121
22117
|
ignoreClone
|
|
22122
|
-
], exports.Joint.prototype, "
|
|
22118
|
+
], exports.Joint.prototype, "_handleConnectedAnchorChanged", null);
|
|
22123
22119
|
__decorate([
|
|
22124
22120
|
ignoreClone
|
|
22125
22121
|
], exports.Joint.prototype, "_onSelfTransformChanged", null);
|
|
@@ -22181,6 +22177,9 @@ __decorate([
|
|
|
22181
22177
|
_this = Joint.call(this, entity) || this, _this._axis = new engineMath.Vector3(1, 0, 0), _this._hingeFlags = HingeJointFlag.None, _this._useSpring = false, _this._angle = 0, _this._velocity = 0;
|
|
22182
22178
|
_this._onMotorChanged = _this._onMotorChanged.bind(_this);
|
|
22183
22179
|
_this._onLimitsChanged = _this._onLimitsChanged.bind(_this);
|
|
22180
|
+
_this._onAxisChanged = _this._onAxisChanged.bind(_this);
|
|
22181
|
+
//@ts-ignore
|
|
22182
|
+
_this._axis._onValueChanged = _this._onAxisChanged;
|
|
22184
22183
|
return _this;
|
|
22185
22184
|
}
|
|
22186
22185
|
var _proto = HingeJoint.prototype;
|
|
@@ -22229,20 +22228,27 @@ __decorate([
|
|
|
22229
22228
|
}
|
|
22230
22229
|
}
|
|
22231
22230
|
};
|
|
22231
|
+
_proto._onAxisChanged = function _onAxisChanged() {
|
|
22232
|
+
var _this__nativeJoint;
|
|
22233
|
+
//@ts-ignore
|
|
22234
|
+
this._axis._onValueChanged = null;
|
|
22235
|
+
this._axis.normalize();
|
|
22236
|
+
(_this__nativeJoint = this._nativeJoint) == null ? void 0 : _this__nativeJoint.setAxis(this._axis);
|
|
22237
|
+
//@ts-ignore
|
|
22238
|
+
this._axis._onValueChanged = this._onAxisChanged;
|
|
22239
|
+
};
|
|
22232
22240
|
_create_class(HingeJoint, [
|
|
22233
22241
|
{
|
|
22234
22242
|
key: "axis",
|
|
22235
22243
|
get: /**
|
|
22236
|
-
* The
|
|
22244
|
+
* The Direction of the axis around which the hingeJoint.
|
|
22237
22245
|
*/ function get() {
|
|
22238
22246
|
return this._axis;
|
|
22239
22247
|
},
|
|
22240
22248
|
set: function set(value) {
|
|
22241
22249
|
var axis = this._axis;
|
|
22242
22250
|
if (value !== axis) {
|
|
22243
|
-
var _this__nativeJoint;
|
|
22244
22251
|
axis.copyFrom(value);
|
|
22245
|
-
(_this__nativeJoint = this._nativeJoint) == null ? void 0 : _this__nativeJoint.setAxis(axis);
|
|
22246
22252
|
}
|
|
22247
22253
|
}
|
|
22248
22254
|
},
|
|
@@ -22366,6 +22372,9 @@ __decorate([
|
|
|
22366
22372
|
__decorate([
|
|
22367
22373
|
ignoreClone
|
|
22368
22374
|
], HingeJoint.prototype, "_onLimitsChanged", null);
|
|
22375
|
+
__decorate([
|
|
22376
|
+
ignoreClone
|
|
22377
|
+
], HingeJoint.prototype, "_onAxisChanged", null);
|
|
22369
22378
|
|
|
22370
22379
|
/**
|
|
22371
22380
|
* A joint that maintains an upper or lower bound (or both) on the distance between two points on different objects.
|
|
@@ -23364,6 +23373,8 @@ PointerEventEmitter._tempRay = new engineMath.Ray();
|
|
|
23364
23373
|
var currY = (latestEvent.clientY - top) * heightPixelRatio;
|
|
23365
23374
|
pointer.deltaPosition.set(currX - position.x, currY - position.y);
|
|
23366
23375
|
position.set(currX, currY);
|
|
23376
|
+
pointer.button = _pointerDec2BinMap[latestEvent.button] || PointerButton.None;
|
|
23377
|
+
pointer.pressedButtons = latestEvent.buttons;
|
|
23367
23378
|
for(var i = 0; i < length; i++){
|
|
23368
23379
|
var event = events[i];
|
|
23369
23380
|
switch(event.type){
|
|
@@ -24586,11 +24597,16 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
|
|
|
24586
24597
|
|
|
24587
24598
|
var UIUtils = /*#__PURE__*/ function() {
|
|
24588
24599
|
function UIUtils() {}
|
|
24589
|
-
UIUtils.renderOverlay = function renderOverlay(engine, uiCanvases) {
|
|
24600
|
+
UIUtils.renderOverlay = function renderOverlay(engine, scene, uiCanvases) {
|
|
24601
|
+
var canvas = engine.canvas, rhi = engine._hardwareRenderer, renderContext = engine._renderContext, batcherManager = engine._batcherManager;
|
|
24590
24602
|
var uiRenderQueue = this._renderQueue || (this._renderQueue = new RenderQueue(RenderQueueType.Transparent));
|
|
24591
24603
|
var virtualCamera = this._virtualCamera || (this._virtualCamera = new VirtualCamera());
|
|
24592
24604
|
var viewport = this._viewport || (this._viewport = new engineMath.Vector4(0, 0, 1, 1));
|
|
24593
|
-
|
|
24605
|
+
// @ts-ignore
|
|
24606
|
+
var camera = this._overlayCamera || (this._overlayCamera = new OverlayCamera());
|
|
24607
|
+
camera.engine = engine;
|
|
24608
|
+
camera.scene = scene;
|
|
24609
|
+
renderContext.camera = camera;
|
|
24594
24610
|
var _virtualCamera_projectionMatrix = virtualCamera.projectionMatrix, projectE = _virtualCamera_projectionMatrix.elements;
|
|
24595
24611
|
var _virtualCamera_viewMatrix = virtualCamera.viewMatrix, viewE = _virtualCamera_viewMatrix.elements;
|
|
24596
24612
|
projectE[0] = 2 / canvas.width, projectE[5] = 2 / canvas.height, projectE[10] = 0;
|
|
@@ -24598,8 +24614,8 @@ var UIUtils = /*#__PURE__*/ function() {
|
|
|
24598
24614
|
for(var i = 0, n = uiCanvases.length; i < n; i++){
|
|
24599
24615
|
var uiCanvas = uiCanvases.get(i);
|
|
24600
24616
|
if (uiCanvas) {
|
|
24601
|
-
var
|
|
24602
|
-
viewE[12] = -
|
|
24617
|
+
var position = uiCanvas.entity.transform.position;
|
|
24618
|
+
viewE[12] = -position.x, viewE[13] = -position.y;
|
|
24603
24619
|
engineMath.Matrix.multiply(virtualCamera.projectionMatrix, virtualCamera.viewMatrix, virtualCamera.viewProjectionMatrix);
|
|
24604
24620
|
renderContext.applyVirtualCamera(virtualCamera, false);
|
|
24605
24621
|
renderContext.rendererUpdateFlag |= ContextRendererUpdateFlag.ProjectionMatrix;
|
|
@@ -24615,6 +24631,14 @@ var UIUtils = /*#__PURE__*/ function() {
|
|
|
24615
24631
|
};
|
|
24616
24632
|
return UIUtils;
|
|
24617
24633
|
}();
|
|
24634
|
+
var OverlayCamera = function OverlayCamera() {
|
|
24635
|
+
// @ts-ignore
|
|
24636
|
+
this.instanceId = ++EngineObject._instanceIdCounter;
|
|
24637
|
+
this.shaderData = new ShaderData(ShaderDataGroup.Camera);
|
|
24638
|
+
this.enableFrustumCulling = true;
|
|
24639
|
+
this.cullingMask = Layer.Everything;
|
|
24640
|
+
this._globalShaderMacro = new ShaderMacroCollection();
|
|
24641
|
+
};
|
|
24618
24642
|
|
|
24619
24643
|
/**
|
|
24620
24644
|
* XRManager located in the main package, its implementation logic is XRManagerExtended in the sub-package engine-xr.
|
|
@@ -24941,25 +24965,25 @@ ShaderPool.init();
|
|
|
24941
24965
|
var cameras = componentsManager._activeCameras;
|
|
24942
24966
|
if (cameras.length === 0) {
|
|
24943
24967
|
Logger.debug("No active camera in scene.");
|
|
24944
|
-
|
|
24945
|
-
|
|
24946
|
-
|
|
24947
|
-
|
|
24948
|
-
|
|
24949
|
-
|
|
24950
|
-
|
|
24951
|
-
|
|
24952
|
-
|
|
24953
|
-
|
|
24954
|
-
|
|
24955
|
-
}
|
|
24956
|
-
|
|
24957
|
-
|
|
24958
|
-
}
|
|
24968
|
+
} else {
|
|
24969
|
+
cameras.forEach(function(camera) {
|
|
24970
|
+
componentsManager.callCameraOnBeginRender(camera);
|
|
24971
|
+
// Update post process manager
|
|
24972
|
+
scene.postProcessManager._update(camera);
|
|
24973
|
+
camera.render();
|
|
24974
|
+
componentsManager.callCameraOnEndRender(camera);
|
|
24975
|
+
// Temp solution for webgl implement bug
|
|
24976
|
+
if (_this1._hardwareRenderer._options._forceFlush) {
|
|
24977
|
+
_this1._hardwareRenderer.flush();
|
|
24978
|
+
}
|
|
24979
|
+
}, function(camera, index) {
|
|
24980
|
+
camera._cameraIndex = index;
|
|
24981
|
+
});
|
|
24982
|
+
}
|
|
24959
24983
|
var uiCanvas = componentsManager._overlayCanvases;
|
|
24960
24984
|
if (uiCanvas.length > 0) {
|
|
24961
24985
|
componentsManager.sortOverlayUICanvases();
|
|
24962
|
-
UIUtils.renderOverlay(_this, uiCanvas);
|
|
24986
|
+
UIUtils.renderOverlay(_this, scene, uiCanvas);
|
|
24963
24987
|
}
|
|
24964
24988
|
};
|
|
24965
24989
|
var _this1 = this;
|