playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
22 lines (21 loc) • 654 B
JavaScript
var uv0_default = `
fn getUv0() -> vec2f {
var uv = vertex_position.xz;
let positiveUnitOffset = clamp(vertex_position.xz, vec2f(0.0, 0.0), vec2f(1.0, 1.0));
let negativeUnitOffset = clamp(-vertex_position.xz, vec2f(0.0, 0.0), vec2f(1.0, 1.0));
uv = uv + ((-positiveUnitOffset * uniform.innerOffset.xy) + (negativeUnitOffset * uniform.innerOffset.zw)) * vertex_texCoord0.xy;
uv = uv * -0.5 + vec2f(0.5, 0.5);
uv = uv * uniform.atlasRect.zw + uniform.atlasRect.xy;
dMaskGlobal = vertex_texCoord0.xy;
return uv;
}
fn getUv0() -> vec2f {
return vertex_texCoord0;
}
`;
export {
uv0_default as default
};