@symbiote-native/gl 0.0.0-stage → 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -2
  3. package/build/angular/gl-view/index.d.ts +18 -0
  4. package/build/angular/gl-view/index.js +87 -0
  5. package/build/angular/index.d.ts +2 -0
  6. package/build/angular/index.js +3 -0
  7. package/build/core/constants.d.ts +4 -0
  8. package/build/core/constants.js +4 -0
  9. package/build/core/gl-context.d.ts +13 -0
  10. package/build/core/gl-context.js +54 -0
  11. package/build/core/gl-errors.d.ts +1 -0
  12. package/build/core/gl-errors.js +8 -0
  13. package/build/core/gl-utils.d.ts +5 -0
  14. package/build/core/gl-utils.js +84 -0
  15. package/build/core/gl-view.d.ts +16 -0
  16. package/build/core/gl-view.js +99 -0
  17. package/build/core/index.d.ts +6 -0
  18. package/build/core/index.js +5 -0
  19. package/build/core/native-module.d.ts +15 -0
  20. package/build/core/native-module.js +3 -0
  21. package/build/core/types.d.ts +75 -0
  22. package/build/core/types.js +13 -0
  23. package/build/core/worklet-context-manager.d.ts +6 -0
  24. package/build/core/worklet-context-manager.js +34 -0
  25. package/build/react/gl-view.d.ts +8 -0
  26. package/build/react/gl-view.js +6 -0
  27. package/build/react/index.d.ts +3 -0
  28. package/build/react/index.js +3 -0
  29. package/build/solid/gl-view.d.ts +13 -0
  30. package/build/solid/gl-view.js +4 -0
  31. package/build/solid/index.d.ts +2 -0
  32. package/build/solid/index.js +3 -0
  33. package/build/svelte/gl-view.svelte +19 -0
  34. package/build/svelte/gl-view.svelte.d.ts +9 -0
  35. package/build/svelte/index.d.ts +2 -0
  36. package/build/svelte/index.js +3 -0
  37. package/build/vue/gl-view.d.ts +2 -0
  38. package/build/vue/gl-view.js +4 -0
  39. package/build/vue/index.d.ts +2 -0
  40. package/build/vue/index.js +3 -0
  41. package/build-ngc/angular/gl-view/index.d.ts +21 -0
  42. package/build-ngc/angular/gl-view/index.js +46 -0
  43. package/build-ngc/angular/gl-view/index.js.map +1 -0
  44. package/build-ngc/angular/index.d.ts +2 -0
  45. package/build-ngc/angular/index.js +4 -0
  46. package/build-ngc/angular/index.js.map +1 -0
  47. package/build-ngc/core/constants.d.ts +4 -0
  48. package/build-ngc/core/constants.js +5 -0
  49. package/build-ngc/core/constants.js.map +1 -0
  50. package/build-ngc/core/gl-context.d.ts +13 -0
  51. package/build-ngc/core/gl-context.js +55 -0
  52. package/build-ngc/core/gl-context.js.map +1 -0
  53. package/build-ngc/core/gl-errors.d.ts +1 -0
  54. package/build-ngc/core/gl-errors.js +9 -0
  55. package/build-ngc/core/gl-errors.js.map +1 -0
  56. package/build-ngc/core/gl-utils.d.ts +5 -0
  57. package/build-ngc/core/gl-utils.js +85 -0
  58. package/build-ngc/core/gl-utils.js.map +1 -0
  59. package/build-ngc/core/gl-view.d.ts +16 -0
  60. package/build-ngc/core/gl-view.js +100 -0
  61. package/build-ngc/core/gl-view.js.map +1 -0
  62. package/build-ngc/core/index.d.ts +6 -0
  63. package/build-ngc/core/index.js +6 -0
  64. package/build-ngc/core/index.js.map +1 -0
  65. package/build-ngc/core/native-module.d.ts +15 -0
  66. package/build-ngc/core/native-module.js +4 -0
  67. package/build-ngc/core/native-module.js.map +1 -0
  68. package/build-ngc/core/types.d.ts +75 -0
  69. package/build-ngc/core/types.js +14 -0
  70. package/build-ngc/core/types.js.map +1 -0
  71. package/build-ngc/core/worklet-context-manager.d.ts +6 -0
  72. package/build-ngc/core/worklet-context-manager.js +35 -0
  73. package/build-ngc/core/worklet-context-manager.js.map +1 -0
  74. package/native-link.json +12 -0
  75. package/package.json +145 -3
  76. package/src/angular/gl-view/index.ts +50 -0
  77. package/src/angular/index.ts +4 -0
  78. package/src/core/constants.ts +6 -0
  79. package/src/core/gl-context.ts +74 -0
  80. package/src/core/gl-errors.ts +8 -0
  81. package/src/core/gl-utils.ts +97 -0
  82. package/src/core/gl-view.ts +143 -0
  83. package/src/core/index.ts +21 -0
  84. package/src/core/native-module.ts +18 -0
  85. package/src/core/types.ts +95 -0
  86. package/src/core/worklet-context-manager.ts +42 -0
  87. package/src/react/gl-view.ts +14 -0
  88. package/src/react/index.ts +5 -0
  89. package/src/solid/gl-view.ts +6 -0
  90. package/src/solid/index.ts +4 -0
  91. package/src/svelte/gl-view.svelte +19 -0
  92. package/src/svelte/index.ts +4 -0
  93. package/src/svelte/svelte-ambient.d.ts +3 -0
  94. package/src/svelte/svelte-compile.test-helper.ts +6 -0
  95. package/src/vue/gl-view.ts +5 -0
  96. package/src/vue/index.ts +4 -0
@@ -0,0 +1,8 @@
1
+ import type { ReactElement, Ref } from 'react';
2
+ import type { IGLViewHandle, IGLViewProps } from '../core';
3
+ export type IGLViewReactProps = IGLViewProps & {
4
+ ref?: Ref<IGLViewHandle>;
5
+ className?: string;
6
+ };
7
+ /** React twin of `expo-gl`'s `GLView` */
8
+ export declare function GLView({ ref, ...props }: IGLViewReactProps): ReactElement | null;
@@ -0,0 +1,6 @@
1
+ import { useNativeViewController } from '@symbiote-native/react';
2
+ import { createGLView } from '../core/index.js';
3
+ /** React twin of `expo-gl`'s `GLView` */
4
+ export function GLView({ ref, ...props }) {
5
+ return useNativeViewController(ref, createGLView, props);
6
+ }
@@ -0,0 +1,3 @@
1
+ export { GLView } from './gl-view';
2
+ export type { IGLViewReactProps } from './gl-view';
3
+ export * from '../core';
@@ -0,0 +1,3 @@
1
+ // @symbiote-native/gl/react: a GLView that gives a WebGL context to draw into, on a shared core
2
+ export { GLView } from './gl-view.js';
3
+ export * from '../core/index.js';
@@ -0,0 +1,13 @@
1
+ import type { IGLViewHandle } from '../core';
2
+ /** Solid twin of `expo-gl`'s `GLView`, `ref` gets the handle of the view */
3
+ export declare const GLView: (props: import("@symbiote-native/components").IAccessibilityProps & import("@symbiote-native/components").IAriaProps & import("@symbiote-native/components").IResponderProps & {
4
+ style?: import("@symbiote-native/engine").IStyleProp<import("@symbiote-native/engine").IViewStyle>;
5
+ testID?: string;
6
+ nativeID?: string;
7
+ onLayout?: (event: import("@symbiote-native/engine").ISymbioteEvent) => void;
8
+ onContextCreate(gl: import(".").IExpoWebGLRenderingContext): void;
9
+ msaaSamples?: number;
10
+ enableExperimentalWorkletSupport?: boolean;
11
+ } & {
12
+ ref?: ((handle: IGLViewHandle) => void) | undefined;
13
+ }) => import("@symbiote-native/engine").ISymbioteNode | null;
@@ -0,0 +1,4 @@
1
+ import { defineNativeViewComponent } from '@symbiote-native/solid';
2
+ import { createGLView } from '../core/index.js';
3
+ /** Solid twin of `expo-gl`'s `GLView`, `ref` gets the handle of the view */
4
+ export const GLView = defineNativeViewComponent(createGLView);
@@ -0,0 +1,2 @@
1
+ export { GLView } from './gl-view';
2
+ export * from '../core';
@@ -0,0 +1,3 @@
1
+ // @symbiote-native/gl/solid: a GLView that gives a WebGL context to draw into, on a shared core
2
+ export { GLView } from './gl-view.js';
3
+ export * from '../core/index.js';
@@ -0,0 +1,19 @@
1
+ <script lang="ts">
2
+ import DescriptorHost from '@symbiote-native/svelte/descriptor-host';
3
+ import { useNativeViewController } from '@symbiote-native/svelte/runes/use-native-view-controller';
4
+ import { createGLView } from '../core';
5
+ import type { IGLViewProps } from '../core';
6
+
7
+ const props: IGLViewProps = $props();
8
+ const view = useNativeViewController(createGLView, () => ({ ...props }));
9
+
10
+ // The functions of the view are instance members, `bind:this` reaches them
11
+ export const createCameraTextureAsync = view.handle.createCameraTextureAsync;
12
+ export const destroyObjectAsync = view.handle.destroyObjectAsync;
13
+ export const takeSnapshotAsync = view.handle.takeSnapshotAsync;
14
+ export const getContextId = (): number | undefined => view.handle.exglCtxId;
15
+ </script>
16
+
17
+ {#if view.descriptor}
18
+ <DescriptorHost descriptor={view.descriptor} />
19
+ {/if}
@@ -0,0 +1,9 @@
1
+ import type { IGLViewProps } from '../core';
2
+ declare const GlView: import("svelte").Component<IGLViewProps, {
3
+ createCameraTextureAsync: (camera: import(".").IGLNodeOrTag) => Promise<WebGLTexture>;
4
+ destroyObjectAsync: (glObject: import(".").IGLObject) => Promise<boolean>;
5
+ takeSnapshotAsync: (options?: import(".").IGLSnapshotOptions) => Promise<import(".").IGLSnapshot>;
6
+ getContextId: () => number | undefined;
7
+ }, "">;
8
+ type GlView = ReturnType<typeof GlView>;
9
+ export default GlView;
@@ -0,0 +1,2 @@
1
+ export { default as GLView } from './gl-view.svelte';
2
+ export * from '../core';
@@ -0,0 +1,3 @@
1
+ // @symbiote-native/gl/svelte: a GLView that gives a WebGL context to draw into, on a shared core
2
+ export { default as GLView } from './gl-view.svelte';
3
+ export * from '../core/index.js';
@@ -0,0 +1,2 @@
1
+ /** Vue twin of `expo-gl`'s `GLView`, `ref` gets the handle of the view */
2
+ export declare const GLView: import("vue").DefineComponent<{}, () => import("vue").VNode | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,4 @@
1
+ import { defineNativeViewComponent } from '@symbiote-native/vue';
2
+ import { createGLView } from '../core/index.js';
3
+ /** Vue twin of `expo-gl`'s `GLView`, `ref` gets the handle of the view */
4
+ export const GLView = defineNativeViewComponent('GLView', createGLView);
@@ -0,0 +1,2 @@
1
+ export { GLView } from './gl-view';
2
+ export * from '../core';
@@ -0,0 +1,3 @@
1
+ // @symbiote-native/gl/vue: a GLView that gives a WebGL context to draw into, on a shared core
2
+ export { GLView } from './gl-view.js';
3
+ export * from '../core/index.js';
@@ -0,0 +1,21 @@
1
+ import { NativeViewBase } from '@symbiote-native/angular';
2
+ import type { IDescriptor } from '@symbiote-native/components';
3
+ import type { IGLViewProps } from '../../core';
4
+ import * as i0 from "@angular/core";
5
+ declare const GL_VIEW_INPUTS: readonly ["onContextCreate", "msaaSamples", "enableExperimentalWorkletSupport"];
6
+ export interface GLView extends Partial<Pick<IGLViewProps, (typeof GL_VIEW_INPUTS)[number]>> {
7
+ }
8
+ /** Angular twin of `expo-gl`'s `GLView` */
9
+ export declare class GLView extends NativeViewBase {
10
+ private readonly view;
11
+ readonly createCameraTextureAsync: (camera: import("..").IGLNodeOrTag) => Promise<WebGLTexture>;
12
+ readonly destroyObjectAsync: (glObject: import("..").IGLObject) => Promise<boolean>;
13
+ readonly takeSnapshotAsync: (options?: import("..").IGLSnapshotOptions) => Promise<import("..").IGLSnapshot>;
14
+ get exglCtxId(): number | undefined;
15
+ protected readonly propNames: readonly ["onContextCreate", "msaaSamples", "enableExperimentalWorkletSupport"];
16
+ protected renderView(props: object): IDescriptor | null;
17
+ protected disposeView(): void;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<GLView, never>;
19
+ static ɵcmp: i0.ɵɵComponentDeclaration<GLView, "GLView", never, { "onContextCreate": { "alias": "onContextCreate"; "required": false; }; "msaaSamples": { "alias": "msaaSamples"; "required": false; }; "enableExperimentalWorkletSupport": { "alias": "enableExperimentalWorkletSupport"; "required": false; }; }, {}, never, never, true, never>;
20
+ }
21
+ export {};
@@ -0,0 +1,46 @@
1
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { DescriptorOutlet, NativeViewBase } from '@symbiote-native/angular';
3
+ import { createGLView } from '../../core';
4
+ import * as i0 from "@angular/core";
5
+ // One list is the inputs of the component and the props it hands to the native view
6
+ const GL_VIEW_INPUTS = [
7
+ 'onContextCreate',
8
+ 'msaaSamples',
9
+ 'enableExperimentalWorkletSupport',
10
+ ];
11
+ /** Angular twin of `expo-gl`'s `GLView` */
12
+ export class GLView extends NativeViewBase {
13
+ view = createGLView(() => this.hostNode());
14
+ // The functions of the view are members of the component, a `@ViewChild` reaches them
15
+ createCameraTextureAsync = this.view.handle.createCameraTextureAsync;
16
+ destroyObjectAsync = this.view.handle.destroyObjectAsync;
17
+ takeSnapshotAsync = this.view.handle.takeSnapshotAsync;
18
+ get exglCtxId() {
19
+ return this.view.handle.exglCtxId;
20
+ }
21
+ propNames = GL_VIEW_INPUTS;
22
+ renderView(props) {
23
+ return this.view.render(props);
24
+ }
25
+ disposeView() {
26
+ this.view.dispose();
27
+ }
28
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: GLView, deps: null, target: i0.ɵɵFactoryTarget.Component });
29
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: GLView, isStandalone: true, selector: "GLView", inputs: { onContextCreate: "onContextCreate", msaaSamples: "msaaSamples", enableExperimentalWorkletSupport: "enableExperimentalWorkletSupport" }, usesInheritance: true, ngImport: i0, template: `@if (descriptor; as node) {
30
+ <symbiote-descriptor-outlet [node]="node" />
31
+ }`, isInline: true, dependencies: [{ kind: "component", type: DescriptorOutlet, selector: "symbiote-descriptor-outlet", inputs: ["node"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
32
+ }
33
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: GLView, decorators: [{
34
+ type: Component,
35
+ args: [{
36
+ selector: 'GLView',
37
+ standalone: true,
38
+ imports: [DescriptorOutlet],
39
+ inputs: [...GL_VIEW_INPUTS],
40
+ changeDetection: ChangeDetectionStrategy.OnPush,
41
+ template: `@if (descriptor; as node) {
42
+ <symbiote-descriptor-outlet [node]="node" />
43
+ }`,
44
+ }]
45
+ }] });
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/angular/gl-view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;;AAG1C,oFAAoF;AACpF,MAAM,cAAc,GAAG;IACrB,iBAAiB;IACjB,aAAa;IACb,kCAAkC;CAC1B,CAAC;AAMX,2CAA2C;AAW3C,MAAM,OAAO,MAAO,SAAQ,cAAc;IACvB,IAAI,GAAG,YAAY,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAE5D,sFAAsF;IAC7E,wBAAwB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC;IACrE,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;IACzD,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC;IAEhE,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IACpC,CAAC;IAE2B,SAAS,GAAG,cAAc,CAAC;IAEpC,UAAU,CAAC,KAAa;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAEkB,WAAW;QAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;uGApBU,MAAM;2FAAN,MAAM,2OAJP;;IAER,4DALQ,gBAAgB;;2FAOf,MAAM;kBAVlB,SAAS;mBAAC;oBACT,QAAQ,EAAE,QAAQ;oBAClB,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;oBAC3B,MAAM,EAAE,CAAC,GAAG,cAAc,CAAC;oBAC3B,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,QAAQ,EAAE;;IAER;iBACH"}
@@ -0,0 +1,2 @@
1
+ export { GLView } from './gl-view';
2
+ export * from '../core';
@@ -0,0 +1,4 @@
1
+ // @symbiote-native/gl/angular: a GLView that gives a WebGL context to draw into, on a shared core
2
+ export { GLView } from './gl-view';
3
+ export * from '../core';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAElG,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const GL_MODULE_NAME = "ExpoGL";
2
+ export declare const GL_PACKAGE_NAME = "expo-gl";
3
+ /** Where the native module keeps the contexts it installs on the runtime, by id */
4
+ export declare const GL_CONTEXTS_GLOBAL = "__EXGLContexts";
@@ -0,0 +1,5 @@
1
+ export const GL_MODULE_NAME = 'ExpoGL';
2
+ export const GL_PACKAGE_NAME = 'expo-gl';
3
+ /** Where the native module keeps the contexts it installs on the runtime, by id */
4
+ export const GL_CONTEXTS_GLOBAL = '__EXGLContexts';
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEvC,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC;AAEzC,mFAAmF;AACnF,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { IExpoWebGLRenderingContext, IGLSnapshot, IGLSnapshotOptions } from './types';
2
+ /** The context of a worklet, `exgl` has to be created with worklet support */
3
+ export declare function getWorkletContext(contextId: number): IExpoWebGLRenderingContext | undefined;
4
+ export declare function unregisterGLContext(exglCtxId: number): void;
5
+ /** The GL interface of a context id the native side created */
6
+ export declare function getGl(exglCtxId: number): IExpoWebGLRenderingContext;
7
+ export declare function getContextId(exgl?: IExpoWebGLRenderingContext | number): number;
8
+ /** A context with no view, which does not present its framebuffer, take a snapshot to see it */
9
+ export declare function createContextAsync(): Promise<IExpoWebGLRenderingContext>;
10
+ /** For a headless context made by `createContextAsync` */
11
+ export declare function destroyContextAsync(exgl?: IExpoWebGLRenderingContext | number): Promise<boolean>;
12
+ /** Saves the framebuffer as a file in the cache directory of the app */
13
+ export declare function takeSnapshotAsync(exgl?: IExpoWebGLRenderingContext | number, options?: IGLSnapshotOptions): Promise<IGLSnapshot>;
@@ -0,0 +1,55 @@
1
+ import { CodedError } from 'expo-modules-core';
2
+ import { GL_CONTEXTS_GLOBAL } from './constants';
3
+ import { configureLogging } from './gl-utils';
4
+ import { glNativeModule } from './native-module';
5
+ import { createWorkletContextManager } from './worklet-context-manager';
6
+ const workletContextManager = createWorkletContextManager();
7
+ function isContext(value) {
8
+ return typeof value === 'object' && value !== null;
9
+ }
10
+ /** The context of a worklet, `exgl` has to be created with worklet support */
11
+ export function getWorkletContext(contextId) {
12
+ 'worklet';
13
+ return workletContextManager.getContext(contextId);
14
+ }
15
+ export function unregisterGLContext(exglCtxId) {
16
+ const contexts = Reflect.get(globalThis, GL_CONTEXTS_GLOBAL);
17
+ if (contexts)
18
+ Reflect.deleteProperty(Object(contexts), String(exglCtxId));
19
+ workletContextManager.unregister?.(exglCtxId);
20
+ }
21
+ /** The GL interface of a context id the native side created */
22
+ export function getGl(exglCtxId) {
23
+ const contexts = Reflect.get(globalThis, GL_CONTEXTS_GLOBAL);
24
+ if (!contexts) {
25
+ throw new CodedError('ERR_GL_NOT_AVAILABLE', 'GL is currently not available. (Have you enabled remote debugging? GL is not available while debugging remotely.)');
26
+ }
27
+ const gl = Reflect.get(Object(contexts), String(exglCtxId));
28
+ if (!isContext(gl))
29
+ throw new Error(`There is no EXGLContext with id ${exglCtxId}`);
30
+ configureLogging(gl);
31
+ return gl;
32
+ }
33
+ export function getContextId(exgl) {
34
+ const exglCtxId = exgl && typeof exgl === 'object' ? exgl.contextId : exgl;
35
+ if (!exglCtxId || typeof exglCtxId !== 'number') {
36
+ throw new Error(`Invalid EXGLContext id: ${String(exglCtxId)}`);
37
+ }
38
+ return exglCtxId;
39
+ }
40
+ /** A context with no view, which does not present its framebuffer, take a snapshot to see it */
41
+ export async function createContextAsync() {
42
+ const { exglCtxId } = await glNativeModule.createContextAsync();
43
+ return getGl(exglCtxId);
44
+ }
45
+ /** For a headless context made by `createContextAsync` */
46
+ export async function destroyContextAsync(exgl) {
47
+ const exglCtxId = getContextId(exgl);
48
+ unregisterGLContext(exglCtxId);
49
+ return glNativeModule.destroyContextAsync(exglCtxId);
50
+ }
51
+ /** Saves the framebuffer as a file in the cache directory of the app */
52
+ export async function takeSnapshotAsync(exgl, options = {}) {
53
+ return glNativeModule.takeSnapshotAsync(getContextId(exgl), options);
54
+ }
55
+ //# sourceMappingURL=gl-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gl-context.js","sourceRoot":"","sources":["../../src/core/gl-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAExE,MAAM,qBAAqB,GAAG,2BAA2B,EAAE,CAAC;AAE5D,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IACjD,SAAS,CAAC;IACV,OAAO,qBAAqB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IACnD,MAAM,QAAQ,GAAY,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;IACtE,IAAI,QAAQ;QAAE,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1E,qBAAqB,CAAC,U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IAAI,CAAC,CAAC;IACrC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC/B,OAAO,cAAc,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;AACvD,CAAC;AAED,wEAAwE;AACxE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAA0C,EAC1C,UAA8B,EAAE;IAEhC,OAAO,cAAc,CAAC,iBAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const GL_ERRORS: Readonly<Record<number, string>>;
@@ -0,0 +1,9 @@
1
+ export const GL_ERRORS = {
2
+ 1280: 'INVALID ENUM: An unacceptable value has been specified for an enumerated argument.',
3
+ 1281: 'INVALID_VALUE: A numeric argument is out of range.',
4
+ 1282: 'INVALID_OPERATION: The specified command is not allowed for the current state.',
5
+ 1285: 'OUT_OF_MEMORY: Not enough memory is left to execute the command.',
6
+ 1286: 'INVALID_FRAMEBUFFER_OPERATION: The currently bound framebuffer is not complete when trying to render to or to read from it.',
7
+ 37442: 'CONTEXT_LOST_WEBGL: The WebGL context is lost.',
8
+ };
9
+ //# sourceMappingURL=gl-errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gl-errors.js","sourceRoot":"","sources":["../../src/core/gl-errors.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAqC;IACzD,IAAI,EAAE,oFAAoF;IAC1F,IAAI,EAAE,oDAAoD;IAC1D,IAAI,EAAE,gFAAgF;IACtF,IAAI,EAAE,kEAAkE;IACxE,IAAI,EAAE,6HAA6H;IACnI,KAAK,EAAE,gDAAgD;CACxD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { IExpoWebGLRenderingContext } from './types';
2
+ type ILoggableGL = Pick<IExpoWebGLRenderingContext, '__expoSetLogging'>;
3
+ /** Adds `__expoSetLogging` to the context, for the logging options useful in debugging GL calls */
4
+ export declare function configureLogging(gl: ILoggableGL): void;
5
+ export {};
@@ -0,0 +1,85 @@
1
+ import { GL_ERRORS } from './gl-errors';
2
+ import { GLLoggingOption } from './types';
3
+ const MAX_STRING_LENGTH = 20;
4
+ const SET_LOGGING_KEY = '__expoSetLogging';
5
+ const wrappers = new WeakSet();
6
+ function isGLFunction(value) {
7
+ return typeof value === 'function';
8
+ }
9
+ function constantNameOf(gl, value) {
10
+ for (const name in gl) {
11
+ if (Reflect.get(gl, name) === value)
12
+ return name;
13
+ }
14
+ return undefined;
15
+ }
16
+ // Numbers get the name of a constant that holds them, which can mislead for a size, so the
17
+ // number stays. Strings are cut because a shader is long and logging it blocks the bridge
18
+ function describeArg(gl, option, arg) {
19
+ if (option & GLLoggingOption.RESOLVE_CONSTANTS && typeof arg === 'number') {
20
+ const name = constantNameOf(gl, arg);
21
+ if (name)
22
+ return `${arg} (${name})`;
23
+ }
24
+ const isLong = typeof arg === 'string' && arg.length > MAX_STRING_LENGTH;
25
+ if (option & GLLoggingOption.TRUNCATE_STRINGS && isLong) {
26
+ const lastSpace = arg.lastIndexOf(' ', MAX_STRING_LENGTH);
27
+ return `${arg.slice(0, lastSpace >= 0 ? lastSpace : MAX_STRING_LENGTH)}...`;
28
+ }
29
+ return String(arg);
30
+ }
31
+ // The original `getError`, a wrapped one would log itself
32
+ function reportError(gl) {
33
+ const getError = Reflect.get(Reflect.getPrototypeOf(gl) ?? {}, 'getError');
34
+ if (!isGLFunction(getError))
35
+ return;
36
+ const error = getError.call(gl);
37
+ if (typeof error !== 'number' || error === Reflect.get(gl, 'NO_ERROR'))
38
+ return;
39
+ console.warn(`\x1b[31mExpoGL: Error ${GL_ERRORS[error]}\x1b[0m`);
40
+ }
41
+ function wrapMethod(gl, key, original, getOption) {
42
+ const wrapper = (...args) => {
43
+ const option = getOption();
44
+ if (option & GLLoggingOption.METHOD_CALLS) {
45
+ const params = args.map(arg => describeArg(gl, option, arg));
46
+ console.warn(`ExpoGL: ${key}(${params.join(', ')})`);
47
+ }
48
+ const result = original.apply(gl, args);
49
+ if (option & GLLoggingOption.METHOD_CALLS)
50
+ console.warn(`ExpoGL: = ${String(result)}`);
51
+ if (option & GLLoggingOption.GET_ERRORS && key !== 'getError')
52
+ reportError(gl);
53
+ return result;
54
+ };
55
+ wrappers.add(wrapper);
56
+ Reflect.set(gl, key, wrapper);
57
+ }
58
+ function wrapMethods(gl, getOption) {
59
+ for (const [key, original] of Object.entries(Reflect.getPrototypeOf(gl) ?? {})) {
60
+ if (isGLFunction(original) && key !== SET_LOGGING_KEY) {
61
+ wrapMethod(gl, key, original, getOption);
62
+ }
63
+ }
64
+ }
65
+ function unwrapMethods(gl) {
66
+ for (const [key, value] of Object.entries(gl)) {
67
+ if (isGLFunction(value) && wrappers.has(value))
68
+ Reflect.deleteProperty(gl, key);
69
+ }
70
+ }
71
+ /** Adds `__expoSetLogging` to the context, for the logging options useful in debugging GL calls */
72
+ export function configureLogging(gl) {
73
+ let loggingOption = GLLoggingOption.DISABLED;
74
+ gl.__expoSetLogging = (option) => {
75
+ // Both on or both off needs no wrapping or unwrapping, only the new option
76
+ if (!loggingOption !== !option) {
77
+ if (option)
78
+ wrapMethods(gl, () => loggingOption);
79
+ else
80
+ unwrapMethods(gl);
81
+ }
82
+ loggingOption = option;
83
+ };
84
+ }
85
+ //# sourceMappingURL=gl-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gl-utils.js","sourceRoot":"","sources":["../../src/core/gl-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO1C,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAE3C,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAe,CAAC;AAE5C,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC;AACrC,CAAC;AAED,SAAS,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EAAE,SAAuB;IACtD,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAC/E,IAAI,YAAY,CAAC,QAAQ,CAAC,IAAI,GAAG,KAAK,eAAe,EAAE,CAAC;YACtD,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,EAAU;IAC/B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QAC9C,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAClF,CAAC;AACH,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,gBAAgB,CAAC,EAAe;IAC9C,IAAI,aAAa,GAAW,eAAe,CAAC,QAAQ,CAAC;IAErD,EAAE,CAAC,gBAAgB,GAAG,CAAC,MAAuB,EAAQ,EAAE;QACtD,2EAA2E;QAC3E,IAAI,CAAC,aAAa,KAAK,CAAC,MAAM,EAAE,CAAC;YAC/B,IAAI,MAAM;gBAAE,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC;;gBAC5C,aAAa,CAAC,EAAE,CAAC,CAAC;QACzB,CAAC;QACD,aAAa,GAAG,MAAM,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { IDescriptor } from '@symbiote-native/components';
2
+ import type { ISymbioteNode } from '@symbiote-native/engine';
3
+ import type { IGLViewHandle } from './types';
4
+ export declare const glViewName: () => string;
5
+ export declare const ensureGLViewRegistered: () => boolean;
6
+ export type IGLView = {
7
+ handle: IGLViewHandle;
8
+ /** `null` means the view cannot register and the caller renders nothing */
9
+ render(props: object): IDescriptor | null;
10
+ /** Forgets the context of the surface, called when the view unmounts */
11
+ dispose(): void;
12
+ };
13
+ type IGetNode = () => ISymbioteNode | null | undefined;
14
+ /** One per mounted view, `getNode` is kept for the shape the adapters share */
15
+ export declare function createGLView(_getNode: IGetNode): IGLView;
16
+ export {};
@@ -0,0 +1,100 @@
1
+ import { Platform, UnavailabilityError, requireNativeViewManager, } from 'expo-modules-core';
2
+ import { el } from '@symbiote-native/components';
3
+ import { defineExpoNativeView, getNativeTag, isDevBuild, isSymbioteNode, } from '@symbiote-native/engine';
4
+ import { GL_MODULE_NAME, GL_PACKAGE_NAME } from './constants';
5
+ import { getGl, takeSnapshotAsync, unregisterGLContext } from './gl-context';
6
+ import { glNativeModule } from './native-module';
7
+ // Registered on render: a barrel side effect is lost in a release build
8
+ const glView = defineExpoNativeView(requireNativeViewManager, GL_MODULE_NAME);
9
+ export const glViewName = glView.name;
10
+ export const ensureGLViewRegistered = glView.ensureRegistered;
11
+ const DEFAULT_MSAA_SAMPLES = 4;
12
+ function isSurfaceCreated(value) {
13
+ return typeof Reflect.get(Object(value), 'exglCtxId') === 'number';
14
+ }
15
+ function isContextCallback(value) {
16
+ return typeof value === 'function';
17
+ }
18
+ // Adapters hand over the props they hold, a missing callback is a view nobody listens to
19
+ function toViewProps(props) {
20
+ const onContextCreate = Reflect.get(props, 'onContextCreate');
21
+ return {
22
+ ...props,
23
+ onContextCreate: isContextCallback(onContextCreate) ? onContextCreate : () => undefined,
24
+ };
25
+ }
26
+ function nativeTagOf(camera) {
27
+ const tag = isSymbioteNode(camera) ? getNativeTag(camera) : camera;
28
+ if (typeof tag !== 'number')
29
+ throw new Error('The camera view has no native tag yet');
30
+ return tag;
31
+ }
32
+ /** One per mounted view, `getNode` is kept for the shape the adapters share */
33
+ export function createGLView(_getNode) {
34
+ let exglCtxId;
35
+ let latestProps;
36
+ let hasWorkletSupport;
37
+ const onSurfaceCreate = (event) => {
38
+ if (!isSurfaceCreated(event.nativeEvent))
39
+ return;
40
+ exglCtxId = event.nativeEvent.exglCtxId;
41
+ latestProps?.onContextCreate(getGl(exglCtxId));
42
+ };
43
+ function warnOnWorkletChange(enabled) {
44
+ if (hasWorkletSupport !== undefined && hasWorkletSupport !== enabled) {
45
+ console.warn('Updating prop enableExperimentalWorkletSupport is not supported');
46
+ }
47
+ hasWorkletSupport = enabled;
48
+ }
49
+ const handle = {
50
+ get exglCtxId() {
51
+ return exglCtxId;
52
+ },
53
+ async createCameraTextureAsync(camera) {
54
+ if (!glNativeModule.createCameraTextureAsync) {
55
+ throw new UnavailabilityError(GL_PACKAGE_NAME, 'createCameraTextureAsync');
56
+ }
57
+ if (!exglCtxId)
58
+ throw new Error("GLView's surface is not created yet!");
59
+ const { exglObjId } = await glNativeModule.createCameraTextureAsync(exglCtxId, nativeTagOf(camera));
60
+ const texture = { id: exglObjId };
61
+ return texture;
62
+ },
63
+ async destroyObjectAsync(glObject) {
64
+ if (!glNativeModule.destroyObjectAsync) {
65
+ throw new UnavailabilityError(GL_PACKAGE_NAME, 'destroyObjectAsync');
66
+ }
67
+ return glNativeModule.destroyObjectAsync(glObject.id);
68
+ },
69
+ takeSnapshotAsync: (options) => takeSnapshotAsync(exglCtxId, options),
70
+ };
71
+ return {
72
+ handle,
73
+ dispose: () => {
74
+ if (exglCtxId)
75
+ unregisterGLContext(exglCtxId);
76
+ },
77
+ render: props => {
78
+ if (!ensureGLViewRegistered()) {
79
+ if (isDevBuild())
80
+ console.warn("'GLView' is not available.");
81
+ return null;
82
+ }
83
+ latestProps = toViewProps(props);
84
+ const { onContextCreate, msaaSamples = DEFAULT_MSAA_SAMPLES, enableExperimentalWorkletSupport = false, ...viewProps } = latestProps;
85
+ warnOnWorkletChange(enableExperimentalWorkletSupport);
86
+ return el('view', viewProps, [
87
+ el(glViewName(), {
88
+ style: {
89
+ flex: 1,
90
+ ...Platform.select({ ios: { backgroundColor: 'transparent' }, default: {} }),
91
+ },
92
+ onSurfaceCreate,
93
+ enableExperimentalWorkletSupport,
94
+ msaaSamples: Platform.select({ ios: msaaSamples, default: undefined }),
95
+ }),
96
+ ]);
97
+ },
98
+ };
99
+ }
100
+ //# sourceMappingURL=gl-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gl-view.js","sourceRoot":"","sources":["../../src/core/gl-view.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AAEjD,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,cAAc,GACf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AASjD,wEAAwE;AACxE,MAAM,MAAM,GAAG,oBAAoB,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC;AAE9E,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC;AAEtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAE9D,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAY/B,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,KAAK,QAAQ,CAAC;AACrE,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC;AACrC,CAAC;AAED,yFAAyF;AACzF,SAAS,WAAW,CAAC,KAAa;IAChC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,WAAW,CAAC;YAChB,mBAAmB,CAAC,gCAAgC,CAAC,CAAC;YACtD,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE;gBAC3B,EAAE,CAAC,UAAU,EAAE,EAAE;oBACf,KAAK,EAAE;wBACL,IAAI,EAAE,CAAC;wBACP,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,eAAe,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;qBAC7E;oBACD,eAAe;oBACf,gCAAgC;oBAChC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;iBACvE,CAAC;aACH,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { GL_MODULE_NAME } from './constants';
2
+ export { createContextAsync, destroyContextAsync, getGl, getWorkletContext, takeSnapshotAsync, } from './gl-context';
3
+ export { configureLogging } from './gl-utils';
4
+ export { createGLView, ensureGLViewRegistered, glViewName, type IGLView } from './gl-view';
5
+ export { GLLoggingOption } from './types';
6
+ export type { IExpoWebGLRenderingContext, IGLNodeOrTag, IGLObject, IGLSnapshot, IGLSnapshotOptions, IGLSurfaceCreateEvent, IGLViewHandle, IGLViewProps, } from './types';
@@ -0,0 +1,6 @@
1
+ export { GL_MODULE_NAME } from './constants';
2
+ export { createContextAsync, destroyContextAsync, getGl, getWorkletContext, takeSnapshotAsync, } from './gl-context';
3
+ export { configureLogging } from './gl-utils';
4
+ export { createGLView, ensureGLViewRegistered, glViewName } from './gl-view';
5
+ export { GLLoggingOption } from './types';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,EACL,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,UAAU,EAAgB,MAAM,WAAW,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { IGLSnapshot, IGLSnapshotOptions } from './types';
2
+ export type INativeGLModule = {
3
+ createContextAsync(): Promise<{
4
+ exglCtxId: number;
5
+ }>;
6
+ destroyContextAsync(exglCtxId: number): Promise<boolean>;
7
+ takeSnapshotAsync(exglCtxId: number, options: IGLSnapshotOptions): Promise<IGLSnapshot>;
8
+ /** Absent where there is no camera texture support */
9
+ createCameraTextureAsync?(exglCtxId: number, cameraTag: number): Promise<{
10
+ exglObjId: number;
11
+ }>;
12
+ /** Absent where objects cannot be destroyed one by one */
13
+ destroyObjectAsync?(exglObjId: number): Promise<boolean>;
14
+ };
15
+ export declare const glNativeModule: INativeGLModule;
@@ -0,0 +1,4 @@
1
+ import { requireNativeModule } from 'expo-modules-core';
2
+ import { GL_MODULE_NAME } from './constants';
3
+ export const glNativeModule = requireNativeModule(GL_MODULE_NAME);
4
+ //# sourceMappingURL=native-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAgB7C,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAkB,cAAc,CAAC,CAAC"}