@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/browser.js
CHANGED
|
@@ -9887,7 +9887,7 @@
|
|
|
9887
9887
|
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
|
|
9888
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
|
|
9889
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
|
|
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
|
|
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
|
|
9891
9891
|
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
|
|
9892
9892
|
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
|
|
9893
9893
|
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
|
|
@@ -17946,118 +17946,13 @@
|
|
|
17946
17946
|
this._fixedTimeStep = 1 / 60;
|
|
17947
17947
|
this._colliders = new DisorderedArray();
|
|
17948
17948
|
this._gravity = new Vector3(0, -9.81, 0);
|
|
17949
|
-
this._onContactEnter = function(nativeCollision) {
|
|
17950
|
-
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
17951
|
-
var shape0Id = nativeCollision.shape0Id, shape1Id = nativeCollision.shape1Id;
|
|
17952
|
-
var shape1 = physicalObjectsMap[shape0Id];
|
|
17953
|
-
var shape2 = physicalObjectsMap[shape1Id];
|
|
17954
|
-
var collision = PhysicsScene._collision;
|
|
17955
|
-
collision._nativeCollision = nativeCollision;
|
|
17956
|
-
shape1.collider.entity._scripts.forEach(function(element) {
|
|
17957
|
-
collision.shape = shape2;
|
|
17958
|
-
element.onCollisionEnter(collision);
|
|
17959
|
-
}, function(element, index) {
|
|
17960
|
-
element._entityScriptsIndex = index;
|
|
17961
|
-
});
|
|
17962
|
-
shape2.collider.entity._scripts.forEach(function(element) {
|
|
17963
|
-
collision.shape = shape1;
|
|
17964
|
-
element.onCollisionEnter(collision);
|
|
17965
|
-
}, function(element, index) {
|
|
17966
|
-
element._entityScriptsIndex = index;
|
|
17967
|
-
});
|
|
17968
|
-
};
|
|
17969
|
-
this._onContactExit = function(nativeCollision) {
|
|
17970
|
-
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
17971
|
-
var shape0Id = nativeCollision.shape0Id, shape1Id = nativeCollision.shape1Id;
|
|
17972
|
-
var shape1 = physicalObjectsMap[shape0Id];
|
|
17973
|
-
var shape2 = physicalObjectsMap[shape1Id];
|
|
17974
|
-
var collision = PhysicsScene._collision;
|
|
17975
|
-
collision._nativeCollision = nativeCollision;
|
|
17976
|
-
shape1.collider.entity._scripts.forEach(function(element) {
|
|
17977
|
-
collision.shape = shape2;
|
|
17978
|
-
element.onCollisionExit(collision);
|
|
17979
|
-
}, function(element, index) {
|
|
17980
|
-
element._entityScriptsIndex = index;
|
|
17981
|
-
});
|
|
17982
|
-
shape2.collider.entity._scripts.forEach(function(element) {
|
|
17983
|
-
collision.shape = shape1;
|
|
17984
|
-
element.onCollisionExit(collision);
|
|
17985
|
-
}, function(element, index) {
|
|
17986
|
-
element._entityScriptsIndex = index;
|
|
17987
|
-
});
|
|
17988
|
-
};
|
|
17989
|
-
this._onContactStay = function(nativeCollision) {
|
|
17990
|
-
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
17991
|
-
var shape0Id = nativeCollision.shape0Id, shape1Id = nativeCollision.shape1Id;
|
|
17992
|
-
var shape1 = physicalObjectsMap[shape0Id];
|
|
17993
|
-
var shape2 = physicalObjectsMap[shape1Id];
|
|
17994
|
-
var collision = PhysicsScene._collision;
|
|
17995
|
-
collision._nativeCollision = nativeCollision;
|
|
17996
|
-
shape1.collider.entity._scripts.forEach(function(element) {
|
|
17997
|
-
collision.shape = shape2;
|
|
17998
|
-
element.onCollisionStay(collision);
|
|
17999
|
-
}, function(element, index) {
|
|
18000
|
-
element._entityScriptsIndex = index;
|
|
18001
|
-
});
|
|
18002
|
-
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18003
|
-
collision.shape = shape1;
|
|
18004
|
-
element.onCollisionStay(collision);
|
|
18005
|
-
}, function(element, index) {
|
|
18006
|
-
element._entityScriptsIndex = index;
|
|
18007
|
-
});
|
|
18008
|
-
};
|
|
18009
|
-
this._onTriggerEnter = function(obj1, obj2) {
|
|
18010
|
-
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
18011
|
-
var shape1 = physicalObjectsMap[obj1];
|
|
18012
|
-
var shape2 = physicalObjectsMap[obj2];
|
|
18013
|
-
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18014
|
-
element.onTriggerEnter(shape2);
|
|
18015
|
-
}, function(element, index) {
|
|
18016
|
-
element._entityScriptsIndex = index;
|
|
18017
|
-
});
|
|
18018
|
-
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18019
|
-
element.onTriggerEnter(shape1);
|
|
18020
|
-
}, function(element, index) {
|
|
18021
|
-
element._entityScriptsIndex = index;
|
|
18022
|
-
});
|
|
18023
|
-
};
|
|
18024
|
-
this._onTriggerExit = function(obj1, obj2) {
|
|
18025
|
-
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
18026
|
-
var shape1 = physicalObjectsMap[obj1];
|
|
18027
|
-
var shape2 = physicalObjectsMap[obj2];
|
|
18028
|
-
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18029
|
-
element.onTriggerExit(shape2);
|
|
18030
|
-
}, function(element, index) {
|
|
18031
|
-
element._entityScriptsIndex = index;
|
|
18032
|
-
});
|
|
18033
|
-
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18034
|
-
element.onTriggerExit(shape1);
|
|
18035
|
-
}, function(element, index) {
|
|
18036
|
-
element._entityScriptsIndex = index;
|
|
18037
|
-
});
|
|
18038
|
-
};
|
|
18039
|
-
this._onTriggerStay = function(obj1, obj2) {
|
|
18040
|
-
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
18041
|
-
var shape1 = physicalObjectsMap[obj1];
|
|
18042
|
-
var shape2 = physicalObjectsMap[obj2];
|
|
18043
|
-
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18044
|
-
element.onTriggerStay(shape2);
|
|
18045
|
-
}, function(element, index) {
|
|
18046
|
-
element._entityScriptsIndex = index;
|
|
18047
|
-
});
|
|
18048
|
-
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18049
|
-
element.onTriggerStay(shape1);
|
|
18050
|
-
}, function(element, index) {
|
|
18051
|
-
element._entityScriptsIndex = index;
|
|
18052
|
-
});
|
|
18053
|
-
};
|
|
18054
17949
|
this._scene = scene;
|
|
18055
17950
|
this._setGravity = this._setGravity.bind(this);
|
|
18056
17951
|
//@ts-ignore
|
|
18057
17952
|
this._gravity._onValueChanged = this._setGravity;
|
|
18058
17953
|
var engine = scene.engine;
|
|
18059
17954
|
if (engine._physicsInitialized) {
|
|
18060
|
-
this._nativePhysicsScene = Engine._nativePhysics.createPhysicsScene(engine._nativePhysicsManager
|
|
17955
|
+
this._nativePhysicsScene = Engine._nativePhysics.createPhysicsScene(engine._nativePhysicsManager);
|
|
18061
17956
|
}
|
|
18062
17957
|
}
|
|
18063
17958
|
var _proto = PhysicsScene.prototype;
|
|
@@ -18269,6 +18164,7 @@
|
|
|
18269
18164
|
this._callColliderOnUpdate();
|
|
18270
18165
|
nativePhysicsManager.update(fixedTimeStep);
|
|
18271
18166
|
this._callColliderOnLateUpdate();
|
|
18167
|
+
this._dispatchEvents(nativePhysicsManager.updateEvents());
|
|
18272
18168
|
}
|
|
18273
18169
|
};
|
|
18274
18170
|
/**
|
|
@@ -18332,7 +18228,9 @@
|
|
|
18332
18228
|
/**
|
|
18333
18229
|
* @internal
|
|
18334
18230
|
*/ _proto._gc = function _gc() {
|
|
18231
|
+
var _this__nativePhysicsScene;
|
|
18335
18232
|
this._colliders.garbageCollection();
|
|
18233
|
+
(_this__nativePhysicsScene = this._nativePhysicsScene) == null ? void 0 : _this__nativePhysicsScene.gc();
|
|
18336
18234
|
};
|
|
18337
18235
|
/**
|
|
18338
18236
|
* @internal
|
|
@@ -18340,6 +18238,92 @@
|
|
|
18340
18238
|
var _this__nativePhysicsScene;
|
|
18341
18239
|
(_this__nativePhysicsScene = this._nativePhysicsScene) == null ? void 0 : _this__nativePhysicsScene.destroy();
|
|
18342
18240
|
};
|
|
18241
|
+
_proto._dispatchEvents = function _dispatchEvents(events) {
|
|
18242
|
+
var _loop = function _loop(i, n) {
|
|
18243
|
+
var _shape1_collider, _shape2_collider;
|
|
18244
|
+
var event = contactEvents[i];
|
|
18245
|
+
var shape1 = physicalObjectsMap[event.shape0Id];
|
|
18246
|
+
var shape2 = physicalObjectsMap[event.shape1Id];
|
|
18247
|
+
// entity.destroy() is deferred, so shapes/colliders stay valid through the dispatch loop
|
|
18248
|
+
// This guard covers synchronous removeShape()/clearShapes() which sets shape._collider = null
|
|
18249
|
+
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";
|
|
18250
|
+
collision._nativeCollision = event;
|
|
18251
|
+
switch(event.state){
|
|
18252
|
+
case 0:
|
|
18253
|
+
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18254
|
+
collision.shape = shape2;
|
|
18255
|
+
element.onCollisionEnter(collision);
|
|
18256
|
+
}, scriptIndexSetter);
|
|
18257
|
+
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18258
|
+
collision.shape = shape1;
|
|
18259
|
+
element.onCollisionEnter(collision);
|
|
18260
|
+
}, scriptIndexSetter);
|
|
18261
|
+
break;
|
|
18262
|
+
case 1:
|
|
18263
|
+
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18264
|
+
collision.shape = shape2;
|
|
18265
|
+
element.onCollisionStay(collision);
|
|
18266
|
+
}, scriptIndexSetter);
|
|
18267
|
+
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18268
|
+
collision.shape = shape1;
|
|
18269
|
+
element.onCollisionStay(collision);
|
|
18270
|
+
}, scriptIndexSetter);
|
|
18271
|
+
break;
|
|
18272
|
+
case 2:
|
|
18273
|
+
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18274
|
+
collision.shape = shape2;
|
|
18275
|
+
element.onCollisionExit(collision);
|
|
18276
|
+
}, scriptIndexSetter);
|
|
18277
|
+
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18278
|
+
collision.shape = shape1;
|
|
18279
|
+
element.onCollisionExit(collision);
|
|
18280
|
+
}, scriptIndexSetter);
|
|
18281
|
+
break;
|
|
18282
|
+
}
|
|
18283
|
+
}, _loop1 = function _loop1(i1, n1) {
|
|
18284
|
+
var _shape1_collider, _shape2_collider;
|
|
18285
|
+
var event = triggerEvents[i1];
|
|
18286
|
+
var shape1 = physicalObjectsMap[event.index1];
|
|
18287
|
+
var shape2 = physicalObjectsMap[event.index2];
|
|
18288
|
+
// entity.destroy() is deferred, so shapes/colliders stay valid through the dispatch loop
|
|
18289
|
+
// This guard covers synchronous removeShape()/clearShapes() which sets shape._collider = null
|
|
18290
|
+
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";
|
|
18291
|
+
switch(event.dispatchState){
|
|
18292
|
+
case 0:
|
|
18293
|
+
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18294
|
+
element.onTriggerEnter(shape2);
|
|
18295
|
+
}, scriptIndexSetter);
|
|
18296
|
+
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18297
|
+
element.onTriggerEnter(shape1);
|
|
18298
|
+
}, scriptIndexSetter);
|
|
18299
|
+
break;
|
|
18300
|
+
case 1:
|
|
18301
|
+
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18302
|
+
element.onTriggerStay(shape2);
|
|
18303
|
+
}, scriptIndexSetter);
|
|
18304
|
+
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18305
|
+
element.onTriggerStay(shape1);
|
|
18306
|
+
}, scriptIndexSetter);
|
|
18307
|
+
break;
|
|
18308
|
+
case 2:
|
|
18309
|
+
shape1.collider.entity._scripts.forEach(function(element) {
|
|
18310
|
+
element.onTriggerExit(shape2);
|
|
18311
|
+
}, scriptIndexSetter);
|
|
18312
|
+
shape2.collider.entity._scripts.forEach(function(element) {
|
|
18313
|
+
element.onTriggerExit(shape1);
|
|
18314
|
+
}, scriptIndexSetter);
|
|
18315
|
+
break;
|
|
18316
|
+
}
|
|
18317
|
+
};
|
|
18318
|
+
var physicalObjectsMap = Engine._physicalObjectsMap;
|
|
18319
|
+
var collision = PhysicsScene._collision;
|
|
18320
|
+
var scriptIndexSetter = PhysicsScene._scriptIndexSetter;
|
|
18321
|
+
var contactEvents = events.contactEvents, contactEventCount = events.contactEventCount, triggerEvents = events.triggerEvents;
|
|
18322
|
+
// Dispatch contact events
|
|
18323
|
+
for(var i = 0, n = contactEventCount; i < n; i++)_loop(i);
|
|
18324
|
+
// Dispatch trigger events
|
|
18325
|
+
for(var i1 = 0, n1 = triggerEvents.length; i1 < n1; i1++)_loop1(i1);
|
|
18326
|
+
};
|
|
18343
18327
|
_proto._setGravity = function _setGravity() {
|
|
18344
18328
|
this._nativePhysicsScene.setGravity(this._gravity);
|
|
18345
18329
|
};
|
|
@@ -18399,6 +18383,9 @@
|
|
|
18399
18383
|
}();
|
|
18400
18384
|
PhysicsScene._collision = new Collision();
|
|
18401
18385
|
PhysicsScene._identityQuaternion = new Quaternion(0, 0, 0, 1);
|
|
18386
|
+
PhysicsScene._scriptIndexSetter = function(element, index) {
|
|
18387
|
+
element._entityScriptsIndex = index;
|
|
18388
|
+
};
|
|
18402
18389
|
/**
|
|
18403
18390
|
* A static collider component that will not move.
|
|
18404
18391
|
* @remarks Mostly used for object which always stays at the same place and never moves around.
|
|
@@ -31832,6 +31819,11 @@
|
|
|
31832
31819
|
this._textSubRenderElementPool.garbageCollection();
|
|
31833
31820
|
this._renderElementPool.garbageCollection();
|
|
31834
31821
|
this._renderContext.garbageCollection();
|
|
31822
|
+
var scenes = this._sceneManager._scenes.getLoopArray();
|
|
31823
|
+
for(var i = 0, n = scenes.length; i < n; i++){
|
|
31824
|
+
var _scenes_i_physics, _scenes_i;
|
|
31825
|
+
(_scenes_i = scenes[i]) == null ? void 0 : (_scenes_i_physics = _scenes_i.physics) == null ? void 0 : _scenes_i_physics._gc();
|
|
31826
|
+
}
|
|
31835
31827
|
};
|
|
31836
31828
|
_create_class$2(Engine, [
|
|
31837
31829
|
{
|
|
@@ -39590,10 +39582,10 @@
|
|
|
39590
39582
|
_inherits$2(LimitVelocityOverLifetimeModule, ParticleGeneratorModule);
|
|
39591
39583
|
function LimitVelocityOverLifetimeModule(generator) {
|
|
39592
39584
|
var _this;
|
|
39593
|
-
_this = ParticleGeneratorModule.call(this, generator) || this, /** @internal */ _this.
|
|
39594
|
-
_this.
|
|
39595
|
-
_this.
|
|
39596
|
-
_this.
|
|
39585
|
+
_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;
|
|
39586
|
+
_this.speedX = new ParticleCompositeCurve(1);
|
|
39587
|
+
_this.speedY = new ParticleCompositeCurve(1);
|
|
39588
|
+
_this.speedZ = new ParticleCompositeCurve(1);
|
|
39597
39589
|
_this.drag = new ParticleCompositeCurve(0);
|
|
39598
39590
|
return _this;
|
|
39599
39591
|
}
|
|
@@ -39605,19 +39597,19 @@
|
|
|
39605
39597
|
};
|
|
39606
39598
|
/**
|
|
39607
39599
|
* @internal
|
|
39608
|
-
*/ _proto.
|
|
39600
|
+
*/ _proto._isSpeedRandomMode = function _isSpeedRandomMode() {
|
|
39609
39601
|
if (this._separateAxes) {
|
|
39610
|
-
return (this.
|
|
39602
|
+
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);
|
|
39611
39603
|
}
|
|
39612
|
-
return this.
|
|
39604
|
+
return this._speedX.mode === ParticleCurveMode.TwoConstants || this._speedX.mode === ParticleCurveMode.TwoCurves;
|
|
39613
39605
|
};
|
|
39614
39606
|
/**
|
|
39615
39607
|
* @internal
|
|
39616
39608
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
39617
39609
|
var enabledModuleMacro = null;
|
|
39618
39610
|
var separateAxesMacro = null;
|
|
39619
|
-
var
|
|
39620
|
-
var
|
|
39611
|
+
var speedModeMacro = null;
|
|
39612
|
+
var speedRandomMacro = null;
|
|
39621
39613
|
var dragCurveMacro = null;
|
|
39622
39614
|
var dragRandomMacro = null;
|
|
39623
39615
|
var dragSizeMacro = null;
|
|
@@ -39628,16 +39620,16 @@
|
|
|
39628
39620
|
shaderData.setFloat(LimitVelocityOverLifetimeModule._dampenProperty, this._dampen);
|
|
39629
39621
|
// Space
|
|
39630
39622
|
shaderData.setInt(LimitVelocityOverLifetimeModule._spaceProperty, this._space);
|
|
39631
|
-
// Limit
|
|
39623
|
+
// Limit speed
|
|
39632
39624
|
if (this._separateAxes) {
|
|
39633
39625
|
separateAxesMacro = LimitVelocityOverLifetimeModule._separateAxesMacro;
|
|
39634
|
-
var result = this.
|
|
39635
|
-
|
|
39636
|
-
|
|
39626
|
+
var result = this._uploadSeparateAxisSpeeds(shaderData);
|
|
39627
|
+
speedModeMacro = result.modeMacro;
|
|
39628
|
+
speedRandomMacro = result.randomMacro;
|
|
39637
39629
|
} else {
|
|
39638
|
-
var result1 = this.
|
|
39639
|
-
|
|
39640
|
-
|
|
39630
|
+
var result1 = this._uploadScalarSpeed(shaderData);
|
|
39631
|
+
speedModeMacro = result1.modeMacro;
|
|
39632
|
+
speedRandomMacro = result1.randomMacro;
|
|
39641
39633
|
}
|
|
39642
39634
|
// Drag
|
|
39643
39635
|
var dragResult = this._uploadDrag(shaderData);
|
|
@@ -39653,8 +39645,8 @@
|
|
|
39653
39645
|
}
|
|
39654
39646
|
this._enabledModuleMacro = this._enableMacro(shaderData, this._enabledModuleMacro, enabledModuleMacro);
|
|
39655
39647
|
this._separateAxesCachedMacro = this._enableMacro(shaderData, this._separateAxesCachedMacro, separateAxesMacro);
|
|
39656
|
-
this.
|
|
39657
|
-
this.
|
|
39648
|
+
this._speedModeMacro = this._enableMacro(shaderData, this._speedModeMacro, speedModeMacro);
|
|
39649
|
+
this._speedRandomMacro = this._enableMacro(shaderData, this._speedRandomMacro, speedRandomMacro);
|
|
39658
39650
|
this._dragCurveCachedMacro = this._enableMacro(shaderData, this._dragCurveCachedMacro, dragCurveMacro);
|
|
39659
39651
|
this._dragRandomCachedMacro = this._enableMacro(shaderData, this._dragRandomCachedMacro, dragRandomMacro);
|
|
39660
39652
|
this._dragSizeMacro = this._enableMacro(shaderData, this._dragSizeMacro, dragSizeMacro);
|
|
@@ -39663,26 +39655,26 @@
|
|
|
39663
39655
|
/**
|
|
39664
39656
|
* @internal
|
|
39665
39657
|
*/ _proto._resetRandomSeed = function _resetRandomSeed(seed) {
|
|
39666
|
-
this.
|
|
39658
|
+
this._speedRand.reset(seed, ParticleRandomSubSeeds.LimitVelocityOverLifetime);
|
|
39667
39659
|
};
|
|
39668
|
-
_proto.
|
|
39669
|
-
var
|
|
39660
|
+
_proto._uploadScalarSpeed = function _uploadScalarSpeed(shaderData) {
|
|
39661
|
+
var speedX = this._speedX;
|
|
39670
39662
|
var modeMacro = null;
|
|
39671
39663
|
var randomMacro = null;
|
|
39672
|
-
var isRandomCurveMode =
|
|
39673
|
-
if (isRandomCurveMode ||
|
|
39674
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39675
|
-
modeMacro = LimitVelocityOverLifetimeModule.
|
|
39664
|
+
var isRandomCurveMode = speedX.mode === ParticleCurveMode.TwoCurves;
|
|
39665
|
+
if (isRandomCurveMode || speedX.mode === ParticleCurveMode.Curve) {
|
|
39666
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedMaxCurveProperty, speedX.curveMax._getTypeArray());
|
|
39667
|
+
modeMacro = LimitVelocityOverLifetimeModule._speedCurveModeMacro;
|
|
39676
39668
|
if (isRandomCurveMode) {
|
|
39677
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39678
|
-
randomMacro = LimitVelocityOverLifetimeModule.
|
|
39669
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedMinCurveProperty, speedX.curveMin._getTypeArray());
|
|
39670
|
+
randomMacro = LimitVelocityOverLifetimeModule._speedIsRandomMacro;
|
|
39679
39671
|
}
|
|
39680
39672
|
} else {
|
|
39681
|
-
shaderData.setFloat(LimitVelocityOverLifetimeModule.
|
|
39682
|
-
modeMacro = LimitVelocityOverLifetimeModule.
|
|
39683
|
-
if (
|
|
39684
|
-
shaderData.setFloat(LimitVelocityOverLifetimeModule.
|
|
39685
|
-
randomMacro = LimitVelocityOverLifetimeModule.
|
|
39673
|
+
shaderData.setFloat(LimitVelocityOverLifetimeModule._speedMaxConstProperty, speedX.constantMax);
|
|
39674
|
+
modeMacro = LimitVelocityOverLifetimeModule._speedConstantModeMacro;
|
|
39675
|
+
if (speedX.mode === ParticleCurveMode.TwoConstants) {
|
|
39676
|
+
shaderData.setFloat(LimitVelocityOverLifetimeModule._speedMinConstProperty, speedX.constantMin);
|
|
39677
|
+
randomMacro = LimitVelocityOverLifetimeModule._speedIsRandomMacro;
|
|
39686
39678
|
}
|
|
39687
39679
|
}
|
|
39688
39680
|
return {
|
|
@@ -39690,34 +39682,34 @@
|
|
|
39690
39682
|
randomMacro: randomMacro
|
|
39691
39683
|
};
|
|
39692
39684
|
};
|
|
39693
|
-
_proto.
|
|
39694
|
-
var
|
|
39695
|
-
var
|
|
39696
|
-
var
|
|
39685
|
+
_proto._uploadSeparateAxisSpeeds = function _uploadSeparateAxisSpeeds(shaderData) {
|
|
39686
|
+
var speedX = this._speedX;
|
|
39687
|
+
var speedY = this._speedY;
|
|
39688
|
+
var speedZ = this._speedZ;
|
|
39697
39689
|
var modeMacro = null;
|
|
39698
39690
|
var randomMacro = null;
|
|
39699
|
-
var isRandomCurveMode =
|
|
39700
|
-
if (isRandomCurveMode ||
|
|
39701
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39702
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39703
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39704
|
-
modeMacro = LimitVelocityOverLifetimeModule.
|
|
39691
|
+
var isRandomCurveMode = speedX.mode === ParticleCurveMode.TwoCurves && speedY.mode === ParticleCurveMode.TwoCurves && speedZ.mode === ParticleCurveMode.TwoCurves;
|
|
39692
|
+
if (isRandomCurveMode || speedX.mode === ParticleCurveMode.Curve && speedY.mode === ParticleCurveMode.Curve && speedZ.mode === ParticleCurveMode.Curve) {
|
|
39693
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedXMaxCurveProperty, speedX.curveMax._getTypeArray());
|
|
39694
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedYMaxCurveProperty, speedY.curveMax._getTypeArray());
|
|
39695
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedZMaxCurveProperty, speedZ.curveMax._getTypeArray());
|
|
39696
|
+
modeMacro = LimitVelocityOverLifetimeModule._speedCurveModeMacro;
|
|
39705
39697
|
if (isRandomCurveMode) {
|
|
39706
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39707
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39708
|
-
shaderData.setFloatArray(LimitVelocityOverLifetimeModule.
|
|
39709
|
-
randomMacro = LimitVelocityOverLifetimeModule.
|
|
39698
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedXMinCurveProperty, speedX.curveMin._getTypeArray());
|
|
39699
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedYMinCurveProperty, speedY.curveMin._getTypeArray());
|
|
39700
|
+
shaderData.setFloatArray(LimitVelocityOverLifetimeModule._speedZMinCurveProperty, speedZ.curveMin._getTypeArray());
|
|
39701
|
+
randomMacro = LimitVelocityOverLifetimeModule._speedIsRandomMacro;
|
|
39710
39702
|
}
|
|
39711
39703
|
} else {
|
|
39712
|
-
var constantMax = this.
|
|
39713
|
-
constantMax.set(
|
|
39714
|
-
shaderData.setVector3(LimitVelocityOverLifetimeModule.
|
|
39715
|
-
modeMacro = LimitVelocityOverLifetimeModule.
|
|
39716
|
-
if (
|
|
39717
|
-
var constantMin = this.
|
|
39718
|
-
constantMin.set(
|
|
39719
|
-
shaderData.setVector3(LimitVelocityOverLifetimeModule.
|
|
39720
|
-
randomMacro = LimitVelocityOverLifetimeModule.
|
|
39704
|
+
var constantMax = this._speedMaxConstantVec;
|
|
39705
|
+
constantMax.set(speedX.constantMax, speedY.constantMax, speedZ.constantMax);
|
|
39706
|
+
shaderData.setVector3(LimitVelocityOverLifetimeModule._speedMaxConstVecProperty, constantMax);
|
|
39707
|
+
modeMacro = LimitVelocityOverLifetimeModule._speedConstantModeMacro;
|
|
39708
|
+
if (speedX.mode === ParticleCurveMode.TwoConstants && speedY.mode === ParticleCurveMode.TwoConstants && speedZ.mode === ParticleCurveMode.TwoConstants) {
|
|
39709
|
+
var constantMin = this._speedMinConstantVec;
|
|
39710
|
+
constantMin.set(speedX.constantMin, speedY.constantMin, speedZ.constantMin);
|
|
39711
|
+
shaderData.setVector3(LimitVelocityOverLifetimeModule._speedMinConstVecProperty, constantMin);
|
|
39712
|
+
randomMacro = LimitVelocityOverLifetimeModule._speedIsRandomMacro;
|
|
39721
39713
|
}
|
|
39722
39714
|
}
|
|
39723
39715
|
return {
|
|
@@ -39767,57 +39759,57 @@
|
|
|
39767
39759
|
}
|
|
39768
39760
|
},
|
|
39769
39761
|
{
|
|
39770
|
-
key: "
|
|
39762
|
+
key: "speed",
|
|
39771
39763
|
get: /**
|
|
39772
39764
|
* Speed limit when separateAxes is false.
|
|
39773
39765
|
*/ function get() {
|
|
39774
|
-
return this.
|
|
39766
|
+
return this._speedX;
|
|
39775
39767
|
},
|
|
39776
39768
|
set: function set(value) {
|
|
39777
|
-
this.
|
|
39769
|
+
this.speedX = value;
|
|
39778
39770
|
}
|
|
39779
39771
|
},
|
|
39780
39772
|
{
|
|
39781
|
-
key: "
|
|
39773
|
+
key: "speedX",
|
|
39782
39774
|
get: /**
|
|
39783
39775
|
* Speed limit for the x-axis (or overall limit when separateAxes is false).
|
|
39784
39776
|
*/ function get() {
|
|
39785
|
-
return this.
|
|
39777
|
+
return this._speedX;
|
|
39786
39778
|
},
|
|
39787
39779
|
set: function set(value) {
|
|
39788
|
-
var lastValue = this.
|
|
39780
|
+
var lastValue = this._speedX;
|
|
39789
39781
|
if (value !== lastValue) {
|
|
39790
|
-
this.
|
|
39782
|
+
this._speedX = value;
|
|
39791
39783
|
this._onCompositeCurveChange(lastValue, value);
|
|
39792
39784
|
}
|
|
39793
39785
|
}
|
|
39794
39786
|
},
|
|
39795
39787
|
{
|
|
39796
|
-
key: "
|
|
39788
|
+
key: "speedY",
|
|
39797
39789
|
get: /**
|
|
39798
39790
|
* Speed limit for the y-axis.
|
|
39799
39791
|
*/ function get() {
|
|
39800
|
-
return this.
|
|
39792
|
+
return this._speedY;
|
|
39801
39793
|
},
|
|
39802
39794
|
set: function set(value) {
|
|
39803
|
-
var lastValue = this.
|
|
39795
|
+
var lastValue = this._speedY;
|
|
39804
39796
|
if (value !== lastValue) {
|
|
39805
|
-
this.
|
|
39797
|
+
this._speedY = value;
|
|
39806
39798
|
this._onCompositeCurveChange(lastValue, value);
|
|
39807
39799
|
}
|
|
39808
39800
|
}
|
|
39809
39801
|
},
|
|
39810
39802
|
{
|
|
39811
|
-
key: "
|
|
39803
|
+
key: "speedZ",
|
|
39812
39804
|
get: /**
|
|
39813
39805
|
* Speed limit for the z-axis.
|
|
39814
39806
|
*/ function get() {
|
|
39815
|
-
return this.
|
|
39807
|
+
return this._speedZ;
|
|
39816
39808
|
},
|
|
39817
39809
|
set: function set(value) {
|
|
39818
|
-
var lastValue = this.
|
|
39810
|
+
var lastValue = this._speedZ;
|
|
39819
39811
|
if (value !== lastValue) {
|
|
39820
|
-
this.
|
|
39812
|
+
this._speedZ = value;
|
|
39821
39813
|
this._onCompositeCurveChange(lastValue, value);
|
|
39822
39814
|
}
|
|
39823
39815
|
}
|
|
@@ -39885,6 +39877,7 @@
|
|
|
39885
39877
|
key: "space",
|
|
39886
39878
|
get: /**
|
|
39887
39879
|
* Specifies if the velocity limits are in local space or world space.
|
|
39880
|
+
* @remarks Only takes effect when 'separateAxes' is enabled.
|
|
39888
39881
|
*/ function get() {
|
|
39889
39882
|
return this._space;
|
|
39890
39883
|
},
|
|
@@ -39919,25 +39912,25 @@
|
|
|
39919
39912
|
}(ParticleGeneratorModule);
|
|
39920
39913
|
LimitVelocityOverLifetimeModule._enabledMacro = ShaderMacro.getByName("RENDERER_LVL_MODULE_ENABLED");
|
|
39921
39914
|
LimitVelocityOverLifetimeModule._separateAxesMacro = ShaderMacro.getByName("RENDERER_LVL_SEPARATE_AXES");
|
|
39922
|
-
LimitVelocityOverLifetimeModule.
|
|
39923
|
-
LimitVelocityOverLifetimeModule.
|
|
39924
|
-
LimitVelocityOverLifetimeModule.
|
|
39915
|
+
LimitVelocityOverLifetimeModule._speedConstantModeMacro = ShaderMacro.getByName("RENDERER_LVL_SPEED_CONSTANT_MODE");
|
|
39916
|
+
LimitVelocityOverLifetimeModule._speedCurveModeMacro = ShaderMacro.getByName("RENDERER_LVL_SPEED_CURVE_MODE");
|
|
39917
|
+
LimitVelocityOverLifetimeModule._speedIsRandomMacro = ShaderMacro.getByName("RENDERER_LVL_SPEED_IS_RANDOM_TWO");
|
|
39925
39918
|
LimitVelocityOverLifetimeModule._dragCurveModeMacro = ShaderMacro.getByName("RENDERER_LVL_DRAG_CURVE_MODE");
|
|
39926
39919
|
LimitVelocityOverLifetimeModule._dragIsRandomMacro = ShaderMacro.getByName("RENDERER_LVL_DRAG_IS_RANDOM_TWO");
|
|
39927
39920
|
LimitVelocityOverLifetimeModule._multiplyDragBySizeMacro = ShaderMacro.getByName("RENDERER_LVL_DRAG_MULTIPLY_SIZE");
|
|
39928
39921
|
LimitVelocityOverLifetimeModule._multiplyDragByVelocityMacro = ShaderMacro.getByName("RENDERER_LVL_DRAG_MULTIPLY_VELOCITY");
|
|
39929
|
-
LimitVelocityOverLifetimeModule.
|
|
39930
|
-
LimitVelocityOverLifetimeModule.
|
|
39931
|
-
LimitVelocityOverLifetimeModule.
|
|
39932
|
-
LimitVelocityOverLifetimeModule.
|
|
39933
|
-
LimitVelocityOverLifetimeModule.
|
|
39934
|
-
LimitVelocityOverLifetimeModule.
|
|
39935
|
-
LimitVelocityOverLifetimeModule.
|
|
39936
|
-
LimitVelocityOverLifetimeModule.
|
|
39937
|
-
LimitVelocityOverLifetimeModule.
|
|
39938
|
-
LimitVelocityOverLifetimeModule.
|
|
39939
|
-
LimitVelocityOverLifetimeModule.
|
|
39940
|
-
LimitVelocityOverLifetimeModule.
|
|
39922
|
+
LimitVelocityOverLifetimeModule._speedMaxConstProperty = ShaderProperty.getByName("renderer_LVLSpeedMaxConst");
|
|
39923
|
+
LimitVelocityOverLifetimeModule._speedMinConstProperty = ShaderProperty.getByName("renderer_LVLSpeedMinConst");
|
|
39924
|
+
LimitVelocityOverLifetimeModule._speedMaxCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedMaxCurve");
|
|
39925
|
+
LimitVelocityOverLifetimeModule._speedMinCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedMinCurve");
|
|
39926
|
+
LimitVelocityOverLifetimeModule._speedMaxConstVecProperty = ShaderProperty.getByName("renderer_LVLSpeedMaxConstVector");
|
|
39927
|
+
LimitVelocityOverLifetimeModule._speedMinConstVecProperty = ShaderProperty.getByName("renderer_LVLSpeedMinConstVector");
|
|
39928
|
+
LimitVelocityOverLifetimeModule._speedXMaxCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedXMaxCurve");
|
|
39929
|
+
LimitVelocityOverLifetimeModule._speedXMinCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedXMinCurve");
|
|
39930
|
+
LimitVelocityOverLifetimeModule._speedYMaxCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedYMaxCurve");
|
|
39931
|
+
LimitVelocityOverLifetimeModule._speedYMinCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedYMinCurve");
|
|
39932
|
+
LimitVelocityOverLifetimeModule._speedZMaxCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedZMaxCurve");
|
|
39933
|
+
LimitVelocityOverLifetimeModule._speedZMinCurveProperty = ShaderProperty.getByName("renderer_LVLSpeedZMinCurve");
|
|
39941
39934
|
LimitVelocityOverLifetimeModule._dampenProperty = ShaderProperty.getByName("renderer_LVLDampen");
|
|
39942
39935
|
LimitVelocityOverLifetimeModule._dragConstantProperty = ShaderProperty.getByName("renderer_LVLDragConstant");
|
|
39943
39936
|
LimitVelocityOverLifetimeModule._dragMaxCurveProperty = ShaderProperty.getByName("renderer_LVLDragMaxCurve");
|
|
@@ -39945,13 +39938,13 @@
|
|
|
39945
39938
|
LimitVelocityOverLifetimeModule._spaceProperty = ShaderProperty.getByName("renderer_LVLSpace");
|
|
39946
39939
|
__decorate$1([
|
|
39947
39940
|
ignoreClone
|
|
39948
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39941
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedRand", void 0);
|
|
39949
39942
|
__decorate$1([
|
|
39950
39943
|
ignoreClone
|
|
39951
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39944
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedMinConstantVec", void 0);
|
|
39952
39945
|
__decorate$1([
|
|
39953
39946
|
ignoreClone
|
|
39954
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39947
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedMaxConstantVec", void 0);
|
|
39955
39948
|
__decorate$1([
|
|
39956
39949
|
ignoreClone
|
|
39957
39950
|
], LimitVelocityOverLifetimeModule.prototype, "_dragConstantVec", void 0);
|
|
@@ -39963,10 +39956,10 @@
|
|
|
39963
39956
|
], LimitVelocityOverLifetimeModule.prototype, "_separateAxesCachedMacro", void 0);
|
|
39964
39957
|
__decorate$1([
|
|
39965
39958
|
ignoreClone
|
|
39966
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39959
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedModeMacro", void 0);
|
|
39967
39960
|
__decorate$1([
|
|
39968
39961
|
ignoreClone
|
|
39969
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39962
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedRandomMacro", void 0);
|
|
39970
39963
|
__decorate$1([
|
|
39971
39964
|
ignoreClone
|
|
39972
39965
|
], LimitVelocityOverLifetimeModule.prototype, "_dragCurveCachedMacro", void 0);
|
|
@@ -39981,13 +39974,13 @@
|
|
|
39981
39974
|
], LimitVelocityOverLifetimeModule.prototype, "_dragVelocityMacro", void 0);
|
|
39982
39975
|
__decorate$1([
|
|
39983
39976
|
deepClone
|
|
39984
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39977
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedX", void 0);
|
|
39985
39978
|
__decorate$1([
|
|
39986
39979
|
deepClone
|
|
39987
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39980
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedY", void 0);
|
|
39988
39981
|
__decorate$1([
|
|
39989
39982
|
deepClone
|
|
39990
|
-
], LimitVelocityOverLifetimeModule.prototype, "
|
|
39983
|
+
], LimitVelocityOverLifetimeModule.prototype, "_speedZ", void 0);
|
|
39991
39984
|
__decorate$1([
|
|
39992
39985
|
deepClone
|
|
39993
39986
|
], LimitVelocityOverLifetimeModule.prototype, "_drag", void 0);
|
|
@@ -41676,8 +41669,8 @@
|
|
|
41676
41669
|
instanceVertices[offset + 40] = rand1.random();
|
|
41677
41670
|
}
|
|
41678
41671
|
var limitVelocityOverLifetime = this.limitVelocityOverLifetime;
|
|
41679
|
-
if (limitVelocityOverLifetime.enabled && (limitVelocityOverLifetime.
|
|
41680
|
-
instanceVertices[offset + 41] = limitVelocityOverLifetime.
|
|
41672
|
+
if (limitVelocityOverLifetime.enabled && (limitVelocityOverLifetime._isSpeedRandomMode() || limitVelocityOverLifetime._isDragRandomMode())) {
|
|
41673
|
+
instanceVertices[offset + 41] = limitVelocityOverLifetime._speedRand.random();
|
|
41681
41674
|
}
|
|
41682
41675
|
// Initialize feedback buffer for this particle
|
|
41683
41676
|
if (this._useTransformFeedback) {
|
|
@@ -45849,7 +45842,9 @@
|
|
|
45849
45842
|
_proto._bindMainFBO = function _bindMainFBO() {
|
|
45850
45843
|
var gl = this._gl;
|
|
45851
45844
|
var isWebGL2 = this._isWebGL2;
|
|
45852
|
-
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount
|
|
45845
|
+
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount;
|
|
45846
|
+
_this__target.width;
|
|
45847
|
+
_this__target.height;
|
|
45853
45848
|
var drawBuffers = new Array(colorTextureCount);
|
|
45854
45849
|
gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
|
|
45855
45850
|
/** color render buffer */ for(var i = 0; i < colorTextureCount; i++){
|
|
@@ -45871,11 +45866,7 @@
|
|
|
45871
45866
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, platformTexture._formatDetail.attachment, gl.TEXTURE_2D, platformTexture._glTexture, 0);
|
|
45872
45867
|
} else if (this._target.antiAliasing <= 1) {
|
|
45873
45868
|
var _GLTexture__getRenderBufferDepthFormatDetail = GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2), internalFormat = _GLTexture__getRenderBufferDepthFormatDetail.internalFormat, attachment1 = _GLTexture__getRenderBufferDepthFormatDetail.attachment;
|
|
45874
|
-
|
|
45875
|
-
this._depthRenderBuffer = depthRenderBuffer;
|
|
45876
|
-
gl.bindRenderbuffer(gl.RENDERBUFFER, depthRenderBuffer);
|
|
45877
|
-
gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);
|
|
45878
|
-
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment1, gl.RENDERBUFFER, depthRenderBuffer);
|
|
45869
|
+
this._depthRenderBuffer = this._createRenderBuffer(internalFormat, attachment1);
|
|
45879
45870
|
}
|
|
45880
45871
|
}
|
|
45881
45872
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
@@ -45884,32 +45875,38 @@
|
|
|
45884
45875
|
_proto._bindMSAAFBO = function _bindMSAAFBO() {
|
|
45885
45876
|
var gl = this._gl;
|
|
45886
45877
|
var isWebGL2 = this._isWebGL2;
|
|
45887
|
-
var
|
|
45888
|
-
/** @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;
|
|
45878
|
+
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount;
|
|
45889
45879
|
this._blitDrawBuffers = new Array(colorTextureCount);
|
|
45890
|
-
this._MSAADepthRenderBuffer = MSAADepthRenderBuffer;
|
|
45891
45880
|
gl.bindFramebuffer(gl.FRAMEBUFFER, this._MSAAFrameBuffer);
|
|
45892
45881
|
// prepare MRT+MSAA color RBOs
|
|
45893
45882
|
for(var i = 0; i < colorTextureCount; i++){
|
|
45894
|
-
var MSAAColorRenderBuffer = gl.createRenderbuffer();
|
|
45895
|
-
this._MSAAColorRenderBuffers[i] = MSAAColorRenderBuffer;
|
|
45896
45883
|
this._blitDrawBuffers[i] = gl.NONE;
|
|
45897
|
-
|
|
45898
|
-
|
|
45899
|
-
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, gl.RENDERBUFFER, MSAAColorRenderBuffer);
|
|
45884
|
+
var internalFormat = /** @ts-ignore */ this._target.getColorTexture(i)._platformTexture._formatDetail.internalFormat;
|
|
45885
|
+
this._MSAAColorRenderBuffers[i] = this._createRenderBuffer(internalFormat, gl.COLOR_ATTACHMENT0 + i);
|
|
45900
45886
|
}
|
|
45901
45887
|
gl.drawBuffers(this._oriDrawBuffers);
|
|
45902
45888
|
// prepare MSAA depth RBO
|
|
45903
45889
|
if (_depth !== null) {
|
|
45904
|
-
var _ref = _instanceof1$1(_depth, Texture) ? /** @ts-ignore */ _depth._platformTexture._formatDetail : GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2),
|
|
45905
|
-
|
|
45906
|
-
gl.renderbufferStorageMultisample(gl.RENDERBUFFER, antiAliasing, internalFormat, width, height);
|
|
45907
|
-
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, MSAADepthRenderBuffer);
|
|
45890
|
+
var _ref = _instanceof1$1(_depth, Texture) ? /** @ts-ignore */ _depth._platformTexture._formatDetail : GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2), internalFormat1 = _ref.internalFormat, attachment = _ref.attachment;
|
|
45891
|
+
this._MSAADepthRenderBuffer = this._createRenderBuffer(internalFormat1, attachment);
|
|
45908
45892
|
}
|
|
45909
45893
|
this._checkFrameBuffer();
|
|
45910
45894
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
45911
45895
|
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
|
45912
45896
|
};
|
|
45897
|
+
_proto._createRenderBuffer = function _createRenderBuffer(internalFormat, attachment) {
|
|
45898
|
+
var gl = this._gl;
|
|
45899
|
+
var _this__target = this._target, width = _this__target.width, height = _this__target.height, antiAliasing = _this__target.antiAliasing;
|
|
45900
|
+
var renderBuffer = gl.createRenderbuffer();
|
|
45901
|
+
gl.bindRenderbuffer(gl.RENDERBUFFER, renderBuffer);
|
|
45902
|
+
if (antiAliasing > 1) {
|
|
45903
|
+
gl.renderbufferStorageMultisample(gl.RENDERBUFFER, antiAliasing, internalFormat, width, height);
|
|
45904
|
+
} else {
|
|
45905
|
+
gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);
|
|
45906
|
+
}
|
|
45907
|
+
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, renderBuffer);
|
|
45908
|
+
return renderBuffer;
|
|
45909
|
+
};
|
|
45913
45910
|
_proto._checkFrameBuffer = function _checkFrameBuffer() {
|
|
45914
45911
|
var gl = this._gl;
|
|
45915
45912
|
var e = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
|
|
@@ -54058,7 +54055,7 @@
|
|
|
54058
54055
|
], EXT_texture_webp);
|
|
54059
54056
|
|
|
54060
54057
|
//@ts-ignore
|
|
54061
|
-
var version = "2.0.0-alpha.
|
|
54058
|
+
var version = "2.0.0-alpha.19";
|
|
54062
54059
|
console.log("Galacean Engine Version: " + version);
|
|
54063
54060
|
for(var key in CoreObjects){
|
|
54064
54061
|
Loader.registerClass(key, CoreObjects[key]);
|