UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

3 lines (2 loc) 1.08 kB
declare const _default: "\nattribute vec3 vertex_position; // xy: cornerUV, z: render order offset within instance\n\nuniform uint numSplats; // total number of splats\nuniform highp usampler2D splatOrder; // per-splat index to source gaussian\n\n// initialize the splat source structure and global splat\nbool initSource(out SplatSource source) {\n // calculate splat order from instance index and vertex position offset\n source.order = uint(gl_InstanceID) * {GSPLAT_INSTANCE_SIZE}u + uint(vertex_position.z);\n\n // return if out of range (since the last block of splats may be partially full)\n if (source.order >= numSplats) {\n return false;\n }\n\n ivec2 orderUV = ivec2(source.order % splatTextureSize, source.order / splatTextureSize);\n\n // read splat id and initialize global splat for format read functions\n uint splatId = texelFetch(splatOrder, orderUV, 0).r;\n setSplat(splatId);\n\n // get the corner\n source.cornerUV = vertex_position.xy;\n\n return true;\n}\n"; export default _default;