/** * Hexagonal Pixelate * Renders the image using a pattern of hexagonal tiles. * Tile colors are nearest-neighbor sampled from the centers of the tiles. */ export type HexagonalPixelateProps = { /** The [x, y] coordinates of the pattern center. */ center?: [number, number]; /** The width of an individual tile, in pixels. */ scale?: number; }; export type HexagonalPixelateUniforms = HexagonalPixelateProps; /** * Hexagonal Pixelate * Renders the image using a pattern of hexagonal tiles. Tile colors * are nearest-neighbor sampled from the centers of the tiles. */ export declare const hexagonalPixelate: { readonly name: "hexagonalPixelate"; readonly source: "struct hexagonalPixelateUniforms {\n center: vec2f,\n scale: f32,\n};\n\n@group(0) @binding(auto) var hexagonalPixelate: hexagonalPixelateUniforms;\n\nfn hexagonalPixelate_sampleColor(\n sourceTexture: texture_2d,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n var tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;\n tex.y /= 0.866025404;\n tex.x -= tex.y * 0.5;\n\n var a = vec2f(0.0);\n if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {\n a = vec2f(floor(tex.x), floor(tex.y));\n } else {\n a = vec2f(ceil(tex.x), ceil(tex.y));\n }\n let b = vec2f(ceil(tex.x), floor(tex.y));\n let c = vec2f(floor(tex.x), ceil(tex.y));\n\n let texBarycentric = vec3f(tex.x, tex.y, 1.0 - tex.x - tex.y);\n let aBarycentric = vec3f(a.x, a.y, 1.0 - a.x - a.y);\n let bBarycentric = vec3f(b.x, b.y, 1.0 - b.x - b.y);\n let cBarycentric = vec3f(c.x, c.y, 1.0 - c.x - c.y);\n\n let aLength = length(texBarycentric - aBarycentric);\n let bLength = length(texBarycentric - bBarycentric);\n let cLength = length(texBarycentric - cBarycentric);\n\n var choice = vec2f(0.0);\n if (aLength < bLength) {\n if (aLength < cLength) {\n choice = a;\n } else {\n choice = c;\n }\n } else {\n if (bLength < cLength) {\n choice = b;\n } else {\n choice = c;\n }\n }\n\n choice.x += choice.y * 0.5;\n choice.y *= 0.866025404;\n choice *= hexagonalPixelate.scale / texSize;\n\n return textureSample(sourceTexture, sourceTextureSampler, choice + hexagonalPixelate.center);\n}\n"; readonly fs: "layout(std140) uniform hexagonalPixelateUniforms {\n vec2 center;\n float scale;\n} hexagonalPixelate;\n\nvec4 hexagonalPixelate_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;\n tex.y /= 0.866025404;\n tex.x -= tex.y * 0.5;\n\n vec2 a;\n if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {\n a = vec2(floor(tex.x), floor(tex.y));\n }\n else a = vec2(ceil(tex.x), ceil(tex.y));\n vec2 b = vec2(ceil(tex.x), floor(tex.y));\n vec2 c = vec2(floor(tex.x), ceil(tex.y));\n\n vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);\n vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);\n vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);\n vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);\n\n float alen = length(TEX - A);\n float blen = length(TEX - B);\n float clen = length(TEX - C);\n\n vec2 choice;\n if (alen < blen) {\n if (alen < clen) choice = a;\n else choice = c;\n } else {\n if (blen < clen) choice = b;\n else choice = c;\n }\n\n choice.x += choice.y * 0.5;\n choice.y *= 0.866025404;\n choice *= hexagonalPixelate.scale / texSize;\n\n return texture(source, choice + hexagonalPixelate.center);\n}\n"; readonly props: HexagonalPixelateProps; readonly uniforms: HexagonalPixelateUniforms; readonly uniformTypes: { readonly center: "vec2"; readonly scale: "f32"; }; readonly propTypes: { readonly center: { readonly value: readonly [0.5, 0.5]; readonly hint: "screenspace"; }; readonly scale: { readonly value: 10; readonly min: 1; readonly softMin: 5; readonly softMax: 50; }; }; readonly passes: [{ readonly sampler: true; }]; }; //# sourceMappingURL=hexagonalpixelate.d.ts.map