UNPKG

1.93 kBTypeScriptView Raw
1import * as React from 'react';
2import { ComponentOrHandle, SurfaceCreateEvent, GLSnapshot, ExpoWebGLRenderingContext, SnapshotOptions, BaseGLViewProps } from './GLView.types';
3export declare type GLViewProps = {
4 /**
5 * Called when the OpenGL context is created, with the context object as a parameter. The context
6 * object has an API mirroring WebGL's WebGLRenderingContext.
7 */
8 onContextCreate(gl: ExpoWebGLRenderingContext): void;
9 /**
10 * [iOS only] Number of samples for Apple's built-in multisampling.
11 */
12 msaaSamples: number;
13 /**
14 * A ref callback for the native GLView
15 */
16 nativeRef_EXPERIMENTAL?(callback: ComponentOrHandle | null): any;
17} & BaseGLViewProps;
18/**
19 * A component that acts as an OpenGL render target
20 */
21export declare class GLView extends React.Component<GLViewProps> {
22 static NativeView: any;
23 static defaultProps: {
24 msaaSamples: number;
25 };
26 static createContextAsync(): Promise<ExpoWebGLRenderingContext>;
27 static destroyContextAsync(exgl?: ExpoWebGLRenderingContext | number): Promise<boolean>;
28 static takeSnapshotAsync(exgl?: ExpoWebGLRenderingContext | number, options?: SnapshotOptions): Promise<GLSnapshot>;
29 nativeRef: ComponentOrHandle;
30 exglCtxId?: number;
31 render(): JSX.Element;
32 _setNativeRef: (nativeRef: ComponentOrHandle) => void;
33 _onSurfaceCreate: ({ nativeEvent: { exglCtxId } }: SurfaceCreateEvent) => void;
34 startARSessionAsync(): Promise<any>;
35 createCameraTextureAsync(cameraRefOrHandle: ComponentOrHandle): Promise<WebGLTexture>;
36 destroyObjectAsync(glObject: WebGLObject): Promise<boolean>;
37 takeSnapshotAsync(options?: SnapshotOptions): Promise<GLSnapshot>;
38}
39declare type WebGLObjectId = any;
40export declare class WebGLObject {
41 id: WebGLObjectId;
42 constructor(id: WebGLObjectId);
43 toString(): string;
44}
45declare class WebGLTexture extends WebGLObject {
46}
47export {};