mirror of
https://github.com/gre/gl-react.git
synced 2026-01-18 16:16:59 +00:00
28 lines
628 B
JavaScript
28 lines
628 B
JavaScript
const React = require("react");
|
|
const GL = require("gl-react");
|
|
const glslify = require("glslify");
|
|
|
|
const shaders = GL.Shaders.create({
|
|
blur1D: {
|
|
frag: glslify(`${__dirname}/blur1D.frag`)
|
|
}
|
|
});
|
|
|
|
module.exports = GL.createComponent(
|
|
({ width, height, direction, minBlur, maxBlur, blurMap, offset, children }) =>
|
|
<GL.View
|
|
shader={shaders.blur1D}
|
|
width={width}
|
|
height={height}
|
|
uniforms={{
|
|
direction,
|
|
minBlur,
|
|
maxBlur,
|
|
blurMap,
|
|
offset,
|
|
resolution: [ width, height ]
|
|
}}>
|
|
<GL.Uniform name="t">{children}</GL.Uniform>
|
|
</GL.View>,
|
|
{ displayName: "Blur1D" });
|