playcanvas
Version:
PlayCanvas WebGL game engine
3 lines (2 loc) • 803 B
TypeScript
declare const _default: "\nvar sh_centroids: texture_2d<f32>;\n\nuniform shN_mins: f32;\nuniform shN_maxs: f32;\n\nfn readSHData(source: ptr<function, SplatSource>, sh: ptr<function, array<vec3f, SH_COEFFS>>, scale: ptr<function, f32>) {\n // extract spherical harmonics palette index\n let t: vec2<i32> = vec2<i32>(i32(packedSample.x & 255u), i32(packedSample.y & 255u));\n let n: i32 = t.x + t.y * 256;\n let u: i32 = (n % 64) * SH_COEFFS;\n let v: i32 = n / 64;\n\n // calculate offset into the centroids texture and read consecutive texels\n for (var i: i32 = 0; i < SH_COEFFS; i = i + 1) {\n sh[i] = mix(vec3f(uniform.shN_mins), vec3f(uniform.shN_maxs), textureLoad(sh_centroids, vec2<i32>(u + i, v), 0).xyz);\n }\n\n *scale = 1.0;\n}\n";
export default _default;