@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/module.js
CHANGED
|
@@ -8842,6 +8842,7 @@ BatchUtils._disableBatchTag = ShaderTagKey.getByName("spriteDisableBatching");
|
|
|
8842
8842
|
var blitMaterial = material || basicResources.blitMaterial;
|
|
8843
8843
|
var rhi = engine._hardwareRenderer;
|
|
8844
8844
|
var context = engine._renderContext;
|
|
8845
|
+
var camera = context.camera;
|
|
8845
8846
|
// We not use projection matrix when blit, but we must modify flipProjection to make front face correct
|
|
8846
8847
|
context.flipProjection = !!destination;
|
|
8847
8848
|
rhi.activeRenderTarget(destination, viewport, context.flipProjection, 0);
|
|
@@ -8853,10 +8854,12 @@ BatchUtils._disableBatchTag = ShaderTagKey.getByName("spriteDisableBatching");
|
|
|
8853
8854
|
rendererShaderData.setVector4(Blitter._sourceScaleOffsetProperty, sourceScaleOffset != null ? sourceScaleOffset : Blitter._defaultScaleOffset);
|
|
8854
8855
|
var pass = blitMaterial.shader.subShaders[0].passes[passIndex];
|
|
8855
8856
|
var compileMacros = Shader._compileMacros;
|
|
8856
|
-
ShaderMacroCollection.unionCollection(
|
|
8857
|
+
ShaderMacroCollection.unionCollection(camera._globalShaderMacro, blitMaterial.shaderData._macroCollection, compileMacros);
|
|
8857
8858
|
var program = pass._getShaderProgram(engine, compileMacros);
|
|
8858
8859
|
program.bind();
|
|
8859
8860
|
program.groupingOtherUniformBlock();
|
|
8861
|
+
program.uploadAll(program.sceneUniformBlock, camera.scene.shaderData);
|
|
8862
|
+
program.uploadAll(program.cameraUniformBlock, camera.shaderData);
|
|
8860
8863
|
program.uploadAll(program.rendererUniformBlock, rendererShaderData);
|
|
8861
8864
|
program.uploadAll(program.materialUniformBlock, blitMaterial.shaderData);
|
|
8862
8865
|
program.uploadUnGroupTextures();
|
|
@@ -10348,7 +10351,7 @@ var Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10348
10351
|
};
|
|
10349
10352
|
_proto._createInstanceMaterial = function _createInstanceMaterial(material, index) {
|
|
10350
10353
|
var insMaterial = material.clone();
|
|
10351
|
-
insMaterial.name =
|
|
10354
|
+
insMaterial.name = material.name + "(Instance)";
|
|
10352
10355
|
this._addResourceReferCount(material, -1);
|
|
10353
10356
|
this._addResourceReferCount(insMaterial, 1);
|
|
10354
10357
|
this._materialsInstanced[index] = true;
|
|
@@ -12327,6 +12330,7 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
12327
12330
|
_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.
|
|
12328
12331
|
, _this._shaderData = new ShaderData(ShaderDataGroup.Material);
|
|
12329
12332
|
_this.shader = shader;
|
|
12333
|
+
_this.name = shader.name;
|
|
12330
12334
|
return _this;
|
|
12331
12335
|
}
|
|
12332
12336
|
var _proto = Material.prototype;
|
|
@@ -12334,7 +12338,7 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
12334
12338
|
* Clone and return the instance.
|
|
12335
12339
|
*/ _proto.clone = function clone() {
|
|
12336
12340
|
var dest = new Material(this._engine, this.shader);
|
|
12337
|
-
this.
|
|
12341
|
+
this._cloneToAndModifyName(dest);
|
|
12338
12342
|
return dest;
|
|
12339
12343
|
};
|
|
12340
12344
|
/**
|
|
@@ -12351,6 +12355,10 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
12351
12355
|
this.shaderData._addReferCount(value);
|
|
12352
12356
|
this._shader._addReferCount(value);
|
|
12353
12357
|
};
|
|
12358
|
+
_proto._cloneToAndModifyName = function _cloneToAndModifyName(target) {
|
|
12359
|
+
this.cloneTo(target);
|
|
12360
|
+
target.name = this.name + "(Clone)";
|
|
12361
|
+
};
|
|
12354
12362
|
/**
|
|
12355
12363
|
* @override
|
|
12356
12364
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
@@ -12506,7 +12514,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
12506
12514
|
* Clone and return the instance.
|
|
12507
12515
|
*/ _proto.clone = function clone() {
|
|
12508
12516
|
var dest = new BaseMaterial(this._engine, this.shader);
|
|
12509
|
-
this.
|
|
12517
|
+
this._cloneToAndModifyName(dest);
|
|
12510
12518
|
return dest;
|
|
12511
12519
|
};
|
|
12512
12520
|
/**
|
|
@@ -12688,7 +12696,7 @@ BaseMaterial._alphaCutoffMacro = ShaderMacro.getByName("MATERIAL_IS_ALPHA_CUTOFF
|
|
|
12688
12696
|
var _proto = BlinnPhongMaterial.prototype;
|
|
12689
12697
|
_proto.clone = function clone() {
|
|
12690
12698
|
var dest = new BlinnPhongMaterial(this._engine);
|
|
12691
|
-
this.
|
|
12699
|
+
this._cloneToAndModifyName(dest);
|
|
12692
12700
|
return dest;
|
|
12693
12701
|
};
|
|
12694
12702
|
_create_class(BlinnPhongMaterial, [
|
|
@@ -13148,7 +13156,7 @@ PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("material
|
|
|
13148
13156
|
* @inheritdoc
|
|
13149
13157
|
*/ _proto.clone = function clone() {
|
|
13150
13158
|
var dest = new PBRMaterial(this._engine);
|
|
13151
|
-
this.
|
|
13159
|
+
this._cloneToAndModifyName(dest);
|
|
13152
13160
|
return dest;
|
|
13153
13161
|
};
|
|
13154
13162
|
_proto._onIridescenceRangeChanged = function _onIridescenceRangeChanged() {
|
|
@@ -13614,7 +13622,7 @@ PBRMaterial._thicknessTextureProp = ShaderProperty.getByName("material_Thickness
|
|
|
13614
13622
|
* @inheritdoc
|
|
13615
13623
|
*/ _proto.clone = function clone() {
|
|
13616
13624
|
var dest = new PBRSpecularMaterial(this._engine);
|
|
13617
|
-
this.
|
|
13625
|
+
this._cloneToAndModifyName(dest);
|
|
13618
13626
|
return dest;
|
|
13619
13627
|
};
|
|
13620
13628
|
_create_class(PBRSpecularMaterial, [
|
|
@@ -13687,7 +13695,7 @@ PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("MAT
|
|
|
13687
13695
|
* @inheritdoc
|
|
13688
13696
|
*/ _proto.clone = function clone() {
|
|
13689
13697
|
var dest = new UnlitMaterial(this._engine);
|
|
13690
|
-
this.
|
|
13698
|
+
this._cloneToAndModifyName(dest);
|
|
13691
13699
|
return dest;
|
|
13692
13700
|
};
|
|
13693
13701
|
_create_class(UnlitMaterial, [
|
|
@@ -17347,7 +17355,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17347
17355
|
var _this;
|
|
17348
17356
|
_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----------------------------------------------------------------
|
|
17349
17357
|
_this._invModelMatrix = new Matrix();
|
|
17350
|
-
_this.name = name;
|
|
17358
|
+
_this.name = name != null ? name : "Entity";
|
|
17351
17359
|
for(var i = 0, n = components.length; i < n; i++){
|
|
17352
17360
|
_this.addComponent(components[i]);
|
|
17353
17361
|
}
|
|
@@ -17428,11 +17436,11 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17428
17436
|
child = indexOrChild;
|
|
17429
17437
|
}
|
|
17430
17438
|
if (child._isRoot) {
|
|
17431
|
-
child._scene
|
|
17439
|
+
var oldScene = child._scene;
|
|
17440
|
+
Entity._removeFromChildren(oldScene._rootEntities, child);
|
|
17432
17441
|
child._isRoot = false;
|
|
17433
17442
|
this._addToChildrenList(index, child);
|
|
17434
17443
|
child._parent = this;
|
|
17435
|
-
var oldScene = child._scene;
|
|
17436
17444
|
var newScene = this._scene;
|
|
17437
17445
|
var inActiveChangeFlag = ActiveChangeFlag.None;
|
|
17438
17446
|
if (!this._isActiveInHierarchy) {
|
|
@@ -17637,14 +17645,8 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17637
17645
|
*/ _proto._removeFromParent = function _removeFromParent() {
|
|
17638
17646
|
var oldParent = this._parent;
|
|
17639
17647
|
if (oldParent != null) {
|
|
17640
|
-
|
|
17641
|
-
var index = this._siblingIndex;
|
|
17642
|
-
oldSibling.splice(index, 1);
|
|
17643
|
-
for(var n = oldSibling.length; index < n; index++){
|
|
17644
|
-
oldSibling[index]._siblingIndex--;
|
|
17645
|
-
}
|
|
17648
|
+
Entity._removeFromChildren(oldParent._children, this);
|
|
17646
17649
|
this._parent = null;
|
|
17647
|
-
this._siblingIndex = -1;
|
|
17648
17650
|
this._dispatchModify(EntityModifyFlags.Child, oldParent);
|
|
17649
17651
|
}
|
|
17650
17652
|
};
|
|
@@ -17690,21 +17692,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17690
17692
|
(_this__modifyFlagManager = this._modifyFlagManager) == null ? void 0 : _this__modifyFlagManager.dispatch(flag, param);
|
|
17691
17693
|
};
|
|
17692
17694
|
_proto._addToChildrenList = function _addToChildrenList(index, child) {
|
|
17693
|
-
|
|
17694
|
-
var childCount = children.length;
|
|
17695
|
-
if (index === undefined) {
|
|
17696
|
-
child._siblingIndex = childCount;
|
|
17697
|
-
children.push(child);
|
|
17698
|
-
} else {
|
|
17699
|
-
if (index < 0 || index > childCount) {
|
|
17700
|
-
throw "The index " + index + " is out of child list bounds " + childCount;
|
|
17701
|
-
}
|
|
17702
|
-
child._siblingIndex = index;
|
|
17703
|
-
children.splice(index, 0, child);
|
|
17704
|
-
for(var i = index + 1, n = childCount + 1; i < n; i++){
|
|
17705
|
-
children[i]._siblingIndex++;
|
|
17706
|
-
}
|
|
17707
|
-
}
|
|
17695
|
+
Entity._addToChildren(this._children, child, index);
|
|
17708
17696
|
this._dispatchModify(EntityModifyFlags.Child, this);
|
|
17709
17697
|
};
|
|
17710
17698
|
_proto._setParent = function _setParent(parent, siblingIndex) {
|
|
@@ -17883,6 +17871,39 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17883
17871
|
}
|
|
17884
17872
|
return entity;
|
|
17885
17873
|
};
|
|
17874
|
+
/**
|
|
17875
|
+
* @internal
|
|
17876
|
+
*/ Entity._removeFromChildren = function _removeFromChildren(children, entity) {
|
|
17877
|
+
var count = children.length - 1;
|
|
17878
|
+
for(var i = entity._siblingIndex; i < count; i++){
|
|
17879
|
+
var child = children[i + 1];
|
|
17880
|
+
children[i] = child;
|
|
17881
|
+
child._siblingIndex = i;
|
|
17882
|
+
}
|
|
17883
|
+
children.length = count;
|
|
17884
|
+
entity._siblingIndex = -1;
|
|
17885
|
+
};
|
|
17886
|
+
/**
|
|
17887
|
+
* @internal
|
|
17888
|
+
*/ Entity._addToChildren = function _addToChildren(children, entity, index) {
|
|
17889
|
+
var childCount = children.length;
|
|
17890
|
+
children.length = childCount + 1;
|
|
17891
|
+
if (index === undefined) {
|
|
17892
|
+
children[childCount] = entity;
|
|
17893
|
+
entity._siblingIndex = childCount;
|
|
17894
|
+
} else {
|
|
17895
|
+
if (index < 0 || index > childCount) {
|
|
17896
|
+
throw "The index " + index + " is out of child list bounds " + childCount;
|
|
17897
|
+
}
|
|
17898
|
+
for(var i = childCount; i > index; i--){
|
|
17899
|
+
var swapChild = children[i - 1];
|
|
17900
|
+
swapChild._siblingIndex = i;
|
|
17901
|
+
children[i] = swapChild;
|
|
17902
|
+
}
|
|
17903
|
+
entity._siblingIndex = index;
|
|
17904
|
+
children[index] = entity;
|
|
17905
|
+
}
|
|
17906
|
+
};
|
|
17886
17907
|
_create_class(Entity, [
|
|
17887
17908
|
{
|
|
17888
17909
|
key: "transform",
|
|
@@ -24438,7 +24459,7 @@ var blinnPhongVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>
|
|
|
24438
24459
|
|
|
24439
24460
|
var depthOnlyFs = "#define GLSLIFY 1\nvoid main() {\n}"; // eslint-disable-line
|
|
24440
24461
|
|
|
24441
|
-
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
|
|
24462
|
+
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
|
|
24442
24463
|
|
|
24443
24464
|
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
|
|
24444
24465
|
|
|
@@ -26972,11 +26993,11 @@ PostProcessManager._tempVector3 = new Vector3();
|
|
|
26972
26993
|
var oldScene = entity._scene;
|
|
26973
26994
|
if (oldScene !== this) {
|
|
26974
26995
|
if (oldScene && isRoot) {
|
|
26975
|
-
oldScene.
|
|
26996
|
+
Entity._removeFromChildren(oldScene._rootEntities, entity);
|
|
26976
26997
|
}
|
|
26977
|
-
this.
|
|
26998
|
+
Entity._addToChildren(this._rootEntities, entity, index);
|
|
26978
26999
|
} else if (!isRoot) {
|
|
26979
|
-
this.
|
|
27000
|
+
Entity._addToChildren(this._rootEntities, entity, index);
|
|
26980
27001
|
}
|
|
26981
27002
|
// Process entity active/inActive
|
|
26982
27003
|
var inActiveChangeFlag = ActiveChangeFlag.None;
|
|
@@ -27003,7 +27024,7 @@ PostProcessManager._tempVector3 = new Vector3();
|
|
|
27003
27024
|
* @param entity - The root entity to remove
|
|
27004
27025
|
*/ _proto.removeRootEntity = function removeRootEntity(entity) {
|
|
27005
27026
|
if (entity._isRoot && entity._scene == this) {
|
|
27006
|
-
this.
|
|
27027
|
+
Entity._removeFromChildren(this._rootEntities, entity);
|
|
27007
27028
|
entity._isRoot = false;
|
|
27008
27029
|
var inActiveChangeFlag = ActiveChangeFlag.None;
|
|
27009
27030
|
this._isActiveInEngine && entity._isActiveInHierarchy && (inActiveChangeFlag |= ActiveChangeFlag.Hierarchy);
|
|
@@ -27102,17 +27123,6 @@ PostProcessManager._tempVector3 = new Vector3();
|
|
|
27102
27123
|
};
|
|
27103
27124
|
/**
|
|
27104
27125
|
* @internal
|
|
27105
|
-
*/ _proto._removeFromEntityList = function _removeFromEntityList(entity) {
|
|
27106
|
-
var rootEntities = this._rootEntities;
|
|
27107
|
-
var index = entity._siblingIndex;
|
|
27108
|
-
rootEntities.splice(index, 1);
|
|
27109
|
-
for(var n = rootEntities.length; index < n; index++){
|
|
27110
|
-
rootEntities[index]._siblingIndex--;
|
|
27111
|
-
}
|
|
27112
|
-
entity._siblingIndex = -1;
|
|
27113
|
-
};
|
|
27114
|
-
/**
|
|
27115
|
-
* @internal
|
|
27116
27126
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
27117
27127
|
EngineObject.prototype._onDestroy.call(this);
|
|
27118
27128
|
// Remove from sceneManager
|
|
@@ -27129,23 +27139,6 @@ PostProcessManager._tempVector3 = new Vector3();
|
|
|
27129
27139
|
var allCreatedScenes = sceneManager._allCreatedScenes;
|
|
27130
27140
|
allCreatedScenes.splice(allCreatedScenes.indexOf(this), 1);
|
|
27131
27141
|
};
|
|
27132
|
-
_proto._addToRootEntityList = function _addToRootEntityList(index, rootEntity) {
|
|
27133
|
-
var rootEntities = this._rootEntities;
|
|
27134
|
-
var rootEntityCount = rootEntities.length;
|
|
27135
|
-
if (index === undefined) {
|
|
27136
|
-
rootEntity._siblingIndex = rootEntityCount;
|
|
27137
|
-
rootEntities.push(rootEntity);
|
|
27138
|
-
} else {
|
|
27139
|
-
if (index < 0 || index > rootEntityCount) {
|
|
27140
|
-
throw "The index " + index + " is out of child list bounds " + rootEntityCount;
|
|
27141
|
-
}
|
|
27142
|
-
rootEntity._siblingIndex = index;
|
|
27143
|
-
rootEntities.splice(index, 0, rootEntity);
|
|
27144
|
-
for(var i = index + 1, n = rootEntityCount + 1; i < n; i++){
|
|
27145
|
-
rootEntities[i]._siblingIndex++;
|
|
27146
|
-
}
|
|
27147
|
-
}
|
|
27148
|
-
};
|
|
27149
27142
|
_proto._computeLinearFogParams = function _computeLinearFogParams(fogStart, fogEnd) {
|
|
27150
27143
|
var fogRange = fogEnd - fogStart;
|
|
27151
27144
|
var fogParams = this._fogParams;
|
|
@@ -31204,7 +31197,7 @@ function _assert_this_initialized(self) {
|
|
|
31204
31197
|
var _proto = SkyBoxMaterial.prototype;
|
|
31205
31198
|
_proto.clone = function clone() {
|
|
31206
31199
|
var dest = new SkyBoxMaterial(this._engine);
|
|
31207
|
-
this.
|
|
31200
|
+
this._cloneToAndModifyName(dest);
|
|
31208
31201
|
return dest;
|
|
31209
31202
|
};
|
|
31210
31203
|
_create_class(SkyBoxMaterial, [
|
|
@@ -31310,7 +31303,7 @@ SkyBoxMaterial._decodeSkyRGBMMacro = ShaderMacro.getByName("MATERIAL_IS_DECODE_S
|
|
|
31310
31303
|
* @inheritDoc
|
|
31311
31304
|
*/ _proto.clone = function clone() {
|
|
31312
31305
|
var dest = new SkyProceduralMaterial(this._engine);
|
|
31313
|
-
this.
|
|
31306
|
+
this._cloneToAndModifyName(dest);
|
|
31314
31307
|
return dest;
|
|
31315
31308
|
};
|
|
31316
31309
|
_create_class(SkyProceduralMaterial, [
|
|
@@ -32211,6 +32204,13 @@ __decorate([
|
|
|
32211
32204
|
return this.constant;
|
|
32212
32205
|
case ParticleCurveMode.TwoConstants:
|
|
32213
32206
|
return this.constantMin + (this.constantMax - this.constantMin) * lerpFactor;
|
|
32207
|
+
case ParticleCurveMode.Curve:
|
|
32208
|
+
var _this_curve;
|
|
32209
|
+
return (_this_curve = this.curve) == null ? void 0 : _this_curve._evaluate(time);
|
|
32210
|
+
case ParticleCurveMode.TwoCurves:
|
|
32211
|
+
var _this_curveMin, _this_curveMax;
|
|
32212
|
+
var min = (_this_curveMin = this.curveMin) == null ? void 0 : _this_curveMin._evaluate(time);
|
|
32213
|
+
return min + (((_this_curveMax = this.curveMax) == null ? void 0 : _this_curveMax._evaluate(time)) - min) * lerpFactor;
|
|
32214
32214
|
}
|
|
32215
32215
|
};
|
|
32216
32216
|
/**
|
|
@@ -33049,9 +33049,10 @@ __decorate([
|
|
|
33049
33049
|
* Remove a key from the curve.
|
|
33050
33050
|
* @param index - The remove key index
|
|
33051
33051
|
*/ _proto.removeKey = function removeKey(index) {
|
|
33052
|
-
this._keys
|
|
33052
|
+
var keys = this._keys;
|
|
33053
|
+
var removeKey = keys[index];
|
|
33054
|
+
keys.splice(index, 1);
|
|
33053
33055
|
this._typeArrayDirty = true;
|
|
33054
|
-
var removeKey = this._keys[index];
|
|
33055
33056
|
removeKey._unRegisterOnValueChanged(this._updateDispatch);
|
|
33056
33057
|
this._updateDispatch();
|
|
33057
33058
|
};
|
|
@@ -33067,6 +33068,29 @@ __decorate([
|
|
|
33067
33068
|
};
|
|
33068
33069
|
/**
|
|
33069
33070
|
* @internal
|
|
33071
|
+
*/ _proto._evaluate = function _evaluate(normalizedAge) {
|
|
33072
|
+
var keys = this.keys;
|
|
33073
|
+
var length = keys.length;
|
|
33074
|
+
for(var i = 0; i < length; i++){
|
|
33075
|
+
var key = keys[i];
|
|
33076
|
+
var time = key.time;
|
|
33077
|
+
if (normalizedAge <= time) {
|
|
33078
|
+
if (i === 0) {
|
|
33079
|
+
// Small than first key
|
|
33080
|
+
return key.value;
|
|
33081
|
+
} else {
|
|
33082
|
+
// Between two keys
|
|
33083
|
+
var _keys_ = keys[i - 1], lastTime = _keys_.time, lastValue = _keys_.value;
|
|
33084
|
+
var age = (normalizedAge - lastTime) / (time - lastTime);
|
|
33085
|
+
return lastValue + (key.value - lastValue) * age;
|
|
33086
|
+
}
|
|
33087
|
+
}
|
|
33088
|
+
}
|
|
33089
|
+
// Large than last key
|
|
33090
|
+
return keys[length - 1].value;
|
|
33091
|
+
};
|
|
33092
|
+
/**
|
|
33093
|
+
* @internal
|
|
33070
33094
|
*/ _proto._getTypeArray = function _getTypeArray() {
|
|
33071
33095
|
var typeArray = this._typeArray || (this._typeArray = new Float32Array(4 * 2));
|
|
33072
33096
|
if (this._typeArrayDirty) {
|
|
@@ -33678,7 +33702,7 @@ __decorate([
|
|
|
33678
33702
|
};
|
|
33679
33703
|
/**
|
|
33680
33704
|
* @internal
|
|
33681
|
-
*/ _proto._emit = function _emit(
|
|
33705
|
+
*/ _proto._emit = function _emit(playTime, count) {
|
|
33682
33706
|
if (this.emission.enabled) {
|
|
33683
33707
|
// Wait the existing particles to be retired
|
|
33684
33708
|
var notRetireParticleCount = this._getNotRetiredParticleCount();
|
|
@@ -33691,7 +33715,7 @@ __decorate([
|
|
|
33691
33715
|
var shape = this.emission.shape;
|
|
33692
33716
|
for(var i = 0; i < count; i++){
|
|
33693
33717
|
if (shape == null ? void 0 : shape.enabled) {
|
|
33694
|
-
shape._generatePositionAndDirection(this.emission._shapeRand,
|
|
33718
|
+
shape._generatePositionAndDirection(this.emission._shapeRand, playTime, position, direction);
|
|
33695
33719
|
var positionScale = this.main._getPositionScale();
|
|
33696
33720
|
position.multiply(positionScale);
|
|
33697
33721
|
direction.normalize().multiply(positionScale);
|
|
@@ -33699,7 +33723,7 @@ __decorate([
|
|
|
33699
33723
|
position.set(0, 0, 0);
|
|
33700
33724
|
direction.set(0, 0, -1);
|
|
33701
33725
|
}
|
|
33702
|
-
this._addNewParticle(position, direction, transform,
|
|
33726
|
+
this._addNewParticle(position, direction, transform, playTime);
|
|
33703
33727
|
}
|
|
33704
33728
|
}
|
|
33705
33729
|
};
|
|
@@ -34014,7 +34038,7 @@ __decorate([
|
|
|
34014
34038
|
this._transformedBoundsArray[previousFreeElement * ParticleBufferUtils.boundsFloatStride + boundsTimeOffset] = this._playTime;
|
|
34015
34039
|
}
|
|
34016
34040
|
};
|
|
34017
|
-
_proto._addNewParticle = function _addNewParticle(position, direction, transform,
|
|
34041
|
+
_proto._addNewParticle = function _addNewParticle(position, direction, transform, playTime) {
|
|
34018
34042
|
var firstFreeElement = this._firstFreeElement;
|
|
34019
34043
|
var nextFreeElement = firstFreeElement + 1;
|
|
34020
34044
|
if (nextFreeElement >= this._currentParticleCount) {
|
|
@@ -34044,35 +34068,30 @@ __decorate([
|
|
|
34044
34068
|
var instanceVertices = this._instanceVertices;
|
|
34045
34069
|
var offset = firstFreeElement * ParticleBufferUtils.instanceVertexFloatStride;
|
|
34046
34070
|
// Position
|
|
34047
|
-
instanceVertices
|
|
34048
|
-
instanceVertices[offset + 1] = position.y;
|
|
34049
|
-
instanceVertices[offset + 2] = position.z;
|
|
34071
|
+
position.copyToArray(instanceVertices, offset);
|
|
34050
34072
|
// Start life time
|
|
34051
34073
|
instanceVertices[offset + ParticleBufferUtils.startLifeTimeOffset] = main.startLifetime.evaluate(undefined, main._startLifeTimeRand.random());
|
|
34052
34074
|
// Direction
|
|
34053
|
-
instanceVertices
|
|
34054
|
-
instanceVertices[offset + 5] = direction.y;
|
|
34055
|
-
instanceVertices[offset + 6] = direction.z;
|
|
34075
|
+
direction.copyToArray(instanceVertices, offset + 4);
|
|
34056
34076
|
// Time
|
|
34057
|
-
instanceVertices[offset + ParticleBufferUtils.timeOffset] =
|
|
34077
|
+
instanceVertices[offset + ParticleBufferUtils.timeOffset] = playTime;
|
|
34058
34078
|
// Color
|
|
34059
34079
|
var startColor = ParticleGenerator._tempColor0;
|
|
34060
34080
|
main.startColor.evaluate(undefined, main._startColorRand.random(), startColor);
|
|
34061
34081
|
if (this._renderer.engine.settings.colorSpace === ColorSpace.Linear) {
|
|
34062
34082
|
startColor.toLinear(startColor);
|
|
34063
34083
|
}
|
|
34064
|
-
instanceVertices
|
|
34065
|
-
|
|
34066
|
-
|
|
34067
|
-
instanceVertices[offset + 11] = startColor.a;
|
|
34084
|
+
startColor.copyToArray(instanceVertices, offset + 8);
|
|
34085
|
+
var duration = this.main.duration;
|
|
34086
|
+
var normalizedEmitAge = playTime % duration / duration;
|
|
34068
34087
|
// Start size
|
|
34069
34088
|
var startSizeRand = main._startSizeRand;
|
|
34070
34089
|
if (main.startSize3D) {
|
|
34071
|
-
instanceVertices[offset + 12] = main.startSizeX.evaluate(
|
|
34072
|
-
instanceVertices[offset + 13] = main.startSizeY.evaluate(
|
|
34073
|
-
instanceVertices[offset + 14] = main.startSizeZ.evaluate(
|
|
34090
|
+
instanceVertices[offset + 12] = main.startSizeX.evaluate(normalizedEmitAge, startSizeRand.random());
|
|
34091
|
+
instanceVertices[offset + 13] = main.startSizeY.evaluate(normalizedEmitAge, startSizeRand.random());
|
|
34092
|
+
instanceVertices[offset + 14] = main.startSizeZ.evaluate(normalizedEmitAge, startSizeRand.random());
|
|
34074
34093
|
} else {
|
|
34075
|
-
var size = main.startSize.evaluate(
|
|
34094
|
+
var size = main.startSize.evaluate(normalizedEmitAge, startSizeRand.random());
|
|
34076
34095
|
instanceVertices[offset + 12] = size;
|
|
34077
34096
|
instanceVertices[offset + 13] = size;
|
|
34078
34097
|
instanceVertices[offset + 14] = size;
|
|
@@ -34125,14 +34144,9 @@ __decorate([
|
|
|
34125
34144
|
}
|
|
34126
34145
|
if (this.main.simulationSpace === ParticleSimulationSpace.World) {
|
|
34127
34146
|
// Simulation world position
|
|
34128
|
-
instanceVertices
|
|
34129
|
-
instanceVertices[offset + 28] = pos.y;
|
|
34130
|
-
instanceVertices[offset + 29] = pos.z;
|
|
34147
|
+
pos.copyToArray(instanceVertices, offset + 27);
|
|
34131
34148
|
// Simulation world position
|
|
34132
|
-
instanceVertices
|
|
34133
|
-
instanceVertices[offset + 31] = rot.y;
|
|
34134
|
-
instanceVertices[offset + 32] = rot.z;
|
|
34135
|
-
instanceVertices[offset + 33] = rot.w;
|
|
34149
|
+
rot.copyToArray(instanceVertices, offset + 30);
|
|
34136
34150
|
}
|
|
34137
34151
|
// Simulation UV
|
|
34138
34152
|
if (textureSheetAnimation.enabled) {
|
|
@@ -34502,7 +34516,7 @@ __decorate([
|
|
|
34502
34516
|
* @inheritdoc
|
|
34503
34517
|
*/ _proto.clone = function clone() {
|
|
34504
34518
|
var dest = new ParticleMaterial(this._engine);
|
|
34505
|
-
this.
|
|
34519
|
+
this._cloneToAndModifyName(dest);
|
|
34506
34520
|
return dest;
|
|
34507
34521
|
};
|
|
34508
34522
|
_create_class(ParticleMaterial, [
|