@galacean/engine 2.0.0-alpha.17 → 2.0.0-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +218 -221
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/bundled.module.js +218 -221
- package/dist/bundled.module.js.map +1 -1
- package/dist/bundled.module.min.js +1 -1
- package/dist/bundled.module.min.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/bundled.module.js
CHANGED
|
@@ -9881,7 +9881,7 @@ var size_over_lifetime_module = "#ifdef RENDERER_SOL_CURVE_MODE\n uniform vec
|
|
|
9881
9881
|
var color_over_lifetime_module = "#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\n uniform vec4 renderer_COLMaxGradientColor[4]; // x:time y:r z:g w:b\n uniform vec2 renderer_COLMaxGradientAlpha[4]; // x:time y:alpha\n\n #ifdef RENDERER_COL_RANDOM_GRADIENTS\n uniform vec4 renderer_COLMinGradientColor[4]; // x:time y:r z:g w:b\n uniform vec2 renderer_COLMinGradientAlpha[4]; // x:time y:alpha\n #endif\n\n uniform vec4 renderer_COLGradientKeysMaxTime; // x: minColorKeysMaxTime, y: minAlphaKeysMaxTime, z: maxColorKeysMaxTime, w: maxAlphaKeysMaxTime\n#endif\n\n\nvec4 computeParticleColor(in vec4 color, in float normalizedAge) {\n #if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\n vec4 gradientColor = evaluateParticleGradient(renderer_COLMaxGradientColor, renderer_COLGradientKeysMaxTime.z, renderer_COLMaxGradientAlpha, renderer_COLGradientKeysMaxTime.w, normalizedAge);\n #endif\n\n #ifdef RENDERER_COL_RANDOM_GRADIENTS\n gradientColor = mix(evaluateParticleGradient(renderer_COLMinGradientColor,renderer_COLGradientKeysMaxTime.x, renderer_COLMinGradientAlpha, renderer_COLGradientKeysMaxTime.y, normalizedAge), gradientColor, a_Random0.y);\n #endif\n\n #if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\n color *= gradientColor;\n #endif\n\n return color;\n}\n"; // eslint-disable-line
|
|
9882
9882
|
var texture_sheet_animation_module = "#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\n uniform float renderer_TSACycles;\n uniform vec3 renderer_TSATillingParams; // x:subU y:subV z:tileCount\n uniform vec2 renderer_TSAFrameMaxCurve[4]; // x:time y:value\n\n #ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\n uniform vec2 renderer_TSAFrameMinCurve[4]; // x:time y:value\n #endif\n#endif\n\nvec2 computeParticleUV(in vec2 uv, in float normalizedAge) {\n #if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\n float scaledNormalizedAge = normalizedAge * renderer_TSACycles;\n float cycleNormalizedAge = scaledNormalizedAge - floor(scaledNormalizedAge);\n float normalizedFrame = evaluateParticleCurve(renderer_TSAFrameMaxCurve, cycleNormalizedAge);\n #ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\n normalizedFrame = mix(evaluateParticleCurve(renderer_TSAFrameMinCurve, cycleNormalizedAge), normalizedFrame, a_Random1.x);\n #endif\n\n float frame = floor(normalizedFrame * renderer_TSATillingParams.z);\n\n float tileRow = frame * renderer_TSATillingParams.x;\n float tileRowIndex = floor(tileRow);\n uv.x += tileRow - tileRowIndex;\n uv.y += tileRowIndex * renderer_TSATillingParams.y;\n #endif\n \n return uv;\n}\n"; // eslint-disable-line
|
|
9883
9883
|
var force_over_lifetime_module = "#if defined(RENDERER_FOL_CONSTANT_MODE) || defined(RENDERER_FOL_CURVE_MODE)\n #define _FOL_MODULE_ENABLED\n#endif\n\n#ifdef _FOL_MODULE_ENABLED\n uniform int renderer_FOLSpace;\n\n #ifdef RENDERER_FOL_CONSTANT_MODE\n uniform vec3 renderer_FOLMaxConst;\n\n #ifdef RENDERER_FOL_IS_RANDOM_TWO\n uniform vec3 renderer_FOLMinConst;\n #endif\n\n #endif\n\n #ifdef RENDERER_FOL_CURVE_MODE\n uniform vec2 renderer_FOLMaxGradientX[4];\n uniform vec2 renderer_FOLMaxGradientY[4];\n uniform vec2 renderer_FOLMaxGradientZ[4];\n\n #ifdef RENDERER_FOL_IS_RANDOM_TWO\n uniform vec2 renderer_FOLMinGradientX[4];\n uniform vec2 renderer_FOLMinGradientY[4];\n uniform vec2 renderer_FOLMinGradientZ[4];\n #endif\n #endif\n\n // (tHat - t1) * (tHat - t1) * (tHat - t1) * (a2 - a1) / ((t2 - t1) * 6.0) + a1 * (tHat - t1) * (tHat - t1) * 0.5 + v1 * (tHat - t1);\n // to = tHat - t1; tr = t2 - t1\n float computeDisplacementIntegral(in float to, in float tr, in float a1, in float a2, in float v1) {\n return to * to * to * (a2 - a1) / (tr * 6.0) + a1 * to * to * 0.5 + v1 * to;\n }\n\n float evaluateForceParticleCurveCumulative(in vec2 keys[4], in float normalizedAge, out float velocityCumulative) {\n float cumulativeValue = 0.0;\n velocityCumulative = 0.0;\n\n for (int i = 1; i < 4; i++){\n vec2 key = keys[i];\n vec2 lastKey = keys[i - 1];\n float timeRange = (key.x - lastKey.x) * a_ShapePositionStartLifeTime.w;\n\n if (key.x >= normalizedAge){\n float timeOffset = (normalizedAge - lastKey.x) * a_ShapePositionStartLifeTime.w;\n cumulativeValue += computeDisplacementIntegral(timeOffset, timeRange, lastKey.y, key.y, velocityCumulative);\n\n float finalAcceleration = mix(lastKey.y, key.y, timeOffset / timeRange);\n velocityCumulative += 0.5 * timeOffset * (finalAcceleration + lastKey.y);\n break;\n } else { \n cumulativeValue += computeDisplacementIntegral(timeRange, timeRange, lastKey.y, key.y, velocityCumulative);\n velocityCumulative += 0.5 * timeRange * (lastKey.y + key.y);\n }\n }\n return cumulativeValue;\n }\n\n vec3 computeForcePositionOffset(in float normalizedAge, in float age, out vec3 velocityOffset) {\n vec3 forcePosition;\n\n #if defined(RENDERER_FOL_CONSTANT_MODE)\n vec3 forceAcceleration = renderer_FOLMaxConst;\n\n #ifdef RENDERER_FOL_IS_RANDOM_TWO\n forceAcceleration = mix(renderer_FOLMinConst, forceAcceleration, vec3(a_Random2.x, a_Random2.y, a_Random2.z));\n #endif\n\n velocityOffset = forceAcceleration * age;\n\n forcePosition = 0.5 * forceAcceleration * age * age;\n #elif defined(RENDERER_FOL_CURVE_MODE)\n forcePosition = vec3(\n evaluateForceParticleCurveCumulative(renderer_FOLMaxGradientX, normalizedAge, velocityOffset.x),\n evaluateForceParticleCurveCumulative(renderer_FOLMaxGradientY, normalizedAge, velocityOffset.y),\n evaluateForceParticleCurveCumulative(renderer_FOLMaxGradientZ, normalizedAge, velocityOffset.z)\n );\n #ifdef RENDERER_FOL_IS_RANDOM_TWO\n vec3 minVelocityOffset;\n\n forcePosition = vec3(\n mix(evaluateForceParticleCurveCumulative(renderer_FOLMinGradientX, normalizedAge, minVelocityOffset.x), forcePosition.x, a_Random2.x),\n mix(evaluateForceParticleCurveCumulative(renderer_FOLMinGradientY, normalizedAge, minVelocityOffset.y), forcePosition.y, a_Random2.y),\n mix(evaluateForceParticleCurveCumulative(renderer_FOLMinGradientZ, normalizedAge, minVelocityOffset.z), forcePosition.z, a_Random2.z)\n );\n\n velocityOffset = mix(minVelocityOffset, velocityOffset, vec3(a_Random2.x, a_Random2.y, a_Random2.z));\n #endif\n #endif\n return forcePosition;\n }\n#endif"; // eslint-disable-line
|
|
9884
|
-
var limit_velocity_over_lifetime_module = "#ifdef RENDERER_LVL_MODULE_ENABLED\n uniform int renderer_LVLSpace;\n uniform float renderer_LVLDampen;\n\n // Scalar limit\n #ifndef RENDERER_LVL_SEPARATE_AXES\n #ifdef
|
|
9884
|
+
var limit_velocity_over_lifetime_module = "#ifdef RENDERER_LVL_MODULE_ENABLED\n uniform int renderer_LVLSpace;\n uniform float renderer_LVLDampen;\n\n // Scalar limit\n #ifndef RENDERER_LVL_SEPARATE_AXES\n #ifdef RENDERER_LVL_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
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
|
|
9886
9886
|
var sphere_billboard = "#ifdef RENDERER_MODE_SPHERE_BILLBOARD\n\tvec2 corner = a_CornerTextureCoordinate.xy + renderer_PivotOffset.xy;\n\tvec3 sideVector = normalize(cross(camera_Forward, camera_Up));\n\tvec3 upVector = normalize(cross(sideVector, camera_Forward));\n\tcorner *= computeParticleSizeBillboard(a_StartSize.xy, normalizedAge);\n #if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n if (renderer_ThreeDStartRotation) {\n vec3 rotation = radians(vec3(a_StartRotation0.xy, computeParticleRotationFloat(a_StartRotation0.z, age, normalizedAge)));\n center += renderer_SizeScale.xzy * rotationByEuler(corner.x * sideVector + corner.y * upVector, rotation);\n } else {\n float rot = radians(computeParticleRotationFloat(a_StartRotation0.x, age, normalizedAge));\n float c = cos(rot);\n float s = sin(rot);\n mat2 rotation = mat2(c, -s, s, c);\n corner = rotation * corner;\n center += renderer_SizeScale.xzy * (corner.x * sideVector + corner.y * upVector);\n }\n #else\n if (renderer_ThreeDStartRotation) {\n center += renderer_SizeScale.xzy * rotationByEuler(corner.x * sideVector + corner.y * upVector, radians(a_StartRotation0));\n } else {\n float c = cos(radians(a_StartRotation0.x));\n float s = sin(radians(a_StartRotation0.x));\n mat2 rotation = mat2(c, -s, s, c);\n corner = rotation * corner;\n center += renderer_SizeScale.xzy * (corner.x * sideVector + corner.y * upVector);\n }\n #endif\n#endif"; // eslint-disable-line
|
|
9887
9887
|
var stretched_billboard = "#ifdef RENDERER_MODE_STRETCHED_BILLBOARD\n\tvec2 corner = a_CornerTextureCoordinate.xy + renderer_PivotOffset.xy;\n\tvec3 velocity = rotationByQuaternions(renderer_SizeScale * localVelocity, worldRotation) + worldVelocity;\n\tvec3 cameraUpVector = normalize(velocity);\n\tvec3 direction = normalize(center - camera_Position);\n\tvec3 sideVector = normalize(cross(direction, normalize(velocity)));\n\n\tsideVector = renderer_SizeScale.xzy * sideVector;\n\tcameraUpVector = length(vec3(renderer_SizeScale.x, 0.0, 0.0)) * cameraUpVector;\n\n\tvec2 size = computeParticleSizeBillboard(a_StartSize.xy, normalizedAge);\n\n\tconst mat2 rotationZHalfPI = mat2(0.0, -1.0, 1.0, 0.0);\n\tcorner = rotationZHalfPI * corner;\n\tcorner.y = corner.y - abs(corner.y);\n\n\tfloat speed = length(velocity); // TODO:\n\tcenter += sign(renderer_SizeScale.x) * (sign(renderer_StretchedBillboardLengthScale) * size.x * corner.x * sideVector\n\t + (speed * renderer_StretchedBillboardSpeedScale + size.y * renderer_StretchedBillboardLengthScale) * corner.y * cameraUpVector);\n#endif"; // eslint-disable-line
|
|
@@ -17940,118 +17940,13 @@ __decorate$1([
|
|
|
17940
17940
|
this._fixedTimeStep = 1 / 60;
|
|
17941
17941
|
this._colliders = new DisorderedArray();
|
|
17942
17942
|
this._gravity = new Vector3(0, -9.81, 0);
|
|
17943
|
-
this._onContactEnter = function(nativeCollision) {
|
|
17944
|
-
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
17945
|
-
var shape0Id = nativeCollision.shape0Id, shape1Id = nativeCollision.shape1Id;
|
|
17946
|
-
var shape1 = physicalObjectsMap[shape0Id];
|
|
17947
|
-
var shape2 = physicalObjectsMap[shape1Id];
|
|
17948
|
-
var collision = PhysicsScene._collision;
|
|
17949
|
-
collision._nativeCollision = nativeCollision;
|
|
17950
|
-
shape1.collider.entity._scripts.forEach(function(element) {
|
|
17951
|
-
collision.shape = shape2;
|
|
17952
|
-
element.onCollisionEnter(collision);
|
|
17953
|
-
}, function(element, index) {
|
|
17954
|
-
element._entityScriptsIndex = index;
|
|
17955
|
-
});
|
|
17956
|
-
shape2.collider.entity._scripts.forEach(function(element) {
|
|
17957
|
-
collision.shape = shape1;
|
|
17958
|
-
element.onCollisionEnter(collision);
|
|
17959
|
-
}, function(element, index) {
|
|
17960
|
-
element._entityScriptsIndex = index;
|
|
17961
|
-
});
|
|
17962
|
-
};
|
|
17963
|
-
this._onContactExit = function(nativeCollision) {
|
|
17964
|
-
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
17965
|
-
var shape0Id = nativeCollision.shape0Id, shape1Id = nativeCollision.shape1Id;
|
|
17966
|
-
var shape1 = physicalObjectsMap[shape0Id];
|
|
17967
|
-
var shape2 = physicalObjectsMap[shape1Id];
|
|
17968
|
-
var collision = PhysicsScene._collision;
|
|
17969
|
-
collision._nativeCollision = nativeCollision;
|
|
17970
|
-
shape1.collider.entity._scripts.forEach(function(element) {
|
|
17971
|
-
collision.shape = shape2;
|
|
17972
|
-
element.onCollisionExit(collision);
|
|
17973
|
-
}, function(element, index) {
|
|
17974
|
-
element._entityScriptsIndex = index;
|
|
17975
|
-
});
|
|
17976
|
-
shape2.collider.entity._scripts.forEach(function(element) {
|
|
17977
|
-
collision.shape = shape1;
|
|
17978
|
-
element.onCollisionExit(collision);
|
|
17979
|
-
}, function(element, index) {
|
|
17980
|
-
element._entityScriptsIndex = index;
|
|
17981
|
-
});
|
|
17982
|
-
};
|
|
17983
|
-
this._onContactStay = function(nativeCollision) {
|
|
17984
|
-
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
17985
|
-
var shape0Id = nativeCollision.shape0Id, shape1Id = nativeCollision.shape1Id;
|
|
17986
|
-
var shape1 = physicalObjectsMap[shape0Id];
|
|
17987
|
-
var shape2 = physicalObjectsMap[shape1Id];
|
|
17988
|
-
var collision = PhysicsScene._collision;
|
|
17989
|
-
collision._nativeCollision = nativeCollision;
|
|
17990
|
-
shape1.collider.entity._scripts.forEach(function(element) {
|
|
17991
|
-
collision.shape = shape2;
|
|
17992
|
-
element.onCollisionStay(collision);
|
|
17993
|
-
}, function(element, index) {
|
|
17994
|
-
element._entityScriptsIndex = index;
|
|
17995
|
-
});
|
|
17996
|
-
shape2.collider.entity._scripts.forEach(function(element) {
|
|
17997
|
-
collision.shape = shape1;
|
|
17998
|
-
element.onCollisionStay(collision);
|
|
17999
|
-
}, function(element, index) {
|
|
18000
|
-
element._entityScriptsIndex = index;
|
|
18001
|
-
});
|
|
18002
|
-
};
|
|
18003
|
-
this._onTriggerEnter = function(obj1, obj2) {
|
|
18004
|
-
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
18005
|
-
var shape1 = physicalObjectsMap[obj1];
|
|
18006
|
-
var shape2 = physicalObjectsMap[obj2];
|
|
18007
|
-
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18008
|
-
element.onTriggerEnter(shape2);
|
|
18009
|
-
}, function(element, index) {
|
|
18010
|
-
element._entityScriptsIndex = index;
|
|
18011
|
-
});
|
|
18012
|
-
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18013
|
-
element.onTriggerEnter(shape1);
|
|
18014
|
-
}, function(element, index) {
|
|
18015
|
-
element._entityScriptsIndex = index;
|
|
18016
|
-
});
|
|
18017
|
-
};
|
|
18018
|
-
this._onTriggerExit = function(obj1, obj2) {
|
|
18019
|
-
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
18020
|
-
var shape1 = physicalObjectsMap[obj1];
|
|
18021
|
-
var shape2 = physicalObjectsMap[obj2];
|
|
18022
|
-
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18023
|
-
element.onTriggerExit(shape2);
|
|
18024
|
-
}, function(element, index) {
|
|
18025
|
-
element._entityScriptsIndex = index;
|
|
18026
|
-
});
|
|
18027
|
-
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18028
|
-
element.onTriggerExit(shape1);
|
|
18029
|
-
}, function(element, index) {
|
|
18030
|
-
element._entityScriptsIndex = index;
|
|
18031
|
-
});
|
|
18032
|
-
};
|
|
18033
|
-
this._onTriggerStay = function(obj1, obj2) {
|
|
18034
|
-
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
18035
|
-
var shape1 = physicalObjectsMap[obj1];
|
|
18036
|
-
var shape2 = physicalObjectsMap[obj2];
|
|
18037
|
-
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18038
|
-
element.onTriggerStay(shape2);
|
|
18039
|
-
}, function(element, index) {
|
|
18040
|
-
element._entityScriptsIndex = index;
|
|
18041
|
-
});
|
|
18042
|
-
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18043
|
-
element.onTriggerStay(shape1);
|
|
18044
|
-
}, function(element, index) {
|
|
18045
|
-
element._entityScriptsIndex = index;
|
|
18046
|
-
});
|
|
18047
|
-
};
|
|
18048
17943
|
this._scene = scene;
|
|
18049
17944
|
this._setGravity = this._setGravity.bind(this);
|
|
18050
17945
|
//@ts-ignore
|
|
18051
17946
|
this._gravity._onValueChanged = this._setGravity;
|
|
18052
17947
|
var engine = scene.engine;
|
|
18053
17948
|
if (engine._physicsInitialized) {
|
|
18054
|
-
this._nativePhysicsScene = Engine._nativePhysics.createPhysicsScene(engine._nativePhysicsManager
|
|
17949
|
+
this._nativePhysicsScene = Engine._nativePhysics.createPhysicsScene(engine._nativePhysicsManager);
|
|
18055
17950
|
}
|
|
18056
17951
|
}
|
|
18057
17952
|
var _proto = PhysicsScene.prototype;
|
|
@@ -18263,6 +18158,7 @@ __decorate$1([
|
|
|
18263
18158
|
this._callColliderOnUpdate();
|
|
18264
18159
|
nativePhysicsManager.update(fixedTimeStep);
|
|
18265
18160
|
this._callColliderOnLateUpdate();
|
|
18161
|
+
this._dispatchEvents(nativePhysicsManager.updateEvents());
|
|
18266
18162
|
}
|
|
18267
18163
|
};
|
|
18268
18164
|
/**
|
|
@@ -18326,7 +18222,9 @@ __decorate$1([
|
|
|
18326
18222
|
/**
|
|
18327
18223
|
* @internal
|
|
18328
18224
|
*/ _proto._gc = function _gc() {
|
|
18225
|
+
var _this__nativePhysicsScene;
|
|
18329
18226
|
this._colliders.garbageCollection();
|
|
18227
|
+
(_this__nativePhysicsScene = this._nativePhysicsScene) == null ? void 0 : _this__nativePhysicsScene.gc();
|
|
18330
18228
|
};
|
|
18331
18229
|
/**
|
|
18332
18230
|
* @internal
|
|
@@ -18334,6 +18232,92 @@ __decorate$1([
|
|
|
18334
18232
|
var _this__nativePhysicsScene;
|
|
18335
18233
|
(_this__nativePhysicsScene = this._nativePhysicsScene) == null ? void 0 : _this__nativePhysicsScene.destroy();
|
|
18336
18234
|
};
|
|
18235
|
+
_proto._dispatchEvents = function _dispatchEvents(events) {
|
|
18236
|
+
var _loop = function _loop(i, n) {
|
|
18237
|
+
var _shape1_collider, _shape2_collider;
|
|
18238
|
+
var event = contactEvents[i];
|
|
18239
|
+
var shape1 = physicalObjectsMap[event.shape0Id];
|
|
18240
|
+
var shape2 = physicalObjectsMap[event.shape1Id];
|
|
18241
|
+
// entity.destroy() is deferred, so shapes/colliders stay valid through the dispatch loop
|
|
18242
|
+
// This guard covers synchronous removeShape()/clearShapes() which sets shape._collider = null
|
|
18243
|
+
if (!(shape1 == null ? void 0 : (_shape1_collider = shape1.collider) == null ? void 0 : _shape1_collider.entity) || !(shape2 == null ? void 0 : (_shape2_collider = shape2.collider) == null ? void 0 : _shape2_collider.entity)) return "continue";
|
|
18244
|
+
collision._nativeCollision = event;
|
|
18245
|
+
switch(event.state){
|
|
18246
|
+
case 0:
|
|
18247
|
+
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18248
|
+
collision.shape = shape2;
|
|
18249
|
+
element.onCollisionEnter(collision);
|
|
18250
|
+
}, scriptIndexSetter);
|
|
18251
|
+
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18252
|
+
collision.shape = shape1;
|
|
18253
|
+
element.onCollisionEnter(collision);
|
|
18254
|
+
}, scriptIndexSetter);
|
|
18255
|
+
break;
|
|
18256
|
+
case 1:
|
|
18257
|
+
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18258
|
+
collision.shape = shape2;
|
|
18259
|
+
element.onCollisionStay(collision);
|
|
18260
|
+
}, scriptIndexSetter);
|
|
18261
|
+
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18262
|
+
collision.shape = shape1;
|
|
18263
|
+
element.onCollisionStay(collision);
|
|
18264
|
+
}, scriptIndexSetter);
|
|
18265
|
+
break;
|
|
18266
|
+
case 2:
|
|
18267
|
+
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18268
|
+
collision.shape = shape2;
|
|
18269
|
+
element.onCollisionExit(collision);
|
|
18270
|
+
}, scriptIndexSetter);
|
|
18271
|
+
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18272
|
+
collision.shape = shape1;
|
|
18273
|
+
element.onCollisionExit(collision);
|
|
18274
|
+
}, scriptIndexSetter);
|
|
18275
|
+
break;
|
|
18276
|
+
}
|
|
18277
|
+
}, _loop1 = function _loop1(i1, n1) {
|
|
18278
|
+
var _shape1_collider, _shape2_collider;
|
|
18279
|
+
var event = triggerEvents[i1];
|
|
18280
|
+
var shape1 = physicalObjectsMap[event.index1];
|
|
18281
|
+
var shape2 = physicalObjectsMap[event.index2];
|
|
18282
|
+
// entity.destroy() is deferred, so shapes/colliders stay valid through the dispatch loop
|
|
18283
|
+
// This guard covers synchronous removeShape()/clearShapes() which sets shape._collider = null
|
|
18284
|
+
if (!(shape1 == null ? void 0 : (_shape1_collider = shape1.collider) == null ? void 0 : _shape1_collider.entity) || !(shape2 == null ? void 0 : (_shape2_collider = shape2.collider) == null ? void 0 : _shape2_collider.entity)) return "continue";
|
|
18285
|
+
switch(event.dispatchState){
|
|
18286
|
+
case 0:
|
|
18287
|
+
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18288
|
+
element.onTriggerEnter(shape2);
|
|
18289
|
+
}, scriptIndexSetter);
|
|
18290
|
+
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18291
|
+
element.onTriggerEnter(shape1);
|
|
18292
|
+
}, scriptIndexSetter);
|
|
18293
|
+
break;
|
|
18294
|
+
case 1:
|
|
18295
|
+
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18296
|
+
element.onTriggerStay(shape2);
|
|
18297
|
+
}, scriptIndexSetter);
|
|
18298
|
+
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18299
|
+
element.onTriggerStay(shape1);
|
|
18300
|
+
}, scriptIndexSetter);
|
|
18301
|
+
break;
|
|
18302
|
+
case 2:
|
|
18303
|
+
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18304
|
+
element.onTriggerExit(shape2);
|
|
18305
|
+
}, scriptIndexSetter);
|
|
18306
|
+
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18307
|
+
element.onTriggerExit(shape1);
|
|
18308
|
+
}, scriptIndexSetter);
|
|
18309
|
+
break;
|
|
18310
|
+
}
|
|
18311
|
+
};
|
|
18312
|
+
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
18313
|
+
var collision = PhysicsScene._collision;
|
|
18314
|
+
var scriptIndexSetter = PhysicsScene._scriptIndexSetter;
|
|
18315
|
+
var contactEvents = events.contactEvents, contactEventCount = events.contactEventCount, triggerEvents = events.triggerEvents;
|
|
18316
|
+
// Dispatch contact events
|
|
18317
|
+
for(var i = 0, n = contactEventCount; i < n; i++)_loop(i);
|
|
18318
|
+
// Dispatch trigger events
|
|
18319
|
+
for(var i1 = 0, n1 = triggerEvents.length; i1 < n1; i1++)_loop1(i1);
|
|
18320
|
+
};
|
|
18337
18321
|
_proto._setGravity = function _setGravity() {
|
|
18338
18322
|
this._nativePhysicsScene.setGravity(this._gravity);
|
|
18339
18323
|
};
|
|
@@ -18393,6 +18377,9 @@ __decorate$1([
|
|
|
18393
18377
|
}();
|
|
18394
18378
|
PhysicsScene._collision = new Collision();
|
|
18395
18379
|
PhysicsScene._identityQuaternion = new Quaternion(0, 0, 0, 1);
|
|
18380
|
+
PhysicsScene._scriptIndexSetter = function(element, index) {
|
|
18381
|
+
element._entityScriptsIndex = index;
|
|
18382
|
+
};
|
|
18396
18383
|
/**
|
|
18397
18384
|
* A static collider component that will not move.
|
|
18398
18385
|
* @remarks Mostly used for object which always stays at the same place and never moves around.
|
|
@@ -31826,6 +31813,11 @@ ShaderPool.init();
|
|
|
31826
31813
|
this._textSubRenderElementPool.garbageCollection();
|
|
31827
31814
|
this._renderElementPool.garbageCollection();
|
|
31828
31815
|
this._renderContext.garbageCollection();
|
|
31816
|
+
var scenes = this._sceneManager._scenes.getLoopArray();
|
|
31817
|
+
for(var i = 0, n = scenes.length; i < n; i++){
|
|
31818
|
+
var _scenes_i_physics, _scenes_i;
|
|
31819
|
+
(_scenes_i = scenes[i]) == null ? void 0 : (_scenes_i_physics = _scenes_i.physics) == null ? void 0 : _scenes_i_physics._gc();
|
|
31820
|
+
}
|
|
31829
31821
|
};
|
|
31830
31822
|
_create_class$2(Engine, [
|
|
31831
31823
|
{
|
|
@@ -39584,10 +39576,10 @@ __decorate$1([
|
|
|
39584
39576
|
_inherits$2(LimitVelocityOverLifetimeModule, ParticleGeneratorModule);
|
|
39585
39577
|
function LimitVelocityOverLifetimeModule(generator) {
|
|
39586
39578
|
var _this;
|
|
39587
|
-
_this = ParticleGeneratorModule.call(this, generator) || this, /** @internal */ _this.
|
|
39588
|
-
_this.
|
|
39589
|
-
_this.
|
|
39590
|
-
_this.
|
|
39579
|
+
_this = ParticleGeneratorModule.call(this, generator) || this, /** @internal */ _this._speedRand = new Rand(0, ParticleRandomSubSeeds.LimitVelocityOverLifetime), _this._speedMinConstantVec = new Vector3(), _this._speedMaxConstantVec = new Vector3(), _this._dragConstantVec = new Vector2(), _this._separateAxes = false, _this._dampen = 0, _this._multiplyDragByParticleSize = false, _this._multiplyDragByParticleVelocity = false, _this._space = ParticleSimulationSpace.Local;
|
|
39580
|
+
_this.speedX = new ParticleCompositeCurve(1);
|
|
39581
|
+
_this.speedY = new ParticleCompositeCurve(1);
|
|
39582
|
+
_this.speedZ = new ParticleCompositeCurve(1);
|
|
39591
39583
|
_this.drag = new ParticleCompositeCurve(0);
|
|
39592
39584
|
return _this;
|
|
39593
39585
|
}
|
|
@@ -39599,19 +39591,19 @@ __decorate$1([
|
|
|
39599
39591
|
};
|
|
39600
39592
|
/**
|
|
39601
39593
|
* @internal
|
|
39602
|
-
*/ _proto.
|
|
39594
|
+
*/ _proto._isSpeedRandomMode = function _isSpeedRandomMode() {
|
|
39603
39595
|
if (this._separateAxes) {
|
|
39604
|
-
return (this.
|
|
39596
|
+
return (this._speedX.mode === ParticleCurveMode.TwoConstants || this._speedX.mode === ParticleCurveMode.TwoCurves) && (this._speedY.mode === ParticleCurveMode.TwoConstants || this._speedY.mode === ParticleCurveMode.TwoCurves) && (this._speedZ.mode === ParticleCurveMode.TwoConstants || this._speedZ.mode === ParticleCurveMode.TwoCurves);
|
|
39605
39597
|
}
|
|
39606
|
-
return this.
|
|
39598
|
+
return this._speedX.mode === ParticleCurveMode.TwoConstants || this._speedX.mode === ParticleCurveMode.TwoCurves;
|
|
39607
39599
|
};
|
|
39608
39600
|
/**
|
|
39609
39601
|
* @internal
|
|
39610
39602
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
39611
39603
|
var enabledModuleMacro = null;
|
|
39612
39604
|
var separateAxesMacro = null;
|
|
39613
|
-
var
|
|
39614
|
-
var
|
|
39605
|
+
var speedModeMacro = null;
|
|
39606
|
+
var speedRandomMacro = null;
|
|
39615
39607
|
var dragCurveMacro = null;
|
|
39616
39608
|
var dragRandomMacro = null;
|
|
39617
39609
|
var dragSizeMacro = null;
|
|
@@ -39622,16 +39614,16 @@ __decorate$1([
|
|
|
39622
39614
|
shaderData.setFloat(LimitVelocityOverLifetimeModule._dampenProperty, this._dampen);
|
|
39623
39615
|
// Space
|
|
39624
39616
|
shaderData.setInt(LimitVelocityOverLifetimeModule._spaceProperty, this._space);
|
|
39625
|
-
// Limit
|
|
39617
|
+
// Limit speed
|
|
39626
39618
|
if (this._separateAxes) {
|
|
39627
39619
|
separateAxesMacro = LimitVelocityOverLifetimeModule._separateAxesMacro;
|
|
39628
|
-
var result = this.
|
|
39629
|
-
|
|
39630
|
-
|
|
39620
|
+
var result = this._uploadSeparateAxisSpeeds(shaderData);
|
|
39621
|
+
speedModeMacro = result.modeMacro;
|
|
39622
|
+
speedRandomMacro = result.randomMacro;
|
|
39631
39623
|
} else {
|
|
39632
|
-
var result1 = this.
|
|
39633
|
-
|
|
39634
|
-
|
|
39624
|
+
var result1 = this._uploadScalarSpeed(shaderData);
|
|
39625
|
+
speedModeMacro = result1.modeMacro;
|
|
39626
|
+
speedRandomMacro = result1.randomMacro;
|
|
39635
39627
|
}
|
|
39636
39628
|
// Drag
|
|
39637
39629
|
var dragResult = this._uploadDrag(shaderData);
|
|
@@ -39647,8 +39639,8 @@ __decorate$1([
|
|
|
39647
39639
|
}
|
|
39648
39640
|
this._enabledModuleMacro = this._enableMacro(shaderData, this._enabledModuleMacro, enabledModuleMacro);
|
|
39649
39641
|
this._separateAxesCachedMacro = this._enableMacro(shaderData, this._separateAxesCachedMacro, separateAxesMacro);
|
|
39650
|
-
this.
|
|
39651
|
-
this.
|
|
39642
|
+
this._speedModeMacro = this._enableMacro(shaderData, this._speedModeMacro, speedModeMacro);
|
|
39643
|
+
this._speedRandomMacro = this._enableMacro(shaderData, this._speedRandomMacro, speedRandomMacro);
|
|
39652
39644
|
this._dragCurveCachedMacro = this._enableMacro(shaderData, this._dragCurveCachedMacro, dragCurveMacro);
|
|
39653
39645
|
this._dragRandomCachedMacro = this._enableMacro(shaderData, this._dragRandomCachedMacro, dragRandomMacro);
|
|
39654
39646
|
this._dragSizeMacro = this._enableMacro(shaderData, this._dragSizeMacro, dragSizeMacro);
|
|
@@ -39657,26 +39649,26 @@ __decorate$1([
|
|
|
39657
39649
|
/**
|
|
39658
39650
|
* @internal
|
|
39659
39651
|
*/ _proto._resetRandomSeed = function _resetRandomSeed(seed) {
|
|
39660
|
-
this.
|
|
39652
|
+
this._speedRand.reset(seed, ParticleRandomSubSeeds.LimitVelocityOverLifetime);
|
|
39661
39653
|
};
|
|
39662
|
-
_proto.
|
|
39663
|
-
var
|
|
39654
|
+
_proto._uploadScalarSpeed = function _uploadScalarSpeed(shaderData) {
|
|
39655
|
+
var speedX = this._speedX;
|
|
39664
39656
|
var modeMacro = null;
|
|
39665
39657
|
var randomMacro = null;
|
|
39666
|
-
var isRandomCurveMode =
|
|
39667
|
-
if (isRandomCurveMode ||
|
|
39668
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39669
|
-
modeMacro = LimitVelocityOverLifetimeModule.
|
|
39658
|
+
var isRandomCurveMode = speedX.mode === ParticleCurveMode.TwoCurves;
|
|
39659
|
+
if (isRandomCurveMode || speedX.mode === ParticleCurveMode.Curve) {
|
|
39660
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedMaxCurveProperty, speedX.curveMax._getTypeArray());
|
|
39661
|
+
modeMacro = LimitVelocityOverLifetimeModule._speedCurveModeMacro;
|
|
39670
39662
|
if (isRandomCurveMode) {
|
|
39671
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39672
|
-
randomMacro = LimitVelocityOverLifetimeModule.
|
|
39663
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedMinCurveProperty, speedX.curveMin._getTypeArray());
|
|
39664
|
+
randomMacro = LimitVelocityOverLifetimeModule._speedIsRandomMacro;
|
|
39673
39665
|
}
|
|
39674
39666
|
} else {
|
|
39675
|
-
shaderData.setFloat(LimitVelocityOverLifetimeModule.
|
|
39676
|
-
modeMacro = LimitVelocityOverLifetimeModule.
|
|
39677
|
-
if (
|
|
39678
|
-
shaderData.setFloat(LimitVelocityOverLifetimeModule.
|
|
39679
|
-
randomMacro = LimitVelocityOverLifetimeModule.
|
|
39667
|
+
shaderData.setFloat(LimitVelocityOverLifetimeModule._speedMaxConstProperty, speedX.constantMax);
|
|
39668
|
+
modeMacro = LimitVelocityOverLifetimeModule._speedConstantModeMacro;
|
|
39669
|
+
if (speedX.mode === ParticleCurveMode.TwoConstants) {
|
|
39670
|
+
shaderData.setFloat(LimitVelocityOverLifetimeModule._speedMinConstProperty, speedX.constantMin);
|
|
39671
|
+
randomMacro = LimitVelocityOverLifetimeModule._speedIsRandomMacro;
|
|
39680
39672
|
}
|
|
39681
39673
|
}
|
|
39682
39674
|
return {
|
|
@@ -39684,34 +39676,34 @@ __decorate$1([
|
|
|
39684
39676
|
randomMacro: randomMacro
|
|
39685
39677
|
};
|
|
39686
39678
|
};
|
|
39687
|
-
_proto.
|
|
39688
|
-
var
|
|
39689
|
-
var
|
|
39690
|
-
var
|
|
39679
|
+
_proto._uploadSeparateAxisSpeeds = function _uploadSeparateAxisSpeeds(shaderData) {
|
|
39680
|
+
var speedX = this._speedX;
|
|
39681
|
+
var speedY = this._speedY;
|
|
39682
|
+
var speedZ = this._speedZ;
|
|
39691
39683
|
var modeMacro = null;
|
|
39692
39684
|
var randomMacro = null;
|
|
39693
|
-
var isRandomCurveMode =
|
|
39694
|
-
if (isRandomCurveMode ||
|
|
39695
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39696
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39697
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39698
|
-
modeMacro = LimitVelocityOverLifetimeModule.
|
|
39685
|
+
var isRandomCurveMode = speedX.mode === ParticleCurveMode.TwoCurves && speedY.mode === ParticleCurveMode.TwoCurves && speedZ.mode === ParticleCurveMode.TwoCurves;
|
|
39686
|
+
if (isRandomCurveMode || speedX.mode === ParticleCurveMode.Curve && speedY.mode === ParticleCurveMode.Curve && speedZ.mode === ParticleCurveMode.Curve) {
|
|
39687
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedXMaxCurveProperty, speedX.curveMax._getTypeArray());
|
|
39688
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedYMaxCurveProperty, speedY.curveMax._getTypeArray());
|
|
39689
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedZMaxCurveProperty, speedZ.curveMax._getTypeArray());
|
|
39690
|
+
modeMacro = LimitVelocityOverLifetimeModule._speedCurveModeMacro;
|
|
39699
39691
|
if (isRandomCurveMode) {
|
|
39700
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39701
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39702
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39703
|
-
randomMacro = LimitVelocityOverLifetimeModule.
|
|
39692
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedXMinCurveProperty, speedX.curveMin._getTypeArray());
|
|
39693
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedYMinCurveProperty, speedY.curveMin._getTypeArray());
|
|
39694
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedZMinCurveProperty, speedZ.curveMin._getTypeArray());
|
|
39695
|
+
randomMacro = LimitVelocityOverLifetimeModule._speedIsRandomMacro;
|
|
39704
39696
|
}
|
|
39705
39697
|
} else {
|
|
39706
|
-
var constantMax = this.
|
|
39707
|
-
constantMax.set(
|
|
39708
|
-
shaderData.setVector3(LimitVelocityOverLifetimeModule.
|
|
39709
|
-
modeMacro = LimitVelocityOverLifetimeModule.
|
|
39710
|
-
if (
|
|
39711
|
-
var constantMin = this.
|
|
39712
|
-
constantMin.set(
|
|
39713
|
-
shaderData.setVector3(LimitVelocityOverLifetimeModule.
|
|
39714
|
-
randomMacro = LimitVelocityOverLifetimeModule.
|
|
39698
|
+
var constantMax = this._speedMaxConstantVec;
|
|
39699
|
+
constantMax.set(speedX.constantMax, speedY.constantMax, speedZ.constantMax);
|
|
39700
|
+
shaderData.setVector3(LimitVelocityOverLifetimeModule._speedMaxConstVecProperty, constantMax);
|
|
39701
|
+
modeMacro = LimitVelocityOverLifetimeModule._speedConstantModeMacro;
|
|
39702
|
+
if (speedX.mode === ParticleCurveMode.TwoConstants && speedY.mode === ParticleCurveMode.TwoConstants && speedZ.mode === ParticleCurveMode.TwoConstants) {
|
|
39703
|
+
var constantMin = this._speedMinConstantVec;
|
|
39704
|
+
constantMin.set(speedX.constantMin, speedY.constantMin, speedZ.constantMin);
|
|
39705
|
+
shaderData.setVector3(LimitVelocityOverLifetimeModule._speedMinConstVecProperty, constantMin);
|
|
39706
|
+
randomMacro = LimitVelocityOverLifetimeModule._speedIsRandomMacro;
|
|
39715
39707
|
}
|
|
39716
39708
|
}
|
|
39717
39709
|
return {
|
|
@@ -39761,57 +39753,57 @@ __decorate$1([
|
|
|
39761
39753
|
}
|
|
39762
39754
|
},
|
|
39763
39755
|
{
|
|
39764
|
-
key: "
|
|
39756
|
+
key: "speed",
|
|
39765
39757
|
get: /**
|
|
39766
39758
|
* Speed limit when separateAxes is false.
|
|
39767
39759
|
*/ function get() {
|
|
39768
|
-
return this.
|
|
39760
|
+
return this._speedX;
|
|
39769
39761
|
},
|
|
39770
39762
|
set: function set(value) {
|
|
39771
|
-
this.
|
|
39763
|
+
this.speedX = value;
|
|
39772
39764
|
}
|
|
39773
39765
|
},
|
|
39774
39766
|
{
|
|
39775
|
-
key: "
|
|
39767
|
+
key: "speedX",
|
|
39776
39768
|
get: /**
|
|
39777
39769
|
* Speed limit for the x-axis (or overall limit when separateAxes is false).
|
|
39778
39770
|
*/ function get() {
|
|
39779
|
-
return this.
|
|
39771
|
+
return this._speedX;
|
|
39780
39772
|
},
|
|
39781
39773
|
set: function set(value) {
|
|
39782
|
-
var lastValue = this.
|
|
39774
|
+
var lastValue = this._speedX;
|
|
39783
39775
|
if (value !== lastValue) {
|
|
39784
|
-
this.
|
|
39776
|
+
this._speedX = value;
|
|
39785
39777
|
this._onCompositeCurveChange(lastValue, value);
|
|
39786
39778
|
}
|
|
39787
39779
|
}
|
|
39788
39780
|
},
|
|
39789
39781
|
{
|
|
39790
|
-
key: "
|
|
39782
|
+
key: "speedY",
|
|
39791
39783
|
get: /**
|
|
39792
39784
|
* Speed limit for the y-axis.
|
|
39793
39785
|
*/ function get() {
|
|
39794
|
-
return this.
|
|
39786
|
+
return this._speedY;
|
|
39795
39787
|
},
|
|
39796
39788
|
set: function set(value) {
|
|
39797
|
-
var lastValue = this.
|
|
39789
|
+
var lastValue = this._speedY;
|
|
39798
39790
|
if (value !== lastValue) {
|
|
39799
|
-
this.
|
|
39791
|
+
this._speedY = value;
|
|
39800
39792
|
this._onCompositeCurveChange(lastValue, value);
|
|
39801
39793
|
}
|
|
39802
39794
|
}
|
|
39803
39795
|
},
|
|
39804
39796
|
{
|
|
39805
|
-
key: "
|
|
39797
|
+
key: "speedZ",
|
|
39806
39798
|
get: /**
|
|
39807
39799
|
* Speed limit for the z-axis.
|
|
39808
39800
|
*/ function get() {
|
|
39809
|
-
return this.
|
|
39801
|
+
return this._speedZ;
|
|
39810
39802
|
},
|
|
39811
39803
|
set: function set(value) {
|
|
39812
|
-
var lastValue = this.
|
|
39804
|
+
var lastValue = this._speedZ;
|
|
39813
39805
|
if (value !== lastValue) {
|
|
39814
|
-
this.
|
|
39806
|
+
this._speedZ = value;
|
|
39815
39807
|
this._onCompositeCurveChange(lastValue, value);
|
|
39816
39808
|
}
|
|
39817
39809
|
}
|
|
@@ -39879,6 +39871,7 @@ __decorate$1([
|
|
|
39879
39871
|
key: "space",
|
|
39880
39872
|
get: /**
|
|
39881
39873
|
* Specifies if the velocity limits are in local space or world space.
|
|
39874
|
+
* @remarks Only takes effect when 'separateAxes' is enabled.
|
|
39882
39875
|
*/ function get() {
|
|
39883
39876
|
return this._space;
|
|
39884
39877
|
},
|
|
@@ -39913,25 +39906,25 @@ __decorate$1([
|
|
|
39913
39906
|
}(ParticleGeneratorModule);
|
|
39914
39907
|
LimitVelocityOverLifetimeModule._enabledMacro = ShaderMacro.getByName("RENDERER_LVL_MODULE_ENABLED");
|
|
39915
39908
|
LimitVelocityOverLifetimeModule._separateAxesMacro = ShaderMacro.getByName("RENDERER_LVL_SEPARATE_AXES");
|
|
39916
|
-
LimitVelocityOverLifetimeModule.
|
|
39917
|
-
LimitVelocityOverLifetimeModule.
|
|
39918
|
-
LimitVelocityOverLifetimeModule.
|
|
39909
|
+
LimitVelocityOverLifetimeModule._speedConstantModeMacro = ShaderMacro.getByName("RENDERER_LVL_SPEED_CONSTANT_MODE");
|
|
39910
|
+
LimitVelocityOverLifetimeModule._speedCurveModeMacro = ShaderMacro.getByName("RENDERER_LVL_SPEED_CURVE_MODE");
|
|
39911
|
+
LimitVelocityOverLifetimeModule._speedIsRandomMacro = ShaderMacro.getByName("RENDERER_LVL_SPEED_IS_RANDOM_TWO");
|
|
39919
39912
|
LimitVelocityOverLifetimeModule._dragCurveModeMacro = ShaderMacro.getByName("RENDERER_LVL_DRAG_CURVE_MODE");
|
|
39920
39913
|
LimitVelocityOverLifetimeModule._dragIsRandomMacro = ShaderMacro.getByName("RENDERER_LVL_DRAG_IS_RANDOM_TWO");
|
|
39921
39914
|
LimitVelocityOverLifetimeModule._multiplyDragBySizeMacro = ShaderMacro.getByName("RENDERER_LVL_DRAG_MULTIPLY_SIZE");
|
|
39922
39915
|
LimitVelocityOverLifetimeModule._multiplyDragByVelocityMacro = ShaderMacro.getByName("RENDERER_LVL_DRAG_MULTIPLY_VELOCITY");
|
|
39923
|
-
LimitVelocityOverLifetimeModule.
|
|
39924
|
-
LimitVelocityOverLifetimeModule.
|
|
39925
|
-
LimitVelocityOverLifetimeModule.
|
|
39926
|
-
LimitVelocityOverLifetimeModule.
|
|
39927
|
-
LimitVelocityOverLifetimeModule.
|
|
39928
|
-
LimitVelocityOverLifetimeModule.
|
|
39929
|
-
LimitVelocityOverLifetimeModule.
|
|
39930
|
-
LimitVelocityOverLifetimeModule.
|
|
39931
|
-
LimitVelocityOverLifetimeModule.
|
|
39932
|
-
LimitVelocityOverLifetimeModule.
|
|
39933
|
-
LimitVelocityOverLifetimeModule.
|
|
39934
|
-
LimitVelocityOverLifetimeModule.
|
|
39916
|
+
LimitVelocityOverLifetimeModule._speedMaxConstProperty = ShaderProperty.getByName("renderer_LVLSpeedMaxConst");
|
|
39917
|
+
LimitVelocityOverLifetimeModule._speedMinConstProperty = ShaderProperty.getByName("renderer_LVLSpeedMinConst");
|
|
39918
|
+
LimitVelocityOverLifetimeModule._speedMaxCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedMaxCurve");
|
|
39919
|
+
LimitVelocityOverLifetimeModule._speedMinCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedMinCurve");
|
|
39920
|
+
LimitVelocityOverLifetimeModule._speedMaxConstVecProperty = ShaderProperty.getByName("renderer_LVLSpeedMaxConstVector");
|
|
39921
|
+
LimitVelocityOverLifetimeModule._speedMinConstVecProperty = ShaderProperty.getByName("renderer_LVLSpeedMinConstVector");
|
|
39922
|
+
LimitVelocityOverLifetimeModule._speedXMaxCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedXMaxCurve");
|
|
39923
|
+
LimitVelocityOverLifetimeModule._speedXMinCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedXMinCurve");
|
|
39924
|
+
LimitVelocityOverLifetimeModule._speedYMaxCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedYMaxCurve");
|
|
39925
|
+
LimitVelocityOverLifetimeModule._speedYMinCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedYMinCurve");
|
|
39926
|
+
LimitVelocityOverLifetimeModule._speedZMaxCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedZMaxCurve");
|
|
39927
|
+
LimitVelocityOverLifetimeModule._speedZMinCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedZMinCurve");
|
|
39935
39928
|
LimitVelocityOverLifetimeModule._dampenProperty = ShaderProperty.getByName("renderer_LVLDampen");
|
|
39936
39929
|
LimitVelocityOverLifetimeModule._dragConstantProperty = ShaderProperty.getByName("renderer_LVLDragConstant");
|
|
39937
39930
|
LimitVelocityOverLifetimeModule._dragMaxCurveProperty = ShaderProperty.getByName("renderer_LVLDragMaxCurve");
|
|
@@ -39939,13 +39932,13 @@ LimitVelocityOverLifetimeModule._dragMinCurveProperty = ShaderProperty.getByName
|
|
|
39939
39932
|
LimitVelocityOverLifetimeModule._spaceProperty = ShaderProperty.getByName("renderer_LVLSpace");
|
|
39940
39933
|
__decorate$1([
|
|
39941
39934
|
ignoreClone
|
|
39942
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39935
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedRand", void 0);
|
|
39943
39936
|
__decorate$1([
|
|
39944
39937
|
ignoreClone
|
|
39945
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39938
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedMinConstantVec", void 0);
|
|
39946
39939
|
__decorate$1([
|
|
39947
39940
|
ignoreClone
|
|
39948
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39941
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedMaxConstantVec", void 0);
|
|
39949
39942
|
__decorate$1([
|
|
39950
39943
|
ignoreClone
|
|
39951
39944
|
], LimitVelocityOverLifetimeModule.prototype, "_dragConstantVec", void 0);
|
|
@@ -39957,10 +39950,10 @@ __decorate$1([
|
|
|
39957
39950
|
], LimitVelocityOverLifetimeModule.prototype, "_separateAxesCachedMacro", void 0);
|
|
39958
39951
|
__decorate$1([
|
|
39959
39952
|
ignoreClone
|
|
39960
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39953
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedModeMacro", void 0);
|
|
39961
39954
|
__decorate$1([
|
|
39962
39955
|
ignoreClone
|
|
39963
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39956
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedRandomMacro", void 0);
|
|
39964
39957
|
__decorate$1([
|
|
39965
39958
|
ignoreClone
|
|
39966
39959
|
], LimitVelocityOverLifetimeModule.prototype, "_dragCurveCachedMacro", void 0);
|
|
@@ -39975,13 +39968,13 @@ __decorate$1([
|
|
|
39975
39968
|
], LimitVelocityOverLifetimeModule.prototype, "_dragVelocityMacro", void 0);
|
|
39976
39969
|
__decorate$1([
|
|
39977
39970
|
deepClone
|
|
39978
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39971
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedX", void 0);
|
|
39979
39972
|
__decorate$1([
|
|
39980
39973
|
deepClone
|
|
39981
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39974
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedY", void 0);
|
|
39982
39975
|
__decorate$1([
|
|
39983
39976
|
deepClone
|
|
39984
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39977
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedZ", void 0);
|
|
39985
39978
|
__decorate$1([
|
|
39986
39979
|
deepClone
|
|
39987
39980
|
], LimitVelocityOverLifetimeModule.prototype, "_drag", void 0);
|
|
@@ -41670,8 +41663,8 @@ __decorate$1([
|
|
|
41670
41663
|
instanceVertices[offset + 40] = rand1.random();
|
|
41671
41664
|
}
|
|
41672
41665
|
var limitVelocityOverLifetime = this.limitVelocityOverLifetime;
|
|
41673
|
-
if (limitVelocityOverLifetime.enabled && (limitVelocityOverLifetime.
|
|
41674
|
-
instanceVertices[offset + 41] = limitVelocityOverLifetime.
|
|
41666
|
+
if (limitVelocityOverLifetime.enabled && (limitVelocityOverLifetime._isSpeedRandomMode() || limitVelocityOverLifetime._isDragRandomMode())) {
|
|
41667
|
+
instanceVertices[offset + 41] = limitVelocityOverLifetime._speedRand.random();
|
|
41675
41668
|
}
|
|
41676
41669
|
// Initialize feedback buffer for this particle
|
|
41677
41670
|
if (this._useTransformFeedback) {
|
|
@@ -45843,7 +45836,9 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
45843
45836
|
_proto._bindMainFBO = function _bindMainFBO() {
|
|
45844
45837
|
var gl = this._gl;
|
|
45845
45838
|
var isWebGL2 = this._isWebGL2;
|
|
45846
|
-
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount
|
|
45839
|
+
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount;
|
|
45840
|
+
_this__target.width;
|
|
45841
|
+
_this__target.height;
|
|
45847
45842
|
var drawBuffers = new Array(colorTextureCount);
|
|
45848
45843
|
gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
|
|
45849
45844
|
/** color render buffer */ for(var i = 0; i < colorTextureCount; i++){
|
|
@@ -45865,11 +45860,7 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
45865
45860
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, platformTexture._formatDetail.attachment, gl.TEXTURE_2D, platformTexture._glTexture, 0);
|
|
45866
45861
|
} else if (this._target.antiAliasing <= 1) {
|
|
45867
45862
|
var _GLTexture__getRenderBufferDepthFormatDetail = GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2), internalFormat = _GLTexture__getRenderBufferDepthFormatDetail.internalFormat, attachment1 = _GLTexture__getRenderBufferDepthFormatDetail.attachment;
|
|
45868
|
-
|
|
45869
|
-
this._depthRenderBuffer = depthRenderBuffer;
|
|
45870
|
-
gl.bindRenderbuffer(gl.RENDERBUFFER, depthRenderBuffer);
|
|
45871
|
-
gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);
|
|
45872
|
-
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment1, gl.RENDERBUFFER, depthRenderBuffer);
|
|
45863
|
+
this._depthRenderBuffer = this._createRenderBuffer(internalFormat, attachment1);
|
|
45873
45864
|
}
|
|
45874
45865
|
}
|
|
45875
45866
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
@@ -45878,32 +45869,38 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
45878
45869
|
_proto._bindMSAAFBO = function _bindMSAAFBO() {
|
|
45879
45870
|
var gl = this._gl;
|
|
45880
45871
|
var isWebGL2 = this._isWebGL2;
|
|
45881
|
-
var
|
|
45882
|
-
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount, antiAliasing = _this__target.antiAliasing, width = _this__target.width, height = _this__target.height;
|
|
45872
|
+
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount;
|
|
45883
45873
|
this._blitDrawBuffers = new Array(colorTextureCount);
|
|
45884
|
-
this._MSAADepthRenderBuffer = MSAADepthRenderBuffer;
|
|
45885
45874
|
gl.bindFramebuffer(gl.FRAMEBUFFER, this._MSAAFrameBuffer);
|
|
45886
45875
|
// prepare MRT+MSAA color RBOs
|
|
45887
45876
|
for(var i = 0; i < colorTextureCount; i++){
|
|
45888
|
-
var MSAAColorRenderBuffer = gl.createRenderbuffer();
|
|
45889
|
-
this._MSAAColorRenderBuffers[i] = MSAAColorRenderBuffer;
|
|
45890
45877
|
this._blitDrawBuffers[i] = gl.NONE;
|
|
45891
|
-
|
|
45892
|
-
|
|
45893
|
-
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, gl.RENDERBUFFER, MSAAColorRenderBuffer);
|
|
45878
|
+
var internalFormat = /** @ts-ignore */ this._target.getColorTexture(i)._platformTexture._formatDetail.internalFormat;
|
|
45879
|
+
this._MSAAColorRenderBuffers[i] = this._createRenderBuffer(internalFormat, gl.COLOR_ATTACHMENT0 + i);
|
|
45894
45880
|
}
|
|
45895
45881
|
gl.drawBuffers(this._oriDrawBuffers);
|
|
45896
45882
|
// prepare MSAA depth RBO
|
|
45897
45883
|
if (_depth !== null) {
|
|
45898
|
-
var _ref = _instanceof1$1(_depth, Texture) ? /** @ts-ignore */ _depth._platformTexture._formatDetail : GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2),
|
|
45899
|
-
|
|
45900
|
-
gl.renderbufferStorageMultisample(gl.RENDERBUFFER, antiAliasing, internalFormat, width, height);
|
|
45901
|
-
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, MSAADepthRenderBuffer);
|
|
45884
|
+
var _ref = _instanceof1$1(_depth, Texture) ? /** @ts-ignore */ _depth._platformTexture._formatDetail : GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2), internalFormat1 = _ref.internalFormat, attachment = _ref.attachment;
|
|
45885
|
+
this._MSAADepthRenderBuffer = this._createRenderBuffer(internalFormat1, attachment);
|
|
45902
45886
|
}
|
|
45903
45887
|
this._checkFrameBuffer();
|
|
45904
45888
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
45905
45889
|
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
|
45906
45890
|
};
|
|
45891
|
+
_proto._createRenderBuffer = function _createRenderBuffer(internalFormat, attachment) {
|
|
45892
|
+
var gl = this._gl;
|
|
45893
|
+
var _this__target = this._target, width = _this__target.width, height = _this__target.height, antiAliasing = _this__target.antiAliasing;
|
|
45894
|
+
var renderBuffer = gl.createRenderbuffer();
|
|
45895
|
+
gl.bindRenderbuffer(gl.RENDERBUFFER, renderBuffer);
|
|
45896
|
+
if (antiAliasing > 1) {
|
|
45897
|
+
gl.renderbufferStorageMultisample(gl.RENDERBUFFER, antiAliasing, internalFormat, width, height);
|
|
45898
|
+
} else {
|
|
45899
|
+
gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);
|
|
45900
|
+
}
|
|
45901
|
+
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, renderBuffer);
|
|
45902
|
+
return renderBuffer;
|
|
45903
|
+
};
|
|
45907
45904
|
_proto._checkFrameBuffer = function _checkFrameBuffer() {
|
|
45908
45905
|
var gl = this._gl;
|
|
45909
45906
|
var e = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
|
|
@@ -54052,7 +54049,7 @@ EXT_texture_webp = __decorate([
|
|
|
54052
54049
|
], EXT_texture_webp);
|
|
54053
54050
|
|
|
54054
54051
|
//@ts-ignore
|
|
54055
|
-
var version = "2.0.0-alpha.
|
|
54052
|
+
var version = "2.0.0-alpha.19";
|
|
54056
54053
|
console.log("Galacean Engine Version: " + version);
|
|
54057
54054
|
for(var key in CoreObjects){
|
|
54058
54055
|
Loader.registerClass(key, CoreObjects[key]);
|