playcanvas
Version:
PlayCanvas WebGL game engine
3 lines (2 loc) • 1.73 kB
TypeScript
declare const _default: "\nuniform highp usampler2D splatTexture0;\nuniform highp usampler2D splatTexture1;\n\n#ifdef GSPLAT_COLOR_UINT\n uniform highp usampler2D splatColor;\n#else\n uniform mediump sampler2D splatColor;\n#endif\n\n// cached texture fetches\nuvec4 cachedSplatTexture0Data;\nuvec2 cachedSplatTexture1Data;\n\n// load splat textures into globals to avoid redundant fetches\nvoid loadSplatTextures(SplatSource source) {\n cachedSplatTexture0Data = texelFetch(splatTexture0, source.uv, 0);\n cachedSplatTexture1Data = texelFetch(splatTexture1, source.uv, 0).xy;\n}\n\n// read the model-space center of the gaussian\nvec3 readCenter(SplatSource source) {\n return vec3(uintBitsToFloat(cachedSplatTexture0Data.r), uintBitsToFloat(cachedSplatTexture0Data.g), uintBitsToFloat(cachedSplatTexture0Data.b));\n}\n\n// sample covariance vectors\nvoid readCovariance(in SplatSource source, out vec3 cov_A, out vec3 cov_B) {\n vec2 covAxy = unpackHalf2x16(cachedSplatTexture1Data.x);\n vec2 covBxy = unpackHalf2x16(cachedSplatTexture1Data.y);\n vec2 covAzBz = unpackHalf2x16(cachedSplatTexture0Data.a);\n cov_A = vec3(covAxy, covAzBz.x);\n cov_B = vec3(covBxy, covAzBz.y);\n}\n\nvec4 readColor(in SplatSource source) {\n #ifdef GSPLAT_COLOR_UINT\n // Unpack RGBA from 4x half-float (16-bit) values stored in RGBA16U format\n uvec4 packed = texelFetch(splatColor, source.uv, 0);\n uint packed_rg = packed.r | (packed.g << 16u);\n uint packed_ba = packed.b | (packed.a << 16u);\n return vec4(unpackHalf2x16(packed_rg), unpackHalf2x16(packed_ba));\n #else\n return texelFetch(splatColor, source.uv, 0);\n #endif\n}\n";
export default _default;