@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
26 lines (22 loc) • 985 B
JavaScript
var particleUpdaterCylinderPS = /* glsl */`
uniform mat3 spawnBounds;
uniform float spawnBoundsSphere;
uniform float spawnBoundsSphereInnerRatio;
uniform float spawnBoundsLength;
uniform float spawnBoundsLengthInnerRatio;
vec3 calcSpawnPosition(vec3 inBounds, float rndFactor) {
float rnd4 = fract(rndFactor * 1000.0);
vec2 norm = normalize(inBounds.xy - vec2(0.5));
float r = rnd4 * (1.0 - spawnBoundsSphereInnerRatio) + spawnBoundsSphereInnerRatio;
float l = inBounds.z * (1.0 - spawnBoundsLengthInnerRatio) + spawnBoundsLengthInnerRatio;
return emitterPos + spawnBounds * vec3(norm * r * spawnBoundsSphere, (l - 0.5) * spawnBoundsLength);
return spawnBounds * vec3(norm * r * spawnBoundsSphere, (l - 0.5) * spawnBoundsLength);
}
void addInitialVelocity(inout vec3 localVelocity, vec3 inBounds) {
localVelocity += normalize(inBounds - vec3(0.5)) * initialVelocity;
}
`;
export { particleUpdaterCylinderPS as default };