import '../../../assert/js/assert.js';
import '../../../globals.js';
/**
 * An abstract node (should be subtyped) that is drawn by user-provided custom WebGL code.
 *
 * The region that can be drawn in is handled manually, by controlling the canvasBounds property of this WebGLNode.
 * Any regions outside of the canvasBounds will not be guaranteed to be drawn. This can be set with canvasBounds in the
 * constructor, or later with node.canvasBounds = bounds or setCanvasBounds( bounds ).
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 * @author Sam Reid (PhET Interactive Simulations)
 */
import Bounds2 from '../../../dot/js/Bounds2.js';
import Matrix3 from '../../../dot/js/Matrix3.js';
import Vector2 from '../../../dot/js/Vector2.js';
import { Shape } from '../../../kite/js/imports.js';
import { CanvasContextWrapper, Instance, Node, NodeOptions, WebGLSelfDrawable } from '../imports.js';
type SelfOptions = {
    canvasBounds?: Bounds2;
};
export type WebGLNodeOptions = SelfOptions & NodeOptions;
export type WebGLNodePainterResult = 0 | 1;
export type WebGLNodePainter = {
    paint: (modelViewMatrix: Matrix3, projectionMatrix: Matrix3) => WebGLNodePainterResult;
    dispose: () => void;
};
type WebGLNodePainterType = new (gl: WebGLRenderingContext, node: never) => WebGLNodePainter;
export default abstract class WebGLNode extends Node {
    private painterType;
    /**
     *
     * It is required to pass a canvasBounds option and/or keep canvasBounds such that it will cover the entirety of the
     * Node. This will also set its self bounds.
     *
     * A "Painter" type should be passed to the constructor. It will be responsible for creating individual "painters"
     * that are used with different WebGL contexts to paint. This is helpful, since each context will need to have its
     * own buffers/textures/etc.
     *
     * painterType will be called with new painterType( gl, node ). Should contain the following methods:
     *
     * paint( modelViewMatrix, projectionMatrix )
     *   {Matrix3} modelViewMatrix - Transforms from the node's local coordinate frame to Scenery's global coordinate
     *                               frame.
     *   {Matrix3} projectionMatrix - Transforms from the global coordinate frame to normalized device coordinates.
     *   Returns either WebGLNode.PAINTED_NOTHING or WebGLNode.PAINTED_SOMETHING.
     * dispose()
     *
     * NOTE: If any alpha values are non-1, please note that Scenery's canvases uses blending/settings for premultiplied
     * alpha. This means that if you want a color to look like (r,g,b,a), the value passed to gl_FragColor should be
     * (r/a,g/a,b/a,a).
     *
     * @param painterType - The type (constructor) for the painters that will be used for this node.
     * @param [options] - WebGLNode-specific options are documented in LINE_OPTION_KEYS above, and can be
     *                    provided along-side options for Node
     */
    constructor(painterType: WebGLNodePainterType, options?: WebGLNodeOptions);
    /**
     * Sets the bounds that are used for layout/repainting.
     *
     * These bounds should always cover at least the area where the WebGLNode will draw in. If this is violated, this
     * node may be partially or completely invisible in Scenery's output.
     */
    setCanvasBounds(selfBounds: Bounds2): this;
    set canvasBounds(value: Bounds2);
    get canvasBounds(): Bounds2;
    /**
     * Returns the previously-set canvasBounds, or Bounds2.NOTHING if it has not been set yet.
     */
    getCanvasBounds(): Bounds2;
    /**
     * Whether this Node itself is painted (displays something itself).
     */
    isPainted(): boolean;
    /**
     * Should be called when this node needs to be repainted. When not called, Scenery assumes that this node does
     * NOT need to be repainted (although Scenery may repaint it due to other nodes needing to be repainted).
     *
     * This sets a "dirty" flag, so that it will be repainted the next time it would be displayed.
     */
    invalidatePaint(): void;
    /**
     * Computes whether the provided point is "inside" (contained) in this Node's self content, or "outside".
     *
     * If WebGLNode subtypes want to support being picked or hit-tested, it should override this function.
     *
     * @param point - Considered to be in the local coordinate frame
     */
    containsPointSelf(point: Vector2): boolean;
    /**
     * Returns a Shape that represents the area covered by containsPointSelf.
     */
    getSelfShape(): Shape;
    /**
     * Draws the current Node's self representation, assuming the wrapper's Canvas context is already in the local
     * coordinate frame of this node. (scenery-internal)
     *
     * @param wrapper
     * @param matrix - The transformation matrix already applied to the context.
     */
    protected canvasPaintSelf(wrapper: CanvasContextWrapper, matrix: Matrix3): void;
    /**
     * Renders this Node only (its self) into the Canvas wrapper, in its local coordinate frame.
     *
     * @param wrapper
     * @param matrix - The current transformation matrix associated with the wrapper
     */
    renderToCanvasSelf(wrapper: CanvasContextWrapper, matrix: Matrix3): void;
    /**
     * Creates a WebGL drawable for this WebGLNode. (scenery-internal)
     *
     * @param renderer - In the bitmask format specified by Renderer, which may contain additional bit flags.
     * @param instance - Instance object that will be associated with the drawable
     */
    createWebGLDrawable(renderer: number, instance: Instance): WebGLSelfDrawable;
    mutate(options?: WebGLNodeOptions): this;
    static readonly PAINTED_NOTHING: 0;
    static readonly PAINTED_SOMETHING: 1;
}
export {};
//# sourceMappingURL=WebGLNode.d.ts.map