UNPKG

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.

17 lines (15 loc) 479 B
//#region src/core/shaders/chunks/fragment/head/get-vertex-to-UV-coords-helpers.ts /** Convert vertex position as `vec2f` or `vec3f` to uv coordinates `vec2f`. */ const getVertexToUVCoords = ` 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) ); } `; //#endregion export { getVertexToUVCoords };