playcanvas
Version:
PlayCanvas WebGL game engine
3 lines (2 loc) • 834 B
TypeScript
declare const _default: "\nuniform spawnBoundsSphere: f32;\nuniform spawnBoundsSphereInnerRatio: f32;\n\nfn calcSpawnPosition(inBounds: vec3f, rndFactor: f32) -> vec3f {\n let rnd4: f32 = fract(rndFactor * 1000.0);\n let norm: vec3f = normalize(inBounds.xyz - vec3f(0.5));\n let r: f32 = rnd4 * (1.0 - uniform.spawnBoundsSphereInnerRatio) + uniform.spawnBoundsSphereInnerRatio;\n\n #ifndef LOCAL_SPACE\n return uniform.emitterPos + norm * r * uniform.spawnBoundsSphere;\n #else\n return norm * r * uniform.spawnBoundsSphere;\n #endif\n}\n\nfn addInitialVelocity(localVelocity: ptr<function, vec3f>, inBounds: vec3f) {\n let initialVelOffset: vec3f = normalize(inBounds - vec3f(0.5)) * uniform.initialVelocity;\n *localVelocity = *localVelocity + initialVelOffset;\n}\n";
export default _default;