playcanvas
Version:
PlayCanvas WebGL game engine
20 lines (18 loc) • 654 B
JavaScript
var particleUpdaterSpherePS = `
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 { particleUpdaterSpherePS as default };