@galacean/engine 1.1.0-beta.0 → 1.1.0-beta.10
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 +1076 -645
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -5511,15 +5511,16 @@
|
|
|
5511
5511
|
break;
|
|
5512
5512
|
case Array:
|
|
5513
5513
|
var targetPropertyA = target[k];
|
|
5514
|
-
var
|
|
5514
|
+
var length = sourceProperty.length;
|
|
5515
5515
|
if (targetPropertyA == null) {
|
|
5516
|
-
target[k] = targetPropertyA = new Array(
|
|
5516
|
+
target[k] = targetPropertyA = new Array(length);
|
|
5517
5517
|
} else {
|
|
5518
|
-
targetPropertyA.length =
|
|
5518
|
+
targetPropertyA.length = length;
|
|
5519
5519
|
}
|
|
5520
|
-
for(var i = 0; i <
|
|
5520
|
+
for(var i = 0; i < length; i++){
|
|
5521
5521
|
CloneManager.cloneProperty(sourceProperty, targetPropertyA, i, cloneMode);
|
|
5522
5522
|
}
|
|
5523
|
+
break;
|
|
5523
5524
|
default:
|
|
5524
5525
|
var _target, _k;
|
|
5525
5526
|
var targetOProperty = (_target = target)[_k = k] || (_target[_k] = new sourceProperty.constructor());
|
|
@@ -6238,7 +6239,7 @@
|
|
|
6238
6239
|
/**
|
|
6239
6240
|
* Two-dimensional texture array.
|
|
6240
6241
|
*/ var Texture2DArray = /*#__PURE__*/ function(Texture1) {
|
|
6241
|
-
var Texture2DArray = function Texture2DArray(engine, width, height,
|
|
6242
|
+
var Texture2DArray = function Texture2DArray(engine, width, height, length, format, mipmap) {
|
|
6242
6243
|
if (format === void 0) format = exports.TextureFormat.R8G8B8A8;
|
|
6243
6244
|
if (mipmap === void 0) mipmap = true;
|
|
6244
6245
|
var _this;
|
|
@@ -6246,7 +6247,7 @@
|
|
|
6246
6247
|
_this._mipmap = mipmap;
|
|
6247
6248
|
_this._width = width;
|
|
6248
6249
|
_this._height = height;
|
|
6249
|
-
_this._length =
|
|
6250
|
+
_this._length = length;
|
|
6250
6251
|
_this._format = format;
|
|
6251
6252
|
_this._mipmapCount = _this._getMipmapCount();
|
|
6252
6253
|
_this._platformTexture = engine._hardwareRenderer.createPlatformTexture2DArray(_assert_this_initialized(_this));
|
|
@@ -6267,11 +6268,11 @@
|
|
|
6267
6268
|
* @param width - Data width. if it's empty, width is the width corresponding to mipLevel minus x , width corresponding to mipLevel is Math.max(1, this.width >> mipLevel)
|
|
6268
6269
|
* @param height - Data height. if it's empty, height is the height corresponding to mipLevel minus y , height corresponding to mipLevel is Math.max(1, this.height >> mipLevel)
|
|
6269
6270
|
* @param length - Data length. if it's empty, length is the length of Texture2DArray.length
|
|
6270
|
-
*/ _proto.setPixelBuffer = function setPixelBuffer(offsetIndex, colorBuffer, mipLevel, x, y, width, height,
|
|
6271
|
+
*/ _proto.setPixelBuffer = function setPixelBuffer(offsetIndex, colorBuffer, mipLevel, x, y, width, height, length) {
|
|
6271
6272
|
if (mipLevel === void 0) mipLevel = 0;
|
|
6272
6273
|
if (x === void 0) x = 0;
|
|
6273
6274
|
if (y === void 0) y = 0;
|
|
6274
|
-
this._platformTexture.setPixelBuffer(offsetIndex, colorBuffer, mipLevel, x, y, width, height,
|
|
6275
|
+
this._platformTexture.setPixelBuffer(offsetIndex, colorBuffer, mipLevel, x, y, width, height, length);
|
|
6275
6276
|
this._isContentLost = false;
|
|
6276
6277
|
};
|
|
6277
6278
|
/**
|
|
@@ -7477,8 +7478,8 @@
|
|
|
7477
7478
|
var _this;
|
|
7478
7479
|
_this = EngineObject1.call(this, entity.engine) || this;
|
|
7479
7480
|
/** @internal */ _this._awoken = false;
|
|
7480
|
-
_this._phasedActive = false;
|
|
7481
7481
|
_this._phasedActiveInScene = false;
|
|
7482
|
+
_this._phasedActive = false;
|
|
7482
7483
|
_this._enabled = true;
|
|
7483
7484
|
_this._entity = entity;
|
|
7484
7485
|
return _this;
|
|
@@ -7611,10 +7612,10 @@
|
|
|
7611
7612
|
], Component.prototype, "_awoken", void 0);
|
|
7612
7613
|
__decorate$1([
|
|
7613
7614
|
ignoreClone
|
|
7614
|
-
], Component.prototype, "
|
|
7615
|
+
], Component.prototype, "_phasedActiveInScene", void 0);
|
|
7615
7616
|
__decorate$1([
|
|
7616
7617
|
ignoreClone
|
|
7617
|
-
], Component.prototype, "
|
|
7618
|
+
], Component.prototype, "_phasedActive", void 0);
|
|
7618
7619
|
__decorate$1([
|
|
7619
7620
|
assignmentClone
|
|
7620
7621
|
], Component.prototype, "_enabled", void 0);
|
|
@@ -7769,14 +7770,14 @@
|
|
|
7769
7770
|
}
|
|
7770
7771
|
return end;
|
|
7771
7772
|
};
|
|
7772
|
-
_proto.forEach = function forEach(callbackFn) {
|
|
7773
|
+
_proto.forEach = function forEach(callbackFn, swapFn) {
|
|
7773
7774
|
this._startLoop();
|
|
7774
7775
|
var elements = this._elements;
|
|
7775
7776
|
for(var i = 0; i < this.length; i++){
|
|
7776
7777
|
var element = elements[i];
|
|
7777
7778
|
element && callbackFn(element);
|
|
7778
7779
|
}
|
|
7779
|
-
this._endLoop();
|
|
7780
|
+
this._endLoop(swapFn);
|
|
7780
7781
|
};
|
|
7781
7782
|
_proto.forEachAndClean = function forEachAndClean(callbackFn) {
|
|
7782
7783
|
this._startLoop();
|
|
@@ -7793,16 +7794,24 @@
|
|
|
7793
7794
|
_proto._startLoop = function _startLoop() {
|
|
7794
7795
|
this._isLooping = true;
|
|
7795
7796
|
};
|
|
7796
|
-
_proto._endLoop = function _endLoop() {
|
|
7797
|
+
_proto._endLoop = function _endLoop(swapFn) {
|
|
7797
7798
|
this._isLooping = false;
|
|
7798
7799
|
if (this._blankCount) {
|
|
7800
|
+
var from = 0;
|
|
7801
|
+
var to = this.length - 1;
|
|
7799
7802
|
var elements = this._elements;
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7803
|
+
partition: do {
|
|
7804
|
+
while(elements[from])if (++from >= to) {
|
|
7805
|
+
break partition;
|
|
7806
|
+
}
|
|
7807
|
+
while(!elements[to])if (from >= --to) {
|
|
7808
|
+
break partition;
|
|
7809
|
+
}
|
|
7810
|
+
var swapElement = elements[to];
|
|
7811
|
+
swapFn(swapElement, from);
|
|
7812
|
+
elements[from++] = swapElement;
|
|
7813
|
+
elements[to--] = null;
|
|
7814
|
+
}while (from < to);
|
|
7806
7815
|
this.length -= this._blankCount;
|
|
7807
7816
|
this._blankCount = 0;
|
|
7808
7817
|
}
|
|
@@ -7890,11 +7899,11 @@
|
|
|
7890
7899
|
var pathArr = this._stringToPath(path);
|
|
7891
7900
|
var object = target;
|
|
7892
7901
|
var index = 0;
|
|
7893
|
-
var
|
|
7894
|
-
while(object != null && index <
|
|
7902
|
+
var length = pathArr.length;
|
|
7903
|
+
while(object != null && index < length){
|
|
7895
7904
|
object = object[pathArr[index++]];
|
|
7896
7905
|
}
|
|
7897
|
-
return index && index ==
|
|
7906
|
+
return index && index == length ? object : undefined;
|
|
7898
7907
|
};
|
|
7899
7908
|
/**
|
|
7900
7909
|
* Fast remove an element from array.
|
|
@@ -9071,7 +9080,7 @@
|
|
|
9071
9080
|
*/ _proto.findByPath = function findByPath(path) {
|
|
9072
9081
|
var splits = path.split("/");
|
|
9073
9082
|
var entity = this;
|
|
9074
|
-
for(var i = 0,
|
|
9083
|
+
for(var i = 0, length = splits.length; i < length; ++i){
|
|
9075
9084
|
var split = splits[i];
|
|
9076
9085
|
if (split) {
|
|
9077
9086
|
entity = Entity._findChildByName(entity, split);
|
|
@@ -9157,12 +9166,6 @@
|
|
|
9157
9166
|
this._hookResource._addReferCount(-1);
|
|
9158
9167
|
this._hookResource = null;
|
|
9159
9168
|
}
|
|
9160
|
-
this.isActive = false;
|
|
9161
|
-
if (this._isRoot) {
|
|
9162
|
-
this._scene.removeRootEntity(this);
|
|
9163
|
-
} else {
|
|
9164
|
-
this._setParent(null);
|
|
9165
|
-
}
|
|
9166
9169
|
var components = this._components;
|
|
9167
9170
|
for(var i = components.length - 1; i >= 0; i--){
|
|
9168
9171
|
components[i].destroy();
|
|
@@ -9172,6 +9175,12 @@
|
|
|
9172
9175
|
while(children.length > 0){
|
|
9173
9176
|
children[0].destroy();
|
|
9174
9177
|
}
|
|
9178
|
+
if (this._isRoot) {
|
|
9179
|
+
this._scene.removeRootEntity(this);
|
|
9180
|
+
} else {
|
|
9181
|
+
this._setParent(null);
|
|
9182
|
+
}
|
|
9183
|
+
this.isActive = false;
|
|
9175
9184
|
};
|
|
9176
9185
|
/**
|
|
9177
9186
|
* @internal
|
|
@@ -9303,7 +9312,7 @@
|
|
|
9303
9312
|
};
|
|
9304
9313
|
_proto._setActiveComponents = function _setActiveComponents(isActive, activeChangeFlag) {
|
|
9305
9314
|
var activeChangedComponents = this._activeChangedComponents;
|
|
9306
|
-
for(var i = 0,
|
|
9315
|
+
for(var i = 0, length = activeChangedComponents.length; i < length; ++i){
|
|
9307
9316
|
activeChangedComponents[i]._setActive(isActive, activeChangeFlag);
|
|
9308
9317
|
}
|
|
9309
9318
|
this._scene._componentsManager.putActiveChangedTempList(activeChangedComponents);
|
|
@@ -11056,6 +11065,12 @@
|
|
|
11056
11065
|
};
|
|
11057
11066
|
return BlendState;
|
|
11058
11067
|
}();
|
|
11068
|
+
__decorate$1([
|
|
11069
|
+
deepClone
|
|
11070
|
+
], BlendState.prototype, "targetBlendState", void 0);
|
|
11071
|
+
__decorate$1([
|
|
11072
|
+
deepClone
|
|
11073
|
+
], BlendState.prototype, "blendColor", void 0);
|
|
11059
11074
|
/**
|
|
11060
11075
|
* Depth state.
|
|
11061
11076
|
*/ var DepthState = /*#__PURE__*/ function() {
|
|
@@ -11434,6 +11449,18 @@
|
|
|
11434
11449
|
};
|
|
11435
11450
|
return RenderState;
|
|
11436
11451
|
}();
|
|
11452
|
+
__decorate$1([
|
|
11453
|
+
deepClone
|
|
11454
|
+
], RenderState.prototype, "blendState", void 0);
|
|
11455
|
+
__decorate$1([
|
|
11456
|
+
deepClone
|
|
11457
|
+
], RenderState.prototype, "depthState", void 0);
|
|
11458
|
+
__decorate$1([
|
|
11459
|
+
deepClone
|
|
11460
|
+
], RenderState.prototype, "stencilState", void 0);
|
|
11461
|
+
__decorate$1([
|
|
11462
|
+
deepClone
|
|
11463
|
+
], RenderState.prototype, "rasterState", void 0);
|
|
11437
11464
|
/**
|
|
11438
11465
|
* Shader for rendering.
|
|
11439
11466
|
*/ var Shader = /*#__PURE__*/ function() {
|
|
@@ -12335,7 +12362,7 @@
|
|
|
12335
12362
|
ignoreClone
|
|
12336
12363
|
], exports.Renderer.prototype, "_globalShaderMacro", void 0);
|
|
12337
12364
|
__decorate$1([
|
|
12338
|
-
|
|
12365
|
+
ignoreClone
|
|
12339
12366
|
], exports.Renderer.prototype, "_bounds", void 0);
|
|
12340
12367
|
__decorate$1([
|
|
12341
12368
|
ignoreClone
|
|
@@ -13281,14 +13308,14 @@
|
|
|
13281
13308
|
vertexElements[index] = element;
|
|
13282
13309
|
this._bufferStructChanged = true;
|
|
13283
13310
|
};
|
|
13284
|
-
_proto.setVertexElementsLength = function setVertexElementsLength(
|
|
13311
|
+
_proto.setVertexElementsLength = function setVertexElementsLength(length) {
|
|
13285
13312
|
var vertexElementMap = this._vertexElementMap;
|
|
13286
13313
|
var vertexElements = this._vertexElements;
|
|
13287
|
-
for(var i =
|
|
13314
|
+
for(var i = length, n = vertexElements.length; i < n; i++){
|
|
13288
13315
|
var element = vertexElements[i];
|
|
13289
13316
|
delete vertexElementMap[element.attribute];
|
|
13290
13317
|
}
|
|
13291
|
-
vertexElements.length =
|
|
13318
|
+
vertexElements.length = length;
|
|
13292
13319
|
};
|
|
13293
13320
|
_proto.setVertexBufferBinding = function setVertexBufferBinding(index, binding) {
|
|
13294
13321
|
var referCount = this._getReferCount();
|
|
@@ -13442,8 +13469,8 @@
|
|
|
13442
13469
|
/**
|
|
13443
13470
|
* @internal
|
|
13444
13471
|
*
|
|
13445
|
-
*/ _proto._setVertexElementsLength = function _setVertexElementsLength(
|
|
13446
|
-
this._primitive.setVertexElementsLength(
|
|
13472
|
+
*/ _proto._setVertexElementsLength = function _setVertexElementsLength(length) {
|
|
13473
|
+
this._primitive.setVertexElementsLength(length);
|
|
13447
13474
|
};
|
|
13448
13475
|
/**
|
|
13449
13476
|
* @internal
|
|
@@ -15159,9 +15186,9 @@
|
|
|
15159
15186
|
}
|
|
15160
15187
|
var bsUpdate = !bsManager._useTextureMode() && bsManager._vertexElementsNeedUpdate();
|
|
15161
15188
|
if (previousBSOffset !== bsManager._vertexElementOffset || bsUpdate && bsManager._blendShapeCount > 0) {
|
|
15162
|
-
var
|
|
15163
|
-
if (
|
|
15164
|
-
this._setVertexElementsLength(
|
|
15189
|
+
var length = bsManager._addVertexElements(this);
|
|
15190
|
+
if (length < previousCount) {
|
|
15191
|
+
this._setVertexElementsLength(length);
|
|
15165
15192
|
}
|
|
15166
15193
|
}
|
|
15167
15194
|
};
|
|
@@ -17073,7 +17100,7 @@
|
|
|
17073
17100
|
_proto.drawBatches = function drawBatches(camera) {
|
|
17074
17101
|
var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
|
|
17075
17102
|
var mesh = this._meshes[this._flushId];
|
|
17076
|
-
var subMeshes = mesh.subMeshes;
|
|
17103
|
+
var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
|
|
17077
17104
|
var sceneData = camera.scene.shaderData;
|
|
17078
17105
|
var cameraData = camera.shaderData;
|
|
17079
17106
|
for(var i = 0, len = subMeshes.length; i < len; i++){
|
|
@@ -17105,7 +17132,7 @@
|
|
|
17105
17132
|
program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
|
|
17106
17133
|
program.uploadAll(program.materialUniformBlock, material.shaderData);
|
|
17107
17134
|
material.renderState._apply(engine, false, pass._renderStateDataMap, material.shaderData);
|
|
17108
|
-
engine._hardwareRenderer.drawPrimitive(
|
|
17135
|
+
engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
|
|
17109
17136
|
}
|
|
17110
17137
|
};
|
|
17111
17138
|
return SpriteMaskBatcher;
|
|
@@ -17344,16 +17371,31 @@
|
|
|
17344
17371
|
};
|
|
17345
17372
|
var _proto = SceneManager.prototype;
|
|
17346
17373
|
_proto.addScene = function addScene(indexOrScene, scene) {
|
|
17374
|
+
var scenes = this._scenes;
|
|
17375
|
+
var index;
|
|
17347
17376
|
if (typeof indexOrScene === "number") {
|
|
17348
|
-
|
|
17377
|
+
if (indexOrScene < 0 || indexOrScene > scenes.length) {
|
|
17378
|
+
throw "The index is out of range.";
|
|
17379
|
+
}
|
|
17380
|
+
index = indexOrScene;
|
|
17349
17381
|
} else {
|
|
17382
|
+
index = scenes.length;
|
|
17350
17383
|
scene = indexOrScene;
|
|
17351
|
-
this._scenes.push(scene);
|
|
17352
17384
|
}
|
|
17353
17385
|
if (scene.engine !== this.engine) {
|
|
17354
17386
|
throw "The scene is not belong to this engine.";
|
|
17355
17387
|
}
|
|
17356
|
-
scene.
|
|
17388
|
+
if (scene._sceneManager) {
|
|
17389
|
+
var currentIndex = scenes.indexOf(scene);
|
|
17390
|
+
if (currentIndex !== index) {
|
|
17391
|
+
scenes.removeByIndex(currentIndex);
|
|
17392
|
+
scenes.add(index, scene);
|
|
17393
|
+
}
|
|
17394
|
+
} else {
|
|
17395
|
+
scene._sceneManager = this;
|
|
17396
|
+
scenes.add(index, scene);
|
|
17397
|
+
scene.isActive && scene._processActive(true);
|
|
17398
|
+
}
|
|
17357
17399
|
};
|
|
17358
17400
|
/**
|
|
17359
17401
|
* Remove scene.
|
|
@@ -17364,7 +17406,8 @@
|
|
|
17364
17406
|
if (index !== -1) {
|
|
17365
17407
|
var removedScene = scenes.getArray()[index];
|
|
17366
17408
|
scenes.removeByIndex(index);
|
|
17367
|
-
|
|
17409
|
+
scene._sceneManager = null;
|
|
17410
|
+
removedScene.isActive && removedScene._processActive(false);
|
|
17368
17411
|
}
|
|
17369
17412
|
};
|
|
17370
17413
|
/**
|
|
@@ -18015,11 +18058,15 @@
|
|
|
18015
18058
|
if (this._currentEnteredEntity) {
|
|
18016
18059
|
this._currentEnteredEntity._scripts.forEach(function(element) {
|
|
18017
18060
|
element.onPointerExit(_this);
|
|
18061
|
+
}, function(element, index) {
|
|
18062
|
+
element._entityScriptsIndex = index;
|
|
18018
18063
|
});
|
|
18019
18064
|
}
|
|
18020
18065
|
if (rayCastEntity) {
|
|
18021
18066
|
rayCastEntity._scripts.forEach(function(element) {
|
|
18022
18067
|
element.onPointerEnter(_this);
|
|
18068
|
+
}, function(element, index) {
|
|
18069
|
+
element._entityScriptsIndex = index;
|
|
18023
18070
|
});
|
|
18024
18071
|
}
|
|
18025
18072
|
this._currentEnteredEntity = rayCastEntity;
|
|
@@ -18032,6 +18079,8 @@
|
|
|
18032
18079
|
if (rayCastEntity) {
|
|
18033
18080
|
rayCastEntity._scripts.forEach(function(element) {
|
|
18034
18081
|
element.onPointerDown(_this);
|
|
18082
|
+
}, function(element, index) {
|
|
18083
|
+
element._entityScriptsIndex = index;
|
|
18035
18084
|
});
|
|
18036
18085
|
}
|
|
18037
18086
|
this._currentPressedEntity = rayCastEntity;
|
|
@@ -18043,6 +18092,8 @@
|
|
|
18043
18092
|
if (this._currentPressedEntity) {
|
|
18044
18093
|
this._currentPressedEntity._scripts.forEach(function(element) {
|
|
18045
18094
|
element.onPointerDrag(_this);
|
|
18095
|
+
}, function(element, index) {
|
|
18096
|
+
element._entityScriptsIndex = index;
|
|
18046
18097
|
});
|
|
18047
18098
|
}
|
|
18048
18099
|
};
|
|
@@ -18056,6 +18107,8 @@
|
|
|
18056
18107
|
pressedEntity._scripts.forEach(function(element) {
|
|
18057
18108
|
sameTarget && element.onPointerClick(_this);
|
|
18058
18109
|
element.onPointerUp(_this);
|
|
18110
|
+
}, function(element, index) {
|
|
18111
|
+
element._entityScriptsIndex = index;
|
|
18059
18112
|
});
|
|
18060
18113
|
this._currentPressedEntity = null;
|
|
18061
18114
|
}
|
|
@@ -18556,9 +18609,9 @@
|
|
|
18556
18609
|
oldCollider.removeShape(shape);
|
|
18557
18610
|
}
|
|
18558
18611
|
this._shapes.push(shape);
|
|
18559
|
-
this.scene.physics._addColliderShape(shape);
|
|
18560
18612
|
shape._collider = this;
|
|
18561
18613
|
this._nativeCollider.addShape(shape._nativeShape);
|
|
18614
|
+
this._phasedActiveInScene && this.scene.physics._addColliderShape(shape);
|
|
18562
18615
|
}
|
|
18563
18616
|
};
|
|
18564
18617
|
/**
|
|
@@ -18568,7 +18621,7 @@
|
|
|
18568
18621
|
var index = this._shapes.indexOf(shape);
|
|
18569
18622
|
if (index !== -1) {
|
|
18570
18623
|
this._shapes.splice(index, 1);
|
|
18571
|
-
this.scene.physics._removeColliderShape(shape);
|
|
18624
|
+
this._phasedActiveInScene && this.scene.physics._removeColliderShape(shape);
|
|
18572
18625
|
shape._collider = null;
|
|
18573
18626
|
this._nativeCollider.removeShape(shape._nativeShape);
|
|
18574
18627
|
}
|
|
@@ -18579,7 +18632,7 @@
|
|
|
18579
18632
|
var shapes = this._shapes;
|
|
18580
18633
|
for(var i = 0, n = shapes.length; i < n; i++){
|
|
18581
18634
|
var shape = shapes[i];
|
|
18582
|
-
this.scene.physics._removeColliderShape(shape);
|
|
18635
|
+
this._phasedActiveInScene && this.scene.physics._removeColliderShape(shape);
|
|
18583
18636
|
shape._destroy();
|
|
18584
18637
|
this._nativeCollider.removeShape(shape._nativeShape);
|
|
18585
18638
|
}
|
|
@@ -18604,12 +18657,30 @@
|
|
|
18604
18657
|
/**
|
|
18605
18658
|
* @internal
|
|
18606
18659
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
18607
|
-
this.scene.physics
|
|
18660
|
+
var physics = this.scene.physics;
|
|
18661
|
+
physics._addCollider(this);
|
|
18662
|
+
var shapes = this.shapes;
|
|
18663
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
18664
|
+
physics._addColliderShape(shapes[i]);
|
|
18665
|
+
}
|
|
18608
18666
|
};
|
|
18609
18667
|
/**
|
|
18610
18668
|
* @internal
|
|
18611
18669
|
*/ _proto._onDisableInScene = function _onDisableInScene() {
|
|
18612
|
-
this.scene.physics
|
|
18670
|
+
var physics = this.scene.physics;
|
|
18671
|
+
physics._removeCollider(this);
|
|
18672
|
+
var shapes = this.shapes;
|
|
18673
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
18674
|
+
physics._removeColliderShape(shapes[i]);
|
|
18675
|
+
}
|
|
18676
|
+
};
|
|
18677
|
+
/**
|
|
18678
|
+
* @internal
|
|
18679
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
18680
|
+
var shapes = target._shapes;
|
|
18681
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
18682
|
+
target._addPhysicsShape(shapes[i]);
|
|
18683
|
+
}
|
|
18613
18684
|
};
|
|
18614
18685
|
/**
|
|
18615
18686
|
* @internal
|
|
@@ -18618,6 +18689,11 @@
|
|
|
18618
18689
|
this.clearShapes();
|
|
18619
18690
|
this._nativeCollider.destroy();
|
|
18620
18691
|
};
|
|
18692
|
+
_proto._addPhysicsShape = function _addPhysicsShape(shape) {
|
|
18693
|
+
shape._collider = this;
|
|
18694
|
+
this._nativeCollider.addShape(shape._nativeShape);
|
|
18695
|
+
this._phasedActiveInScene && this.scene.physics._addColliderShape(shape);
|
|
18696
|
+
};
|
|
18621
18697
|
_create_class$3(Collider, [
|
|
18622
18698
|
{
|
|
18623
18699
|
key: "shapes",
|
|
@@ -18633,6 +18709,15 @@
|
|
|
18633
18709
|
__decorate$1([
|
|
18634
18710
|
ignoreClone
|
|
18635
18711
|
], exports.Collider.prototype, "_index", void 0);
|
|
18712
|
+
__decorate$1([
|
|
18713
|
+
ignoreClone
|
|
18714
|
+
], exports.Collider.prototype, "_nativeCollider", void 0);
|
|
18715
|
+
__decorate$1([
|
|
18716
|
+
ignoreClone
|
|
18717
|
+
], exports.Collider.prototype, "_updateFlag", void 0);
|
|
18718
|
+
__decorate$1([
|
|
18719
|
+
deepClone
|
|
18720
|
+
], exports.Collider.prototype, "_shapes", void 0);
|
|
18636
18721
|
exports.Collider = __decorate$1([
|
|
18637
18722
|
dependentComponents(Transform, exports.DependentMode.CheckOnly)
|
|
18638
18723
|
], exports.Collider);
|
|
@@ -18654,11 +18739,15 @@
|
|
|
18654
18739
|
var collision = PhysicsScene._collision;
|
|
18655
18740
|
collision.shape = shape2;
|
|
18656
18741
|
element.onCollisionEnter(collision);
|
|
18742
|
+
}, function(element, index) {
|
|
18743
|
+
element._entityScriptsIndex = index;
|
|
18657
18744
|
});
|
|
18658
18745
|
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18659
18746
|
var collision = PhysicsScene._collision;
|
|
18660
18747
|
collision.shape = shape1;
|
|
18661
18748
|
element.onCollisionEnter(collision);
|
|
18749
|
+
}, function(element, index) {
|
|
18750
|
+
element._entityScriptsIndex = index;
|
|
18662
18751
|
});
|
|
18663
18752
|
};
|
|
18664
18753
|
this._onContactExit = function(obj1, obj2) {
|
|
@@ -18669,11 +18758,15 @@
|
|
|
18669
18758
|
var collision = PhysicsScene._collision;
|
|
18670
18759
|
collision.shape = shape2;
|
|
18671
18760
|
element.onCollisionExit(collision);
|
|
18761
|
+
}, function(element, index) {
|
|
18762
|
+
element._entityScriptsIndex = index;
|
|
18672
18763
|
});
|
|
18673
18764
|
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18674
18765
|
var collision = PhysicsScene._collision;
|
|
18675
18766
|
collision.shape = shape1;
|
|
18676
18767
|
element.onCollisionExit(collision);
|
|
18768
|
+
}, function(element, index) {
|
|
18769
|
+
element._entityScriptsIndex = index;
|
|
18677
18770
|
});
|
|
18678
18771
|
};
|
|
18679
18772
|
this._onContactStay = function(obj1, obj2) {
|
|
@@ -18684,11 +18777,15 @@
|
|
|
18684
18777
|
var collision = PhysicsScene._collision;
|
|
18685
18778
|
collision.shape = shape2;
|
|
18686
18779
|
element.onCollisionStay(collision);
|
|
18780
|
+
}, function(element, index) {
|
|
18781
|
+
element._entityScriptsIndex = index;
|
|
18687
18782
|
});
|
|
18688
18783
|
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18689
18784
|
var collision = PhysicsScene._collision;
|
|
18690
18785
|
collision.shape = shape1;
|
|
18691
18786
|
element.onCollisionStay(collision);
|
|
18787
|
+
}, function(element, index) {
|
|
18788
|
+
element._entityScriptsIndex = index;
|
|
18692
18789
|
});
|
|
18693
18790
|
};
|
|
18694
18791
|
this._onTriggerEnter = function(obj1, obj2) {
|
|
@@ -18697,9 +18794,13 @@
|
|
|
18697
18794
|
var shape2 = physicalObjectsMap[obj2];
|
|
18698
18795
|
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18699
18796
|
element.onTriggerEnter(shape2);
|
|
18797
|
+
}, function(element, index) {
|
|
18798
|
+
element._entityScriptsIndex = index;
|
|
18700
18799
|
});
|
|
18701
18800
|
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18702
18801
|
element.onTriggerEnter(shape1);
|
|
18802
|
+
}, function(element, index) {
|
|
18803
|
+
element._entityScriptsIndex = index;
|
|
18703
18804
|
});
|
|
18704
18805
|
};
|
|
18705
18806
|
this._onTriggerExit = function(obj1, obj2) {
|
|
@@ -18708,9 +18809,13 @@
|
|
|
18708
18809
|
var shape2 = physicalObjectsMap[obj2];
|
|
18709
18810
|
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18710
18811
|
element.onTriggerExit(shape2);
|
|
18812
|
+
}, function(element, index) {
|
|
18813
|
+
element._entityScriptsIndex = index;
|
|
18711
18814
|
});
|
|
18712
18815
|
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18713
18816
|
element.onTriggerExit(shape1);
|
|
18817
|
+
}, function(element, index) {
|
|
18818
|
+
element._entityScriptsIndex = index;
|
|
18714
18819
|
});
|
|
18715
18820
|
};
|
|
18716
18821
|
this._onTriggerStay = function(obj1, obj2) {
|
|
@@ -18719,9 +18824,13 @@
|
|
|
18719
18824
|
var shape2 = physicalObjectsMap[obj2];
|
|
18720
18825
|
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18721
18826
|
element.onTriggerStay(shape2);
|
|
18827
|
+
}, function(element, index) {
|
|
18828
|
+
element._entityScriptsIndex = index;
|
|
18722
18829
|
});
|
|
18723
18830
|
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18724
18831
|
element.onTriggerStay(shape1);
|
|
18832
|
+
}, function(element, index) {
|
|
18833
|
+
element._entityScriptsIndex = index;
|
|
18725
18834
|
});
|
|
18726
18835
|
};
|
|
18727
18836
|
this._scene = scene;
|
|
@@ -18754,6 +18863,9 @@
|
|
|
18754
18863
|
}
|
|
18755
18864
|
var onRaycast = function onRaycast(obj) {
|
|
18756
18865
|
var shape = _this._scene.engine._physicalObjectsMap[obj];
|
|
18866
|
+
if (!shape) {
|
|
18867
|
+
return false;
|
|
18868
|
+
}
|
|
18757
18869
|
return shape.collider.entity.layer & layerMask && shape.isSceneQuery;
|
|
18758
18870
|
};
|
|
18759
18871
|
if (hitResult != undefined) {
|
|
@@ -18976,18 +19088,27 @@
|
|
|
18976
19088
|
*/ _proto._onLateUpdate = function _onLateUpdate() {
|
|
18977
19089
|
var position = this.entity.transform.worldPosition;
|
|
18978
19090
|
this._nativeCollider.getWorldPosition(position);
|
|
18979
|
-
this.entity.transform.worldPosition = position;
|
|
18980
19091
|
this._updateFlag.flag = false;
|
|
18981
19092
|
};
|
|
18982
19093
|
/**
|
|
18983
19094
|
* @internal
|
|
18984
19095
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
18985
|
-
this.scene.physics
|
|
19096
|
+
var physics = this.scene.physics;
|
|
19097
|
+
physics._addCharacterController(this);
|
|
19098
|
+
var shapes = this.shapes;
|
|
19099
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
19100
|
+
physics._addColliderShape(shapes[i]);
|
|
19101
|
+
}
|
|
18986
19102
|
};
|
|
18987
19103
|
/**
|
|
18988
19104
|
* @internal
|
|
18989
19105
|
*/ _proto._onDisableInScene = function _onDisableInScene() {
|
|
18990
|
-
this.scene.physics
|
|
19106
|
+
var physics = this.scene.physics;
|
|
19107
|
+
physics._removeCharacterController(this);
|
|
19108
|
+
var shapes = this.shapes;
|
|
19109
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
19110
|
+
physics._removeColliderShape(shapes[i]);
|
|
19111
|
+
}
|
|
18991
19112
|
};
|
|
18992
19113
|
_proto._setUpDirection = function _setUpDirection() {
|
|
18993
19114
|
this._nativeCollider.setUpDirection(this._upDirection);
|
|
@@ -19122,6 +19243,25 @@
|
|
|
19122
19243
|
this._nativeCollider.getWorldTransform(worldPosition, worldRotationQuaternion);
|
|
19123
19244
|
this._updateFlag.flag = false;
|
|
19124
19245
|
};
|
|
19246
|
+
/**
|
|
19247
|
+
* @internal
|
|
19248
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
19249
|
+
Collider1.prototype._cloneTo.call(this, target);
|
|
19250
|
+
target.linearDamping = this.linearDamping;
|
|
19251
|
+
target.angularDamping = this.angularDamping;
|
|
19252
|
+
target.linearVelocity = this.linearVelocity;
|
|
19253
|
+
target.angularVelocity = this.angularVelocity;
|
|
19254
|
+
target.mass = this.mass;
|
|
19255
|
+
target.centerOfMass = this.centerOfMass;
|
|
19256
|
+
target.inertiaTensor = this.inertiaTensor;
|
|
19257
|
+
target.maxAngularVelocity = this.maxAngularVelocity;
|
|
19258
|
+
target.maxDepenetrationVelocity = this.maxDepenetrationVelocity;
|
|
19259
|
+
target.sleepThreshold = this.sleepThreshold;
|
|
19260
|
+
target.solverIterations = this.solverIterations;
|
|
19261
|
+
target.isKinematic = this.isKinematic;
|
|
19262
|
+
target.constraints = this.constraints;
|
|
19263
|
+
target.collisionDetectionMode = this.collisionDetectionMode;
|
|
19264
|
+
};
|
|
19125
19265
|
_proto._setLinearVelocity = function _setLinearVelocity() {
|
|
19126
19266
|
this._nativeCollider.setLinearVelocity(this._linearVelocity);
|
|
19127
19267
|
};
|
|
@@ -19330,6 +19470,48 @@
|
|
|
19330
19470
|
]);
|
|
19331
19471
|
return DynamicCollider;
|
|
19332
19472
|
}(exports.Collider);
|
|
19473
|
+
__decorate$1([
|
|
19474
|
+
ignoreClone
|
|
19475
|
+
], DynamicCollider.prototype, "_linearDamping", void 0);
|
|
19476
|
+
__decorate$1([
|
|
19477
|
+
ignoreClone
|
|
19478
|
+
], DynamicCollider.prototype, "_angularDamping", void 0);
|
|
19479
|
+
__decorate$1([
|
|
19480
|
+
ignoreClone
|
|
19481
|
+
], DynamicCollider.prototype, "_linearVelocity", void 0);
|
|
19482
|
+
__decorate$1([
|
|
19483
|
+
ignoreClone
|
|
19484
|
+
], DynamicCollider.prototype, "_angularVelocity", void 0);
|
|
19485
|
+
__decorate$1([
|
|
19486
|
+
ignoreClone
|
|
19487
|
+
], DynamicCollider.prototype, "_mass", void 0);
|
|
19488
|
+
__decorate$1([
|
|
19489
|
+
ignoreClone
|
|
19490
|
+
], DynamicCollider.prototype, "_centerOfMass", void 0);
|
|
19491
|
+
__decorate$1([
|
|
19492
|
+
ignoreClone
|
|
19493
|
+
], DynamicCollider.prototype, "_inertiaTensor", void 0);
|
|
19494
|
+
__decorate$1([
|
|
19495
|
+
ignoreClone
|
|
19496
|
+
], DynamicCollider.prototype, "_maxAngularVelocity", void 0);
|
|
19497
|
+
__decorate$1([
|
|
19498
|
+
ignoreClone
|
|
19499
|
+
], DynamicCollider.prototype, "_maxDepenetrationVelocity", void 0);
|
|
19500
|
+
__decorate$1([
|
|
19501
|
+
ignoreClone
|
|
19502
|
+
], DynamicCollider.prototype, "_solverIterations", void 0);
|
|
19503
|
+
__decorate$1([
|
|
19504
|
+
ignoreClone
|
|
19505
|
+
], DynamicCollider.prototype, "_isKinematic", void 0);
|
|
19506
|
+
__decorate$1([
|
|
19507
|
+
ignoreClone
|
|
19508
|
+
], DynamicCollider.prototype, "_constraints", void 0);
|
|
19509
|
+
__decorate$1([
|
|
19510
|
+
ignoreClone
|
|
19511
|
+
], DynamicCollider.prototype, "_collisionDetectionMode", void 0);
|
|
19512
|
+
__decorate$1([
|
|
19513
|
+
ignoreClone
|
|
19514
|
+
], DynamicCollider.prototype, "_sleepThreshold", void 0);
|
|
19333
19515
|
exports.CollisionDetectionMode = void 0;
|
|
19334
19516
|
(function(CollisionDetectionMode) {
|
|
19335
19517
|
CollisionDetectionMode[CollisionDetectionMode["Discrete"] = 0] = "Discrete";
|
|
@@ -19379,7 +19561,8 @@
|
|
|
19379
19561
|
/**
|
|
19380
19562
|
* @internal
|
|
19381
19563
|
*/ _proto._destroy = function _destroy() {
|
|
19382
|
-
this._nativeMaterial.destroy();
|
|
19564
|
+
!this._destroyed && this._nativeMaterial.destroy();
|
|
19565
|
+
this._destroyed = true;
|
|
19383
19566
|
};
|
|
19384
19567
|
_create_class$3(PhysicsMaterial, [
|
|
19385
19568
|
{
|
|
@@ -19489,25 +19672,38 @@
|
|
|
19489
19672
|
var Joint = function Joint(entity) {
|
|
19490
19673
|
var _this;
|
|
19491
19674
|
_this = Component1.call(this, entity) || this;
|
|
19492
|
-
_this.
|
|
19493
|
-
_this.
|
|
19675
|
+
_this._colliderInfo = new JointColliderInfo();
|
|
19676
|
+
_this._connectedColliderInfo = new JointColliderInfo();
|
|
19494
19677
|
_this._force = 0;
|
|
19495
19678
|
_this._torque = 0;
|
|
19496
|
-
_this.
|
|
19679
|
+
_this._connectedColliderInfo.localPosition = new Vector3();
|
|
19497
19680
|
return _this;
|
|
19498
19681
|
};
|
|
19499
19682
|
_inherits$2(Joint, Component1);
|
|
19683
|
+
var _proto = Joint.prototype;
|
|
19684
|
+
/**
|
|
19685
|
+
* @internal
|
|
19686
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
19687
|
+
target.connectedCollider = this.connectedCollider;
|
|
19688
|
+
target.connectedAnchor = this.connectedAnchor;
|
|
19689
|
+
target.connectedMassScale = this.connectedMassScale;
|
|
19690
|
+
target.connectedInertiaScale = this.connectedInertiaScale;
|
|
19691
|
+
target.massScale = this.massScale;
|
|
19692
|
+
target.inertiaScale = this.inertiaScale;
|
|
19693
|
+
target.breakForce = this.breakForce;
|
|
19694
|
+
target.breakTorque = this.breakTorque;
|
|
19695
|
+
};
|
|
19500
19696
|
_create_class$3(Joint, [
|
|
19501
19697
|
{
|
|
19502
19698
|
key: "connectedCollider",
|
|
19503
19699
|
get: /**
|
|
19504
19700
|
* The connected collider.
|
|
19505
19701
|
*/ function get() {
|
|
19506
|
-
return this.
|
|
19702
|
+
return this._connectedColliderInfo.collider;
|
|
19507
19703
|
},
|
|
19508
19704
|
set: function set(value) {
|
|
19509
|
-
if (this.
|
|
19510
|
-
this.
|
|
19705
|
+
if (this._connectedColliderInfo.collider !== value) {
|
|
19706
|
+
this._connectedColliderInfo.collider = value;
|
|
19511
19707
|
this._nativeJoint.setConnectedCollider(value._nativeCollider);
|
|
19512
19708
|
}
|
|
19513
19709
|
}
|
|
@@ -19518,10 +19714,10 @@
|
|
|
19518
19714
|
* The connected anchor position.
|
|
19519
19715
|
* @remarks If connectedCollider is set, this anchor is relative offset, or the anchor is world position.
|
|
19520
19716
|
*/ function get() {
|
|
19521
|
-
return this.
|
|
19717
|
+
return this._connectedColliderInfo.localPosition;
|
|
19522
19718
|
},
|
|
19523
19719
|
set: function set(value) {
|
|
19524
|
-
var connectedAnchor = this.
|
|
19720
|
+
var connectedAnchor = this._connectedColliderInfo.localPosition;
|
|
19525
19721
|
if (value !== connectedAnchor) {
|
|
19526
19722
|
connectedAnchor.copyFrom(value);
|
|
19527
19723
|
}
|
|
@@ -19533,11 +19729,11 @@
|
|
|
19533
19729
|
get: /**
|
|
19534
19730
|
* The scale to apply to the inverse mass of collider 0 for resolving this constraint.
|
|
19535
19731
|
*/ function get() {
|
|
19536
|
-
return this.
|
|
19732
|
+
return this._connectedColliderInfo.massScale;
|
|
19537
19733
|
},
|
|
19538
19734
|
set: function set(value) {
|
|
19539
|
-
if (value !== this.
|
|
19540
|
-
this.
|
|
19735
|
+
if (value !== this._connectedColliderInfo.massScale) {
|
|
19736
|
+
this._connectedColliderInfo.massScale = value;
|
|
19541
19737
|
this._nativeJoint.setConnectedMassScale(value);
|
|
19542
19738
|
}
|
|
19543
19739
|
}
|
|
@@ -19547,11 +19743,11 @@
|
|
|
19547
19743
|
get: /**
|
|
19548
19744
|
* The scale to apply to the inverse inertia of collider0 for resolving this constraint.
|
|
19549
19745
|
*/ function get() {
|
|
19550
|
-
return this.
|
|
19746
|
+
return this._connectedColliderInfo.inertiaScale;
|
|
19551
19747
|
},
|
|
19552
19748
|
set: function set(value) {
|
|
19553
|
-
if (value !== this.
|
|
19554
|
-
this.
|
|
19749
|
+
if (value !== this._connectedColliderInfo.inertiaScale) {
|
|
19750
|
+
this._connectedColliderInfo.inertiaScale = value;
|
|
19555
19751
|
this._nativeJoint.setConnectedInertiaScale(value);
|
|
19556
19752
|
}
|
|
19557
19753
|
}
|
|
@@ -19561,11 +19757,11 @@
|
|
|
19561
19757
|
get: /**
|
|
19562
19758
|
* The scale to apply to the inverse mass of collider 1 for resolving this constraint.
|
|
19563
19759
|
*/ function get() {
|
|
19564
|
-
return this.
|
|
19760
|
+
return this._colliderInfo.massScale;
|
|
19565
19761
|
},
|
|
19566
19762
|
set: function set(value) {
|
|
19567
|
-
if (value !== this.
|
|
19568
|
-
this.
|
|
19763
|
+
if (value !== this._colliderInfo.massScale) {
|
|
19764
|
+
this._colliderInfo.massScale = value;
|
|
19569
19765
|
this._nativeJoint.setMassScale(value);
|
|
19570
19766
|
}
|
|
19571
19767
|
}
|
|
@@ -19575,11 +19771,11 @@
|
|
|
19575
19771
|
get: /**
|
|
19576
19772
|
* The scale to apply to the inverse inertia of collider1 for resolving this constraint.
|
|
19577
19773
|
*/ function get() {
|
|
19578
|
-
return this.
|
|
19774
|
+
return this._colliderInfo.inertiaScale;
|
|
19579
19775
|
},
|
|
19580
19776
|
set: function set(value) {
|
|
19581
|
-
if (value !== this.
|
|
19582
|
-
this.
|
|
19777
|
+
if (value !== this._colliderInfo.inertiaScale) {
|
|
19778
|
+
this._colliderInfo.inertiaScale = value;
|
|
19583
19779
|
this._nativeJoint.setInertiaScale(value);
|
|
19584
19780
|
}
|
|
19585
19781
|
}
|
|
@@ -19615,12 +19811,27 @@
|
|
|
19615
19811
|
]);
|
|
19616
19812
|
return Joint;
|
|
19617
19813
|
}(Component);
|
|
19814
|
+
__decorate$1([
|
|
19815
|
+
ignoreClone
|
|
19816
|
+
], exports.Joint.prototype, "_colliderInfo", void 0);
|
|
19817
|
+
__decorate$1([
|
|
19818
|
+
ignoreClone
|
|
19819
|
+
], exports.Joint.prototype, "_connectedColliderInfo", void 0);
|
|
19820
|
+
__decorate$1([
|
|
19821
|
+
ignoreClone
|
|
19822
|
+
], exports.Joint.prototype, "_nativeJoint", void 0);
|
|
19823
|
+
__decorate$1([
|
|
19824
|
+
ignoreClone
|
|
19825
|
+
], exports.Joint.prototype, "_force", void 0);
|
|
19826
|
+
__decorate$1([
|
|
19827
|
+
ignoreClone
|
|
19828
|
+
], exports.Joint.prototype, "_torque", void 0);
|
|
19618
19829
|
exports.Joint = __decorate$1([
|
|
19619
19830
|
dependentComponents(exports.Collider, exports.DependentMode.CheckOnly)
|
|
19620
19831
|
], exports.Joint);
|
|
19621
19832
|
/**
|
|
19622
19833
|
* @internal
|
|
19623
|
-
*/ var
|
|
19834
|
+
*/ var JointColliderInfo = function JointColliderInfo() {
|
|
19624
19835
|
this.collider = null;
|
|
19625
19836
|
this.massScale = 0;
|
|
19626
19837
|
this.inertiaScale = 0;
|
|
@@ -19636,7 +19847,7 @@
|
|
|
19636
19847
|
/**
|
|
19637
19848
|
* @internal
|
|
19638
19849
|
*/ _proto._onAwake = function _onAwake() {
|
|
19639
|
-
var collider = this.
|
|
19850
|
+
var collider = this._colliderInfo;
|
|
19640
19851
|
collider.collider = this.entity.getComponent(exports.Collider);
|
|
19641
19852
|
this._nativeJoint = PhysicsScene._nativePhysics.createFixedJoint(collider.collider._nativeCollider);
|
|
19642
19853
|
};
|
|
@@ -19668,11 +19879,22 @@
|
|
|
19668
19879
|
/**
|
|
19669
19880
|
* @internal
|
|
19670
19881
|
*/ _proto._onAwake = function _onAwake() {
|
|
19671
|
-
var collider = this.
|
|
19882
|
+
var collider = this._colliderInfo;
|
|
19672
19883
|
collider.localPosition = new Vector3();
|
|
19673
19884
|
collider.collider = this.entity.getComponent(exports.Collider);
|
|
19674
19885
|
this._nativeJoint = PhysicsScene._nativePhysics.createHingeJoint(collider.collider._nativeCollider);
|
|
19675
19886
|
};
|
|
19887
|
+
/**
|
|
19888
|
+
* @internal
|
|
19889
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
19890
|
+
target.axis = this.axis;
|
|
19891
|
+
target.swingOffset = this.swingOffset;
|
|
19892
|
+
target.useLimits = this.useLimits;
|
|
19893
|
+
target.useMotor = this.useMotor;
|
|
19894
|
+
target.useSpring = this.useSpring;
|
|
19895
|
+
target.motor = this.motor;
|
|
19896
|
+
target.limits = this.limits;
|
|
19897
|
+
};
|
|
19676
19898
|
_create_class$3(HingeJoint, [
|
|
19677
19899
|
{
|
|
19678
19900
|
key: "axis",
|
|
@@ -19694,10 +19916,10 @@
|
|
|
19694
19916
|
get: /**
|
|
19695
19917
|
* The swing offset.
|
|
19696
19918
|
*/ function get() {
|
|
19697
|
-
return this.
|
|
19919
|
+
return this._colliderInfo.localPosition;
|
|
19698
19920
|
},
|
|
19699
19921
|
set: function set(value) {
|
|
19700
|
-
var swingOffset = this.
|
|
19922
|
+
var swingOffset = this._colliderInfo.localPosition;
|
|
19701
19923
|
if (value !== swingOffset) {
|
|
19702
19924
|
swingOffset.copyFrom(value);
|
|
19703
19925
|
}
|
|
@@ -19800,6 +20022,21 @@
|
|
|
19800
20022
|
]);
|
|
19801
20023
|
return HingeJoint;
|
|
19802
20024
|
}(exports.Joint);
|
|
20025
|
+
__decorate$1([
|
|
20026
|
+
ignoreClone
|
|
20027
|
+
], HingeJoint.prototype, "_axis", void 0);
|
|
20028
|
+
__decorate$1([
|
|
20029
|
+
ignoreClone
|
|
20030
|
+
], HingeJoint.prototype, "_hingeFlags", void 0);
|
|
20031
|
+
__decorate$1([
|
|
20032
|
+
ignoreClone
|
|
20033
|
+
], HingeJoint.prototype, "_useSpring", void 0);
|
|
20034
|
+
__decorate$1([
|
|
20035
|
+
ignoreClone
|
|
20036
|
+
], HingeJoint.prototype, "_jointMonitor", void 0);
|
|
20037
|
+
__decorate$1([
|
|
20038
|
+
ignoreClone
|
|
20039
|
+
], HingeJoint.prototype, "_limits", void 0);
|
|
19803
20040
|
/**
|
|
19804
20041
|
* A joint that maintains an upper or lower bound (or both) on the distance between two points on different objects.
|
|
19805
20042
|
*/ var SpringJoint = /*#__PURE__*/ function(Joint1) {
|
|
@@ -19818,21 +20055,31 @@
|
|
|
19818
20055
|
/**
|
|
19819
20056
|
* @internal
|
|
19820
20057
|
*/ _proto._onAwake = function _onAwake() {
|
|
19821
|
-
var collider = this.
|
|
20058
|
+
var collider = this._colliderInfo;
|
|
19822
20059
|
collider.localPosition = new Vector3();
|
|
19823
20060
|
collider.collider = this.entity.getComponent(exports.Collider);
|
|
19824
20061
|
this._nativeJoint = PhysicsScene._nativePhysics.createSpringJoint(collider.collider._nativeCollider);
|
|
19825
20062
|
};
|
|
20063
|
+
/**
|
|
20064
|
+
* @internal
|
|
20065
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
20066
|
+
target.swingOffset = this.swingOffset;
|
|
20067
|
+
target.minDistance = this.minDistance;
|
|
20068
|
+
target.maxDistance = this.maxDistance;
|
|
20069
|
+
target.tolerance = this.tolerance;
|
|
20070
|
+
target.stiffness = this.stiffness;
|
|
20071
|
+
target.damping = this.damping;
|
|
20072
|
+
};
|
|
19826
20073
|
_create_class$3(SpringJoint, [
|
|
19827
20074
|
{
|
|
19828
20075
|
key: "swingOffset",
|
|
19829
20076
|
get: /**
|
|
19830
20077
|
* The swing offset.
|
|
19831
20078
|
*/ function get() {
|
|
19832
|
-
return this.
|
|
20079
|
+
return this._colliderInfo.localPosition;
|
|
19833
20080
|
},
|
|
19834
20081
|
set: function set(value) {
|
|
19835
|
-
var swingOffset = this.
|
|
20082
|
+
var swingOffset = this._colliderInfo.localPosition;
|
|
19836
20083
|
if (value !== swingOffset) {
|
|
19837
20084
|
swingOffset.copyFrom(value);
|
|
19838
20085
|
}
|
|
@@ -19954,6 +20201,15 @@
|
|
|
19954
20201
|
var _proto = ColliderShape.prototype;
|
|
19955
20202
|
/**
|
|
19956
20203
|
* @internal
|
|
20204
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
20205
|
+
target.contactOffset = this.contactOffset;
|
|
20206
|
+
target.rotation = this.rotation;
|
|
20207
|
+
target.position = this.position;
|
|
20208
|
+
target.isTrigger = this.isTrigger;
|
|
20209
|
+
target.material = this.material;
|
|
20210
|
+
};
|
|
20211
|
+
/**
|
|
20212
|
+
* @internal
|
|
19957
20213
|
*/ _proto._destroy = function _destroy() {
|
|
19958
20214
|
this._material._destroy();
|
|
19959
20215
|
this._nativeShape.destroy();
|
|
@@ -20055,6 +20311,30 @@
|
|
|
20055
20311
|
(function() {
|
|
20056
20312
|
ColliderShape._idGenerator = 0;
|
|
20057
20313
|
})();
|
|
20314
|
+
__decorate$1([
|
|
20315
|
+
ignoreClone
|
|
20316
|
+
], ColliderShape.prototype, "_collider", void 0);
|
|
20317
|
+
__decorate$1([
|
|
20318
|
+
ignoreClone
|
|
20319
|
+
], ColliderShape.prototype, "_nativeShape", void 0);
|
|
20320
|
+
__decorate$1([
|
|
20321
|
+
ignoreClone
|
|
20322
|
+
], ColliderShape.prototype, "_id", void 0);
|
|
20323
|
+
__decorate$1([
|
|
20324
|
+
ignoreClone
|
|
20325
|
+
], ColliderShape.prototype, "_material", void 0);
|
|
20326
|
+
__decorate$1([
|
|
20327
|
+
ignoreClone
|
|
20328
|
+
], ColliderShape.prototype, "_isTrigger", void 0);
|
|
20329
|
+
__decorate$1([
|
|
20330
|
+
ignoreClone
|
|
20331
|
+
], ColliderShape.prototype, "_rotation", void 0);
|
|
20332
|
+
__decorate$1([
|
|
20333
|
+
ignoreClone
|
|
20334
|
+
], ColliderShape.prototype, "_position", void 0);
|
|
20335
|
+
__decorate$1([
|
|
20336
|
+
ignoreClone
|
|
20337
|
+
], ColliderShape.prototype, "_contactOffset", void 0);
|
|
20058
20338
|
/**
|
|
20059
20339
|
* Physical collider shape for box.
|
|
20060
20340
|
*/ var BoxColliderShape = /*#__PURE__*/ function(ColliderShape1) {
|
|
@@ -20070,6 +20350,12 @@
|
|
|
20070
20350
|
};
|
|
20071
20351
|
_inherits$2(BoxColliderShape, ColliderShape1);
|
|
20072
20352
|
var _proto = BoxColliderShape.prototype;
|
|
20353
|
+
/**
|
|
20354
|
+
* @internal
|
|
20355
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
20356
|
+
ColliderShape1.prototype._cloneTo.call(this, target);
|
|
20357
|
+
target.size = this.size;
|
|
20358
|
+
};
|
|
20073
20359
|
_proto._setSize = function _setSize() {
|
|
20074
20360
|
this._nativeShape.setSize(this._size);
|
|
20075
20361
|
};
|
|
@@ -20090,6 +20376,9 @@
|
|
|
20090
20376
|
]);
|
|
20091
20377
|
return BoxColliderShape;
|
|
20092
20378
|
}(ColliderShape);
|
|
20379
|
+
__decorate$1([
|
|
20380
|
+
ignoreClone
|
|
20381
|
+
], BoxColliderShape.prototype, "_size", void 0);
|
|
20093
20382
|
/**
|
|
20094
20383
|
* Physical collider shape for sphere.
|
|
20095
20384
|
*/ var SphereColliderShape = /*#__PURE__*/ function(ColliderShape1) {
|
|
@@ -20101,6 +20390,11 @@
|
|
|
20101
20390
|
return _this;
|
|
20102
20391
|
};
|
|
20103
20392
|
_inherits$2(SphereColliderShape, ColliderShape1);
|
|
20393
|
+
var _proto = SphereColliderShape.prototype;
|
|
20394
|
+
_proto._cloneTo = function _cloneTo(target) {
|
|
20395
|
+
ColliderShape1.prototype._cloneTo.call(this, target);
|
|
20396
|
+
target.radius = this.radius;
|
|
20397
|
+
};
|
|
20104
20398
|
_create_class$3(SphereColliderShape, [
|
|
20105
20399
|
{
|
|
20106
20400
|
key: "radius",
|
|
@@ -20119,6 +20413,9 @@
|
|
|
20119
20413
|
]);
|
|
20120
20414
|
return SphereColliderShape;
|
|
20121
20415
|
}(ColliderShape);
|
|
20416
|
+
__decorate$1([
|
|
20417
|
+
ignoreClone
|
|
20418
|
+
], SphereColliderShape.prototype, "_radius", void 0);
|
|
20122
20419
|
/**
|
|
20123
20420
|
* Physical collider shape plane.
|
|
20124
20421
|
*/ var PlaneColliderShape = /*#__PURE__*/ function(ColliderShape1) {
|
|
@@ -20144,6 +20441,15 @@
|
|
|
20144
20441
|
return _this;
|
|
20145
20442
|
};
|
|
20146
20443
|
_inherits$2(CapsuleColliderShape, ColliderShape1);
|
|
20444
|
+
var _proto = CapsuleColliderShape.prototype;
|
|
20445
|
+
/**
|
|
20446
|
+
* @internal
|
|
20447
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
20448
|
+
ColliderShape1.prototype._cloneTo.call(this, target);
|
|
20449
|
+
target.radius = this.radius;
|
|
20450
|
+
target.height = this.height;
|
|
20451
|
+
target.upAxis = this.upAxis;
|
|
20452
|
+
};
|
|
20147
20453
|
_create_class$3(CapsuleColliderShape, [
|
|
20148
20454
|
{
|
|
20149
20455
|
key: "radius",
|
|
@@ -20190,6 +20496,15 @@
|
|
|
20190
20496
|
]);
|
|
20191
20497
|
return CapsuleColliderShape;
|
|
20192
20498
|
}(ColliderShape);
|
|
20499
|
+
__decorate$1([
|
|
20500
|
+
ignoreClone
|
|
20501
|
+
], CapsuleColliderShape.prototype, "_radius", void 0);
|
|
20502
|
+
__decorate$1([
|
|
20503
|
+
ignoreClone
|
|
20504
|
+
], CapsuleColliderShape.prototype, "_height", void 0);
|
|
20505
|
+
__decorate$1([
|
|
20506
|
+
ignoreClone
|
|
20507
|
+
], CapsuleColliderShape.prototype, "_upAxis", void 0);
|
|
20193
20508
|
/**
|
|
20194
20509
|
* Pointer Manager.
|
|
20195
20510
|
* @internal
|
|
@@ -20279,9 +20594,9 @@
|
|
|
20279
20594
|
pointer._firePointerDrag();
|
|
20280
20595
|
var rayCastEntity = this._pointerRayCast(scenes, position.x / canvas.width, position.y / canvas.height);
|
|
20281
20596
|
pointer._firePointerExitAndEnter(rayCastEntity);
|
|
20282
|
-
var
|
|
20283
|
-
if (
|
|
20284
|
-
for(var i1 = 0; i1 <
|
|
20597
|
+
var length = events.length;
|
|
20598
|
+
if (length > 0) {
|
|
20599
|
+
for(var i1 = 0; i1 < length; i1++){
|
|
20285
20600
|
switch(events[i1].type){
|
|
20286
20601
|
case "pointerdown":
|
|
20287
20602
|
pointer.phase = exports.PointerPhase.Down;
|
|
@@ -20376,15 +20691,15 @@
|
|
|
20376
20691
|
};
|
|
20377
20692
|
_proto._updatePointerInfo = function _updatePointerInfo(frameCount, pointer, left, top, widthPixelRatio, heightPixelRatio) {
|
|
20378
20693
|
var events = pointer._events, position = pointer.position;
|
|
20379
|
-
var
|
|
20380
|
-
if (
|
|
20694
|
+
var length = events.length;
|
|
20695
|
+
if (length > 0) {
|
|
20381
20696
|
var _this = this, _upList = _this._upList, _upMap = _this._upMap, _downList = _this._downList, _downMap = _this._downMap;
|
|
20382
|
-
var latestEvent = events[
|
|
20697
|
+
var latestEvent = events[length - 1];
|
|
20383
20698
|
var currX = (latestEvent.clientX - left) * widthPixelRatio;
|
|
20384
20699
|
var currY = (latestEvent.clientY - top) * heightPixelRatio;
|
|
20385
20700
|
pointer.deltaPosition.set(currX - position.x, currY - position.y);
|
|
20386
20701
|
position.set(currX, currY);
|
|
20387
|
-
for(var i = 0; i <
|
|
20702
|
+
for(var i = 0; i < length; i++){
|
|
20388
20703
|
var event = events[i];
|
|
20389
20704
|
var button = event.button;
|
|
20390
20705
|
pointer.button = _pointerDec2BinMap[button] || exports.PointerButton.None;
|
|
@@ -20426,8 +20741,8 @@
|
|
|
20426
20741
|
continue;
|
|
20427
20742
|
}
|
|
20428
20743
|
var cameras = scene._activeCameras;
|
|
20429
|
-
for(var j =
|
|
20430
|
-
var camera = cameras[
|
|
20744
|
+
for(var j = cameras.length - 1; j >= 0; j--){
|
|
20745
|
+
var camera = cameras[j];
|
|
20431
20746
|
if (!camera.enabled || camera.renderTarget) {
|
|
20432
20747
|
continue;
|
|
20433
20748
|
}
|
|
@@ -21087,10 +21402,6 @@
|
|
|
21087
21402
|
magentaMaterial.isGCIgnored = true;
|
|
21088
21403
|
magentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
21089
21404
|
_this._magentaMaterial = magentaMaterial;
|
|
21090
|
-
var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
|
|
21091
|
-
backgroundTextureMaterial.isGCIgnored = true;
|
|
21092
|
-
backgroundTextureMaterial.renderState.depthState.compareFunction = exports.CompareFunction.LessEqual;
|
|
21093
|
-
_this._backgroundTextureMaterial = backgroundTextureMaterial;
|
|
21094
21405
|
var innerSettings = _this._settings;
|
|
21095
21406
|
var colorSpace = configuration.colorSpace || exports.ColorSpace.Linear;
|
|
21096
21407
|
colorSpace === exports.ColorSpace.Gamma && _this._macroCollection.enable(Engine._gammaMacro);
|
|
@@ -21254,9 +21565,9 @@
|
|
|
21254
21565
|
var shaderProgramPools = this._shaderProgramPools;
|
|
21255
21566
|
var pool = shaderProgramPools[index];
|
|
21256
21567
|
if (!pool) {
|
|
21257
|
-
var
|
|
21258
|
-
if (
|
|
21259
|
-
shaderProgramPools.length =
|
|
21568
|
+
var length = index + 1;
|
|
21569
|
+
if (length > shaderProgramPools.length) {
|
|
21570
|
+
shaderProgramPools.length = length;
|
|
21260
21571
|
}
|
|
21261
21572
|
shaderProgramPools[index] = pool = new ShaderProgramPool();
|
|
21262
21573
|
}
|
|
@@ -21637,7 +21948,7 @@
|
|
|
21637
21948
|
program.uploadAll(program.materialUniformBlock, materialShaderData);
|
|
21638
21949
|
program.uploadUnGroupTextures();
|
|
21639
21950
|
renderState._apply(engine, false, pass._renderStateDataMap, materialShaderData);
|
|
21640
|
-
rhi.drawPrimitive(mesh, mesh.subMesh, program);
|
|
21951
|
+
rhi.drawPrimitive(mesh._primitive, mesh.subMesh, program);
|
|
21641
21952
|
cameraShaderData.setMatrix(RenderContext.vpMatrixProperty, originViewProjMatrix);
|
|
21642
21953
|
};
|
|
21643
21954
|
_create_class$3(Sky, [
|
|
@@ -21704,34 +22015,29 @@
|
|
|
21704
22015
|
this./** @internal */ _textureFillMode = exports.BackgroundTextureFillMode.AspectFitHeight;
|
|
21705
22016
|
this._texture = null;
|
|
21706
22017
|
this._initMesh(_engine);
|
|
22018
|
+
this._initMaterial(_engine);
|
|
21707
22019
|
};
|
|
21708
22020
|
var _proto = Background.prototype;
|
|
21709
22021
|
/**
|
|
21710
22022
|
* @internal
|
|
21711
22023
|
*/ _proto.destroy = function destroy() {
|
|
22024
|
+
this.texture = null;
|
|
21712
22025
|
this._mesh._addReferCount(-1);
|
|
21713
22026
|
this._mesh = null;
|
|
21714
|
-
this.
|
|
22027
|
+
this._material._addReferCount(-1);
|
|
22028
|
+
this._material = null;
|
|
21715
22029
|
this.solidColor = null;
|
|
21716
22030
|
this.sky.destroy();
|
|
21717
22031
|
};
|
|
21718
22032
|
/**
|
|
21719
22033
|
* @internal
|
|
21720
|
-
* Standalone for CanvasRenderer plugin.
|
|
21721
|
-
*/ _proto._initMesh = function _initMesh(engine) {
|
|
21722
|
-
this._mesh = this._createPlane(engine);
|
|
21723
|
-
this._mesh._addReferCount(1);
|
|
21724
|
-
};
|
|
21725
|
-
/**
|
|
21726
|
-
* @internal
|
|
21727
22034
|
*/ _proto._resizeBackgroundTexture = function _resizeBackgroundTexture() {
|
|
22035
|
+
var _this = this, texture = _this._texture, mesh = _this._mesh;
|
|
21728
22036
|
if (!this._texture) {
|
|
21729
22037
|
return;
|
|
21730
22038
|
}
|
|
21731
|
-
var
|
|
21732
|
-
var
|
|
21733
|
-
var _this = this, _backgroundTextureMesh = _this._mesh;
|
|
21734
|
-
var positions = _backgroundTextureMesh.getPositions();
|
|
22039
|
+
var _this__engine_canvas = this._engine.canvas, width = _this__engine_canvas.width, height = _this__engine_canvas.height;
|
|
22040
|
+
var positions = mesh.getPositions();
|
|
21735
22041
|
switch(this._textureFillMode){
|
|
21736
22042
|
case exports.BackgroundTextureFillMode.Fill:
|
|
21737
22043
|
positions[0].set(-1, -1, 1);
|
|
@@ -21740,22 +22046,31 @@
|
|
|
21740
22046
|
positions[3].set(1, 1, 1);
|
|
21741
22047
|
break;
|
|
21742
22048
|
case exports.BackgroundTextureFillMode.AspectFitWidth:
|
|
21743
|
-
var fitWidthScale =
|
|
22049
|
+
var fitWidthScale = texture.height * width / texture.width / height;
|
|
21744
22050
|
positions[0].set(-1, -fitWidthScale, 1);
|
|
21745
22051
|
positions[1].set(1, -fitWidthScale, 1);
|
|
21746
22052
|
positions[2].set(-1, fitWidthScale, 1);
|
|
21747
22053
|
positions[3].set(1, fitWidthScale, 1);
|
|
21748
22054
|
break;
|
|
21749
22055
|
case exports.BackgroundTextureFillMode.AspectFitHeight:
|
|
21750
|
-
var fitHeightScale =
|
|
22056
|
+
var fitHeightScale = texture.width * height / texture.height / width;
|
|
21751
22057
|
positions[0].set(-fitHeightScale, -1, 1);
|
|
21752
22058
|
positions[1].set(fitHeightScale, -1, 1);
|
|
21753
22059
|
positions[2].set(-fitHeightScale, 1, 1);
|
|
21754
22060
|
positions[3].set(fitHeightScale, 1, 1);
|
|
21755
22061
|
break;
|
|
21756
22062
|
}
|
|
21757
|
-
|
|
21758
|
-
|
|
22063
|
+
mesh.setPositions(positions);
|
|
22064
|
+
mesh.uploadData(false);
|
|
22065
|
+
};
|
|
22066
|
+
_proto._initMesh = function _initMesh(engine) {
|
|
22067
|
+
this._mesh = this._createPlane(engine);
|
|
22068
|
+
this._mesh._addReferCount(1);
|
|
22069
|
+
};
|
|
22070
|
+
_proto._initMaterial = function _initMaterial(engine) {
|
|
22071
|
+
var material = this._material = new Material(engine, Shader.find("background-texture"));
|
|
22072
|
+
material.renderState.depthState.compareFunction = exports.CompareFunction.LessEqual;
|
|
22073
|
+
material._addReferCount(1);
|
|
21759
22074
|
};
|
|
21760
22075
|
_proto._createPlane = function _createPlane(engine) {
|
|
21761
22076
|
var mesh = new ModelMesh(engine);
|
|
@@ -21796,14 +22111,14 @@
|
|
|
21796
22111
|
(_value = value) == null ? void 0 : _value._addReferCount(1);
|
|
21797
22112
|
(_this__texture = this._texture) == null ? void 0 : _this__texture._addReferCount(-1);
|
|
21798
22113
|
this._texture = value;
|
|
21799
|
-
this.
|
|
22114
|
+
this._material.shaderData.setTexture("material_BaseTexture", value);
|
|
22115
|
+
this._resizeBackgroundTexture();
|
|
21800
22116
|
}
|
|
21801
22117
|
}
|
|
21802
22118
|
},
|
|
21803
22119
|
{
|
|
21804
22120
|
key: "textureFillMode",
|
|
21805
22121
|
get: /**
|
|
21806
|
-
* @internal
|
|
21807
22122
|
* Background texture fill mode.
|
|
21808
22123
|
* @remarks When `mode` is `BackgroundMode.Texture`, the property will take effects.
|
|
21809
22124
|
* @defaultValue `BackgroundTextureFillMode.FitHeight`
|
|
@@ -21920,40 +22235,44 @@
|
|
|
21920
22235
|
};
|
|
21921
22236
|
_proto.callScriptOnUpdate = function callScriptOnUpdate(deltaTime) {
|
|
21922
22237
|
this._onUpdateScripts.forEach(function(element) {
|
|
21923
|
-
|
|
21924
|
-
|
|
21925
|
-
|
|
22238
|
+
element._started && element.onUpdate(deltaTime);
|
|
22239
|
+
}, function(element, index) {
|
|
22240
|
+
element._onUpdateIndex = index;
|
|
21926
22241
|
});
|
|
21927
22242
|
};
|
|
21928
22243
|
_proto.callScriptOnLateUpdate = function callScriptOnLateUpdate(deltaTime) {
|
|
21929
22244
|
this._onLateUpdateScripts.forEach(function(element) {
|
|
21930
|
-
|
|
21931
|
-
|
|
21932
|
-
|
|
22245
|
+
element._started && element.onLateUpdate(deltaTime);
|
|
22246
|
+
}, function(element, index) {
|
|
22247
|
+
element._onLateUpdateIndex = index;
|
|
21933
22248
|
});
|
|
21934
22249
|
};
|
|
21935
22250
|
_proto.callScriptOnPhysicsUpdate = function callScriptOnPhysicsUpdate() {
|
|
21936
22251
|
this._onPhysicsUpdateScripts.forEach(function(element) {
|
|
21937
|
-
|
|
21938
|
-
|
|
21939
|
-
|
|
22252
|
+
element._started && element.onPhysicsUpdate();
|
|
22253
|
+
}, function(element, index) {
|
|
22254
|
+
element._onPhysicsUpdateIndex = index;
|
|
21940
22255
|
});
|
|
21941
22256
|
};
|
|
21942
22257
|
_proto.callAnimationUpdate = function callAnimationUpdate(deltaTime) {
|
|
21943
22258
|
this._onUpdateAnimations.forEach(function(element) {
|
|
21944
22259
|
element.engine.time.frameCount > element._playFrameCount && element.update(deltaTime);
|
|
22260
|
+
}, function(element, index) {
|
|
22261
|
+
element._onUpdateIndex = index;
|
|
21945
22262
|
});
|
|
21946
22263
|
};
|
|
21947
22264
|
_proto.callRendererOnUpdate = function callRendererOnUpdate(deltaTime) {
|
|
21948
22265
|
this._onUpdateRenderers.forEach(function(element) {
|
|
21949
22266
|
element.update(deltaTime);
|
|
22267
|
+
}, function(element, index) {
|
|
22268
|
+
element._onUpdateIndex = index;
|
|
21950
22269
|
});
|
|
21951
22270
|
};
|
|
21952
22271
|
_proto.handlingInvalidScripts = function handlingInvalidScripts() {
|
|
21953
22272
|
var _this = this, pendingDestroyScripts = _this._disposeDestroyScripts, disposeDestroyScripts = _this._pendingDestroyScripts;
|
|
21954
22273
|
this._disposeDestroyScripts = disposeDestroyScripts;
|
|
21955
22274
|
this._pendingDestroyScripts = pendingDestroyScripts;
|
|
21956
|
-
length = disposeDestroyScripts.length;
|
|
22275
|
+
var length = disposeDestroyScripts.length;
|
|
21957
22276
|
if (length > 0) {
|
|
21958
22277
|
for(var i = length - 1; i >= 0; i--){
|
|
21959
22278
|
disposeDestroyScripts[i].onDestroy();
|
|
@@ -21964,11 +22283,15 @@
|
|
|
21964
22283
|
_proto.callCameraOnBeginRender = function callCameraOnBeginRender(camera) {
|
|
21965
22284
|
camera.entity._scripts.forEach(function(element) {
|
|
21966
22285
|
element.onBeginRender(camera);
|
|
22286
|
+
}, function(element, index) {
|
|
22287
|
+
element._entityScriptsIndex = index;
|
|
21967
22288
|
});
|
|
21968
22289
|
};
|
|
21969
22290
|
_proto.callCameraOnEndRender = function callCameraOnEndRender(camera) {
|
|
21970
22291
|
camera.entity._scripts.forEach(function(element) {
|
|
21971
22292
|
element.onEndRender(camera);
|
|
22293
|
+
}, function(element, index) {
|
|
22294
|
+
element._entityScriptsIndex = index;
|
|
21972
22295
|
});
|
|
21973
22296
|
};
|
|
21974
22297
|
_proto.getActiveChangedTempList = function getActiveChangedTempList() {
|
|
@@ -22363,11 +22686,6 @@
|
|
|
22363
22686
|
]);
|
|
22364
22687
|
return Light;
|
|
22365
22688
|
}(Component);
|
|
22366
|
-
(function() {
|
|
22367
|
-
/**
|
|
22368
|
-
* Each type of light source is at most 10, beyond which it will not take effect.
|
|
22369
|
-
* */ Light._maxLight = 10;
|
|
22370
|
-
})();
|
|
22371
22689
|
__decorate$1([
|
|
22372
22690
|
ignoreClone
|
|
22373
22691
|
], Light.prototype, "_lightIndex", void 0);
|
|
@@ -22384,13 +22702,12 @@
|
|
|
22384
22702
|
var _proto = DirectLight.prototype;
|
|
22385
22703
|
/**
|
|
22386
22704
|
* @internal
|
|
22387
|
-
*/ _proto._appendData = function _appendData(lightIndex) {
|
|
22705
|
+
*/ _proto._appendData = function _appendData(lightIndex, data) {
|
|
22388
22706
|
var cullingMaskStart = lightIndex * 2;
|
|
22389
22707
|
var colorStart = lightIndex * 3;
|
|
22390
22708
|
var directionStart = lightIndex * 3;
|
|
22391
22709
|
var lightColor = this._getLightIntensityColor();
|
|
22392
22710
|
var direction = this.direction;
|
|
22393
|
-
var data = DirectLight._combinedData;
|
|
22394
22711
|
var cullingMask = this.cullingMask;
|
|
22395
22712
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
22396
22713
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
@@ -22419,8 +22736,7 @@
|
|
|
22419
22736
|
};
|
|
22420
22737
|
/**
|
|
22421
22738
|
* @internal
|
|
22422
|
-
*/ DirectLight._updateShaderData = function _updateShaderData(shaderData) {
|
|
22423
|
-
var data = DirectLight._combinedData;
|
|
22739
|
+
*/ DirectLight._updateShaderData = function _updateShaderData(shaderData, data) {
|
|
22424
22740
|
shaderData.setIntArray(DirectLight._cullingMaskProperty, data.cullingMask);
|
|
22425
22741
|
shaderData.setFloatArray(DirectLight._colorProperty, data.color);
|
|
22426
22742
|
shaderData.setFloatArray(DirectLight._directionProperty, data.direction);
|
|
@@ -22463,13 +22779,6 @@
|
|
|
22463
22779
|
(function() {
|
|
22464
22780
|
DirectLight._directionProperty = ShaderProperty.getByName("scene_DirectLightDirection");
|
|
22465
22781
|
})();
|
|
22466
|
-
(function() {
|
|
22467
|
-
DirectLight._combinedData = {
|
|
22468
|
-
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
22469
|
-
color: new Float32Array(Light._maxLight * 3),
|
|
22470
|
-
direction: new Float32Array(Light._maxLight * 3)
|
|
22471
|
-
};
|
|
22472
|
-
})();
|
|
22473
22782
|
/**
|
|
22474
22783
|
* Point light.
|
|
22475
22784
|
*/ var PointLight = /*#__PURE__*/ function(Light1) {
|
|
@@ -22483,14 +22792,13 @@
|
|
|
22483
22792
|
var _proto = PointLight.prototype;
|
|
22484
22793
|
/**
|
|
22485
22794
|
* @internal
|
|
22486
|
-
*/ _proto._appendData = function _appendData(lightIndex) {
|
|
22795
|
+
*/ _proto._appendData = function _appendData(lightIndex, data) {
|
|
22487
22796
|
var cullingMaskStart = lightIndex * 2;
|
|
22488
22797
|
var colorStart = lightIndex * 3;
|
|
22489
22798
|
var positionStart = lightIndex * 3;
|
|
22490
22799
|
var distanceStart = lightIndex;
|
|
22491
22800
|
var lightColor = this._getLightIntensityColor();
|
|
22492
22801
|
var lightPosition = this.position;
|
|
22493
|
-
var data = PointLight._combinedData;
|
|
22494
22802
|
var cullingMask = this.cullingMask;
|
|
22495
22803
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
22496
22804
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
@@ -22520,8 +22828,7 @@
|
|
|
22520
22828
|
};
|
|
22521
22829
|
/**
|
|
22522
22830
|
* @internal
|
|
22523
|
-
*/ PointLight._updateShaderData = function _updateShaderData(shaderData) {
|
|
22524
|
-
var data = PointLight._combinedData;
|
|
22831
|
+
*/ PointLight._updateShaderData = function _updateShaderData(shaderData, data) {
|
|
22525
22832
|
shaderData.setIntArray(PointLight._cullingMaskProperty, data.cullingMask);
|
|
22526
22833
|
shaderData.setFloatArray(PointLight._colorProperty, data.color);
|
|
22527
22834
|
shaderData.setFloatArray(PointLight._positionProperty, data.position);
|
|
@@ -22559,14 +22866,6 @@
|
|
|
22559
22866
|
(function() {
|
|
22560
22867
|
PointLight._distanceProperty = ShaderProperty.getByName("scene_PointLightDistance");
|
|
22561
22868
|
})();
|
|
22562
|
-
(function() {
|
|
22563
|
-
PointLight._combinedData = {
|
|
22564
|
-
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
22565
|
-
color: new Float32Array(Light._maxLight * 3),
|
|
22566
|
-
position: new Float32Array(Light._maxLight * 3),
|
|
22567
|
-
distance: new Float32Array(Light._maxLight)
|
|
22568
|
-
};
|
|
22569
|
-
})();
|
|
22570
22869
|
/**
|
|
22571
22870
|
* Spot light.
|
|
22572
22871
|
*/ var SpotLight = /*#__PURE__*/ function(Light1) {
|
|
@@ -22584,7 +22883,7 @@
|
|
|
22584
22883
|
var _proto = SpotLight.prototype;
|
|
22585
22884
|
/**
|
|
22586
22885
|
* @internal
|
|
22587
|
-
*/ _proto._appendData = function _appendData(lightIndex) {
|
|
22886
|
+
*/ _proto._appendData = function _appendData(lightIndex, data) {
|
|
22588
22887
|
var cullingMaskStart = lightIndex * 2;
|
|
22589
22888
|
var colorStart = lightIndex * 3;
|
|
22590
22889
|
var positionStart = lightIndex * 3;
|
|
@@ -22595,7 +22894,6 @@
|
|
|
22595
22894
|
var lightColor = this._getLightIntensityColor();
|
|
22596
22895
|
var position = this.position;
|
|
22597
22896
|
var direction = this.direction;
|
|
22598
|
-
var data = SpotLight._combinedData;
|
|
22599
22897
|
var cullingMask = this.cullingMask;
|
|
22600
22898
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
22601
22899
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
@@ -22630,8 +22928,7 @@
|
|
|
22630
22928
|
};
|
|
22631
22929
|
/**
|
|
22632
22930
|
* @internal
|
|
22633
|
-
*/ SpotLight._updateShaderData = function _updateShaderData(shaderData) {
|
|
22634
|
-
var data = SpotLight._combinedData;
|
|
22931
|
+
*/ SpotLight._updateShaderData = function _updateShaderData(shaderData, data) {
|
|
22635
22932
|
shaderData.setIntArray(SpotLight._cullingMaskProperty, data.cullingMask);
|
|
22636
22933
|
shaderData.setFloatArray(SpotLight._colorProperty, data.color);
|
|
22637
22934
|
shaderData.setFloatArray(SpotLight._positionProperty, data.position);
|
|
@@ -22701,25 +22998,34 @@
|
|
|
22701
22998
|
(function() {
|
|
22702
22999
|
SpotLight._penumbraCosProperty = ShaderProperty.getByName("scene_SpotLightPenumbraCos");
|
|
22703
23000
|
})();
|
|
22704
|
-
(function() {
|
|
22705
|
-
SpotLight._combinedData = {
|
|
22706
|
-
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
22707
|
-
color: new Float32Array(Light._maxLight * 3),
|
|
22708
|
-
position: new Float32Array(Light._maxLight * 3),
|
|
22709
|
-
direction: new Float32Array(Light._maxLight * 3),
|
|
22710
|
-
distance: new Float32Array(Light._maxLight),
|
|
22711
|
-
angleCos: new Float32Array(Light._maxLight),
|
|
22712
|
-
penumbraCos: new Float32Array(Light._maxLight)
|
|
22713
|
-
};
|
|
22714
|
-
})();
|
|
22715
23001
|
/**
|
|
22716
23002
|
* Light manager.
|
|
22717
23003
|
*/ var LightManager = /*#__PURE__*/ function() {
|
|
22718
|
-
|
|
23004
|
+
function LightManager() {
|
|
22719
23005
|
/** @internal */ this._spotLights = new DisorderedArray();
|
|
22720
23006
|
/** @internal */ this._pointLights = new DisorderedArray();
|
|
22721
23007
|
/** @internal */ this._directLights = new DisorderedArray();
|
|
22722
|
-
|
|
23008
|
+
this._directData = {
|
|
23009
|
+
cullingMask: new Int32Array(LightManager._maxLight * 2),
|
|
23010
|
+
color: new Float32Array(LightManager._maxLight * 3),
|
|
23011
|
+
direction: new Float32Array(LightManager._maxLight * 3)
|
|
23012
|
+
};
|
|
23013
|
+
this._pointData = {
|
|
23014
|
+
cullingMask: new Int32Array(LightManager._maxLight * 2),
|
|
23015
|
+
color: new Float32Array(LightManager._maxLight * 3),
|
|
23016
|
+
position: new Float32Array(LightManager._maxLight * 3),
|
|
23017
|
+
distance: new Float32Array(LightManager._maxLight)
|
|
23018
|
+
};
|
|
23019
|
+
this._spotData = {
|
|
23020
|
+
cullingMask: new Int32Array(LightManager._maxLight * 2),
|
|
23021
|
+
color: new Float32Array(LightManager._maxLight * 3),
|
|
23022
|
+
position: new Float32Array(LightManager._maxLight * 3),
|
|
23023
|
+
direction: new Float32Array(LightManager._maxLight * 3),
|
|
23024
|
+
distance: new Float32Array(LightManager._maxLight),
|
|
23025
|
+
angleCos: new Float32Array(LightManager._maxLight),
|
|
23026
|
+
penumbraCos: new Float32Array(LightManager._maxLight)
|
|
23027
|
+
};
|
|
23028
|
+
}
|
|
22723
23029
|
var _proto = LightManager.prototype;
|
|
22724
23030
|
/**
|
|
22725
23031
|
* @internal
|
|
@@ -22778,38 +23084,34 @@
|
|
|
22778
23084
|
/**
|
|
22779
23085
|
* @internal
|
|
22780
23086
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
22781
|
-
var spotLight =
|
|
22782
|
-
var
|
|
22783
|
-
var directLight = this._directLights;
|
|
23087
|
+
var _this = this, spotLight = _this._spotLights, pointLight = _this._pointLights, directLight = _this._directLights;
|
|
23088
|
+
var _this1 = this, spotData = _this1._spotData, pointData = _this1._pointData, directData = _this1._directData;
|
|
22784
23089
|
var spotLightCount = spotLight.length;
|
|
22785
23090
|
var pointLightCount = pointLight.length;
|
|
22786
23091
|
var directLightCount = directLight.length;
|
|
22787
|
-
for(var i = 0
|
|
22788
|
-
|
|
22789
|
-
light._appendData(i);
|
|
23092
|
+
for(var i = 0; i < spotLightCount; i++){
|
|
23093
|
+
spotLight.get(i)._appendData(i, spotData);
|
|
22790
23094
|
}
|
|
22791
|
-
for(var i1 = 0
|
|
22792
|
-
|
|
22793
|
-
light1._appendData(i1);
|
|
23095
|
+
for(var i1 = 0; i1 < pointLightCount; i1++){
|
|
23096
|
+
pointLight.get(i1)._appendData(i1, pointData);
|
|
22794
23097
|
}
|
|
22795
|
-
for(var i2 = 0
|
|
22796
|
-
|
|
22797
|
-
light2._appendData(i2);
|
|
23098
|
+
for(var i2 = 0; i2 < directLightCount; i2++){
|
|
23099
|
+
directLight.get(i2)._appendData(i2, directData);
|
|
22798
23100
|
}
|
|
22799
23101
|
if (directLightCount) {
|
|
22800
|
-
DirectLight._updateShaderData(shaderData);
|
|
23102
|
+
DirectLight._updateShaderData(shaderData, directData);
|
|
22801
23103
|
shaderData.enableMacro("SCENE_DIRECT_LIGHT_COUNT", directLightCount.toString());
|
|
22802
23104
|
} else {
|
|
22803
23105
|
shaderData.disableMacro("SCENE_DIRECT_LIGHT_COUNT");
|
|
22804
23106
|
}
|
|
22805
23107
|
if (pointLightCount) {
|
|
22806
|
-
PointLight._updateShaderData(shaderData);
|
|
23108
|
+
PointLight._updateShaderData(shaderData, pointData);
|
|
22807
23109
|
shaderData.enableMacro("SCENE_POINT_LIGHT_COUNT", pointLightCount.toString());
|
|
22808
23110
|
} else {
|
|
22809
23111
|
shaderData.disableMacro("SCENE_POINT_LIGHT_COUNT");
|
|
22810
23112
|
}
|
|
22811
23113
|
if (spotLightCount) {
|
|
22812
|
-
SpotLight._updateShaderData(shaderData);
|
|
23114
|
+
SpotLight._updateShaderData(shaderData, spotData);
|
|
22813
23115
|
shaderData.enableMacro("SCENE_SPOT_LIGHT_COUNT", spotLightCount.toString());
|
|
22814
23116
|
} else {
|
|
22815
23117
|
shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
|
|
@@ -22850,6 +23152,11 @@
|
|
|
22850
23152
|
};
|
|
22851
23153
|
return LightManager;
|
|
22852
23154
|
}();
|
|
23155
|
+
(function() {
|
|
23156
|
+
/**
|
|
23157
|
+
* Each type of light source is at most 10, beyond which it will not take effect.
|
|
23158
|
+
* */ LightManager._maxLight = 10;
|
|
23159
|
+
})();
|
|
22853
23160
|
/**
|
|
22854
23161
|
* Scene.
|
|
22855
23162
|
*/ var Scene = /*#__PURE__*/ function(EngineObject1) {
|
|
@@ -22879,6 +23186,7 @@
|
|
|
22879
23186
|
_this._fogEnd = 300;
|
|
22880
23187
|
_this._fogDensity = 0.01;
|
|
22881
23188
|
_this._fogParams = new Vector4();
|
|
23189
|
+
_this._isActive = true;
|
|
22882
23190
|
_this.name = name1 || "";
|
|
22883
23191
|
var shaderData = _this.shaderData;
|
|
22884
23192
|
shaderData._addReferCount(1);
|
|
@@ -23126,6 +23434,24 @@
|
|
|
23126
23434
|
this._fogParams.w = density / Math.sqrt(Math.LN2);
|
|
23127
23435
|
};
|
|
23128
23436
|
_create_class$3(Scene, [
|
|
23437
|
+
{
|
|
23438
|
+
key: "isActive",
|
|
23439
|
+
get: /**
|
|
23440
|
+
* Whether the scene is active.
|
|
23441
|
+
*/ function get() {
|
|
23442
|
+
return this._isActive;
|
|
23443
|
+
},
|
|
23444
|
+
set: function set(value) {
|
|
23445
|
+
if (this._isActive !== value) {
|
|
23446
|
+
this._isActive = value;
|
|
23447
|
+
if (value) {
|
|
23448
|
+
this._sceneManager && this._processActive(true);
|
|
23449
|
+
} else {
|
|
23450
|
+
this._sceneManager && this._processActive(false);
|
|
23451
|
+
}
|
|
23452
|
+
}
|
|
23453
|
+
}
|
|
23454
|
+
},
|
|
23129
23455
|
{
|
|
23130
23456
|
key: "shaderData",
|
|
23131
23457
|
get: /**
|
|
@@ -23443,7 +23769,11 @@
|
|
|
23443
23769
|
* @internal
|
|
23444
23770
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
23445
23771
|
Component1.prototype._onDestroy.call(this);
|
|
23446
|
-
this.scene
|
|
23772
|
+
if (this.scene) {
|
|
23773
|
+
this.scene._componentsManager.addPendingDestroyScript(this);
|
|
23774
|
+
} else {
|
|
23775
|
+
this.onDestroy();
|
|
23776
|
+
}
|
|
23447
23777
|
};
|
|
23448
23778
|
return Script;
|
|
23449
23779
|
}(Component);
|
|
@@ -23583,7 +23913,7 @@
|
|
|
23583
23913
|
_proto.drawBatches = function drawBatches(camera) {
|
|
23584
23914
|
var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
|
|
23585
23915
|
var mesh = this._meshes[this._flushId];
|
|
23586
|
-
var subMeshes = mesh.subMeshes;
|
|
23916
|
+
var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
|
|
23587
23917
|
var maskManager = engine._spriteMaskManager;
|
|
23588
23918
|
var sceneData = camera.scene.shaderData;
|
|
23589
23919
|
var cameraData = camera.shaderData;
|
|
@@ -23613,7 +23943,7 @@
|
|
|
23613
23943
|
program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
|
|
23614
23944
|
program.uploadAll(program.materialUniformBlock, material.shaderData);
|
|
23615
23945
|
material.renderState._apply(engine, false, shaderPass._renderStateDataMap, material.shaderData);
|
|
23616
|
-
engine._hardwareRenderer.drawPrimitive(
|
|
23946
|
+
engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
|
|
23617
23947
|
maskManager.postRender(renderer);
|
|
23618
23948
|
}
|
|
23619
23949
|
};
|
|
@@ -24980,8 +25310,8 @@
|
|
|
24980
25310
|
};
|
|
24981
25311
|
_proto._drawBackgroundTexture = function _drawBackgroundTexture(engine, background) {
|
|
24982
25312
|
var rhi = engine._hardwareRenderer;
|
|
24983
|
-
var
|
|
24984
|
-
var mesh = background._mesh;
|
|
25313
|
+
var canvas = engine.canvas;
|
|
25314
|
+
var material = background._material, mesh = background._mesh;
|
|
24985
25315
|
if ((this._lastCanvasSize.x !== canvas.width || this._lastCanvasSize.y !== canvas.height) && background._textureFillMode !== exports.BackgroundTextureFillMode.Fill) {
|
|
24986
25316
|
this._lastCanvasSize.set(canvas.width, canvas.height);
|
|
24987
25317
|
background._resizeBackgroundTexture();
|
|
@@ -24992,7 +25322,7 @@
|
|
|
24992
25322
|
program.uploadAll(program.materialUniformBlock, material.shaderData);
|
|
24993
25323
|
program.uploadUnGroupTextures();
|
|
24994
25324
|
(pass._renderState || material.renderState)._apply(engine, false, pass._renderStateDataMap, material.shaderData);
|
|
24995
|
-
rhi.drawPrimitive(mesh, mesh.subMesh, program);
|
|
25325
|
+
rhi.drawPrimitive(mesh._primitive, mesh.subMesh, program);
|
|
24996
25326
|
};
|
|
24997
25327
|
_proto._callRender = function _callRender(context) {
|
|
24998
25328
|
var engine = context.camera.engine;
|
|
@@ -25154,7 +25484,7 @@
|
|
|
25154
25484
|
// Use the intersection of the near clipping plane as the origin point.
|
|
25155
25485
|
var origin = this._innerViewportToWorldPoint(point.x, point.y, 0.0, invViewProjMat, out.origin);
|
|
25156
25486
|
// Use the intersection of the far clipping plane as the origin point.
|
|
25157
|
-
var direction = this._innerViewportToWorldPoint(point.x, point.y, 1.
|
|
25487
|
+
var direction = this._innerViewportToWorldPoint(point.x, point.y, 1 - MathUtil$1.zeroTolerance, invViewProjMat, out.direction);
|
|
25158
25488
|
Vector3.subtract(direction, origin, direction);
|
|
25159
25489
|
direction.normalize();
|
|
25160
25490
|
return out;
|
|
@@ -28129,11 +28459,11 @@
|
|
|
28129
28459
|
/**
|
|
28130
28460
|
* @internal
|
|
28131
28461
|
*/ var CharRenderDataPool = /*#__PURE__*/ function() {
|
|
28132
|
-
var CharRenderDataPool = function CharRenderDataPool(type,
|
|
28462
|
+
var CharRenderDataPool = function CharRenderDataPool(type, length) {
|
|
28133
28463
|
this._elements = [];
|
|
28134
28464
|
this._type = type;
|
|
28135
28465
|
var elements = this._elements;
|
|
28136
|
-
for(var i = 0; i <
|
|
28466
|
+
for(var i = 0; i < length; ++i){
|
|
28137
28467
|
elements[i] = new type();
|
|
28138
28468
|
}
|
|
28139
28469
|
};
|
|
@@ -28768,6 +29098,9 @@
|
|
|
28768
29098
|
this.property = property;
|
|
28769
29099
|
this.component = target.getComponent(type);
|
|
28770
29100
|
this.cureType = cureType;
|
|
29101
|
+
var isBlendShape = _instanceof1$2(this.component, SkinnedMeshRenderer);
|
|
29102
|
+
// @todo: Temp solution with blendShape
|
|
29103
|
+
this._isCopyMode = cureType._isCopyMode && !isBlendShape;
|
|
28771
29104
|
var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
|
|
28772
29105
|
this._assembler = new assemblerType();
|
|
28773
29106
|
this._assembler.initialize(this);
|
|
@@ -28799,7 +29132,7 @@
|
|
|
28799
29132
|
this._assembler.setTargetValue(this.defaultValue);
|
|
28800
29133
|
};
|
|
28801
29134
|
_proto.getEvaluateValue = function getEvaluateValue(out) {
|
|
28802
|
-
if (this.
|
|
29135
|
+
if (this._isCopyMode) {
|
|
28803
29136
|
this.cureType._setValue(this.baseEvaluateData.value, out);
|
|
28804
29137
|
return out;
|
|
28805
29138
|
} else {
|
|
@@ -28807,14 +29140,14 @@
|
|
|
28807
29140
|
}
|
|
28808
29141
|
};
|
|
28809
29142
|
_proto.saveDefaultValue = function saveDefaultValue() {
|
|
28810
|
-
if (this.
|
|
29143
|
+
if (this._isCopyMode) {
|
|
28811
29144
|
this.cureType._setValue(this.referenceTargetValue, this.defaultValue);
|
|
28812
29145
|
} else {
|
|
28813
29146
|
this.defaultValue = this._assembler.getTargetValue();
|
|
28814
29147
|
}
|
|
28815
29148
|
};
|
|
28816
29149
|
_proto.saveFixedPoseValue = function saveFixedPoseValue() {
|
|
28817
|
-
if (this.
|
|
29150
|
+
if (this._isCopyMode) {
|
|
28818
29151
|
this.cureType._setValue(this.referenceTargetValue, this.fixedPoseValue);
|
|
28819
29152
|
} else {
|
|
28820
29153
|
this.fixedPoseValue = this._assembler.getTargetValue();
|
|
@@ -28823,7 +29156,7 @@
|
|
|
28823
29156
|
_proto.applyValue = function applyValue(value, weight, additive) {
|
|
28824
29157
|
var cureType = this.cureType;
|
|
28825
29158
|
if (additive) {
|
|
28826
|
-
if (
|
|
29159
|
+
if (this._isCopyMode) {
|
|
28827
29160
|
cureType._additiveValue(value, weight, this.referenceTargetValue);
|
|
28828
29161
|
} else {
|
|
28829
29162
|
var assembler = this._assembler;
|
|
@@ -28833,13 +29166,13 @@
|
|
|
28833
29166
|
}
|
|
28834
29167
|
} else {
|
|
28835
29168
|
if (weight === 1.0) {
|
|
28836
|
-
if (
|
|
29169
|
+
if (this._isCopyMode) {
|
|
28837
29170
|
cureType._setValue(value, this.referenceTargetValue);
|
|
28838
29171
|
} else {
|
|
28839
29172
|
this._assembler.setTargetValue(value);
|
|
28840
29173
|
}
|
|
28841
29174
|
} else {
|
|
28842
|
-
if (
|
|
29175
|
+
if (this._isCopyMode) {
|
|
28843
29176
|
var targetValue = this.referenceTargetValue;
|
|
28844
29177
|
cureType._lerpValue(targetValue, value, weight, targetValue);
|
|
28845
29178
|
} else {
|
|
@@ -28851,7 +29184,7 @@
|
|
|
28851
29184
|
}
|
|
28852
29185
|
};
|
|
28853
29186
|
_proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
28854
|
-
if (this.
|
|
29187
|
+
if (this._isCopyMode) {
|
|
28855
29188
|
return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
|
|
28856
29189
|
} else {
|
|
28857
29190
|
this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
@@ -28930,16 +29263,22 @@
|
|
|
28930
29263
|
/**
|
|
28931
29264
|
* @internal
|
|
28932
29265
|
*/ var BlendShapeWeightsAnimationCurveOwnerAssembler = /*#__PURE__*/ function() {
|
|
28933
|
-
var BlendShapeWeightsAnimationCurveOwnerAssembler = function BlendShapeWeightsAnimationCurveOwnerAssembler() {
|
|
29266
|
+
var BlendShapeWeightsAnimationCurveOwnerAssembler = function BlendShapeWeightsAnimationCurveOwnerAssembler() {
|
|
29267
|
+
this._skinnedMeshRenderer = [];
|
|
29268
|
+
};
|
|
28934
29269
|
var _proto = BlendShapeWeightsAnimationCurveOwnerAssembler.prototype;
|
|
28935
29270
|
_proto.initialize = function initialize(owner) {
|
|
28936
|
-
|
|
29271
|
+
// @todo: Compatible with multiple SkinnedMeshRenderer in a entity, optimize later.
|
|
29272
|
+
owner.target.getComponents(SkinnedMeshRenderer, this._skinnedMeshRenderer);
|
|
28937
29273
|
};
|
|
28938
29274
|
_proto.getTargetValue = function getTargetValue() {
|
|
28939
|
-
return this._skinnedMeshRenderer.blendShapeWeights;
|
|
29275
|
+
return this._skinnedMeshRenderer[0].blendShapeWeights;
|
|
28940
29276
|
};
|
|
28941
29277
|
_proto.setTargetValue = function setTargetValue(value) {
|
|
28942
|
-
this._skinnedMeshRenderer
|
|
29278
|
+
var skinnedMeshRenderer = this._skinnedMeshRenderer;
|
|
29279
|
+
for(var i = 0, n = skinnedMeshRenderer.length; i < n; i++){
|
|
29280
|
+
skinnedMeshRenderer[i].blendShapeWeights = value;
|
|
29281
|
+
}
|
|
28943
29282
|
};
|
|
28944
29283
|
return BlendShapeWeightsAnimationCurveOwnerAssembler;
|
|
28945
29284
|
}();
|
|
@@ -29178,8 +29517,8 @@
|
|
|
29178
29517
|
/**
|
|
29179
29518
|
* @internal
|
|
29180
29519
|
*/ _proto._evaluate = function _evaluate(time, evaluateData) {
|
|
29181
|
-
var
|
|
29182
|
-
if (!
|
|
29520
|
+
var length = this.keys.length;
|
|
29521
|
+
if (!length) {
|
|
29183
29522
|
console.warn("This curve don't have any keyframes: ", this);
|
|
29184
29523
|
return;
|
|
29185
29524
|
}
|
|
@@ -29187,11 +29526,11 @@
|
|
|
29187
29526
|
// Compute curIndex and nextIndex.
|
|
29188
29527
|
var curIndex = evaluateData.curKeyframeIndex;
|
|
29189
29528
|
// Reset loop,if delete keyfranme may cause `curIndex >= length`
|
|
29190
|
-
if (curIndex !== -1 && (curIndex >=
|
|
29529
|
+
if (curIndex !== -1 && (curIndex >= length || time < keys[curIndex].time)) {
|
|
29191
29530
|
curIndex = -1;
|
|
29192
29531
|
}
|
|
29193
29532
|
var nextIndex = curIndex + 1;
|
|
29194
|
-
while(nextIndex <
|
|
29533
|
+
while(nextIndex < length){
|
|
29195
29534
|
if (time < keys[nextIndex].time) {
|
|
29196
29535
|
break;
|
|
29197
29536
|
}
|
|
@@ -29203,7 +29542,7 @@
|
|
|
29203
29542
|
var value;
|
|
29204
29543
|
if (curIndex === -1) {
|
|
29205
29544
|
value = this._type._setValue(keys[0].value, evaluateData.value);
|
|
29206
|
-
} else if (nextIndex ===
|
|
29545
|
+
} else if (nextIndex === length) {
|
|
29207
29546
|
value = this._type._setValue(keys[curIndex].value, evaluateData.value);
|
|
29208
29547
|
} else {
|
|
29209
29548
|
// Time between first frame and end frame.
|
|
@@ -30787,7 +31126,6 @@
|
|
|
30787
31126
|
var state = playState.state;
|
|
30788
31127
|
var clipDuration = state.clip.length;
|
|
30789
31128
|
if (this.speed * state.speed >= 0) {
|
|
30790
|
-
console.log(999, clipTime, lastClipTime);
|
|
30791
31129
|
if (clipTime < lastClipTime) {
|
|
30792
31130
|
this._checkSubTransition(playState, transitions, layerIndex, lastClipTime, state.clipEndTime * clipDuration);
|
|
30793
31131
|
playState.currentTransitionIndex = 0;
|
|
@@ -31565,62 +31903,199 @@
|
|
|
31565
31903
|
(function() {
|
|
31566
31904
|
SkyProceduralMaterial._sunSimpleMacro = ShaderMacro.getByName("MATERIAL_SUN_SIMPLE");
|
|
31567
31905
|
})();
|
|
31906
|
+
var SubPrimitive = function SubPrimitive() {};
|
|
31568
31907
|
/**
|
|
31569
|
-
*
|
|
31570
|
-
*/
|
|
31571
|
-
|
|
31908
|
+
* The rendering mode for particle renderer.
|
|
31909
|
+
*/ exports.ParticleRenderMode = void 0;
|
|
31910
|
+
(function(ParticleRenderMode) {
|
|
31911
|
+
ParticleRenderMode[ParticleRenderMode[/** Render particles as billboards facing the active camera. */ "Billboard"] = 0] = "Billboard";
|
|
31912
|
+
ParticleRenderMode[ParticleRenderMode[/** Stretch particles in the direction of motion. */ "StretchBillboard"] = 1] = "StretchBillboard";
|
|
31913
|
+
ParticleRenderMode[ParticleRenderMode[/** Render particles as billboards always facing up along the y-Axis. */ "HorizontalBillboard"] = 2] = "HorizontalBillboard";
|
|
31914
|
+
ParticleRenderMode[ParticleRenderMode[/** Render particles as billboards always facing the player, but not pitching along the x-Axis. */ "VerticalBillboard"] = 3] = "VerticalBillboard";
|
|
31915
|
+
ParticleRenderMode[ParticleRenderMode[/** Render particles as meshes. */ "Mesh"] = 4] = "Mesh";
|
|
31916
|
+
ParticleRenderMode[ParticleRenderMode[/** Do not render particles. */ "None"] = 5] = "None";
|
|
31917
|
+
})(exports.ParticleRenderMode || (exports.ParticleRenderMode = {}));
|
|
31918
|
+
exports.ParticleStopMode = void 0;
|
|
31919
|
+
(function(ParticleStopMode) {
|
|
31920
|
+
ParticleStopMode[ParticleStopMode[/** Stop emitting new particles and clear existing particles immediately. */ "StopEmittingAndClear"] = 0] = "StopEmittingAndClear";
|
|
31921
|
+
ParticleStopMode[ParticleStopMode[/** Stop emitting new particles, but keep existing particles until they expire. */ "StopEmitting"] = 1] = "StopEmitting";
|
|
31922
|
+
})(exports.ParticleStopMode || (exports.ParticleStopMode = {}));
|
|
31923
|
+
/**
|
|
31924
|
+
* Particle Renderer Component.
|
|
31925
|
+
*/ var ParticleRenderer = /*#__PURE__*/ function(Renderer1) {
|
|
31926
|
+
_inherits$2(ParticleRenderer, Renderer1);
|
|
31927
|
+
function ParticleRenderer(entity) {
|
|
31572
31928
|
var _this;
|
|
31573
|
-
_this =
|
|
31574
|
-
|
|
31575
|
-
|
|
31576
|
-
|
|
31577
|
-
_this.
|
|
31929
|
+
_this = Renderer1.call(this, entity) || this;
|
|
31930
|
+
/** Particle generator. */ _this.generator = new ParticleGenerator(_assert_this_initialized(_this));
|
|
31931
|
+
/** Specifies how much particles stretch depending on their velocity. */ _this.velocityScale = 0;
|
|
31932
|
+
/** How much are the particles stretched in their direction of motion, defined as the length of the particle compared to its width. */ _this.lengthScale = 2;
|
|
31933
|
+
/** The pivot of particle. */ _this.pivot = new Vector3();
|
|
31934
|
+
_this._currentRenderModeMacro = ParticleRenderer._billboardModeMacro;
|
|
31935
|
+
_this.shaderData.enableMacro(ParticleRenderer._billboardModeMacro);
|
|
31936
|
+
_this._supportInstancedArrays = _this.engine._hardwareRenderer.canIUse(exports.GLCapabilityType.instancedArrays);
|
|
31578
31937
|
return _this;
|
|
31938
|
+
}
|
|
31939
|
+
var _proto = ParticleRenderer.prototype;
|
|
31940
|
+
/**
|
|
31941
|
+
* @internal
|
|
31942
|
+
*/ _proto._onEnable = function _onEnable() {
|
|
31943
|
+
if (this.generator.main.playOnEnabled) {
|
|
31944
|
+
this.generator.play(false);
|
|
31945
|
+
}
|
|
31579
31946
|
};
|
|
31580
|
-
_inherits$2(ParticleMaterial, BaseMaterial1);
|
|
31581
|
-
var _proto = ParticleMaterial.prototype;
|
|
31582
31947
|
/**
|
|
31583
|
-
* @
|
|
31584
|
-
*/ _proto.
|
|
31585
|
-
|
|
31586
|
-
this.cloneTo(dest);
|
|
31587
|
-
return dest;
|
|
31948
|
+
* @internal
|
|
31949
|
+
*/ _proto._onDisable = function _onDisable() {
|
|
31950
|
+
this.generator.stop(false, exports.ParticleStopMode.StopEmittingAndClear);
|
|
31588
31951
|
};
|
|
31589
|
-
|
|
31952
|
+
/**
|
|
31953
|
+
* @internal
|
|
31954
|
+
*/ _proto._prepareRender = function _prepareRender(context) {
|
|
31955
|
+
if (!this._supportInstancedArrays) {
|
|
31956
|
+
return;
|
|
31957
|
+
}
|
|
31958
|
+
var generator = this.generator;
|
|
31959
|
+
generator._update(this.engine.time.deltaTime);
|
|
31960
|
+
// No particles to render
|
|
31961
|
+
if (generator._firstActiveElement === generator._firstFreeElement) {
|
|
31962
|
+
return;
|
|
31963
|
+
}
|
|
31964
|
+
Renderer1.prototype._prepareRender.call(this, context);
|
|
31965
|
+
};
|
|
31966
|
+
/**
|
|
31967
|
+
* @internal
|
|
31968
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
31969
|
+
worldBounds.min.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
|
|
31970
|
+
worldBounds.max.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
|
|
31971
|
+
};
|
|
31972
|
+
/**
|
|
31973
|
+
* @internal
|
|
31974
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
31975
|
+
var shaderData = this.shaderData;
|
|
31976
|
+
shaderData.setFloat(ParticleRenderer._lengthScale, this.lengthScale);
|
|
31977
|
+
shaderData.setFloat(ParticleRenderer._speedScale, this.velocityScale);
|
|
31978
|
+
shaderData.setFloat(ParticleRenderer._currentTime, this.generator._playTime);
|
|
31979
|
+
shaderData.setVector3(ParticleRenderer._pivotOffsetProperty, this.pivot);
|
|
31980
|
+
this.generator._updateShaderData(shaderData);
|
|
31981
|
+
};
|
|
31982
|
+
_proto._render = function _render(context) {
|
|
31983
|
+
var generator = this.generator;
|
|
31984
|
+
var primitive = generator._primitive;
|
|
31985
|
+
if (generator._firstActiveElement < generator._firstFreeElement) {
|
|
31986
|
+
primitive.instanceCount = generator._firstFreeElement - generator._firstActiveElement;
|
|
31987
|
+
} else {
|
|
31988
|
+
var instanceCount = generator._currentParticleCount - generator._firstActiveElement;
|
|
31989
|
+
if (generator._firstFreeElement > 0) {
|
|
31990
|
+
instanceCount += generator._firstFreeElement;
|
|
31991
|
+
}
|
|
31992
|
+
primitive.instanceCount = instanceCount;
|
|
31993
|
+
}
|
|
31994
|
+
var material = this.getMaterial();
|
|
31995
|
+
var renderData = this._engine._renderDataPool.getFromPool();
|
|
31996
|
+
renderData.setX(this, material, generator._primitive, generator._subPrimitive);
|
|
31997
|
+
context.camera._renderPipeline.pushRenderData(context, renderData);
|
|
31998
|
+
};
|
|
31999
|
+
_proto._onDestroy = function _onDestroy() {
|
|
32000
|
+
this.generator._destroy();
|
|
32001
|
+
};
|
|
32002
|
+
_create_class$3(ParticleRenderer, [
|
|
31590
32003
|
{
|
|
31591
|
-
key: "
|
|
32004
|
+
key: "renderMode",
|
|
31592
32005
|
get: /**
|
|
31593
|
-
*
|
|
32006
|
+
* Specifies how particles are rendered.
|
|
31594
32007
|
*/ function get() {
|
|
31595
|
-
return this.
|
|
32008
|
+
return this._renderMode;
|
|
31596
32009
|
},
|
|
31597
32010
|
set: function set(value) {
|
|
31598
|
-
|
|
31599
|
-
|
|
31600
|
-
|
|
32011
|
+
if (this._renderMode !== value) {
|
|
32012
|
+
var lastRenderMode = this._renderMode;
|
|
32013
|
+
this._renderMode = value;
|
|
32014
|
+
var renderModeMacro = null;
|
|
32015
|
+
var shaderData = this.shaderData;
|
|
32016
|
+
switch(value){
|
|
32017
|
+
case exports.ParticleRenderMode.Billboard:
|
|
32018
|
+
renderModeMacro = ParticleRenderer._billboardModeMacro;
|
|
32019
|
+
break;
|
|
32020
|
+
case exports.ParticleRenderMode.StretchBillboard:
|
|
32021
|
+
renderModeMacro = ParticleRenderer._stretchedBillboardModeMacro;
|
|
32022
|
+
break;
|
|
32023
|
+
case exports.ParticleRenderMode.HorizontalBillboard:
|
|
32024
|
+
throw "Not implemented";
|
|
32025
|
+
case exports.ParticleRenderMode.VerticalBillboard:
|
|
32026
|
+
throw "Not implemented";
|
|
32027
|
+
case exports.ParticleRenderMode.Mesh:
|
|
32028
|
+
throw "Not implemented";
|
|
32029
|
+
}
|
|
32030
|
+
if (this._currentRenderModeMacro !== renderModeMacro) {
|
|
32031
|
+
this._currentRenderModeMacro && shaderData.disableMacro(this._currentRenderModeMacro);
|
|
32032
|
+
renderModeMacro && shaderData.enableMacro(renderModeMacro);
|
|
32033
|
+
this._currentRenderModeMacro = renderModeMacro;
|
|
32034
|
+
}
|
|
32035
|
+
// @ts-ignore
|
|
32036
|
+
if (lastRenderMode !== exports.ParticleRenderMode.Mesh !== (value === exports.ParticleRenderMode.Mesh)) {
|
|
32037
|
+
this.generator._reorganizeGeometryBuffers();
|
|
32038
|
+
}
|
|
31601
32039
|
}
|
|
31602
32040
|
}
|
|
31603
32041
|
},
|
|
31604
32042
|
{
|
|
31605
|
-
key: "
|
|
32043
|
+
key: "mesh",
|
|
31606
32044
|
get: /**
|
|
31607
|
-
*
|
|
32045
|
+
* The mesh of particle.
|
|
32046
|
+
* @remarks Valid when `renderMode` is `Mesh`.
|
|
31608
32047
|
*/ function get() {
|
|
31609
|
-
return this.
|
|
32048
|
+
return this._mesh;
|
|
31610
32049
|
},
|
|
31611
32050
|
set: function set(value) {
|
|
31612
|
-
this.
|
|
31613
|
-
if (value) {
|
|
31614
|
-
|
|
31615
|
-
|
|
31616
|
-
|
|
32051
|
+
var lastMesh = this._mesh;
|
|
32052
|
+
if (lastMesh !== value) {
|
|
32053
|
+
var _lastMesh, _value;
|
|
32054
|
+
this._mesh = value;
|
|
32055
|
+
(_lastMesh = lastMesh) == null ? void 0 : _lastMesh._addReferCount(-1);
|
|
32056
|
+
(_value = value) == null ? void 0 : _value._addReferCount(1);
|
|
32057
|
+
if (this.renderMode === exports.ParticleRenderMode.Mesh) {
|
|
32058
|
+
this.generator._reorganizeGeometryBuffers();
|
|
32059
|
+
}
|
|
31617
32060
|
}
|
|
31618
32061
|
}
|
|
31619
32062
|
}
|
|
31620
32063
|
]);
|
|
31621
|
-
return
|
|
31622
|
-
}(
|
|
31623
|
-
|
|
32064
|
+
return ParticleRenderer;
|
|
32065
|
+
}(exports.Renderer);
|
|
32066
|
+
(function() {
|
|
32067
|
+
ParticleRenderer._billboardModeMacro = ShaderMacro.getByName("RENDERER_MODE_SPHERE_BILLBOARD");
|
|
32068
|
+
})();
|
|
32069
|
+
(function() {
|
|
32070
|
+
ParticleRenderer._stretchedBillboardModeMacro = ShaderMacro.getByName("RENDERER_MODE_STRETCHED_BILLBOARD");
|
|
32071
|
+
})();
|
|
32072
|
+
(function() {
|
|
32073
|
+
ParticleRenderer._horizontalBillboardModeMacro = ShaderMacro.getByName("RENDERER_MODE_HORIZONTAL_BILLBOARD");
|
|
32074
|
+
})();
|
|
32075
|
+
(function() {
|
|
32076
|
+
ParticleRenderer._verticalBillboardModeMacro = ShaderMacro.getByName("RENDERER_MODE_VERTICAL_BILLBOARD");
|
|
32077
|
+
})();
|
|
32078
|
+
(function() {
|
|
32079
|
+
ParticleRenderer._renderModeMeshMacro = ShaderMacro.getByName("RENDERER_MODE_MESH");
|
|
32080
|
+
})();
|
|
32081
|
+
(function() {
|
|
32082
|
+
ParticleRenderer._pivotOffsetProperty = ShaderProperty.getByName("renderer_PivotOffset");
|
|
32083
|
+
})();
|
|
32084
|
+
(function() {
|
|
32085
|
+
ParticleRenderer._lengthScale = ShaderProperty.getByName("renderer_StretchedBillboardLengthScale");
|
|
32086
|
+
})();
|
|
32087
|
+
(function() {
|
|
32088
|
+
ParticleRenderer._speedScale = ShaderProperty.getByName("renderer_StretchedBillboardSpeedScale");
|
|
32089
|
+
})();
|
|
32090
|
+
(function() {
|
|
32091
|
+
ParticleRenderer._currentTime = ShaderProperty.getByName("renderer_CurrentTime");
|
|
32092
|
+
})();
|
|
32093
|
+
__decorate$1([
|
|
32094
|
+
deepClone
|
|
32095
|
+
], ParticleRenderer.prototype, "generator", void 0);
|
|
32096
|
+
__decorate$1([
|
|
32097
|
+
shallowClone
|
|
32098
|
+
], ParticleRenderer.prototype, "pivot", void 0);
|
|
31624
32099
|
/**
|
|
31625
32100
|
* Particle curve mode.
|
|
31626
32101
|
*/ exports.ParticleCurveMode = void 0;
|
|
@@ -31639,17 +32114,6 @@
|
|
|
31639
32114
|
ParticleGradientMode[ParticleGradientMode[/* Single color gradient curve mode. */ "Gradient"] = 2] = "Gradient";
|
|
31640
32115
|
ParticleGradientMode[ParticleGradientMode[/* Random value between two color gradients. */ "TwoGradients"] = 3] = "TwoGradients";
|
|
31641
32116
|
})(exports.ParticleGradientMode || (exports.ParticleGradientMode = {}));
|
|
31642
|
-
/**
|
|
31643
|
-
* The rendering mode for particle renderer.
|
|
31644
|
-
*/ exports.ParticleRenderMode = void 0;
|
|
31645
|
-
(function(ParticleRenderMode) {
|
|
31646
|
-
ParticleRenderMode[ParticleRenderMode[/** Render particles as billboards facing the active camera. */ "Billboard"] = 0] = "Billboard";
|
|
31647
|
-
ParticleRenderMode[ParticleRenderMode[/** Stretch particles in the direction of motion. */ "StretchBillboard"] = 1] = "StretchBillboard";
|
|
31648
|
-
ParticleRenderMode[ParticleRenderMode[/** Render particles as billboards always facing up along the y-Axis. */ "HorizontalBillboard"] = 2] = "HorizontalBillboard";
|
|
31649
|
-
ParticleRenderMode[ParticleRenderMode[/** Render particles as billboards always facing the player, but not pitching along the x-Axis. */ "VerticalBillboard"] = 3] = "VerticalBillboard";
|
|
31650
|
-
ParticleRenderMode[ParticleRenderMode[/** Render particles as meshes. */ "Mesh"] = 4] = "Mesh";
|
|
31651
|
-
ParticleRenderMode[ParticleRenderMode[/** Do not render particles. */ "None"] = 5] = "None";
|
|
31652
|
-
})(exports.ParticleRenderMode || (exports.ParticleRenderMode = {}));
|
|
31653
32117
|
/**
|
|
31654
32118
|
* The space to simulate particles in.
|
|
31655
32119
|
*/ exports.ParticleSimulationSpace = void 0;
|
|
@@ -31657,11 +32121,6 @@
|
|
|
31657
32121
|
ParticleSimulationSpace[ParticleSimulationSpace[/** Simulate particles in local space. */ "Local"] = 0] = "Local";
|
|
31658
32122
|
ParticleSimulationSpace[ParticleSimulationSpace[/** Simulate particles in world space. */ "World"] = 1] = "World";
|
|
31659
32123
|
})(exports.ParticleSimulationSpace || (exports.ParticleSimulationSpace = {}));
|
|
31660
|
-
exports.ParticleStopMode = void 0;
|
|
31661
|
-
(function(ParticleStopMode) {
|
|
31662
|
-
ParticleStopMode[ParticleStopMode[/** Stop emitting new particles and clear existing particles immediately. */ "StopEmittingAndClear"] = 0] = "StopEmittingAndClear";
|
|
31663
|
-
ParticleStopMode[ParticleStopMode[/** Stop emitting new particles, but keep existing particles until they expire. */ "StopEmitting"] = 1] = "StopEmitting";
|
|
31664
|
-
})(exports.ParticleStopMode || (exports.ParticleStopMode = {}));
|
|
31665
32124
|
/**
|
|
31666
32125
|
* @internal
|
|
31667
32126
|
*/ var ParticleRandomSubSeeds;
|
|
@@ -32281,15 +32740,13 @@
|
|
|
32281
32740
|
/** The initial lifetime of particles when emitted. */ this.startLifetime = new ParticleCompositeCurve(5);
|
|
32282
32741
|
/** The initial speed of particles when the Particle Generator first spawns them. */ this.startSpeed = new ParticleCompositeCurve(5);
|
|
32283
32742
|
/** A flag to enable specifying particle size individually for each axis. */ this.startSize3D = false;
|
|
32284
|
-
/** The initial size of particles when the Particle Generator first spawns them. */ this.startSize = new ParticleCompositeCurve(1);
|
|
32285
32743
|
/** The initial size of particles along the x-axis when the Particle Generator first spawns them. */ this.startSizeX = new ParticleCompositeCurve(1);
|
|
32286
32744
|
/** The initial size of particles along the y-axis when the Particle Generator first spawns them. */ this.startSizeY = new ParticleCompositeCurve(1);
|
|
32287
32745
|
/** The initial size of particles along the z-axis when the Particle Generator first spawns them. */ this.startSizeZ = new ParticleCompositeCurve(1);
|
|
32288
|
-
/** A flag to enable 3D particle rotation. */ this.startRotation3D = false;
|
|
32289
|
-
/** The initial rotation of particles when the Particle Generator first spawns them. */ this.startRotation = new ParticleCompositeCurve(0);
|
|
32746
|
+
/** A flag to enable 3D particle rotation, when disabled, only `startRotationZ` is used. */ this.startRotation3D = false;
|
|
32290
32747
|
/** The initial rotation of particles around the x-axis when emitted.*/ this.startRotationX = new ParticleCompositeCurve(0);
|
|
32291
32748
|
/** The initial rotation of particles around the y-axis when emitted. */ this.startRotationY = new ParticleCompositeCurve(0);
|
|
32292
|
-
this.startRotationZ = new ParticleCompositeCurve(0);
|
|
32749
|
+
/** The initial rotation of particles around the z-axis when emitted. */ this.startRotationZ = new ParticleCompositeCurve(0);
|
|
32293
32750
|
/** Makes some particles spin in the opposite direction. */ this.flipRotation = 0;
|
|
32294
32751
|
/** The mode of start color */ this.startColor = new ParticleCompositeGradient(new Color$1(1, 1, 1, 1));
|
|
32295
32752
|
/** A scale that this Particle Generator applies to gravity, defined by Physics.gravity. */ this.gravityModifier = new ParticleCompositeCurve(0);
|
|
@@ -32392,6 +32849,17 @@
|
|
|
32392
32849
|
}
|
|
32393
32850
|
}
|
|
32394
32851
|
}
|
|
32852
|
+
},
|
|
32853
|
+
{
|
|
32854
|
+
key: "startSize",
|
|
32855
|
+
get: /**
|
|
32856
|
+
* The initial size of particles when the Particle Generator first spawns them.
|
|
32857
|
+
*/ function get() {
|
|
32858
|
+
return this.startSizeX;
|
|
32859
|
+
},
|
|
32860
|
+
set: function set(value) {
|
|
32861
|
+
this.startSizeX = value;
|
|
32862
|
+
}
|
|
32395
32863
|
}
|
|
32396
32864
|
]);
|
|
32397
32865
|
return MainModule;
|
|
@@ -32435,9 +32903,6 @@
|
|
|
32435
32903
|
__decorate$1([
|
|
32436
32904
|
deepClone
|
|
32437
32905
|
], MainModule.prototype, "startSpeed", void 0);
|
|
32438
|
-
__decorate$1([
|
|
32439
|
-
deepClone
|
|
32440
|
-
], MainModule.prototype, "startSize", void 0);
|
|
32441
32906
|
__decorate$1([
|
|
32442
32907
|
deepClone
|
|
32443
32908
|
], MainModule.prototype, "startSizeX", void 0);
|
|
@@ -32447,9 +32912,6 @@
|
|
|
32447
32912
|
__decorate$1([
|
|
32448
32913
|
deepClone
|
|
32449
32914
|
], MainModule.prototype, "startSizeZ", void 0);
|
|
32450
|
-
__decorate$1([
|
|
32451
|
-
deepClone
|
|
32452
|
-
], MainModule.prototype, "startRotation", void 0);
|
|
32453
32915
|
__decorate$1([
|
|
32454
32916
|
deepClone
|
|
32455
32917
|
], MainModule.prototype, "startRotationX", void 0);
|
|
@@ -32457,7 +32919,6 @@
|
|
|
32457
32919
|
deepClone
|
|
32458
32920
|
], MainModule.prototype, "startRotationY", void 0);
|
|
32459
32921
|
__decorate$1([
|
|
32460
|
-
deepClone,
|
|
32461
32922
|
deepClone
|
|
32462
32923
|
], MainModule.prototype, "startRotationZ", void 0);
|
|
32463
32924
|
__decorate$1([
|
|
@@ -32496,7 +32957,7 @@
|
|
|
32496
32957
|
var RotationOverLifetimeModule = function RotationOverLifetimeModule() {
|
|
32497
32958
|
var _this;
|
|
32498
32959
|
_this = ParticleGeneratorModule1.apply(this, arguments) || this;
|
|
32499
|
-
/** Specifies whether the rotation is separate on each axis, when disabled only
|
|
32960
|
+
/** Specifies whether the rotation is separate on each axis, when disabled, only `rotationZ` is used. */ _this.separateAxes = false;
|
|
32500
32961
|
/** Rotation over lifetime for z axis. */ _this.rotationX = new ParticleCompositeCurve(0);
|
|
32501
32962
|
/** Rotation over lifetime for z axis. */ _this.rotationY = new ParticleCompositeCurve(0);
|
|
32502
32963
|
/** Rotation over lifetime for z axis. */ _this.rotationZ = new ParticleCompositeCurve(45);
|
|
@@ -32848,9 +33309,6 @@
|
|
|
32848
33309
|
_inherits$2(TextureSheetAnimationModule, ParticleGeneratorModule1);
|
|
32849
33310
|
var _proto = TextureSheetAnimationModule.prototype;
|
|
32850
33311
|
/**
|
|
32851
|
-
* @inheritDoc
|
|
32852
|
-
*/ _proto.cloneTo = function cloneTo(dest) {};
|
|
32853
|
-
/**
|
|
32854
33312
|
* @internal
|
|
32855
33313
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
32856
33314
|
var frameMacro = null;
|
|
@@ -33336,7 +33794,7 @@
|
|
|
33336
33794
|
instanceVertices[offset + 16] = MathUtil$1.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
|
|
33337
33795
|
instanceVertices[offset + 17] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
|
|
33338
33796
|
} else {
|
|
33339
|
-
instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.
|
|
33797
|
+
instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
|
|
33340
33798
|
}
|
|
33341
33799
|
// Start speed
|
|
33342
33800
|
instanceVertices[offset + 18] = startSpeed;
|
|
@@ -33598,181 +34056,60 @@
|
|
|
33598
34056
|
ignoreClone
|
|
33599
34057
|
], ParticleGenerator.prototype, "_instanceVertices", void 0);
|
|
33600
34058
|
/**
|
|
33601
|
-
* Particle
|
|
33602
|
-
*/ var
|
|
33603
|
-
|
|
33604
|
-
function ParticleRenderer(entity) {
|
|
34059
|
+
* Particle Material.
|
|
34060
|
+
*/ var ParticleMaterial = /*#__PURE__*/ function(BaseMaterial1) {
|
|
34061
|
+
var ParticleMaterial = function ParticleMaterial(engine) {
|
|
33605
34062
|
var _this;
|
|
33606
|
-
_this =
|
|
33607
|
-
|
|
33608
|
-
|
|
33609
|
-
|
|
33610
|
-
|
|
33611
|
-
_this._currentRenderModeMacro = ParticleRenderer._billboardModeMacro;
|
|
33612
|
-
_this.shaderData.enableMacro(ParticleRenderer._billboardModeMacro);
|
|
33613
|
-
_this._supportInstancedArrays = _this.engine._hardwareRenderer.canIUse(exports.GLCapabilityType.instancedArrays);
|
|
34063
|
+
_this = BaseMaterial1.call(this, engine, Shader.find("particle-shader")) || this;
|
|
34064
|
+
var shaderData = _this.shaderData;
|
|
34065
|
+
shaderData.enableMacro("MATERIAL_OMIT_NORMAL");
|
|
34066
|
+
shaderData.setColor(BaseMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
|
|
34067
|
+
_this.isTransparent = true;
|
|
33614
34068
|
return _this;
|
|
33615
|
-
}
|
|
33616
|
-
var _proto = ParticleRenderer.prototype;
|
|
33617
|
-
/**
|
|
33618
|
-
* @internal
|
|
33619
|
-
*/ _proto._onEnable = function _onEnable() {
|
|
33620
|
-
if (this.generator.main.playOnEnabled) {
|
|
33621
|
-
this.generator.play(false);
|
|
33622
|
-
}
|
|
33623
|
-
};
|
|
33624
|
-
/**
|
|
33625
|
-
* @internal
|
|
33626
|
-
*/ _proto._onDisable = function _onDisable() {
|
|
33627
|
-
this.generator.stop(false, exports.ParticleStopMode.StopEmittingAndClear);
|
|
33628
|
-
};
|
|
33629
|
-
/**
|
|
33630
|
-
* @internal
|
|
33631
|
-
*/ _proto._prepareRender = function _prepareRender(context) {
|
|
33632
|
-
if (!this._supportInstancedArrays) {
|
|
33633
|
-
return;
|
|
33634
|
-
}
|
|
33635
|
-
var generator = this.generator;
|
|
33636
|
-
generator._update(this.engine.time.deltaTime);
|
|
33637
|
-
// No particles to render
|
|
33638
|
-
if (generator._firstActiveElement === generator._firstFreeElement) {
|
|
33639
|
-
return;
|
|
33640
|
-
}
|
|
33641
|
-
Renderer1.prototype._prepareRender.call(this, context);
|
|
33642
|
-
};
|
|
33643
|
-
/**
|
|
33644
|
-
* @internal
|
|
33645
|
-
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
33646
|
-
worldBounds.min.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
|
|
33647
|
-
worldBounds.max.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
|
|
33648
34069
|
};
|
|
34070
|
+
_inherits$2(ParticleMaterial, BaseMaterial1);
|
|
34071
|
+
var _proto = ParticleMaterial.prototype;
|
|
33649
34072
|
/**
|
|
33650
|
-
* @
|
|
33651
|
-
*/ _proto.
|
|
33652
|
-
var
|
|
33653
|
-
|
|
33654
|
-
|
|
33655
|
-
shaderData.setFloat(ParticleRenderer._currentTime, this.generator._playTime);
|
|
33656
|
-
shaderData.setVector3(ParticleRenderer._pivotOffsetProperty, this.pivot);
|
|
33657
|
-
this.generator._updateShaderData(shaderData);
|
|
33658
|
-
};
|
|
33659
|
-
_proto._render = function _render(context) {
|
|
33660
|
-
var generator = this.generator;
|
|
33661
|
-
var primitive = generator._primitive;
|
|
33662
|
-
if (generator._firstActiveElement < generator._firstFreeElement) {
|
|
33663
|
-
primitive.instanceCount = generator._firstFreeElement - generator._firstActiveElement;
|
|
33664
|
-
} else {
|
|
33665
|
-
var instanceCount = generator._currentParticleCount - generator._firstActiveElement;
|
|
33666
|
-
if (generator._firstFreeElement > 0) {
|
|
33667
|
-
instanceCount += generator._firstFreeElement;
|
|
33668
|
-
}
|
|
33669
|
-
primitive.instanceCount = instanceCount;
|
|
33670
|
-
}
|
|
33671
|
-
var material = this.getMaterial();
|
|
33672
|
-
var renderData = this._engine._renderDataPool.getFromPool();
|
|
33673
|
-
renderData.setX(this, material, generator._primitive, generator._subPrimitive);
|
|
33674
|
-
context.camera._renderPipeline.pushRenderData(context, renderData);
|
|
33675
|
-
};
|
|
33676
|
-
_proto._onDestroy = function _onDestroy() {
|
|
33677
|
-
this.generator._destroy();
|
|
34073
|
+
* @inheritdoc
|
|
34074
|
+
*/ _proto.clone = function clone() {
|
|
34075
|
+
var dest = new ParticleMaterial(this._engine);
|
|
34076
|
+
this.cloneTo(dest);
|
|
34077
|
+
return dest;
|
|
33678
34078
|
};
|
|
33679
|
-
_create_class$3(
|
|
34079
|
+
_create_class$3(ParticleMaterial, [
|
|
33680
34080
|
{
|
|
33681
|
-
key: "
|
|
34081
|
+
key: "baseColor",
|
|
33682
34082
|
get: /**
|
|
33683
|
-
*
|
|
34083
|
+
* Base color.
|
|
33684
34084
|
*/ function get() {
|
|
33685
|
-
return this.
|
|
34085
|
+
return this.shaderData.getColor(BaseMaterial._baseColorProp);
|
|
33686
34086
|
},
|
|
33687
34087
|
set: function set(value) {
|
|
33688
|
-
|
|
33689
|
-
|
|
33690
|
-
|
|
33691
|
-
var renderModeMacro = null;
|
|
33692
|
-
var shaderData = this.shaderData;
|
|
33693
|
-
switch(value){
|
|
33694
|
-
case exports.ParticleRenderMode.Billboard:
|
|
33695
|
-
renderModeMacro = ParticleRenderer._billboardModeMacro;
|
|
33696
|
-
break;
|
|
33697
|
-
case exports.ParticleRenderMode.StretchBillboard:
|
|
33698
|
-
renderModeMacro = ParticleRenderer._stretchedBillboardModeMacro;
|
|
33699
|
-
break;
|
|
33700
|
-
case exports.ParticleRenderMode.HorizontalBillboard:
|
|
33701
|
-
throw "Not implemented";
|
|
33702
|
-
case exports.ParticleRenderMode.VerticalBillboard:
|
|
33703
|
-
throw "Not implemented";
|
|
33704
|
-
case exports.ParticleRenderMode.Mesh:
|
|
33705
|
-
throw "Not implemented";
|
|
33706
|
-
}
|
|
33707
|
-
if (this._currentRenderModeMacro !== renderModeMacro) {
|
|
33708
|
-
this._currentRenderModeMacro && shaderData.disableMacro(this._currentRenderModeMacro);
|
|
33709
|
-
renderModeMacro && shaderData.enableMacro(renderModeMacro);
|
|
33710
|
-
this._currentRenderModeMacro = renderModeMacro;
|
|
33711
|
-
}
|
|
33712
|
-
// @ts-ignore
|
|
33713
|
-
if (lastRenderMode !== exports.ParticleRenderMode.Mesh !== (value === exports.ParticleRenderMode.Mesh)) {
|
|
33714
|
-
this.generator._reorganizeGeometryBuffers();
|
|
33715
|
-
}
|
|
34088
|
+
var baseColor = this.shaderData.getColor(BaseMaterial._baseColorProp);
|
|
34089
|
+
if (value !== baseColor) {
|
|
34090
|
+
baseColor.copyFrom(value);
|
|
33716
34091
|
}
|
|
33717
34092
|
}
|
|
33718
34093
|
},
|
|
33719
34094
|
{
|
|
33720
|
-
key: "
|
|
34095
|
+
key: "baseTexture",
|
|
33721
34096
|
get: /**
|
|
33722
|
-
*
|
|
33723
|
-
* @remarks Valid when `renderMode` is `Mesh`.
|
|
34097
|
+
* Base texture.
|
|
33724
34098
|
*/ function get() {
|
|
33725
|
-
return this.
|
|
34099
|
+
return this.shaderData.getTexture(BaseMaterial._baseTextureProp);
|
|
33726
34100
|
},
|
|
33727
34101
|
set: function set(value) {
|
|
33728
|
-
|
|
33729
|
-
if (
|
|
33730
|
-
|
|
33731
|
-
|
|
33732
|
-
(
|
|
33733
|
-
(_value = value) == null ? void 0 : _value._addReferCount(1);
|
|
33734
|
-
if (this.renderMode === exports.ParticleRenderMode.Mesh) {
|
|
33735
|
-
this.generator._reorganizeGeometryBuffers();
|
|
33736
|
-
}
|
|
34102
|
+
this.shaderData.setTexture(BaseMaterial._baseTextureProp, value);
|
|
34103
|
+
if (value) {
|
|
34104
|
+
this.shaderData.enableMacro(BaseMaterial._baseTextureMacro);
|
|
34105
|
+
} else {
|
|
34106
|
+
this.shaderData.disableMacro(BaseMaterial._baseTextureMacro);
|
|
33737
34107
|
}
|
|
33738
34108
|
}
|
|
33739
34109
|
}
|
|
33740
34110
|
]);
|
|
33741
|
-
return
|
|
33742
|
-
}(
|
|
33743
|
-
(function() {
|
|
33744
|
-
ParticleRenderer._billboardModeMacro = ShaderMacro.getByName("RENDERER_MODE_SPHERE_BILLBOARD");
|
|
33745
|
-
})();
|
|
33746
|
-
(function() {
|
|
33747
|
-
ParticleRenderer._stretchedBillboardModeMacro = ShaderMacro.getByName("RENDERER_MODE_STRETCHED_BILLBOARD");
|
|
33748
|
-
})();
|
|
33749
|
-
(function() {
|
|
33750
|
-
ParticleRenderer._horizontalBillboardModeMacro = ShaderMacro.getByName("RENDERER_MODE_HORIZONTAL_BILLBOARD");
|
|
33751
|
-
})();
|
|
33752
|
-
(function() {
|
|
33753
|
-
ParticleRenderer._verticalBillboardModeMacro = ShaderMacro.getByName("RENDERER_MODE_VERTICAL_BILLBOARD");
|
|
33754
|
-
})();
|
|
33755
|
-
(function() {
|
|
33756
|
-
ParticleRenderer._renderModeMeshMacro = ShaderMacro.getByName("RENDERER_MODE_MESH");
|
|
33757
|
-
})();
|
|
33758
|
-
(function() {
|
|
33759
|
-
ParticleRenderer._pivotOffsetProperty = ShaderProperty.getByName("renderer_PivotOffset");
|
|
33760
|
-
})();
|
|
33761
|
-
(function() {
|
|
33762
|
-
ParticleRenderer._lengthScale = ShaderProperty.getByName("renderer_StretchedBillboardLengthScale");
|
|
33763
|
-
})();
|
|
33764
|
-
(function() {
|
|
33765
|
-
ParticleRenderer._speedScale = ShaderProperty.getByName("renderer_StretchedBillboardSpeedScale");
|
|
33766
|
-
})();
|
|
33767
|
-
(function() {
|
|
33768
|
-
ParticleRenderer._currentTime = ShaderProperty.getByName("renderer_CurrentTime");
|
|
33769
|
-
})();
|
|
33770
|
-
__decorate$1([
|
|
33771
|
-
deepClone
|
|
33772
|
-
], ParticleRenderer.prototype, "generator", void 0);
|
|
33773
|
-
__decorate$1([
|
|
33774
|
-
shallowClone
|
|
33775
|
-
], ParticleRenderer.prototype, "pivot", void 0);
|
|
34111
|
+
return ParticleMaterial;
|
|
34112
|
+
}(BaseMaterial);
|
|
33776
34113
|
/**
|
|
33777
34114
|
* A burst is a particle emission event, where a number of particles are all emitted at the same time
|
|
33778
34115
|
*/ var Burst = function Burst(time, count) {
|
|
@@ -34457,6 +34794,7 @@
|
|
|
34457
34794
|
ColliderShape: ColliderShape,
|
|
34458
34795
|
get ColliderShapeUpAxis () { return exports.ColliderShapeUpAxis; },
|
|
34459
34796
|
get CollisionDetectionMode () { return exports.CollisionDetectionMode; },
|
|
34797
|
+
ColorOverLifetimeModule: ColorOverLifetimeModule,
|
|
34460
34798
|
get ColorSpace () { return exports.ColorSpace; },
|
|
34461
34799
|
get ColorWriteMask () { return exports.ColorWriteMask; },
|
|
34462
34800
|
get CompareFunction () { return exports.CompareFunction; },
|
|
@@ -34477,6 +34815,7 @@
|
|
|
34477
34815
|
DirectLight: DirectLight,
|
|
34478
34816
|
DynamicCollider: DynamicCollider,
|
|
34479
34817
|
get DynamicColliderConstraints () { return exports.DynamicColliderConstraints; },
|
|
34818
|
+
EmissionModule: EmissionModule,
|
|
34480
34819
|
Engine: Engine,
|
|
34481
34820
|
EngineObject: EngineObject,
|
|
34482
34821
|
Entity: Entity,
|
|
@@ -34486,6 +34825,8 @@
|
|
|
34486
34825
|
Font: Font,
|
|
34487
34826
|
get FontStyle () { return exports.FontStyle; },
|
|
34488
34827
|
get GLCapabilityType () { return exports.GLCapabilityType; },
|
|
34828
|
+
GradientAlphaKey: GradientAlphaKey,
|
|
34829
|
+
GradientColorKey: GradientColorKey,
|
|
34489
34830
|
HemisphereShape: HemisphereShape,
|
|
34490
34831
|
HingeJoint: HingeJoint,
|
|
34491
34832
|
HitResult: HitResult,
|
|
@@ -34502,6 +34843,7 @@
|
|
|
34502
34843
|
Light: Light,
|
|
34503
34844
|
Loader: Loader,
|
|
34504
34845
|
Logger: Logger,
|
|
34846
|
+
MainModule: MainModule,
|
|
34505
34847
|
Material: Material,
|
|
34506
34848
|
Mesh: Mesh,
|
|
34507
34849
|
MeshRenderer: MeshRenderer,
|
|
@@ -34512,8 +34854,11 @@
|
|
|
34512
34854
|
PBRMaterial: PBRMaterial,
|
|
34513
34855
|
PBRSpecularMaterial: PBRSpecularMaterial,
|
|
34514
34856
|
ParticleCompositeCurve: ParticleCompositeCurve,
|
|
34857
|
+
ParticleCompositeGradient: ParticleCompositeGradient,
|
|
34515
34858
|
ParticleCurve: ParticleCurve,
|
|
34516
34859
|
get ParticleCurveMode () { return exports.ParticleCurveMode; },
|
|
34860
|
+
ParticleGenerator: ParticleGenerator,
|
|
34861
|
+
ParticleGradient: ParticleGradient,
|
|
34517
34862
|
get ParticleGradientMode () { return exports.ParticleGradientMode; },
|
|
34518
34863
|
ParticleMaterial: ParticleMaterial,
|
|
34519
34864
|
get ParticleRenderMode () { return exports.ParticleRenderMode; },
|
|
@@ -34548,6 +34893,7 @@
|
|
|
34548
34893
|
RenderTargetBlendState: RenderTargetBlendState,
|
|
34549
34894
|
get Renderer () { return exports.Renderer; },
|
|
34550
34895
|
ResourceManager: ResourceManager,
|
|
34896
|
+
RotationOverLifetimeModule: RotationOverLifetimeModule,
|
|
34551
34897
|
Scene: Scene,
|
|
34552
34898
|
SceneManager: SceneManager,
|
|
34553
34899
|
Script: Script,
|
|
@@ -34564,6 +34910,7 @@
|
|
|
34564
34910
|
get ShadowCascadesMode () { return exports.ShadowCascadesMode; },
|
|
34565
34911
|
get ShadowResolution () { return exports.ShadowResolution; },
|
|
34566
34912
|
get ShadowType () { return exports.ShadowType; },
|
|
34913
|
+
SizeOverLifetimeModule: SizeOverLifetimeModule,
|
|
34567
34914
|
Skin: Skin,
|
|
34568
34915
|
SkinnedMeshRenderer: SkinnedMeshRenderer,
|
|
34569
34916
|
Sky: Sky,
|
|
@@ -34602,6 +34949,7 @@
|
|
|
34602
34949
|
get TextureDepthCompareFunction () { return exports.TextureDepthCompareFunction; },
|
|
34603
34950
|
get TextureFilterMode () { return exports.TextureFilterMode; },
|
|
34604
34951
|
get TextureFormat () { return exports.TextureFormat; },
|
|
34952
|
+
TextureSheetAnimationModule: TextureSheetAnimationModule,
|
|
34605
34953
|
get TextureUsage () { return exports.TextureUsage; },
|
|
34606
34954
|
get TextureWrapMode () { return exports.TextureWrapMode; },
|
|
34607
34955
|
Time: Time,
|
|
@@ -34610,6 +34958,7 @@
|
|
|
34610
34958
|
Transform: Transform,
|
|
34611
34959
|
UnlitMaterial: UnlitMaterial,
|
|
34612
34960
|
Utils: Utils,
|
|
34961
|
+
VelocityOverLifetimeModule: VelocityOverLifetimeModule,
|
|
34613
34962
|
get VertexAttribute () { return exports.VertexAttribute; },
|
|
34614
34963
|
VertexBufferBinding: VertexBufferBinding,
|
|
34615
34964
|
VertexElement: VertexElement,
|
|
@@ -37433,12 +37782,12 @@
|
|
|
37433
37782
|
return _construct.apply(null, arguments);
|
|
37434
37783
|
}
|
|
37435
37784
|
var ReflectionParser = /*#__PURE__*/ function() {
|
|
37436
|
-
var ReflectionParser = function ReflectionParser() {
|
|
37437
|
-
|
|
37438
|
-
this.customParseComponentHandles[componentType] = handle;
|
|
37785
|
+
var ReflectionParser = function ReflectionParser(_context) {
|
|
37786
|
+
this._context = _context;
|
|
37439
37787
|
};
|
|
37440
|
-
|
|
37441
|
-
|
|
37788
|
+
var _proto = ReflectionParser.prototype;
|
|
37789
|
+
_proto.parseEntity = function parseEntity(entityConfig) {
|
|
37790
|
+
return this._getEntityByConfig(entityConfig).then(function(entity) {
|
|
37442
37791
|
var _entityConfig_isActive;
|
|
37443
37792
|
entity.isActive = (_entityConfig_isActive = entityConfig.isActive) != null ? _entityConfig_isActive : true;
|
|
37444
37793
|
var position = entityConfig.position, rotation = entityConfig.rotation, scale = entityConfig.scale;
|
|
@@ -37448,72 +37797,29 @@
|
|
|
37448
37797
|
return entity;
|
|
37449
37798
|
});
|
|
37450
37799
|
};
|
|
37451
|
-
|
|
37452
|
-
// @ts-ignore
|
|
37453
|
-
var assetRefId = entityConfig.assetRefId;
|
|
37454
|
-
if (assetRefId) {
|
|
37455
|
-
return engine.resourceManager // @ts-ignore
|
|
37456
|
-
.getResourceByRef({
|
|
37457
|
-
refId: assetRefId,
|
|
37458
|
-
key: entityConfig.key,
|
|
37459
|
-
isClone: entityConfig.isClone
|
|
37460
|
-
}).then(function(entity) {
|
|
37461
|
-
entity.name = entityConfig.name;
|
|
37462
|
-
return entity;
|
|
37463
|
-
});
|
|
37464
|
-
} else {
|
|
37465
|
-
var entity = new Entity(engine, entityConfig.name);
|
|
37466
|
-
return Promise.resolve(entity);
|
|
37467
|
-
}
|
|
37468
|
-
};
|
|
37469
|
-
ReflectionParser.parseClassObject = function parseClassObject(item, engine, resourceManager) {
|
|
37470
|
-
if (resourceManager === void 0) resourceManager = engine.resourceManager;
|
|
37800
|
+
_proto.parseClassObject = function parseClassObject(item) {
|
|
37471
37801
|
var Class = Loader.getClass(item.class);
|
|
37472
37802
|
var _item_constructParams;
|
|
37473
37803
|
var params = (_item_constructParams = item.constructParams) != null ? _item_constructParams : [];
|
|
37474
37804
|
var instance = _construct(Class, [].concat(params));
|
|
37475
|
-
return this.parsePropsAndMethods(instance, item
|
|
37805
|
+
return this.parsePropsAndMethods(instance, item);
|
|
37476
37806
|
};
|
|
37477
|
-
|
|
37478
|
-
if (resourceManager === void 0) resourceManager = engine.resourceManager;
|
|
37479
|
-
var _this = this;
|
|
37480
|
-
if (Array.isArray(value)) {
|
|
37481
|
-
return Promise.all(value.map(function(item) {
|
|
37482
|
-
return _this.parseBasicType(item, engine, resourceManager);
|
|
37483
|
-
}));
|
|
37484
|
-
} else if (typeof value === "object" && value != null) {
|
|
37485
|
-
if (this._isClass(value)) {
|
|
37486
|
-
// class object
|
|
37487
|
-
return this.parseClassObject(value, engine, resourceManager);
|
|
37488
|
-
} else if (this._isRef(value)) {
|
|
37489
|
-
// reference object
|
|
37490
|
-
return resourceManager.getResourceByRef(value);
|
|
37491
|
-
} else {
|
|
37492
|
-
// basic type
|
|
37493
|
-
return Promise.resolve(value);
|
|
37494
|
-
}
|
|
37495
|
-
} else {
|
|
37496
|
-
return Promise.resolve(value);
|
|
37497
|
-
}
|
|
37498
|
-
};
|
|
37499
|
-
ReflectionParser.parsePropsAndMethods = function parsePropsAndMethods(instance, item, engine, resourceManager) {
|
|
37500
|
-
if (resourceManager === void 0) resourceManager = engine.resourceManager;
|
|
37501
|
-
var _this = this;
|
|
37807
|
+
_proto.parsePropsAndMethods = function parsePropsAndMethods(instance, item) {
|
|
37502
37808
|
var promises = [];
|
|
37503
37809
|
if (item.methods) {
|
|
37504
37810
|
for(var methodName in item.methods){
|
|
37505
37811
|
var methodParams = item.methods[methodName];
|
|
37506
37812
|
for(var i = 0, count = methodParams.length; i < count; i++){
|
|
37507
37813
|
var params = methodParams[i];
|
|
37508
|
-
var promise = this.parseMethod(instance, methodName, params
|
|
37814
|
+
var promise = this.parseMethod(instance, methodName, params);
|
|
37509
37815
|
promises.push(promise);
|
|
37510
37816
|
}
|
|
37511
37817
|
}
|
|
37512
37818
|
}
|
|
37513
37819
|
if (item.props) {
|
|
37514
|
-
var
|
|
37820
|
+
var _this = this, _loop = function _loop(key) {
|
|
37515
37821
|
var value = item.props[key];
|
|
37516
|
-
var promise =
|
|
37822
|
+
var promise = _this.parseBasicType(value).then(function(v) {
|
|
37517
37823
|
return instance[key] = v;
|
|
37518
37824
|
});
|
|
37519
37825
|
promises.push(promise);
|
|
@@ -37521,27 +37827,76 @@
|
|
|
37521
37827
|
for(var key in item.props)_loop(key);
|
|
37522
37828
|
}
|
|
37523
37829
|
return Promise.all(promises).then(function() {
|
|
37524
|
-
var handle =
|
|
37525
|
-
if (handle) return handle(instance, item
|
|
37830
|
+
var handle = ReflectionParser.customParseComponentHandles[instance.constructor.name];
|
|
37831
|
+
if (handle) return handle(instance, item);
|
|
37526
37832
|
else return instance;
|
|
37527
37833
|
});
|
|
37528
37834
|
};
|
|
37529
|
-
|
|
37530
|
-
if (resourceManager === void 0) resourceManager = engine.resourceManager;
|
|
37835
|
+
_proto.parseMethod = function parseMethod(instance, methodName, methodParams) {
|
|
37531
37836
|
var _this = this;
|
|
37532
37837
|
return Promise.all(methodParams.map(function(param) {
|
|
37533
|
-
return _this.parseBasicType(param
|
|
37838
|
+
return _this.parseBasicType(param);
|
|
37534
37839
|
})).then(function(result) {
|
|
37535
37840
|
var _instance;
|
|
37536
37841
|
return (_instance = instance)[methodName].apply(_instance, [].concat(result));
|
|
37537
37842
|
});
|
|
37538
37843
|
};
|
|
37844
|
+
_proto.parseBasicType = function parseBasicType(value) {
|
|
37845
|
+
var _this = this;
|
|
37846
|
+
if (Array.isArray(value)) {
|
|
37847
|
+
return Promise.all(value.map(function(item) {
|
|
37848
|
+
return _this.parseBasicType(item);
|
|
37849
|
+
}));
|
|
37850
|
+
} else if (typeof value === "object" && value != null) {
|
|
37851
|
+
if (ReflectionParser._isClass(value)) {
|
|
37852
|
+
// class object
|
|
37853
|
+
return this.parseClassObject(value);
|
|
37854
|
+
} else if (ReflectionParser._isAssetRef(value)) {
|
|
37855
|
+
// reference object
|
|
37856
|
+
// @ts-ignore
|
|
37857
|
+
return this._context.resourceManager.getResourceByRef(value);
|
|
37858
|
+
} else if (ReflectionParser._isEntityRef(value)) {
|
|
37859
|
+
// entity reference
|
|
37860
|
+
return Promise.resolve(this._context.entityMap.get(value.entityId));
|
|
37861
|
+
} else {
|
|
37862
|
+
// basic type
|
|
37863
|
+
return Promise.resolve(value);
|
|
37864
|
+
}
|
|
37865
|
+
} else {
|
|
37866
|
+
return Promise.resolve(value);
|
|
37867
|
+
}
|
|
37868
|
+
};
|
|
37869
|
+
_proto._getEntityByConfig = function _getEntityByConfig(entityConfig) {
|
|
37870
|
+
// @ts-ignore
|
|
37871
|
+
var assetRefId = entityConfig.assetRefId;
|
|
37872
|
+
var engine = this._context.engine;
|
|
37873
|
+
if (assetRefId) {
|
|
37874
|
+
return engine.resourceManager // @ts-ignore
|
|
37875
|
+
.getResourceByRef({
|
|
37876
|
+
refId: assetRefId,
|
|
37877
|
+
key: entityConfig.key,
|
|
37878
|
+
isClone: entityConfig.isClone
|
|
37879
|
+
}).then(function(entity) {
|
|
37880
|
+
entity.name = entityConfig.name;
|
|
37881
|
+
return entity;
|
|
37882
|
+
});
|
|
37883
|
+
} else {
|
|
37884
|
+
var entity = new Entity(engine, entityConfig.name);
|
|
37885
|
+
return Promise.resolve(entity);
|
|
37886
|
+
}
|
|
37887
|
+
};
|
|
37888
|
+
ReflectionParser.registerCustomParseComponent = function registerCustomParseComponent(componentType, handle) {
|
|
37889
|
+
this.customParseComponentHandles[componentType] = handle;
|
|
37890
|
+
};
|
|
37539
37891
|
ReflectionParser._isClass = function _isClass(value) {
|
|
37540
37892
|
return value["class"] != undefined;
|
|
37541
37893
|
};
|
|
37542
|
-
ReflectionParser.
|
|
37894
|
+
ReflectionParser._isAssetRef = function _isAssetRef(value) {
|
|
37543
37895
|
return value["refId"] != undefined;
|
|
37544
37896
|
};
|
|
37897
|
+
ReflectionParser._isEntityRef = function _isEntityRef(value) {
|
|
37898
|
+
return value["entityId"] != undefined;
|
|
37899
|
+
};
|
|
37545
37900
|
return ReflectionParser;
|
|
37546
37901
|
}();
|
|
37547
37902
|
(function() {
|
|
@@ -37797,6 +38152,8 @@
|
|
|
37797
38152
|
this.assets = new Map();
|
|
37798
38153
|
this.entityConfigMap = new Map();
|
|
37799
38154
|
this.rootIds = [];
|
|
38155
|
+
this.engine = scene.engine;
|
|
38156
|
+
this.resourceManager = scene.engine.resourceManager;
|
|
37800
38157
|
};
|
|
37801
38158
|
var _proto = SceneParserContext.prototype;
|
|
37802
38159
|
_proto.destroy = function destroy() {
|
|
@@ -37812,7 +38169,7 @@
|
|
|
37812
38169
|
var SceneParser = function SceneParser(context) {
|
|
37813
38170
|
var _this = this;
|
|
37814
38171
|
this.context = context;
|
|
37815
|
-
this._engine =
|
|
38172
|
+
this._engine = context.scene.engine;
|
|
37816
38173
|
this._organizeEntities = this._organizeEntities.bind(this);
|
|
37817
38174
|
this._parseComponents = this._parseComponents.bind(this);
|
|
37818
38175
|
this._clearAndResolveScene = this._clearAndResolveScene.bind(this);
|
|
@@ -37820,22 +38177,24 @@
|
|
|
37820
38177
|
_this._reject = reject;
|
|
37821
38178
|
_this._resolve = resolve;
|
|
37822
38179
|
});
|
|
38180
|
+
this._reflectionParser = new ReflectionParser(context);
|
|
37823
38181
|
};
|
|
37824
38182
|
var _proto = SceneParser.prototype;
|
|
37825
38183
|
/** start parse the scene */ _proto.start = function start() {
|
|
37826
38184
|
this._parseEntities().then(this._organizeEntities).then(this._parseComponents).then(this._clearAndResolveScene).then(this._resolve).catch(this._reject);
|
|
37827
38185
|
};
|
|
37828
38186
|
_proto._parseEntities = function _parseEntities() {
|
|
38187
|
+
var _this = this;
|
|
37829
38188
|
var entitiesConfig = this.context.originalData.entities;
|
|
37830
38189
|
var entityConfigMap = this.context.entityConfigMap;
|
|
37831
38190
|
var entitiesMap = this.context.entityMap;
|
|
37832
38191
|
var rootIds = this.context.rootIds;
|
|
37833
|
-
|
|
38192
|
+
this._engine;
|
|
37834
38193
|
var promises = entitiesConfig.map(function(entityConfig) {
|
|
37835
38194
|
entityConfigMap.set(entityConfig.id, entityConfig);
|
|
37836
38195
|
// record root entities
|
|
37837
38196
|
if (!entityConfig.parent) rootIds.push(entityConfig.id);
|
|
37838
|
-
return
|
|
38197
|
+
return _this._reflectionParser.parseEntity(entityConfig);
|
|
37839
38198
|
});
|
|
37840
38199
|
return Promise.all(promises).then(function(entities) {
|
|
37841
38200
|
for(var i = 0, l = entities.length; i < l; i++){
|
|
@@ -37873,7 +38232,7 @@
|
|
|
37873
38232
|
component = entity.getComponent(Loader.getClass(key));
|
|
37874
38233
|
}
|
|
37875
38234
|
component = component || entity.addComponent(Loader.getClass(key));
|
|
37876
|
-
var promise =
|
|
38235
|
+
var promise = this._reflectionParser.parsePropsAndMethods(component, componentConfig);
|
|
37877
38236
|
promises.push(promise);
|
|
37878
38237
|
}
|
|
37879
38238
|
}
|
|
@@ -39300,20 +39659,56 @@
|
|
|
39300
39659
|
return AbstractTranscoder;
|
|
39301
39660
|
}();
|
|
39302
39661
|
/** @internal */ function TranscodeWorkerCode$1() {
|
|
39303
|
-
|
|
39304
|
-
|
|
39305
|
-
|
|
39306
|
-
|
|
39307
|
-
|
|
39662
|
+
self.onmessage = function onmessage(event) {
|
|
39663
|
+
var message = event.data;
|
|
39664
|
+
switch(message.type){
|
|
39665
|
+
case "init":
|
|
39666
|
+
init(message.transcoderWasm).then(function() {
|
|
39667
|
+
self.postMessage("init-completed");
|
|
39668
|
+
}).catch(function(e) {
|
|
39669
|
+
return self.postMessage({
|
|
39670
|
+
error: e
|
|
39671
|
+
});
|
|
39672
|
+
});
|
|
39673
|
+
break;
|
|
39674
|
+
case "transcode":
|
|
39675
|
+
init().then(function(KTX2File) {
|
|
39676
|
+
var result = transcode(message.buffer, message.format, KTX2File);
|
|
39677
|
+
// @ts-ignore
|
|
39678
|
+
result.type = "transcoded";
|
|
39679
|
+
self.postMessage(result);
|
|
39680
|
+
}).catch(function(e) {
|
|
39681
|
+
return self.postMessage({
|
|
39682
|
+
error: e
|
|
39683
|
+
});
|
|
39684
|
+
});
|
|
39685
|
+
break;
|
|
39308
39686
|
}
|
|
39309
|
-
|
|
39310
|
-
|
|
39311
|
-
|
|
39312
|
-
|
|
39313
|
-
|
|
39687
|
+
};
|
|
39688
|
+
}
|
|
39689
|
+
var _init = function init() {
|
|
39690
|
+
var initPromise;
|
|
39691
|
+
return function init(wasmBinary) {
|
|
39692
|
+
if (!initPromise) {
|
|
39693
|
+
initPromise = new Promise(function(resolve, reject) {
|
|
39694
|
+
var BasisModule = {
|
|
39695
|
+
wasmBinary: wasmBinary,
|
|
39696
|
+
onRuntimeInitialized: function onRuntimeInitialized() {
|
|
39697
|
+
return resolve(BasisModule);
|
|
39698
|
+
},
|
|
39699
|
+
onAbort: reject
|
|
39700
|
+
};
|
|
39701
|
+
self["BASIS"](BasisModule);
|
|
39702
|
+
}).then(function(BasisModule) {
|
|
39703
|
+
BasisModule.initializeBasis();
|
|
39704
|
+
return BasisModule.KTX2File;
|
|
39705
|
+
});
|
|
39314
39706
|
}
|
|
39315
|
-
return
|
|
39707
|
+
return initPromise;
|
|
39316
39708
|
};
|
|
39709
|
+
};
|
|
39710
|
+
var init = _init();
|
|
39711
|
+
function transcode(buffer, targetFormat, KTX2File) {
|
|
39317
39712
|
var getTranscodeFormatFromTarget = function getTranscodeFormatFromTarget(target, hasAlpha) {
|
|
39318
39713
|
switch(target){
|
|
39319
39714
|
case 2:
|
|
@@ -39330,76 +39725,24 @@
|
|
|
39330
39725
|
return 7;
|
|
39331
39726
|
}
|
|
39332
39727
|
};
|
|
39333
|
-
var
|
|
39334
|
-
|
|
39335
|
-
|
|
39336
|
-
|
|
39337
|
-
|
|
39338
|
-
return resolve(BasisModule);
|
|
39339
|
-
},
|
|
39340
|
-
onAbort: reject
|
|
39341
|
-
};
|
|
39342
|
-
self["BASIS"](BasisModule);
|
|
39343
|
-
}).then(function(BasisModule) {
|
|
39344
|
-
BasisModule.initializeBasis();
|
|
39345
|
-
return BasisModule.KTX2File;
|
|
39346
|
-
});
|
|
39347
|
-
return transcodePromise;
|
|
39348
|
-
};
|
|
39349
|
-
var transcode = function transcode(buffer, targetFormat, KTX2File) {
|
|
39350
|
-
var cleanup = function cleanup() {
|
|
39351
|
-
ktx2File.close();
|
|
39352
|
-
ktx2File.delete();
|
|
39353
|
-
};
|
|
39354
|
-
var ktx2File = new KTX2File(new Uint8Array(buffer));
|
|
39355
|
-
if (!ktx2File.isValid()) {
|
|
39356
|
-
cleanup();
|
|
39357
|
-
throw new Error("Invalid or unsupported .ktx2 file");
|
|
39358
|
-
}
|
|
39359
|
-
var width = ktx2File.getWidth();
|
|
39360
|
-
var height = ktx2File.getHeight();
|
|
39361
|
-
var layerCount = ktx2File.getLayers() || 1;
|
|
39362
|
-
var levelCount = ktx2File.getLevels();
|
|
39363
|
-
var hasAlpha = ktx2File.getHasAlpha();
|
|
39364
|
-
var faceCount = ktx2File.getFaces();
|
|
39365
|
-
var format = getTranscodeFormatFromTarget(targetFormat, hasAlpha);
|
|
39366
|
-
var faces = new Array(faceCount);
|
|
39367
|
-
for(var face = 0; face < faceCount; face++){
|
|
39368
|
-
var mipmaps = new Array(levelCount);
|
|
39369
|
-
for(var mip = 0; mip < levelCount; mip++){
|
|
39370
|
-
var layerMips = new Array(layerCount);
|
|
39371
|
-
var mipWidth = void 0, mipHeight = void 0;
|
|
39372
|
-
for(var layer = 0; layer < layerCount; layer++){
|
|
39373
|
-
var levelInfo = ktx2File.getImageLevelInfo(mip, layer, face);
|
|
39374
|
-
mipWidth = levelInfo.origWidth;
|
|
39375
|
-
mipHeight = levelInfo.origHeight;
|
|
39376
|
-
var dst = new Uint8Array(ktx2File.getImageTranscodedSizeInBytes(mip, layer, 0, format));
|
|
39377
|
-
var status = ktx2File.transcodeImage(dst, mip, layer, face, format, 0, -1, -1);
|
|
39378
|
-
if (!status) {
|
|
39379
|
-
cleanup();
|
|
39380
|
-
throw new Error("transcodeImage failed.");
|
|
39381
|
-
}
|
|
39382
|
-
layerMips[layer] = dst;
|
|
39383
|
-
}
|
|
39384
|
-
mipmaps[mip] = {
|
|
39385
|
-
data: concat(layerMips),
|
|
39386
|
-
width: mipWidth,
|
|
39387
|
-
height: mipHeight
|
|
39388
|
-
};
|
|
39389
|
-
}
|
|
39390
|
-
faces[face] = mipmaps;
|
|
39728
|
+
var concat = function concat(arrays) {
|
|
39729
|
+
if (arrays.length === 1) return arrays[0];
|
|
39730
|
+
var totalByteLength = 0;
|
|
39731
|
+
for(var i = 0; i < arrays.length; i++){
|
|
39732
|
+
totalByteLength += arrays[i].byteLength;
|
|
39391
39733
|
}
|
|
39392
|
-
|
|
39393
|
-
|
|
39394
|
-
|
|
39395
|
-
|
|
39396
|
-
|
|
39397
|
-
|
|
39398
|
-
|
|
39399
|
-
|
|
39400
|
-
|
|
39734
|
+
var result = new Uint8Array(totalByteLength);
|
|
39735
|
+
var byteOffset = 0;
|
|
39736
|
+
for(var i1 = 0; i1 < arrays.length; i1++){
|
|
39737
|
+
result.set(arrays[i1], byteOffset);
|
|
39738
|
+
byteOffset += arrays[i1].byteLength;
|
|
39739
|
+
}
|
|
39740
|
+
return result;
|
|
39741
|
+
};
|
|
39742
|
+
var cleanup = function cleanup() {
|
|
39743
|
+
ktx2File.close();
|
|
39744
|
+
ktx2File.delete();
|
|
39401
39745
|
};
|
|
39402
|
-
var transcodePromise;
|
|
39403
39746
|
var BasisFormat;
|
|
39404
39747
|
(function(BasisFormat) {
|
|
39405
39748
|
BasisFormat[BasisFormat["ETC1"] = 0] = "ETC1";
|
|
@@ -39425,31 +39768,56 @@
|
|
|
39425
39768
|
TargetFormat[TargetFormat["RG8"] = 6] = "RG8";
|
|
39426
39769
|
TargetFormat[TargetFormat["RGBA8"] = 7] = "RGBA8";
|
|
39427
39770
|
})(TargetFormat || (TargetFormat = {}));
|
|
39428
|
-
|
|
39429
|
-
|
|
39430
|
-
|
|
39431
|
-
|
|
39432
|
-
|
|
39433
|
-
|
|
39434
|
-
|
|
39435
|
-
|
|
39436
|
-
|
|
39437
|
-
|
|
39438
|
-
|
|
39439
|
-
|
|
39440
|
-
|
|
39441
|
-
|
|
39442
|
-
|
|
39443
|
-
|
|
39444
|
-
|
|
39445
|
-
|
|
39446
|
-
|
|
39447
|
-
|
|
39448
|
-
|
|
39449
|
-
|
|
39450
|
-
|
|
39451
|
-
|
|
39771
|
+
var ktx2File = new KTX2File(new Uint8Array(buffer));
|
|
39772
|
+
if (!ktx2File.isValid()) {
|
|
39773
|
+
cleanup();
|
|
39774
|
+
throw new Error("Invalid or unsupported .ktx2 file");
|
|
39775
|
+
}
|
|
39776
|
+
if (!ktx2File.startTranscoding()) {
|
|
39777
|
+
cleanup();
|
|
39778
|
+
throw new Error("KTX2 startTranscoding failed");
|
|
39779
|
+
}
|
|
39780
|
+
var width = ktx2File.getWidth();
|
|
39781
|
+
var height = ktx2File.getHeight();
|
|
39782
|
+
var layerCount = ktx2File.getLayers() || 1;
|
|
39783
|
+
var levelCount = ktx2File.getLevels();
|
|
39784
|
+
var hasAlpha = ktx2File.getHasAlpha();
|
|
39785
|
+
var faceCount = ktx2File.getFaces();
|
|
39786
|
+
var format = getTranscodeFormatFromTarget(targetFormat, hasAlpha);
|
|
39787
|
+
var faces = new Array(faceCount);
|
|
39788
|
+
for(var face = 0; face < faceCount; face++){
|
|
39789
|
+
var mipmaps = new Array(levelCount);
|
|
39790
|
+
for(var mip = 0; mip < levelCount; mip++){
|
|
39791
|
+
var layerMips = new Array(layerCount);
|
|
39792
|
+
var mipWidth = void 0, mipHeight = void 0;
|
|
39793
|
+
for(var layer = 0; layer < layerCount; layer++){
|
|
39794
|
+
var levelInfo = ktx2File.getImageLevelInfo(mip, layer, face);
|
|
39795
|
+
mipWidth = levelInfo.origWidth;
|
|
39796
|
+
mipHeight = levelInfo.origHeight;
|
|
39797
|
+
var dst = new Uint8Array(ktx2File.getImageTranscodedSizeInBytes(mip, layer, 0, format));
|
|
39798
|
+
var status = ktx2File.transcodeImage(dst, mip, layer, face, format, 0, -1, -1);
|
|
39799
|
+
if (!status) {
|
|
39800
|
+
cleanup();
|
|
39801
|
+
throw new Error("transcodeImage failed.");
|
|
39802
|
+
}
|
|
39803
|
+
layerMips[layer] = dst;
|
|
39804
|
+
}
|
|
39805
|
+
mipmaps[mip] = {
|
|
39806
|
+
data: concat(layerMips),
|
|
39807
|
+
width: mipWidth,
|
|
39808
|
+
height: mipHeight
|
|
39809
|
+
};
|
|
39452
39810
|
}
|
|
39811
|
+
faces[face] = mipmaps;
|
|
39812
|
+
}
|
|
39813
|
+
cleanup();
|
|
39814
|
+
return {
|
|
39815
|
+
faces: faces,
|
|
39816
|
+
width: width,
|
|
39817
|
+
height: height,
|
|
39818
|
+
hasAlpha: hasAlpha,
|
|
39819
|
+
faceCount: faceCount,
|
|
39820
|
+
format: format
|
|
39453
39821
|
};
|
|
39454
39822
|
}
|
|
39455
39823
|
/** @internal */ var BinomialLLCTranscoder = /*#__PURE__*/ function(AbstractTranscoder1) {
|
|
@@ -39469,23 +39837,49 @@
|
|
|
39469
39837
|
})
|
|
39470
39838
|
]).then(function(param) {
|
|
39471
39839
|
var jsCode = param[0], wasmBuffer = param[1];
|
|
39472
|
-
|
|
39473
|
-
|
|
39474
|
-
|
|
39475
|
-
|
|
39476
|
-
|
|
39477
|
-
|
|
39478
|
-
|
|
39479
|
-
|
|
39480
|
-
|
|
39840
|
+
if (_this.workerLimitCount === 0) {
|
|
39841
|
+
return new Promise(function(resolve, reject) {
|
|
39842
|
+
var scriptDom = document.createElement("script");
|
|
39843
|
+
scriptDom.src = URL.createObjectURL(new Blob([
|
|
39844
|
+
jsCode
|
|
39845
|
+
], {
|
|
39846
|
+
type: "application/javascript"
|
|
39847
|
+
}));
|
|
39848
|
+
document.body.appendChild(scriptDom);
|
|
39849
|
+
scriptDom.onload = function() {
|
|
39850
|
+
init(wasmBuffer).then(function() {
|
|
39851
|
+
resolve(null);
|
|
39852
|
+
});
|
|
39853
|
+
};
|
|
39854
|
+
scriptDom.onerror = function() {
|
|
39855
|
+
reject();
|
|
39856
|
+
};
|
|
39857
|
+
});
|
|
39858
|
+
} else {
|
|
39859
|
+
var funcCode = TranscodeWorkerCode$1.toString();
|
|
39860
|
+
var transcodeString = funcCode.substring(funcCode.indexOf("{"), funcCode.lastIndexOf("}") + 1);
|
|
39861
|
+
var workerCode = "\n " + jsCode + "\n var init = (" + _init.toString() + ")();\n " + transcode.toString() + "\n " + transcodeString + "\n ";
|
|
39862
|
+
var workerURL = URL.createObjectURL(new Blob([
|
|
39863
|
+
workerCode
|
|
39864
|
+
], {
|
|
39865
|
+
type: "application/javascript"
|
|
39866
|
+
}));
|
|
39867
|
+
return _this._createTranscodePool(workerURL, wasmBuffer);
|
|
39868
|
+
}
|
|
39481
39869
|
});
|
|
39482
39870
|
};
|
|
39483
|
-
_proto.transcode = function
|
|
39484
|
-
|
|
39485
|
-
|
|
39486
|
-
|
|
39487
|
-
|
|
39488
|
-
}
|
|
39871
|
+
_proto.transcode = function transcode1(buffer, format) {
|
|
39872
|
+
if (this.workerLimitCount === 0) {
|
|
39873
|
+
return init().then(function(KTX2File) {
|
|
39874
|
+
return transcode(buffer, format, KTX2File);
|
|
39875
|
+
});
|
|
39876
|
+
} else {
|
|
39877
|
+
return this._transcodeWorkerPool.postMessage({
|
|
39878
|
+
buffer: buffer,
|
|
39879
|
+
format: format,
|
|
39880
|
+
type: "transcode"
|
|
39881
|
+
});
|
|
39882
|
+
}
|
|
39489
39883
|
};
|
|
39490
39884
|
return BinomialLLCTranscoder;
|
|
39491
39885
|
}(AbstractTranscoder);
|
|
@@ -39709,7 +40103,7 @@
|
|
|
39709
40103
|
_proto.initialize = function initialize(engine, configuration) {
|
|
39710
40104
|
if (configuration.ktx2Loader) {
|
|
39711
40105
|
var options = configuration.ktx2Loader;
|
|
39712
|
-
if (this._isKhronosSupported(options.priorityFormats, engine)) {
|
|
40106
|
+
if (this._isKhronosSupported(options.priorityFormats, engine) && options.workerCount !== 0) {
|
|
39713
40107
|
return exports.KTX2Loader._getKhronosTranscoder(options.workerCount).init();
|
|
39714
40108
|
} else {
|
|
39715
40109
|
return exports.KTX2Loader._getBinomialLLCTranscoder(options.workerCount).init();
|
|
@@ -40425,12 +40819,12 @@
|
|
|
40425
40819
|
if (curve2.interpolation === exports.InterpolationType.CubicSpine) {
|
|
40426
40820
|
keyframe2.inTangent = Array.from(output.subarray(offset2, offset2 + outputSize));
|
|
40427
40821
|
offset2 += outputSize;
|
|
40428
|
-
keyframe2.value = output.
|
|
40822
|
+
keyframe2.value = output.slice(offset2, offset2 + outputSize);
|
|
40429
40823
|
offset2 += outputSize;
|
|
40430
40824
|
keyframe2.outTangent = Array.from(output.subarray(offset2, offset2 + outputSize));
|
|
40431
40825
|
offset2 += outputSize;
|
|
40432
40826
|
} else {
|
|
40433
|
-
keyframe2.value = output.
|
|
40827
|
+
keyframe2.value = output.slice(offset2, offset2 + outputSize);
|
|
40434
40828
|
offset2 += outputSize;
|
|
40435
40829
|
}
|
|
40436
40830
|
curve2.addKey(keyframe2);
|
|
@@ -41173,8 +41567,7 @@
|
|
|
41173
41567
|
mipmap: (_samplerInfo = samplerInfo) == null ? void 0 : _samplerInfo.mipmap
|
|
41174
41568
|
}
|
|
41175
41569
|
}).then(function(texture) {
|
|
41176
|
-
|
|
41177
|
-
(_texture = texture).name || (_texture.name = textureName || imageName || "texture_" + index);
|
|
41570
|
+
texture.name = textureName || imageName || texture.name || "texture_" + index;
|
|
41178
41571
|
useSampler && GLTFUtils.parseSampler(texture, samplerInfo);
|
|
41179
41572
|
return texture;
|
|
41180
41573
|
});
|
|
@@ -42262,6 +42655,38 @@
|
|
|
42262
42655
|
""
|
|
42263
42656
|
])
|
|
42264
42657
|
], TextureCubeLoader);
|
|
42658
|
+
var ProjectLoader = /*#__PURE__*/ function(Loader1) {
|
|
42659
|
+
var ProjectLoader = function ProjectLoader() {
|
|
42660
|
+
return Loader1.apply(this, arguments);
|
|
42661
|
+
};
|
|
42662
|
+
_inherits(ProjectLoader, Loader1);
|
|
42663
|
+
var _proto = ProjectLoader.prototype;
|
|
42664
|
+
_proto.load = function load(item, resourceManager) {
|
|
42665
|
+
var _this = this;
|
|
42666
|
+
var engine = resourceManager.engine;
|
|
42667
|
+
return new AssetPromise(function(resolve, reject) {
|
|
42668
|
+
_this.request(item.url, {
|
|
42669
|
+
type: "json"
|
|
42670
|
+
}).then(function(data) {
|
|
42671
|
+
// @ts-ignore
|
|
42672
|
+
engine.resourceManager.initVirtualResources(data.files);
|
|
42673
|
+
return resourceManager.load({
|
|
42674
|
+
type: exports.AssetType.Scene,
|
|
42675
|
+
url: data.scene
|
|
42676
|
+
}).then(function(scene) {
|
|
42677
|
+
engine.sceneManager.activeScene = scene;
|
|
42678
|
+
resolve();
|
|
42679
|
+
});
|
|
42680
|
+
}).catch(reject);
|
|
42681
|
+
});
|
|
42682
|
+
};
|
|
42683
|
+
return ProjectLoader;
|
|
42684
|
+
}(Loader);
|
|
42685
|
+
ProjectLoader = __decorate([
|
|
42686
|
+
resourceLoader(exports.AssetType.Project, [
|
|
42687
|
+
"proj"
|
|
42688
|
+
], false)
|
|
42689
|
+
], ProjectLoader);
|
|
42265
42690
|
var SceneLoader = /*#__PURE__*/ function(Loader1) {
|
|
42266
42691
|
var SceneLoader = function SceneLoader() {
|
|
42267
42692
|
return Loader1.apply(this, arguments);
|
|
@@ -42280,32 +42705,26 @@
|
|
|
42280
42705
|
// parse ambient light
|
|
42281
42706
|
var ambient = data.scene.ambient;
|
|
42282
42707
|
var useCustomAmbient = ambient.specularMode === "Custom";
|
|
42708
|
+
var useSH = ambient.diffuseMode === exports.DiffuseMode.SphericalHarmonics;
|
|
42709
|
+
scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
|
|
42710
|
+
scene.ambientLight.specularIntensity = ambient.specularIntensity;
|
|
42711
|
+
scene.ambientLight.diffuseMode = ambient.diffuseMode;
|
|
42712
|
+
scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
|
|
42713
|
+
scene.ambientLight.specularTextureDecodeRGBM = true;
|
|
42283
42714
|
if (useCustomAmbient && ambient.customAmbientLight) {
|
|
42284
|
-
|
|
42285
|
-
|
|
42286
|
-
|
|
42287
|
-
|
|
42288
|
-
|
|
42289
|
-
|
|
42290
|
-
|
|
42291
|
-
|
|
42292
|
-
|
|
42293
|
-
|
|
42294
|
-
|
|
42295
|
-
|
|
42296
|
-
|
|
42297
|
-
var ambientLightPromise = resourceManager.getResourceByRef(ambient.ambientLight).then(function(ambientLight) {
|
|
42298
|
-
scene.ambientLight = ambientLight;
|
|
42299
|
-
scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
|
|
42300
|
-
scene.ambientLight.specularIntensity = ambient.specularIntensity;
|
|
42301
|
-
scene.ambientLight.diffuseMode = ambient.diffuseMode;
|
|
42302
|
-
scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
|
|
42303
|
-
});
|
|
42304
|
-
promises.push(ambientLightPromise);
|
|
42305
|
-
} else {
|
|
42306
|
-
scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
|
|
42307
|
-
scene.ambientLight.specularIntensity = ambient.specularIntensity;
|
|
42308
|
-
scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
|
|
42715
|
+
promises.push(resourceManager.getResourceByRef(ambient.customAmbientLight).then(function(ambientLight) {
|
|
42716
|
+
scene.ambientLight.specularTexture = ambientLight.specularTexture;
|
|
42717
|
+
}));
|
|
42718
|
+
}
|
|
42719
|
+
if (ambient.ambientLight && (!useCustomAmbient || useSH)) {
|
|
42720
|
+
promises.push(resourceManager.getResourceByRef(ambient.ambientLight).then(function(ambientLight) {
|
|
42721
|
+
if (!useCustomAmbient) {
|
|
42722
|
+
scene.ambientLight.specularTexture = ambientLight.specularTexture;
|
|
42723
|
+
}
|
|
42724
|
+
if (useSH) {
|
|
42725
|
+
scene.ambientLight.diffuseSphericalHarmonics = ambientLight.diffuseSphericalHarmonics;
|
|
42726
|
+
}
|
|
42727
|
+
}));
|
|
42309
42728
|
}
|
|
42310
42729
|
var background = data.scene.background;
|
|
42311
42730
|
scene.background.mode = background.mode;
|
|
@@ -42858,7 +43277,7 @@
|
|
|
42858
43277
|
], GALACEAN_animation_event);
|
|
42859
43278
|
|
|
42860
43279
|
//@ts-ignore
|
|
42861
|
-
var version = "1.1.0-beta.
|
|
43280
|
+
var version = "1.1.0-beta.10";
|
|
42862
43281
|
console.log("Galacean engine version: " + version);
|
|
42863
43282
|
for(var key in CoreObjects){
|
|
42864
43283
|
Loader.registerClass(key, CoreObjects[key]);
|
|
@@ -42901,6 +43320,7 @@
|
|
|
42901
43320
|
exports.ColliderShape = ColliderShape;
|
|
42902
43321
|
exports.CollisionUtil = CollisionUtil;
|
|
42903
43322
|
exports.Color = Color$1;
|
|
43323
|
+
exports.ColorOverLifetimeModule = ColorOverLifetimeModule;
|
|
42904
43324
|
exports.Component = Component;
|
|
42905
43325
|
exports.ComponentMap = ComponentMap;
|
|
42906
43326
|
exports.ConeShape = ConeShape;
|
|
@@ -42910,6 +43330,7 @@
|
|
|
42910
43330
|
exports.DepthState = DepthState;
|
|
42911
43331
|
exports.DirectLight = DirectLight;
|
|
42912
43332
|
exports.DynamicCollider = DynamicCollider;
|
|
43333
|
+
exports.EmissionModule = EmissionModule;
|
|
42913
43334
|
exports.Engine = Engine;
|
|
42914
43335
|
exports.EngineObject = EngineObject;
|
|
42915
43336
|
exports.Entity = Entity;
|
|
@@ -42921,6 +43342,8 @@
|
|
|
42921
43342
|
exports.GLTFParserContext = GLTFParserContext;
|
|
42922
43343
|
exports.GLTFResource = GLTFResource;
|
|
42923
43344
|
exports.GLTFUtils = GLTFUtils;
|
|
43345
|
+
exports.GradientAlphaKey = GradientAlphaKey;
|
|
43346
|
+
exports.GradientColorKey = GradientColorKey;
|
|
42924
43347
|
exports.HemisphereShape = HemisphereShape;
|
|
42925
43348
|
exports.HingeJoint = HingeJoint;
|
|
42926
43349
|
exports.HitResult = HitResult;
|
|
@@ -42932,6 +43355,7 @@
|
|
|
42932
43355
|
exports.Light = Light;
|
|
42933
43356
|
exports.Loader = Loader;
|
|
42934
43357
|
exports.Logger = Logger;
|
|
43358
|
+
exports.MainModule = MainModule;
|
|
42935
43359
|
exports.Material = Material;
|
|
42936
43360
|
exports.MathUtil = MathUtil$1;
|
|
42937
43361
|
exports.Matrix = Matrix;
|
|
@@ -42943,7 +43367,10 @@
|
|
|
42943
43367
|
exports.PBRMaterial = PBRMaterial;
|
|
42944
43368
|
exports.PBRSpecularMaterial = PBRSpecularMaterial;
|
|
42945
43369
|
exports.ParticleCompositeCurve = ParticleCompositeCurve;
|
|
43370
|
+
exports.ParticleCompositeGradient = ParticleCompositeGradient;
|
|
42946
43371
|
exports.ParticleCurve = ParticleCurve;
|
|
43372
|
+
exports.ParticleGenerator = ParticleGenerator;
|
|
43373
|
+
exports.ParticleGradient = ParticleGradient;
|
|
42947
43374
|
exports.ParticleMaterial = ParticleMaterial;
|
|
42948
43375
|
exports.ParticleRenderer = ParticleRenderer;
|
|
42949
43376
|
exports.PhysicsMaterial = PhysicsMaterial;
|
|
@@ -42969,6 +43396,7 @@
|
|
|
42969
43396
|
exports.RenderTarget = RenderTarget;
|
|
42970
43397
|
exports.RenderTargetBlendState = RenderTargetBlendState;
|
|
42971
43398
|
exports.ResourceManager = ResourceManager;
|
|
43399
|
+
exports.RotationOverLifetimeModule = RotationOverLifetimeModule;
|
|
42972
43400
|
exports.Scene = Scene;
|
|
42973
43401
|
exports.SceneManager = SceneManager;
|
|
42974
43402
|
exports.SceneParser = SceneParser;
|
|
@@ -42981,6 +43409,7 @@
|
|
|
42981
43409
|
exports.ShaderPass = ShaderPass;
|
|
42982
43410
|
exports.ShaderProperty = ShaderProperty;
|
|
42983
43411
|
exports.ShaderTagKey = ShaderTagKey;
|
|
43412
|
+
exports.SizeOverLifetimeModule = SizeOverLifetimeModule;
|
|
42984
43413
|
exports.Skin = Skin;
|
|
42985
43414
|
exports.SkinnedMeshRenderer = SkinnedMeshRenderer;
|
|
42986
43415
|
exports.Sky = Sky;
|
|
@@ -43007,6 +43436,7 @@
|
|
|
43007
43436
|
exports.Texture2D = Texture2D;
|
|
43008
43437
|
exports.Texture2DArray = Texture2DArray;
|
|
43009
43438
|
exports.TextureCube = TextureCube;
|
|
43439
|
+
exports.TextureSheetAnimationModule = TextureSheetAnimationModule;
|
|
43010
43440
|
exports.Time = Time;
|
|
43011
43441
|
exports.TrailMaterial = TrailMaterial;
|
|
43012
43442
|
exports.TrailRenderer = TrailRenderer;
|
|
@@ -43016,6 +43446,7 @@
|
|
|
43016
43446
|
exports.Vector2 = Vector2;
|
|
43017
43447
|
exports.Vector3 = Vector3;
|
|
43018
43448
|
exports.Vector4 = Vector4;
|
|
43449
|
+
exports.VelocityOverLifetimeModule = VelocityOverLifetimeModule;
|
|
43019
43450
|
exports.VertexBufferBinding = VertexBufferBinding;
|
|
43020
43451
|
exports.VertexElement = VertexElement;
|
|
43021
43452
|
exports.WebCanvas = WebCanvas;
|