Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "tex/index-uv"

Index

Variables

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))))),])

Converts linearized 2D index i into a vec2 UV coord, based on given texture size (in pixels).

param

-

param

-

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)))))),])

Inverse operation of indexToUV. Converts vec2 UV coord into linearized 2D index, based on given texture width (in pixels).

param

-

param

-

Generated using TypeDoc