playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
19 lines (17 loc) • 561 B
JavaScript
var gsplatSourceVS = `
attribute vec3 vertex_position;
uniform uint numSplats;
uniform highp usampler2D splatOrder;
bool initSource(out SplatSource source) {
source.order = uint(gl_InstanceID) * {GSPLAT_INSTANCE_SIZE}u + uint(vertex_position.z);
if (source.order >= numSplats) {
return false;
}
ivec2 orderUV = ivec2(source.order % splatTextureSize, source.order / splatTextureSize);
uint splatId = texelFetch(splatOrder, orderUV, 0).r;
setSplat(splatId);
source.cornerUV = vertex_position.xy;
return true;
}
`;
export { gsplatSourceVS as default };