@galacean/engine 2.0.0-alpha.16 → 2.0.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +1210 -61
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/bundled.module.js +1210 -62
- package/dist/bundled.module.js.map +1 -1
- package/dist/bundled.module.min.js +1 -1
- package/dist/bundled.module.min.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/bundled.module.js
CHANGED
|
@@ -9874,13 +9874,15 @@ var ShadowLib = {
|
|
|
9874
9874
|
ShadowVertexDeclaration: ShadowVertexDeclaration,
|
|
9875
9875
|
ShadowVertex: ShadowVertex
|
|
9876
9876
|
};
|
|
9877
|
-
var particle_common = "vec3 rotationByQuaternions(in vec3 v, in vec4 q) {\n return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v);\n}\n\nvec3 rotationByEuler(in vec3 vector, in vec3 rot) {\n float halfRoll = rot.z * 0.5;\n float halfPitch = rot.x * 0.5;\n float halfYaw = rot.y * 0.5;\n\n float sinRoll = sin(halfRoll);\n float cosRoll = cos(halfRoll);\n float sinPitch = sin(halfPitch);\n float cosPitch = cos(halfPitch);\n float sinYaw = sin(halfYaw);\n float cosYaw = cos(halfYaw);\n\n float cosYawPitch = cosYaw * cosPitch;\n float sinYawPitch = sinYaw * sinPitch;\n\n float quaX = (cosYaw * sinPitch * cosRoll) + (sinYaw * cosPitch * sinRoll);\n float quaY = (sinYaw * cosPitch * cosRoll) - (cosYaw * sinPitch * sinRoll);\n float quaZ = (cosYawPitch * sinRoll) - (sinYawPitch * cosRoll);\n float quaW = (cosYawPitch * cosRoll) + (sinYawPitch * sinRoll);\n\n return rotationByQuaternions(vector, vec4(quaX, quaY, quaZ, quaW));\n}\n\n// Assume axis is normalized\nvec3 rotationByAxis(in vec3 vector, in vec3 axis, in float angle) {\n float halfAngle = angle * 0.5;\n float s = sin(halfAngle);\n\n return rotationByQuaternions(vector, vec4(axis * s, cos(halfAngle)));\n}\n\n\nfloat evaluateParticleCurve(in vec2 keys[4], in float normalizedAge) {\n float value;\n for (int i = 1; i < 4; i++) {\n vec2 key = keys[i];\n float time = key.x;\n if (time >= normalizedAge) {\n vec2 lastKey = keys[i - 1];\n float lastTime = lastKey.x;\n float age = (normalizedAge - lastTime) / (time - lastTime);\n value = mix(lastKey.y, key.y, age);\n break;\n }\n }\n return value;\n}\n\nfloat evaluateParticleCurveCumulative(in vec2 keys[4], in float normalizedAge, out float currentValue){\n float cumulativeValue = 0.0;\n for (int i = 1; i < 4; i++){\n\t vec2 key = keys[i];\n\t float time = key.x;\n\t vec2 lastKey = keys[i - 1];\n\t float lastValue = lastKey.y;\n\n\t if (time >= normalizedAge){\n\t\t float lastTime = lastKey.x;\n float offsetTime = normalizedAge - lastTime;\n\t\t float age = offsetTime / (time - lastTime);\n currentValue = mix(lastValue, key.y, age);\n\t\t cumulativeValue += (lastValue + currentValue) * 0.5 * offsetTime;\n\t\t break;\n\t\t}\n\t else{\n\t\t cumulativeValue += (lastValue + key.y) * 0.5 * (time - lastKey.x);\n\t\t}\n\t}\n return cumulativeValue;\n}\n\nvec4 evaluateParticleGradient(in vec4 colorKeys[4], in float colorMaxTime, in vec2 alphaKeys[4], in float alphaMaxTime, in float t) {\n vec4 value;\n\n float alphaT = min(t, alphaMaxTime);\n for (int i = 0; i < 4; i++) {\n vec2 key = alphaKeys[i];\n if (alphaT <= key.x) {\n if (i == 0) {\n value.a = alphaKeys[0].y;\n } else {\n vec2 lastKey = alphaKeys[i - 1];\n float age = (alphaT - lastKey.x) / (key.x - lastKey.x);\n value.a = mix(lastKey.y, key.y, age);\n }\n break;\n }\n }\n\n float colorT = min(t, colorMaxTime);\n for (int i = 0; i < 4; i++) {\n vec4 key = colorKeys[i];\n if (colorT <= key.x) {\n if (i == 0) {\n value.rgb = colorKeys[0].yzw;\n } else {\n vec4 lastKey = colorKeys[i - 1];\n float age = (colorT - lastKey.x) / (key.x - lastKey.x);\n value.rgb = mix(lastKey.yzw, key.yzw, age);\n }\n break;\n }\n }\n\n return value;\n}"; // eslint-disable-line
|
|
9877
|
+
var particle_common = "vec3 rotationByQuaternions(in vec3 v, in vec4 q) {\n return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v);\n}\n\nvec4 quaternionConjugate(in vec4 q) {\n return vec4(-q.xyz, q.w);\n}\n\nvec3 rotationByEuler(in vec3 vector, in vec3 rot) {\n float halfRoll = rot.z * 0.5;\n float halfPitch = rot.x * 0.5;\n float halfYaw = rot.y * 0.5;\n\n float sinRoll = sin(halfRoll);\n float cosRoll = cos(halfRoll);\n float sinPitch = sin(halfPitch);\n float cosPitch = cos(halfPitch);\n float sinYaw = sin(halfYaw);\n float cosYaw = cos(halfYaw);\n\n float cosYawPitch = cosYaw * cosPitch;\n float sinYawPitch = sinYaw * sinPitch;\n\n float quaX = (cosYaw * sinPitch * cosRoll) + (sinYaw * cosPitch * sinRoll);\n float quaY = (sinYaw * cosPitch * cosRoll) - (cosYaw * sinPitch * sinRoll);\n float quaZ = (cosYawPitch * sinRoll) - (sinYawPitch * cosRoll);\n float quaW = (cosYawPitch * cosRoll) + (sinYawPitch * sinRoll);\n\n return rotationByQuaternions(vector, vec4(quaX, quaY, quaZ, quaW));\n}\n\n// Assume axis is normalized\nvec3 rotationByAxis(in vec3 vector, in vec3 axis, in float angle) {\n float halfAngle = angle * 0.5;\n float s = sin(halfAngle);\n\n return rotationByQuaternions(vector, vec4(axis * s, cos(halfAngle)));\n}\n\n\nfloat evaluateParticleCurve(in vec2 keys[4], in float normalizedAge) {\n float value;\n for (int i = 1; i < 4; i++) {\n vec2 key = keys[i];\n float time = key.x;\n if (time >= normalizedAge) {\n vec2 lastKey = keys[i - 1];\n float lastTime = lastKey.x;\n float age = (normalizedAge - lastTime) / (time - lastTime);\n value = mix(lastKey.y, key.y, age);\n break;\n }\n }\n return value;\n}\n\nfloat evaluateParticleCurveCumulative(in vec2 keys[4], in float normalizedAge, out float currentValue){\n float cumulativeValue = 0.0;\n for (int i = 1; i < 4; i++){\n\t vec2 key = keys[i];\n\t float time = key.x;\n\t vec2 lastKey = keys[i - 1];\n\t float lastValue = lastKey.y;\n\n\t if (time >= normalizedAge){\n\t\t float lastTime = lastKey.x;\n float offsetTime = normalizedAge - lastTime;\n\t\t float age = offsetTime / (time - lastTime);\n currentValue = mix(lastValue, key.y, age);\n\t\t cumulativeValue += (lastValue + currentValue) * 0.5 * offsetTime;\n\t\t break;\n\t\t}\n\t else{\n\t\t cumulativeValue += (lastValue + key.y) * 0.5 * (time - lastKey.x);\n\t\t}\n\t}\n return cumulativeValue;\n}\n\nvec4 evaluateParticleGradient(in vec4 colorKeys[4], in float colorMaxTime, in vec2 alphaKeys[4], in float alphaMaxTime, in float t) {\n vec4 value;\n\n float alphaT = min(t, alphaMaxTime);\n for (int i = 0; i < 4; i++) {\n vec2 key = alphaKeys[i];\n if (alphaT <= key.x) {\n if (i == 0) {\n value.a = alphaKeys[0].y;\n } else {\n vec2 lastKey = alphaKeys[i - 1];\n float age = (alphaT - lastKey.x) / (key.x - lastKey.x);\n value.a = mix(lastKey.y, key.y, age);\n }\n break;\n }\n }\n\n float colorT = min(t, colorMaxTime);\n for (int i = 0; i < 4; i++) {\n vec4 key = colorKeys[i];\n if (colorT <= key.x) {\n if (i == 0) {\n value.rgb = colorKeys[0].yzw;\n } else {\n vec4 lastKey = colorKeys[i - 1];\n float age = (colorT - lastKey.x) / (key.x - lastKey.x);\n value.rgb = mix(lastKey.yzw, key.yzw, age);\n }\n break;\n }\n }\n\n return value;\n}"; // eslint-disable-line
|
|
9878
9878
|
var velocity_over_lifetime_module = "#if defined(RENDERER_VOL_CONSTANT_MODE) || defined(RENDERER_VOL_CURVE_MODE)\n #define _VOL_MODULE_ENABLED\n#endif\n\n#ifdef _VOL_MODULE_ENABLED\n uniform int renderer_VOLSpace;\n\n #ifdef RENDERER_VOL_CONSTANT_MODE\n uniform vec3 renderer_VOLMaxConst;\n\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n uniform vec3 renderer_VOLMinConst;\n #endif\n #endif\n\n #ifdef RENDERER_VOL_CURVE_MODE\n uniform vec2 renderer_VOLMaxGradientX[4]; // x:time y:value\n uniform vec2 renderer_VOLMaxGradientY[4]; // x:time y:value\n uniform vec2 renderer_VOLMaxGradientZ[4]; // x:time y:value\n\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n uniform vec2 renderer_VOLMinGradientX[4]; // x:time y:value\n uniform vec2 renderer_VOLMinGradientY[4]; // x:time y:value\n uniform vec2 renderer_VOLMinGradientZ[4]; // x:time y:value\n #endif\n #endif\n\n\n vec3 computeVelocityPositionOffset(in float normalizedAge, in float age, out vec3 currentVelocity) {\n vec3 velocityPosition;\n\n #ifdef RENDERER_VOL_CONSTANT_MODE\n currentVelocity = renderer_VOLMaxConst;\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n currentVelocity = mix(renderer_VOLMinConst, currentVelocity, a_Random1.yzw);\n #endif\n\n velocityPosition = currentVelocity * age;\n #endif\n\n #ifdef RENDERER_VOL_CURVE_MODE\n velocityPosition = vec3(\n evaluateParticleCurveCumulative(renderer_VOLMaxGradientX, normalizedAge, currentVelocity.x),\n evaluateParticleCurveCumulative(renderer_VOLMaxGradientY, normalizedAge, currentVelocity.y),\n evaluateParticleCurveCumulative(renderer_VOLMaxGradientZ, normalizedAge, currentVelocity.z));\n\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n vec3 minCurrentVelocity;\n vec3 minVelocityPosition = vec3(\n evaluateParticleCurveCumulative(renderer_VOLMinGradientX, normalizedAge, minCurrentVelocity.x),\n evaluateParticleCurveCumulative(renderer_VOLMinGradientY, normalizedAge, minCurrentVelocity.y),\n evaluateParticleCurveCumulative(renderer_VOLMinGradientZ, normalizedAge, minCurrentVelocity.z));\n\n currentVelocity = mix(minCurrentVelocity, currentVelocity, a_Random1.yzw);\n velocityPosition = mix(minVelocityPosition, velocityPosition, a_Random1.yzw);\n #endif\n\n velocityPosition *= vec3(a_ShapePositionStartLifeTime.w);\n #endif\n return velocityPosition;\n }\n#endif\n"; // eslint-disable-line
|
|
9879
9879
|
var rotation_over_lifetime_module = "#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n #ifdef RENDERER_ROL_CURVE_MODE\n uniform vec2 renderer_ROLMaxCurveZ[4];\n #ifdef RENDERER_ROL_IS_SEPARATE\n uniform vec2 renderer_ROLMaxCurveX[4];\n uniform vec2 renderer_ROLMaxCurveY[4];\n #endif\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n uniform vec2 renderer_ROLMinCurveZ[4];\n #ifdef RENDERER_ROL_IS_SEPARATE\n uniform vec2 renderer_ROLMinCurveX[4];\n uniform vec2 renderer_ROLMinCurveY[4];\n #endif\n #endif\n #else\n uniform vec3 renderer_ROLMaxConst;\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n uniform vec3 renderer_ROLMinConst;\n #endif\n #endif\n#endif\n\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\n float currentValue;\n float lifeRotation = evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue);\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n lifeRotation = mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ, normalizedAge, currentValue), lifeRotation, a_Random0.w);\n #endif\n rotation += lifeRotation * a_ShapePositionStartLifeTime.w;\n #else\n float lifeRotation = renderer_ROLMaxConst.z;\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n lifeRotation = mix(renderer_ROLMinConst.z, lifeRotation, a_Random0.w);\n #endif\n rotation += lifeRotation * age;\n #endif\n #endif\n return rotation;\n}\n\n\n#if defined(RENDERER_MODE_MESH) && (defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE))\nvec3 computeParticleRotationVec3(in vec3 rotation, in float age, in float normalizedAge) {\n #ifdef RENDERER_ROL_IS_SEPARATE\n #ifdef RENDERER_ROL_CONSTANT_MODE\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n vec3 ageRot = mix(renderer_ROLMinConst, renderer_ROLMaxConst, a_Random0.w) * age;\n #else\n vec3 ageRot = renderer_ROLMaxConst * age;\n #endif\n rotation += ageRot;\n #endif\n #ifdef RENDERER_ROL_CURVE_MODE\n float currentValue;\n float lifetime = a_ShapePositionStartLifeTime.w;\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n rotation += vec3(\n mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveX, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveX, normalizedAge, currentValue), a_Random0.w),\n mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveY, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveY, normalizedAge, currentValue), a_Random0.w),\n mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue), a_Random0.w)) * lifetime;\n #else\n rotation += vec3(\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveX, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveY, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue)) * lifetime;\n #endif\n #endif\n #else\n #ifdef RENDERER_ROL_CONSTANT_MODE\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n float ageRot = mix(renderer_ROLMinConst.z, renderer_ROLMaxConst.z, a_Random0.w) * age;\n #else\n float ageRot = renderer_ROLMaxConst.z * age;\n #endif\n rotation += ageRot;\n #endif\n\n #ifdef RENDERER_ROL_CURVE_MODE\n float currentValue;\n float lifeRotation = evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue);\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n lifeRotation = mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ, normalizedAge, currentValue), lifeRotation, a_Random0.w);\n #endif\n rotation += lifeRotation * a_ShapePositionStartLifeTime.w;\n #endif\n #endif\n return rotation;\n}\n#endif\n"; // eslint-disable-line
|
|
9880
9880
|
var size_over_lifetime_module = "#ifdef RENDERER_SOL_CURVE_MODE\n uniform vec2 renderer_SOLMaxCurveX[4]; // x:time y:value\n #ifdef RENDERER_SOL_IS_SEPARATE\n uniform vec2 renderer_SOLMaxCurveY[4]; // x:time y:value\n uniform vec2 renderer_SOLMaxCurveZ[4]; // x:time y:value\n #endif\n\n #ifdef RENDERER_SOL_IS_RANDOM_TWO\n uniform vec2 renderer_SOLMinCurveX[4]; // x:time y:value\n #ifdef RENDERER_SOL_IS_SEPARATE\n uniform vec2 renderer_SOLMinCurveY[4]; // x:time y:value\n uniform vec2 renderer_SOLMinCurveZ[4]; // x:time y:value\n #endif\n #endif\n#endif\n\nvec2 computeParticleSizeBillboard(in vec2 size, in float normalizedAge) {\n #ifdef RENDERER_SOL_CURVE_MODE\n float lifeSizeX = evaluateParticleCurve(renderer_SOLMaxCurveX, normalizedAge);\n #ifdef RENDERER_SOL_IS_RANDOM_TWO\n lifeSizeX = mix(evaluateParticleCurve(renderer_SOLMinCurveX, normalizedAge), lifeSizeX, a_Random0.z);\n #endif\n\n #ifdef RENDERER_SOL_IS_SEPARATE\n float lifeSizeY = evaluateParticleCurve(renderer_SOLMaxCurveY, normalizedAge);\n #ifdef RENDERER_SOL_IS_RANDOM_TWO\n lifeSizeY = mix(evaluateParticleCurve(renderer_SOLMinCurveY, normalizedAge), lifeSizeY, a_Random0.z);\n #endif\n size *= vec2(lifeSizeX, lifeSizeY);\n #else\n size *= lifeSizeX;\n #endif\n #endif\n return size;\n}\n\n#ifdef RENDERER_MODE_MESH\n vec3 computeParticleSizeMesh(in vec3 size, in float normalizedAge) {\n #ifdef RENDERER_SOL_CURVE\n size *= evaluateParticleCurve(renderer_SOLMaxCurveX, normalizedAge);\n #endif\n #ifdef RENDERER_SOL_RANDOM_CURVES\n size *= mix(evaluateParticleCurve(renderer_SOLMaxCurveX, normalizedAge),\n evaluateParticleCurve(u_SOLSizeGradientMax, normalizedAge),\n a_Random0.z);\n #endif\n #ifdef RENDERER_SOL_CURVE_SEPARATE\n size *= vec3(evaluateParticleCurve(renderer_SOLMinCurveX, normalizedAge),\n evaluateParticleCurve(renderer_SOLMinCurveY, normalizedAge),\n evaluateParticleCurve(renderer_SOLMinCurveZ, normalizedAge));\n #endif\n #ifdef RENDERER_SOL_RANDOM_CURVES_SEPARATE\n size *= vec3(mix(evaluateParticleCurve(renderer_SOLMinCurveX, normalizedAge),\n evaluateParticleCurve(renderer_SOLMaxCurveX, normalizedAge),\n a_Random0.z),\n mix(evaluateParticleCurve(renderer_SOLMinCurveY, normalizedAge),\n evaluateParticleCurve(renderer_SOLMaxCurveY, normalizedAge),\n a_Random0.z),\n mix(evaluateParticleCurve(renderer_SOLMinCurveZ, normalizedAge),\n evaluateParticleCurve(renderer_SOLMaxCurveZ, normalizedAge),\n a_Random0.z));\n #endif\n return size;\n }\n#endif"; // eslint-disable-line
|
|
9881
9881
|
var color_over_lifetime_module = "#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\n uniform vec4 renderer_COLMaxGradientColor[4]; // x:time y:r z:g w:b\n uniform vec2 renderer_COLMaxGradientAlpha[4]; // x:time y:alpha\n\n #ifdef RENDERER_COL_RANDOM_GRADIENTS\n uniform vec4 renderer_COLMinGradientColor[4]; // x:time y:r z:g w:b\n uniform vec2 renderer_COLMinGradientAlpha[4]; // x:time y:alpha\n #endif\n\n uniform vec4 renderer_COLGradientKeysMaxTime; // x: minColorKeysMaxTime, y: minAlphaKeysMaxTime, z: maxColorKeysMaxTime, w: maxAlphaKeysMaxTime\n#endif\n\n\nvec4 computeParticleColor(in vec4 color, in float normalizedAge) {\n #if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\n vec4 gradientColor = evaluateParticleGradient(renderer_COLMaxGradientColor, renderer_COLGradientKeysMaxTime.z, renderer_COLMaxGradientAlpha, renderer_COLGradientKeysMaxTime.w, normalizedAge);\n #endif\n\n #ifdef RENDERER_COL_RANDOM_GRADIENTS\n gradientColor = mix(evaluateParticleGradient(renderer_COLMinGradientColor,renderer_COLGradientKeysMaxTime.x, renderer_COLMinGradientAlpha, renderer_COLGradientKeysMaxTime.y, normalizedAge), gradientColor, a_Random0.y);\n #endif\n\n #if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\n color *= gradientColor;\n #endif\n\n return color;\n}\n"; // eslint-disable-line
|
|
9882
9882
|
var texture_sheet_animation_module = "#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\n uniform float renderer_TSACycles;\n uniform vec3 renderer_TSATillingParams; // x:subU y:subV z:tileCount\n uniform vec2 renderer_TSAFrameMaxCurve[4]; // x:time y:value\n\n #ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\n uniform vec2 renderer_TSAFrameMinCurve[4]; // x:time y:value\n #endif\n#endif\n\nvec2 computeParticleUV(in vec2 uv, in float normalizedAge) {\n #if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\n float scaledNormalizedAge = normalizedAge * renderer_TSACycles;\n float cycleNormalizedAge = scaledNormalizedAge - floor(scaledNormalizedAge);\n float normalizedFrame = evaluateParticleCurve(renderer_TSAFrameMaxCurve, cycleNormalizedAge);\n #ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\n normalizedFrame = mix(evaluateParticleCurve(renderer_TSAFrameMinCurve, cycleNormalizedAge), normalizedFrame, a_Random1.x);\n #endif\n\n float frame = floor(normalizedFrame * renderer_TSATillingParams.z);\n\n float tileRow = frame * renderer_TSATillingParams.x;\n float tileRowIndex = floor(tileRow);\n uv.x += tileRow - tileRowIndex;\n uv.y += tileRowIndex * renderer_TSATillingParams.y;\n #endif\n \n return uv;\n}\n"; // eslint-disable-line
|
|
9883
|
-
var force_over_lifetime_module = "#if defined(RENDERER_FOL_CONSTANT_MODE) || defined(RENDERER_FOL_CURVE_MODE)\n #define _FOL_MODULE_ENABLED\n#endif\n\n#ifdef _FOL_MODULE_ENABLED\n
|
|
9883
|
+
var force_over_lifetime_module = "#if defined(RENDERER_FOL_CONSTANT_MODE) || defined(RENDERER_FOL_CURVE_MODE)\n #define _FOL_MODULE_ENABLED\n#endif\n\n#ifdef _FOL_MODULE_ENABLED\n uniform int renderer_FOLSpace;\n\n #ifdef RENDERER_FOL_CONSTANT_MODE\n uniform vec3 renderer_FOLMaxConst;\n\n #ifdef RENDERER_FOL_IS_RANDOM_TWO\n uniform vec3 renderer_FOLMinConst;\n #endif\n\n #endif\n\n #ifdef RENDERER_FOL_CURVE_MODE\n uniform vec2 renderer_FOLMaxGradientX[4];\n uniform vec2 renderer_FOLMaxGradientY[4];\n uniform vec2 renderer_FOLMaxGradientZ[4];\n\n #ifdef RENDERER_FOL_IS_RANDOM_TWO\n uniform vec2 renderer_FOLMinGradientX[4];\n uniform vec2 renderer_FOLMinGradientY[4];\n uniform vec2 renderer_FOLMinGradientZ[4];\n #endif\n #endif\n\n // (tHat - t1) * (tHat - t1) * (tHat - t1) * (a2 - a1) / ((t2 - t1) * 6.0) + a1 * (tHat - t1) * (tHat - t1) * 0.5 + v1 * (tHat - t1);\n // to = tHat - t1; tr = t2 - t1\n float computeDisplacementIntegral(in float to, in float tr, in float a1, in float a2, in float v1) {\n return to * to * to * (a2 - a1) / (tr * 6.0) + a1 * to * to * 0.5 + v1 * to;\n }\n\n float evaluateForceParticleCurveCumulative(in vec2 keys[4], in float normalizedAge, out float velocityCumulative) {\n float cumulativeValue = 0.0;\n velocityCumulative = 0.0;\n\n for (int i = 1; i < 4; i++){\n vec2 key = keys[i];\n vec2 lastKey = keys[i - 1];\n float timeRange = (key.x - lastKey.x) * a_ShapePositionStartLifeTime.w;\n\n if (key.x >= normalizedAge){\n float timeOffset = (normalizedAge - lastKey.x) * a_ShapePositionStartLifeTime.w;\n cumulativeValue += computeDisplacementIntegral(timeOffset, timeRange, lastKey.y, key.y, velocityCumulative);\n\n float finalAcceleration = mix(lastKey.y, key.y, timeOffset / timeRange);\n velocityCumulative += 0.5 * timeOffset * (finalAcceleration + lastKey.y);\n break;\n } else { \n cumulativeValue += computeDisplacementIntegral(timeRange, timeRange, lastKey.y, key.y, velocityCumulative);\n velocityCumulative += 0.5 * timeRange * (lastKey.y + key.y);\n }\n }\n return cumulativeValue;\n }\n\n vec3 computeForcePositionOffset(in float normalizedAge, in float age, out vec3 velocityOffset) {\n vec3 forcePosition;\n\n #if defined(RENDERER_FOL_CONSTANT_MODE)\n vec3 forceAcceleration = renderer_FOLMaxConst;\n\n #ifdef RENDERER_FOL_IS_RANDOM_TWO\n forceAcceleration = mix(renderer_FOLMinConst, forceAcceleration, vec3(a_Random2.x, a_Random2.y, a_Random2.z));\n #endif\n\n velocityOffset = forceAcceleration * age;\n\n forcePosition = 0.5 * forceAcceleration * age * age;\n #elif defined(RENDERER_FOL_CURVE_MODE)\n forcePosition = vec3(\n evaluateForceParticleCurveCumulative(renderer_FOLMaxGradientX, normalizedAge, velocityOffset.x),\n evaluateForceParticleCurveCumulative(renderer_FOLMaxGradientY, normalizedAge, velocityOffset.y),\n evaluateForceParticleCurveCumulative(renderer_FOLMaxGradientZ, normalizedAge, velocityOffset.z)\n );\n #ifdef RENDERER_FOL_IS_RANDOM_TWO\n vec3 minVelocityOffset;\n\n forcePosition = vec3(\n mix(evaluateForceParticleCurveCumulative(renderer_FOLMinGradientX, normalizedAge, minVelocityOffset.x), forcePosition.x, a_Random2.x),\n mix(evaluateForceParticleCurveCumulative(renderer_FOLMinGradientY, normalizedAge, minVelocityOffset.y), forcePosition.y, a_Random2.y),\n mix(evaluateForceParticleCurveCumulative(renderer_FOLMinGradientZ, normalizedAge, minVelocityOffset.z), forcePosition.z, a_Random2.z)\n );\n\n velocityOffset = mix(minVelocityOffset, velocityOffset, vec3(a_Random2.x, a_Random2.y, a_Random2.z));\n #endif\n #endif\n return forcePosition;\n }\n#endif"; // eslint-disable-line
|
|
9884
|
+
var limit_velocity_over_lifetime_module = "#ifdef RENDERER_LVL_MODULE_ENABLED\n uniform int renderer_LVLSpace;\n uniform float renderer_LVLDampen;\n\n // Scalar limit\n #ifndef RENDERER_LVL_SEPARATE_AXES\n #ifdef RENDERER_LVL_LIMIT_CONSTANT_MODE\n uniform float renderer_LVLLimitMaxConst;\n #ifdef RENDERER_LVL_LIMIT_IS_RANDOM_TWO\n uniform float renderer_LVLLimitMinConst;\n #endif\n #endif\n #ifdef RENDERER_LVL_LIMIT_CURVE_MODE\n uniform vec2 renderer_LVLLimitMaxCurve[4];\n #ifdef RENDERER_LVL_LIMIT_IS_RANDOM_TWO\n uniform vec2 renderer_LVLLimitMinCurve[4];\n #endif\n #endif\n #endif\n\n // Per-axis limit\n #ifdef RENDERER_LVL_SEPARATE_AXES\n #ifdef RENDERER_LVL_LIMIT_CONSTANT_MODE\n uniform vec3 renderer_LVLLimitMaxConstVector;\n #ifdef RENDERER_LVL_LIMIT_IS_RANDOM_TWO\n uniform vec3 renderer_LVLLimitMinConstVector;\n #endif\n #endif\n #ifdef RENDERER_LVL_LIMIT_CURVE_MODE\n uniform vec2 renderer_LVLLimitXMaxCurve[4];\n uniform vec2 renderer_LVLLimitYMaxCurve[4];\n uniform vec2 renderer_LVLLimitZMaxCurve[4];\n #ifdef RENDERER_LVL_LIMIT_IS_RANDOM_TWO\n uniform vec2 renderer_LVLLimitXMinCurve[4];\n uniform vec2 renderer_LVLLimitYMinCurve[4];\n uniform vec2 renderer_LVLLimitZMinCurve[4];\n #endif\n #endif\n #endif\n\n // Drag curve\n #ifdef RENDERER_LVL_DRAG_CURVE_MODE\n uniform vec2 renderer_LVLDragMaxCurve[4];\n #ifdef RENDERER_LVL_DRAG_IS_RANDOM_TWO\n uniform vec2 renderer_LVLDragMinCurve[4];\n #endif\n #endif\n\n float evaluateLVLDrag(float normalizedAge, float dragRand) {\n #ifdef RENDERER_LVL_DRAG_CURVE_MODE\n float dragMax = evaluateParticleCurve(renderer_LVLDragMaxCurve, normalizedAge);\n #ifdef RENDERER_LVL_DRAG_IS_RANDOM_TWO\n float dragMin = evaluateParticleCurve(renderer_LVLDragMinCurve, normalizedAge);\n return mix(dragMin, dragMax, dragRand);\n #else\n return dragMax;\n #endif\n #else\n return mix(renderer_LVLDragConstant.x, renderer_LVLDragConstant.y, dragRand);\n #endif\n }\n\n vec3 applyLVLSpeedLimitTF(vec3 velocity, float normalizedAge, float limitRand, float effectiveDampen) {\n #ifdef RENDERER_LVL_SEPARATE_AXES\n vec3 limitValue;\n #ifdef RENDERER_LVL_LIMIT_CONSTANT_MODE\n limitValue = renderer_LVLLimitMaxConstVector;\n #ifdef RENDERER_LVL_LIMIT_IS_RANDOM_TWO\n limitValue = mix(renderer_LVLLimitMinConstVector, limitValue, limitRand);\n #endif\n #endif\n #ifdef RENDERER_LVL_LIMIT_CURVE_MODE\n limitValue = vec3(\n evaluateParticleCurve(renderer_LVLLimitXMaxCurve, normalizedAge),\n evaluateParticleCurve(renderer_LVLLimitYMaxCurve, normalizedAge),\n evaluateParticleCurve(renderer_LVLLimitZMaxCurve, normalizedAge)\n );\n #ifdef RENDERER_LVL_LIMIT_IS_RANDOM_TWO\n vec3 minLimitValue = vec3(\n evaluateParticleCurve(renderer_LVLLimitXMinCurve, normalizedAge),\n evaluateParticleCurve(renderer_LVLLimitYMinCurve, normalizedAge),\n evaluateParticleCurve(renderer_LVLLimitZMinCurve, normalizedAge)\n );\n limitValue = mix(minLimitValue, limitValue, limitRand);\n #endif\n #endif\n\n vec3 absVel = abs(velocity);\n vec3 excess = max(absVel - limitValue, vec3(0.0));\n velocity = sign(velocity) * (absVel - excess * effectiveDampen);\n #else\n float limitValue;\n #ifdef RENDERER_LVL_LIMIT_CONSTANT_MODE\n limitValue = renderer_LVLLimitMaxConst;\n #ifdef RENDERER_LVL_LIMIT_IS_RANDOM_TWO\n limitValue = mix(renderer_LVLLimitMinConst, limitValue, limitRand);\n #endif\n #endif\n #ifdef RENDERER_LVL_LIMIT_CURVE_MODE\n limitValue = evaluateParticleCurve(renderer_LVLLimitMaxCurve, normalizedAge);\n #ifdef RENDERER_LVL_LIMIT_IS_RANDOM_TWO\n float minLimitValue = evaluateParticleCurve(renderer_LVLLimitMinCurve, normalizedAge);\n limitValue = mix(minLimitValue, limitValue, limitRand);\n #endif\n #endif\n\n float speed = length(velocity);\n if (speed > limitValue && speed > 0.0) {\n float excess = speed - limitValue;\n velocity = velocity * ((speed - excess * effectiveDampen) / speed);\n }\n #endif\n return velocity;\n }\n\n#endif\n"; // eslint-disable-line
|
|
9885
|
+
var particle_feedback_simulation = "// Transform Feedback update shader for particle simulation.\n// Update order: VOL/FOL → Dampen → Drag → Position.\n// Runs once per particle per frame (no rasterization).\n\n// Previous frame TF data\nattribute vec3 a_FeedbackPosition;\nattribute vec3 a_FeedbackVelocity;\n\n// Per-particle instance data\nattribute vec4 a_ShapePositionStartLifeTime;\nattribute vec4 a_DirectionTime;\nattribute vec3 a_StartSize;\nattribute float a_StartSpeed;\nattribute vec4 a_Random0;\nattribute vec4 a_Random1;\nattribute vec3 a_SimulationWorldPosition;\nattribute vec4 a_SimulationWorldRotation;\nattribute vec4 a_Random2;\n\n// Uniforms\nuniform float renderer_CurrentTime;\nuniform float renderer_DeltaTime;\nuniform vec3 renderer_Gravity;\nuniform vec2 renderer_LVLDragConstant;\nuniform vec3 renderer_WorldPosition;\nuniform vec4 renderer_WorldRotation;\nuniform int renderer_SimulationSpace;\n\n// TF outputs\nvarying vec3 v_FeedbackPosition;\nvarying vec3 v_FeedbackVelocity;\n\n#include <particle_common>\n#include <velocity_over_lifetime_module>\n#include <force_over_lifetime_module>\n#include <limit_velocity_over_lifetime_module>\n\n// Get VOL instantaneous velocity at normalizedAge\nvec3 getVOLVelocity(float normalizedAge) {\n vec3 vel = vec3(0.0);\n #ifdef _VOL_MODULE_ENABLED\n #ifdef RENDERER_VOL_CONSTANT_MODE\n vel = renderer_VOLMaxConst;\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n vel = mix(renderer_VOLMinConst, vel, a_Random1.yzw);\n #endif\n #endif\n #ifdef RENDERER_VOL_CURVE_MODE\n vel = vec3(\n evaluateParticleCurve(renderer_VOLMaxGradientX, normalizedAge),\n evaluateParticleCurve(renderer_VOLMaxGradientY, normalizedAge),\n evaluateParticleCurve(renderer_VOLMaxGradientZ, normalizedAge)\n );\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n vec3 minVel = vec3(\n evaluateParticleCurve(renderer_VOLMinGradientX, normalizedAge),\n evaluateParticleCurve(renderer_VOLMinGradientY, normalizedAge),\n evaluateParticleCurve(renderer_VOLMinGradientZ, normalizedAge)\n );\n vel = mix(minVel, vel, a_Random1.yzw);\n #endif\n #endif\n #endif\n return vel;\n}\n\n// Get FOL instantaneous acceleration at normalizedAge\nvec3 getFOLAcceleration(float normalizedAge) {\n vec3 acc = vec3(0.0);\n #ifdef _FOL_MODULE_ENABLED\n #ifdef RENDERER_FOL_CONSTANT_MODE\n acc = renderer_FOLMaxConst;\n #ifdef RENDERER_FOL_IS_RANDOM_TWO\n acc = mix(renderer_FOLMinConst, acc, vec3(a_Random2.x, a_Random2.y, a_Random2.z));\n #endif\n #endif\n #ifdef RENDERER_FOL_CURVE_MODE\n acc = vec3(\n evaluateParticleCurve(renderer_FOLMaxGradientX, normalizedAge),\n evaluateParticleCurve(renderer_FOLMaxGradientY, normalizedAge),\n evaluateParticleCurve(renderer_FOLMaxGradientZ, normalizedAge)\n );\n #ifdef RENDERER_FOL_IS_RANDOM_TWO\n vec3 minAcc = vec3(\n evaluateParticleCurve(renderer_FOLMinGradientX, normalizedAge),\n evaluateParticleCurve(renderer_FOLMinGradientY, normalizedAge),\n evaluateParticleCurve(renderer_FOLMinGradientZ, normalizedAge)\n );\n acc = mix(minAcc, acc, vec3(a_Random2.x, a_Random2.y, a_Random2.z));\n #endif\n #endif\n #endif\n return acc;\n}\n\nvoid main() {\n float age = renderer_CurrentTime - a_DirectionTime.w;\n float lifetime = a_ShapePositionStartLifeTime.w;\n float normalizedAge = age / lifetime;\n // Clamp to age on the first TF pass: particles emitted mid-frame have age < dt,\n // so using the full dt would over-integrate. Subsequent passes are unaffected (age >= dt).\n float dt = min(renderer_DeltaTime, age);\n\n // normalizedAge < 0.0: stale TF slot whose startTime is from a previous playback (e.g. after StopEmittingAndClear).\n if (normalizedAge >= 1.0 || normalizedAge < 0.0) {\n v_FeedbackPosition = a_FeedbackPosition;\n v_FeedbackVelocity = a_FeedbackVelocity;\n gl_Position = vec4(0.0);\n return;\n }\n\n vec4 worldRotation;\n if (renderer_SimulationSpace == 0) {\n worldRotation = renderer_WorldRotation;\n } else {\n worldRotation = a_SimulationWorldRotation;\n }\n vec4 invWorldRotation = quaternionConjugate(worldRotation);\n\n // Read previous frame state (initialized by CPU on particle birth)\n vec3 localVelocity = a_FeedbackVelocity;\n\n // =====================================================\n // Step 1: Apply velocity module deltas (VOL + FOL + Gravity)\n // =====================================================\n\n // Gravity (world space)\n vec3 gravityDelta = renderer_Gravity * a_Random0.x * dt;\n\n // VOL instantaneous velocity (animated velocity, not persisted)\n vec3 volLocal = vec3(0.0);\n vec3 volWorld = vec3(0.0);\n #ifdef _VOL_MODULE_ENABLED\n vec3 vol = getVOLVelocity(normalizedAge);\n if (renderer_VOLSpace == 0) {\n volLocal = vol;\n } else {\n volWorld = vol;\n }\n #endif\n\n // FOL acceleration → velocity delta (always persisted, like gravity)\n vec3 folDeltaLocal = vec3(0.0);\n #ifdef _FOL_MODULE_ENABLED\n vec3 folAcc = getFOLAcceleration(normalizedAge);\n vec3 folVelDelta = folAcc * dt;\n if (renderer_FOLSpace == 0) {\n folDeltaLocal = folVelDelta;\n } else {\n // World FOL: convert to local and persist, same as gravity\n folDeltaLocal = rotationByQuaternions(folVelDelta, invWorldRotation);\n }\n #endif\n\n // Gravity and FOL contribute to base velocity (persisted, subject to dampen/drag).\n vec3 gravityLocal = rotationByQuaternions(gravityDelta, invWorldRotation);\n localVelocity += folDeltaLocal + gravityLocal;\n\n // =====================================================\n // Step 2 & 3: Dampen (Limit Velocity) + Drag\n // VOL must be projected into the LVL target space so that\n // limit/drag see the full velocity regardless of VOL.space vs LVL.space.\n // =====================================================\n #ifdef RENDERER_LVL_MODULE_ENABLED\n // Precompute VOL in both spaces\n vec3 volAsLocal = volLocal + rotationByQuaternions(volWorld, invWorldRotation);\n vec3 volAsWorld = rotationByQuaternions(volLocal, worldRotation) + volWorld;\n\n float limitRand = a_Random2.w;\n float dampen = renderer_LVLDampen;\n // Frame-rate independent dampen (30fps as reference)\n float effectiveDampen = 1.0 - pow(1.0 - dampen, dt * 30.0);\n\n if (renderer_LVLSpace == 0) {\n // Local space: total = base + all VOL projected to local\n vec3 totalLocal = localVelocity + volAsLocal;\n vec3 dampenedTotal = applyLVLSpeedLimitTF(totalLocal, normalizedAge, limitRand, effectiveDampen);\n localVelocity = dampenedTotal - volAsLocal;\n } else {\n // World space: total = rotated base + all VOL projected to world\n vec3 totalWorld = rotationByQuaternions(localVelocity, worldRotation) + volAsWorld;\n vec3 dampenedTotal = applyLVLSpeedLimitTF(totalWorld, normalizedAge, limitRand, effectiveDampen);\n localVelocity = rotationByQuaternions(dampenedTotal - volAsWorld, invWorldRotation);\n }\n\n // Drag: same space as dampen\n {\n float dragCoeff = evaluateLVLDrag(normalizedAge, a_Random2.w);\n if (dragCoeff > 0.0) {\n vec3 totalVel;\n if (renderer_LVLSpace == 0) {\n totalVel = localVelocity + volAsLocal;\n } else {\n totalVel = rotationByQuaternions(localVelocity, worldRotation) + volAsWorld;\n }\n float velMagSqr = dot(totalVel, totalVel);\n float velMag = sqrt(velMagSqr);\n\n float drag = dragCoeff;\n\n #ifdef RENDERER_LVL_DRAG_MULTIPLY_SIZE\n float maxDim = max(a_StartSize.x, max(a_StartSize.y, a_StartSize.z));\n float radius = maxDim * 0.5;\n drag *= 3.14159265 * radius * radius;\n #endif\n\n #ifdef RENDERER_LVL_DRAG_MULTIPLY_VELOCITY\n drag *= velMagSqr;\n #endif\n\n if (velMag > 0.0) {\n float newVelMag = max(0.0, velMag - drag * dt);\n vec3 draggedTotal = totalVel * (newVelMag / velMag);\n if (renderer_LVLSpace == 0) {\n localVelocity = draggedTotal - volAsLocal;\n } else {\n localVelocity = rotationByQuaternions(draggedTotal - volAsWorld, invWorldRotation);\n }\n }\n }\n }\n #endif\n\n // =====================================================\n // Step 4: Integrate position in simulation space\n // Local mode: position in local space, velocity rotated to local\n // World mode: position in world space, velocity rotated to world\n // =====================================================\n // FOL is now fully in localVelocity (both local and world-space FOL).\n // Only VOL overlay needs to be added here.\n vec3 totalVelocity;\n if (renderer_SimulationSpace == 0) {\n // Local: integrate in local space\n totalVelocity = localVelocity + volLocal\n + rotationByQuaternions(volWorld, invWorldRotation);\n } else {\n // World: integrate in world space\n totalVelocity = rotationByQuaternions(localVelocity + volLocal, worldRotation) + volWorld;\n }\n vec3 position = a_FeedbackPosition + totalVelocity * dt;\n\n v_FeedbackPosition = position;\n v_FeedbackVelocity = localVelocity;\n gl_Position = vec4(0.0);\n}\n"; // eslint-disable-line
|
|
9884
9886
|
var sphere_billboard = "#ifdef RENDERER_MODE_SPHERE_BILLBOARD\n\tvec2 corner = a_CornerTextureCoordinate.xy + renderer_PivotOffset.xy;\n\tvec3 sideVector = normalize(cross(camera_Forward, camera_Up));\n\tvec3 upVector = normalize(cross(sideVector, camera_Forward));\n\tcorner *= computeParticleSizeBillboard(a_StartSize.xy, normalizedAge);\n #if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n if (renderer_ThreeDStartRotation) {\n vec3 rotation = radians(vec3(a_StartRotation0.xy, computeParticleRotationFloat(a_StartRotation0.z, age, normalizedAge)));\n center += renderer_SizeScale.xzy * rotationByEuler(corner.x * sideVector + corner.y * upVector, rotation);\n } else {\n float rot = radians(computeParticleRotationFloat(a_StartRotation0.x, age, normalizedAge));\n float c = cos(rot);\n float s = sin(rot);\n mat2 rotation = mat2(c, -s, s, c);\n corner = rotation * corner;\n center += renderer_SizeScale.xzy * (corner.x * sideVector + corner.y * upVector);\n }\n #else\n if (renderer_ThreeDStartRotation) {\n center += renderer_SizeScale.xzy * rotationByEuler(corner.x * sideVector + corner.y * upVector, radians(a_StartRotation0));\n } else {\n float c = cos(radians(a_StartRotation0.x));\n float s = sin(radians(a_StartRotation0.x));\n mat2 rotation = mat2(c, -s, s, c);\n corner = rotation * corner;\n center += renderer_SizeScale.xzy * (corner.x * sideVector + corner.y * upVector);\n }\n #endif\n#endif"; // eslint-disable-line
|
|
9885
9887
|
var stretched_billboard = "#ifdef RENDERER_MODE_STRETCHED_BILLBOARD\n\tvec2 corner = a_CornerTextureCoordinate.xy + renderer_PivotOffset.xy;\n\tvec3 velocity = rotationByQuaternions(renderer_SizeScale * localVelocity, worldRotation) + worldVelocity;\n\tvec3 cameraUpVector = normalize(velocity);\n\tvec3 direction = normalize(center - camera_Position);\n\tvec3 sideVector = normalize(cross(direction, normalize(velocity)));\n\n\tsideVector = renderer_SizeScale.xzy * sideVector;\n\tcameraUpVector = length(vec3(renderer_SizeScale.x, 0.0, 0.0)) * cameraUpVector;\n\n\tvec2 size = computeParticleSizeBillboard(a_StartSize.xy, normalizedAge);\n\n\tconst mat2 rotationZHalfPI = mat2(0.0, -1.0, 1.0, 0.0);\n\tcorner = rotationZHalfPI * corner;\n\tcorner.y = corner.y - abs(corner.y);\n\n\tfloat speed = length(velocity); // TODO:\n\tcenter += sign(renderer_SizeScale.x) * (sign(renderer_StretchedBillboardLengthScale) * size.x * corner.x * sideVector\n\t + (speed * renderer_StretchedBillboardSpeedScale + size.y * renderer_StretchedBillboardLengthScale) * corner.y * cameraUpVector);\n#endif"; // eslint-disable-line
|
|
9886
9888
|
var vertical_billboard = "#ifdef RENDERER_MODE_VERTICAL_BILLBOARD\n\tvec2 corner = a_CornerTextureCoordinate.xy + renderer_PivotOffset.xy; // Billboard模式z轴无效\n\tconst vec3 cameraUpVector = vec3(0.0, 1.0, 0.0);\n\tvec3 sideVector = normalize(cross(camera_Forward, cameraUpVector));\n\n\tfloat rot = radians(computeParticleRotationFloat(a_StartRotation0.x, age, normalizedAge));\n\tfloat c = cos(rot);\n\tfloat s = sin(rot);\n\tmat2 rotation = mat2(c, -s, s, c);\n\tcorner = rotation * corner * cos(0.78539816339744830961566084581988); // TODO:临时缩小cos45,不确定U3D原因\n\tcorner *= computeParticleSizeBillboard(a_StartSize.xy, normalizedAge);\n\tcenter += renderer_SizeScale.xzy * (corner.x * sideVector + corner.y * cameraUpVector);\n#endif"; // eslint-disable-line
|
|
@@ -9894,6 +9896,8 @@ var ParticleShaderLib = {
|
|
|
9894
9896
|
color_over_lifetime_module: color_over_lifetime_module,
|
|
9895
9897
|
texture_sheet_animation_module: texture_sheet_animation_module,
|
|
9896
9898
|
force_over_lifetime_module: force_over_lifetime_module,
|
|
9899
|
+
limit_velocity_over_lifetime_module: limit_velocity_over_lifetime_module,
|
|
9900
|
+
particle_feedback_simulation: particle_feedback_simulation,
|
|
9897
9901
|
sphere_billboard: sphere_billboard,
|
|
9898
9902
|
stretched_billboard: stretched_billboard,
|
|
9899
9903
|
vertical_billboard: vertical_billboard,
|
|
@@ -9957,6 +9961,41 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
9957
9961
|
return "#define " + (m.value ? m.name + " " + m.value : m.name) + "\n";
|
|
9958
9962
|
}).join("");
|
|
9959
9963
|
};
|
|
9964
|
+
/**
|
|
9965
|
+
* @internal
|
|
9966
|
+
* Compile vertex and fragment source with standard macros, includes, and version header.
|
|
9967
|
+
* @param engine - Engine instance
|
|
9968
|
+
* @param macroCollection - Current macro collection
|
|
9969
|
+
* @param vertexSource - Raw vertex shader source (may contain #include)
|
|
9970
|
+
* @param fragmentSource - Raw fragment shader source
|
|
9971
|
+
* @returns Compiled { vertexSource, fragmentSource } ready for ShaderProgram
|
|
9972
|
+
*/ ShaderFactory.compilePlatformSource = function compilePlatformSource(engine, macroCollection, vertexSource, fragmentSource) {
|
|
9973
|
+
var isWebGL2 = engine._hardwareRenderer.isWebGL2;
|
|
9974
|
+
var shaderMacroList = new Array();
|
|
9975
|
+
ShaderMacro._getMacrosElements(macroCollection, shaderMacroList);
|
|
9976
|
+
shaderMacroList.push(ShaderMacro.getByName(isWebGL2 ? "GRAPHICS_API_WEBGL2" : "GRAPHICS_API_WEBGL1"));
|
|
9977
|
+
if (engine._hardwareRenderer.canIUse(GLCapabilityType.shaderTextureLod)) {
|
|
9978
|
+
shaderMacroList.push(ShaderMacro.getByName("HAS_TEX_LOD"));
|
|
9979
|
+
}
|
|
9980
|
+
if (engine._hardwareRenderer.canIUse(GLCapabilityType.standardDerivatives)) {
|
|
9981
|
+
shaderMacroList.push(ShaderMacro.getByName("HAS_DERIVATIVES"));
|
|
9982
|
+
}
|
|
9983
|
+
var noIncludeVertex = ShaderFactory.parseIncludes(vertexSource);
|
|
9984
|
+
var noIncludeFrag = ShaderFactory.parseIncludes(fragmentSource);
|
|
9985
|
+
var macroStr = ShaderFactory.parseCustomMacros(shaderMacroList);
|
|
9986
|
+
noIncludeVertex = macroStr + noIncludeVertex;
|
|
9987
|
+
noIncludeFrag = macroStr + noIncludeFrag;
|
|
9988
|
+
if (isWebGL2) {
|
|
9989
|
+
noIncludeVertex = ShaderFactory.convertTo300(noIncludeVertex);
|
|
9990
|
+
noIncludeFrag = ShaderFactory.convertTo300(noIncludeFrag, true);
|
|
9991
|
+
}
|
|
9992
|
+
var versionStr = isWebGL2 ? "#version 300 es" : "#version 100";
|
|
9993
|
+
var precisionStr = "\n#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n#else\n precision mediump float;\n precision mediump int;\n#endif\n";
|
|
9994
|
+
return {
|
|
9995
|
+
vertexSource: versionStr + "\nprecision highp float;\n" + noIncludeVertex,
|
|
9996
|
+
fragmentSource: versionStr + "\n" + (isWebGL2 ? "" : ShaderFactory._shaderExtension) + precisionStr + noIncludeFrag
|
|
9997
|
+
};
|
|
9998
|
+
};
|
|
9960
9999
|
ShaderFactory.registerInclude = function registerInclude(includeName, includeSource) {
|
|
9961
10000
|
if (ShaderLib[includeName]) {
|
|
9962
10001
|
throw 'The "' + includeName + '" shader include already exist';
|
|
@@ -10284,7 +10323,7 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
10284
10323
|
* Shader program, corresponding to the GPU shader program.
|
|
10285
10324
|
* @internal
|
|
10286
10325
|
*/ var ShaderProgram = /*#__PURE__*/ function() {
|
|
10287
|
-
function ShaderProgram(engine, vertexSource, fragmentSource) {
|
|
10326
|
+
function ShaderProgram(engine, vertexSource, fragmentSource, transformFeedbackVaryings) {
|
|
10288
10327
|
this.sceneUniformBlock = new ShaderUniformBlock();
|
|
10289
10328
|
this.cameraUniformBlock = new ShaderUniformBlock();
|
|
10290
10329
|
this.rendererUniformBlock = new ShaderUniformBlock();
|
|
@@ -10300,7 +10339,7 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
10300
10339
|
this._activeTextureUint = 0;
|
|
10301
10340
|
this._engine = engine;
|
|
10302
10341
|
this._gl = engine._hardwareRenderer.gl;
|
|
10303
|
-
this._glProgram = this._createProgram(vertexSource, fragmentSource);
|
|
10342
|
+
this._glProgram = this._createProgram(vertexSource, fragmentSource, transformFeedbackVaryings);
|
|
10304
10343
|
if (this._glProgram) {
|
|
10305
10344
|
this._isValid = true;
|
|
10306
10345
|
this._recordLocation();
|
|
@@ -10446,7 +10485,7 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
10446
10485
|
};
|
|
10447
10486
|
/**
|
|
10448
10487
|
* Init and link program with shader.
|
|
10449
|
-
*/ _proto._createProgram = function _createProgram(vertexSource, fragmentSource) {
|
|
10488
|
+
*/ _proto._createProgram = function _createProgram(vertexSource, fragmentSource, transformFeedbackVaryings) {
|
|
10450
10489
|
var gl = this._gl;
|
|
10451
10490
|
// Create and compile shader
|
|
10452
10491
|
var vertexShader = this._createShader(gl.VERTEX_SHADER, vertexSource);
|
|
@@ -10464,6 +10503,10 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
10464
10503
|
}
|
|
10465
10504
|
gl.attachShader(program, vertexShader);
|
|
10466
10505
|
gl.attachShader(program, fragmentShader);
|
|
10506
|
+
// Set Transform Feedback varyings before linking (WebGL2 only)
|
|
10507
|
+
if (transformFeedbackVaryings == null ? void 0 : transformFeedbackVaryings.length) {
|
|
10508
|
+
gl.transformFeedbackVaryings(program, transformFeedbackVaryings, gl.INTERLEAVED_ATTRIBS);
|
|
10509
|
+
}
|
|
10467
10510
|
gl.linkProgram(program);
|
|
10468
10511
|
gl.validateProgram(program);
|
|
10469
10512
|
gl.deleteShader(vertexShader);
|
|
@@ -10726,7 +10769,7 @@ var precisionStr = "\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision hig
|
|
|
10726
10769
|
/**
|
|
10727
10770
|
* @internal
|
|
10728
10771
|
*/ _proto._getShaderProgram = function _getShaderProgram(engine, macroCollection) {
|
|
10729
|
-
var shaderProgramPool = engine._getShaderProgramPool(this);
|
|
10772
|
+
var shaderProgramPool = engine._getShaderProgramPool(this._shaderPassId, this._shaderProgramPools);
|
|
10730
10773
|
var shaderProgram = shaderProgramPool.get(macroCollection);
|
|
10731
10774
|
if (shaderProgram) {
|
|
10732
10775
|
return shaderProgram;
|
|
@@ -10748,6 +10791,13 @@ var precisionStr = "\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision hig
|
|
|
10748
10791
|
shaderProgramPools.length = 0;
|
|
10749
10792
|
};
|
|
10750
10793
|
_proto._getCanonicalShaderProgram = function _getCanonicalShaderProgram(engine, macroCollection) {
|
|
10794
|
+
if (this._platformTarget != undefined) {
|
|
10795
|
+
return this._getShaderLabProgram(engine, macroCollection);
|
|
10796
|
+
}
|
|
10797
|
+
var _ShaderFactory_compilePlatformSource = ShaderFactory.compilePlatformSource(engine, macroCollection, this._vertexSource, this._fragmentSource), vertexSource = _ShaderFactory_compilePlatformSource.vertexSource, fragmentSource = _ShaderFactory_compilePlatformSource.fragmentSource;
|
|
10798
|
+
return new ShaderProgram(engine, vertexSource, fragmentSource);
|
|
10799
|
+
};
|
|
10800
|
+
_proto._getShaderLabProgram = function _getShaderLabProgram(engine, macroCollection) {
|
|
10751
10801
|
var isWebGL2 = engine._hardwareRenderer.isWebGL2;
|
|
10752
10802
|
var shaderMacroList = new Array();
|
|
10753
10803
|
ShaderMacro._getMacrosElements(macroCollection, shaderMacroList);
|
|
@@ -10758,32 +10808,22 @@ var precisionStr = "\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision hig
|
|
|
10758
10808
|
if (engine._hardwareRenderer.canIUse(GLCapabilityType.standardDerivatives)) {
|
|
10759
10809
|
shaderMacroList.push(ShaderMacro.getByName("HAS_DERIVATIVES"));
|
|
10760
10810
|
}
|
|
10761
|
-
// Compatible with non-shaderlab syntax
|
|
10762
10811
|
var noIncludeVertex = ShaderFactory.parseIncludes(this._vertexSource);
|
|
10763
10812
|
var noIncludeFrag = ShaderFactory.parseIncludes(this._fragmentSource);
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
noIncludeFrag = Shader._shaderLab._parseMacros(noIncludeFrag, shaderMacroList);
|
|
10768
|
-
} else {
|
|
10769
|
-
var macroNameStr = ShaderFactory.parseCustomMacros(shaderMacroList);
|
|
10770
|
-
noIncludeVertex = macroNameStr + noIncludeVertex;
|
|
10771
|
-
noIncludeFrag = macroNameStr + noIncludeFrag;
|
|
10772
|
-
}
|
|
10773
|
-
// Need to convert to 300 es when the target is GLSL ES 100 or unkdown
|
|
10774
|
-
if (isWebGL2 && (this._platformTarget == undefined || this._platformTarget === ShaderLanguage.GLSLES100)) {
|
|
10813
|
+
noIncludeVertex = Shader._shaderLab._parseMacros(noIncludeVertex, shaderMacroList);
|
|
10814
|
+
noIncludeFrag = Shader._shaderLab._parseMacros(noIncludeFrag, shaderMacroList);
|
|
10815
|
+
if (isWebGL2 && this._platformTarget === ShaderLanguage.GLSLES100) {
|
|
10775
10816
|
noIncludeVertex = ShaderFactory.convertTo300(noIncludeVertex);
|
|
10776
10817
|
noIncludeFrag = ShaderFactory.convertTo300(noIncludeFrag, true);
|
|
10777
10818
|
}
|
|
10778
10819
|
var versionStr = isWebGL2 ? "#version 300 es" : "#version 100";
|
|
10779
|
-
var vertexSource = " " + versionStr + "
|
|
10820
|
+
var vertexSource = " " + versionStr + "\n " + noIncludeVertex + "\n ";
|
|
10780
10821
|
var fragmentSource = " " + versionStr + "\n " + (isWebGL2 ? "" : ShaderFactory._shaderExtension) + "\n " + precisionStr + "\n " + noIncludeFrag + "\n ";
|
|
10781
|
-
|
|
10782
|
-
return shaderProgram;
|
|
10822
|
+
return new ShaderProgram(engine, vertexSource, fragmentSource);
|
|
10783
10823
|
};
|
|
10784
10824
|
return ShaderPass;
|
|
10785
10825
|
}(ShaderPart);
|
|
10786
|
-
ShaderPass._shaderPassCounter = 0;
|
|
10826
|
+
/** @internal */ ShaderPass._shaderPassCounter = 0;
|
|
10787
10827
|
/** @internal */ ShaderPass._shaderRootPath = "shaders://root/";
|
|
10788
10828
|
/**
|
|
10789
10829
|
* Sub shader.
|
|
@@ -23298,6 +23338,15 @@ var TextChunk = function TextChunk() {
|
|
|
23298
23338
|
this._platformBuffer.getData(data, bufferByteOffset, dataOffset, dataLength);
|
|
23299
23339
|
};
|
|
23300
23340
|
/**
|
|
23341
|
+
* Copy data from another buffer on the GPU.
|
|
23342
|
+
* @param srcBuffer - Source buffer
|
|
23343
|
+
* @param srcByteOffset - Byte offset in the source buffer
|
|
23344
|
+
* @param dstByteOffset - Byte offset in this buffer
|
|
23345
|
+
* @param byteLength - Number of bytes to copy
|
|
23346
|
+
*/ _proto.copyFromBuffer = function copyFromBuffer(srcBuffer, srcByteOffset, dstByteOffset, byteLength) {
|
|
23347
|
+
this._platformBuffer.copyFromBuffer(srcBuffer._platformBuffer, srcByteOffset, dstByteOffset, byteLength);
|
|
23348
|
+
};
|
|
23349
|
+
/**
|
|
23301
23350
|
* Mark buffer as readable, the `data` property will be not accessible anymore.
|
|
23302
23351
|
*/ _proto.markAsUnreadable = function markAsUnreadable() {
|
|
23303
23352
|
this._data = null;
|
|
@@ -23587,8 +23636,8 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
23587
23636
|
/**
|
|
23588
23637
|
* Buffer binding flag.
|
|
23589
23638
|
*/ var BufferBindFlag = /*#__PURE__*/ function(BufferBindFlag) {
|
|
23590
|
-
/** Vertex buffer binding flag */ BufferBindFlag[BufferBindFlag["VertexBuffer"] = 0] = "VertexBuffer";
|
|
23591
|
-
/** Index buffer binding flag */ BufferBindFlag[BufferBindFlag["IndexBuffer"] = 1] = "IndexBuffer";
|
|
23639
|
+
/** Vertex buffer binding flag. */ BufferBindFlag[BufferBindFlag["VertexBuffer"] = 0] = "VertexBuffer";
|
|
23640
|
+
/** Index buffer binding flag. */ BufferBindFlag[BufferBindFlag["IndexBuffer"] = 1] = "IndexBuffer";
|
|
23592
23641
|
return BufferBindFlag;
|
|
23593
23642
|
}({});
|
|
23594
23643
|
/**
|
|
@@ -30960,6 +31009,14 @@ PointerEventEmitter._tempRay = new Ray();
|
|
|
30960
31009
|
ParticleBillboardVertexAttribute["cornerTextureCoordinate"] = "a_CornerTextureCoordinate";
|
|
30961
31010
|
return ParticleBillboardVertexAttribute;
|
|
30962
31011
|
}({});
|
|
31012
|
+
/**
|
|
31013
|
+
* @internal
|
|
31014
|
+
* Vertex attributes for the Transform Feedback buffer.
|
|
31015
|
+
*/ var ParticleFeedbackVertexAttribute = /*#__PURE__*/ function(ParticleFeedbackVertexAttribute) {
|
|
31016
|
+
ParticleFeedbackVertexAttribute["Position"] = "a_FeedbackPosition";
|
|
31017
|
+
ParticleFeedbackVertexAttribute["Velocity"] = "a_FeedbackVelocity";
|
|
31018
|
+
return ParticleFeedbackVertexAttribute;
|
|
31019
|
+
}({});
|
|
30963
31020
|
/**
|
|
30964
31021
|
* @internal
|
|
30965
31022
|
*/ var ParticleInstanceVertexAttribute = /*#__PURE__*/ function(ParticleInstanceVertexAttribute) {
|
|
@@ -31052,6 +31109,22 @@ PointerEventEmitter._tempRay = new Ray();
|
|
|
31052
31109
|
return _class;
|
|
31053
31110
|
}(ContentRestorer))());
|
|
31054
31111
|
};
|
|
31112
|
+
ParticleBufferUtils.feedbackVertexStride = 24;
|
|
31113
|
+
ParticleBufferUtils.feedbackVertexElements = [
|
|
31114
|
+
new VertexElement(ParticleFeedbackVertexAttribute.Position, 0, VertexElementFormat.Vector3, 0),
|
|
31115
|
+
new VertexElement(ParticleFeedbackVertexAttribute.Velocity, 12, VertexElementFormat.Vector3, 0)
|
|
31116
|
+
];
|
|
31117
|
+
ParticleBufferUtils.feedbackInstanceElements = [
|
|
31118
|
+
new VertexElement(ParticleInstanceVertexAttribute.ShapePositionStartLifeTime, 0, VertexElementFormat.Vector4, 0),
|
|
31119
|
+
new VertexElement(ParticleInstanceVertexAttribute.DirectionTime, 16, VertexElementFormat.Vector4, 0),
|
|
31120
|
+
new VertexElement(ParticleInstanceVertexAttribute.StartSize, 48, VertexElementFormat.Vector3, 0),
|
|
31121
|
+
new VertexElement(ParticleInstanceVertexAttribute.StartSpeed, 72, VertexElementFormat.Float, 0),
|
|
31122
|
+
new VertexElement(ParticleInstanceVertexAttribute.Random0, 76, VertexElementFormat.Vector4, 0),
|
|
31123
|
+
new VertexElement(ParticleInstanceVertexAttribute.Random1, 92, VertexElementFormat.Vector4, 0),
|
|
31124
|
+
new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldPosition, 108, VertexElementFormat.Vector3, 0),
|
|
31125
|
+
new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldRotation, 120, VertexElementFormat.Vector4, 0),
|
|
31126
|
+
new VertexElement(ParticleInstanceVertexAttribute.Random2, 152, VertexElementFormat.Vector4, 0)
|
|
31127
|
+
];
|
|
31055
31128
|
ParticleBufferUtils.instanceVertexStride = 168;
|
|
31056
31129
|
ParticleBufferUtils.instanceVertexFloatStride = ParticleBufferUtils.instanceVertexStride / 4;
|
|
31057
31130
|
ParticleBufferUtils.startLifeTimeOffset = 3;
|
|
@@ -31072,7 +31145,7 @@ var blinnPhongVs = "#include <common>\n#include <common_vert>\n#include <blendSh
|
|
|
31072
31145
|
var depthOnlyFs = "void main() {\n}"; // eslint-disable-line
|
|
31073
31146
|
var depthOnlyVs = "#define MATERIAL_OMIT_NORMAL\n#include <common>\n#include <common_vert>\n#include <blendShape_input>\nuniform mat4 camera_VPMat;\n\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
|
|
31074
31147
|
var particleFs = "#include <common>\n\nvarying vec4 v_Color;\nvarying vec2 v_TextureCoordinate;\nuniform sampler2D material_BaseTexture;\nuniform vec4 material_BaseColor;\n \nuniform mediump vec3 material_EmissiveColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\n uniform sampler2D material_EmissiveTexture;\n#endif\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#if defined(RENDERER_MODE_MESH) && defined(RENDERER_ENABLE_VERTEXCOLOR)\n\t\tcolor *= v_MeshColor;\n\t#endif\n\n\t#ifdef MATERIAL_HAS_BASETEXTURE\n\t\tcolor *= texture2DSRGB(material_BaseTexture, v_TextureCoordinate);\n\t#endif\n\t\n\t// Emissive\n\tvec3 emissiveRadiance = material_EmissiveColor;\n\t#ifdef MATERIAL_HAS_EMISSIVETEXTURE\n\t\temissiveRadiance *= texture2DSRGB(material_EmissiveTexture, v_TextureCoordinate).rgb;\n\t#endif\n\n\tcolor.rgb += emissiveRadiance;\n\n\tgl_FragColor = color;\n}"; // eslint-disable-line
|
|
31075
|
-
var particleVs = "#if defined(RENDERER_MODE_SPHERE_BILLBOARD) || defined(RENDERER_MODE_STRETCHED_BILLBOARD) || defined(RENDERER_MODE_HORIZONTAL_BILLBOARD) || defined(RENDERER_MODE_VERTICAL_BILLBOARD)\n attribute vec4 a_CornerTextureCoordinate;\n#endif\n\n#ifdef RENDERER_MODE_MESH\n attribute vec3 POSITION;\n #ifdef RENDERER_ENABLE_VERTEXCOLOR\n attribute vec4 COLOR_0;\n #endif\n attribute vec2 TEXCOORD_0;\n varying vec4 v_MeshColor;\n#endif\n\nattribute vec4 a_ShapePositionStartLifeTime;\nattribute vec4 a_DirectionTime;\nattribute vec4 a_StartColor;\nattribute vec3 a_StartSize;\nattribute vec3 a_StartRotation0;\nattribute float a_StartSpeed;\n\n//#if defined(COLOR_OVER_LIFETIME) || defined(RENDERER_COL_RANDOM_GRADIENTS) || defined(RENDERER_SOL_RANDOM_CURVES) || defined(RENDERER_SOL_RANDOM_CURVES_SEPARATE) || defined(ROTATION_OVER_LIFE_TIME_RANDOM_CONSTANTS) || defined(ROTATION_OVER_LIFETIME_RANDOM_CURVES)\n attribute vec4 a_Random0;\n//#endif\n\n#if defined(RENDERER_TSA_FRAME_RANDOM_CURVES) || defined(RENDERER_VOL_IS_RANDOM_TWO)\n attribute vec4 a_Random1; // x:texture sheet animation random\n#endif\n\nattribute vec3 a_SimulationWorldPosition;\nattribute vec4 a_SimulationWorldRotation;\n\nvarying vec4 v_Color;\n#ifdef MATERIAL_HAS_BASETEXTURE\n attribute vec4 a_SimulationUV;\n varying vec2 v_TextureCoordinate;\n#endif\n\nuniform float renderer_CurrentTime;\nuniform vec3 renderer_Gravity;\nuniform
|
|
31148
|
+
var particleVs = "#if defined(RENDERER_MODE_SPHERE_BILLBOARD) || defined(RENDERER_MODE_STRETCHED_BILLBOARD) || defined(RENDERER_MODE_HORIZONTAL_BILLBOARD) || defined(RENDERER_MODE_VERTICAL_BILLBOARD)\n attribute vec4 a_CornerTextureCoordinate;\n#endif\n\n#ifdef RENDERER_MODE_MESH\n attribute vec3 POSITION;\n #ifdef RENDERER_ENABLE_VERTEXCOLOR\n attribute vec4 COLOR_0;\n #endif\n attribute vec2 TEXCOORD_0;\n varying vec4 v_MeshColor;\n#endif\n\nattribute vec4 a_ShapePositionStartLifeTime;\nattribute vec4 a_DirectionTime;\nattribute vec4 a_StartColor;\nattribute vec3 a_StartSize;\nattribute vec3 a_StartRotation0;\nattribute float a_StartSpeed;\n\n//#if defined(COLOR_OVER_LIFETIME) || defined(RENDERER_COL_RANDOM_GRADIENTS) || defined(RENDERER_SOL_RANDOM_CURVES) || defined(RENDERER_SOL_RANDOM_CURVES_SEPARATE) || defined(ROTATION_OVER_LIFE_TIME_RANDOM_CONSTANTS) || defined(ROTATION_OVER_LIFETIME_RANDOM_CURVES)\n attribute vec4 a_Random0;\n//#endif\n\n#if defined(RENDERER_TSA_FRAME_RANDOM_CURVES) || defined(RENDERER_VOL_IS_RANDOM_TWO)\n attribute vec4 a_Random1; // x:texture sheet animation random\n#endif\n\n#if defined(RENDERER_FOL_CONSTANT_MODE) || defined(RENDERER_FOL_CURVE_MODE) || defined(RENDERER_LVL_MODULE_ENABLED)\n attribute vec4 a_Random2;\n#endif\n\nattribute vec3 a_SimulationWorldPosition;\nattribute vec4 a_SimulationWorldRotation;\n\n#ifdef RENDERER_TRANSFORM_FEEDBACK\n attribute vec3 a_FeedbackPosition;\n attribute vec3 a_FeedbackVelocity;\n#endif\n\nvarying vec4 v_Color;\n#ifdef MATERIAL_HAS_BASETEXTURE\n attribute vec4 a_SimulationUV;\n varying vec2 v_TextureCoordinate;\n#endif\n\nuniform float renderer_CurrentTime;\nuniform vec3 renderer_Gravity;\nuniform vec3 renderer_WorldPosition;\nuniform vec4 renderer_WorldRotation;\nuniform bool renderer_ThreeDStartRotation;\nuniform int renderer_ScalingMode;\nuniform vec3 renderer_PositionScale;\nuniform vec3 renderer_SizeScale;\nuniform vec3 renderer_PivotOffset;\n\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\n\n#ifdef RENDERER_MODE_STRETCHED_BILLBOARD\n uniform vec3 camera_Position;\n#endif\nuniform vec3 camera_Forward; // TODO:只有几种广告牌模式需要用\nuniform vec3 camera_Up;\n\nuniform float renderer_StretchedBillboardLengthScale;\nuniform float renderer_StretchedBillboardSpeedScale;\nuniform int renderer_SimulationSpace;\n\n#include <particle_common>\n#include <velocity_over_lifetime_module>\n#include <force_over_lifetime_module>\n#include <color_over_lifetime_module>\n#include <size_over_lifetime_module>\n#include <rotation_over_lifetime_module>\n#include <texture_sheet_animation_module>\n\nvec3 computeParticlePosition(in vec3 startVelocity, in float age, in float normalizedAge, vec3 gravityVelocity, vec4 worldRotation, inout vec3 localVelocity, inout vec3 worldVelocity) {\n vec3 startPosition = startVelocity * age;\n\n vec3 finalPosition;\n vec3 localPositionOffset = startPosition;\n vec3 worldPositionOffset;\n\n #ifdef _VOL_MODULE_ENABLED\n vec3 lifeVelocity; \n vec3 velocityPositionOffset = computeVelocityPositionOffset(normalizedAge, age, lifeVelocity);\n if (renderer_VOLSpace == 0) {\n localVelocity += lifeVelocity;\n localPositionOffset += velocityPositionOffset;\n } else {\n worldVelocity += lifeVelocity;\n worldPositionOffset += velocityPositionOffset;\n }\n #endif\n\n #ifdef _FOL_MODULE_ENABLED\n vec3 forceVelocity;\n vec3 forcePositionOffset = computeForcePositionOffset(normalizedAge, age, forceVelocity);\n if (renderer_FOLSpace == 0) {\n localVelocity += forceVelocity;\n localPositionOffset += forcePositionOffset;\n } else {\n worldVelocity += forceVelocity;\n worldPositionOffset += forcePositionOffset;\n }\n #endif\n\n finalPosition = rotationByQuaternions(a_ShapePositionStartLifeTime.xyz + localPositionOffset, worldRotation) + worldPositionOffset;\n\n if (renderer_SimulationSpace == 0) {\n finalPosition = finalPosition + renderer_WorldPosition;\n } else if (renderer_SimulationSpace == 1) {\n\t finalPosition = finalPosition + a_SimulationWorldPosition;\n\t}\n\n finalPosition += 0.5 * gravityVelocity * age;\n\n return finalPosition;\n}\n\nvoid main() {\n float age = renderer_CurrentTime - a_DirectionTime.w;\n float normalizedAge = age / a_ShapePositionStartLifeTime.w;\n // normalizedAge >= 0.0: skip stale TF slots whose startTime is from a previous playback (e.g. after StopEmittingAndClear).\n if (normalizedAge >= 0.0 && normalizedAge < 1.0) {\n vec4 worldRotation;\n if (renderer_SimulationSpace == 0) {\n worldRotation = renderer_WorldRotation;\n } else {\n worldRotation = a_SimulationWorldRotation;\n }\n\n vec3 localVelocity;\n vec3 worldVelocity;\n\n #ifdef RENDERER_TRANSFORM_FEEDBACK\n // Transform Feedback mode: position in simulation space (local or world).\n // Local: transform to world; World: use directly.\n vec3 center;\n if (renderer_SimulationSpace == 0) {\n center = rotationByQuaternions(a_FeedbackPosition, worldRotation) + renderer_WorldPosition;\n } else if (renderer_SimulationSpace == 1) {\n center = a_FeedbackPosition;\n }\n localVelocity = a_FeedbackVelocity;\n worldVelocity = vec3(0.0);\n\n #ifdef _VOL_MODULE_ENABLED\n vec3 instantVOLVelocity;\n computeVelocityPositionOffset(normalizedAge, age, instantVOLVelocity);\n if (renderer_VOLSpace == 0) {\n localVelocity += instantVOLVelocity;\n } else {\n worldVelocity += instantVOLVelocity;\n }\n #endif\n #else\n // Original analytical path\n vec3 startVelocity = a_DirectionTime.xyz * a_StartSpeed;\n vec3 gravityVelocity = renderer_Gravity * a_Random0.x * age;\n localVelocity = startVelocity;\n worldVelocity = gravityVelocity;\n vec3 center = computeParticlePosition(startVelocity, age, normalizedAge, gravityVelocity, worldRotation, localVelocity, worldVelocity);\n #endif\n\n #include <sphere_billboard>\n #include <stretched_billboard>\n #include <horizontal_billboard>\n #include <vertical_billboard>\n #include <particle_mesh>\n\n gl_Position = camera_ProjMat * camera_ViewMat * vec4(center, 1.0);\n v_Color = computeParticleColor(a_StartColor, normalizedAge);\n\n #ifdef MATERIAL_HAS_BASETEXTURE\n vec2 simulateUV;\n #if defined(RENDERER_MODE_SPHERE_BILLBOARD) || defined(RENDERER_MODE_STRETCHED_BILLBOARD) || defined(RENDERER_MODE_HORIZONTAL_BILLBOARD) || defined(RENDERER_MODE_VERTICAL_BILLBOARD)\n simulateUV = a_CornerTextureCoordinate.zw * a_SimulationUV.xy + a_SimulationUV.zw;\n v_TextureCoordinate = computeParticleUV(simulateUV, normalizedAge);\n #endif\n #ifdef RENDERER_MODE_MESH\n simulateUV = a_SimulationUV.zw + TEXCOORD_0 * a_SimulationUV.xy;\n v_TextureCoordinate = computeParticleUV(simulateUV, normalizedAge);\n #endif\n #endif\n } else {\n\t gl_Position = vec4(2.0, 2.0, 2.0, 1.0); // Discard use out of X(-1,1),Y(-1,1),Z(0,1)\n }\n}"; // eslint-disable-line
|
|
31076
31149
|
var pbrSpecularFs = "#include <common>\n#include <camera_declare>\n\n#include <FogFragmentDeclaration>\n\n#include <uv_share>\n#include <normal_share>\n#include <color_share>\n#include <worldpos_share>\n\n#include <light_frag_define>\n\n\n#include <pbr_frag_define>\n#include <pbr_helper>\n\nvoid main() {\n #include <pbr_frag>\n #include <FogFragment>\n}\n"; // eslint-disable-line
|
|
31077
31150
|
var pbrFs = "#include <common>\n#include <camera_declare>\n#include <transform_declare>\n\n#include <FogFragmentDeclaration>\n#include <PositionClipSpaceDeclaration>\n\n#include <uv_share>\n#include <normal_share>\n#include <color_share>\n#include <worldpos_share>\n\n#include <light_frag_define>\n\n#include <pbr_frag_define>\n#include <pbr_helper>\n\nvoid main() {\n #include <pbr_frag>\n #include <FogFragment>\n}\n"; // eslint-disable-line
|
|
31078
31151
|
var pbrVs = "#include <common>\n#include <common_vert>\n#include <blendShape_input>\n#include <uv_share>\n#include <color_share>\n#include <normal_share>\n#include <worldpos_share>\n\n#include <ShadowVertexDeclaration>\n#include <FogVertexDeclaration>\n#include <PositionClipSpaceDeclaration>\n\nvoid main() {\n\n #include <begin_position_vert>\n #include <begin_normal_vert>\n #include <blendShape_vert>\n #include <skinning_vert>\n #include <uv_vert>\n #include <color_vert>\n #include <normal_vert>\n #include <worldpos_vert>\n #include <position_vert>\n\n #include <ShadowVertex>\n #include <FogVertex>\n #include <PositionClipSpaceVertex>\n}\n"; // eslint-disable-line
|
|
@@ -31090,12 +31163,45 @@ var trailFs = "#include <common>\n\nvarying vec2 v_uv;\nvarying vec4 v_color;\n\
|
|
|
31090
31163
|
var trailVs = "attribute vec4 a_PositionBirthTime; // xyz: World position, w: Birth time (used by CPU only)\nattribute vec4 a_CornerTangent; // x: Corner (-1 or 1), yzw: Tangent direction\nattribute float a_Distance; // Absolute cumulative distance (written once per point)\n\nuniform vec4 renderer_TrailParams; // x: TextureMode (0: Stretch, 1: Tile), y: TextureScaleX, z: TextureScaleY\nuniform vec2 renderer_DistanceParams; // x: HeadDistance, y: TailDistance\nuniform vec3 camera_Position;\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\nuniform vec2 renderer_WidthCurve[4]; // Width curve (4 keyframes max: x=time, y=value)\nuniform vec4 renderer_ColorKeys[4]; // Color gradient (x=time, yzw=rgb)\nuniform vec2 renderer_AlphaKeys[4]; // Alpha gradient (x=time, y=alpha)\nuniform vec4 renderer_CurveMaxTime; // x: colorMaxTime, y: alphaMaxTime, z: widthMaxTime\n\nvarying vec2 v_uv;\nvarying vec4 v_color;\n\n#include <particle_common>\n\nvoid main() {\n vec3 position = a_PositionBirthTime.xyz;\n float corner = a_CornerTangent.x;\n vec3 tangent = a_CornerTangent.yzw;\n\n // Distance-based relative position: 0=head(newest), 1=tail(oldest)\n float distFromHead = renderer_DistanceParams.x - a_Distance;\n float totalDist = renderer_DistanceParams.x - renderer_DistanceParams.y;\n float relativePos = totalDist > 0.0 ? distFromHead / totalDist : 0.0;\n\n // Billboard: expand perpendicular to tangent and view direction\n vec3 toCamera = normalize(camera_Position - position);\n vec3 right = cross(tangent, toCamera);\n float rightLenSq = dot(right, right);\n if (rightLenSq < 0.000001) {\n right = cross(tangent, vec3(0.0, 1.0, 0.0));\n rightLenSq = dot(right, right);\n if (rightLenSq < 0.000001) {\n right = cross(tangent, vec3(1.0, 0.0, 0.0));\n rightLenSq = dot(right, right);\n }\n }\n right = right * inversesqrt(rightLenSq);\n\n float width = evaluateParticleCurve(renderer_WidthCurve, min(relativePos, renderer_CurveMaxTime.z));\n vec3 worldPosition = position + right * width * 0.5 * corner;\n\n gl_Position = camera_ProjMat * camera_ViewMat * vec4(worldPosition, 1.0);\n\n // u = position along trail (affected by textureMode), v = corner side.\n float u = renderer_TrailParams.x == 0.0 ? relativePos : distFromHead;\n float v = corner * 0.5 + 0.5;\n v_uv = vec2(u * renderer_TrailParams.y, v * renderer_TrailParams.z);\n\n v_color = evaluateParticleGradient(renderer_ColorKeys, renderer_CurveMaxTime.x, renderer_AlphaKeys, renderer_CurveMaxTime.y, relativePos);\n}\n"; // eslint-disable-line
|
|
31091
31164
|
var unlitFs = "#include <common>\n#include <uv_share>\n#include <FogFragmentDeclaration>\n\nuniform vec4 material_BaseColor;\nuniform float material_AlphaCutoff;\n\n#ifdef MATERIAL_HAS_BASETEXTURE\n uniform sampler2D material_BaseTexture;\n#endif\n\nvoid main() {\n vec4 baseColor = material_BaseColor;\n\n #ifdef MATERIAL_HAS_BASETEXTURE\n baseColor *= texture2DSRGB(material_BaseTexture, v_uv);\n #endif\n\n #ifdef MATERIAL_IS_ALPHA_CUTOFF\n if( baseColor.a < material_AlphaCutoff ) {\n discard;\n }\n #endif\n\n gl_FragColor = baseColor;\n\n #ifndef MATERIAL_IS_TRANSPARENT\n gl_FragColor.a = 1.0;\n #endif\n\n #include <FogFragment>\n}\n"; // eslint-disable-line
|
|
31092
31165
|
var unlitVs = "#include <common>\n#include <common_vert>\n#include <blendShape_input>\n#include <uv_share>\n#include <FogVertexDeclaration>\n\nvoid main() {\n\n #include <begin_position_vert>\n #include <blendShape_vert>\n #include <skinning_vert>\n #include <uv_vert>\n #include <position_vert>\n\n #include <FogVertex>\n}\n"; // eslint-disable-line
|
|
31166
|
+
/**
|
|
31167
|
+
* @internal
|
|
31168
|
+
* Shared shader definition for Transform Feedback simulation.
|
|
31169
|
+
* Multiple simulators using the same shader share a single program pool per engine.
|
|
31170
|
+
*/ var TransformFeedbackShader = /*#__PURE__*/ function() {
|
|
31171
|
+
function TransformFeedbackShader(vertexSource, fragmentSource, feedbackVaryings) {
|
|
31172
|
+
this._id = ShaderPass._shaderPassCounter++;
|
|
31173
|
+
this.vertexSource = vertexSource;
|
|
31174
|
+
this.fragmentSource = fragmentSource;
|
|
31175
|
+
this.feedbackVaryings = feedbackVaryings;
|
|
31176
|
+
}
|
|
31177
|
+
var _proto = TransformFeedbackShader.prototype;
|
|
31178
|
+
/**
|
|
31179
|
+
* Get or compile a shader program for the given engine and macro combination.
|
|
31180
|
+
*/ _proto.getProgram = function getProgram(engine, macroCollection) {
|
|
31181
|
+
var pool = engine._getShaderProgramPool(this._id);
|
|
31182
|
+
var program = pool.get(macroCollection);
|
|
31183
|
+
if (program) return program;
|
|
31184
|
+
var _ShaderFactory_compilePlatformSource = ShaderFactory.compilePlatformSource(engine, macroCollection, this.vertexSource, this.fragmentSource), vertexSource = _ShaderFactory_compilePlatformSource.vertexSource, fragmentSource = _ShaderFactory_compilePlatformSource.fragmentSource;
|
|
31185
|
+
program = new ShaderProgram(engine, vertexSource, fragmentSource, this.feedbackVaryings);
|
|
31186
|
+
if (!program.isValid) {
|
|
31187
|
+
Logger.error("TransformFeedbackShader: Failed to compile shader program.");
|
|
31188
|
+
return null;
|
|
31189
|
+
}
|
|
31190
|
+
pool.cache(program);
|
|
31191
|
+
return program;
|
|
31192
|
+
};
|
|
31193
|
+
return TransformFeedbackShader;
|
|
31194
|
+
}();
|
|
31093
31195
|
/**
|
|
31094
31196
|
* Internal shader pool.
|
|
31095
31197
|
* @internal
|
|
31096
31198
|
*/ var ShaderPool = /*#__PURE__*/ function() {
|
|
31097
31199
|
function ShaderPool() {}
|
|
31098
31200
|
ShaderPool.init = function init() {
|
|
31201
|
+
ShaderPool.particleFeedbackShader = new TransformFeedbackShader("#include <particle_feedback_simulation>", "void main() { discard; }", [
|
|
31202
|
+
"v_FeedbackPosition",
|
|
31203
|
+
"v_FeedbackVelocity"
|
|
31204
|
+
]);
|
|
31099
31205
|
var shadowCasterPass = new ShaderPass("ShadowCaster", shadowMapVs, shadowMapFs, {
|
|
31100
31206
|
pipelineStage: PipelineStage.ShadowCaster
|
|
31101
31207
|
});
|
|
@@ -31586,8 +31692,7 @@ ShaderPool.init();
|
|
|
31586
31692
|
};
|
|
31587
31693
|
/**
|
|
31588
31694
|
* @internal
|
|
31589
|
-
*/ _proto._getShaderProgramPool = function _getShaderProgramPool(
|
|
31590
|
-
var index = shaderPass._shaderPassId;
|
|
31695
|
+
*/ _proto._getShaderProgramPool = function _getShaderProgramPool(index, trackPools) {
|
|
31591
31696
|
var shaderProgramPools = this._shaderProgramPools;
|
|
31592
31697
|
var pool = shaderProgramPools[index];
|
|
31593
31698
|
if (!pool) {
|
|
@@ -31596,7 +31701,7 @@ ShaderPool.init();
|
|
|
31596
31701
|
shaderProgramPools.length = length;
|
|
31597
31702
|
}
|
|
31598
31703
|
shaderProgramPools[index] = pool = new ShaderProgramPool(this);
|
|
31599
|
-
|
|
31704
|
+
trackPools == null ? void 0 : trackPools.push(pool);
|
|
31600
31705
|
}
|
|
31601
31706
|
return pool;
|
|
31602
31707
|
};
|
|
@@ -33470,24 +33575,24 @@ AmbientOcclusion._enableMacro = ShaderMacro.getByName("SCENE_ENABLE_AMBIENT_OCCL
|
|
|
33470
33575
|
Scene._fogColorProperty = ShaderProperty.getByName("scene_FogColor");
|
|
33471
33576
|
Scene._fogParamsProperty = ShaderProperty.getByName("scene_FogParams");
|
|
33472
33577
|
Scene._prefilterdDFGProperty = ShaderProperty.getByName("scene_PrefilteredDFG");
|
|
33473
|
-
function _array_like_to_array$
|
|
33578
|
+
function _array_like_to_array$2(arr, len) {
|
|
33474
33579
|
if (len == null || len > arr.length) len = arr.length;
|
|
33475
33580
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
33476
33581
|
return arr2;
|
|
33477
33582
|
}
|
|
33478
|
-
function _unsupported_iterable_to_array$
|
|
33583
|
+
function _unsupported_iterable_to_array$2(o, minLen) {
|
|
33479
33584
|
if (!o) return;
|
|
33480
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
33585
|
+
if (typeof o === "string") return _array_like_to_array$2(o, minLen);
|
|
33481
33586
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
33482
33587
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
33483
33588
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
33484
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
33589
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
|
|
33485
33590
|
}
|
|
33486
|
-
function _create_for_of_iterator_helper_loose$
|
|
33591
|
+
function _create_for_of_iterator_helper_loose$2(o, allowArrayLike) {
|
|
33487
33592
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
33488
33593
|
if (it) return (it = it.call(o)).next.bind(it);
|
|
33489
33594
|
// Fallback for engines without symbol support
|
|
33490
|
-
if (Array.isArray(o) || (it = _unsupported_iterable_to_array$
|
|
33595
|
+
if (Array.isArray(o) || (it = _unsupported_iterable_to_array$2(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
33491
33596
|
if (it) o = it;
|
|
33492
33597
|
var i = 0;
|
|
33493
33598
|
return function() {
|
|
@@ -33642,7 +33747,7 @@ function _create_for_of_iterator_helper_loose$1(o, allowArrayLike) {
|
|
|
33642
33747
|
if (this.onPhysicsUpdate !== prototype.onPhysicsUpdate) {
|
|
33643
33748
|
componentsManager.addOnPhysicsUpdateScript(this);
|
|
33644
33749
|
}
|
|
33645
|
-
for(var _iterator = _create_for_of_iterator_helper_loose$
|
|
33750
|
+
for(var _iterator = _create_for_of_iterator_helper_loose$2(Object.values(PointerMethods)), _step; !(_step = _iterator()).done;){
|
|
33646
33751
|
var pointerMethod = _step.value;
|
|
33647
33752
|
if (this[pointerMethod] === prototype[pointerMethod]) {
|
|
33648
33753
|
this[pointerMethod] = null;
|
|
@@ -37896,6 +38001,10 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
|
|
|
37896
38001
|
shaderData.setFloat(ParticleRenderer._currentTime, this.generator._playTime);
|
|
37897
38002
|
shaderData.setVector3(ParticleRenderer._pivotOffsetProperty, this.pivot);
|
|
37898
38003
|
this.generator._updateShaderData(shaderData);
|
|
38004
|
+
// Run Transform Feedback simulation after shader data is up to date
|
|
38005
|
+
if (generator._useTransformFeedback) {
|
|
38006
|
+
generator._updateFeedback(shaderData, this.engine.time.deltaTime * generator.main.simulationSpeed);
|
|
38007
|
+
}
|
|
37899
38008
|
};
|
|
37900
38009
|
_proto._render = function _render(context) {
|
|
37901
38010
|
var generator = this.generator;
|
|
@@ -37904,7 +38013,9 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
|
|
|
37904
38013
|
if (!aliveParticleCount) {
|
|
37905
38014
|
return;
|
|
37906
38015
|
}
|
|
37907
|
-
|
|
38016
|
+
// Transform Feedback: render all slots (instance buffer not compacted, dead particles discarded in shader)
|
|
38017
|
+
// Non-Transform Feedback: render only alive particles (instance buffer compacted)
|
|
38018
|
+
generator._primitive.instanceCount = generator._useTransformFeedback ? generator._firstActiveElement <= generator._firstFreeElement ? generator._firstFreeElement : generator._currentParticleCount : aliveParticleCount;
|
|
37908
38019
|
var material = this.getMaterial();
|
|
37909
38020
|
if (!material || this._renderMode === ParticleRenderMode.Mesh && !this._mesh) {
|
|
37910
38021
|
return;
|
|
@@ -38059,6 +38170,327 @@ __decorate$1([
|
|
|
38059
38170
|
/** On Generator Bounds Related Params Changed */ ParticleUpdateFlags[ParticleUpdateFlags["GeneratorVolume"] = 4] = "GeneratorVolume";
|
|
38060
38171
|
return ParticleUpdateFlags;
|
|
38061
38172
|
}({});
|
|
38173
|
+
/**
|
|
38174
|
+
* Transform Feedback object for GPU-based data capture.
|
|
38175
|
+
* @internal
|
|
38176
|
+
*/ var TransformFeedback = /*#__PURE__*/ function(GraphicsResource) {
|
|
38177
|
+
_inherits$2(TransformFeedback, GraphicsResource);
|
|
38178
|
+
function TransformFeedback(engine) {
|
|
38179
|
+
var _this;
|
|
38180
|
+
_this = GraphicsResource.call(this, engine) || this;
|
|
38181
|
+
_this._platformTransformFeedback = engine._hardwareRenderer.createPlatformTransformFeedback();
|
|
38182
|
+
return _this;
|
|
38183
|
+
}
|
|
38184
|
+
var _proto = TransformFeedback.prototype;
|
|
38185
|
+
/**
|
|
38186
|
+
* Bind this Transform Feedback object as active.
|
|
38187
|
+
*/ _proto.bind = function bind() {
|
|
38188
|
+
this._platformTransformFeedback.bind();
|
|
38189
|
+
};
|
|
38190
|
+
/**
|
|
38191
|
+
* Bind a buffer range as output at the given index.
|
|
38192
|
+
* @param index - Output binding point index (corresponds to varying index in shader)
|
|
38193
|
+
* @param buffer - Output buffer to capture data into
|
|
38194
|
+
* @param byteOffset - Starting byte offset in the buffer
|
|
38195
|
+
* @param byteSize - Size in bytes of the capture range
|
|
38196
|
+
*/ _proto.bindBufferRange = function bindBufferRange(index, buffer, byteOffset, byteSize) {
|
|
38197
|
+
this._platformTransformFeedback.bindBufferRange(index, buffer._platformBuffer, byteOffset, byteSize);
|
|
38198
|
+
};
|
|
38199
|
+
/**
|
|
38200
|
+
* Begin a Transform Feedback pass.
|
|
38201
|
+
* @param primitiveMode - Primitive topology mode
|
|
38202
|
+
*/ _proto.begin = function begin(primitiveMode) {
|
|
38203
|
+
this._platformTransformFeedback.begin(primitiveMode);
|
|
38204
|
+
};
|
|
38205
|
+
/**
|
|
38206
|
+
* End the current Transform Feedback pass.
|
|
38207
|
+
*/ _proto.end = function end() {
|
|
38208
|
+
this._platformTransformFeedback.end();
|
|
38209
|
+
};
|
|
38210
|
+
/**
|
|
38211
|
+
* Unbind the output buffer at the given index from the Transform Feedback target.
|
|
38212
|
+
* @param index - Output binding point index
|
|
38213
|
+
*/ _proto.unbindBuffer = function unbindBuffer(index) {
|
|
38214
|
+
this._platformTransformFeedback.unbindBuffer(index);
|
|
38215
|
+
};
|
|
38216
|
+
/**
|
|
38217
|
+
* Unbind this Transform Feedback object.
|
|
38218
|
+
*/ _proto.unbind = function unbind() {
|
|
38219
|
+
this._platformTransformFeedback.unbind();
|
|
38220
|
+
};
|
|
38221
|
+
_proto._rebuild = function _rebuild() {
|
|
38222
|
+
this._platformTransformFeedback = this._engine._hardwareRenderer.createPlatformTransformFeedback();
|
|
38223
|
+
};
|
|
38224
|
+
_proto._onDestroy = function _onDestroy() {
|
|
38225
|
+
GraphicsResource.prototype._onDestroy.call(this);
|
|
38226
|
+
this._platformTransformFeedback.destroy();
|
|
38227
|
+
};
|
|
38228
|
+
return TransformFeedback;
|
|
38229
|
+
}(GraphicsResource);
|
|
38230
|
+
/**
|
|
38231
|
+
* @internal
|
|
38232
|
+
* Primitive for Transform Feedback simulation with read/write buffer swapping.
|
|
38233
|
+
*/ var TransformFeedbackPrimitive = /*#__PURE__*/ function(GraphicsResource) {
|
|
38234
|
+
_inherits$2(TransformFeedbackPrimitive, GraphicsResource);
|
|
38235
|
+
function TransformFeedbackPrimitive(engine, byteStride) {
|
|
38236
|
+
var _this;
|
|
38237
|
+
_this = GraphicsResource.call(this, engine) || this, _this._readIsA = true;
|
|
38238
|
+
_this._byteStride = byteStride;
|
|
38239
|
+
_this._transformFeedback = new TransformFeedback(engine);
|
|
38240
|
+
_this._transformFeedback.isGCIgnored = true;
|
|
38241
|
+
_this._platformPrimitive = engine._hardwareRenderer.createPlatformTransformFeedbackPrimitive();
|
|
38242
|
+
_this.isGCIgnored = true;
|
|
38243
|
+
return _this;
|
|
38244
|
+
}
|
|
38245
|
+
var _proto = TransformFeedbackPrimitive.prototype;
|
|
38246
|
+
/**
|
|
38247
|
+
* Resize read and write buffers.
|
|
38248
|
+
* @param vertexCount - Number of vertices to allocate
|
|
38249
|
+
*/ _proto.resize = function resize(vertexCount) {
|
|
38250
|
+
var byteLength = this._byteStride * vertexCount;
|
|
38251
|
+
var bufferA = new Buffer(this._engine, BufferBindFlag.VertexBuffer, byteLength, BufferUsage.Dynamic, false);
|
|
38252
|
+
bufferA.isGCIgnored = true;
|
|
38253
|
+
var bufferB = new Buffer(this._engine, BufferBindFlag.VertexBuffer, byteLength, BufferUsage.Dynamic, false);
|
|
38254
|
+
bufferB.isGCIgnored = true;
|
|
38255
|
+
this._bindingA = new VertexBufferBinding(bufferA, this._byteStride);
|
|
38256
|
+
this._bindingB = new VertexBufferBinding(bufferB, this._byteStride);
|
|
38257
|
+
this._readIsA = true;
|
|
38258
|
+
this._platformPrimitive.invalidate();
|
|
38259
|
+
};
|
|
38260
|
+
/**
|
|
38261
|
+
* Update vertex layout, only rebuilds when program changes.
|
|
38262
|
+
* @param program - Shader program for attribute locations
|
|
38263
|
+
* @param feedbackElements - Vertex elements describing the read/write buffer
|
|
38264
|
+
* @param inputBinding - Additional input buffer binding
|
|
38265
|
+
* @param inputElements - Vertex elements describing the input buffer
|
|
38266
|
+
*/ _proto.updateVertexLayout = function updateVertexLayout(program, feedbackElements, inputBinding, inputElements) {
|
|
38267
|
+
this._platformPrimitive.updateVertexLayout(program, this._bindingA, this._bindingB, feedbackElements, inputBinding, inputElements);
|
|
38268
|
+
};
|
|
38269
|
+
/**
|
|
38270
|
+
* Bind state before issuing draw calls.
|
|
38271
|
+
*/ _proto.beginDraw = function beginDraw() {
|
|
38272
|
+
this._engine._hardwareRenderer.enableRasterizerDiscard();
|
|
38273
|
+
this._transformFeedback.bind();
|
|
38274
|
+
this._platformPrimitive.bind(this._readIsA);
|
|
38275
|
+
};
|
|
38276
|
+
/**
|
|
38277
|
+
* Issue a draw call for a vertex range, capturing output to the write buffer.
|
|
38278
|
+
* @param mode - Primitive topology
|
|
38279
|
+
* @param first - First vertex index
|
|
38280
|
+
* @param count - Number of vertices
|
|
38281
|
+
*/ _proto.draw = function draw(mode, first, count) {
|
|
38282
|
+
var transformFeedback = this._transformFeedback;
|
|
38283
|
+
transformFeedback.bindBufferRange(0, this.writeBinding.buffer, first * this._byteStride, count * this._byteStride);
|
|
38284
|
+
transformFeedback.begin(mode);
|
|
38285
|
+
this._platformPrimitive.draw(mode, first, count);
|
|
38286
|
+
transformFeedback.end();
|
|
38287
|
+
};
|
|
38288
|
+
/**
|
|
38289
|
+
* Unbind state after draw calls.
|
|
38290
|
+
*/ _proto.endDraw = function endDraw() {
|
|
38291
|
+
this._platformPrimitive.unbind();
|
|
38292
|
+
this._transformFeedback.unbindBuffer(0);
|
|
38293
|
+
this._transformFeedback.unbind();
|
|
38294
|
+
this._engine._hardwareRenderer.disableRasterizerDiscard();
|
|
38295
|
+
this._engine._hardwareRenderer.invalidateShaderProgramState();
|
|
38296
|
+
};
|
|
38297
|
+
/**
|
|
38298
|
+
* Swap read and write buffers.
|
|
38299
|
+
*/ _proto.swap = function swap() {
|
|
38300
|
+
this._readIsA = !this._readIsA;
|
|
38301
|
+
};
|
|
38302
|
+
_proto._rebuild = function _rebuild() {
|
|
38303
|
+
this._platformPrimitive = this._engine._hardwareRenderer.createPlatformTransformFeedbackPrimitive();
|
|
38304
|
+
};
|
|
38305
|
+
_proto._onDestroy = function _onDestroy() {
|
|
38306
|
+
var _this__platformPrimitive, _this__bindingA, _this__bindingB, _this__transformFeedback;
|
|
38307
|
+
GraphicsResource.prototype._onDestroy.call(this);
|
|
38308
|
+
(_this__platformPrimitive = this._platformPrimitive) == null ? void 0 : _this__platformPrimitive.destroy();
|
|
38309
|
+
(_this__bindingA = this._bindingA) == null ? void 0 : _this__bindingA.buffer.destroy();
|
|
38310
|
+
(_this__bindingB = this._bindingB) == null ? void 0 : _this__bindingB.buffer.destroy();
|
|
38311
|
+
(_this__transformFeedback = this._transformFeedback) == null ? void 0 : _this__transformFeedback.destroy();
|
|
38312
|
+
};
|
|
38313
|
+
_create_class$2(TransformFeedbackPrimitive, [
|
|
38314
|
+
{
|
|
38315
|
+
key: "readBinding",
|
|
38316
|
+
get: /**
|
|
38317
|
+
* The current read buffer binding.
|
|
38318
|
+
*/ function get() {
|
|
38319
|
+
return this._readIsA ? this._bindingA : this._bindingB;
|
|
38320
|
+
}
|
|
38321
|
+
},
|
|
38322
|
+
{
|
|
38323
|
+
key: "writeBinding",
|
|
38324
|
+
get: /**
|
|
38325
|
+
* The current write buffer binding.
|
|
38326
|
+
*/ function get() {
|
|
38327
|
+
return this._readIsA ? this._bindingB : this._bindingA;
|
|
38328
|
+
}
|
|
38329
|
+
}
|
|
38330
|
+
]);
|
|
38331
|
+
return TransformFeedbackPrimitive;
|
|
38332
|
+
}(GraphicsResource);
|
|
38333
|
+
/**
|
|
38334
|
+
* @internal
|
|
38335
|
+
* General-purpose Transform Feedback simulator.
|
|
38336
|
+
* Manages per-frame simulation with shared shader program caching.
|
|
38337
|
+
*/ var TransformFeedbackSimulator = /*#__PURE__*/ function() {
|
|
38338
|
+
function TransformFeedbackSimulator(engine, byteStride, shader) {
|
|
38339
|
+
this._engine = engine;
|
|
38340
|
+
this._primitive = new TransformFeedbackPrimitive(engine, byteStride);
|
|
38341
|
+
this._shader = shader;
|
|
38342
|
+
}
|
|
38343
|
+
var _proto = TransformFeedbackSimulator.prototype;
|
|
38344
|
+
/**
|
|
38345
|
+
* Resize feedback buffers.
|
|
38346
|
+
* @param vertexCount - Number of vertices to allocate
|
|
38347
|
+
*/ _proto.resize = function resize(vertexCount) {
|
|
38348
|
+
this._primitive.resize(vertexCount);
|
|
38349
|
+
};
|
|
38350
|
+
/**
|
|
38351
|
+
* Begin a simulation step: get/compile program, bind, upload uniforms, update layout.
|
|
38352
|
+
* @param shaderData - Shader data with current macros and uniforms
|
|
38353
|
+
* @param feedbackElements - Vertex elements for the feedback buffer
|
|
38354
|
+
* @param inputBinding - Input buffer binding
|
|
38355
|
+
* @param inputElements - Vertex elements for the input buffer
|
|
38356
|
+
*/ _proto.beginUpdate = function beginUpdate(shaderData, feedbackElements, inputBinding, inputElements) {
|
|
38357
|
+
var program = this._shader.getProgram(this._engine, shaderData._macroCollection);
|
|
38358
|
+
if (!program) return false;
|
|
38359
|
+
program.bind();
|
|
38360
|
+
program.uploadUniforms(program.rendererUniformBlock, shaderData);
|
|
38361
|
+
program.uploadUniforms(program.otherUniformBlock, shaderData);
|
|
38362
|
+
this._primitive.updateVertexLayout(program, feedbackElements, inputBinding, inputElements);
|
|
38363
|
+
this._primitive.beginDraw();
|
|
38364
|
+
return true;
|
|
38365
|
+
};
|
|
38366
|
+
/**
|
|
38367
|
+
* Issue a draw call for a vertex range.
|
|
38368
|
+
* @param mode - Primitive topology
|
|
38369
|
+
* @param first - First vertex index
|
|
38370
|
+
* @param count - Number of vertices
|
|
38371
|
+
*/ _proto.draw = function draw(mode, first, count) {
|
|
38372
|
+
this._primitive.draw(mode, first, count);
|
|
38373
|
+
};
|
|
38374
|
+
/**
|
|
38375
|
+
* End the simulation step: unbind state and swap buffers.
|
|
38376
|
+
*/ _proto.endUpdate = function endUpdate() {
|
|
38377
|
+
this._primitive.endDraw();
|
|
38378
|
+
this._primitive.swap();
|
|
38379
|
+
};
|
|
38380
|
+
_proto.destroy = function destroy() {
|
|
38381
|
+
var _this__primitive;
|
|
38382
|
+
(_this__primitive = this._primitive) == null ? void 0 : _this__primitive.destroy();
|
|
38383
|
+
};
|
|
38384
|
+
_create_class$2(TransformFeedbackSimulator, [
|
|
38385
|
+
{
|
|
38386
|
+
key: "readBinding",
|
|
38387
|
+
get: /**
|
|
38388
|
+
* The current read buffer binding.
|
|
38389
|
+
*/ function get() {
|
|
38390
|
+
return this._primitive.readBinding;
|
|
38391
|
+
}
|
|
38392
|
+
},
|
|
38393
|
+
{
|
|
38394
|
+
key: "writeBinding",
|
|
38395
|
+
get: /**
|
|
38396
|
+
* The current write buffer binding.
|
|
38397
|
+
*/ function get() {
|
|
38398
|
+
return this._primitive.writeBinding;
|
|
38399
|
+
}
|
|
38400
|
+
}
|
|
38401
|
+
]);
|
|
38402
|
+
return TransformFeedbackSimulator;
|
|
38403
|
+
}();
|
|
38404
|
+
/**
|
|
38405
|
+
* @internal
|
|
38406
|
+
* Particle-specific Transform Feedback simulation.
|
|
38407
|
+
*/ var ParticleTransformFeedbackSimulator = /*#__PURE__*/ function() {
|
|
38408
|
+
function ParticleTransformFeedbackSimulator(engine) {
|
|
38409
|
+
this._particleInitData = new Float32Array(6);
|
|
38410
|
+
this._simulator = new TransformFeedbackSimulator(engine, ParticleBufferUtils.feedbackVertexStride, ShaderPool.particleFeedbackShader);
|
|
38411
|
+
}
|
|
38412
|
+
var _proto = ParticleTransformFeedbackSimulator.prototype;
|
|
38413
|
+
/**
|
|
38414
|
+
* Resize feedback buffers.
|
|
38415
|
+
* Saves pre-resize buffers internally for subsequent `copyOldBufferData` / `destroyOldBuffers` calls.
|
|
38416
|
+
* @param particleCount - Number of particles to allocate
|
|
38417
|
+
* @param instanceBinding - New instance vertex buffer binding
|
|
38418
|
+
*/ _proto.resize = function resize(particleCount, instanceBinding) {
|
|
38419
|
+
var _this__simulator_readBinding, _this__simulator_writeBinding;
|
|
38420
|
+
this._oldReadBuffer = (_this__simulator_readBinding = this._simulator.readBinding) == null ? void 0 : _this__simulator_readBinding.buffer;
|
|
38421
|
+
this._oldWriteBuffer = (_this__simulator_writeBinding = this._simulator.writeBinding) == null ? void 0 : _this__simulator_writeBinding.buffer;
|
|
38422
|
+
this._simulator.resize(particleCount);
|
|
38423
|
+
this._instanceBinding = instanceBinding;
|
|
38424
|
+
};
|
|
38425
|
+
/**
|
|
38426
|
+
* Write initial position and velocity for a newly emitted particle.
|
|
38427
|
+
*/ _proto.writeParticleData = function writeParticleData(index, position, vx, vy, vz) {
|
|
38428
|
+
var data = this._particleInitData;
|
|
38429
|
+
data[0] = position.x;
|
|
38430
|
+
data[1] = position.y;
|
|
38431
|
+
data[2] = position.z;
|
|
38432
|
+
data[3] = vx;
|
|
38433
|
+
data[4] = vy;
|
|
38434
|
+
data[5] = vz;
|
|
38435
|
+
var simulator = this._simulator;
|
|
38436
|
+
var byteOffset = index * ParticleBufferUtils.feedbackVertexStride;
|
|
38437
|
+
simulator.readBinding.buffer.setData(data, byteOffset);
|
|
38438
|
+
simulator.writeBinding.buffer.setData(data, byteOffset);
|
|
38439
|
+
};
|
|
38440
|
+
/**
|
|
38441
|
+
* Copy data from pre-resize buffers to current buffers.
|
|
38442
|
+
* Must be called after `resize` which saves the old buffers.
|
|
38443
|
+
*/ _proto.copyOldBufferData = function copyOldBufferData(srcByteOffset, dstByteOffset, byteLength) {
|
|
38444
|
+
this._simulator.readBinding.buffer.copyFromBuffer(this._oldReadBuffer, srcByteOffset, dstByteOffset, byteLength);
|
|
38445
|
+
this._simulator.writeBinding.buffer.copyFromBuffer(this._oldWriteBuffer, srcByteOffset, dstByteOffset, byteLength);
|
|
38446
|
+
};
|
|
38447
|
+
/**
|
|
38448
|
+
* Destroy pre-resize buffers saved during `resize`.
|
|
38449
|
+
*/ _proto.destroyOldBuffers = function destroyOldBuffers() {
|
|
38450
|
+
var _this__oldReadBuffer, _this__oldWriteBuffer;
|
|
38451
|
+
(_this__oldReadBuffer = this._oldReadBuffer) == null ? void 0 : _this__oldReadBuffer.destroy();
|
|
38452
|
+
(_this__oldWriteBuffer = this._oldWriteBuffer) == null ? void 0 : _this__oldWriteBuffer.destroy();
|
|
38453
|
+
this._oldReadBuffer = null;
|
|
38454
|
+
this._oldWriteBuffer = null;
|
|
38455
|
+
};
|
|
38456
|
+
/**
|
|
38457
|
+
* Run one simulation step.
|
|
38458
|
+
* @param shaderData - Shader data with current macros and uniforms
|
|
38459
|
+
* @param particleCount - Total particle slot count
|
|
38460
|
+
* @param firstActive - First active particle index in ring buffer
|
|
38461
|
+
* @param firstFree - First free particle index in ring buffer
|
|
38462
|
+
* @param deltaTime - Frame delta time
|
|
38463
|
+
*/ _proto.update = function update(shaderData, particleCount, firstActive, firstFree, deltaTime) {
|
|
38464
|
+
if (firstActive === firstFree) return;
|
|
38465
|
+
shaderData.setFloat(ParticleTransformFeedbackSimulator._deltaTimeProperty, deltaTime);
|
|
38466
|
+
if (!this._simulator.beginUpdate(shaderData, ParticleBufferUtils.feedbackVertexElements, this._instanceBinding, ParticleBufferUtils.feedbackInstanceElements)) return;
|
|
38467
|
+
if (firstActive < firstFree) {
|
|
38468
|
+
this._simulator.draw(MeshTopology.Points, firstActive, firstFree - firstActive);
|
|
38469
|
+
} else {
|
|
38470
|
+
this._simulator.draw(MeshTopology.Points, firstActive, particleCount - firstActive);
|
|
38471
|
+
if (firstFree > 0) {
|
|
38472
|
+
this._simulator.draw(MeshTopology.Points, 0, firstFree);
|
|
38473
|
+
}
|
|
38474
|
+
}
|
|
38475
|
+
this._simulator.endUpdate();
|
|
38476
|
+
};
|
|
38477
|
+
_proto.destroy = function destroy() {
|
|
38478
|
+
var _this__simulator;
|
|
38479
|
+
(_this__simulator = this._simulator) == null ? void 0 : _this__simulator.destroy();
|
|
38480
|
+
};
|
|
38481
|
+
_create_class$2(ParticleTransformFeedbackSimulator, [
|
|
38482
|
+
{
|
|
38483
|
+
key: "readBinding",
|
|
38484
|
+
get: /**
|
|
38485
|
+
* The current read buffer binding for the render pass.
|
|
38486
|
+
*/ function get() {
|
|
38487
|
+
return this._simulator.readBinding;
|
|
38488
|
+
}
|
|
38489
|
+
}
|
|
38490
|
+
]);
|
|
38491
|
+
return ParticleTransformFeedbackSimulator;
|
|
38492
|
+
}();
|
|
38493
|
+
ParticleTransformFeedbackSimulator._deltaTimeProperty = ShaderProperty.getByName("renderer_DeltaTime");
|
|
38062
38494
|
/**
|
|
38063
38495
|
* Particle curve mode.
|
|
38064
38496
|
*/ var ParticleCurveMode = /*#__PURE__*/ function(ParticleCurveMode) {
|
|
@@ -38096,6 +38528,7 @@ __decorate$1([
|
|
|
38096
38528
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["Shape"] = 2941263940] = "Shape";
|
|
38097
38529
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["GravityModifier"] = 2759560269] = "GravityModifier";
|
|
38098
38530
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["ForceOverLifetime"] = 3875246972] = "ForceOverLifetime";
|
|
38531
|
+
ParticleRandomSubSeeds[ParticleRandomSubSeeds["LimitVelocityOverLifetime"] = 3047300990] = "LimitVelocityOverLifetime";
|
|
38099
38532
|
return ParticleRandomSubSeeds;
|
|
38100
38533
|
}({});
|
|
38101
38534
|
/**
|
|
@@ -39145,6 +39578,413 @@ __decorate$1([
|
|
|
39145
39578
|
__decorate$1([
|
|
39146
39579
|
deepClone
|
|
39147
39580
|
], ForceOverLifetimeModule.prototype, "_forceZ", void 0);
|
|
39581
|
+
/**
|
|
39582
|
+
* Limit velocity over lifetime module.
|
|
39583
|
+
*/ var LimitVelocityOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
|
|
39584
|
+
_inherits$2(LimitVelocityOverLifetimeModule, ParticleGeneratorModule);
|
|
39585
|
+
function LimitVelocityOverLifetimeModule(generator) {
|
|
39586
|
+
var _this;
|
|
39587
|
+
_this = ParticleGeneratorModule.call(this, generator) || this, /** @internal */ _this._limitRand = new Rand(0, ParticleRandomSubSeeds.LimitVelocityOverLifetime), _this._limitMinConstantVec = new Vector3(), _this._limitMaxConstantVec = new Vector3(), _this._dragConstantVec = new Vector2(), _this._separateAxes = false, _this._dampen = 1, _this._multiplyDragByParticleSize = false, _this._multiplyDragByParticleVelocity = false, _this._space = ParticleSimulationSpace.Local;
|
|
39588
|
+
_this.limitX = new ParticleCompositeCurve(1);
|
|
39589
|
+
_this.limitY = new ParticleCompositeCurve(1);
|
|
39590
|
+
_this.limitZ = new ParticleCompositeCurve(1);
|
|
39591
|
+
_this.drag = new ParticleCompositeCurve(0);
|
|
39592
|
+
return _this;
|
|
39593
|
+
}
|
|
39594
|
+
var _proto = LimitVelocityOverLifetimeModule.prototype;
|
|
39595
|
+
/**
|
|
39596
|
+
* @internal
|
|
39597
|
+
*/ _proto._isDragRandomMode = function _isDragRandomMode() {
|
|
39598
|
+
return this._drag.mode === ParticleCurveMode.TwoConstants || this._drag.mode === ParticleCurveMode.TwoCurves;
|
|
39599
|
+
};
|
|
39600
|
+
/**
|
|
39601
|
+
* @internal
|
|
39602
|
+
*/ _proto._isLimitRandomMode = function _isLimitRandomMode() {
|
|
39603
|
+
if (this._separateAxes) {
|
|
39604
|
+
return (this._limitX.mode === ParticleCurveMode.TwoConstants || this._limitX.mode === ParticleCurveMode.TwoCurves) && (this._limitY.mode === ParticleCurveMode.TwoConstants || this._limitY.mode === ParticleCurveMode.TwoCurves) && (this._limitZ.mode === ParticleCurveMode.TwoConstants || this._limitZ.mode === ParticleCurveMode.TwoCurves);
|
|
39605
|
+
}
|
|
39606
|
+
return this._limitX.mode === ParticleCurveMode.TwoConstants || this._limitX.mode === ParticleCurveMode.TwoCurves;
|
|
39607
|
+
};
|
|
39608
|
+
/**
|
|
39609
|
+
* @internal
|
|
39610
|
+
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
39611
|
+
var enabledModuleMacro = null;
|
|
39612
|
+
var separateAxesMacro = null;
|
|
39613
|
+
var limitModeMacro = null;
|
|
39614
|
+
var limitRandomMacro = null;
|
|
39615
|
+
var dragCurveMacro = null;
|
|
39616
|
+
var dragRandomMacro = null;
|
|
39617
|
+
var dragSizeMacro = null;
|
|
39618
|
+
var dragVelocityMacro = null;
|
|
39619
|
+
if (this.enabled) {
|
|
39620
|
+
enabledModuleMacro = LimitVelocityOverLifetimeModule._enabledMacro;
|
|
39621
|
+
// Dampen
|
|
39622
|
+
shaderData.setFloat(LimitVelocityOverLifetimeModule._dampenProperty, this._dampen);
|
|
39623
|
+
// Space
|
|
39624
|
+
shaderData.setInt(LimitVelocityOverLifetimeModule._spaceProperty, this._space);
|
|
39625
|
+
// Limit
|
|
39626
|
+
if (this._separateAxes) {
|
|
39627
|
+
separateAxesMacro = LimitVelocityOverLifetimeModule._separateAxesMacro;
|
|
39628
|
+
var result = this._uploadSeparateAxisLimits(shaderData);
|
|
39629
|
+
limitModeMacro = result.modeMacro;
|
|
39630
|
+
limitRandomMacro = result.randomMacro;
|
|
39631
|
+
} else {
|
|
39632
|
+
var result1 = this._uploadScalarLimit(shaderData);
|
|
39633
|
+
limitModeMacro = result1.modeMacro;
|
|
39634
|
+
limitRandomMacro = result1.randomMacro;
|
|
39635
|
+
}
|
|
39636
|
+
// Drag
|
|
39637
|
+
var dragResult = this._uploadDrag(shaderData);
|
|
39638
|
+
dragCurveMacro = dragResult.curveMacro;
|
|
39639
|
+
dragRandomMacro = dragResult.randomMacro;
|
|
39640
|
+
// Drag modifiers
|
|
39641
|
+
if (this._multiplyDragByParticleSize) {
|
|
39642
|
+
dragSizeMacro = LimitVelocityOverLifetimeModule._multiplyDragBySizeMacro;
|
|
39643
|
+
}
|
|
39644
|
+
if (this._multiplyDragByParticleVelocity) {
|
|
39645
|
+
dragVelocityMacro = LimitVelocityOverLifetimeModule._multiplyDragByVelocityMacro;
|
|
39646
|
+
}
|
|
39647
|
+
}
|
|
39648
|
+
this._enabledModuleMacro = this._enableMacro(shaderData, this._enabledModuleMacro, enabledModuleMacro);
|
|
39649
|
+
this._separateAxesCachedMacro = this._enableMacro(shaderData, this._separateAxesCachedMacro, separateAxesMacro);
|
|
39650
|
+
this._limitModeMacro = this._enableMacro(shaderData, this._limitModeMacro, limitModeMacro);
|
|
39651
|
+
this._limitRandomMacro = this._enableMacro(shaderData, this._limitRandomMacro, limitRandomMacro);
|
|
39652
|
+
this._dragCurveCachedMacro = this._enableMacro(shaderData, this._dragCurveCachedMacro, dragCurveMacro);
|
|
39653
|
+
this._dragRandomCachedMacro = this._enableMacro(shaderData, this._dragRandomCachedMacro, dragRandomMacro);
|
|
39654
|
+
this._dragSizeMacro = this._enableMacro(shaderData, this._dragSizeMacro, dragSizeMacro);
|
|
39655
|
+
this._dragVelocityMacro = this._enableMacro(shaderData, this._dragVelocityMacro, dragVelocityMacro);
|
|
39656
|
+
};
|
|
39657
|
+
/**
|
|
39658
|
+
* @internal
|
|
39659
|
+
*/ _proto._resetRandomSeed = function _resetRandomSeed(seed) {
|
|
39660
|
+
this._limitRand.reset(seed, ParticleRandomSubSeeds.LimitVelocityOverLifetime);
|
|
39661
|
+
};
|
|
39662
|
+
_proto._uploadScalarLimit = function _uploadScalarLimit(shaderData) {
|
|
39663
|
+
var limitX = this._limitX;
|
|
39664
|
+
var modeMacro = null;
|
|
39665
|
+
var randomMacro = null;
|
|
39666
|
+
var isRandomCurveMode = limitX.mode === ParticleCurveMode.TwoCurves;
|
|
39667
|
+
if (isRandomCurveMode || limitX.mode === ParticleCurveMode.Curve) {
|
|
39668
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._limitMaxCurveProperty, limitX.curveMax._getTypeArray());
|
|
39669
|
+
modeMacro = LimitVelocityOverLifetimeModule._limitCurveModeMacro;
|
|
39670
|
+
if (isRandomCurveMode) {
|
|
39671
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._limitMinCurveProperty, limitX.curveMin._getTypeArray());
|
|
39672
|
+
randomMacro = LimitVelocityOverLifetimeModule._limitIsRandomMacro;
|
|
39673
|
+
}
|
|
39674
|
+
} else {
|
|
39675
|
+
shaderData.setFloat(LimitVelocityOverLifetimeModule._limitMaxConstProperty, limitX.constantMax);
|
|
39676
|
+
modeMacro = LimitVelocityOverLifetimeModule._limitConstantModeMacro;
|
|
39677
|
+
if (limitX.mode === ParticleCurveMode.TwoConstants) {
|
|
39678
|
+
shaderData.setFloat(LimitVelocityOverLifetimeModule._limitMinConstProperty, limitX.constantMin);
|
|
39679
|
+
randomMacro = LimitVelocityOverLifetimeModule._limitIsRandomMacro;
|
|
39680
|
+
}
|
|
39681
|
+
}
|
|
39682
|
+
return {
|
|
39683
|
+
modeMacro: modeMacro,
|
|
39684
|
+
randomMacro: randomMacro
|
|
39685
|
+
};
|
|
39686
|
+
};
|
|
39687
|
+
_proto._uploadSeparateAxisLimits = function _uploadSeparateAxisLimits(shaderData) {
|
|
39688
|
+
var limitX = this._limitX;
|
|
39689
|
+
var limitY = this._limitY;
|
|
39690
|
+
var limitZ = this._limitZ;
|
|
39691
|
+
var modeMacro = null;
|
|
39692
|
+
var randomMacro = null;
|
|
39693
|
+
var isRandomCurveMode = limitX.mode === ParticleCurveMode.TwoCurves && limitY.mode === ParticleCurveMode.TwoCurves && limitZ.mode === ParticleCurveMode.TwoCurves;
|
|
39694
|
+
if (isRandomCurveMode || limitX.mode === ParticleCurveMode.Curve && limitY.mode === ParticleCurveMode.Curve && limitZ.mode === ParticleCurveMode.Curve) {
|
|
39695
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._limitXMaxCurveProperty, limitX.curveMax._getTypeArray());
|
|
39696
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._limitYMaxCurveProperty, limitY.curveMax._getTypeArray());
|
|
39697
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._limitZMaxCurveProperty, limitZ.curveMax._getTypeArray());
|
|
39698
|
+
modeMacro = LimitVelocityOverLifetimeModule._limitCurveModeMacro;
|
|
39699
|
+
if (isRandomCurveMode) {
|
|
39700
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._limitXMinCurveProperty, limitX.curveMin._getTypeArray());
|
|
39701
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._limitYMinCurveProperty, limitY.curveMin._getTypeArray());
|
|
39702
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._limitZMinCurveProperty, limitZ.curveMin._getTypeArray());
|
|
39703
|
+
randomMacro = LimitVelocityOverLifetimeModule._limitIsRandomMacro;
|
|
39704
|
+
}
|
|
39705
|
+
} else {
|
|
39706
|
+
var constantMax = this._limitMaxConstantVec;
|
|
39707
|
+
constantMax.set(limitX.constantMax, limitY.constantMax, limitZ.constantMax);
|
|
39708
|
+
shaderData.setVector3(LimitVelocityOverLifetimeModule._limitMaxConstVecProperty, constantMax);
|
|
39709
|
+
modeMacro = LimitVelocityOverLifetimeModule._limitConstantModeMacro;
|
|
39710
|
+
if (limitX.mode === ParticleCurveMode.TwoConstants && limitY.mode === ParticleCurveMode.TwoConstants && limitZ.mode === ParticleCurveMode.TwoConstants) {
|
|
39711
|
+
var constantMin = this._limitMinConstantVec;
|
|
39712
|
+
constantMin.set(limitX.constantMin, limitY.constantMin, limitZ.constantMin);
|
|
39713
|
+
shaderData.setVector3(LimitVelocityOverLifetimeModule._limitMinConstVecProperty, constantMin);
|
|
39714
|
+
randomMacro = LimitVelocityOverLifetimeModule._limitIsRandomMacro;
|
|
39715
|
+
}
|
|
39716
|
+
}
|
|
39717
|
+
return {
|
|
39718
|
+
modeMacro: modeMacro,
|
|
39719
|
+
randomMacro: randomMacro
|
|
39720
|
+
};
|
|
39721
|
+
};
|
|
39722
|
+
_proto._uploadDrag = function _uploadDrag(shaderData) {
|
|
39723
|
+
var drag = this._drag;
|
|
39724
|
+
var curveMacro = null;
|
|
39725
|
+
var randomMacro = null;
|
|
39726
|
+
var isRandomCurveMode = drag.mode === ParticleCurveMode.TwoCurves;
|
|
39727
|
+
if (isRandomCurveMode || drag.mode === ParticleCurveMode.Curve) {
|
|
39728
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._dragMaxCurveProperty, drag.curveMax._getTypeArray());
|
|
39729
|
+
curveMacro = LimitVelocityOverLifetimeModule._dragCurveModeMacro;
|
|
39730
|
+
if (isRandomCurveMode) {
|
|
39731
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._dragMinCurveProperty, drag.curveMin._getTypeArray());
|
|
39732
|
+
randomMacro = LimitVelocityOverLifetimeModule._dragIsRandomMacro;
|
|
39733
|
+
}
|
|
39734
|
+
} else {
|
|
39735
|
+
var dragVec = this._dragConstantVec;
|
|
39736
|
+
if (drag.mode === ParticleCurveMode.TwoConstants) {
|
|
39737
|
+
dragVec.set(drag.constantMin, drag.constantMax);
|
|
39738
|
+
} else {
|
|
39739
|
+
dragVec.set(drag.constantMax, drag.constantMax);
|
|
39740
|
+
}
|
|
39741
|
+
shaderData.setVector2(LimitVelocityOverLifetimeModule._dragConstantProperty, dragVec);
|
|
39742
|
+
}
|
|
39743
|
+
return {
|
|
39744
|
+
curveMacro: curveMacro,
|
|
39745
|
+
randomMacro: randomMacro
|
|
39746
|
+
};
|
|
39747
|
+
};
|
|
39748
|
+
_create_class$2(LimitVelocityOverLifetimeModule, [
|
|
39749
|
+
{
|
|
39750
|
+
key: "separateAxes",
|
|
39751
|
+
get: /**
|
|
39752
|
+
* Whether to limit velocity on each axis separately.
|
|
39753
|
+
*/ function get() {
|
|
39754
|
+
return this._separateAxes;
|
|
39755
|
+
},
|
|
39756
|
+
set: function set(value) {
|
|
39757
|
+
if (value !== this._separateAxes) {
|
|
39758
|
+
this._separateAxes = value;
|
|
39759
|
+
this._generator._renderer._onGeneratorParamsChanged();
|
|
39760
|
+
}
|
|
39761
|
+
}
|
|
39762
|
+
},
|
|
39763
|
+
{
|
|
39764
|
+
key: "limit",
|
|
39765
|
+
get: /**
|
|
39766
|
+
* Speed limit when separateAxes is false.
|
|
39767
|
+
*/ function get() {
|
|
39768
|
+
return this._limitX;
|
|
39769
|
+
},
|
|
39770
|
+
set: function set(value) {
|
|
39771
|
+
this.limitX = value;
|
|
39772
|
+
}
|
|
39773
|
+
},
|
|
39774
|
+
{
|
|
39775
|
+
key: "limitX",
|
|
39776
|
+
get: /**
|
|
39777
|
+
* Speed limit for the x-axis (or overall limit when separateAxes is false).
|
|
39778
|
+
*/ function get() {
|
|
39779
|
+
return this._limitX;
|
|
39780
|
+
},
|
|
39781
|
+
set: function set(value) {
|
|
39782
|
+
var lastValue = this._limitX;
|
|
39783
|
+
if (value !== lastValue) {
|
|
39784
|
+
this._limitX = value;
|
|
39785
|
+
this._onCompositeCurveChange(lastValue, value);
|
|
39786
|
+
}
|
|
39787
|
+
}
|
|
39788
|
+
},
|
|
39789
|
+
{
|
|
39790
|
+
key: "limitY",
|
|
39791
|
+
get: /**
|
|
39792
|
+
* Speed limit for the y-axis.
|
|
39793
|
+
*/ function get() {
|
|
39794
|
+
return this._limitY;
|
|
39795
|
+
},
|
|
39796
|
+
set: function set(value) {
|
|
39797
|
+
var lastValue = this._limitY;
|
|
39798
|
+
if (value !== lastValue) {
|
|
39799
|
+
this._limitY = value;
|
|
39800
|
+
this._onCompositeCurveChange(lastValue, value);
|
|
39801
|
+
}
|
|
39802
|
+
}
|
|
39803
|
+
},
|
|
39804
|
+
{
|
|
39805
|
+
key: "limitZ",
|
|
39806
|
+
get: /**
|
|
39807
|
+
* Speed limit for the z-axis.
|
|
39808
|
+
*/ function get() {
|
|
39809
|
+
return this._limitZ;
|
|
39810
|
+
},
|
|
39811
|
+
set: function set(value) {
|
|
39812
|
+
var lastValue = this._limitZ;
|
|
39813
|
+
if (value !== lastValue) {
|
|
39814
|
+
this._limitZ = value;
|
|
39815
|
+
this._onCompositeCurveChange(lastValue, value);
|
|
39816
|
+
}
|
|
39817
|
+
}
|
|
39818
|
+
},
|
|
39819
|
+
{
|
|
39820
|
+
key: "dampen",
|
|
39821
|
+
get: /**
|
|
39822
|
+
* Controls how much the velocity is dampened when it exceeds the limit.
|
|
39823
|
+
* @remarks Value is clamped to [0, 1]. 0 means no damping, 1 means full damping.
|
|
39824
|
+
*/ function get() {
|
|
39825
|
+
return this._dampen;
|
|
39826
|
+
},
|
|
39827
|
+
set: function set(value) {
|
|
39828
|
+
value = Math.max(0, Math.min(1, value));
|
|
39829
|
+
if (value !== this._dampen) {
|
|
39830
|
+
this._dampen = value;
|
|
39831
|
+
this._generator._renderer._onGeneratorParamsChanged();
|
|
39832
|
+
}
|
|
39833
|
+
}
|
|
39834
|
+
},
|
|
39835
|
+
{
|
|
39836
|
+
key: "drag",
|
|
39837
|
+
get: /**
|
|
39838
|
+
* Controls the amount of drag applied to particle velocities.
|
|
39839
|
+
*/ function get() {
|
|
39840
|
+
return this._drag;
|
|
39841
|
+
},
|
|
39842
|
+
set: function set(value) {
|
|
39843
|
+
var lastValue = this._drag;
|
|
39844
|
+
if (value !== lastValue) {
|
|
39845
|
+
this._drag = value;
|
|
39846
|
+
this._onCompositeCurveChange(lastValue, value);
|
|
39847
|
+
}
|
|
39848
|
+
}
|
|
39849
|
+
},
|
|
39850
|
+
{
|
|
39851
|
+
key: "multiplyDragByParticleSize",
|
|
39852
|
+
get: /**
|
|
39853
|
+
* Adjust the amount of drag based on particle sizes.
|
|
39854
|
+
*/ function get() {
|
|
39855
|
+
return this._multiplyDragByParticleSize;
|
|
39856
|
+
},
|
|
39857
|
+
set: function set(value) {
|
|
39858
|
+
if (value !== this._multiplyDragByParticleSize) {
|
|
39859
|
+
this._multiplyDragByParticleSize = value;
|
|
39860
|
+
this._generator._renderer._onGeneratorParamsChanged();
|
|
39861
|
+
}
|
|
39862
|
+
}
|
|
39863
|
+
},
|
|
39864
|
+
{
|
|
39865
|
+
key: "multiplyDragByParticleVelocity",
|
|
39866
|
+
get: /**
|
|
39867
|
+
* Adjust the amount of drag based on particle speeds.
|
|
39868
|
+
*/ function get() {
|
|
39869
|
+
return this._multiplyDragByParticleVelocity;
|
|
39870
|
+
},
|
|
39871
|
+
set: function set(value) {
|
|
39872
|
+
if (value !== this._multiplyDragByParticleVelocity) {
|
|
39873
|
+
this._multiplyDragByParticleVelocity = value;
|
|
39874
|
+
this._generator._renderer._onGeneratorParamsChanged();
|
|
39875
|
+
}
|
|
39876
|
+
}
|
|
39877
|
+
},
|
|
39878
|
+
{
|
|
39879
|
+
key: "space",
|
|
39880
|
+
get: /**
|
|
39881
|
+
* Specifies if the velocity limits are in local space or world space.
|
|
39882
|
+
*/ function get() {
|
|
39883
|
+
return this._space;
|
|
39884
|
+
},
|
|
39885
|
+
set: function set(value) {
|
|
39886
|
+
if (value !== this._space) {
|
|
39887
|
+
this._space = value;
|
|
39888
|
+
this._generator._renderer._onGeneratorParamsChanged();
|
|
39889
|
+
}
|
|
39890
|
+
}
|
|
39891
|
+
},
|
|
39892
|
+
{
|
|
39893
|
+
key: "enabled",
|
|
39894
|
+
get: /**
|
|
39895
|
+
* Specifies whether the module is enabled.
|
|
39896
|
+
* @remarks This module requires WebGL2, On WebGL1, enabling will be silently ignored.
|
|
39897
|
+
*/ function get() {
|
|
39898
|
+
return this._enabled;
|
|
39899
|
+
},
|
|
39900
|
+
set: function set(value) {
|
|
39901
|
+
if (value !== this._enabled) {
|
|
39902
|
+
if (value && !this._generator._renderer.engine._hardwareRenderer.isWebGL2) {
|
|
39903
|
+
return;
|
|
39904
|
+
}
|
|
39905
|
+
this._enabled = value;
|
|
39906
|
+
this._generator._setTransformFeedback(value);
|
|
39907
|
+
this._generator._renderer._onGeneratorParamsChanged();
|
|
39908
|
+
}
|
|
39909
|
+
}
|
|
39910
|
+
}
|
|
39911
|
+
]);
|
|
39912
|
+
return LimitVelocityOverLifetimeModule;
|
|
39913
|
+
}(ParticleGeneratorModule);
|
|
39914
|
+
LimitVelocityOverLifetimeModule._enabledMacro = ShaderMacro.getByName("RENDERER_LVL_MODULE_ENABLED");
|
|
39915
|
+
LimitVelocityOverLifetimeModule._separateAxesMacro = ShaderMacro.getByName("RENDERER_LVL_SEPARATE_AXES");
|
|
39916
|
+
LimitVelocityOverLifetimeModule._limitConstantModeMacro = ShaderMacro.getByName("RENDERER_LVL_LIMIT_CONSTANT_MODE");
|
|
39917
|
+
LimitVelocityOverLifetimeModule._limitCurveModeMacro = ShaderMacro.getByName("RENDERER_LVL_LIMIT_CURVE_MODE");
|
|
39918
|
+
LimitVelocityOverLifetimeModule._limitIsRandomMacro = ShaderMacro.getByName("RENDERER_LVL_LIMIT_IS_RANDOM_TWO");
|
|
39919
|
+
LimitVelocityOverLifetimeModule._dragCurveModeMacro = ShaderMacro.getByName("RENDERER_LVL_DRAG_CURVE_MODE");
|
|
39920
|
+
LimitVelocityOverLifetimeModule._dragIsRandomMacro = ShaderMacro.getByName("RENDERER_LVL_DRAG_IS_RANDOM_TWO");
|
|
39921
|
+
LimitVelocityOverLifetimeModule._multiplyDragBySizeMacro = ShaderMacro.getByName("RENDERER_LVL_DRAG_MULTIPLY_SIZE");
|
|
39922
|
+
LimitVelocityOverLifetimeModule._multiplyDragByVelocityMacro = ShaderMacro.getByName("RENDERER_LVL_DRAG_MULTIPLY_VELOCITY");
|
|
39923
|
+
LimitVelocityOverLifetimeModule._limitMaxConstProperty = ShaderProperty.getByName("renderer_LVLLimitMaxConst");
|
|
39924
|
+
LimitVelocityOverLifetimeModule._limitMinConstProperty = ShaderProperty.getByName("renderer_LVLLimitMinConst");
|
|
39925
|
+
LimitVelocityOverLifetimeModule._limitMaxCurveProperty = ShaderProperty.getByName("renderer_LVLLimitMaxCurve");
|
|
39926
|
+
LimitVelocityOverLifetimeModule._limitMinCurveProperty = ShaderProperty.getByName("renderer_LVLLimitMinCurve");
|
|
39927
|
+
LimitVelocityOverLifetimeModule._limitMaxConstVecProperty = ShaderProperty.getByName("renderer_LVLLimitMaxConstVector");
|
|
39928
|
+
LimitVelocityOverLifetimeModule._limitMinConstVecProperty = ShaderProperty.getByName("renderer_LVLLimitMinConstVector");
|
|
39929
|
+
LimitVelocityOverLifetimeModule._limitXMaxCurveProperty = ShaderProperty.getByName("renderer_LVLLimitXMaxCurve");
|
|
39930
|
+
LimitVelocityOverLifetimeModule._limitXMinCurveProperty = ShaderProperty.getByName("renderer_LVLLimitXMinCurve");
|
|
39931
|
+
LimitVelocityOverLifetimeModule._limitYMaxCurveProperty = ShaderProperty.getByName("renderer_LVLLimitYMaxCurve");
|
|
39932
|
+
LimitVelocityOverLifetimeModule._limitYMinCurveProperty = ShaderProperty.getByName("renderer_LVLLimitYMinCurve");
|
|
39933
|
+
LimitVelocityOverLifetimeModule._limitZMaxCurveProperty = ShaderProperty.getByName("renderer_LVLLimitZMaxCurve");
|
|
39934
|
+
LimitVelocityOverLifetimeModule._limitZMinCurveProperty = ShaderProperty.getByName("renderer_LVLLimitZMinCurve");
|
|
39935
|
+
LimitVelocityOverLifetimeModule._dampenProperty = ShaderProperty.getByName("renderer_LVLDampen");
|
|
39936
|
+
LimitVelocityOverLifetimeModule._dragConstantProperty = ShaderProperty.getByName("renderer_LVLDragConstant");
|
|
39937
|
+
LimitVelocityOverLifetimeModule._dragMaxCurveProperty = ShaderProperty.getByName("renderer_LVLDragMaxCurve");
|
|
39938
|
+
LimitVelocityOverLifetimeModule._dragMinCurveProperty = ShaderProperty.getByName("renderer_LVLDragMinCurve");
|
|
39939
|
+
LimitVelocityOverLifetimeModule._spaceProperty = ShaderProperty.getByName("renderer_LVLSpace");
|
|
39940
|
+
__decorate$1([
|
|
39941
|
+
ignoreClone
|
|
39942
|
+
], LimitVelocityOverLifetimeModule.prototype, "_limitRand", void 0);
|
|
39943
|
+
__decorate$1([
|
|
39944
|
+
ignoreClone
|
|
39945
|
+
], LimitVelocityOverLifetimeModule.prototype, "_limitMinConstantVec", void 0);
|
|
39946
|
+
__decorate$1([
|
|
39947
|
+
ignoreClone
|
|
39948
|
+
], LimitVelocityOverLifetimeModule.prototype, "_limitMaxConstantVec", void 0);
|
|
39949
|
+
__decorate$1([
|
|
39950
|
+
ignoreClone
|
|
39951
|
+
], LimitVelocityOverLifetimeModule.prototype, "_dragConstantVec", void 0);
|
|
39952
|
+
__decorate$1([
|
|
39953
|
+
ignoreClone
|
|
39954
|
+
], LimitVelocityOverLifetimeModule.prototype, "_enabledModuleMacro", void 0);
|
|
39955
|
+
__decorate$1([
|
|
39956
|
+
ignoreClone
|
|
39957
|
+
], LimitVelocityOverLifetimeModule.prototype, "_separateAxesCachedMacro", void 0);
|
|
39958
|
+
__decorate$1([
|
|
39959
|
+
ignoreClone
|
|
39960
|
+
], LimitVelocityOverLifetimeModule.prototype, "_limitModeMacro", void 0);
|
|
39961
|
+
__decorate$1([
|
|
39962
|
+
ignoreClone
|
|
39963
|
+
], LimitVelocityOverLifetimeModule.prototype, "_limitRandomMacro", void 0);
|
|
39964
|
+
__decorate$1([
|
|
39965
|
+
ignoreClone
|
|
39966
|
+
], LimitVelocityOverLifetimeModule.prototype, "_dragCurveCachedMacro", void 0);
|
|
39967
|
+
__decorate$1([
|
|
39968
|
+
ignoreClone
|
|
39969
|
+
], LimitVelocityOverLifetimeModule.prototype, "_dragRandomCachedMacro", void 0);
|
|
39970
|
+
__decorate$1([
|
|
39971
|
+
ignoreClone
|
|
39972
|
+
], LimitVelocityOverLifetimeModule.prototype, "_dragSizeMacro", void 0);
|
|
39973
|
+
__decorate$1([
|
|
39974
|
+
ignoreClone
|
|
39975
|
+
], LimitVelocityOverLifetimeModule.prototype, "_dragVelocityMacro", void 0);
|
|
39976
|
+
__decorate$1([
|
|
39977
|
+
deepClone
|
|
39978
|
+
], LimitVelocityOverLifetimeModule.prototype, "_limitX", void 0);
|
|
39979
|
+
__decorate$1([
|
|
39980
|
+
deepClone
|
|
39981
|
+
], LimitVelocityOverLifetimeModule.prototype, "_limitY", void 0);
|
|
39982
|
+
__decorate$1([
|
|
39983
|
+
deepClone
|
|
39984
|
+
], LimitVelocityOverLifetimeModule.prototype, "_limitZ", void 0);
|
|
39985
|
+
__decorate$1([
|
|
39986
|
+
deepClone
|
|
39987
|
+
], LimitVelocityOverLifetimeModule.prototype, "_drag", void 0);
|
|
39148
39988
|
/**
|
|
39149
39989
|
* Control how Particle Generator apply transform scale.
|
|
39150
39990
|
*/ var ParticleScaleMode = /*#__PURE__*/ function(ParticleScaleMode) {
|
|
@@ -40186,6 +41026,8 @@ __decorate$1([
|
|
|
40186
41026
|
/** @internal */ this._firstRetiredElement = 0;
|
|
40187
41027
|
/** @internal */ this._vertexBufferBindings = new Array();
|
|
40188
41028
|
/** @internal */ this._subPrimitive = new SubMesh(0, 0, MeshTopology.Triangles);
|
|
41029
|
+
/** @internal */ this._useTransformFeedback = false;
|
|
41030
|
+
/** @internal */ this._feedbackBindingIndex = -1;
|
|
40189
41031
|
this._isPlaying = false;
|
|
40190
41032
|
this._instanceBufferResized = false;
|
|
40191
41033
|
this._waitProcessRetiredElementCount = 0;
|
|
@@ -40204,6 +41046,7 @@ __decorate$1([
|
|
|
40204
41046
|
this.velocityOverLifetime = new VelocityOverLifetimeModule(this);
|
|
40205
41047
|
this.forceOverLifetime = new ForceOverLifetimeModule(this);
|
|
40206
41048
|
this.sizeOverLifetime = new SizeOverLifetimeModule(this);
|
|
41049
|
+
this.limitVelocityOverLifetime = new LimitVelocityOverLifetimeModule(this);
|
|
40207
41050
|
this.emission.enabled = true;
|
|
40208
41051
|
}
|
|
40209
41052
|
var _proto = ParticleGenerator.prototype;
|
|
@@ -40242,11 +41085,7 @@ __decorate$1([
|
|
|
40242
41085
|
} else {
|
|
40243
41086
|
this._isPlaying = false;
|
|
40244
41087
|
if (stopMode === ParticleStopMode.StopEmittingAndClear) {
|
|
40245
|
-
|
|
40246
|
-
var firstFreeElement = this._firstFreeElement;
|
|
40247
|
-
this._firstRetiredElement = firstFreeElement;
|
|
40248
|
-
this._firstActiveElement = firstFreeElement;
|
|
40249
|
-
this._firstNewElement = firstFreeElement;
|
|
41088
|
+
this._clearActiveParticles();
|
|
40250
41089
|
this._playTime = 0;
|
|
40251
41090
|
this._firstActiveTransformedBoundingBox = this._firstFreeTransformedBoundingBox;
|
|
40252
41091
|
this.emission._reset();
|
|
@@ -40330,6 +41169,16 @@ __decorate$1([
|
|
|
40330
41169
|
this._isPlaying = false;
|
|
40331
41170
|
}
|
|
40332
41171
|
}
|
|
41172
|
+
// Retire all particles on device restore before bounds/volume bookkeeping
|
|
41173
|
+
var isContentLost = this._instanceVertexBufferBinding._buffer.isContentLost;
|
|
41174
|
+
if (isContentLost) {
|
|
41175
|
+
this._firstActiveElement = 0;
|
|
41176
|
+
this._firstNewElement = 0;
|
|
41177
|
+
this._firstFreeElement = 0;
|
|
41178
|
+
this._firstRetiredElement = 0;
|
|
41179
|
+
this._waitProcessRetiredElementCount = 0;
|
|
41180
|
+
this._firstActiveTransformedBoundingBox = this._firstFreeTransformedBoundingBox;
|
|
41181
|
+
}
|
|
40333
41182
|
if (this.isAlive) {
|
|
40334
41183
|
if (main.simulationSpace === ParticleSimulationSpace.World) {
|
|
40335
41184
|
this._generateTransformedBounds();
|
|
@@ -40343,16 +41192,21 @@ __decorate$1([
|
|
|
40343
41192
|
if (this.isAlive !== lastAlive) {
|
|
40344
41193
|
this._renderer._onWorldVolumeChanged();
|
|
40345
41194
|
}
|
|
40346
|
-
|
|
40347
|
-
//
|
|
40348
|
-
// Another choice is just add new particles to vertex buffer and render all particles ignore the retired particle in shader, especially billboards
|
|
40349
|
-
// But webgl don't support map buffer range, so this choice don't have performance advantage even less set data to GPU
|
|
40350
|
-
if (this._firstNewElement != this._firstFreeElement || this._waitProcessRetiredElementCount > 0 || this._instanceBufferResized || this._instanceVertexBufferBinding._buffer.isContentLost) {
|
|
41195
|
+
if (this._firstNewElement != this._firstFreeElement || this._waitProcessRetiredElementCount > 0 || this._instanceBufferResized) {
|
|
40351
41196
|
this._addActiveParticlesToVertexBuffer();
|
|
40352
41197
|
}
|
|
40353
41198
|
};
|
|
40354
41199
|
/**
|
|
40355
41200
|
* @internal
|
|
41201
|
+
* Run Transform Feedback simulation pass.
|
|
41202
|
+
*/ _proto._updateFeedback = function _updateFeedback(shaderData, deltaTime) {
|
|
41203
|
+
this._feedbackSimulator.update(shaderData, this._currentParticleCount, this._firstActiveElement, this._firstFreeElement, deltaTime);
|
|
41204
|
+
// After swap, update the render pass buffer binding to point to the latest output.
|
|
41205
|
+
// VAO is disabled in TF mode so direct assignment is safe (no stale VAO issue).
|
|
41206
|
+
this._primitive.vertexBufferBindings[this._feedbackBindingIndex] = this._feedbackSimulator.readBinding;
|
|
41207
|
+
};
|
|
41208
|
+
/**
|
|
41209
|
+
* @internal
|
|
40356
41210
|
*/ _proto._reorganizeGeometryBuffers = function _reorganizeGeometryBuffers() {
|
|
40357
41211
|
var _this = this, renderer = _this._renderer, primitive = _this._primitive, vertexBufferBindings = _this._vertexBufferBindings;
|
|
40358
41212
|
var _renderer_engine = renderer.engine, particleUtils = _renderer_engine._particleBufferUtils;
|
|
@@ -40404,6 +41258,15 @@ __decorate$1([
|
|
|
40404
41258
|
if (this._instanceVertexBufferBinding) {
|
|
40405
41259
|
vertexBufferBindings.push(this._instanceVertexBufferBinding);
|
|
40406
41260
|
}
|
|
41261
|
+
// Add feedback buffer binding for render pass
|
|
41262
|
+
if (this._useTransformFeedback) {
|
|
41263
|
+
this._feedbackBindingIndex = vertexBufferBindings.length;
|
|
41264
|
+
primitive.addVertexElement(new VertexElement(ParticleFeedbackVertexAttribute.Position, 0, VertexElementFormat.Vector3, this._feedbackBindingIndex, 1));
|
|
41265
|
+
primitive.addVertexElement(new VertexElement(ParticleFeedbackVertexAttribute.Velocity, 12, VertexElementFormat.Vector3, this._feedbackBindingIndex, 1));
|
|
41266
|
+
vertexBufferBindings.push(this._feedbackSimulator.readBinding);
|
|
41267
|
+
} else {
|
|
41268
|
+
this._feedbackBindingIndex = -1;
|
|
41269
|
+
}
|
|
40407
41270
|
primitive.setVertexBufferBindings(vertexBufferBindings);
|
|
40408
41271
|
};
|
|
40409
41272
|
/**
|
|
@@ -40419,18 +41282,28 @@ __decorate$1([
|
|
|
40419
41282
|
vertexInstanceBuffer.isGCIgnored = true;
|
|
40420
41283
|
var vertexBufferBindings = this._primitive.vertexBufferBindings;
|
|
40421
41284
|
var vertexBufferBinding = new VertexBufferBinding(vertexInstanceBuffer, stride);
|
|
40422
|
-
var instanceVertices = new Float32Array(newByteLength / 4);
|
|
40423
41285
|
var lastInstanceVertices = this._instanceVertices;
|
|
41286
|
+
var useFeedback = this._useTransformFeedback;
|
|
41287
|
+
var instanceVertices = new Float32Array(newByteLength / 4);
|
|
41288
|
+
if (useFeedback) {
|
|
41289
|
+
this._feedbackSimulator.resize(newParticleCount, vertexBufferBinding);
|
|
41290
|
+
}
|
|
40424
41291
|
if (lastInstanceVertices) {
|
|
40425
|
-
var floatStride = ParticleBufferUtils.instanceVertexFloatStride;
|
|
41292
|
+
var floatStride = ParticleBufferUtils.instanceVertexFloatStride, feedbackVertexStride = ParticleBufferUtils.feedbackVertexStride;
|
|
40426
41293
|
var firstFreeElement = this._firstFreeElement;
|
|
40427
41294
|
var firstRetiredElement = this._firstRetiredElement;
|
|
40428
41295
|
if (isIncrease) {
|
|
41296
|
+
// Copy front segment [0, firstFreeElement)
|
|
40429
41297
|
instanceVertices.set(new Float32Array(lastInstanceVertices.buffer, 0, firstFreeElement * floatStride));
|
|
41298
|
+
// Copy tail segment shifted by increaseCount
|
|
40430
41299
|
var nextFreeElement = firstFreeElement + 1;
|
|
40431
|
-
var
|
|
40432
|
-
|
|
40433
|
-
|
|
41300
|
+
var tailCount = this._currentParticleCount - nextFreeElement;
|
|
41301
|
+
var tailDstElement = nextFreeElement + increaseCount;
|
|
41302
|
+
instanceVertices.set(new Float32Array(lastInstanceVertices.buffer, nextFreeElement * floatStride * 4), tailDstElement * floatStride);
|
|
41303
|
+
if (useFeedback) {
|
|
41304
|
+
this._feedbackSimulator.copyOldBufferData(0, 0, firstFreeElement * feedbackVertexStride);
|
|
41305
|
+
this._feedbackSimulator.copyOldBufferData(nextFreeElement * feedbackVertexStride, tailDstElement * feedbackVertexStride, tailCount * feedbackVertexStride);
|
|
41306
|
+
}
|
|
40434
41307
|
this._firstNewElement > firstFreeElement && (this._firstNewElement += increaseCount);
|
|
40435
41308
|
this._firstActiveElement > firstFreeElement && (this._firstActiveElement += increaseCount);
|
|
40436
41309
|
firstRetiredElement > firstFreeElement && (this._firstRetiredElement += increaseCount);
|
|
@@ -40439,7 +41312,6 @@ __decorate$1([
|
|
|
40439
41312
|
if (firstRetiredElement <= firstFreeElement) {
|
|
40440
41313
|
migrateCount = firstFreeElement - firstRetiredElement;
|
|
40441
41314
|
bufferOffset = 0;
|
|
40442
|
-
// Maintain expanded pointers
|
|
40443
41315
|
this._firstFreeElement -= firstRetiredElement;
|
|
40444
41316
|
this._firstNewElement -= firstRetiredElement;
|
|
40445
41317
|
this._firstActiveElement -= firstRetiredElement;
|
|
@@ -40447,20 +41319,29 @@ __decorate$1([
|
|
|
40447
41319
|
} else {
|
|
40448
41320
|
migrateCount = this._currentParticleCount - firstRetiredElement;
|
|
40449
41321
|
bufferOffset = firstFreeElement;
|
|
40450
|
-
// Maintain expanded pointers
|
|
40451
41322
|
this._firstNewElement > firstFreeElement && (this._firstNewElement -= firstFreeElement);
|
|
40452
41323
|
this._firstActiveElement > firstFreeElement && (this._firstActiveElement -= firstFreeElement);
|
|
40453
41324
|
firstRetiredElement > firstFreeElement && (this._firstRetiredElement -= firstFreeElement);
|
|
40454
41325
|
}
|
|
40455
41326
|
instanceVertices.set(new Float32Array(lastInstanceVertices.buffer, firstRetiredElement * floatStride * 4, migrateCount * floatStride), bufferOffset * floatStride);
|
|
41327
|
+
if (useFeedback) {
|
|
41328
|
+
this._feedbackSimulator.copyOldBufferData(firstRetiredElement * feedbackVertexStride, bufferOffset * feedbackVertexStride, migrateCount * feedbackVertexStride);
|
|
41329
|
+
}
|
|
41330
|
+
}
|
|
41331
|
+
if (useFeedback) {
|
|
41332
|
+
this._feedbackSimulator.destroyOldBuffers();
|
|
40456
41333
|
}
|
|
40457
41334
|
this._instanceBufferResized = true;
|
|
40458
41335
|
}
|
|
40459
|
-
//
|
|
40460
|
-
|
|
41336
|
+
// Update instance buffer binding
|
|
41337
|
+
var instanceBindingIndex = lastInstanceVertices ? vertexBufferBindings.length - 1 - (useFeedback ? 1 : 0) : vertexBufferBindings.length;
|
|
41338
|
+
this._primitive.setVertexBufferBinding(instanceBindingIndex, vertexBufferBinding);
|
|
40461
41339
|
this._instanceVertices = instanceVertices;
|
|
40462
41340
|
this._instanceVertexBufferBinding = vertexBufferBinding;
|
|
40463
41341
|
this._currentParticleCount = newParticleCount;
|
|
41342
|
+
if (useFeedback) {
|
|
41343
|
+
this._primitive.setVertexBufferBinding(this._feedbackBindingIndex, this._feedbackSimulator.readBinding);
|
|
41344
|
+
}
|
|
40464
41345
|
};
|
|
40465
41346
|
/**
|
|
40466
41347
|
* @internal
|
|
@@ -40468,6 +41349,7 @@ __decorate$1([
|
|
|
40468
41349
|
this.main._updateShaderData(shaderData);
|
|
40469
41350
|
this.velocityOverLifetime._updateShaderData(shaderData);
|
|
40470
41351
|
this.forceOverLifetime._updateShaderData(shaderData);
|
|
41352
|
+
this.limitVelocityOverLifetime._updateShaderData(shaderData);
|
|
40471
41353
|
this.textureSheetAnimation._updateShaderData(shaderData);
|
|
40472
41354
|
this.sizeOverLifetime._updateShaderData(shaderData);
|
|
40473
41355
|
this.rotationOverLifetime._updateShaderData(shaderData);
|
|
@@ -40482,11 +41364,41 @@ __decorate$1([
|
|
|
40482
41364
|
this.textureSheetAnimation._resetRandomSeed(seed);
|
|
40483
41365
|
this.velocityOverLifetime._resetRandomSeed(seed);
|
|
40484
41366
|
this.forceOverLifetime._resetRandomSeed(seed);
|
|
41367
|
+
this.limitVelocityOverLifetime._resetRandomSeed(seed);
|
|
40485
41368
|
this.rotationOverLifetime._resetRandomSeed(seed);
|
|
40486
41369
|
this.colorOverLifetime._resetRandomSeed(seed);
|
|
40487
41370
|
};
|
|
40488
41371
|
/**
|
|
40489
41372
|
* @internal
|
|
41373
|
+
*/ _proto._setTransformFeedback = function _setTransformFeedback(enabled) {
|
|
41374
|
+
this._useTransformFeedback = enabled;
|
|
41375
|
+
// Switching TF mode invalidates all active particle state: feedback buffers and instance
|
|
41376
|
+
// buffer layout are incompatible between the two paths. Clear rather than show a one-frame
|
|
41377
|
+
// jump; new particles will fill in naturally from the next emit cycle.
|
|
41378
|
+
this._clearActiveParticles();
|
|
41379
|
+
if (enabled) {
|
|
41380
|
+
if (!this._feedbackSimulator) {
|
|
41381
|
+
this._feedbackSimulator = new ParticleTransformFeedbackSimulator(this._renderer.engine);
|
|
41382
|
+
}
|
|
41383
|
+
var simulator = this._feedbackSimulator;
|
|
41384
|
+
var readBinding = simulator.readBinding;
|
|
41385
|
+
if (!readBinding || readBinding.buffer.byteLength !== this._currentParticleCount * ParticleBufferUtils.feedbackVertexStride) {
|
|
41386
|
+
simulator.resize(this._currentParticleCount, this._instanceVertexBufferBinding);
|
|
41387
|
+
simulator.destroyOldBuffers();
|
|
41388
|
+
} else {
|
|
41389
|
+
simulator._instanceBinding = this._instanceVertexBufferBinding;
|
|
41390
|
+
}
|
|
41391
|
+
this._renderer.shaderData.enableMacro(ParticleGenerator._transformFeedbackMacro);
|
|
41392
|
+
// Feedback buffer swaps every frame; VAO caching would bake stale buffer handles.
|
|
41393
|
+
this._primitive.enableVAO = false;
|
|
41394
|
+
} else {
|
|
41395
|
+
this._renderer.shaderData.disableMacro(ParticleGenerator._transformFeedbackMacro);
|
|
41396
|
+
this._primitive.enableVAO = true;
|
|
41397
|
+
}
|
|
41398
|
+
this._reorganizeGeometryBuffers();
|
|
41399
|
+
};
|
|
41400
|
+
/**
|
|
41401
|
+
* @internal
|
|
40490
41402
|
*/ _proto._getAliveParticleCount = function _getAliveParticleCount() {
|
|
40491
41403
|
if (this._firstActiveElement <= this._firstFreeElement) {
|
|
40492
41404
|
return this._firstFreeElement - this._firstActiveElement;
|
|
@@ -40513,10 +41425,19 @@ __decorate$1([
|
|
|
40513
41425
|
};
|
|
40514
41426
|
/**
|
|
40515
41427
|
* @internal
|
|
41428
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
41429
|
+
if (target.limitVelocityOverLifetime.enabled) {
|
|
41430
|
+
target._setTransformFeedback(true);
|
|
41431
|
+
}
|
|
41432
|
+
};
|
|
41433
|
+
/**
|
|
41434
|
+
* @internal
|
|
40516
41435
|
*/ _proto._destroy = function _destroy() {
|
|
41436
|
+
var _this__feedbackSimulator;
|
|
40517
41437
|
this._instanceVertexBufferBinding.buffer.destroy();
|
|
40518
41438
|
this._primitive.destroy();
|
|
40519
41439
|
this.emission._destroy();
|
|
41440
|
+
(_this__feedbackSimulator = this._feedbackSimulator) == null ? void 0 : _this__feedbackSimulator.destroy();
|
|
40520
41441
|
};
|
|
40521
41442
|
/**
|
|
40522
41443
|
* @internal
|
|
@@ -40748,8 +41669,34 @@ __decorate$1([
|
|
|
40748
41669
|
instanceVertices[offset + 39] = rand1.random();
|
|
40749
41670
|
instanceVertices[offset + 40] = rand1.random();
|
|
40750
41671
|
}
|
|
41672
|
+
var limitVelocityOverLifetime = this.limitVelocityOverLifetime;
|
|
41673
|
+
if (limitVelocityOverLifetime.enabled && (limitVelocityOverLifetime._isLimitRandomMode() || limitVelocityOverLifetime._isDragRandomMode())) {
|
|
41674
|
+
instanceVertices[offset + 41] = limitVelocityOverLifetime._limitRand.random();
|
|
41675
|
+
}
|
|
41676
|
+
// Initialize feedback buffer for this particle
|
|
41677
|
+
if (this._useTransformFeedback) {
|
|
41678
|
+
this._addFeedbackParticle(firstFreeElement, position, direction, startSpeed, transform);
|
|
41679
|
+
}
|
|
40751
41680
|
this._firstFreeElement = nextFreeElement;
|
|
40752
41681
|
};
|
|
41682
|
+
_proto._addFeedbackParticle = function _addFeedbackParticle(index, shapePosition, direction, startSpeed, transform) {
|
|
41683
|
+
var position;
|
|
41684
|
+
if (this.main.simulationSpace === ParticleSimulationSpace.Local) {
|
|
41685
|
+
position = shapePosition;
|
|
41686
|
+
} else {
|
|
41687
|
+
position = ParticleGenerator._tempVector32;
|
|
41688
|
+
Vector3.transformByQuat(shapePosition, transform.worldRotationQuaternion, position);
|
|
41689
|
+
position.add(transform.worldPosition);
|
|
41690
|
+
}
|
|
41691
|
+
this._feedbackSimulator.writeParticleData(index, position, direction.x * startSpeed, direction.y * startSpeed, direction.z * startSpeed);
|
|
41692
|
+
};
|
|
41693
|
+
_proto._clearActiveParticles = function _clearActiveParticles() {
|
|
41694
|
+
var firstFreeElement = this._firstFreeElement;
|
|
41695
|
+
this._firstRetiredElement = firstFreeElement;
|
|
41696
|
+
this._firstActiveElement = firstFreeElement;
|
|
41697
|
+
this._firstNewElement = firstFreeElement;
|
|
41698
|
+
this._firstActiveTransformedBoundingBox = this._firstFreeTransformedBoundingBox;
|
|
41699
|
+
};
|
|
40753
41700
|
_proto._retireActiveParticles = function _retireActiveParticles() {
|
|
40754
41701
|
var engine = this._renderer.engine;
|
|
40755
41702
|
var frameCount = engine.time.frameCount;
|
|
@@ -40793,16 +41740,19 @@ __decorate$1([
|
|
|
40793
41740
|
return;
|
|
40794
41741
|
}
|
|
40795
41742
|
var byteStride = ParticleBufferUtils.instanceVertexStride;
|
|
40796
|
-
var start = firstActiveElement * byteStride;
|
|
40797
41743
|
var instanceBuffer = this._instanceVertexBufferBinding.buffer;
|
|
40798
41744
|
var dataBuffer = this._instanceVertices.buffer;
|
|
41745
|
+
// Feedback mode: upload in-place (indices match feedback buffer slots)
|
|
41746
|
+
// Non-feedback mode: compact to GPU offset 0
|
|
41747
|
+
var compact = !this._useTransformFeedback;
|
|
41748
|
+
var start = firstActiveElement * byteStride;
|
|
40799
41749
|
if (firstActiveElement < firstFreeElement) {
|
|
40800
|
-
instanceBuffer.setData(dataBuffer, 0, start, (firstFreeElement - firstActiveElement) * byteStride, SetDataOptions.Discard);
|
|
41750
|
+
instanceBuffer.setData(dataBuffer, compact ? 0 : start, start, (firstFreeElement - firstActiveElement) * byteStride, SetDataOptions.Discard);
|
|
40801
41751
|
} else {
|
|
40802
|
-
var
|
|
40803
|
-
instanceBuffer.setData(dataBuffer, 0, start,
|
|
41752
|
+
var firstSegmentSize = (this._currentParticleCount - firstActiveElement) * byteStride;
|
|
41753
|
+
instanceBuffer.setData(dataBuffer, compact ? 0 : start, start, firstSegmentSize, SetDataOptions.Discard);
|
|
40804
41754
|
if (firstFreeElement > 0) {
|
|
40805
|
-
instanceBuffer.setData(dataBuffer,
|
|
41755
|
+
instanceBuffer.setData(dataBuffer, compact ? firstSegmentSize : 0, 0, firstFreeElement * byteStride);
|
|
40806
41756
|
}
|
|
40807
41757
|
}
|
|
40808
41758
|
this._firstNewElement = firstFreeElement;
|
|
@@ -41020,11 +41970,13 @@ ParticleGenerator._tempVector21 = new Vector2();
|
|
|
41020
41970
|
ParticleGenerator._tempVector22 = new Vector2();
|
|
41021
41971
|
ParticleGenerator._tempVector30 = new Vector3();
|
|
41022
41972
|
ParticleGenerator._tempVector31 = new Vector3();
|
|
41973
|
+
ParticleGenerator._tempVector32 = new Vector3();
|
|
41023
41974
|
ParticleGenerator._tempMat = new Matrix();
|
|
41024
41975
|
ParticleGenerator._tempColor0 = new Color();
|
|
41025
41976
|
ParticleGenerator._tempParticleRenderers = new Array();
|
|
41026
41977
|
ParticleGenerator._particleIncreaseCount = 128;
|
|
41027
41978
|
ParticleGenerator._transformedBoundsIncreaseCount = 16;
|
|
41979
|
+
ParticleGenerator._transformFeedbackMacro = ShaderMacro.getByName("RENDERER_TRANSFORM_FEEDBACK");
|
|
41028
41980
|
__decorate$1([
|
|
41029
41981
|
deepClone
|
|
41030
41982
|
], ParticleGenerator.prototype, "main", void 0);
|
|
@@ -41037,6 +41989,9 @@ __decorate$1([
|
|
|
41037
41989
|
__decorate$1([
|
|
41038
41990
|
deepClone
|
|
41039
41991
|
], ParticleGenerator.prototype, "forceOverLifetime", void 0);
|
|
41992
|
+
__decorate$1([
|
|
41993
|
+
deepClone
|
|
41994
|
+
], ParticleGenerator.prototype, "limitVelocityOverLifetime", void 0);
|
|
41040
41995
|
__decorate$1([
|
|
41041
41996
|
deepClone
|
|
41042
41997
|
], ParticleGenerator.prototype, "sizeOverLifetime", void 0);
|
|
@@ -41073,6 +42028,15 @@ __decorate$1([
|
|
|
41073
42028
|
__decorate$1([
|
|
41074
42029
|
ignoreClone
|
|
41075
42030
|
], ParticleGenerator.prototype, "_subPrimitive", void 0);
|
|
42031
|
+
__decorate$1([
|
|
42032
|
+
ignoreClone
|
|
42033
|
+
], ParticleGenerator.prototype, "_feedbackSimulator", void 0);
|
|
42034
|
+
__decorate$1([
|
|
42035
|
+
ignoreClone
|
|
42036
|
+
], ParticleGenerator.prototype, "_useTransformFeedback", void 0);
|
|
42037
|
+
__decorate$1([
|
|
42038
|
+
ignoreClone
|
|
42039
|
+
], ParticleGenerator.prototype, "_feedbackBindingIndex", void 0);
|
|
41076
42040
|
__decorate$1([
|
|
41077
42041
|
ignoreClone
|
|
41078
42042
|
], ParticleGenerator.prototype, "_isPlaying", void 0);
|
|
@@ -43220,6 +44184,7 @@ var CoreObjects = /*#__PURE__*/Object.freeze({
|
|
|
43220
44184
|
Layer: Layer,
|
|
43221
44185
|
LayerPathMask: LayerPathMask,
|
|
43222
44186
|
Light: Light,
|
|
44187
|
+
LimitVelocityOverLifetimeModule: LimitVelocityOverLifetimeModule,
|
|
43223
44188
|
Loader: Loader,
|
|
43224
44189
|
Logger: Logger,
|
|
43225
44190
|
MSAASamples: MSAASamples,
|
|
@@ -43670,6 +44635,14 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
43670
44635
|
throw "Buffer is write-only on WebGL1.0 platforms.";
|
|
43671
44636
|
}
|
|
43672
44637
|
};
|
|
44638
|
+
_proto.copyFromBuffer = function copyFromBuffer(srcBuffer, srcByteOffset, dstByteOffset, byteLength) {
|
|
44639
|
+
var gl = this._gl;
|
|
44640
|
+
gl.bindBuffer(gl.COPY_READ_BUFFER, srcBuffer._glBuffer);
|
|
44641
|
+
gl.bindBuffer(gl.COPY_WRITE_BUFFER, this._glBuffer);
|
|
44642
|
+
gl.copyBufferSubData(gl.COPY_READ_BUFFER, gl.COPY_WRITE_BUFFER, srcByteOffset, dstByteOffset, byteLength);
|
|
44643
|
+
gl.bindBuffer(gl.COPY_READ_BUFFER, null);
|
|
44644
|
+
gl.bindBuffer(gl.COPY_WRITE_BUFFER, null);
|
|
44645
|
+
};
|
|
43673
44646
|
_proto.destroy = function destroy() {
|
|
43674
44647
|
this._gl.deleteBuffer(this._glBuffer);
|
|
43675
44648
|
this._gl = null;
|
|
@@ -45160,6 +46133,150 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
45160
46133
|
};
|
|
45161
46134
|
return GLTextureCube;
|
|
45162
46135
|
}(GLTexture);
|
|
46136
|
+
/**
|
|
46137
|
+
* @internal
|
|
46138
|
+
* WebGL2 implementation of Transform Feedback.
|
|
46139
|
+
*/ var GLTransformFeedback = /*#__PURE__*/ function() {
|
|
46140
|
+
function GLTransformFeedback(rhi) {
|
|
46141
|
+
var gl = rhi.gl;
|
|
46142
|
+
this._gl = gl;
|
|
46143
|
+
this._glTransformFeedback = gl.createTransformFeedback();
|
|
46144
|
+
}
|
|
46145
|
+
var _proto = GLTransformFeedback.prototype;
|
|
46146
|
+
_proto.bindBufferRange = function bindBufferRange(index, buffer, byteOffset, byteSize) {
|
|
46147
|
+
var gl = this._gl;
|
|
46148
|
+
gl.bindBufferRange(gl.TRANSFORM_FEEDBACK_BUFFER, index, buffer._glBuffer, byteOffset, byteSize);
|
|
46149
|
+
};
|
|
46150
|
+
_proto.unbindBuffer = function unbindBuffer(index) {
|
|
46151
|
+
var gl = this._gl;
|
|
46152
|
+
gl.bindBufferBase(gl.TRANSFORM_FEEDBACK_BUFFER, index, null);
|
|
46153
|
+
};
|
|
46154
|
+
_proto.begin = function begin(primitiveMode) {
|
|
46155
|
+
this._gl.beginTransformFeedback(primitiveMode);
|
|
46156
|
+
};
|
|
46157
|
+
_proto.end = function end() {
|
|
46158
|
+
this._gl.endTransformFeedback();
|
|
46159
|
+
};
|
|
46160
|
+
_proto.bind = function bind() {
|
|
46161
|
+
var gl = this._gl;
|
|
46162
|
+
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, this._glTransformFeedback);
|
|
46163
|
+
};
|
|
46164
|
+
_proto.unbind = function unbind() {
|
|
46165
|
+
var gl = this._gl;
|
|
46166
|
+
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null);
|
|
46167
|
+
};
|
|
46168
|
+
_proto.destroy = function destroy() {
|
|
46169
|
+
if (this._glTransformFeedback) {
|
|
46170
|
+
this._gl.deleteTransformFeedback(this._glTransformFeedback);
|
|
46171
|
+
this._glTransformFeedback = null;
|
|
46172
|
+
}
|
|
46173
|
+
};
|
|
46174
|
+
return GLTransformFeedback;
|
|
46175
|
+
}();
|
|
46176
|
+
function _array_like_to_array$1(arr, len) {
|
|
46177
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
46178
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
46179
|
+
return arr2;
|
|
46180
|
+
}
|
|
46181
|
+
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
46182
|
+
if (!o) return;
|
|
46183
|
+
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
46184
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
46185
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
46186
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
46187
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
46188
|
+
}
|
|
46189
|
+
function _create_for_of_iterator_helper_loose$1(o, allowArrayLike) {
|
|
46190
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
46191
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
46192
|
+
// Fallback for engines without symbol support
|
|
46193
|
+
if (Array.isArray(o) || (it = _unsupported_iterable_to_array$1(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
46194
|
+
if (it) o = it;
|
|
46195
|
+
var i = 0;
|
|
46196
|
+
return function() {
|
|
46197
|
+
if (i >= o.length) return {
|
|
46198
|
+
done: true
|
|
46199
|
+
};
|
|
46200
|
+
return {
|
|
46201
|
+
done: false,
|
|
46202
|
+
value: o[i++]
|
|
46203
|
+
};
|
|
46204
|
+
};
|
|
46205
|
+
}
|
|
46206
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
46207
|
+
}
|
|
46208
|
+
/**
|
|
46209
|
+
* @internal
|
|
46210
|
+
* WebGL2 implementation of Transform Feedback primitive.
|
|
46211
|
+
* Maintains two VAOs (one per read direction), auto-rebuilds when program changes.
|
|
46212
|
+
*/ var GLTransformFeedbackPrimitive = /*#__PURE__*/ function() {
|
|
46213
|
+
function GLTransformFeedbackPrimitive(gl) {
|
|
46214
|
+
this._lastProgramId = -1;
|
|
46215
|
+
this._gl = gl;
|
|
46216
|
+
}
|
|
46217
|
+
var _proto = GLTransformFeedbackPrimitive.prototype;
|
|
46218
|
+
_proto.updateVertexLayout = function updateVertexLayout(program, readBinding, writeBinding, feedbackElements, inputBinding, inputElements) {
|
|
46219
|
+
if (program.id === this._lastProgramId) return;
|
|
46220
|
+
this._deleteVAOs();
|
|
46221
|
+
var attribs = program.attributeLocation;
|
|
46222
|
+
this._vaoA = this._createVAO(attribs, readBinding, feedbackElements, inputBinding, inputElements);
|
|
46223
|
+
this._vaoB = this._createVAO(attribs, writeBinding, feedbackElements, inputBinding, inputElements);
|
|
46224
|
+
this._lastProgramId = program.id;
|
|
46225
|
+
this._gl.bindVertexArray(null);
|
|
46226
|
+
};
|
|
46227
|
+
_proto.bind = function bind(readIsA) {
|
|
46228
|
+
this._gl.bindVertexArray(readIsA ? this._vaoA : this._vaoB);
|
|
46229
|
+
};
|
|
46230
|
+
_proto.unbind = function unbind() {
|
|
46231
|
+
this._gl.bindVertexArray(null);
|
|
46232
|
+
};
|
|
46233
|
+
_proto.draw = function draw(mode, first, count) {
|
|
46234
|
+
this._gl.drawArrays(mode, first, count);
|
|
46235
|
+
};
|
|
46236
|
+
_proto.invalidate = function invalidate() {
|
|
46237
|
+
this._deleteVAOs();
|
|
46238
|
+
};
|
|
46239
|
+
_proto.destroy = function destroy() {
|
|
46240
|
+
this._deleteVAOs();
|
|
46241
|
+
};
|
|
46242
|
+
_proto._deleteVAOs = function _deleteVAOs() {
|
|
46243
|
+
var gl = this._gl;
|
|
46244
|
+
if (this._vaoA) {
|
|
46245
|
+
gl.deleteVertexArray(this._vaoA);
|
|
46246
|
+
this._vaoA = null;
|
|
46247
|
+
}
|
|
46248
|
+
if (this._vaoB) {
|
|
46249
|
+
gl.deleteVertexArray(this._vaoB);
|
|
46250
|
+
this._vaoB = null;
|
|
46251
|
+
}
|
|
46252
|
+
this._lastProgramId = -1;
|
|
46253
|
+
};
|
|
46254
|
+
_proto._createVAO = function _createVAO(attribs, feedbackBinding, feedbackElements, inputBinding, inputElements) {
|
|
46255
|
+
var gl = this._gl;
|
|
46256
|
+
var vao = gl.createVertexArray();
|
|
46257
|
+
gl.bindVertexArray(vao);
|
|
46258
|
+
// @ts-ignore: Access internal _platformBuffer across packages
|
|
46259
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, feedbackBinding.buffer._platformBuffer._glBuffer);
|
|
46260
|
+
this._bindElements(gl, attribs, feedbackElements, feedbackBinding.stride);
|
|
46261
|
+
// @ts-ignore: Access internal _platformBuffer across packages
|
|
46262
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, inputBinding.buffer._platformBuffer._glBuffer);
|
|
46263
|
+
this._bindElements(gl, attribs, inputElements, inputBinding.stride);
|
|
46264
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
46265
|
+
return vao;
|
|
46266
|
+
};
|
|
46267
|
+
_proto._bindElements = function _bindElements(gl, attribs, elements, stride) {
|
|
46268
|
+
for(var _iterator = _create_for_of_iterator_helper_loose$1(elements), _step; !(_step = _iterator()).done;){
|
|
46269
|
+
var element = _step.value;
|
|
46270
|
+
var loc = attribs[element.attribute];
|
|
46271
|
+
if (loc !== undefined && loc !== -1) {
|
|
46272
|
+
var info = element._formatMetaInfo;
|
|
46273
|
+
gl.enableVertexAttribArray(loc);
|
|
46274
|
+
gl.vertexAttribPointer(loc, info.size, info.type, info.normalized, stride, element.offset);
|
|
46275
|
+
}
|
|
46276
|
+
}
|
|
46277
|
+
};
|
|
46278
|
+
return GLTransformFeedbackPrimitive;
|
|
46279
|
+
}();
|
|
45163
46280
|
/**
|
|
45164
46281
|
* WebGL mode.
|
|
45165
46282
|
*/ var WebGLMode = /*#__PURE__*/ function(WebGLMode) {
|
|
@@ -45281,6 +46398,37 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
45281
46398
|
if (bufferUsage === void 0) bufferUsage = BufferUsage.Static;
|
|
45282
46399
|
return new GLBuffer(this, type, byteLength, bufferUsage, data);
|
|
45283
46400
|
};
|
|
46401
|
+
_proto.createPlatformTransformFeedback = function createPlatformTransformFeedback() {
|
|
46402
|
+
return new GLTransformFeedback(this);
|
|
46403
|
+
};
|
|
46404
|
+
_proto.createPlatformTransformFeedbackPrimitive = function createPlatformTransformFeedbackPrimitive() {
|
|
46405
|
+
return new GLTransformFeedbackPrimitive(this._gl);
|
|
46406
|
+
};
|
|
46407
|
+
/**
|
|
46408
|
+
* Enable GL_RASTERIZER_DISCARD (WebGL2 only).
|
|
46409
|
+
*/ _proto.enableRasterizerDiscard = function enableRasterizerDiscard() {
|
|
46410
|
+
if (this._isWebGL2) {
|
|
46411
|
+
var gl = this._gl;
|
|
46412
|
+
gl.enable(gl.RASTERIZER_DISCARD);
|
|
46413
|
+
}
|
|
46414
|
+
};
|
|
46415
|
+
/**
|
|
46416
|
+
* Disable GL_RASTERIZER_DISCARD (WebGL2 only).
|
|
46417
|
+
*/ _proto.disableRasterizerDiscard = function disableRasterizerDiscard() {
|
|
46418
|
+
if (this._isWebGL2) {
|
|
46419
|
+
var gl = this._gl;
|
|
46420
|
+
gl.disable(gl.RASTERIZER_DISCARD);
|
|
46421
|
+
}
|
|
46422
|
+
};
|
|
46423
|
+
/**
|
|
46424
|
+
* Invalidate the cached shader program state.
|
|
46425
|
+
* Call this after using a custom program (e.g., Transform Feedback) outside the engine's pipeline.
|
|
46426
|
+
*/ _proto.invalidateShaderProgramState = function invalidateShaderProgramState() {
|
|
46427
|
+
if (this._currentBindShaderProgram) {
|
|
46428
|
+
this._gl.useProgram(null);
|
|
46429
|
+
this._currentBindShaderProgram = null;
|
|
46430
|
+
}
|
|
46431
|
+
};
|
|
45284
46432
|
_proto.requireExtension = function requireExtension(ext) {
|
|
45285
46433
|
return this._extensions.requireExtension(ext);
|
|
45286
46434
|
};
|
|
@@ -52904,11 +54052,11 @@ EXT_texture_webp = __decorate([
|
|
|
52904
54052
|
], EXT_texture_webp);
|
|
52905
54053
|
|
|
52906
54054
|
//@ts-ignore
|
|
52907
|
-
var version = "2.0.0-alpha.
|
|
54055
|
+
var version = "2.0.0-alpha.17";
|
|
52908
54056
|
console.log("Galacean Engine Version: " + version);
|
|
52909
54057
|
for(var key in CoreObjects){
|
|
52910
54058
|
Loader.registerClass(key, CoreObjects[key]);
|
|
52911
54059
|
}
|
|
52912
54060
|
|
|
52913
|
-
export { AccessorType, AmbientLight, AmbientOcclusion, AmbientOcclusionQuality, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationClipDecoder, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BatchUtils, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoundingBox, BoundingFrustum, BoundingSphere, BoxColliderShape, BoxShape, Buffer, BufferAsset, BufferBindFlag, BufferInfo, BufferMesh, BufferReader, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType$1 as CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, CloneUtils, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, CollisionUtil, Color, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContainmentType, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EntityModifyFlags, EventDispatcher, FileHeader, FinalPass, FixedJoint, FogMode, Font, FontStyle, FrustumFace, GLCapabilityType, GLCompressedTextureInternalFormat, GLTFAnimationParser, GLTFAnimatorControllerParser, GLTFBufferParser, GLTFBufferViewParser, GLTFEntityParser, GLTFExtensionMode, GLTFExtensionParser, GLTFLoader, GLTFMaterialParser, GLTFMeshParser, GLTFParser, GLTFParserContext, GLTFParserType, GLTFResource, GLTFSceneParser, GLTFSchemaParser, GLTFSkinParser, GLTFTextureParser, GLTFUtils, GLTFValidator, GradientAlphaKey, GradientColorKey, HDRDecoder, HemisphereShape, HierarchyParser, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolableValueType, InterpolationType, JSONAsset, Joint, JointLimits, JointMotor, KTX2Loader, KTX2TargetFormat, Keyframe, Keys, Layer, LayerPathMask, Light, Loader, Logger, MSAASamples, MainModule, Material, MaterialLoaderType, MathUtil, Matrix, Matrix3x3, Mesh, MeshColliderShape, MeshColliderShapeCookingFlag, MeshDecoder, MeshRenderer, MeshShape, MeshTopology, ModelMesh, OverflowMode, PBRMaterial, ParserContext, ParserType, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, Plane, PlaneColliderShape, PlaneIntersectionType, Platform, PointLight, Pointer, PointerButton, PointerEventData, PointerEventEmitter, PointerPhase, PostProcess, PostProcessEffect, PostProcessEffectBoolParameter, PostProcessEffectColorParameter, PostProcessEffectEnumParameter, PostProcessEffectFloatParameter, PostProcessEffectParameter, PostProcessEffectTextureParameter, PostProcessEffectVector2Parameter, PostProcessEffectVector3Parameter, PostProcessEffectVector4Parameter, PostProcessManager, PostProcessPass, PostProcessPassEvent, PostProcessUberPass, PrefabResource, Primitive, PrimitiveMesh, Probe, Quaternion, Rand, RasterState, Ray, Rect, ReferResource, ReflectionParser, RefractionMode, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueFlags, RenderQueueType, RenderState, RenderStateElementKey, RenderTarget, RenderTargetBlendState, Renderer, RendererUpdateFlags, RenderingStatistics, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, SceneParser, Script, SetDataOptions, Shader, ShaderData, ShaderDataGroup, ShaderFactory, ShaderLanguage, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, Signal, SimpleSpriteAssembler, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SlicedSpriteAssembler, SpecularMode, SphereColliderShape, SphereShape, SphericalHarmonics3, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteModifyFlags, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubFont, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextAsset, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, Texture2DDecoder, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureUtils, TextureWrapMode$1 as TextureWrapMode, TiledSpriteAssembler, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, TrailTextureMode, Transform, TransformModifyFlags, UnlitMaterial, Utils, Vector2, Vector3, Vector4, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WebCanvas, WebGLEngine, WebGLGraphicDevice, WebGLMode, WrapMode, XRManager, assignmentClone, decode, decoder, decoderMap, deepClone, dependentComponents, ignoreClone, parseSingleKTX, registerGLTFExtension, registerGLTFParser, registerPointerEventEmitter, request, resourceLoader, shallowClone, version };
|
|
54061
|
+
export { AccessorType, AmbientLight, AmbientOcclusion, AmbientOcclusionQuality, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationClipDecoder, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BatchUtils, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoundingBox, BoundingFrustum, BoundingSphere, BoxColliderShape, BoxShape, Buffer, BufferAsset, BufferBindFlag, BufferInfo, BufferMesh, BufferReader, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType$1 as CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, CloneUtils, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, CollisionUtil, Color, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContainmentType, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EntityModifyFlags, EventDispatcher, FileHeader, FinalPass, FixedJoint, FogMode, Font, FontStyle, FrustumFace, GLCapabilityType, GLCompressedTextureInternalFormat, GLTFAnimationParser, GLTFAnimatorControllerParser, GLTFBufferParser, GLTFBufferViewParser, GLTFEntityParser, GLTFExtensionMode, GLTFExtensionParser, GLTFLoader, GLTFMaterialParser, GLTFMeshParser, GLTFParser, GLTFParserContext, GLTFParserType, GLTFResource, GLTFSceneParser, GLTFSchemaParser, GLTFSkinParser, GLTFTextureParser, GLTFUtils, GLTFValidator, GradientAlphaKey, GradientColorKey, HDRDecoder, HemisphereShape, HierarchyParser, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolableValueType, InterpolationType, JSONAsset, Joint, JointLimits, JointMotor, KTX2Loader, KTX2TargetFormat, Keyframe, Keys, Layer, LayerPathMask, Light, LimitVelocityOverLifetimeModule, Loader, Logger, MSAASamples, MainModule, Material, MaterialLoaderType, MathUtil, Matrix, Matrix3x3, Mesh, MeshColliderShape, MeshColliderShapeCookingFlag, MeshDecoder, MeshRenderer, MeshShape, MeshTopology, ModelMesh, OverflowMode, PBRMaterial, ParserContext, ParserType, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, Plane, PlaneColliderShape, PlaneIntersectionType, Platform, PointLight, Pointer, PointerButton, PointerEventData, PointerEventEmitter, PointerPhase, PostProcess, PostProcessEffect, PostProcessEffectBoolParameter, PostProcessEffectColorParameter, PostProcessEffectEnumParameter, PostProcessEffectFloatParameter, PostProcessEffectParameter, PostProcessEffectTextureParameter, PostProcessEffectVector2Parameter, PostProcessEffectVector3Parameter, PostProcessEffectVector4Parameter, PostProcessManager, PostProcessPass, PostProcessPassEvent, PostProcessUberPass, PrefabResource, Primitive, PrimitiveMesh, Probe, Quaternion, Rand, RasterState, Ray, Rect, ReferResource, ReflectionParser, RefractionMode, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueFlags, RenderQueueType, RenderState, RenderStateElementKey, RenderTarget, RenderTargetBlendState, Renderer, RendererUpdateFlags, RenderingStatistics, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, SceneParser, Script, SetDataOptions, Shader, ShaderData, ShaderDataGroup, ShaderFactory, ShaderLanguage, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, Signal, SimpleSpriteAssembler, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SlicedSpriteAssembler, SpecularMode, SphereColliderShape, SphereShape, SphericalHarmonics3, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteModifyFlags, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubFont, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextAsset, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, Texture2DDecoder, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureUtils, TextureWrapMode$1 as TextureWrapMode, TiledSpriteAssembler, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, TrailTextureMode, Transform, TransformModifyFlags, UnlitMaterial, Utils, Vector2, Vector3, Vector4, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WebCanvas, WebGLEngine, WebGLGraphicDevice, WebGLMode, WrapMode, XRManager, assignmentClone, decode, decoder, decoderMap, deepClone, dependentComponents, ignoreClone, parseSingleKTX, registerGLTFExtension, registerGLTFParser, registerPointerEventEmitter, request, resourceLoader, shallowClone, version };
|
|
52914
54062
|
//# sourceMappingURL=bundled.module.js.map
|