@galacean/engine-core 1.4.8 → 1.4.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/main.js +111 -97
- package/dist/main.js.map +1 -1
- package/dist/module.js +111 -97
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Scene.d.ts +0 -1
- package/types/material/Material.d.ts +1 -0
package/dist/main.js
CHANGED
|
@@ -8846,6 +8846,7 @@ BatchUtils._disableBatchTag = ShaderTagKey.getByName("spriteDisableBatching");
|
|
|
8846
8846
|
var blitMaterial = material || basicResources.blitMaterial;
|
|
8847
8847
|
var rhi = engine._hardwareRenderer;
|
|
8848
8848
|
var context = engine._renderContext;
|
|
8849
|
+
var camera = context.camera;
|
|
8849
8850
|
// We not use projection matrix when blit, but we must modify flipProjection to make front face correct
|
|
8850
8851
|
context.flipProjection = !!destination;
|
|
8851
8852
|
rhi.activeRenderTarget(destination, viewport, context.flipProjection, 0);
|
|
@@ -8857,10 +8858,12 @@ BatchUtils._disableBatchTag = ShaderTagKey.getByName("spriteDisableBatching");
|
|
|
8857
8858
|
rendererShaderData.setVector4(Blitter._sourceScaleOffsetProperty, sourceScaleOffset != null ? sourceScaleOffset : Blitter._defaultScaleOffset);
|
|
8858
8859
|
var pass = blitMaterial.shader.subShaders[0].passes[passIndex];
|
|
8859
8860
|
var compileMacros = Shader._compileMacros;
|
|
8860
|
-
ShaderMacroCollection.unionCollection(
|
|
8861
|
+
ShaderMacroCollection.unionCollection(camera._globalShaderMacro, blitMaterial.shaderData._macroCollection, compileMacros);
|
|
8861
8862
|
var program = pass._getShaderProgram(engine, compileMacros);
|
|
8862
8863
|
program.bind();
|
|
8863
8864
|
program.groupingOtherUniformBlock();
|
|
8865
|
+
program.uploadAll(program.sceneUniformBlock, camera.scene.shaderData);
|
|
8866
|
+
program.uploadAll(program.cameraUniformBlock, camera.shaderData);
|
|
8864
8867
|
program.uploadAll(program.rendererUniformBlock, rendererShaderData);
|
|
8865
8868
|
program.uploadAll(program.materialUniformBlock, blitMaterial.shaderData);
|
|
8866
8869
|
program.uploadUnGroupTextures();
|
|
@@ -10352,7 +10355,7 @@ exports.Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10352
10355
|
};
|
|
10353
10356
|
_proto._createInstanceMaterial = function _createInstanceMaterial(material, index) {
|
|
10354
10357
|
var insMaterial = material.clone();
|
|
10355
|
-
insMaterial.name =
|
|
10358
|
+
insMaterial.name = material.name + "(Instance)";
|
|
10356
10359
|
this._addResourceReferCount(material, -1);
|
|
10357
10360
|
this._addResourceReferCount(insMaterial, 1);
|
|
10358
10361
|
this._materialsInstanced[index] = true;
|
|
@@ -12331,6 +12334,7 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
12331
12334
|
_this = ReferResource.call(this, engine) || this, /** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
|
|
12332
12335
|
, _this._shaderData = new ShaderData(ShaderDataGroup.Material);
|
|
12333
12336
|
_this.shader = shader;
|
|
12337
|
+
_this.name = shader.name;
|
|
12334
12338
|
return _this;
|
|
12335
12339
|
}
|
|
12336
12340
|
var _proto = Material.prototype;
|
|
@@ -12338,7 +12342,7 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
12338
12342
|
* Clone and return the instance.
|
|
12339
12343
|
*/ _proto.clone = function clone() {
|
|
12340
12344
|
var dest = new Material(this._engine, this.shader);
|
|
12341
|
-
this.
|
|
12345
|
+
this._cloneToAndModifyName(dest);
|
|
12342
12346
|
return dest;
|
|
12343
12347
|
};
|
|
12344
12348
|
/**
|
|
@@ -12355,6 +12359,10 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
12355
12359
|
this.shaderData._addReferCount(value);
|
|
12356
12360
|
this._shader._addReferCount(value);
|
|
12357
12361
|
};
|
|
12362
|
+
_proto._cloneToAndModifyName = function _cloneToAndModifyName(target) {
|
|
12363
|
+
this.cloneTo(target);
|
|
12364
|
+
target.name = this.name + "(Clone)";
|
|
12365
|
+
};
|
|
12358
12366
|
/**
|
|
12359
12367
|
* @override
|
|
12360
12368
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
@@ -12510,7 +12518,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
12510
12518
|
* Clone and return the instance.
|
|
12511
12519
|
*/ _proto.clone = function clone() {
|
|
12512
12520
|
var dest = new BaseMaterial(this._engine, this.shader);
|
|
12513
|
-
this.
|
|
12521
|
+
this._cloneToAndModifyName(dest);
|
|
12514
12522
|
return dest;
|
|
12515
12523
|
};
|
|
12516
12524
|
/**
|
|
@@ -12692,7 +12700,7 @@ BaseMaterial._alphaCutoffMacro = ShaderMacro.getByName("MATERIAL_IS_ALPHA_CUTOFF
|
|
|
12692
12700
|
var _proto = BlinnPhongMaterial.prototype;
|
|
12693
12701
|
_proto.clone = function clone() {
|
|
12694
12702
|
var dest = new BlinnPhongMaterial(this._engine);
|
|
12695
|
-
this.
|
|
12703
|
+
this._cloneToAndModifyName(dest);
|
|
12696
12704
|
return dest;
|
|
12697
12705
|
};
|
|
12698
12706
|
_create_class(BlinnPhongMaterial, [
|
|
@@ -13152,7 +13160,7 @@ PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("material
|
|
|
13152
13160
|
* @inheritdoc
|
|
13153
13161
|
*/ _proto.clone = function clone() {
|
|
13154
13162
|
var dest = new PBRMaterial(this._engine);
|
|
13155
|
-
this.
|
|
13163
|
+
this._cloneToAndModifyName(dest);
|
|
13156
13164
|
return dest;
|
|
13157
13165
|
};
|
|
13158
13166
|
_proto._onIridescenceRangeChanged = function _onIridescenceRangeChanged() {
|
|
@@ -13618,7 +13626,7 @@ PBRMaterial._thicknessTextureProp = ShaderProperty.getByName("material_Thickness
|
|
|
13618
13626
|
* @inheritdoc
|
|
13619
13627
|
*/ _proto.clone = function clone() {
|
|
13620
13628
|
var dest = new PBRSpecularMaterial(this._engine);
|
|
13621
|
-
this.
|
|
13629
|
+
this._cloneToAndModifyName(dest);
|
|
13622
13630
|
return dest;
|
|
13623
13631
|
};
|
|
13624
13632
|
_create_class(PBRSpecularMaterial, [
|
|
@@ -13691,7 +13699,7 @@ PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("MAT
|
|
|
13691
13699
|
* @inheritdoc
|
|
13692
13700
|
*/ _proto.clone = function clone() {
|
|
13693
13701
|
var dest = new UnlitMaterial(this._engine);
|
|
13694
|
-
this.
|
|
13702
|
+
this._cloneToAndModifyName(dest);
|
|
13695
13703
|
return dest;
|
|
13696
13704
|
};
|
|
13697
13705
|
_create_class(UnlitMaterial, [
|
|
@@ -17351,7 +17359,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17351
17359
|
var _this;
|
|
17352
17360
|
_this = EngineObject.call(this, engine) || this, /** The layer the entity belongs to. */ _this.layer = Layer.Layer0, /** @internal */ _this._isActiveInHierarchy = false, /** @internal */ _this._isActiveInScene = false, /** @internal */ _this._components = [], /** @internal */ _this._scripts = new DisorderedArray(), /** @internal */ _this._children = [], /** @internal */ _this._isRoot = false, /** @internal */ _this._isActive = true, /** @internal */ _this._siblingIndex = -1, /** @internal */ _this._isTemplate = false, /** @internal */ _this._updateFlagManager = new UpdateFlagManager(), _this._parent = null, //--------------------------------------------------------------deprecated----------------------------------------------------------------
|
|
17353
17361
|
_this._invModelMatrix = new engineMath.Matrix();
|
|
17354
|
-
_this.name = name;
|
|
17362
|
+
_this.name = name != null ? name : "Entity";
|
|
17355
17363
|
for(var i = 0, n = components.length; i < n; i++){
|
|
17356
17364
|
_this.addComponent(components[i]);
|
|
17357
17365
|
}
|
|
@@ -17432,11 +17440,11 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17432
17440
|
child = indexOrChild;
|
|
17433
17441
|
}
|
|
17434
17442
|
if (child._isRoot) {
|
|
17435
|
-
child._scene
|
|
17443
|
+
var oldScene = child._scene;
|
|
17444
|
+
Entity._removeFromChildren(oldScene._rootEntities, child);
|
|
17436
17445
|
child._isRoot = false;
|
|
17437
17446
|
this._addToChildrenList(index, child);
|
|
17438
17447
|
child._parent = this;
|
|
17439
|
-
var oldScene = child._scene;
|
|
17440
17448
|
var newScene = this._scene;
|
|
17441
17449
|
var inActiveChangeFlag = ActiveChangeFlag.None;
|
|
17442
17450
|
if (!this._isActiveInHierarchy) {
|
|
@@ -17641,14 +17649,8 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17641
17649
|
*/ _proto._removeFromParent = function _removeFromParent() {
|
|
17642
17650
|
var oldParent = this._parent;
|
|
17643
17651
|
if (oldParent != null) {
|
|
17644
|
-
|
|
17645
|
-
var index = this._siblingIndex;
|
|
17646
|
-
oldSibling.splice(index, 1);
|
|
17647
|
-
for(var n = oldSibling.length; index < n; index++){
|
|
17648
|
-
oldSibling[index]._siblingIndex--;
|
|
17649
|
-
}
|
|
17652
|
+
Entity._removeFromChildren(oldParent._children, this);
|
|
17650
17653
|
this._parent = null;
|
|
17651
|
-
this._siblingIndex = -1;
|
|
17652
17654
|
this._dispatchModify(EntityModifyFlags.Child, oldParent);
|
|
17653
17655
|
}
|
|
17654
17656
|
};
|
|
@@ -17694,21 +17696,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17694
17696
|
(_this__modifyFlagManager = this._modifyFlagManager) == null ? void 0 : _this__modifyFlagManager.dispatch(flag, param);
|
|
17695
17697
|
};
|
|
17696
17698
|
_proto._addToChildrenList = function _addToChildrenList(index, child) {
|
|
17697
|
-
|
|
17698
|
-
var childCount = children.length;
|
|
17699
|
-
if (index === undefined) {
|
|
17700
|
-
child._siblingIndex = childCount;
|
|
17701
|
-
children.push(child);
|
|
17702
|
-
} else {
|
|
17703
|
-
if (index < 0 || index > childCount) {
|
|
17704
|
-
throw "The index " + index + " is out of child list bounds " + childCount;
|
|
17705
|
-
}
|
|
17706
|
-
child._siblingIndex = index;
|
|
17707
|
-
children.splice(index, 0, child);
|
|
17708
|
-
for(var i = index + 1, n = childCount + 1; i < n; i++){
|
|
17709
|
-
children[i]._siblingIndex++;
|
|
17710
|
-
}
|
|
17711
|
-
}
|
|
17699
|
+
Entity._addToChildren(this._children, child, index);
|
|
17712
17700
|
this._dispatchModify(EntityModifyFlags.Child, this);
|
|
17713
17701
|
};
|
|
17714
17702
|
_proto._setParent = function _setParent(parent, siblingIndex) {
|
|
@@ -17887,6 +17875,39 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17887
17875
|
}
|
|
17888
17876
|
return entity;
|
|
17889
17877
|
};
|
|
17878
|
+
/**
|
|
17879
|
+
* @internal
|
|
17880
|
+
*/ Entity._removeFromChildren = function _removeFromChildren(children, entity) {
|
|
17881
|
+
var count = children.length - 1;
|
|
17882
|
+
for(var i = entity._siblingIndex; i < count; i++){
|
|
17883
|
+
var child = children[i + 1];
|
|
17884
|
+
children[i] = child;
|
|
17885
|
+
child._siblingIndex = i;
|
|
17886
|
+
}
|
|
17887
|
+
children.length = count;
|
|
17888
|
+
entity._siblingIndex = -1;
|
|
17889
|
+
};
|
|
17890
|
+
/**
|
|
17891
|
+
* @internal
|
|
17892
|
+
*/ Entity._addToChildren = function _addToChildren(children, entity, index) {
|
|
17893
|
+
var childCount = children.length;
|
|
17894
|
+
children.length = childCount + 1;
|
|
17895
|
+
if (index === undefined) {
|
|
17896
|
+
children[childCount] = entity;
|
|
17897
|
+
entity._siblingIndex = childCount;
|
|
17898
|
+
} else {
|
|
17899
|
+
if (index < 0 || index > childCount) {
|
|
17900
|
+
throw "The index " + index + " is out of child list bounds " + childCount;
|
|
17901
|
+
}
|
|
17902
|
+
for(var i = childCount; i > index; i--){
|
|
17903
|
+
var swapChild = children[i - 1];
|
|
17904
|
+
swapChild._siblingIndex = i;
|
|
17905
|
+
children[i] = swapChild;
|
|
17906
|
+
}
|
|
17907
|
+
entity._siblingIndex = index;
|
|
17908
|
+
children[index] = entity;
|
|
17909
|
+
}
|
|
17910
|
+
};
|
|
17890
17911
|
_create_class(Entity, [
|
|
17891
17912
|
{
|
|
17892
17913
|
key: "transform",
|
|
@@ -24442,7 +24463,7 @@ var blinnPhongVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>
|
|
|
24442
24463
|
|
|
24443
24464
|
var depthOnlyFs = "#define GLSLIFY 1\nvoid main() {\n}"; // eslint-disable-line
|
|
24444
24465
|
|
|
24445
|
-
var depthOnlyVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#include <blendShape_input>\nuniform mat4 camera_VPMat;\n\nvoid main() {\n\n #include <begin_position_vert>\n #include <blendShape_vert>\n #include <skinning_vert>\n #include <position_vert>\n\n}\n"; // eslint-disable-line
|
|
24466
|
+
var depthOnlyVs = "#define GLSLIFY 1\n#define MATERIAL_OMIT_NORMAL\n#include <common>\n#include <common_vert>\n#include <blendShape_input>\nuniform mat4 camera_VPMat;\n\nvoid main() {\n\n #include <begin_position_vert>\n #include <blendShape_vert>\n #include <skinning_vert>\n #include <position_vert>\n\n}\n"; // eslint-disable-line
|
|
24446
24467
|
|
|
24447
24468
|
var particleFs = "#define GLSLIFY 1\n#include <common>\n\nvarying vec4 v_Color;\nvarying vec2 v_TextureCoordinate;\nuniform sampler2D material_BaseTexture;\nuniform vec4 material_BaseColor;\n\n#ifdef RENDERER_MODE_MESH\n\tvarying vec4 v_MeshColor;\n#endif\n\nvoid main() {\n\tvec4 color = material_BaseColor * v_Color;\n\n\t#ifdef RENDERER_MODE_MESH\n\t\tcolor *= v_MeshColor;\n\t#endif\n\n\t#ifdef MATERIAL_HAS_BASETEXTURE\n\t\tvec4 textureColor = texture2D(material_BaseTexture,v_TextureCoordinate);\n\t\t#ifndef ENGINE_IS_COLORSPACE_GAMMA\n textureColor = gammaToLinear(textureColor);\n #endif\n\t\tcolor *= textureColor;\n\t#endif\n\tgl_FragColor = color; \n\n\t #ifndef ENGINE_IS_COLORSPACE_GAMMA\n gl_FragColor = linearToGamma(gl_FragColor);\n #endif\n}"; // eslint-disable-line
|
|
24448
24469
|
|
|
@@ -26976,11 +26997,11 @@ PostProcessManager._tempVector3 = new engineMath.Vector3();
|
|
|
26976
26997
|
var oldScene = entity._scene;
|
|
26977
26998
|
if (oldScene !== this) {
|
|
26978
26999
|
if (oldScene && isRoot) {
|
|
26979
|
-
oldScene.
|
|
27000
|
+
Entity._removeFromChildren(oldScene._rootEntities, entity);
|
|
26980
27001
|
}
|
|
26981
|
-
this.
|
|
27002
|
+
Entity._addToChildren(this._rootEntities, entity, index);
|
|
26982
27003
|
} else if (!isRoot) {
|
|
26983
|
-
this.
|
|
27004
|
+
Entity._addToChildren(this._rootEntities, entity, index);
|
|
26984
27005
|
}
|
|
26985
27006
|
// Process entity active/inActive
|
|
26986
27007
|
var inActiveChangeFlag = ActiveChangeFlag.None;
|
|
@@ -27007,7 +27028,7 @@ PostProcessManager._tempVector3 = new engineMath.Vector3();
|
|
|
27007
27028
|
* @param entity - The root entity to remove
|
|
27008
27029
|
*/ _proto.removeRootEntity = function removeRootEntity(entity) {
|
|
27009
27030
|
if (entity._isRoot && entity._scene == this) {
|
|
27010
|
-
this.
|
|
27031
|
+
Entity._removeFromChildren(this._rootEntities, entity);
|
|
27011
27032
|
entity._isRoot = false;
|
|
27012
27033
|
var inActiveChangeFlag = ActiveChangeFlag.None;
|
|
27013
27034
|
this._isActiveInEngine && entity._isActiveInHierarchy && (inActiveChangeFlag |= ActiveChangeFlag.Hierarchy);
|
|
@@ -27106,17 +27127,6 @@ PostProcessManager._tempVector3 = new engineMath.Vector3();
|
|
|
27106
27127
|
};
|
|
27107
27128
|
/**
|
|
27108
27129
|
* @internal
|
|
27109
|
-
*/ _proto._removeFromEntityList = function _removeFromEntityList(entity) {
|
|
27110
|
-
var rootEntities = this._rootEntities;
|
|
27111
|
-
var index = entity._siblingIndex;
|
|
27112
|
-
rootEntities.splice(index, 1);
|
|
27113
|
-
for(var n = rootEntities.length; index < n; index++){
|
|
27114
|
-
rootEntities[index]._siblingIndex--;
|
|
27115
|
-
}
|
|
27116
|
-
entity._siblingIndex = -1;
|
|
27117
|
-
};
|
|
27118
|
-
/**
|
|
27119
|
-
* @internal
|
|
27120
27130
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
27121
27131
|
EngineObject.prototype._onDestroy.call(this);
|
|
27122
27132
|
// Remove from sceneManager
|
|
@@ -27133,23 +27143,6 @@ PostProcessManager._tempVector3 = new engineMath.Vector3();
|
|
|
27133
27143
|
var allCreatedScenes = sceneManager._allCreatedScenes;
|
|
27134
27144
|
allCreatedScenes.splice(allCreatedScenes.indexOf(this), 1);
|
|
27135
27145
|
};
|
|
27136
|
-
_proto._addToRootEntityList = function _addToRootEntityList(index, rootEntity) {
|
|
27137
|
-
var rootEntities = this._rootEntities;
|
|
27138
|
-
var rootEntityCount = rootEntities.length;
|
|
27139
|
-
if (index === undefined) {
|
|
27140
|
-
rootEntity._siblingIndex = rootEntityCount;
|
|
27141
|
-
rootEntities.push(rootEntity);
|
|
27142
|
-
} else {
|
|
27143
|
-
if (index < 0 || index > rootEntityCount) {
|
|
27144
|
-
throw "The index " + index + " is out of child list bounds " + rootEntityCount;
|
|
27145
|
-
}
|
|
27146
|
-
rootEntity._siblingIndex = index;
|
|
27147
|
-
rootEntities.splice(index, 0, rootEntity);
|
|
27148
|
-
for(var i = index + 1, n = rootEntityCount + 1; i < n; i++){
|
|
27149
|
-
rootEntities[i]._siblingIndex++;
|
|
27150
|
-
}
|
|
27151
|
-
}
|
|
27152
|
-
};
|
|
27153
27146
|
_proto._computeLinearFogParams = function _computeLinearFogParams(fogStart, fogEnd) {
|
|
27154
27147
|
var fogRange = fogEnd - fogStart;
|
|
27155
27148
|
var fogParams = this._fogParams;
|
|
@@ -31208,7 +31201,7 @@ function _assert_this_initialized(self) {
|
|
|
31208
31201
|
var _proto = SkyBoxMaterial.prototype;
|
|
31209
31202
|
_proto.clone = function clone() {
|
|
31210
31203
|
var dest = new SkyBoxMaterial(this._engine);
|
|
31211
|
-
this.
|
|
31204
|
+
this._cloneToAndModifyName(dest);
|
|
31212
31205
|
return dest;
|
|
31213
31206
|
};
|
|
31214
31207
|
_create_class(SkyBoxMaterial, [
|
|
@@ -31314,7 +31307,7 @@ SkyBoxMaterial._decodeSkyRGBMMacro = ShaderMacro.getByName("MATERIAL_IS_DECODE_S
|
|
|
31314
31307
|
* @inheritDoc
|
|
31315
31308
|
*/ _proto.clone = function clone() {
|
|
31316
31309
|
var dest = new SkyProceduralMaterial(this._engine);
|
|
31317
|
-
this.
|
|
31310
|
+
this._cloneToAndModifyName(dest);
|
|
31318
31311
|
return dest;
|
|
31319
31312
|
};
|
|
31320
31313
|
_create_class(SkyProceduralMaterial, [
|
|
@@ -32215,6 +32208,13 @@ __decorate([
|
|
|
32215
32208
|
return this.constant;
|
|
32216
32209
|
case ParticleCurveMode.TwoConstants:
|
|
32217
32210
|
return this.constantMin + (this.constantMax - this.constantMin) * lerpFactor;
|
|
32211
|
+
case ParticleCurveMode.Curve:
|
|
32212
|
+
var _this_curve;
|
|
32213
|
+
return (_this_curve = this.curve) == null ? void 0 : _this_curve._evaluate(time);
|
|
32214
|
+
case ParticleCurveMode.TwoCurves:
|
|
32215
|
+
var _this_curveMin, _this_curveMax;
|
|
32216
|
+
var min = (_this_curveMin = this.curveMin) == null ? void 0 : _this_curveMin._evaluate(time);
|
|
32217
|
+
return min + (((_this_curveMax = this.curveMax) == null ? void 0 : _this_curveMax._evaluate(time)) - min) * lerpFactor;
|
|
32218
32218
|
}
|
|
32219
32219
|
};
|
|
32220
32220
|
/**
|
|
@@ -33053,9 +33053,10 @@ __decorate([
|
|
|
33053
33053
|
* Remove a key from the curve.
|
|
33054
33054
|
* @param index - The remove key index
|
|
33055
33055
|
*/ _proto.removeKey = function removeKey(index) {
|
|
33056
|
-
this._keys
|
|
33056
|
+
var keys = this._keys;
|
|
33057
|
+
var removeKey = keys[index];
|
|
33058
|
+
keys.splice(index, 1);
|
|
33057
33059
|
this._typeArrayDirty = true;
|
|
33058
|
-
var removeKey = this._keys[index];
|
|
33059
33060
|
removeKey._unRegisterOnValueChanged(this._updateDispatch);
|
|
33060
33061
|
this._updateDispatch();
|
|
33061
33062
|
};
|
|
@@ -33071,6 +33072,29 @@ __decorate([
|
|
|
33071
33072
|
};
|
|
33072
33073
|
/**
|
|
33073
33074
|
* @internal
|
|
33075
|
+
*/ _proto._evaluate = function _evaluate(normalizedAge) {
|
|
33076
|
+
var keys = this.keys;
|
|
33077
|
+
var length = keys.length;
|
|
33078
|
+
for(var i = 0; i < length; i++){
|
|
33079
|
+
var key = keys[i];
|
|
33080
|
+
var time = key.time;
|
|
33081
|
+
if (normalizedAge <= time) {
|
|
33082
|
+
if (i === 0) {
|
|
33083
|
+
// Small than first key
|
|
33084
|
+
return key.value;
|
|
33085
|
+
} else {
|
|
33086
|
+
// Between two keys
|
|
33087
|
+
var _keys_ = keys[i - 1], lastTime = _keys_.time, lastValue = _keys_.value;
|
|
33088
|
+
var age = (normalizedAge - lastTime) / (time - lastTime);
|
|
33089
|
+
return lastValue + (key.value - lastValue) * age;
|
|
33090
|
+
}
|
|
33091
|
+
}
|
|
33092
|
+
}
|
|
33093
|
+
// Large than last key
|
|
33094
|
+
return keys[length - 1].value;
|
|
33095
|
+
};
|
|
33096
|
+
/**
|
|
33097
|
+
* @internal
|
|
33074
33098
|
*/ _proto._getTypeArray = function _getTypeArray() {
|
|
33075
33099
|
var typeArray = this._typeArray || (this._typeArray = new Float32Array(4 * 2));
|
|
33076
33100
|
if (this._typeArrayDirty) {
|
|
@@ -33682,7 +33706,7 @@ __decorate([
|
|
|
33682
33706
|
};
|
|
33683
33707
|
/**
|
|
33684
33708
|
* @internal
|
|
33685
|
-
*/ _proto._emit = function _emit(
|
|
33709
|
+
*/ _proto._emit = function _emit(playTime, count) {
|
|
33686
33710
|
if (this.emission.enabled) {
|
|
33687
33711
|
// Wait the existing particles to be retired
|
|
33688
33712
|
var notRetireParticleCount = this._getNotRetiredParticleCount();
|
|
@@ -33695,7 +33719,7 @@ __decorate([
|
|
|
33695
33719
|
var shape = this.emission.shape;
|
|
33696
33720
|
for(var i = 0; i < count; i++){
|
|
33697
33721
|
if (shape == null ? void 0 : shape.enabled) {
|
|
33698
|
-
shape._generatePositionAndDirection(this.emission._shapeRand,
|
|
33722
|
+
shape._generatePositionAndDirection(this.emission._shapeRand, playTime, position, direction);
|
|
33699
33723
|
var positionScale = this.main._getPositionScale();
|
|
33700
33724
|
position.multiply(positionScale);
|
|
33701
33725
|
direction.normalize().multiply(positionScale);
|
|
@@ -33703,7 +33727,7 @@ __decorate([
|
|
|
33703
33727
|
position.set(0, 0, 0);
|
|
33704
33728
|
direction.set(0, 0, -1);
|
|
33705
33729
|
}
|
|
33706
|
-
this._addNewParticle(position, direction, transform,
|
|
33730
|
+
this._addNewParticle(position, direction, transform, playTime);
|
|
33707
33731
|
}
|
|
33708
33732
|
}
|
|
33709
33733
|
};
|
|
@@ -34018,7 +34042,7 @@ __decorate([
|
|
|
34018
34042
|
this._transformedBoundsArray[previousFreeElement * ParticleBufferUtils.boundsFloatStride + boundsTimeOffset] = this._playTime;
|
|
34019
34043
|
}
|
|
34020
34044
|
};
|
|
34021
|
-
_proto._addNewParticle = function _addNewParticle(position, direction, transform,
|
|
34045
|
+
_proto._addNewParticle = function _addNewParticle(position, direction, transform, playTime) {
|
|
34022
34046
|
var firstFreeElement = this._firstFreeElement;
|
|
34023
34047
|
var nextFreeElement = firstFreeElement + 1;
|
|
34024
34048
|
if (nextFreeElement >= this._currentParticleCount) {
|
|
@@ -34048,35 +34072,30 @@ __decorate([
|
|
|
34048
34072
|
var instanceVertices = this._instanceVertices;
|
|
34049
34073
|
var offset = firstFreeElement * ParticleBufferUtils.instanceVertexFloatStride;
|
|
34050
34074
|
// Position
|
|
34051
|
-
instanceVertices
|
|
34052
|
-
instanceVertices[offset + 1] = position.y;
|
|
34053
|
-
instanceVertices[offset + 2] = position.z;
|
|
34075
|
+
position.copyToArray(instanceVertices, offset);
|
|
34054
34076
|
// Start life time
|
|
34055
34077
|
instanceVertices[offset + ParticleBufferUtils.startLifeTimeOffset] = main.startLifetime.evaluate(undefined, main._startLifeTimeRand.random());
|
|
34056
34078
|
// Direction
|
|
34057
|
-
instanceVertices
|
|
34058
|
-
instanceVertices[offset + 5] = direction.y;
|
|
34059
|
-
instanceVertices[offset + 6] = direction.z;
|
|
34079
|
+
direction.copyToArray(instanceVertices, offset + 4);
|
|
34060
34080
|
// Time
|
|
34061
|
-
instanceVertices[offset + ParticleBufferUtils.timeOffset] =
|
|
34081
|
+
instanceVertices[offset + ParticleBufferUtils.timeOffset] = playTime;
|
|
34062
34082
|
// Color
|
|
34063
34083
|
var startColor = ParticleGenerator._tempColor0;
|
|
34064
34084
|
main.startColor.evaluate(undefined, main._startColorRand.random(), startColor);
|
|
34065
34085
|
if (this._renderer.engine.settings.colorSpace === ColorSpace.Linear) {
|
|
34066
34086
|
startColor.toLinear(startColor);
|
|
34067
34087
|
}
|
|
34068
|
-
instanceVertices
|
|
34069
|
-
|
|
34070
|
-
|
|
34071
|
-
instanceVertices[offset + 11] = startColor.a;
|
|
34088
|
+
startColor.copyToArray(instanceVertices, offset + 8);
|
|
34089
|
+
var duration = this.main.duration;
|
|
34090
|
+
var normalizedEmitAge = playTime % duration / duration;
|
|
34072
34091
|
// Start size
|
|
34073
34092
|
var startSizeRand = main._startSizeRand;
|
|
34074
34093
|
if (main.startSize3D) {
|
|
34075
|
-
instanceVertices[offset + 12] = main.startSizeX.evaluate(
|
|
34076
|
-
instanceVertices[offset + 13] = main.startSizeY.evaluate(
|
|
34077
|
-
instanceVertices[offset + 14] = main.startSizeZ.evaluate(
|
|
34094
|
+
instanceVertices[offset + 12] = main.startSizeX.evaluate(normalizedEmitAge, startSizeRand.random());
|
|
34095
|
+
instanceVertices[offset + 13] = main.startSizeY.evaluate(normalizedEmitAge, startSizeRand.random());
|
|
34096
|
+
instanceVertices[offset + 14] = main.startSizeZ.evaluate(normalizedEmitAge, startSizeRand.random());
|
|
34078
34097
|
} else {
|
|
34079
|
-
var size = main.startSize.evaluate(
|
|
34098
|
+
var size = main.startSize.evaluate(normalizedEmitAge, startSizeRand.random());
|
|
34080
34099
|
instanceVertices[offset + 12] = size;
|
|
34081
34100
|
instanceVertices[offset + 13] = size;
|
|
34082
34101
|
instanceVertices[offset + 14] = size;
|
|
@@ -34129,14 +34148,9 @@ __decorate([
|
|
|
34129
34148
|
}
|
|
34130
34149
|
if (this.main.simulationSpace === ParticleSimulationSpace.World) {
|
|
34131
34150
|
// Simulation world position
|
|
34132
|
-
instanceVertices
|
|
34133
|
-
instanceVertices[offset + 28] = pos.y;
|
|
34134
|
-
instanceVertices[offset + 29] = pos.z;
|
|
34151
|
+
pos.copyToArray(instanceVertices, offset + 27);
|
|
34135
34152
|
// Simulation world position
|
|
34136
|
-
instanceVertices
|
|
34137
|
-
instanceVertices[offset + 31] = rot.y;
|
|
34138
|
-
instanceVertices[offset + 32] = rot.z;
|
|
34139
|
-
instanceVertices[offset + 33] = rot.w;
|
|
34153
|
+
rot.copyToArray(instanceVertices, offset + 30);
|
|
34140
34154
|
}
|
|
34141
34155
|
// Simulation UV
|
|
34142
34156
|
if (textureSheetAnimation.enabled) {
|
|
@@ -34506,7 +34520,7 @@ __decorate([
|
|
|
34506
34520
|
* @inheritdoc
|
|
34507
34521
|
*/ _proto.clone = function clone() {
|
|
34508
34522
|
var dest = new ParticleMaterial(this._engine);
|
|
34509
|
-
this.
|
|
34523
|
+
this._cloneToAndModifyName(dest);
|
|
34510
34524
|
return dest;
|
|
34511
34525
|
};
|
|
34512
34526
|
_create_class(ParticleMaterial, [
|