UNPKG

2.39 kBTypeScriptView Raw
1import { Component, ComponentClass } from 'react';
2import { ViewProps } from 'react-native';
3import WebGL2RenderingContext from './WebGL2RenderingContext';
4export declare type SurfaceCreateEvent = {
5 nativeEvent: {
6 exglCtxId: number;
7 };
8};
9export declare type SnapshotOptions = {
10 flip?: boolean;
11 framebuffer?: WebGLFramebuffer;
12 rect?: {
13 x: number;
14 y: number;
15 width: number;
16 height: number;
17 };
18 format?: 'jpeg' | 'png';
19 compress?: number;
20};
21export declare type GLSnapshot = {
22 uri: string | Blob | null;
23 localUri: string;
24 width: number;
25 height: number;
26};
27export interface ExpoWebGLRenderingContext extends WebGL2RenderingContext {
28 __exglCtxId: number;
29 endFrameEXP(): void;
30 __expoSetLogging(option: GLLoggingOption): void;
31}
32export declare type ComponentOrHandle = null | number | Component<any, any> | ComponentClass<any>;
33/**
34 *
35 * A View that acts as an OpenGL ES render target. On mounting, an OpenGL ES
36 * context is created. Its drawing buffer is presented as the contents of
37 * the View every frame.
38 */
39export interface BaseGLViewProps extends ViewProps {
40 /**
41 * Called when the OpenGL context is created, with the context object as a parameter. The context
42 * object has an API mirroring WebGL's WebGLRenderingContext.
43 */
44 onContextCreate(gl: ExpoWebGLRenderingContext): void;
45 /**
46 * [iOS only] Number of samples for Apple's built-in multisampling.
47 */
48 msaaSamples?: number;
49}
50export declare enum GLLoggingOption {
51 /**
52 * Disables logging entirely.
53 */
54 DISABLED = 0,
55 /**
56 * Logs method calls, their parameters and results.
57 */
58 METHOD_CALLS = 1,
59 /**
60 * Calls `gl.getError()` after each other method call and prints an error if any is returned.
61 * This option has a significant impact on the performance as this method is blocking.
62 */
63 GET_ERRORS = 2,
64 /**
65 * Resolves parameters of type `number` to their constant names.
66 */
67 RESOLVE_CONSTANTS = 4,
68 /**
69 * When this option is enabled, long strings will be truncated.
70 * It's useful if your shaders are really big and logging them significantly reduces performance.
71 */
72 TRUNCATE_STRINGS = 8,
73 /**
74 * Enables all other options. It implies `GET_ERRORS` so be aware of the slowdown.
75 */
76 ALL = 15
77}