gpu-curtains
Version:
gpu-curtains is a 3D WebGPU rendering engine. It can be used as a standalone 3D engine, but also includes extra classes focused on mapping 3d objects to DOM elements; It allows users to synchronize values such as position, sizing, or scale between them.
18 lines (15 loc) • 323 B
JavaScript
const getVertexToUVCoords = (
/* wgsl */
`
fn getVertex2DToUVCoords(vertex: vec2f) -> vec2f {
return vec2(
vertex.x * 0.5 + 0.5,
0.5 - vertex.y * 0.5
);
}
fn getVertex3DToUVCoords(vertex: vec3f) -> vec2f {
return getVertex2DToUVCoords( vec2(vertex.x, vertex.y) );
}
`
);
export { getVertexToUVCoords };