Const indexToUV
indexToUV: TaggedFn2<"int", "ivec2", "vec2"> = defn("vec2","indexToUV",[["int", "i", { prec: "highp" }], ["ivec2"]],(i, size) => [ret(vec2(div(float(modi(i, $x(size))), float($x(size))),div(float(div(i, $x(size))), float($y(size))))),])
Const uvToIndex
uvToIndex: TaggedFn2<"vec2", "int", "int"> = defn("int","uvToIndex",["vec2", ["int", "width", { prec: "highp" }]],(uv, width) => [ret(add(int(mul($x(uv), float(width))),int(mul($y(uv), float(mul(width, width)))))),])
Converts linearized 2D index
i
into a vec2 UV coord, based on given texturesize
(in pixels).-
-