@luma.gl/effects
Version:
Post-processing effects for luma.gl
46 lines • 2.98 kB
TypeScript
/**
* Magnify - display a circle with magnify effect applied to surrounding the pixels given position
*/
export type MagnifyProps = {
/** x, y position in screen coords, both x and y is normalized and in range `[0, 1]`. `[0, 0]` is the up left corner, `[1, 1]` is the bottom right corner. Default value is `[0, 0]`. */
screenXY?: [number, number];
/** effect radius in pixels. Default value is `100`. */
radiusPixels?: number;
/** magnify level. Default value is `2`. */
zoom?: number;
/** border width of the effect circle, will not show border if value <= 0.0. Default value is `0`. */
borderWidthPixels?: number;
/** border color of the effect circle. Default value is `[255, 255, 255, 255]`. */
borderColor?: [number, number, number, number];
};
export type MagnifyUniforms = MagnifyProps;
/**
* Magnify - display a circle with magnify effect applied to surrounding the pixels given position
*/
export declare const magnify: {
readonly name: "magnify";
readonly source: "uniform magnifyUniforms {\n screenXY: vec2f;\n radiusPixels: f32;\n zoom: f32;\n borderWidthPixels: f32;\n borderColor: vec4f;\n};\n\n@group(0) @binding(1) var<uniform> magnify: magnifyUniforms;\n\nfn magnify_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {\n vec2 pos = vec2(magnify.screenXY.x, 1.0 - magnify.screenXY.y);\n float dist = distance(texCoord * texSize, pos * texSize);\n if (dist < magnify.radiusPixels) {\n return texture(source, (texCoord - pos) / magnify.zoom + pos);\n }\n\n if (dist <= magnify.radiusPixels + magnify.borderWidthPixels) {\n return magnify.borderColor;\n }\n return texture(source, texCoord);\n}\n";
readonly fs: "uniform magnifyUniforms {\n vec2 screenXY;\n float radiusPixels;\n float zoom;\n float borderWidthPixels;\n vec4 borderColor;\n} magnify;\n\nvec4 magnify_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 pos = vec2(magnify.screenXY.x, 1.0 - magnify.screenXY.y);\n float dist = distance(texCoord * texSize, pos * texSize);\n if (dist < magnify.radiusPixels) {\n return texture(source, (texCoord - pos) / magnify.zoom + pos);\n }\n\n if (dist <= magnify.radiusPixels + magnify.borderWidthPixels) {\n return magnify.borderColor;\n }\n return texture(source, texCoord);\n}\n";
readonly uniformTypes: {
readonly screenXY: "vec2<f32>";
readonly radiusPixels: "f32";
readonly zoom: "f32";
readonly borderWidthPixels: "f32";
readonly borderColor: "vec4<f32>";
};
readonly propTypes: {
readonly screenXY: {
readonly value: readonly [0, 0];
};
readonly radiusPixels: 200;
readonly zoom: 2;
readonly borderWidthPixels: 0;
readonly borderColor: {
readonly value: readonly [255, 255, 255, 255];
};
};
readonly passes: [{
readonly sampler: true;
}];
};
//# sourceMappingURL=magnify.d.ts.map