playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
38 lines (29 loc) • 896 B
JavaScript
// Uncompressed GSplat format - work variables, helpers, and read functions
// Texture declarations and load functions are auto-generated from GSplatFormat streams
var gsplatUncompressedVS = /* glsl */ `
// work values
uint tAw;
vec4 tBcached;
vec4 unpackRotation(vec3 packed) {
return vec4(packed.xyz, sqrt(max(0.0, 1.0 - dot(packed, packed))));
}
// read the model-space center of the gaussian
vec3 getCenter() {
// read transform data using generated load functions (use global splat.uv)
uvec4 tA = loadTransformA();
tAw = tA.w;
tBcached = loadTransformB();
return uintBitsToFloat(tA.xyz);
}
vec4 getColor() {
return loadSplatColor();
}
vec4 getRotation() {
return unpackRotation(vec3(unpackHalf2x16(tAw), tBcached.w)).wxyz;
}
vec3 getScale() {
return tBcached.xyz;
}
`;
export { gsplatUncompressedVS as default };