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