gl-react
Version:
Universal React library, write and compose WebGL shaders, implement complex effects using a descriptive paradigm
58 lines • 1.82 kB
TypeScript
import React, { Component } from "react";
import Node from "./Node";
import type { Surface } from "./createSurface";
import type { NDArray } from "ndarray";
type Props = {
children?: React.ReactElement | ((redraw?: () => void) => React.ReactElement);
uniform?: string;
index: number;
};
/**
* a **Bus is a container to "cache" and re-use content** (tree of Node, canvas, video,...) somewhere else in your GL graph.
*/
export default class Bus extends Component<Props, any> {
id: number;
static contextType: React.Context<{
glParent: any;
glSurface: any;
glSizable: any;
}>;
context: {
glParent: any;
glSurface: any;
glSizable: any;
};
dependents: Array<Node | Surface>;
static defaultProps: {
index: number;
};
componentDidMount(): void;
componentWillUnmount(): void;
componentDidUpdate(prevProps: any): void;
glNode: Node | null;
_addGLNodeChild(node: Node): void;
_removeGLNodeChild(node: Node): void;
_addDependent(node: Node | Surface): void;
_removeDependent(node: Node | Surface): void;
getGLRenderableNode(): Node | null;
getGLRenderableContent(): any;
getGLName(): string;
getGLShortName(): string;
/**
* Capture the underlying Node pixels.
* NB it only works for nodes, not for content like video/canvas.
*/
capture(x?: number, y?: number, w?: number, h?: number): NDArray;
glBusRootNode: any;
onRef: (ref: any) => void;
/**
* Schedule a redraw of all nodes that depends on this Bus.
*/
redraw: () => void;
_onContextLost(): void;
_onContextRestored(gl: WebGLRenderingContext): void;
_draw: () => void;
render(): import("react/jsx-runtime").JSX.Element;
}
export {};
//# sourceMappingURL=Bus.d.ts.map