@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
26 lines (22 loc) • 848 B
JavaScript
var particleUpdaterHemispherePS = /* 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);
vec3 norm = normalize(inBounds.xyz - vec3(0.5));
norm.z = abs(norm.z);
float r = rnd4 * (1.0 - spawnBoundsSphereInnerRatio) + spawnBoundsSphereInnerRatio;
return emitterPos + spawnBounds * norm * r * spawnBoundsSphere;
return spawnBounds * norm * r * spawnBoundsSphere;
}
void addInitialVelocity(inout vec3 localVelocity, vec3 inBounds) {
localVelocity += normalize(inBounds - vec3(0.5)) * initialVelocity;
}
`;
export { particleUpdaterHemispherePS as default };