Skip to content

Instantly share code, notes, and snippets.

@wcandillon
Created February 8, 2018 09:22
Show Gist options
  • Save wcandillon/1abb7e0a191b0279cb783987fc5e3d76 to your computer and use it in GitHub Desktop.
Save wcandillon/1abb7e0a191b0279cb783987fc5e3d76 to your computer and use it in GitHub Desktop.
// @flow
import * as React from "react";
import {Shaders, Node} from "gl-react";
import resolveAssetSource from "react-native/Libraries/Image/resolveAssetSource";
const shaders = Shaders.create({
Brannan: {
frag: `...`
}
});
export default class Brannan extends React.PureComponent<{ on: boolean, children: React.Node }> {
render(): React.Node {
const {on, children: inputImageTexture} = this.props;
// If the filter is disabled, it's a passthrough
if (!on) {
return this.props.children;
}
return (
<Node
shader={shaders.Brannan}
uniforms={{
inputImageTexture,
inputImageTexture2: resolveAssetSource(require("./images/brannanProcess.png")),
}}
/>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment