playcanvas
Version:
PlayCanvas WebGL game engine
21 lines (19 loc) • 648 B
JavaScript
var gsplatSourceVS = `
attribute vertex_position: vec3f;
attribute vertex_id_attrib: u32;
uniform numSplats: u32;
var splatOrder: texture_2d<u32>;
fn initSource(source: ptr<function, SplatSource>) -> bool {
let w: u32 = textureDimensions(splatOrder, 0).x;
source.order = vertex_id_attrib + u32(vertex_position.z);
if (source.order >= uniform.numSplats) {
return false;
}
let orderUV = vec2i(vec2u(source.order % w, source.order / w));
source.id = textureLoad(splatOrder, orderUV, 0).r;
source.uv = vec2i(vec2u(source.id % w, source.id / w));
source.cornerUV = vertex_position.xy;
return true;
}
`;
export { gsplatSourceVS as default };