@galacean/engine 2.0.0-alpha.25 → 2.0.0-alpha.26

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.
@@ -6408,6 +6408,12 @@ SystemInfo._initialize();
6408
6408
  case TextureFormat.ETC2_RGB:
6409
6409
  case TextureFormat.ETC2_RGBA8:
6410
6410
  case TextureFormat.ASTC_4x4:
6411
+ case TextureFormat.ASTC_5x5:
6412
+ case TextureFormat.ASTC_6x6:
6413
+ case TextureFormat.ASTC_8x8:
6414
+ case TextureFormat.ASTC_10x10:
6415
+ case TextureFormat.ASTC_12x12:
6416
+ case TextureFormat.ETC2_RGBA5:
6411
6417
  return true;
6412
6418
  default:
6413
6419
  return false;
@@ -6941,7 +6947,7 @@ SystemInfo._initialize();
6941
6947
  _this = ReferResource.call(this, engine) || this, _this._charInfoMap = {}, _this._space = 1, _this._curX = 1, _this._curY = 1, _this._nextY = 1;
6942
6948
  _this.isGCIgnored = true;
6943
6949
  var format = engine._hardwareRenderer.isWebGL2 ? TextureFormat.R8 : TextureFormat.Alpha8;
6944
- var texture = new Texture2D(engine, 512, 512, format, false);
6950
+ var texture = new Texture2D(engine, 512, 512, format, false, false);
6945
6951
  texture.filterMode = TextureFilterMode.Bilinear;
6946
6952
  texture.isGCIgnored = true;
6947
6953
  _this.texture = texture;
@@ -9882,7 +9888,8 @@ var color_over_lifetime_module = "#if defined(RENDERER_COL_GRADIENT) || defined(
9882
9888
  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
9889
  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
9890
  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_SPEED_CONSTANT_MODE\n uniform float renderer_LVLSpeedMaxConst;\n #ifdef RENDERER_LVL_SPEED_IS_RANDOM_TWO\n uniform float renderer_LVLSpeedMinConst;\n #endif\n #endif\n #ifdef RENDERER_LVL_SPEED_CURVE_MODE\n uniform vec2 renderer_LVLSpeedMaxCurve[4];\n #ifdef RENDERER_LVL_SPEED_IS_RANDOM_TWO\n uniform vec2 renderer_LVLSpeedMinCurve[4];\n #endif\n #endif\n #endif\n\n // Per-axis limit\n #ifdef RENDERER_LVL_SEPARATE_AXES\n #ifdef RENDERER_LVL_SPEED_CONSTANT_MODE\n uniform vec3 renderer_LVLSpeedMaxConstVector;\n #ifdef RENDERER_LVL_SPEED_IS_RANDOM_TWO\n uniform vec3 renderer_LVLSpeedMinConstVector;\n #endif\n #endif\n #ifdef RENDERER_LVL_SPEED_CURVE_MODE\n uniform vec2 renderer_LVLSpeedXMaxCurve[4];\n uniform vec2 renderer_LVLSpeedYMaxCurve[4];\n uniform vec2 renderer_LVLSpeedZMaxCurve[4];\n #ifdef RENDERER_LVL_SPEED_IS_RANDOM_TWO\n uniform vec2 renderer_LVLSpeedXMinCurve[4];\n uniform vec2 renderer_LVLSpeedYMinCurve[4];\n uniform vec2 renderer_LVLSpeedZMinCurve[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 limitSpeed;\n #ifdef RENDERER_LVL_SPEED_CONSTANT_MODE\n limitSpeed = renderer_LVLSpeedMaxConstVector;\n #ifdef RENDERER_LVL_SPEED_IS_RANDOM_TWO\n limitSpeed = mix(renderer_LVLSpeedMinConstVector, limitSpeed, limitRand);\n #endif\n #endif\n #ifdef RENDERER_LVL_SPEED_CURVE_MODE\n limitSpeed = vec3(\n evaluateParticleCurve(renderer_LVLSpeedXMaxCurve, normalizedAge),\n evaluateParticleCurve(renderer_LVLSpeedYMaxCurve, normalizedAge),\n evaluateParticleCurve(renderer_LVLSpeedZMaxCurve, normalizedAge)\n );\n #ifdef RENDERER_LVL_SPEED_IS_RANDOM_TWO\n vec3 minLimitSpeed = vec3(\n evaluateParticleCurve(renderer_LVLSpeedXMinCurve, normalizedAge),\n evaluateParticleCurve(renderer_LVLSpeedYMinCurve, normalizedAge),\n evaluateParticleCurve(renderer_LVLSpeedZMinCurve, normalizedAge)\n );\n limitSpeed = mix(minLimitSpeed, limitSpeed, limitRand);\n #endif\n #endif\n\n vec3 absVel = abs(velocity);\n vec3 excess = max(absVel - limitSpeed, vec3(0.0));\n velocity = sign(velocity) * (absVel - excess * effectiveDampen);\n #else\n float limitSpeed;\n #ifdef RENDERER_LVL_SPEED_CONSTANT_MODE\n limitSpeed = renderer_LVLSpeedMaxConst;\n #ifdef RENDERER_LVL_SPEED_IS_RANDOM_TWO\n limitSpeed = mix(renderer_LVLSpeedMinConst, limitSpeed, limitRand);\n #endif\n #endif\n #ifdef RENDERER_LVL_SPEED_CURVE_MODE\n limitSpeed = evaluateParticleCurve(renderer_LVLSpeedMaxCurve, normalizedAge);\n #ifdef RENDERER_LVL_SPEED_IS_RANDOM_TWO\n float minLimitSpeed = evaluateParticleCurve(renderer_LVLSpeedMinCurve, normalizedAge);\n limitSpeed = mix(minLimitSpeed, limitSpeed, limitRand);\n #endif\n #endif\n\n float speed = length(velocity);\n if (speed > limitSpeed && speed > 0.0) {\n float excess = speed - limitSpeed;\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
9891
+ var noise_module = "#ifdef RENDERER_NOISE_MODULE_ENABLED\n\n#include <noise_common>\n#include <noise_simplex_3D>\n\nuniform vec4 renderer_NoiseParams; // xyz = strength (constant mode only), w = frequency\nuniform vec4 renderer_NoiseOctaveParams; // x = scrollSpeed, y = octaveCount, z = octaveIntensityMultiplier, w = octaveFrequencyMultiplier\n\n#ifdef RENDERER_NOISE_STRENGTH_CURVE\n uniform vec2 renderer_NoiseStrengthMaxCurveX[4];\n #ifdef RENDERER_NOISE_IS_SEPARATE\n uniform vec2 renderer_NoiseStrengthMaxCurveY[4];\n uniform vec2 renderer_NoiseStrengthMaxCurveZ[4];\n #endif\n #ifdef RENDERER_NOISE_STRENGTH_IS_RANDOM_TWO\n uniform vec2 renderer_NoiseStrengthMinCurveX[4];\n #ifdef RENDERER_NOISE_IS_SEPARATE\n uniform vec2 renderer_NoiseStrengthMinCurveY[4];\n uniform vec2 renderer_NoiseStrengthMinCurveZ[4];\n #endif\n #endif\n#else\n #ifdef RENDERER_NOISE_STRENGTH_IS_RANDOM_TWO\n uniform vec3 renderer_NoiseStrengthMinConst;\n #endif\n#endif\n\nvec3 sampleSimplexNoise3D(vec3 coord) {\n float axisOffset = 100.0;\n return vec3(\n simplex(vec3(coord.z, coord.y, coord.x)),\n simplex(vec3(coord.x + axisOffset, coord.z, coord.y)),\n simplex(vec3(coord.y, coord.x + axisOffset, coord.z))\n );\n}\n\nvec3 computeNoiseDisplacement(vec3 currentPosition, float normalizedAge) {\n vec3 coord = currentPosition * renderer_NoiseParams.w\n + vec3(renderer_CurrentTime * renderer_NoiseOctaveParams.x);\n\n int octaveCount = int(renderer_NoiseOctaveParams.y);\n float octaveIntensityMultiplier = renderer_NoiseOctaveParams.z;\n float octaveFrequencyMultiplier = renderer_NoiseOctaveParams.w;\n\n vec3 noiseValue = sampleSimplexNoise3D(coord);\n float totalAmplitude = 1.0;\n\n // Unrolled octave loop (GLSL ES 1.0 requires constant loop bounds)\n if (octaveCount >= 2) {\n float amplitude = octaveIntensityMultiplier;\n totalAmplitude += amplitude;\n noiseValue += amplitude * sampleSimplexNoise3D(coord * octaveFrequencyMultiplier);\n\n if (octaveCount >= 3) {\n amplitude *= octaveIntensityMultiplier;\n totalAmplitude += amplitude;\n noiseValue += amplitude * sampleSimplexNoise3D(coord * octaveFrequencyMultiplier * octaveFrequencyMultiplier);\n }\n }\n\n // Evaluate strength (supports Constant, TwoConstants, Curve, TwoCurves).\n vec3 strength;\n #ifdef RENDERER_NOISE_STRENGTH_CURVE\n float sx = evaluateParticleCurve(renderer_NoiseStrengthMaxCurveX, normalizedAge);\n #ifdef RENDERER_NOISE_STRENGTH_IS_RANDOM_TWO\n sx = mix(evaluateParticleCurve(renderer_NoiseStrengthMinCurveX, normalizedAge), sx, a_Random0.z);\n #endif\n #ifdef RENDERER_NOISE_IS_SEPARATE\n float sy = evaluateParticleCurve(renderer_NoiseStrengthMaxCurveY, normalizedAge);\n float sz = evaluateParticleCurve(renderer_NoiseStrengthMaxCurveZ, normalizedAge);\n #ifdef RENDERER_NOISE_STRENGTH_IS_RANDOM_TWO\n sy = mix(evaluateParticleCurve(renderer_NoiseStrengthMinCurveY, normalizedAge), sy, a_Random0.z);\n sz = mix(evaluateParticleCurve(renderer_NoiseStrengthMinCurveZ, normalizedAge), sz, a_Random0.z);\n #endif\n strength = vec3(sx, sy, sz);\n #else\n strength = vec3(sx);\n #endif\n #else\n strength = renderer_NoiseParams.xyz;\n #ifdef RENDERER_NOISE_STRENGTH_IS_RANDOM_TWO\n strength = mix(renderer_NoiseStrengthMinConst, strength, a_Random0.z);\n #endif\n #endif\n\n return (noiseValue / totalAmplitude) * strength;\n}\n\n#endif\n"; // eslint-disable-line
9892
+ 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#include <noise_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 // VOL and Noise overlays are added here (not persisted).\n\n vec3 totalVelocity;\n if (renderer_SimulationSpace == 0) {\n totalVelocity = localVelocity + volLocal + rotationByQuaternions(volWorld, invWorldRotation);\n } else {\n totalVelocity = rotationByQuaternions(localVelocity + volLocal, worldRotation) + volWorld;\n }\n #ifdef RENDERER_NOISE_MODULE_ENABLED\n // Noise velocity overlay (not persisted)\n // computeNoiseDisplacement returns noise * strength (position-scale)\n // Dividing by lifetime converts to velocity so that integration over lifetime\n // recovers the original displacement magnitude\n // Use analytical base position (birth + initial velocity * age) instead of\n // a_FeedbackPosition to avoid feedback loop: position → noise → velocity → position\n vec3 noiseBasePos;\n if (renderer_SimulationSpace == 0) {\n noiseBasePos = a_ShapePositionStartLifeTime.xyz + a_DirectionTime.xyz * a_StartSpeed * age;\n } else {\n noiseBasePos = rotationByQuaternions(\n a_ShapePositionStartLifeTime.xyz + a_DirectionTime.xyz * a_StartSpeed * age,\n worldRotation) + a_SimulationWorldPosition;\n }\n totalVelocity += computeNoiseDisplacement(noiseBasePos, normalizedAge) / lifetime;\n #endif\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
9886
9893
  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
9887
9894
  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
9888
9895
  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
@@ -9897,6 +9904,7 @@ var ParticleShaderLib = {
9897
9904
  texture_sheet_animation_module: texture_sheet_animation_module,
9898
9905
  force_over_lifetime_module: force_over_lifetime_module,
9899
9906
  limit_velocity_over_lifetime_module: limit_velocity_over_lifetime_module,
9907
+ noise_module: noise_module,
9900
9908
  particle_feedback_simulation: particle_feedback_simulation,
9901
9909
  sphere_billboard: sphere_billboard,
9902
9910
  stretched_billboard: stretched_billboard,
@@ -10736,26 +10744,483 @@ ShaderTagKey._nameMap = Object.create(null);
10736
10744
  return ShaderProgram;
10737
10745
  }();
10738
10746
  ShaderProgram._counter = 0;
10747
+ function _array_like_to_array$2(arr, len) {
10748
+ if (len == null || len > arr.length) len = arr.length;
10749
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
10750
+ return arr2;
10751
+ }
10752
+ function _unsupported_iterable_to_array$2(o, minLen) {
10753
+ if (!o) return;
10754
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
10755
+ var n = Object.prototype.toString.call(o).slice(8, -1);
10756
+ if (n === "Object" && o.constructor) n = o.constructor.name;
10757
+ if (n === "Map" || n === "Set") return Array.from(n);
10758
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
10759
+ }
10760
+ function _create_for_of_iterator_helper_loose$2(o, allowArrayLike) {
10761
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
10762
+ if (it) return (it = it.call(o)).next.bind(it);
10763
+ // Fallback for engines without symbol support
10764
+ if (Array.isArray(o) || (it = _unsupported_iterable_to_array$2(o)) || allowArrayLike && o && typeof o.length === "number") {
10765
+ if (it) o = it;
10766
+ var i = 0;
10767
+ return function() {
10768
+ if (i >= o.length) return {
10769
+ done: true
10770
+ };
10771
+ return {
10772
+ done: false,
10773
+ value: o[i++]
10774
+ };
10775
+ };
10776
+ }
10777
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
10778
+ }
10779
+ /**
10780
+ * Directive types for shader preprocessor instructions.
10781
+ */ var ShaderPreprocessorDirective = /*#__PURE__*/ function(ShaderPreprocessorDirective) {
10782
+ ShaderPreprocessorDirective[ShaderPreprocessorDirective["Text"] = 0] = "Text";
10783
+ ShaderPreprocessorDirective[ShaderPreprocessorDirective["IfDef"] = 1] = "IfDef";
10784
+ ShaderPreprocessorDirective[ShaderPreprocessorDirective["IfNdef"] = 2] = "IfNdef";
10785
+ ShaderPreprocessorDirective[ShaderPreprocessorDirective["IfCmp"] = 3] = "IfCmp";
10786
+ ShaderPreprocessorDirective[ShaderPreprocessorDirective["IfExpr"] = 4] = "IfExpr";
10787
+ ShaderPreprocessorDirective[ShaderPreprocessorDirective["Else"] = 5] = "Else";
10788
+ ShaderPreprocessorDirective[ShaderPreprocessorDirective["Endif"] = 6] = "Endif";
10789
+ ShaderPreprocessorDirective[ShaderPreprocessorDirective["Define"] = 7] = "Define";
10790
+ ShaderPreprocessorDirective[ShaderPreprocessorDirective["DefineVal"] = 8] = "DefineVal";
10791
+ ShaderPreprocessorDirective[ShaderPreprocessorDirective["DefineFunc"] = 9] = "DefineFunc";
10792
+ ShaderPreprocessorDirective[ShaderPreprocessorDirective["Undef"] = 10] = "Undef";
10793
+ return ShaderPreprocessorDirective;
10794
+ }({});
10795
+ /**
10796
+ * @internal
10797
+ */ var ShaderMacroProcessor = /*#__PURE__*/ function() {
10798
+ function ShaderMacroProcessor() {}
10799
+ /**
10800
+ * Evaluate a flat instruction array with active macros.
10801
+ * Macros are expanded immediately when text chunks are collected,
10802
+ * using the current macro state at that point (conforming to GLSL/C99 §6.10 standard).
10803
+ * @param instructions - Pre-parsed instruction array
10804
+ * @param macros - Active runtime macros
10805
+ * @returns Pure GLSL string with all conditionals resolved and macros expanded
10806
+ */ ShaderMacroProcessor.evaluate = function evaluate(instructions, macros) {
10807
+ var valueMacros = ShaderMacroProcessor._valueMacros;
10808
+ var funcMacros = ShaderMacroProcessor._funcMacros;
10809
+ var shaderChunks = ShaderMacroProcessor._shaderChunks;
10810
+ valueMacros.clear();
10811
+ funcMacros.clear();
10812
+ shaderChunks.length = 0;
10813
+ for(var _iterator = _create_for_of_iterator_helper_loose$2(macros), _step; !(_step = _iterator()).done;){
10814
+ var _step_value = _step.value, name = _step_value[0], value = _step_value[1];
10815
+ valueMacros.set(name, value);
10816
+ }
10817
+ ShaderMacroProcessor._macroFirstCharsDirty = true;
10818
+ var index = 0;
10819
+ var length = instructions.length;
10820
+ while(index < length){
10821
+ var instruction = instructions[index];
10822
+ switch(instruction[0]){
10823
+ case ShaderPreprocessorDirective.Text:
10824
+ // Immediately expand macros using current macro state (GLSL/C99 conformant)
10825
+ shaderChunks.push(ShaderMacroProcessor._expandChunk(instruction[1], valueMacros, funcMacros));
10826
+ index++;
10827
+ break;
10828
+ case ShaderPreprocessorDirective.IfDef:
10829
+ {
10830
+ var name1 = instruction[1];
10831
+ index = valueMacros.has(name1) || funcMacros.has(name1) ? index + 1 : instruction[2];
10832
+ break;
10833
+ }
10834
+ case ShaderPreprocessorDirective.IfNdef:
10835
+ {
10836
+ var name2 = instruction[1];
10837
+ index = !valueMacros.has(name2) && !funcMacros.has(name2) ? index + 1 : instruction[2];
10838
+ break;
10839
+ }
10840
+ case ShaderPreprocessorDirective.IfCmp:
10841
+ {
10842
+ var name3 = instruction[1];
10843
+ var val = valueMacros.get(name3);
10844
+ var matched = val !== undefined && ShaderMacroProcessor._compareValues(Number(val) || 0, instruction[2], instruction[3]);
10845
+ index = matched ? index + 1 : instruction[4];
10846
+ break;
10847
+ }
10848
+ case ShaderPreprocessorDirective.IfExpr:
10849
+ index = ShaderMacroProcessor._evalCondition(instruction[1], valueMacros, funcMacros) ? index + 1 : instruction[2];
10850
+ break;
10851
+ case ShaderPreprocessorDirective.Else:
10852
+ index = instruction[1];
10853
+ break;
10854
+ case ShaderPreprocessorDirective.Endif:
10855
+ index++;
10856
+ break;
10857
+ case ShaderPreprocessorDirective.Define:
10858
+ valueMacros.set(instruction[1], "");
10859
+ index++;
10860
+ break;
10861
+ case ShaderPreprocessorDirective.DefineVal:
10862
+ valueMacros.set(instruction[1], instruction[2]);
10863
+ ShaderMacroProcessor._macroFirstCharsDirty = true;
10864
+ index++;
10865
+ break;
10866
+ case ShaderPreprocessorDirective.DefineFunc:
10867
+ funcMacros.set(instruction[1], {
10868
+ params: instruction[2],
10869
+ body: instruction[3]
10870
+ });
10871
+ ShaderMacroProcessor._macroFirstCharsDirty = true;
10872
+ index++;
10873
+ break;
10874
+ case ShaderPreprocessorDirective.Undef:
10875
+ valueMacros.delete(instruction[1]);
10876
+ funcMacros.delete(instruction[1]);
10877
+ index++;
10878
+ break;
10879
+ default:
10880
+ index++;
10881
+ break;
10882
+ }
10883
+ }
10884
+ return ShaderMacroProcessor._concatChunks(shaderChunks);
10885
+ };
10886
+ /**
10887
+ * Expand macros in a single text chunk using the current macro state.
10888
+ * Returns the chunk as-is if no expandable macros exist.
10889
+ */ ShaderMacroProcessor._expandChunk = function _expandChunk(chunk, valueMacros, funcMacros) {
10890
+ // Fast path: no expandable macros at this point
10891
+ if (funcMacros.size === 0) {
10892
+ var hasExpandable = false;
10893
+ for(var _iterator = _create_for_of_iterator_helper_loose$2(valueMacros), _step; !(_step = _iterator()).done;){
10894
+ var _step_value = _step.value, val = _step_value[1];
10895
+ if (val !== "") {
10896
+ hasExpandable = true;
10897
+ break;
10898
+ }
10899
+ }
10900
+ if (!hasExpandable) return chunk;
10901
+ }
10902
+ // Rebuild first-char filter if macros changed
10903
+ if (ShaderMacroProcessor._macroFirstCharsDirty) {
10904
+ var macroFirstChars = ShaderMacroProcessor._macroFirstChars;
10905
+ macroFirstChars.clear();
10906
+ for(var _iterator1 = _create_for_of_iterator_helper_loose$2(valueMacros.keys()), _step1; !(_step1 = _iterator1()).done;){
10907
+ var name = _step1.value;
10908
+ macroFirstChars.add(name.charCodeAt(0));
10909
+ }
10910
+ for(var _iterator2 = _create_for_of_iterator_helper_loose$2(funcMacros.keys()), _step2; !(_step2 = _iterator2()).done;){
10911
+ var name1 = _step2.value;
10912
+ macroFirstChars.add(name1.charCodeAt(0));
10913
+ }
10914
+ ShaderMacroProcessor._macroFirstCharsDirty = false;
10915
+ }
10916
+ var macroFirstChars1 = ShaderMacroProcessor._macroFirstChars;
10917
+ var expandedNames = ShaderMacroProcessor._expandedNames;
10918
+ var out = ShaderMacroProcessor._out;
10919
+ out.length = 0;
10920
+ var len = chunk.length;
10921
+ var i = 0;
10922
+ while(i < len){
10923
+ var cc = chunk.charCodeAt(i);
10924
+ if (ShaderMacroProcessor._isIdentifierStart(cc)) {
10925
+ var start = i;
10926
+ i++;
10927
+ while(i < len && ShaderMacroProcessor._isIdentifierPart(chunk.charCodeAt(i)))i++;
10928
+ // Fast path: first char not in any macro name
10929
+ if (!macroFirstChars1.has(chunk.charCodeAt(start))) {
10930
+ out.push(chunk.substring(start, i));
10931
+ continue;
10932
+ }
10933
+ var name2 = chunk.substring(start, i);
10934
+ // Try function macro
10935
+ var func = funcMacros.get(name2);
10936
+ if (func) {
10937
+ var lookAhead = i;
10938
+ while(lookAhead < len && (chunk.charCodeAt(lookAhead) === 32 /* space */ || chunk.charCodeAt(lookAhead) === 9))lookAhead++;
10939
+ if (lookAhead < len && chunk.charCodeAt(lookAhead) === 40 /* '(' */ ) {
10940
+ var args = ShaderMacroProcessor._parseFuncArgs(chunk, lookAhead);
10941
+ if (args) {
10942
+ i = args.end;
10943
+ var expanded = ShaderMacroProcessor._expandFuncBody(func, args.values);
10944
+ expandedNames.clear();
10945
+ expandedNames.add(name2);
10946
+ out.push(ShaderMacroProcessor._recursiveExpandMacro(expanded, valueMacros, funcMacros, expandedNames));
10947
+ continue;
10948
+ }
10949
+ }
10950
+ }
10951
+ // Try value macro
10952
+ var val1 = valueMacros.get(name2);
10953
+ if (val1 !== undefined && val1 !== "") {
10954
+ expandedNames.clear();
10955
+ expandedNames.add(name2);
10956
+ out.push(ShaderMacroProcessor._recursiveExpandMacro(val1, valueMacros, funcMacros, expandedNames));
10957
+ continue;
10958
+ }
10959
+ out.push(name2);
10960
+ continue;
10961
+ }
10962
+ // Batch collect non-identifier characters
10963
+ var batchStart = i;
10964
+ while(i < len && !ShaderMacroProcessor._isIdentifierStart(chunk.charCodeAt(i)))i++;
10965
+ out.push(chunk.substring(batchStart, i));
10966
+ }
10967
+ return out.join("");
10968
+ };
10969
+ /**
10970
+ * Recursively expand macro substitution results until no more macros remain.
10971
+ * @param macroExpansion - Intermediate text from a macro substitution that may contain further macro references
10972
+ * @param valueMacros - Current value macro definitions
10973
+ * @param funcMacros - Current function macro definitions
10974
+ * @param expandedNames - Macro names already on the expansion chain, prevents circular references (C99 §6.10.3.4)
10975
+ */ ShaderMacroProcessor._recursiveExpandMacro = function _recursiveExpandMacro(macroExpansion, valueMacros, funcMacros, expandedNames) {
10976
+ if (macroExpansion.length === 0) return macroExpansion;
10977
+ var len = macroExpansion.length;
10978
+ var out = [];
10979
+ var i = 0;
10980
+ while(i < len){
10981
+ var cc = macroExpansion.charCodeAt(i);
10982
+ if (ShaderMacroProcessor._isIdentifierStart(cc)) {
10983
+ var start = i;
10984
+ i++;
10985
+ while(i < len && ShaderMacroProcessor._isIdentifierPart(macroExpansion.charCodeAt(i)))i++;
10986
+ var name = macroExpansion.substring(start, i);
10987
+ // Skip already-expanded names (circular reference prevention)
10988
+ // Skip GL_ prefixed names (reserved GLSL built-ins, charCodes: G=71, L=76, _=95)
10989
+ if (expandedNames.has(name) || name.charCodeAt(0) === 71 && name.charCodeAt(1) === 76 && name.charCodeAt(2) === 95) {
10990
+ out.push(name);
10991
+ continue;
10992
+ }
10993
+ var func = funcMacros.get(name);
10994
+ if (func) {
10995
+ var lookAhead = i;
10996
+ while(lookAhead < len && (macroExpansion.charCodeAt(lookAhead) === 32 /* space */ || macroExpansion.charCodeAt(lookAhead) === 9))lookAhead++;
10997
+ if (lookAhead < len && macroExpansion.charCodeAt(lookAhead) === 40 /* '(' */ ) {
10998
+ var args = ShaderMacroProcessor._parseFuncArgs(macroExpansion, lookAhead);
10999
+ if (args) {
11000
+ i = args.end;
11001
+ expandedNames.add(name);
11002
+ out.push(ShaderMacroProcessor._recursiveExpandMacro(ShaderMacroProcessor._expandFuncBody(func, args.values), valueMacros, funcMacros, expandedNames));
11003
+ expandedNames.delete(name);
11004
+ continue;
11005
+ }
11006
+ }
11007
+ }
11008
+ var val = valueMacros.get(name);
11009
+ if (val !== undefined && val !== "") {
11010
+ expandedNames.add(name);
11011
+ out.push(ShaderMacroProcessor._recursiveExpandMacro(val, valueMacros, funcMacros, expandedNames));
11012
+ expandedNames.delete(name);
11013
+ continue;
11014
+ }
11015
+ out.push(name);
11016
+ continue;
11017
+ }
11018
+ // Batch collect non-identifier characters
11019
+ var batchStart = i;
11020
+ while(i < len && !ShaderMacroProcessor._isIdentifierStart(macroExpansion.charCodeAt(i)))i++;
11021
+ out.push(macroExpansion.substring(batchStart, i));
11022
+ }
11023
+ return out.join("");
11024
+ };
11025
+ /**
11026
+ * Substitute function macro params in body.
11027
+ */ ShaderMacroProcessor._expandFuncBody = function _expandFuncBody(func, args) {
11028
+ if (func.params.length === 0 || args.length !== func.params.length) return func.body;
11029
+ var result = func.body;
11030
+ for(var i = 0; i < func.params.length; i++){
11031
+ result = ShaderMacroProcessor._replaceWord(result, func.params[i], args[i]);
11032
+ }
11033
+ return result;
11034
+ };
11035
+ /**
11036
+ * Evaluate a compound condition tree.
11037
+ */ ShaderMacroProcessor._evalCondition = function _evalCondition(cond, valueMacros, funcMacros) {
11038
+ switch(cond.t){
11039
+ case "def":
11040
+ return valueMacros.has(cond.m) || funcMacros.has(cond.m);
11041
+ case "ndef":
11042
+ return !valueMacros.has(cond.m) && !funcMacros.has(cond.m);
11043
+ case "cmp":
11044
+ {
11045
+ var val = valueMacros.get(cond.m);
11046
+ if (val === undefined) return false;
11047
+ return ShaderMacroProcessor._compareValues(Number(val) || 0, cond.op, cond.v);
11048
+ }
11049
+ case "and":
11050
+ return ShaderMacroProcessor._evalCondition(cond.l, valueMacros, funcMacros) && ShaderMacroProcessor._evalCondition(cond.r, valueMacros, funcMacros);
11051
+ case "or":
11052
+ return ShaderMacroProcessor._evalCondition(cond.l, valueMacros, funcMacros) || ShaderMacroProcessor._evalCondition(cond.r, valueMacros, funcMacros);
11053
+ case "not":
11054
+ return !ShaderMacroProcessor._evalCondition(cond.c, valueMacros, funcMacros);
11055
+ case "bool":
11056
+ return cond.v;
11057
+ }
11058
+ };
11059
+ /**
11060
+ * Evaluate a comparison operator.
11061
+ */ ShaderMacroProcessor._compareValues = function _compareValues(numVal, op, value) {
11062
+ switch(op){
11063
+ case "==":
11064
+ return numVal === value;
11065
+ case "!=":
11066
+ return numVal !== value;
11067
+ case ">":
11068
+ return numVal > value;
11069
+ case "<":
11070
+ return numVal < value;
11071
+ case ">=":
11072
+ return numVal >= value;
11073
+ case "<=":
11074
+ return numVal <= value;
11075
+ default:
11076
+ return false;
11077
+ }
11078
+ };
11079
+ /**
11080
+ * Parse function macro call arguments.
11081
+ * Returns reusable static result object to avoid allocation.
11082
+ */ ShaderMacroProcessor._parseFuncArgs = function _parseFuncArgs(text, openParen) {
11083
+ var result = ShaderMacroProcessor._parsedFuncArgs;
11084
+ result.values.length = 0;
11085
+ var level = 1;
11086
+ var argStart = openParen + 1;
11087
+ var k = argStart;
11088
+ var len = text.length;
11089
+ while(k < len && level > 0){
11090
+ var cc = text.charCodeAt(k);
11091
+ if (cc === 40 /* '(' */ ) {
11092
+ level++;
11093
+ } else if (cc === 41 /* ')' */ ) {
11094
+ if (--level === 0) {
11095
+ var arg = text.substring(argStart, k).trim();
11096
+ if (arg.length > 0 || result.values.length > 0) result.values.push(arg);
11097
+ result.end = k + 1;
11098
+ return result;
11099
+ }
11100
+ } else if (cc === 44 /* ',' */ && level === 1) {
11101
+ result.values.push(text.substring(argStart, k).trim());
11102
+ argStart = k + 1;
11103
+ }
11104
+ k++;
11105
+ }
11106
+ return null;
11107
+ };
11108
+ /**
11109
+ * Replace all whole-word occurrences of `word` in `text` with `replacement`.
11110
+ */ ShaderMacroProcessor._replaceWord = function _replaceWord(text, word, replacement) {
11111
+ var wLen = word.length;
11112
+ var parts = ShaderMacroProcessor._replaceWordParts;
11113
+ parts.length = 0;
11114
+ var start = 0;
11115
+ var idx = text.indexOf(word, start);
11116
+ while(idx !== -1){
11117
+ if (idx > 0 && ShaderMacroProcessor._isIdentifierPart(text.charCodeAt(idx - 1))) {
11118
+ idx = text.indexOf(word, idx + 1);
11119
+ continue;
11120
+ }
11121
+ var afterIdx = idx + wLen;
11122
+ if (afterIdx < text.length && ShaderMacroProcessor._isIdentifierPart(text.charCodeAt(afterIdx))) {
11123
+ idx = text.indexOf(word, idx + 1);
11124
+ continue;
11125
+ }
11126
+ parts.push(text.substring(start, idx));
11127
+ parts.push(replacement);
11128
+ start = afterIdx;
11129
+ idx = text.indexOf(word, start);
11130
+ }
11131
+ if (start === 0) return text;
11132
+ parts.push(text.substring(start));
11133
+ return parts.join("");
11134
+ };
11135
+ /**
11136
+ * Concatenate shader chunks with consecutive blank lines collapsed to a single newline.
11137
+ */ ShaderMacroProcessor._concatChunks = function _concatChunks(shaderChunks) {
11138
+ var out = ShaderMacroProcessor._out;
11139
+ out.length = 0;
11140
+ var lastNewline = false;
11141
+ for(var p = 0; p < shaderChunks.length; p++){
11142
+ var text = shaderChunks[p];
11143
+ var len = text.length;
11144
+ var i = 0;
11145
+ while(i < len){
11146
+ if (text.charCodeAt(i) === 10 /* \n */ ) {
11147
+ if (!lastNewline) {
11148
+ out.push("\n");
11149
+ lastNewline = true;
11150
+ }
11151
+ i++;
11152
+ while(i < len){
11153
+ var c = text.charCodeAt(i);
11154
+ if (c === 32 /* space */ || c === 9 /* tab */ || c === 10 /* \n */ ) i++;
11155
+ else break;
11156
+ }
11157
+ } else {
11158
+ var batchStart = i;
11159
+ while(i < len && text.charCodeAt(i) !== 10 /* \n */ )i++;
11160
+ out.push(text.substring(batchStart, i));
11161
+ lastNewline = false;
11162
+ }
11163
+ }
11164
+ }
11165
+ return out.join("");
11166
+ };
11167
+ /**
11168
+ * Check if char code is a valid identifier start.
11169
+ * Matches: [A-Z] | [a-z] | _
11170
+ */ ShaderMacroProcessor._isIdentifierStart = function _isIdentifierStart(charCode) {
11171
+ return charCode >= 65 && charCode <= 90 || charCode >= 97 && charCode <= 122 || charCode === 95;
11172
+ };
11173
+ /**
11174
+ * Check if char code is a valid identifier part.
11175
+ * Matches: [A-Z] | [a-z] | [0-9] | _
11176
+ */ ShaderMacroProcessor._isIdentifierPart = function _isIdentifierPart(charCode) {
11177
+ return charCode >= 65 && charCode <= 90 || charCode >= 97 && charCode <= 122 || charCode >= 48 && charCode <= 57 || charCode === 95;
11178
+ };
11179
+ return ShaderMacroProcessor;
11180
+ }();
11181
+ ShaderMacroProcessor._valueMacros = new Map();
11182
+ ShaderMacroProcessor._funcMacros = new Map();
11183
+ ShaderMacroProcessor._shaderChunks = [];
11184
+ ShaderMacroProcessor._out = [];
11185
+ ShaderMacroProcessor._expandedNames = new Set();
11186
+ ShaderMacroProcessor._macroFirstChars = new Set();
11187
+ ShaderMacroProcessor._macroFirstCharsDirty = true;
11188
+ ShaderMacroProcessor._replaceWordParts = [];
11189
+ ShaderMacroProcessor._parsedFuncArgs = {
11190
+ values: [],
11191
+ end: 0
11192
+ };
10739
11193
  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 ";
10740
11194
  /**
10741
11195
  * Shader pass containing vertex and fragment source.
10742
11196
  */ var ShaderPass = /*#__PURE__*/ function(ShaderPart) {
10743
11197
  _inherits$2(ShaderPass, ShaderPart);
10744
- function ShaderPass(nameOrVertexSource, vertexSourceOrFragmentSource, fragmentSourceOrTags, tags) {
11198
+ function ShaderPass(nameOrVertexSource, vertexSourceOrFragmentSourceOrInstructions, fragmentSourceOrTags, tagsOrPlatformTarget, tags) {
10745
11199
  var _this;
10746
11200
  _this = ShaderPart.call(this) || this, /** @internal */ _this._shaderPassId = 0, /** @internal */ _this._renderStateDataMap = {}, /** @internal */ _this._shaderProgramPools = [];
10747
11201
  _this._shaderPassId = ShaderPass._shaderPassCounter++;
10748
- if (typeof fragmentSourceOrTags === "string") {
11202
+ if (Array.isArray(vertexSourceOrFragmentSourceOrInstructions)) {
11203
+ // Instructions overload: (name, vertexInst, fragInst, platformTarget, tags?)
10749
11204
  _this._name = nameOrVertexSource;
10750
- _this._vertexSource = vertexSourceOrFragmentSource;
10751
- _this._fragmentSource = fragmentSourceOrTags;
11205
+ _this._vertexShaderInstructions = vertexSourceOrFragmentSourceOrInstructions;
11206
+ _this._fragmentShaderInstructions = fragmentSourceOrTags;
11207
+ _this._platformTarget = tagsOrPlatformTarget;
10752
11208
  tags = _extends$2({
10753
11209
  pipelineStage: PipelineStage.Forward
10754
11210
  }, tags);
11211
+ } else if (typeof fragmentSourceOrTags === "string") {
11212
+ // Named overload: (name, vertexSource, fragmentSource, tags?)
11213
+ _this._name = nameOrVertexSource;
11214
+ _this._vertexSource = vertexSourceOrFragmentSourceOrInstructions;
11215
+ _this._fragmentSource = fragmentSourceOrTags;
11216
+ tags = _extends$2({
11217
+ pipelineStage: PipelineStage.Forward
11218
+ }, tagsOrPlatformTarget);
10755
11219
  } else {
11220
+ // Unnamed overload: (vertexSource, fragmentSource, tags?)
10756
11221
  _this._name = "Default";
10757
11222
  _this._vertexSource = nameOrVertexSource;
10758
- _this._fragmentSource = vertexSourceOrFragmentSource;
11223
+ _this._fragmentSource = vertexSourceOrFragmentSourceOrInstructions;
10759
11224
  tags = _extends$2({
10760
11225
  pipelineStage: PipelineStage.Forward
10761
11226
  }, fragmentSourceOrTags);
@@ -10791,15 +11256,16 @@ var precisionStr = "\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision hig
10791
11256
  shaderProgramPools.length = 0;
10792
11257
  };
10793
11258
  _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;
11259
+ var _ref = this._platformTarget != undefined ? this._compileShaderLabSource(engine, macroCollection) : this._compilePlatformSource(engine, macroCollection), vertexSource = _ref.vertexSource, fragmentSource = _ref.fragmentSource;
10798
11260
  return new ShaderProgram(engine, vertexSource, fragmentSource);
10799
11261
  };
10800
- _proto._getShaderLabProgram = function _getShaderLabProgram(engine, macroCollection) {
11262
+ _proto._compilePlatformSource = function _compilePlatformSource(engine, macroCollection) {
11263
+ return ShaderFactory.compilePlatformSource(engine, macroCollection, this._vertexSource, this._fragmentSource);
11264
+ };
11265
+ _proto._compileShaderLabSource = function _compileShaderLabSource(engine, macroCollection) {
10801
11266
  var isWebGL2 = engine._hardwareRenderer.isWebGL2;
10802
- var shaderMacroList = new Array();
11267
+ var shaderMacroList = ShaderPass._shaderMacroList;
11268
+ shaderMacroList.length = 0;
10803
11269
  ShaderMacro._getMacrosElements(macroCollection, shaderMacroList);
10804
11270
  shaderMacroList.push(ShaderMacro.getByName(isWebGL2 ? "GRAPHICS_API_WEBGL2" : "GRAPHICS_API_WEBGL1"));
10805
11271
  if (engine._hardwareRenderer.canIUse(GLCapabilityType.shaderTextureLod)) {
@@ -10808,23 +11274,31 @@ var precisionStr = "\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision hig
10808
11274
  if (engine._hardwareRenderer.canIUse(GLCapabilityType.standardDerivatives)) {
10809
11275
  shaderMacroList.push(ShaderMacro.getByName("HAS_DERIVATIVES"));
10810
11276
  }
10811
- var noIncludeVertex = ShaderFactory.parseIncludes(this._vertexSource);
10812
- var noIncludeFrag = ShaderFactory.parseIncludes(this._fragmentSource);
10813
- noIncludeVertex = Shader._shaderLab._parseMacros(noIncludeVertex, shaderMacroList);
10814
- noIncludeFrag = Shader._shaderLab._parseMacros(noIncludeFrag, shaderMacroList);
11277
+ var macroMap = ShaderPass._macroMap;
11278
+ macroMap.clear();
11279
+ for(var i = 0, n = shaderMacroList.length; i < n; i++){
11280
+ var macro = shaderMacroList[i];
11281
+ var _macro_value;
11282
+ macroMap.set(macro.name, (_macro_value = macro.value) != null ? _macro_value : "");
11283
+ }
11284
+ var vertexSource = ShaderMacroProcessor.evaluate(this._vertexShaderInstructions, macroMap);
11285
+ var fragmentSource = ShaderMacroProcessor.evaluate(this._fragmentShaderInstructions, macroMap);
10815
11286
  if (isWebGL2 && this._platformTarget === ShaderLanguage.GLSLES100) {
10816
- noIncludeVertex = ShaderFactory.convertTo300(noIncludeVertex);
10817
- noIncludeFrag = ShaderFactory.convertTo300(noIncludeFrag, true);
11287
+ vertexSource = ShaderFactory.convertTo300(vertexSource);
11288
+ fragmentSource = ShaderFactory.convertTo300(fragmentSource, true);
10818
11289
  }
10819
11290
  var versionStr = isWebGL2 ? "#version 300 es" : "#version 100";
10820
- var vertexSource = " " + versionStr + "\n " + noIncludeVertex + "\n ";
10821
- var fragmentSource = " " + versionStr + "\n " + (isWebGL2 ? "" : ShaderFactory._shaderExtension) + "\n " + precisionStr + "\n " + noIncludeFrag + "\n ";
10822
- return new ShaderProgram(engine, vertexSource, fragmentSource);
11291
+ return {
11292
+ vertexSource: " " + versionStr + "\n " + vertexSource + "\n ",
11293
+ fragmentSource: " " + versionStr + "\n " + (isWebGL2 ? "" : ShaderFactory._shaderExtension) + "\n " + precisionStr + "\n " + fragmentSource + "\n "
11294
+ };
10823
11295
  };
10824
11296
  return ShaderPass;
10825
11297
  }(ShaderPart);
10826
11298
  /** @internal */ ShaderPass._shaderPassCounter = 0;
10827
11299
  /** @internal */ ShaderPass._shaderRootPath = "shaders://root/";
11300
+ ShaderPass._shaderMacroList = [];
11301
+ ShaderPass._macroMap = new Map();
10828
11302
  /**
10829
11303
  * Sub shader.
10830
11304
  */ var SubShader = /*#__PURE__*/ function(ShaderPart) {
@@ -11565,36 +12039,14 @@ __decorate$1([
11565
12039
  var subShaderList = shaderSource.subShaders.map(function(subShaderSource) {
11566
12040
  var passList = subShaderSource.passes.map(function(passSource) {
11567
12041
  if (passSource.isUsePass) {
11568
- var _Shader_find_subShaders_find, _Shader_find;
11569
- var _passSource_name_split = passSource.name.split("/"), shaderName = _passSource_name_split[0], subShaderName = _passSource_name_split[1], passName = _passSource_name_split[2];
11570
- return (_Shader_find = Shader.find(shaderName)) == null ? void 0 : (_Shader_find_subShaders_find = _Shader_find.subShaders.find(function(subShader) {
11571
- return subShader.name === subShaderName;
11572
- })) == null ? void 0 : _Shader_find_subShaders_find.passes.find(function(pass) {
11573
- return pass.name === passName;
11574
- });
12042
+ return Shader._resolveUsePass(passSource.name);
11575
12043
  }
11576
12044
  var shaderPassSource = Shader._shaderLab._parseShaderPass(passSource.contents, passSource.vertexEntry, passSource.fragmentEntry, vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget, new URL(fragmentSourceOrPath != null ? fragmentSourceOrPath : "", ShaderPass._shaderRootPath).href);
11577
12045
  if (!shaderPassSource) {
11578
12046
  throw 'Shader pass "' + shaderSource.name + "." + subShaderSource.name + "." + passSource.name + '" parse failed, please check the shader source code.';
11579
12047
  }
11580
- var shaderPass = new ShaderPass(passSource.name, shaderPassSource.vertex, shaderPassSource.fragment, passSource.tags);
11581
- shaderPass._platformTarget = vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget;
11582
- var _passSource_renderStates = passSource.renderStates, constantMap = _passSource_renderStates.constantMap, variableMap = _passSource_renderStates.variableMap;
11583
- // Compatible shader lab no render state use material `renderState` to modify render state
11584
- if (Object.keys(constantMap).length > 0 || Object.keys(variableMap).length > 0) {
11585
- // Parse const render state
11586
- var renderState = new RenderState();
11587
- for(var k in constantMap){
11588
- Shader._applyConstRenderStates(renderState, +k, constantMap[k]);
11589
- }
11590
- shaderPass._renderState = renderState;
11591
- // Parse variable render state
11592
- var renderStateDataMap = {};
11593
- for(var k1 in variableMap){
11594
- renderStateDataMap[k1] = ShaderProperty.getByName(variableMap[k1]);
11595
- }
11596
- shaderPass._renderStateDataMap = renderStateDataMap;
11597
- }
12048
+ var shaderPass = new ShaderPass(passSource.name, shaderPassSource.vertexShaderInstructions, shaderPassSource.fragmentShaderInstructions, vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget, passSource.tags);
12049
+ Shader._applyRenderStates(shaderPass, passSource.renderStates.constantMap, passSource.renderStates.variableMap, false);
11598
12050
  return shaderPass;
11599
12051
  });
11600
12052
  return new SubShader(subShaderSource.name, passList, subShaderSource.tags);
@@ -11639,6 +12091,29 @@ __decorate$1([
11639
12091
  };
11640
12092
  /**
11641
12093
  * @internal
12094
+ */ Shader._createFromPrecompiled = function _createFromPrecompiled(data) {
12095
+ var shaderMap = Shader._shaderMap;
12096
+ if (shaderMap[data.name]) {
12097
+ console.error('Shader named "' + data.name + '" already exists.');
12098
+ return;
12099
+ }
12100
+ var subShaderList = data.subShaders.map(function(subData) {
12101
+ var passList = subData.passes.map(function(passData) {
12102
+ if (passData.isUsePass) {
12103
+ return Shader._resolveUsePass(passData.name);
12104
+ }
12105
+ var shaderPass = new ShaderPass(passData.name, passData.vertexShaderInstructions, passData.fragmentShaderInstructions, data.platformTarget, passData.tags);
12106
+ Shader._applyRenderStates(shaderPass, passData.renderStates.constantMap, passData.renderStates.variableMap, true);
12107
+ return shaderPass;
12108
+ });
12109
+ return new SubShader(subData.name, passList, subData.tags);
12110
+ });
12111
+ var shader = new Shader(data.name, subShaderList);
12112
+ shaderMap[data.name] = shader;
12113
+ return shader;
12114
+ };
12115
+ /**
12116
+ * @internal
11642
12117
  */ Shader._clear = function _clear(engine) {
11643
12118
  var shaderMap = Shader._shaderMap;
11644
12119
  for(var key in shaderMap){
@@ -11659,6 +12134,34 @@ __decorate$1([
11659
12134
  }
11660
12135
  }
11661
12136
  };
12137
+ Shader._resolveUsePass = function _resolveUsePass(passName) {
12138
+ var _Shader_find_subShaders_find, _Shader_find;
12139
+ var _passName_split = passName.split("/"), shaderName = _passName_split[0], subShaderName = _passName_split[1], passNamePart = _passName_split[2];
12140
+ return (_Shader_find = Shader.find(shaderName)) == null ? void 0 : (_Shader_find_subShaders_find = _Shader_find.subShaders.find(function(subShader) {
12141
+ return subShader.name === subShaderName;
12142
+ })) == null ? void 0 : _Shader_find_subShaders_find.passes.find(function(pass) {
12143
+ return pass.name === passNamePart;
12144
+ });
12145
+ };
12146
+ Shader._applyRenderStates = function _applyRenderStates(shaderPass, constantMap, variableMap, deserializeColor) {
12147
+ if (Object.keys(constantMap).length > 0 || Object.keys(variableMap).length > 0) {
12148
+ var renderState = new RenderState();
12149
+ for(var k in constantMap){
12150
+ var value = constantMap[k];
12151
+ if (deserializeColor && Array.isArray(value)) {
12152
+ Shader._applyConstRenderStates(renderState, +k, new Color(value[0], value[1], value[2], value[3]));
12153
+ } else {
12154
+ Shader._applyConstRenderStates(renderState, +k, value);
12155
+ }
12156
+ }
12157
+ shaderPass._renderState = renderState;
12158
+ var renderStateDataMap = {};
12159
+ for(var k1 in variableMap){
12160
+ renderStateDataMap[k1] = ShaderProperty.getByName(variableMap[k1]);
12161
+ }
12162
+ shaderPass._renderStateDataMap = renderStateDataMap;
12163
+ }
12164
+ };
11662
12165
  Shader._applyConstRenderStates = function _applyConstRenderStates(renderState, key, value) {
11663
12166
  switch(key){
11664
12167
  case RenderStateElementKey.BlendStateEnabled0:
@@ -14076,7 +14579,15 @@ var Camera = /*#__PURE__*/ function(Component) {
14076
14579
  */ _proto._getInvViewProjMat = function _getInvViewProjMat() {
14077
14580
  if (this._isInvViewProjDirty.flag) {
14078
14581
  this._isInvViewProjDirty.flag = false;
14079
- Matrix.multiply(this._entity.transform.worldMatrix, this._getInverseProjectionMatrix(), this._invViewProjMat);
14582
+ var matrix = this._invViewProjMat;
14583
+ if (this._isCustomViewMatrix) {
14584
+ Matrix.invert(this.viewMatrix, matrix);
14585
+ } else {
14586
+ // Ignore scale, consistent with viewMatrix getter
14587
+ var transform = this._entity.transform;
14588
+ Matrix.rotationTranslation(transform.worldRotationQuaternion, transform.worldPosition, matrix);
14589
+ }
14590
+ matrix.multiply(this._getInverseProjectionMatrix());
14080
14591
  }
14081
14592
  return this._invViewProjMat;
14082
14593
  };
@@ -27244,7 +27755,7 @@ __decorate$1([
27244
27755
  deepClone
27245
27756
  ], Skin.prototype, "inverseBindMatrices", void 0);
27246
27757
  __decorate$1([
27247
- ignoreClone
27758
+ deepClone
27248
27759
  ], Skin.prototype, "_skinMatrices", void 0);
27249
27760
  __decorate$1([
27250
27761
  ignoreClone
@@ -28235,7 +28746,10 @@ var ComponentCloner = /*#__PURE__*/ function() {
28235
28746
  _proto._setActiveComponents = function _setActiveComponents(isActive, activeChangeFlag) {
28236
28747
  var activeChangedComponents = this._activeChangedComponents;
28237
28748
  for(var i = 0, length = activeChangedComponents.length; i < length; ++i){
28238
- activeChangedComponents[i]._setActive(isActive, activeChangeFlag);
28749
+ var component = activeChangedComponents[i];
28750
+ // Skip components whose scene was already cleared by an earlier callback's removeChild
28751
+ if (!isActive && !component._entity._scene) continue;
28752
+ component._setActive(isActive, activeChangeFlag);
28239
28753
  }
28240
28754
  this._scene._componentsManager.putActiveChangedTempList(activeChangedComponents);
28241
28755
  this._activeChangedComponents = null;
@@ -28255,18 +28769,19 @@ var ComponentCloner = /*#__PURE__*/ function() {
28255
28769
  }
28256
28770
  };
28257
28771
  _proto._setInActiveInHierarchy = function _setInActiveInHierarchy(activeChangedComponents, activeChangeFlag) {
28772
+ // Children-first, reverse traversal for safe removeChild during callbacks
28773
+ var children = this._children;
28774
+ for(var i = children.length - 1; i >= 0; i--){
28775
+ var child = children[i];
28776
+ child.isActive && child._setInActiveInHierarchy(activeChangedComponents, activeChangeFlag);
28777
+ }
28258
28778
  activeChangeFlag & ActiveChangeFlag.Hierarchy && (this._isActiveInHierarchy = false);
28259
28779
  activeChangeFlag & ActiveChangeFlag.Scene && (this._isActiveInScene = false);
28260
28780
  var components = this._components;
28261
- for(var i = 0, n = components.length; i < n; i++){
28262
- var component = components[i];
28781
+ for(var i1 = 0, n = components.length; i1 < n; i1++){
28782
+ var component = components[i1];
28263
28783
  component.enabled && activeChangedComponents.push(component);
28264
28784
  }
28265
- var children = this._children;
28266
- for(var i1 = 0, n1 = children.length; i1 < n1; i1++){
28267
- var child = children[i1];
28268
- child.isActive && child._setInActiveInHierarchy(activeChangedComponents, activeChangeFlag);
28269
- }
28270
28785
  };
28271
28786
  _proto._setSiblingIndex = function _setSiblingIndex(sibling, target) {
28272
28787
  target = Math.min(target, sibling.length - 1);
@@ -31131,7 +31646,7 @@ var blinnPhongVs = "#include <common>\n#include <common_vert>\n#include <blendSh
31131
31646
  var depthOnlyFs = "void main() {\n}"; // eslint-disable-line
31132
31647
  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
31133
31648
  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
31134
- 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
31649
+ 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#include <noise_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
31135
31650
  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
31136
31651
  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
31137
31652
  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
@@ -33566,38 +34081,6 @@ AmbientOcclusion._enableMacro = ShaderMacro.getByName("SCENE_ENABLE_AMBIENT_OCCL
33566
34081
  Scene._fogColorProperty = ShaderProperty.getByName("scene_FogColor");
33567
34082
  Scene._fogParamsProperty = ShaderProperty.getByName("scene_FogParams");
33568
34083
  Scene._prefilterdDFGProperty = ShaderProperty.getByName("scene_PrefilteredDFG");
33569
- function _array_like_to_array$2(arr, len) {
33570
- if (len == null || len > arr.length) len = arr.length;
33571
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
33572
- return arr2;
33573
- }
33574
- function _unsupported_iterable_to_array$2(o, minLen) {
33575
- if (!o) return;
33576
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
33577
- var n = Object.prototype.toString.call(o).slice(8, -1);
33578
- if (n === "Object" && o.constructor) n = o.constructor.name;
33579
- if (n === "Map" || n === "Set") return Array.from(n);
33580
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
33581
- }
33582
- function _create_for_of_iterator_helper_loose$2(o, allowArrayLike) {
33583
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
33584
- if (it) return (it = it.call(o)).next.bind(it);
33585
- // Fallback for engines without symbol support
33586
- if (Array.isArray(o) || (it = _unsupported_iterable_to_array$2(o)) || allowArrayLike && o && typeof o.length === "number") {
33587
- if (it) o = it;
33588
- var i = 0;
33589
- return function() {
33590
- if (i >= o.length) return {
33591
- done: true
33592
- };
33593
- return {
33594
- done: false,
33595
- value: o[i++]
33596
- };
33597
- };
33598
- }
33599
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
33600
- }
33601
34084
  /**
33602
34085
  * Script class, used for logic writing.
33603
34086
  */ var Script = /*#__PURE__*/ function(Component) {
@@ -37922,7 +38405,7 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
37922
38405
  _inherits$2(ParticleRenderer, Renderer);
37923
38406
  function ParticleRenderer(entity) {
37924
38407
  var _this;
37925
- _this = Renderer.call(this, entity) || this, /** Specifies how much particles stretch depending on their velocity. */ _this.velocityScale = 0, /** How much are the particles stretched in their direction of motion, defined as the length of the particle compared to its width. */ _this.lengthScale = 2, /** The pivot of particle. */ _this.pivot = new Vector3(), /** @internal */ _this._generatorBounds = new BoundingBox(), /** @internal */ _this._transformedBounds = new BoundingBox();
38408
+ _this = Renderer.call(this, entity) || this, /** Specifies how much particles stretch depending on their velocity. */ _this.velocityScale = 0, /** How much are the particles stretched in their direction of motion, defined as the length of the particle compared to its width. */ _this.lengthScale = 2, /** The pivot of particle. */ _this.pivot = new Vector3(), /** @internal */ _this._generatorBounds = new BoundingBox(), /** @internal */ _this._transformedBounds = new BoundingBox(), _this._renderMode = ParticleRenderMode.Billboard;
37926
38409
  _this._onGeneratorParamsChanged = _this._onGeneratorParamsChanged.bind(_this);
37927
38410
  _this.generator = new ParticleGenerator(_this);
37928
38411
  _this._currentRenderModeMacro = ParticleRenderer._billboardModeMacro;
@@ -38521,6 +39004,7 @@ ParticleTransformFeedbackSimulator._deltaTimeProperty = ShaderProperty.getByName
38521
39004
  ParticleRandomSubSeeds[ParticleRandomSubSeeds["GravityModifier"] = 2759560269] = "GravityModifier";
38522
39005
  ParticleRandomSubSeeds[ParticleRandomSubSeeds["ForceOverLifetime"] = 3875246972] = "ForceOverLifetime";
38523
39006
  ParticleRandomSubSeeds[ParticleRandomSubSeeds["LimitVelocityOverLifetime"] = 3047300990] = "LimitVelocityOverLifetime";
39007
+ ParticleRandomSubSeeds[ParticleRandomSubSeeds["Noise"] = 4105357473] = "Noise";
38524
39008
  return ParticleRandomSubSeeds;
38525
39009
  }({});
38526
39010
  /**
@@ -39896,7 +40380,7 @@ __decorate$1([
39896
40380
  return;
39897
40381
  }
39898
40382
  this._enabled = value;
39899
- this._generator._setTransformFeedback(value);
40383
+ this._generator._setTransformFeedback();
39900
40384
  this._generator._renderer._onGeneratorParamsChanged();
39901
40385
  }
39902
40386
  }
@@ -40835,6 +41319,297 @@ __decorate$1([
40835
41319
  __decorate$1([
40836
41320
  ignoreClone
40837
41321
  ], TextureSheetAnimationModule.prototype, "_onTilingChanged", null);
41322
+ /**
41323
+ * Noise module for particle system.
41324
+ * Adds simplex noise-based turbulence displacement to particles.
41325
+ */ var NoiseModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
41326
+ _inherits$2(NoiseModule, ParticleGeneratorModule);
41327
+ function NoiseModule(generator) {
41328
+ var _this;
41329
+ _this = ParticleGeneratorModule.call(this, generator) || this, /** @internal */ _this._noiseRand = new Rand(0, ParticleRandomSubSeeds.Noise), _this._noiseParams = new Vector4(), _this._noiseOctaveParams = new Vector4(), _this._strengthMinConst = new Vector3(), _this._scrollSpeed = 0, _this._separateAxes = false, _this._frequency = 0.5, _this._octaveCount = 1, _this._octaveIntensityMultiplier = 0.5, _this._octaveFrequencyMultiplier = 2.0;
41330
+ _this.strengthX = new ParticleCompositeCurve(1);
41331
+ _this.strengthY = new ParticleCompositeCurve(1);
41332
+ _this.strengthZ = new ParticleCompositeCurve(1);
41333
+ return _this;
41334
+ }
41335
+ var _proto = NoiseModule.prototype;
41336
+ /**
41337
+ * @internal
41338
+ */ _proto._updateShaderData = function _updateShaderData(shaderData) {
41339
+ var enabledMacro = null;
41340
+ var strengthCurveMacro = null;
41341
+ var strengthIsRandomTwoMacro = null;
41342
+ var separateAxesMacro = null;
41343
+ if (this.enabled) {
41344
+ enabledMacro = NoiseModule._enabledMacro;
41345
+ var strengthX = this._strengthX;
41346
+ var strengthY = this._strengthY;
41347
+ var strengthZ = this._strengthZ;
41348
+ var separateAxes = this._separateAxes;
41349
+ // Determine strength curve mode (following SOL pattern)
41350
+ var isRandomCurveMode = separateAxes ? strengthX.mode === ParticleCurveMode.TwoCurves && strengthY.mode === ParticleCurveMode.TwoCurves && strengthZ.mode === ParticleCurveMode.TwoCurves : strengthX.mode === ParticleCurveMode.TwoCurves;
41351
+ var isCurveMode = isRandomCurveMode || (separateAxes ? strengthX.mode === ParticleCurveMode.Curve && strengthY.mode === ParticleCurveMode.Curve && strengthZ.mode === ParticleCurveMode.Curve : strengthX.mode === ParticleCurveMode.Curve);
41352
+ var isRandomConstMode = separateAxes ? strengthX.mode === ParticleCurveMode.TwoConstants && strengthY.mode === ParticleCurveMode.TwoConstants && strengthZ.mode === ParticleCurveMode.TwoConstants : strengthX.mode === ParticleCurveMode.TwoConstants;
41353
+ // noiseParams.w = frequency (always needed)
41354
+ var noiseParams = this._noiseParams;
41355
+ if (isCurveMode) {
41356
+ // Curve/TwoCurves: encode curve data as float arrays
41357
+ shaderData.setFloatArray(NoiseModule._strengthMaxCurveXProperty, strengthX.curveMax._getTypeArray());
41358
+ if (separateAxes) {
41359
+ shaderData.setFloatArray(NoiseModule._strengthMaxCurveYProperty, strengthY.curveMax._getTypeArray());
41360
+ shaderData.setFloatArray(NoiseModule._strengthMaxCurveZProperty, strengthZ.curveMax._getTypeArray());
41361
+ }
41362
+ if (isRandomCurveMode) {
41363
+ shaderData.setFloatArray(NoiseModule._strengthMinCurveXProperty, strengthX.curveMin._getTypeArray());
41364
+ if (separateAxes) {
41365
+ shaderData.setFloatArray(NoiseModule._strengthMinCurveYProperty, strengthY.curveMin._getTypeArray());
41366
+ shaderData.setFloatArray(NoiseModule._strengthMinCurveZProperty, strengthZ.curveMin._getTypeArray());
41367
+ }
41368
+ strengthIsRandomTwoMacro = NoiseModule._strengthIsRandomTwoMacro;
41369
+ }
41370
+ strengthCurveMacro = NoiseModule._strengthCurveMacro;
41371
+ // xyz unused in curve mode, just set frequency
41372
+ noiseParams.set(0, 0, 0, this._frequency);
41373
+ } else {
41374
+ // Constant/TwoConstants: pack strength into noiseParams.xyz
41375
+ if (separateAxes) {
41376
+ noiseParams.set(strengthX.constantMax, strengthY.constantMax, strengthZ.constantMax, this._frequency);
41377
+ } else {
41378
+ var s = strengthX.constantMax;
41379
+ noiseParams.set(s, s, s, this._frequency);
41380
+ }
41381
+ if (isRandomConstMode) {
41382
+ var minConst = this._strengthMinConst;
41383
+ if (separateAxes) {
41384
+ minConst.set(strengthX.constantMin, strengthY.constantMin, strengthZ.constantMin);
41385
+ } else {
41386
+ var sMin = strengthX.constantMin;
41387
+ minConst.set(sMin, sMin, sMin);
41388
+ }
41389
+ shaderData.setVector3(NoiseModule._strengthMinConstProperty, minConst);
41390
+ strengthIsRandomTwoMacro = NoiseModule._strengthIsRandomTwoMacro;
41391
+ }
41392
+ }
41393
+ shaderData.setVector4(NoiseModule._noiseProperty, noiseParams);
41394
+ if (separateAxes) {
41395
+ separateAxesMacro = NoiseModule._separateAxesMacro;
41396
+ }
41397
+ var noiseOctaveParams = this._noiseOctaveParams;
41398
+ noiseOctaveParams.set(this._scrollSpeed, this._octaveCount, this._octaveIntensityMultiplier, this._octaveFrequencyMultiplier);
41399
+ shaderData.setVector4(NoiseModule._noiseOctaveProperty, noiseOctaveParams);
41400
+ }
41401
+ this._enabledModuleMacro = this._enableMacro(shaderData, this._enabledModuleMacro, enabledMacro);
41402
+ this._strengthCurveModeMacro = this._enableMacro(shaderData, this._strengthCurveModeMacro, strengthCurveMacro);
41403
+ this._strengthIsRandomTwoModeMacro = this._enableMacro(shaderData, this._strengthIsRandomTwoModeMacro, strengthIsRandomTwoMacro);
41404
+ this._separateAxesModeMacro = this._enableMacro(shaderData, this._separateAxesModeMacro, separateAxesMacro);
41405
+ };
41406
+ /**
41407
+ * @internal
41408
+ */ _proto._resetRandomSeed = function _resetRandomSeed(seed) {
41409
+ this._noiseRand.reset(seed, ParticleRandomSubSeeds.Noise);
41410
+ };
41411
+ _create_class$2(NoiseModule, [
41412
+ {
41413
+ key: "separateAxes",
41414
+ get: /**
41415
+ * Specifies whether the strength is separate on each axis, when disabled, only `strength` is used.
41416
+ */ function get() {
41417
+ return this._separateAxes;
41418
+ },
41419
+ set: function set(value) {
41420
+ if (value !== this._separateAxes) {
41421
+ this._separateAxes = value;
41422
+ this._generator._renderer._onGeneratorParamsChanged();
41423
+ }
41424
+ }
41425
+ },
41426
+ {
41427
+ key: "strengthX",
41428
+ get: /**
41429
+ * Noise strength. When `separateAxes` is disabled, applies to all axes.
41430
+ * When `separateAxes` is enabled, applies only to x axis.
41431
+ */ function get() {
41432
+ return this._strengthX;
41433
+ },
41434
+ set: function set(value) {
41435
+ var lastValue = this._strengthX;
41436
+ if (value !== lastValue) {
41437
+ this._strengthX = value;
41438
+ this._onCompositeCurveChange(lastValue, value);
41439
+ }
41440
+ }
41441
+ },
41442
+ {
41443
+ key: "strengthY",
41444
+ get: /**
41445
+ * Noise strength for y axis, used when `separateAxes` is enabled.
41446
+ */ function get() {
41447
+ return this._strengthY;
41448
+ },
41449
+ set: function set(value) {
41450
+ var lastValue = this._strengthY;
41451
+ if (value !== lastValue) {
41452
+ this._strengthY = value;
41453
+ this._onCompositeCurveChange(lastValue, value);
41454
+ }
41455
+ }
41456
+ },
41457
+ {
41458
+ key: "strengthZ",
41459
+ get: /**
41460
+ * Noise strength for z axis, used when `separateAxes` is enabled.
41461
+ */ function get() {
41462
+ return this._strengthZ;
41463
+ },
41464
+ set: function set(value) {
41465
+ var lastValue = this._strengthZ;
41466
+ if (value !== lastValue) {
41467
+ this._strengthZ = value;
41468
+ this._onCompositeCurveChange(lastValue, value);
41469
+ }
41470
+ }
41471
+ },
41472
+ {
41473
+ key: "frequency",
41474
+ get: /**
41475
+ * Noise spatial frequency.
41476
+ */ function get() {
41477
+ return this._frequency;
41478
+ },
41479
+ set: function set(value) {
41480
+ value = Math.max(1e-6, value);
41481
+ if (value !== this._frequency) {
41482
+ this._frequency = value;
41483
+ this._generator._renderer._onGeneratorParamsChanged();
41484
+ }
41485
+ }
41486
+ },
41487
+ {
41488
+ key: "scrollSpeed",
41489
+ get: /**
41490
+ * Noise field scroll speed over time.
41491
+ */ function get() {
41492
+ return this._scrollSpeed;
41493
+ },
41494
+ set: function set(value) {
41495
+ if (value !== this._scrollSpeed) {
41496
+ this._scrollSpeed = value;
41497
+ this._generator._renderer._onGeneratorParamsChanged();
41498
+ }
41499
+ }
41500
+ },
41501
+ {
41502
+ key: "octaveCount",
41503
+ get: /**
41504
+ * Number of noise octave layers (1-3).
41505
+ */ function get() {
41506
+ return this._octaveCount;
41507
+ },
41508
+ set: function set(value) {
41509
+ value = Math.max(1, Math.min(3, Math.floor(value)));
41510
+ if (value !== this._octaveCount) {
41511
+ this._octaveCount = value;
41512
+ this._generator._renderer._onGeneratorParamsChanged();
41513
+ }
41514
+ }
41515
+ },
41516
+ {
41517
+ key: "octaveIntensityMultiplier",
41518
+ get: /**
41519
+ * Intensity multiplier for each successive octave, only effective when `octaveCount` > 1.
41520
+ * Each layer's contribution is scaled by this factor relative to the previous layer, range [0, 1].
41521
+ */ function get() {
41522
+ return this._octaveIntensityMultiplier;
41523
+ },
41524
+ set: function set(value) {
41525
+ value = Math.max(0, Math.min(1, value));
41526
+ if (value !== this._octaveIntensityMultiplier) {
41527
+ this._octaveIntensityMultiplier = value;
41528
+ this._generator._renderer._onGeneratorParamsChanged();
41529
+ }
41530
+ }
41531
+ },
41532
+ {
41533
+ key: "octaveFrequencyMultiplier",
41534
+ get: /**
41535
+ * Frequency multiplier for each successive octave, only effective when `octaveCount` > 1.
41536
+ * Each layer samples at this multiple of the previous layer's frequency, range [1, 4].
41537
+ */ function get() {
41538
+ return this._octaveFrequencyMultiplier;
41539
+ },
41540
+ set: function set(value) {
41541
+ value = Math.max(1, Math.min(4, value));
41542
+ if (value !== this._octaveFrequencyMultiplier) {
41543
+ this._octaveFrequencyMultiplier = value;
41544
+ this._generator._renderer._onGeneratorParamsChanged();
41545
+ }
41546
+ }
41547
+ },
41548
+ {
41549
+ key: "enabled",
41550
+ get: function get() {
41551
+ return this._enabled;
41552
+ },
41553
+ set: function set(value) {
41554
+ if (value !== this._enabled) {
41555
+ if (value && !this._generator._renderer.engine._hardwareRenderer.isWebGL2) {
41556
+ return;
41557
+ }
41558
+ this._enabled = value;
41559
+ this._generator._setTransformFeedback();
41560
+ this._generator._renderer._onGeneratorParamsChanged();
41561
+ }
41562
+ }
41563
+ }
41564
+ ]);
41565
+ return NoiseModule;
41566
+ }(ParticleGeneratorModule);
41567
+ NoiseModule._enabledMacro = ShaderMacro.getByName("RENDERER_NOISE_MODULE_ENABLED");
41568
+ NoiseModule._strengthCurveMacro = ShaderMacro.getByName("RENDERER_NOISE_STRENGTH_CURVE");
41569
+ NoiseModule._strengthIsRandomTwoMacro = ShaderMacro.getByName("RENDERER_NOISE_STRENGTH_IS_RANDOM_TWO");
41570
+ NoiseModule._separateAxesMacro = ShaderMacro.getByName("RENDERER_NOISE_IS_SEPARATE");
41571
+ NoiseModule._noiseProperty = ShaderProperty.getByName("renderer_NoiseParams");
41572
+ NoiseModule._noiseOctaveProperty = ShaderProperty.getByName("renderer_NoiseOctaveParams");
41573
+ NoiseModule._strengthMinConstProperty = ShaderProperty.getByName("renderer_NoiseStrengthMinConst");
41574
+ NoiseModule._strengthMaxCurveXProperty = ShaderProperty.getByName("renderer_NoiseStrengthMaxCurveX");
41575
+ NoiseModule._strengthMaxCurveYProperty = ShaderProperty.getByName("renderer_NoiseStrengthMaxCurveY");
41576
+ NoiseModule._strengthMaxCurveZProperty = ShaderProperty.getByName("renderer_NoiseStrengthMaxCurveZ");
41577
+ NoiseModule._strengthMinCurveXProperty = ShaderProperty.getByName("renderer_NoiseStrengthMinCurveX");
41578
+ NoiseModule._strengthMinCurveYProperty = ShaderProperty.getByName("renderer_NoiseStrengthMinCurveY");
41579
+ NoiseModule._strengthMinCurveZProperty = ShaderProperty.getByName("renderer_NoiseStrengthMinCurveZ");
41580
+ __decorate$1([
41581
+ ignoreClone
41582
+ ], NoiseModule.prototype, "_enabledModuleMacro", void 0);
41583
+ __decorate$1([
41584
+ ignoreClone
41585
+ ], NoiseModule.prototype, "_strengthCurveModeMacro", void 0);
41586
+ __decorate$1([
41587
+ ignoreClone
41588
+ ], NoiseModule.prototype, "_strengthIsRandomTwoModeMacro", void 0);
41589
+ __decorate$1([
41590
+ ignoreClone
41591
+ ], NoiseModule.prototype, "_separateAxesModeMacro", void 0);
41592
+ __decorate$1([
41593
+ ignoreClone
41594
+ ], NoiseModule.prototype, "_noiseRand", void 0);
41595
+ __decorate$1([
41596
+ ignoreClone
41597
+ ], NoiseModule.prototype, "_noiseParams", void 0);
41598
+ __decorate$1([
41599
+ ignoreClone
41600
+ ], NoiseModule.prototype, "_noiseOctaveParams", void 0);
41601
+ __decorate$1([
41602
+ ignoreClone
41603
+ ], NoiseModule.prototype, "_strengthMinConst", void 0);
41604
+ __decorate$1([
41605
+ deepClone
41606
+ ], NoiseModule.prototype, "_strengthX", void 0);
41607
+ __decorate$1([
41608
+ deepClone
41609
+ ], NoiseModule.prototype, "_strengthY", void 0);
41610
+ __decorate$1([
41611
+ deepClone
41612
+ ], NoiseModule.prototype, "_strengthZ", void 0);
40838
41613
  /**
40839
41614
  * Velocity over lifetime module.
40840
41615
  */ var VelocityOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
@@ -41040,6 +41815,7 @@ __decorate$1([
41040
41815
  this.forceOverLifetime = new ForceOverLifetimeModule(this);
41041
41816
  this.sizeOverLifetime = new SizeOverLifetimeModule(this);
41042
41817
  this.limitVelocityOverLifetime = new LimitVelocityOverLifetimeModule(this);
41818
+ this.noise = new NoiseModule(this);
41043
41819
  this.emission.enabled = true;
41044
41820
  }
41045
41821
  var _proto = ParticleGenerator.prototype;
@@ -41347,6 +42123,7 @@ __decorate$1([
41347
42123
  this.sizeOverLifetime._updateShaderData(shaderData);
41348
42124
  this.rotationOverLifetime._updateShaderData(shaderData);
41349
42125
  this.colorOverLifetime._updateShaderData(shaderData);
42126
+ this.noise._updateShaderData(shaderData);
41350
42127
  };
41351
42128
  /**
41352
42129
  * @internal
@@ -41360,16 +42137,19 @@ __decorate$1([
41360
42137
  this.limitVelocityOverLifetime._resetRandomSeed(seed);
41361
42138
  this.rotationOverLifetime._resetRandomSeed(seed);
41362
42139
  this.colorOverLifetime._resetRandomSeed(seed);
42140
+ this.noise._resetRandomSeed(seed);
41363
42141
  };
41364
42142
  /**
41365
42143
  * @internal
41366
- */ _proto._setTransformFeedback = function _setTransformFeedback(enabled) {
41367
- this._useTransformFeedback = enabled;
42144
+ */ _proto._setTransformFeedback = function _setTransformFeedback() {
42145
+ var needed = this.limitVelocityOverLifetime.enabled || this.noise.enabled;
42146
+ if (needed === this._useTransformFeedback) return;
42147
+ this._useTransformFeedback = needed;
41368
42148
  // Switching TF mode invalidates all active particle state: feedback buffers and instance
41369
42149
  // buffer layout are incompatible between the two paths. Clear rather than show a one-frame
41370
42150
  // jump; new particles will fill in naturally from the next emit cycle.
41371
42151
  this._clearActiveParticles();
41372
- if (enabled) {
42152
+ if (needed) {
41373
42153
  if (!this._feedbackSimulator) {
41374
42154
  this._feedbackSimulator = new ParticleTransformFeedbackSimulator(this._renderer.engine);
41375
42155
  }
@@ -41419,9 +42199,7 @@ __decorate$1([
41419
42199
  /**
41420
42200
  * @internal
41421
42201
  */ _proto._cloneTo = function _cloneTo(target) {
41422
- if (target.limitVelocityOverLifetime.enabled) {
41423
- target._setTransformFeedback(true);
41424
- }
42202
+ target._setTransformFeedback();
41425
42203
  };
41426
42204
  /**
41427
42205
  * @internal
@@ -41583,10 +42361,6 @@ __decorate$1([
41583
42361
  // Start rotation
41584
42362
  var startRotationRand = main._startRotationRand, flipRotation = main.flipRotation;
41585
42363
  var isFlip = flipRotation > startRotationRand.random();
41586
- // @todo:None-Mesh mode should inverse the rotation, maybe should unify it
41587
- if (this._renderer.renderMode !== ParticleRenderMode.Mesh) {
41588
- isFlip = !isFlip;
41589
- }
41590
42364
  var rotationZ = main.startRotationZ.evaluate(undefined, startRotationRand.random());
41591
42365
  if (main.startRotation3D) {
41592
42366
  var rotationX = main.startRotationX.evaluate(undefined, startRotationRand.random());
@@ -41612,7 +42386,9 @@ __decorate$1([
41612
42386
  if (colorOverLifetime.enabled && colorOverLifetime.color.mode === ParticleGradientMode.TwoGradients) {
41613
42387
  instanceVertices[offset + 20] = colorOverLifetime._colorGradientRand.random();
41614
42388
  }
41615
- // instanceVertices[offset + 21] = rand.random();
42389
+ if (this.noise.enabled) {
42390
+ instanceVertices[offset + 21] = this.noise._noiseRand.random();
42391
+ }
41616
42392
  var rotationOverLifetime = this.rotationOverLifetime;
41617
42393
  if (rotationOverLifetime.enabled && rotationOverLifetime.rotationZ.mode === ParticleCurveMode.TwoConstants) {
41618
42394
  instanceVertices[offset + 22] = rotationOverLifetime._rotationRand.random();
@@ -41900,6 +42676,21 @@ __decorate$1([
41900
42676
  out.transform(rotateMat);
41901
42677
  min.add(worldOffsetMin);
41902
42678
  max.add(worldOffsetMax);
42679
+ // Noise module impact: noise output is normalized to [-1, 1],
42680
+ // max displacement = |strength_max|
42681
+ var noise = this.noise;
42682
+ if (noise.enabled) {
42683
+ var noiseMaxX, noiseMaxY, noiseMaxZ;
42684
+ if (noise.separateAxes) {
42685
+ noiseMaxX = Math.abs(noise.strengthX._getMax());
42686
+ noiseMaxY = Math.abs(noise.strengthY._getMax());
42687
+ noiseMaxZ = Math.abs(noise.strengthZ._getMax());
42688
+ } else {
42689
+ noiseMaxX = noiseMaxY = noiseMaxZ = Math.abs(noise.strengthX._getMax());
42690
+ }
42691
+ min.set(min.x - noiseMaxX, min.y - noiseMaxY, min.z - noiseMaxZ);
42692
+ max.set(max.x + noiseMaxX, max.y + noiseMaxY, max.z + noiseMaxZ);
42693
+ }
41903
42694
  min.add(worldPosition);
41904
42695
  max.add(worldPosition);
41905
42696
  };
@@ -41997,6 +42788,9 @@ __decorate$1([
41997
42788
  __decorate$1([
41998
42789
  deepClone
41999
42790
  ], ParticleGenerator.prototype, "textureSheetAnimation", void 0);
42791
+ __decorate$1([
42792
+ deepClone
42793
+ ], ParticleGenerator.prototype, "noise", void 0);
42000
42794
  __decorate$1([
42001
42795
  ignoreClone
42002
42796
  ], ParticleGenerator.prototype, "_playTime", void 0);
@@ -44190,6 +44984,7 @@ var CoreObjects = /*#__PURE__*/Object.freeze({
44190
44984
  MeshShape: MeshShape,
44191
44985
  MeshTopology: MeshTopology,
44192
44986
  ModelMesh: ModelMesh,
44987
+ NoiseModule: NoiseModule,
44193
44988
  OverflowMode: OverflowMode,
44194
44989
  PBRMaterial: PBRMaterial,
44195
44990
  ParticleCompositeCurve: ParticleCompositeCurve,
@@ -45380,7 +46175,7 @@ var GLBuffer = /*#__PURE__*/ function() {
45380
46175
  };
45381
46176
  case TextureFormat.ETC2_RGBA5:
45382
46177
  return {
45383
- internalFormat: GLCompressedTextureInternalFormat.RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
46178
+ internalFormat: isSRGBColorSpace ? GLCompressedTextureInternalFormat.SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 : GLCompressedTextureInternalFormat.RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
45384
46179
  isCompressed: true
45385
46180
  };
45386
46181
  case TextureFormat.ETC2_RGBA8:
@@ -45415,27 +46210,27 @@ var GLBuffer = /*#__PURE__*/ function() {
45415
46210
  };
45416
46211
  case TextureFormat.ASTC_5x5:
45417
46212
  return {
45418
- internalFormat: GLCompressedTextureInternalFormat.RGBA_ASTC_5X5_KHR,
46213
+ internalFormat: isSRGBColorSpace ? GLCompressedTextureInternalFormat.SRGB8_ALPHA8_ASTC_5X5_KHR : GLCompressedTextureInternalFormat.RGBA_ASTC_5X5_KHR,
45419
46214
  isCompressed: true
45420
46215
  };
45421
46216
  case TextureFormat.ASTC_6x6:
45422
46217
  return {
45423
- internalFormat: GLCompressedTextureInternalFormat.RGBA_ASTC_6X6_KHR,
46218
+ internalFormat: isSRGBColorSpace ? GLCompressedTextureInternalFormat.SRGB8_ALPHA8_ASTC_6X6_KHR : GLCompressedTextureInternalFormat.RGBA_ASTC_6X6_KHR,
45424
46219
  isCompressed: true
45425
46220
  };
45426
46221
  case TextureFormat.ASTC_8x8:
45427
46222
  return {
45428
- internalFormat: GLCompressedTextureInternalFormat.RGBA_ASTC_8X8_KHR,
46223
+ internalFormat: isSRGBColorSpace ? GLCompressedTextureInternalFormat.SRGB8_ALPHA8_ASTC_8X8_KHR : GLCompressedTextureInternalFormat.RGBA_ASTC_8X8_KHR,
45429
46224
  isCompressed: true
45430
46225
  };
45431
46226
  case TextureFormat.ASTC_10x10:
45432
46227
  return {
45433
- internalFormat: GLCompressedTextureInternalFormat.RGBA_ASTC_10X10_KHR,
46228
+ internalFormat: isSRGBColorSpace ? GLCompressedTextureInternalFormat.SRGB8_ALPHA8_ASTC_10X10_KHR : GLCompressedTextureInternalFormat.RGBA_ASTC_10X10_KHR,
45434
46229
  isCompressed: true
45435
46230
  };
45436
46231
  case TextureFormat.ASTC_12x12:
45437
46232
  return {
45438
- internalFormat: GLCompressedTextureInternalFormat.RGBA_ASTC_12X12_KHR,
46233
+ internalFormat: isSRGBColorSpace ? GLCompressedTextureInternalFormat.SRGB8_ALPHA8_ASTC_12X12_KHR : GLCompressedTextureInternalFormat.RGBA_ASTC_12X12_KHR,
45439
46234
  isCompressed: true
45440
46235
  };
45441
46236
  case TextureFormat.Depth:
@@ -51695,16 +52490,11 @@ var GLTFSceneParser = /*#__PURE__*/ function(GLTFParser1) {
51695
52490
  var isDefaultScene = scene === index;
51696
52491
  var sceneNodes = sceneInfo.nodes || [];
51697
52492
  var sceneRoot;
51698
- if (sceneNodes.length === 1) {
51699
- sceneRoot = context.get(GLTFParserType.Entity, sceneNodes[0]);
51700
- } else {
51701
- sceneRoot = new Entity(engine, "GLTF_ROOT");
51702
- // @ts-ignore
51703
- sceneRoot._markAsTemplate(glTFResource);
51704
- for(var i = 0; i < sceneNodes.length; i++){
51705
- var childEntity = context.get(GLTFParserType.Entity, sceneNodes[i]);
51706
- sceneRoot.addChild(childEntity);
51707
- }
52493
+ sceneRoot = new Entity(engine, "GLTF_ROOT");
52494
+ // @ts-ignore
52495
+ sceneRoot._markAsTemplate(glTFResource);
52496
+ for(var i = 0; i < sceneNodes.length; i++){
52497
+ sceneRoot.addChild(context.get(GLTFParserType.Entity, sceneNodes[i]));
51708
52498
  }
51709
52499
  if (isDefaultScene) {
51710
52500
  glTFResource._defaultSceneRoot = sceneRoot;
@@ -53227,6 +54017,15 @@ var ShaderLoader = /*#__PURE__*/ function(Loader) {
53227
54017
  _proto.load = function load(item, resourceManager) {
53228
54018
  var _this = this;
53229
54019
  var url = item.url;
54020
+ if (url.endsWith(".gsp")) {
54021
+ // @ts-ignore
54022
+ return resourceManager._request(url, _extends({}, item, {
54023
+ type: "json"
54024
+ })).then(function(data) {
54025
+ // @ts-ignore - _createFromPrecompiled is @internal
54026
+ return Shader._createFromPrecompiled(data);
54027
+ });
54028
+ }
53230
54029
  // @ts-ignore
53231
54030
  return resourceManager._request(url, _extends({}, item, {
53232
54031
  type: "text"
@@ -53250,8 +54049,7 @@ var ShaderLoader = /*#__PURE__*/ function(Loader) {
53250
54049
  ShaderLoader._builtinRegex = /^\s*\/\/\s*@builtin\s+(\w+)/;
53251
54050
  ShaderLoader = __decorate([
53252
54051
  resourceLoader(AssetType.Shader, [
53253
- "gs",
53254
- "gsl"
54052
+ "shader"
53255
54053
  ])
53256
54054
  ], ShaderLoader);
53257
54055
  var PhysicsMaterialLoader = /*#__PURE__*/ function(Loader) {
@@ -53962,11 +54760,11 @@ EXT_texture_webp = __decorate([
53962
54760
  ], EXT_texture_webp);
53963
54761
 
53964
54762
  //@ts-ignore
53965
- var version = "2.0.0-alpha.25";
54763
+ var version = "2.0.0-alpha.26";
53966
54764
  console.log("Galacean Engine Version: " + version);
53967
54765
  for(var key in CoreObjects){
53968
54766
  Loader.registerClass(key, CoreObjects[key]);
53969
54767
  }
53970
54768
 
53971
- 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, 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 };
54769
+ 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, NoiseModule, 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, 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 };
53972
54770
  //# sourceMappingURL=bundled.module.js.map