playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
21 lines (20 loc) • 666 B
JavaScript
var particleUpdaterSphere_default = `
uniform float spawnBoundsSphere;
uniform float spawnBoundsSphereInnerRatio;
vec3 calcSpawnPosition(vec3 inBounds, float rndFactor) {
float rnd4 = fract(rndFactor * 1000.0);
vec3 norm = normalize(inBounds.xyz - vec3(0.5));
float r = rnd4 * (1.0 - spawnBoundsSphereInnerRatio) + spawnBoundsSphereInnerRatio;
return emitterPos + norm * r * spawnBoundsSphere;
return norm * r * spawnBoundsSphere;
}
void addInitialVelocity(inout vec3 localVelocity, vec3 inBounds) {
localVelocity += normalize(inBounds - vec3(0.5)) * initialVelocity;
}
`;
export {
particleUpdaterSphere_default as default
};