@galacean/engine-core 1.3.10 → 1.3.12
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 +64 -19
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +64 -19
- package/dist/module.js +64 -20
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/index.d.ts +1 -0
- package/types/utils/DisorderedArray.d.ts +70 -0
- package/types/DisorderedArray.d.ts +0 -27
package/dist/miniprogram.js
CHANGED
|
@@ -2245,7 +2245,7 @@ var ShadowLib = {
|
|
|
2245
2245
|
|
|
2246
2246
|
var particle_common = "#define GLSLIFY 1\nvec3 rotationByEuler(in vec3 vector,in vec3 rot){float halfRoll=rot.z*0.5;float halfPitch=rot.x*0.5;float halfYaw=rot.y*0.5;float sinRoll=sin(halfRoll);float cosRoll=cos(halfRoll);float sinPitch=sin(halfPitch);float cosPitch=cos(halfPitch);float sinYaw=sin(halfYaw);float cosYaw=cos(halfYaw);float quaX=(cosYaw*sinPitch*cosRoll)+(sinYaw*cosPitch*sinRoll);float quaY=(sinYaw*cosPitch*cosRoll)-(cosYaw*sinPitch*sinRoll);float quaZ=(cosYaw*cosPitch*sinRoll)-(sinYaw*sinPitch*cosRoll);float quaW=(cosYaw*cosPitch*cosRoll)+(sinYaw*sinPitch*sinRoll);float x=quaX+quaX;float y=quaY+quaY;float z=quaZ+quaZ;float wx=quaW*x;float wy=quaW*y;float wz=quaW*z;float xx=quaX*x;float xy=quaX*y;float xz=quaX*z;float yy=quaY*y;float yz=quaY*z;float zz=quaZ*z;return vec3(((vector.x*((1.0-yy)-zz))+(vector.y*(xy-wz)))+(vector.z*(xz+wy)),((vector.x*(xy+wz))+(vector.y*((1.0-xx)-zz)))+(vector.z*(yz-wx)),((vector.x*(xz-wy))+(vector.y*(yz+wx)))+(vector.z*((1.0-xx)-yy)));}vec3 rotationByAxis(in vec3 vector,in vec3 axis,in float angle){float halfAngle=angle*0.5;float sin=sin(halfAngle);float quaX=axis.x*sin;float quaY=axis.y*sin;float quaZ=axis.z*sin;float quaW=cos(halfAngle);float x=quaX+quaX;float y=quaY+quaY;float z=quaZ+quaZ;float wx=quaW*x;float wy=quaW*y;float wz=quaW*z;float xx=quaX*x;float xy=quaX*y;float xz=quaX*z;float yy=quaY*y;float yz=quaY*z;float zz=quaZ*z;return vec3(((vector.x*((1.0-yy)-zz))+(vector.y*(xy-wz)))+(vector.z*(xz+wy)),((vector.x*(xy+wz))+(vector.y*((1.0-xx)-zz)))+(vector.z*(yz-wx)),((vector.x*(xz-wy))+(vector.y*(yz+wx)))+(vector.z*((1.0-xx)-yy)));}vec3 rotationByQuaternions(in vec3 v,in vec4 q){return v+2.0*cross(q.xyz,cross(q.xyz,v)+q.w*v);}float evaluateParticleCurve(in vec2 keys[4],in float normalizedAge){float value;for(int i=1;i<4;i++){vec2 key=keys[i];float time=key.x;if(time>=normalizedAge){vec2 lastKey=keys[i-1];float lastTime=lastKey.x;float age=(normalizedAge-lastTime)/(time-lastTime);value=mix(lastKey.y,key.y,age);break;}}return value;}float evaluateParticleCurveCumulative(in vec2 keys[4],in float normalizedAge){float cumulativeValue=0.0;for(int i=1;i<4;i++){vec2 key=keys[i];float time=key.x;vec2 lastKey=keys[i-1];float lastValue=lastKey.y;if(time>=normalizedAge){float lastTime=lastKey.x;float offsetTime=normalizedAge-lastTime;float age=offsetTime/(time-lastTime);cumulativeValue+=(lastValue+mix(lastValue,key.y,age))*0.5*offsetTime;break;}else{cumulativeValue+=(lastValue+key.y)*0.5*(time-lastKey.x);}}return cumulativeValue;}"; // eslint-disable-line
|
|
2247
2247
|
|
|
2248
|
-
var velocity_over_lifetime_module = "#define GLSLIFY 1\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\nuniform int renderer_VOLSpace;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_RANDOM_CONSTANT)\nuniform vec3 renderer_VOLMaxConst;\n#ifdef RENDERER_VOL_RANDOM_CONSTANT\nuniform vec3 renderer_VOLMinConst;\n#endif\n#endif\n#if defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CURVE)\nuniform vec2 renderer_VOLMaxGradientX[4];uniform vec2 renderer_VOLMaxGradientY[4];uniform vec2 renderer_VOLMaxGradientZ[4];\n#ifdef RENDERER_VOL_RANDOM_CURVE\nuniform vec2 renderer_VOLMinGradientX[4];uniform vec2 renderer_VOLMinGradientY[4];uniform vec2 renderer_VOLMinGradientZ[4];\n#endif\n#endif\n#endif\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\nvec3 computeParticleLifeVelocity(in float normalizedAge){vec3 velocity;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_RANDOM_CONSTANT)\nvelocity=renderer_VOLMaxConst;\n#ifdef RENDERER_VOL_RANDOM_CONSTANT\nvelocity=mix(renderer_VOLMinConst,velocity,vec3(a_Random1.y,a_Random1.z,a_Random1.w));\n#endif\n#endif\n#if defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CURVE)\nvelocity=vec3(evaluateParticleCurve(renderer_VOLMaxGradientX,normalizedAge),evaluateParticleCurve(renderer_VOLMaxGradientY,normalizedAge),evaluateParticleCurve(renderer_VOLMaxGradientZ,normalizedAge));\n#endif\n#ifdef RENDERER_VOL_RANDOM_CURVE\nvelocity=vec3(mix(velocity.x,evaluateParticleCurve(renderer_VOLMinGradientX,normalizedAge),a_Random1.y),mix(velocity.y,evaluateParticleCurve(renderer_VOLMinGradientY,normalizedAge),a_Random1.z),mix(velocity.z,evaluateParticleCurve(renderer_VOLMinGradientZ,normalizedAge),a_Random1.w));\n#endif\nreturn velocity;}\n#endif\nvec3 getStartPosition(vec3 startVelocity,float age,vec3 dragData){vec3 startPosition;float lastTime=min(startVelocity.x/dragData.x,age);startPosition=lastTime*(startVelocity-0.5*dragData*lastTime);return startPosition;}vec3 computeParticlePosition(in vec3 startVelocity,in vec3 lifeVelocity,in float age,in float normalizedAge,vec3 gravityVelocity,vec4 worldRotation,vec3 dragData){vec3 startPosition=getStartPosition(startVelocity,age,dragData);vec3 lifePosition;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\n#if defined(RENDERER_VOL_CONSTANT)|| defined(RENDERER_VOL_RANDOM_CONSTANT)\nlifePosition=lifeVelocity*age;\n#endif\n#if defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CURVE)\nlifePosition=vec3(evaluateParticleCurveCumulative(renderer_VOLMaxGradientX,normalizedAge)evaluateParticleCurveCumulative(renderer_VOLMaxGradientY,normalizedAge),evaluateParticleCurveCumulative(renderer_VOLMaxGradientZ,normalizedAge));\n#ifdef RENDERER_VOL_RANDOM_CURVE\nlifePosition=vec3(mix(evaluateParticleCurveCumulative(renderer_VOLMinGradientX,normalizedAge),lifePosition.x,a_Random1.y),mix(evaluateParticleCurveCumulative(renderer_VOLMinGradientY,normalizedAge),lifePosition.y,a_Random1.z),mix(evaluateParticleCurveCumulative(renderer_VOLMinGradientZ,normalizedAge),lifePosition.z,a_Random1.w));\n#endif\nlifePosition*=vec3(a_ShapePositionStartLifeTime.w);\n#endif\nvec3 finalPosition;if(renderer_VOLSpace==0){finalPosition=rotationByQuaternions(a_ShapePositionStartLifeTime.xyz+startPosition+lifePosition,worldRotation);}else{finalPosition=rotationByQuaternions(a_ShapePositionStartLifeTime.xyz+startPosition,worldRotation)+lifePosition;}\n#else\nvec3 finalPosition=rotationByQuaternions(a_ShapePositionStartLifeTime.xyz+startPosition,worldRotation);\n#endif\nif(renderer_SimulationSpace==0){finalPosition=finalPosition+renderer_WorldPosition;}else if(renderer_SimulationSpace==1){finalPosition=finalPosition+a_SimulationWorldPosition;}finalPosition+=0.5*gravityVelocity*age;return finalPosition;}"; // eslint-disable-line
|
|
2248
|
+
var velocity_over_lifetime_module = "#define GLSLIFY 1\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\nuniform int renderer_VOLSpace;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_RANDOM_CONSTANT)\nuniform vec3 renderer_VOLMaxConst;\n#ifdef RENDERER_VOL_RANDOM_CONSTANT\nuniform vec3 renderer_VOLMinConst;\n#endif\n#endif\n#if defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CURVE)\nuniform vec2 renderer_VOLMaxGradientX[4];uniform vec2 renderer_VOLMaxGradientY[4];uniform vec2 renderer_VOLMaxGradientZ[4];\n#ifdef RENDERER_VOL_RANDOM_CURVE\nuniform vec2 renderer_VOLMinGradientX[4];uniform vec2 renderer_VOLMinGradientY[4];uniform vec2 renderer_VOLMinGradientZ[4];\n#endif\n#endif\n#endif\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\nvec3 computeParticleLifeVelocity(in float normalizedAge){vec3 velocity;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_RANDOM_CONSTANT)\nvelocity=renderer_VOLMaxConst;\n#ifdef RENDERER_VOL_RANDOM_CONSTANT\nvelocity=mix(renderer_VOLMinConst,velocity,vec3(a_Random1.y,a_Random1.z,a_Random1.w));\n#endif\n#endif\n#if defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CURVE)\nvelocity=vec3(evaluateParticleCurve(renderer_VOLMaxGradientX,normalizedAge),evaluateParticleCurve(renderer_VOLMaxGradientY,normalizedAge),evaluateParticleCurve(renderer_VOLMaxGradientZ,normalizedAge));\n#endif\n#ifdef RENDERER_VOL_RANDOM_CURVE\nvelocity=vec3(mix(velocity.x,evaluateParticleCurve(renderer_VOLMinGradientX,normalizedAge),a_Random1.y),mix(velocity.y,evaluateParticleCurve(renderer_VOLMinGradientY,normalizedAge),a_Random1.z),mix(velocity.z,evaluateParticleCurve(renderer_VOLMinGradientZ,normalizedAge),a_Random1.w));\n#endif\nreturn velocity;}\n#endif\nvec3 getStartPosition(vec3 startVelocity,float age,vec3 dragData){vec3 startPosition;float lastTime=min(startVelocity.x/dragData.x,age);startPosition=lastTime*(startVelocity-0.5*dragData*lastTime);return startPosition;}vec3 computeParticlePosition(in vec3 startVelocity,in vec3 lifeVelocity,in float age,in float normalizedAge,vec3 gravityVelocity,vec4 worldRotation,vec3 dragData){vec3 startPosition=getStartPosition(startVelocity,age,dragData);vec3 lifePosition;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\n#if defined(RENDERER_VOL_CONSTANT)|| defined(RENDERER_VOL_RANDOM_CONSTANT)\nlifePosition=lifeVelocity*age;\n#endif\n#if defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CURVE)\nlifePosition=vec3(evaluateParticleCurveCumulative(renderer_VOLMaxGradientX,normalizedAge),evaluateParticleCurveCumulative(renderer_VOLMaxGradientY,normalizedAge),evaluateParticleCurveCumulative(renderer_VOLMaxGradientZ,normalizedAge));\n#ifdef RENDERER_VOL_RANDOM_CURVE\nlifePosition=vec3(mix(evaluateParticleCurveCumulative(renderer_VOLMinGradientX,normalizedAge),lifePosition.x,a_Random1.y),mix(evaluateParticleCurveCumulative(renderer_VOLMinGradientY,normalizedAge),lifePosition.y,a_Random1.z),mix(evaluateParticleCurveCumulative(renderer_VOLMinGradientZ,normalizedAge),lifePosition.z,a_Random1.w));\n#endif\nlifePosition*=vec3(a_ShapePositionStartLifeTime.w);\n#endif\nvec3 finalPosition;if(renderer_VOLSpace==0){finalPosition=rotationByQuaternions(a_ShapePositionStartLifeTime.xyz+startPosition+lifePosition,worldRotation);}else{finalPosition=rotationByQuaternions(a_ShapePositionStartLifeTime.xyz+startPosition,worldRotation)+lifePosition;}\n#else\nvec3 finalPosition=rotationByQuaternions(a_ShapePositionStartLifeTime.xyz+startPosition,worldRotation);\n#endif\nif(renderer_SimulationSpace==0){finalPosition=finalPosition+renderer_WorldPosition;}else if(renderer_SimulationSpace==1){finalPosition=finalPosition+a_SimulationWorldPosition;}finalPosition+=0.5*gravityVelocity*age;return finalPosition;}"; // eslint-disable-line
|
|
2249
2249
|
|
|
2250
2250
|
var rotation_over_lifetime_module = "#define GLSLIFY 1\n#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n#ifdef RENDERER_ROL_CURVE_MODE\nuniform vec2 renderer_ROLMaxCurveZ[4];\n#ifdef RENDERER_ROL_IS_RANDOM_TWO\nuniform vec2 renderer_ROLMinCurveZ[4];\n#endif\n#else\nuniform vec3 renderer_ROLMaxConst;\n#ifdef RENDERER_ROL_IS_RANDOM_TWO\nuniform vec3 renderer_ROLMinConst;\n#endif\n#endif\n#endif\nfloat computeParticleRotationFloat(in float rotation,in float age,in float normalizedAge){\n#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n#ifdef RENDERER_ROL_CURVE_MODE\nfloat lifeRotation=evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ,normalizedAge);\n#ifdef RENDERER_ROL_IS_RANDOM_TWO\nlifeRotation=mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ,normalizedAge),lifeRotation,a_Random0.w);\n#endif\nrotation+=lifeRotation*a_ShapePositionStartLifeTime.w;\n#else\nfloat lifeRotation=renderer_ROLMaxConst.z;\n#ifdef RENDERER_ROL_IS_RANDOM_TWO\nlifeRotation=mix(renderer_ROLMinConst.z,lifeRotation,a_Random0.w);\n#endif\nrotation+=lifeRotation*age;\n#endif\n#endif\nreturn rotation;}\n#if defined(RENDERER_MODE_MESH) && (defined(ROTATION_OVER_LIFETIME) || defined(ROTATION_OVER_LIFETIME_SEPARATE))\nvec3 computeParticleRotationVec3(in vec3 rotation,in float age,in float normalizedAge){\n#ifdef ROTATION_OVER_LIFETIME\n#ifdef ROTATION_OVER_LIFETIME_CONSTANT\nfloat ageRot=u_ROLAngularVelocityConst*age;rotation+=ageRot;\n#endif\n#ifdef ROTATION_OVER_LIFETIME_CURVE\nrotation+=getTotalValueFromGradientFloat(u_ROLAngularVelocityGradient,normalizedAge);\n#endif\n#ifdef ROTATION_OVER_LIFETIME_RANDOM_CONSTANTS\nfloat ageRot=mix(u_ROLAngularVelocityConst,u_ROLAngularVelocityConstMax,a_Random0.w)*age;rotation+=ageRot;\n#endif\n#ifdef ROTATION_OVER_LIFETIME_RANDOM_CURVES\nrotation+=mix(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradient,normalizedAge),getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientMax,normalizedAge),a_Random0.w);\n#endif\n#endif\n#ifdef ROTATION_OVER_LIFETIME_SEPARATE\n#ifdef ROTATION_OVER_LIFETIME_CONSTANT\nvec3 ageRot=u_ROLAngularVelocityConstSeparate*age;rotation+=ageRot;\n#endif\n#ifdef ROTATION_OVER_LIFETIME_CURVE\nrotation+=vec3(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientX,normalizedAge),getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientY,normalizedAge),getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientZ,normalizedAge));\n#endif\n#ifdef ROTATION_OVER_LIFETIME_RANDOM_CONSTANTS\nvec3 ageRot=mix(u_ROLAngularVelocityConstSeparate,renderer_ROLMaxConst,a_Random0.w)*age;rotation+=ageRot;\n#endif\n#ifdef ROTATION_OVER_LIFETIME_RANDOM_CURVES\nrotation+=vec3(mix(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientX,normalizedAge),getTotalValueFromGradientFloat(renderer_ROLMaxCurveX,normalizedAge),a_Random0.w),mix(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientY,normalizedAge),getTotalValueFromGradientFloat(renderer_ROLMaxCurveY,normalizedAge),a_Random0.w),mix(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientZ,normalizedAge),getTotalValueFromGradientFloat(renderer_ROLMaxCurveZ,normalizedAge),a_Random0.w));\n#endif\n#endif\nreturn rotation;}\n#endif\n"; // eslint-disable-line
|
|
2251
2251
|
|
|
@@ -6612,13 +6612,17 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6612
6612
|
*/ var DisorderedArray = /*#__PURE__*/ function() {
|
|
6613
6613
|
function DisorderedArray(count) {
|
|
6614
6614
|
if (count === void 0) count = 0;
|
|
6615
|
-
this.length = 0;
|
|
6616
|
-
this.
|
|
6615
|
+
/** The length of the array. */ this.length = 0;
|
|
6616
|
+
this._loopCounter = 0 // Ignore nested loops, use counter to solve the problem
|
|
6617
|
+
;
|
|
6617
6618
|
this._blankCount = 0;
|
|
6618
6619
|
this._elements = new Array(count);
|
|
6619
6620
|
}
|
|
6620
6621
|
var _proto = DisorderedArray.prototype;
|
|
6621
|
-
|
|
6622
|
+
/**
|
|
6623
|
+
* Add an element to disordered array.
|
|
6624
|
+
* @param element - The element to be added
|
|
6625
|
+
*/ _proto.add = function add(element) {
|
|
6622
6626
|
if (this.length === this._elements.length) {
|
|
6623
6627
|
this._elements.push(element);
|
|
6624
6628
|
} else {
|
|
@@ -6626,18 +6630,29 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6626
6630
|
}
|
|
6627
6631
|
this.length++;
|
|
6628
6632
|
};
|
|
6629
|
-
|
|
6633
|
+
/**
|
|
6634
|
+
* Delete the specified element.
|
|
6635
|
+
* @param element - The element to be deleted
|
|
6636
|
+
*/ _proto.delete = function _delete(element) {
|
|
6630
6637
|
// @todo: It can be optimized for custom binary search and other algorithms, currently this._elements>=this.length wastes performance.
|
|
6631
6638
|
var index = this._elements.indexOf(element);
|
|
6632
6639
|
this.deleteByIndex(index);
|
|
6633
6640
|
};
|
|
6634
|
-
|
|
6641
|
+
/**
|
|
6642
|
+
* Set the element at the specified index.
|
|
6643
|
+
* @param index - The index of the element to be set
|
|
6644
|
+
* @param element - The element to be set
|
|
6645
|
+
*/ _proto.set = function set(index, element) {
|
|
6635
6646
|
if (index >= this.length) {
|
|
6636
6647
|
throw "Index is out of range.";
|
|
6637
6648
|
}
|
|
6638
6649
|
this._elements[index] = element;
|
|
6639
6650
|
};
|
|
6640
|
-
|
|
6651
|
+
/**
|
|
6652
|
+
* Get the element at the specified index.
|
|
6653
|
+
* @param index - The index of the element to be get
|
|
6654
|
+
* @returns The element at the specified index
|
|
6655
|
+
*/ _proto.get = function get(index) {
|
|
6641
6656
|
if (index >= this.length) {
|
|
6642
6657
|
throw "Index is out of range.";
|
|
6643
6658
|
}
|
|
@@ -6650,7 +6665,7 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6650
6665
|
*/ _proto.deleteByIndex = function deleteByIndex(index) {
|
|
6651
6666
|
var elements = this._elements;
|
|
6652
6667
|
var end;
|
|
6653
|
-
if (this.
|
|
6668
|
+
if (this._loopCounter > 0) {
|
|
6654
6669
|
this._elements[index] = null;
|
|
6655
6670
|
this._blankCount++;
|
|
6656
6671
|
} else {
|
|
@@ -6664,41 +6679,57 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6664
6679
|
}
|
|
6665
6680
|
return end;
|
|
6666
6681
|
};
|
|
6667
|
-
|
|
6682
|
+
/**
|
|
6683
|
+
* Loop through all elements.
|
|
6684
|
+
* @param callbackFn - The callback function
|
|
6685
|
+
* @param swapFn - The swap function can process the element after the callback function, it will be called after end looping(`isLopping` = true)
|
|
6686
|
+
*/ _proto.forEach = function forEach(callbackFn, swapFn) {
|
|
6668
6687
|
this._startLoop();
|
|
6669
6688
|
var elements = this._elements;
|
|
6670
6689
|
for(var i = 0, n = this.length; i < n; i++){
|
|
6671
6690
|
var element = elements[i];
|
|
6672
|
-
element && callbackFn(element);
|
|
6691
|
+
element && callbackFn(element, i);
|
|
6673
6692
|
}
|
|
6674
6693
|
this._endLoop(swapFn);
|
|
6675
6694
|
};
|
|
6676
|
-
|
|
6695
|
+
/**
|
|
6696
|
+
* Loop through all elements and clean up the blank elements.
|
|
6697
|
+
* @param callbackFn - The callback function
|
|
6698
|
+
* @param swapFn - The swap function can process the element after the callback function, it will be called after end looping(`isLopping` = true)
|
|
6699
|
+
*/ _proto.forEachAndClean = function forEachAndClean(callbackFn, swapFn) {
|
|
6677
6700
|
this._startLoop();
|
|
6678
6701
|
var preEnd = this.length;
|
|
6679
6702
|
var elements = this._elements;
|
|
6680
6703
|
for(var i = 0, n = preEnd; i < n; i++){
|
|
6681
6704
|
var element = elements[i];
|
|
6682
|
-
element && callbackFn(element);
|
|
6705
|
+
element && callbackFn(element, i);
|
|
6683
6706
|
}
|
|
6684
6707
|
this._endLoopAndClean(preEnd, elements, swapFn);
|
|
6685
6708
|
};
|
|
6686
|
-
|
|
6709
|
+
/**
|
|
6710
|
+
* Sort the array.
|
|
6711
|
+
* @param compareFn - The comparison function
|
|
6712
|
+
*/ _proto.sort = function sort(compareFn) {
|
|
6687
6713
|
Utils._quickSort(this._elements, 0, this.length, compareFn);
|
|
6688
6714
|
};
|
|
6689
|
-
|
|
6715
|
+
/**
|
|
6716
|
+
* Garbage collection, clean up all cached elements.
|
|
6717
|
+
*/ _proto.garbageCollection = function garbageCollection() {
|
|
6690
6718
|
this._elements.length = this.length;
|
|
6691
6719
|
};
|
|
6692
6720
|
_proto._startLoop = function _startLoop() {
|
|
6693
|
-
this.
|
|
6721
|
+
++this._loopCounter;
|
|
6694
6722
|
};
|
|
6695
6723
|
_proto._endLoop = function _endLoop(swapFn) {
|
|
6696
|
-
this.
|
|
6724
|
+
if (--this._loopCounter !== 0) {
|
|
6725
|
+
return;
|
|
6726
|
+
}
|
|
6697
6727
|
if (this._blankCount) {
|
|
6698
6728
|
var from = 0;
|
|
6699
6729
|
var to = this.length - 1;
|
|
6700
6730
|
var elements = this._elements;
|
|
6701
6731
|
partition: do {
|
|
6732
|
+
var _swapFn;
|
|
6702
6733
|
while(elements[from])if (++from >= to) {
|
|
6703
6734
|
break partition;
|
|
6704
6735
|
}
|
|
@@ -6706,7 +6737,7 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6706
6737
|
break partition;
|
|
6707
6738
|
}
|
|
6708
6739
|
var swapElement = elements[to];
|
|
6709
|
-
swapFn(swapElement, from);
|
|
6740
|
+
(_swapFn = swapFn) == null ? void 0 : _swapFn(swapElement, from);
|
|
6710
6741
|
elements[from++] = swapElement;
|
|
6711
6742
|
elements[to--] = null;
|
|
6712
6743
|
}while (from < to);
|
|
@@ -6715,18 +6746,31 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6715
6746
|
}
|
|
6716
6747
|
};
|
|
6717
6748
|
_proto._endLoopAndClean = function _endLoopAndClean(preEnd, elements, swapFn) {
|
|
6749
|
+
if (--this._loopCounter !== 0) {
|
|
6750
|
+
return;
|
|
6751
|
+
}
|
|
6718
6752
|
var index = 0;
|
|
6719
6753
|
for(var i = preEnd, n = this.length; i < n; i++){
|
|
6754
|
+
var _swapFn;
|
|
6720
6755
|
var element = elements[i];
|
|
6721
6756
|
if (!element) continue;
|
|
6722
6757
|
elements[index] = element;
|
|
6723
|
-
swapFn(element, index);
|
|
6758
|
+
(_swapFn = swapFn) == null ? void 0 : _swapFn(element, index);
|
|
6724
6759
|
index++;
|
|
6725
6760
|
}
|
|
6726
|
-
this._isLooping = false;
|
|
6727
6761
|
this.length = index;
|
|
6728
6762
|
this._blankCount = 0;
|
|
6729
6763
|
};
|
|
6764
|
+
_create_class(DisorderedArray, [
|
|
6765
|
+
{
|
|
6766
|
+
key: "isLopping",
|
|
6767
|
+
get: /**
|
|
6768
|
+
* Get whether the array is in the loop.
|
|
6769
|
+
*/ function get() {
|
|
6770
|
+
return this._loopCounter > 0;
|
|
6771
|
+
}
|
|
6772
|
+
}
|
|
6773
|
+
]);
|
|
6730
6774
|
return DisorderedArray;
|
|
6731
6775
|
}();
|
|
6732
6776
|
|
|
@@ -34465,6 +34509,7 @@ exports.CubeProbe = CubeProbe;
|
|
|
34465
34509
|
exports.CurveKey = CurveKey;
|
|
34466
34510
|
exports.DepthState = DepthState;
|
|
34467
34511
|
exports.DirectLight = DirectLight;
|
|
34512
|
+
exports.DisorderedArray = DisorderedArray;
|
|
34468
34513
|
exports.DynamicCollider = DynamicCollider;
|
|
34469
34514
|
exports.EmissionModule = EmissionModule;
|
|
34470
34515
|
exports.Engine = Engine;
|
package/dist/module.js
CHANGED
|
@@ -2240,7 +2240,7 @@ var ShadowLib = {
|
|
|
2240
2240
|
|
|
2241
2241
|
var particle_common = "#define GLSLIFY 1\nvec3 rotationByEuler(in vec3 vector,in vec3 rot){float halfRoll=rot.z*0.5;float halfPitch=rot.x*0.5;float halfYaw=rot.y*0.5;float sinRoll=sin(halfRoll);float cosRoll=cos(halfRoll);float sinPitch=sin(halfPitch);float cosPitch=cos(halfPitch);float sinYaw=sin(halfYaw);float cosYaw=cos(halfYaw);float quaX=(cosYaw*sinPitch*cosRoll)+(sinYaw*cosPitch*sinRoll);float quaY=(sinYaw*cosPitch*cosRoll)-(cosYaw*sinPitch*sinRoll);float quaZ=(cosYaw*cosPitch*sinRoll)-(sinYaw*sinPitch*cosRoll);float quaW=(cosYaw*cosPitch*cosRoll)+(sinYaw*sinPitch*sinRoll);float x=quaX+quaX;float y=quaY+quaY;float z=quaZ+quaZ;float wx=quaW*x;float wy=quaW*y;float wz=quaW*z;float xx=quaX*x;float xy=quaX*y;float xz=quaX*z;float yy=quaY*y;float yz=quaY*z;float zz=quaZ*z;return vec3(((vector.x*((1.0-yy)-zz))+(vector.y*(xy-wz)))+(vector.z*(xz+wy)),((vector.x*(xy+wz))+(vector.y*((1.0-xx)-zz)))+(vector.z*(yz-wx)),((vector.x*(xz-wy))+(vector.y*(yz+wx)))+(vector.z*((1.0-xx)-yy)));}vec3 rotationByAxis(in vec3 vector,in vec3 axis,in float angle){float halfAngle=angle*0.5;float sin=sin(halfAngle);float quaX=axis.x*sin;float quaY=axis.y*sin;float quaZ=axis.z*sin;float quaW=cos(halfAngle);float x=quaX+quaX;float y=quaY+quaY;float z=quaZ+quaZ;float wx=quaW*x;float wy=quaW*y;float wz=quaW*z;float xx=quaX*x;float xy=quaX*y;float xz=quaX*z;float yy=quaY*y;float yz=quaY*z;float zz=quaZ*z;return vec3(((vector.x*((1.0-yy)-zz))+(vector.y*(xy-wz)))+(vector.z*(xz+wy)),((vector.x*(xy+wz))+(vector.y*((1.0-xx)-zz)))+(vector.z*(yz-wx)),((vector.x*(xz-wy))+(vector.y*(yz+wx)))+(vector.z*((1.0-xx)-yy)));}vec3 rotationByQuaternions(in vec3 v,in vec4 q){return v+2.0*cross(q.xyz,cross(q.xyz,v)+q.w*v);}float evaluateParticleCurve(in vec2 keys[4],in float normalizedAge){float value;for(int i=1;i<4;i++){vec2 key=keys[i];float time=key.x;if(time>=normalizedAge){vec2 lastKey=keys[i-1];float lastTime=lastKey.x;float age=(normalizedAge-lastTime)/(time-lastTime);value=mix(lastKey.y,key.y,age);break;}}return value;}float evaluateParticleCurveCumulative(in vec2 keys[4],in float normalizedAge){float cumulativeValue=0.0;for(int i=1;i<4;i++){vec2 key=keys[i];float time=key.x;vec2 lastKey=keys[i-1];float lastValue=lastKey.y;if(time>=normalizedAge){float lastTime=lastKey.x;float offsetTime=normalizedAge-lastTime;float age=offsetTime/(time-lastTime);cumulativeValue+=(lastValue+mix(lastValue,key.y,age))*0.5*offsetTime;break;}else{cumulativeValue+=(lastValue+key.y)*0.5*(time-lastKey.x);}}return cumulativeValue;}"; // eslint-disable-line
|
|
2242
2242
|
|
|
2243
|
-
var velocity_over_lifetime_module = "#define GLSLIFY 1\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\nuniform int renderer_VOLSpace;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_RANDOM_CONSTANT)\nuniform vec3 renderer_VOLMaxConst;\n#ifdef RENDERER_VOL_RANDOM_CONSTANT\nuniform vec3 renderer_VOLMinConst;\n#endif\n#endif\n#if defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CURVE)\nuniform vec2 renderer_VOLMaxGradientX[4];uniform vec2 renderer_VOLMaxGradientY[4];uniform vec2 renderer_VOLMaxGradientZ[4];\n#ifdef RENDERER_VOL_RANDOM_CURVE\nuniform vec2 renderer_VOLMinGradientX[4];uniform vec2 renderer_VOLMinGradientY[4];uniform vec2 renderer_VOLMinGradientZ[4];\n#endif\n#endif\n#endif\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\nvec3 computeParticleLifeVelocity(in float normalizedAge){vec3 velocity;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_RANDOM_CONSTANT)\nvelocity=renderer_VOLMaxConst;\n#ifdef RENDERER_VOL_RANDOM_CONSTANT\nvelocity=mix(renderer_VOLMinConst,velocity,vec3(a_Random1.y,a_Random1.z,a_Random1.w));\n#endif\n#endif\n#if defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CURVE)\nvelocity=vec3(evaluateParticleCurve(renderer_VOLMaxGradientX,normalizedAge),evaluateParticleCurve(renderer_VOLMaxGradientY,normalizedAge),evaluateParticleCurve(renderer_VOLMaxGradientZ,normalizedAge));\n#endif\n#ifdef RENDERER_VOL_RANDOM_CURVE\nvelocity=vec3(mix(velocity.x,evaluateParticleCurve(renderer_VOLMinGradientX,normalizedAge),a_Random1.y),mix(velocity.y,evaluateParticleCurve(renderer_VOLMinGradientY,normalizedAge),a_Random1.z),mix(velocity.z,evaluateParticleCurve(renderer_VOLMinGradientZ,normalizedAge),a_Random1.w));\n#endif\nreturn velocity;}\n#endif\nvec3 getStartPosition(vec3 startVelocity,float age,vec3 dragData){vec3 startPosition;float lastTime=min(startVelocity.x/dragData.x,age);startPosition=lastTime*(startVelocity-0.5*dragData*lastTime);return startPosition;}vec3 computeParticlePosition(in vec3 startVelocity,in vec3 lifeVelocity,in float age,in float normalizedAge,vec3 gravityVelocity,vec4 worldRotation,vec3 dragData){vec3 startPosition=getStartPosition(startVelocity,age,dragData);vec3 lifePosition;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\n#if defined(RENDERER_VOL_CONSTANT)|| defined(RENDERER_VOL_RANDOM_CONSTANT)\nlifePosition=lifeVelocity*age;\n#endif\n#if defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CURVE)\nlifePosition=vec3(evaluateParticleCurveCumulative(renderer_VOLMaxGradientX,normalizedAge)evaluateParticleCurveCumulative(renderer_VOLMaxGradientY,normalizedAge),evaluateParticleCurveCumulative(renderer_VOLMaxGradientZ,normalizedAge));\n#ifdef RENDERER_VOL_RANDOM_CURVE\nlifePosition=vec3(mix(evaluateParticleCurveCumulative(renderer_VOLMinGradientX,normalizedAge),lifePosition.x,a_Random1.y),mix(evaluateParticleCurveCumulative(renderer_VOLMinGradientY,normalizedAge),lifePosition.y,a_Random1.z),mix(evaluateParticleCurveCumulative(renderer_VOLMinGradientZ,normalizedAge),lifePosition.z,a_Random1.w));\n#endif\nlifePosition*=vec3(a_ShapePositionStartLifeTime.w);\n#endif\nvec3 finalPosition;if(renderer_VOLSpace==0){finalPosition=rotationByQuaternions(a_ShapePositionStartLifeTime.xyz+startPosition+lifePosition,worldRotation);}else{finalPosition=rotationByQuaternions(a_ShapePositionStartLifeTime.xyz+startPosition,worldRotation)+lifePosition;}\n#else\nvec3 finalPosition=rotationByQuaternions(a_ShapePositionStartLifeTime.xyz+startPosition,worldRotation);\n#endif\nif(renderer_SimulationSpace==0){finalPosition=finalPosition+renderer_WorldPosition;}else if(renderer_SimulationSpace==1){finalPosition=finalPosition+a_SimulationWorldPosition;}finalPosition+=0.5*gravityVelocity*age;return finalPosition;}"; // eslint-disable-line
|
|
2243
|
+
var velocity_over_lifetime_module = "#define GLSLIFY 1\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\nuniform int renderer_VOLSpace;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_RANDOM_CONSTANT)\nuniform vec3 renderer_VOLMaxConst;\n#ifdef RENDERER_VOL_RANDOM_CONSTANT\nuniform vec3 renderer_VOLMinConst;\n#endif\n#endif\n#if defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CURVE)\nuniform vec2 renderer_VOLMaxGradientX[4];uniform vec2 renderer_VOLMaxGradientY[4];uniform vec2 renderer_VOLMaxGradientZ[4];\n#ifdef RENDERER_VOL_RANDOM_CURVE\nuniform vec2 renderer_VOLMinGradientX[4];uniform vec2 renderer_VOLMinGradientY[4];uniform vec2 renderer_VOLMinGradientZ[4];\n#endif\n#endif\n#endif\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\nvec3 computeParticleLifeVelocity(in float normalizedAge){vec3 velocity;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_RANDOM_CONSTANT)\nvelocity=renderer_VOLMaxConst;\n#ifdef RENDERER_VOL_RANDOM_CONSTANT\nvelocity=mix(renderer_VOLMinConst,velocity,vec3(a_Random1.y,a_Random1.z,a_Random1.w));\n#endif\n#endif\n#if defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CURVE)\nvelocity=vec3(evaluateParticleCurve(renderer_VOLMaxGradientX,normalizedAge),evaluateParticleCurve(renderer_VOLMaxGradientY,normalizedAge),evaluateParticleCurve(renderer_VOLMaxGradientZ,normalizedAge));\n#endif\n#ifdef RENDERER_VOL_RANDOM_CURVE\nvelocity=vec3(mix(velocity.x,evaluateParticleCurve(renderer_VOLMinGradientX,normalizedAge),a_Random1.y),mix(velocity.y,evaluateParticleCurve(renderer_VOLMinGradientY,normalizedAge),a_Random1.z),mix(velocity.z,evaluateParticleCurve(renderer_VOLMinGradientZ,normalizedAge),a_Random1.w));\n#endif\nreturn velocity;}\n#endif\nvec3 getStartPosition(vec3 startVelocity,float age,vec3 dragData){vec3 startPosition;float lastTime=min(startVelocity.x/dragData.x,age);startPosition=lastTime*(startVelocity-0.5*dragData*lastTime);return startPosition;}vec3 computeParticlePosition(in vec3 startVelocity,in vec3 lifeVelocity,in float age,in float normalizedAge,vec3 gravityVelocity,vec4 worldRotation,vec3 dragData){vec3 startPosition=getStartPosition(startVelocity,age,dragData);vec3 lifePosition;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\n#if defined(RENDERER_VOL_CONSTANT)|| defined(RENDERER_VOL_RANDOM_CONSTANT)\nlifePosition=lifeVelocity*age;\n#endif\n#if defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CURVE)\nlifePosition=vec3(evaluateParticleCurveCumulative(renderer_VOLMaxGradientX,normalizedAge),evaluateParticleCurveCumulative(renderer_VOLMaxGradientY,normalizedAge),evaluateParticleCurveCumulative(renderer_VOLMaxGradientZ,normalizedAge));\n#ifdef RENDERER_VOL_RANDOM_CURVE\nlifePosition=vec3(mix(evaluateParticleCurveCumulative(renderer_VOLMinGradientX,normalizedAge),lifePosition.x,a_Random1.y),mix(evaluateParticleCurveCumulative(renderer_VOLMinGradientY,normalizedAge),lifePosition.y,a_Random1.z),mix(evaluateParticleCurveCumulative(renderer_VOLMinGradientZ,normalizedAge),lifePosition.z,a_Random1.w));\n#endif\nlifePosition*=vec3(a_ShapePositionStartLifeTime.w);\n#endif\nvec3 finalPosition;if(renderer_VOLSpace==0){finalPosition=rotationByQuaternions(a_ShapePositionStartLifeTime.xyz+startPosition+lifePosition,worldRotation);}else{finalPosition=rotationByQuaternions(a_ShapePositionStartLifeTime.xyz+startPosition,worldRotation)+lifePosition;}\n#else\nvec3 finalPosition=rotationByQuaternions(a_ShapePositionStartLifeTime.xyz+startPosition,worldRotation);\n#endif\nif(renderer_SimulationSpace==0){finalPosition=finalPosition+renderer_WorldPosition;}else if(renderer_SimulationSpace==1){finalPosition=finalPosition+a_SimulationWorldPosition;}finalPosition+=0.5*gravityVelocity*age;return finalPosition;}"; // eslint-disable-line
|
|
2244
2244
|
|
|
2245
2245
|
var rotation_over_lifetime_module = "#define GLSLIFY 1\n#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n#ifdef RENDERER_ROL_CURVE_MODE\nuniform vec2 renderer_ROLMaxCurveZ[4];\n#ifdef RENDERER_ROL_IS_RANDOM_TWO\nuniform vec2 renderer_ROLMinCurveZ[4];\n#endif\n#else\nuniform vec3 renderer_ROLMaxConst;\n#ifdef RENDERER_ROL_IS_RANDOM_TWO\nuniform vec3 renderer_ROLMinConst;\n#endif\n#endif\n#endif\nfloat computeParticleRotationFloat(in float rotation,in float age,in float normalizedAge){\n#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n#ifdef RENDERER_ROL_CURVE_MODE\nfloat lifeRotation=evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ,normalizedAge);\n#ifdef RENDERER_ROL_IS_RANDOM_TWO\nlifeRotation=mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ,normalizedAge),lifeRotation,a_Random0.w);\n#endif\nrotation+=lifeRotation*a_ShapePositionStartLifeTime.w;\n#else\nfloat lifeRotation=renderer_ROLMaxConst.z;\n#ifdef RENDERER_ROL_IS_RANDOM_TWO\nlifeRotation=mix(renderer_ROLMinConst.z,lifeRotation,a_Random0.w);\n#endif\nrotation+=lifeRotation*age;\n#endif\n#endif\nreturn rotation;}\n#if defined(RENDERER_MODE_MESH) && (defined(ROTATION_OVER_LIFETIME) || defined(ROTATION_OVER_LIFETIME_SEPARATE))\nvec3 computeParticleRotationVec3(in vec3 rotation,in float age,in float normalizedAge){\n#ifdef ROTATION_OVER_LIFETIME\n#ifdef ROTATION_OVER_LIFETIME_CONSTANT\nfloat ageRot=u_ROLAngularVelocityConst*age;rotation+=ageRot;\n#endif\n#ifdef ROTATION_OVER_LIFETIME_CURVE\nrotation+=getTotalValueFromGradientFloat(u_ROLAngularVelocityGradient,normalizedAge);\n#endif\n#ifdef ROTATION_OVER_LIFETIME_RANDOM_CONSTANTS\nfloat ageRot=mix(u_ROLAngularVelocityConst,u_ROLAngularVelocityConstMax,a_Random0.w)*age;rotation+=ageRot;\n#endif\n#ifdef ROTATION_OVER_LIFETIME_RANDOM_CURVES\nrotation+=mix(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradient,normalizedAge),getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientMax,normalizedAge),a_Random0.w);\n#endif\n#endif\n#ifdef ROTATION_OVER_LIFETIME_SEPARATE\n#ifdef ROTATION_OVER_LIFETIME_CONSTANT\nvec3 ageRot=u_ROLAngularVelocityConstSeparate*age;rotation+=ageRot;\n#endif\n#ifdef ROTATION_OVER_LIFETIME_CURVE\nrotation+=vec3(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientX,normalizedAge),getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientY,normalizedAge),getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientZ,normalizedAge));\n#endif\n#ifdef ROTATION_OVER_LIFETIME_RANDOM_CONSTANTS\nvec3 ageRot=mix(u_ROLAngularVelocityConstSeparate,renderer_ROLMaxConst,a_Random0.w)*age;rotation+=ageRot;\n#endif\n#ifdef ROTATION_OVER_LIFETIME_RANDOM_CURVES\nrotation+=vec3(mix(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientX,normalizedAge),getTotalValueFromGradientFloat(renderer_ROLMaxCurveX,normalizedAge),a_Random0.w),mix(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientY,normalizedAge),getTotalValueFromGradientFloat(renderer_ROLMaxCurveY,normalizedAge),a_Random0.w),mix(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientZ,normalizedAge),getTotalValueFromGradientFloat(renderer_ROLMaxCurveZ,normalizedAge),a_Random0.w));\n#endif\n#endif\nreturn rotation;}\n#endif\n"; // eslint-disable-line
|
|
2246
2246
|
|
|
@@ -6607,13 +6607,17 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6607
6607
|
*/ var DisorderedArray = /*#__PURE__*/ function() {
|
|
6608
6608
|
function DisorderedArray(count) {
|
|
6609
6609
|
if (count === void 0) count = 0;
|
|
6610
|
-
this.length = 0;
|
|
6611
|
-
this.
|
|
6610
|
+
/** The length of the array. */ this.length = 0;
|
|
6611
|
+
this._loopCounter = 0 // Ignore nested loops, use counter to solve the problem
|
|
6612
|
+
;
|
|
6612
6613
|
this._blankCount = 0;
|
|
6613
6614
|
this._elements = new Array(count);
|
|
6614
6615
|
}
|
|
6615
6616
|
var _proto = DisorderedArray.prototype;
|
|
6616
|
-
|
|
6617
|
+
/**
|
|
6618
|
+
* Add an element to disordered array.
|
|
6619
|
+
* @param element - The element to be added
|
|
6620
|
+
*/ _proto.add = function add(element) {
|
|
6617
6621
|
if (this.length === this._elements.length) {
|
|
6618
6622
|
this._elements.push(element);
|
|
6619
6623
|
} else {
|
|
@@ -6621,18 +6625,29 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6621
6625
|
}
|
|
6622
6626
|
this.length++;
|
|
6623
6627
|
};
|
|
6624
|
-
|
|
6628
|
+
/**
|
|
6629
|
+
* Delete the specified element.
|
|
6630
|
+
* @param element - The element to be deleted
|
|
6631
|
+
*/ _proto.delete = function _delete(element) {
|
|
6625
6632
|
// @todo: It can be optimized for custom binary search and other algorithms, currently this._elements>=this.length wastes performance.
|
|
6626
6633
|
var index = this._elements.indexOf(element);
|
|
6627
6634
|
this.deleteByIndex(index);
|
|
6628
6635
|
};
|
|
6629
|
-
|
|
6636
|
+
/**
|
|
6637
|
+
* Set the element at the specified index.
|
|
6638
|
+
* @param index - The index of the element to be set
|
|
6639
|
+
* @param element - The element to be set
|
|
6640
|
+
*/ _proto.set = function set(index, element) {
|
|
6630
6641
|
if (index >= this.length) {
|
|
6631
6642
|
throw "Index is out of range.";
|
|
6632
6643
|
}
|
|
6633
6644
|
this._elements[index] = element;
|
|
6634
6645
|
};
|
|
6635
|
-
|
|
6646
|
+
/**
|
|
6647
|
+
* Get the element at the specified index.
|
|
6648
|
+
* @param index - The index of the element to be get
|
|
6649
|
+
* @returns The element at the specified index
|
|
6650
|
+
*/ _proto.get = function get(index) {
|
|
6636
6651
|
if (index >= this.length) {
|
|
6637
6652
|
throw "Index is out of range.";
|
|
6638
6653
|
}
|
|
@@ -6645,7 +6660,7 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6645
6660
|
*/ _proto.deleteByIndex = function deleteByIndex(index) {
|
|
6646
6661
|
var elements = this._elements;
|
|
6647
6662
|
var end;
|
|
6648
|
-
if (this.
|
|
6663
|
+
if (this._loopCounter > 0) {
|
|
6649
6664
|
this._elements[index] = null;
|
|
6650
6665
|
this._blankCount++;
|
|
6651
6666
|
} else {
|
|
@@ -6659,41 +6674,57 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6659
6674
|
}
|
|
6660
6675
|
return end;
|
|
6661
6676
|
};
|
|
6662
|
-
|
|
6677
|
+
/**
|
|
6678
|
+
* Loop through all elements.
|
|
6679
|
+
* @param callbackFn - The callback function
|
|
6680
|
+
* @param swapFn - The swap function can process the element after the callback function, it will be called after end looping(`isLopping` = true)
|
|
6681
|
+
*/ _proto.forEach = function forEach(callbackFn, swapFn) {
|
|
6663
6682
|
this._startLoop();
|
|
6664
6683
|
var elements = this._elements;
|
|
6665
6684
|
for(var i = 0, n = this.length; i < n; i++){
|
|
6666
6685
|
var element = elements[i];
|
|
6667
|
-
element && callbackFn(element);
|
|
6686
|
+
element && callbackFn(element, i);
|
|
6668
6687
|
}
|
|
6669
6688
|
this._endLoop(swapFn);
|
|
6670
6689
|
};
|
|
6671
|
-
|
|
6690
|
+
/**
|
|
6691
|
+
* Loop through all elements and clean up the blank elements.
|
|
6692
|
+
* @param callbackFn - The callback function
|
|
6693
|
+
* @param swapFn - The swap function can process the element after the callback function, it will be called after end looping(`isLopping` = true)
|
|
6694
|
+
*/ _proto.forEachAndClean = function forEachAndClean(callbackFn, swapFn) {
|
|
6672
6695
|
this._startLoop();
|
|
6673
6696
|
var preEnd = this.length;
|
|
6674
6697
|
var elements = this._elements;
|
|
6675
6698
|
for(var i = 0, n = preEnd; i < n; i++){
|
|
6676
6699
|
var element = elements[i];
|
|
6677
|
-
element && callbackFn(element);
|
|
6700
|
+
element && callbackFn(element, i);
|
|
6678
6701
|
}
|
|
6679
6702
|
this._endLoopAndClean(preEnd, elements, swapFn);
|
|
6680
6703
|
};
|
|
6681
|
-
|
|
6704
|
+
/**
|
|
6705
|
+
* Sort the array.
|
|
6706
|
+
* @param compareFn - The comparison function
|
|
6707
|
+
*/ _proto.sort = function sort(compareFn) {
|
|
6682
6708
|
Utils._quickSort(this._elements, 0, this.length, compareFn);
|
|
6683
6709
|
};
|
|
6684
|
-
|
|
6710
|
+
/**
|
|
6711
|
+
* Garbage collection, clean up all cached elements.
|
|
6712
|
+
*/ _proto.garbageCollection = function garbageCollection() {
|
|
6685
6713
|
this._elements.length = this.length;
|
|
6686
6714
|
};
|
|
6687
6715
|
_proto._startLoop = function _startLoop() {
|
|
6688
|
-
this.
|
|
6716
|
+
++this._loopCounter;
|
|
6689
6717
|
};
|
|
6690
6718
|
_proto._endLoop = function _endLoop(swapFn) {
|
|
6691
|
-
this.
|
|
6719
|
+
if (--this._loopCounter !== 0) {
|
|
6720
|
+
return;
|
|
6721
|
+
}
|
|
6692
6722
|
if (this._blankCount) {
|
|
6693
6723
|
var from = 0;
|
|
6694
6724
|
var to = this.length - 1;
|
|
6695
6725
|
var elements = this._elements;
|
|
6696
6726
|
partition: do {
|
|
6727
|
+
var _swapFn;
|
|
6697
6728
|
while(elements[from])if (++from >= to) {
|
|
6698
6729
|
break partition;
|
|
6699
6730
|
}
|
|
@@ -6701,7 +6732,7 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6701
6732
|
break partition;
|
|
6702
6733
|
}
|
|
6703
6734
|
var swapElement = elements[to];
|
|
6704
|
-
swapFn(swapElement, from);
|
|
6735
|
+
(_swapFn = swapFn) == null ? void 0 : _swapFn(swapElement, from);
|
|
6705
6736
|
elements[from++] = swapElement;
|
|
6706
6737
|
elements[to--] = null;
|
|
6707
6738
|
}while (from < to);
|
|
@@ -6710,18 +6741,31 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6710
6741
|
}
|
|
6711
6742
|
};
|
|
6712
6743
|
_proto._endLoopAndClean = function _endLoopAndClean(preEnd, elements, swapFn) {
|
|
6744
|
+
if (--this._loopCounter !== 0) {
|
|
6745
|
+
return;
|
|
6746
|
+
}
|
|
6713
6747
|
var index = 0;
|
|
6714
6748
|
for(var i = preEnd, n = this.length; i < n; i++){
|
|
6749
|
+
var _swapFn;
|
|
6715
6750
|
var element = elements[i];
|
|
6716
6751
|
if (!element) continue;
|
|
6717
6752
|
elements[index] = element;
|
|
6718
|
-
swapFn(element, index);
|
|
6753
|
+
(_swapFn = swapFn) == null ? void 0 : _swapFn(element, index);
|
|
6719
6754
|
index++;
|
|
6720
6755
|
}
|
|
6721
|
-
this._isLooping = false;
|
|
6722
6756
|
this.length = index;
|
|
6723
6757
|
this._blankCount = 0;
|
|
6724
6758
|
};
|
|
6759
|
+
_create_class(DisorderedArray, [
|
|
6760
|
+
{
|
|
6761
|
+
key: "isLopping",
|
|
6762
|
+
get: /**
|
|
6763
|
+
* Get whether the array is in the loop.
|
|
6764
|
+
*/ function get() {
|
|
6765
|
+
return this._loopCounter > 0;
|
|
6766
|
+
}
|
|
6767
|
+
}
|
|
6768
|
+
]);
|
|
6725
6769
|
return DisorderedArray;
|
|
6726
6770
|
}();
|
|
6727
6771
|
|
|
@@ -34415,5 +34459,5 @@ var cacheDir = new Vector3();
|
|
|
34415
34459
|
return CubeProbe;
|
|
34416
34460
|
}(Probe);
|
|
34417
34461
|
|
|
34418
|
-
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraType, Canvas, CapsuleColliderShape, CharacterController, CircleShape, ClearableObjectPool, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorOverLifetimeModule, ColorSpace, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, LayerPathMask, Light, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh, OverflowMode, PBRBaseMaterial, PBRMaterial, PBRSpecularMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerPhase, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueType, RenderState, RenderStateElementKey as RenderStateDataKey, RenderTarget, RenderTargetBlendState, Renderer, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderFactory, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderPlatformTarget, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureWrapMode, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, Transform, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, _PostProcessManager, assignmentClone, deepClone, dependentComponents, ignoreClone, request, resourceLoader, shallowClone };
|
|
34462
|
+
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraType, Canvas, CapsuleColliderShape, CharacterController, CircleShape, ClearableObjectPool, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorOverLifetimeModule, ColorSpace, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, LayerPathMask, Light, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh, OverflowMode, PBRBaseMaterial, PBRMaterial, PBRSpecularMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerPhase, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueType, RenderState, RenderStateElementKey as RenderStateDataKey, RenderTarget, RenderTargetBlendState, Renderer, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderFactory, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderPlatformTarget, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureWrapMode, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, Transform, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, _PostProcessManager, assignmentClone, deepClone, dependentComponents, ignoreClone, request, resourceLoader, shallowClone };
|
|
34419
34463
|
//# sourceMappingURL=module.js.map
|