playcanvas
Version:
PlayCanvas WebGL game engine
3 lines (2 loc) • 1.36 kB
TypeScript
declare const _default: "\nvar splatTexture0: texture_2d<u32>;\nvar splatTexture1: texture_2d<u32>;\nvar splatColor: texture_2d<uff>;\n\n// cached texture fetches\nvar<private> cachedSplatTexture0Data: vec4u;\nvar<private> cachedSplatTexture1Data: vec2u;\n\n// load splat textures into globals to avoid redundant fetches\nfn loadSplatTextures(source: ptr<function, SplatSource>) {\n cachedSplatTexture0Data = textureLoad(splatTexture0, source.uv, 0);\n cachedSplatTexture1Data = textureLoad(splatTexture1, source.uv, 0).xy;\n}\n\n// read the model-space center of the gaussian\nfn readCenter(source: ptr<function, SplatSource>) -> vec3f {\n return vec3f(bitcast<f32>(cachedSplatTexture0Data.r), bitcast<f32>(cachedSplatTexture0Data.g), bitcast<f32>(cachedSplatTexture0Data.b));\n}\n\n// sample covariance vectors\nfn readCovariance(source: ptr<function, SplatSource>, cov_A: ptr<function, vec3f>, cov_B: ptr<function, vec3f>) {\n let covAxy = unpack2x16float(cachedSplatTexture1Data.x);\n let covBxy = unpack2x16float(cachedSplatTexture1Data.y);\n let covAzBz = unpack2x16float(cachedSplatTexture0Data.a);\n *cov_A = vec3f(covAxy, covAzBz.x);\n *cov_B = vec3f(covBxy, covAzBz.y);\n}\n\nfn readColor(source: ptr<function, SplatSource>) -> vec4f {\n return textureLoad(splatColor, source.uv, 0);\n} \n";
export default _default;