expo-gl 16.0.9-canary-20251210-1f163e3 → 16.0.9
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.
- package/CHANGELOG.md +9 -9
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/gl/GLContext.java +2 -2
- package/android/src/main/java/expo/modules/gl/{GLModule.kt → GLObjectManagerModule.kt} +3 -10
- package/android/src/main/java/expo/modules/gl/GLView.kt +1 -1
- package/android/src/main/java/expo/modules/gl/GLViewModule.kt +17 -0
- package/build/GLView.d.ts +1 -0
- package/build/GLView.d.ts.map +1 -1
- package/build/GLView.js +18 -10
- package/build/GLView.js.map +1 -1
- package/expo-module.config.json +3 -3
- package/ios/EXGLContext.mm +4 -2
- package/ios/EXGLObjectManager.h +8 -21
- package/ios/EXGLObjectManager.mm +76 -32
- package/ios/GLViewModule.swift +20 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9-sources.jar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9-sources.jar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9-sources.jar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9-sources.jar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9-sources.jar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.module +87 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/{16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.pom → 16.0.9/expo.modules.gl-16.0.9.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/maven-metadata.xml +4 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/maven-metadata.xml.sha512 +1 -1
- package/package.json +6 -5
- package/src/GLView.tsx +23 -9
- package/ios/ExpoGLModule.swift +0 -76
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3-sources.jar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3-sources.jar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3-sources.jar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3-sources.jar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3-sources.jar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.module +0 -87
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9-canary-20251210-1f163e3/expo.modules.gl-16.0.9-canary-20251210-1f163e3.pom.sha512 +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,21 +8,21 @@
|
|
|
8
8
|
|
|
9
9
|
### 🐛 Bug fixes
|
|
10
10
|
|
|
11
|
-
- Fix race condition bug for **web** env for `onLayout` callback. ([#41460](https://github.com/expo/expo/pull/41460) by [@psnet](https://github.com/psnet))
|
|
12
|
-
|
|
13
11
|
### 💡 Others
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
- [android] rename module to align with iOS ([#41193](https://github.com/expo/expo/pull/41193) by [@Ubax](https://github.com/Ubax))
|
|
13
|
+
## 16.0.9 — 2025-12-11
|
|
17
14
|
|
|
18
|
-
###
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Fix race condition bug for **web** env for `onLayout` callback. ([#41460](https://github.com/expo/expo/pull/41460) by [@psnet](https://github.com/psnet))
|
|
18
|
+
|
|
19
|
+
### 💡 Others
|
|
19
20
|
|
|
20
|
-
- **Performance optimization**: remove support of **GIF** image format in image decoding in `texImage2D` expo wrapper. ([#41499](https://github.com/expo/expo/pull/41499) by [@psnet](https://github.com/psnet))
|
|
21
|
-
- **Performance optimization**: reduce supported old image formats in lib `stb_image.h` used for image decoding in `texImage2D` expo wrapper to support only **JPEG, PNG, GIF** image formats. Formats **BMP, PSD, TGA, HDR, PIC, PNM** are no longer supported. ([#41001](https://github.com/expo/expo/pull/41001) by [@psnet](https://github.com/psnet))
|
|
22
21
|
- Updated library `stb_image.h` used for image decoding in `texImage2D` expo wraper method. A lot of fixes and performance improvements, see related PR. ([#41000](https://github.com/expo/expo/pull/41000) by [@psnet](https://github.com/psnet))
|
|
23
|
-
-
|
|
22
|
+
- **Performance optimization**: reduce supported old image formats in lib `stb_image.h` used for image decoding in `texImage2D` expo wrapper to support only **JPEG, PNG, GIF** image formats. Formats **BMP, PSD, TGA, HDR, PIC, PNM** are no longer supported. ([#41001](https://github.com/expo/expo/pull/41001) by [@psnet](https://github.com/psnet))
|
|
23
|
+
- **Performance optimization**: remove support of **GIF** image format in image decoding in `texImage2D` expo wrapper. ([#41499](https://github.com/expo/expo/pull/41499) by [@psnet](https://github.com/psnet))
|
|
24
24
|
|
|
25
|
-
## 16.0.8
|
|
25
|
+
## 16.0.8 — 2025-12-05
|
|
26
26
|
|
|
27
27
|
_This version does not introduce any user-facing changes._
|
|
28
28
|
|
package/android/build.gradle
CHANGED
|
@@ -9,7 +9,7 @@ def reactNativeArchitectures() {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
group = 'host.exp.exponent'
|
|
12
|
-
version = '16.0.9
|
|
12
|
+
version = '16.0.9'
|
|
13
13
|
|
|
14
14
|
android {
|
|
15
15
|
if (rootProject.hasProperty("ndkPath")) {
|
|
@@ -22,7 +22,7 @@ android {
|
|
|
22
22
|
namespace "expo.modules.gl"
|
|
23
23
|
defaultConfig {
|
|
24
24
|
versionCode 31
|
|
25
|
-
versionName "16.0.9
|
|
25
|
+
versionName "16.0.9"
|
|
26
26
|
|
|
27
27
|
externalNativeBuild {
|
|
28
28
|
cmake {
|
|
@@ -39,7 +39,7 @@ import static expo.modules.gl.cpp.EXGL.*;
|
|
|
39
39
|
public class GLContext {
|
|
40
40
|
private int mEXGLCtxId = -1;
|
|
41
41
|
|
|
42
|
-
private final
|
|
42
|
+
private final GLObjectManagerModule mManager;
|
|
43
43
|
private GLThread mGLThread;
|
|
44
44
|
private EGLDisplay mEGLDisplay;
|
|
45
45
|
private EGLSurface mEGLSurface;
|
|
@@ -49,7 +49,7 @@ public class GLContext {
|
|
|
49
49
|
|
|
50
50
|
private BlockingQueue<Runnable> mEventQueue = new LinkedBlockingQueue<>();
|
|
51
51
|
|
|
52
|
-
public GLContext(
|
|
52
|
+
public GLContext(GLObjectManagerModule manager) {
|
|
53
53
|
super();
|
|
54
54
|
mManager = manager;
|
|
55
55
|
}
|
|
@@ -18,11 +18,11 @@ private class InvalidCameraViewException :
|
|
|
18
18
|
private class InvalidGLContextException :
|
|
19
19
|
CodedException("GLContext not found for given context id")
|
|
20
20
|
|
|
21
|
-
class
|
|
21
|
+
class GLObjectManagerModule : Module() {
|
|
22
22
|
private val mGLObjects = SparseArray<GLObject>()
|
|
23
23
|
private val mGLContextMap = SparseArray<GLContext>()
|
|
24
24
|
override fun definition() = ModuleDefinition {
|
|
25
|
-
Name("
|
|
25
|
+
Name("ExponentGLObjectManager")
|
|
26
26
|
|
|
27
27
|
AsyncFunction("destroyObjectAsync") { exglObjId: Int ->
|
|
28
28
|
val glObject = mGLObjects[exglObjId]
|
|
@@ -61,7 +61,7 @@ class GLModule : Module() {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
AsyncFunction("createContextAsync") { promise: Promise ->
|
|
64
|
-
val glContext = GLContext(this@
|
|
64
|
+
val glContext = GLContext(this@GLObjectManagerModule)
|
|
65
65
|
glContext.initialize(null, false) {
|
|
66
66
|
val results = Bundle()
|
|
67
67
|
results.putInt("exglCtxId", glContext.contextId)
|
|
@@ -76,13 +76,6 @@ class GLModule : Module() {
|
|
|
76
76
|
glContext.destroy()
|
|
77
77
|
true
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
View(GLView::class) {
|
|
81
|
-
Events("onSurfaceCreate")
|
|
82
|
-
Prop("enableExperimentalWorkletSupport") { view: GLView, enableExperimentalWorkletSupport: Boolean? ->
|
|
83
|
-
view.enableExperimentalWorkletSupport = enableExperimentalWorkletSupport ?: false
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
79
|
}
|
|
87
80
|
|
|
88
81
|
private fun getContextWithId(exglCtxId: Int): GLContext? {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package expo.modules.gl
|
|
2
|
+
|
|
3
|
+
import expo.modules.kotlin.modules.Module
|
|
4
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
5
|
+
|
|
6
|
+
class GLViewModule : Module() {
|
|
7
|
+
override fun definition() = ModuleDefinition {
|
|
8
|
+
Name("ExponentGLView")
|
|
9
|
+
|
|
10
|
+
View(GLView::class) {
|
|
11
|
+
Events("onSurfaceCreate")
|
|
12
|
+
Prop("enableExperimentalWorkletSupport") { view: GLView, enableExperimentalWorkletSupport: Boolean? ->
|
|
13
|
+
view.enableExperimentalWorkletSupport = enableExperimentalWorkletSupport ?: false
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
package/build/GLView.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export declare class GLView extends React.Component<GLViewProps> {
|
|
|
48
48
|
_onSurfaceCreate: ({ nativeEvent: { exglCtxId } }: SurfaceCreateEvent) => void;
|
|
49
49
|
componentWillUnmount(): void;
|
|
50
50
|
componentDidUpdate(prevProps: GLViewProps): void;
|
|
51
|
+
startARSessionAsync(): Promise<any>;
|
|
51
52
|
createCameraTextureAsync(cameraRefOrHandle: ComponentOrHandle): Promise<WebGLTexture>;
|
|
52
53
|
destroyObjectAsync(glObject: WebGLObject): Promise<boolean>;
|
|
53
54
|
/**
|
package/build/GLView.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GLView.d.ts","sourceRoot":"","sources":["../src/GLView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GLView.d.ts","sourceRoot":"","sources":["../src/GLView.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,yBAAyB,EACzB,eAAe,EACf,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAIxB,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAUF,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,yBAAyB,GAAG,SAAS,CAG1F;AAGD;;;GAGG;AACH,qBAAa,MAAO,SAAQ,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;IACtD,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC;IAEvB,MAAM,CAAC,YAAY;;;MAGjB;IAEF;;;;;;;OAOG;WACU,kBAAkB,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAKrE;;;;OAIG;WACU,mBAAmB,CAAC,IAAI,CAAC,EAAE,yBAAyB,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAM7F;;;;;OAKG;WACU,iBAAiB,CAC5B,IAAI,CAAC,EAAE,yBAAyB,GAAG,MAAM,EACzC,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,UAAU,CAAC;IAKtB;;;OAGG;IACH,MAAM,CAAC,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,yBAAyB,GAAG,SAAS,CACnD;IAEnC,SAAS,EAAE,iBAAiB,CAAQ;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,MAAM;IAwBN,aAAa,GAAI,WAAW,iBAAiB,KAAG,IAAI,CAKlD;IAEF,gBAAgB,GAAI,gCAAgC,kBAAkB,KAAG,IAAI,CAQ3E;IAEF,oBAAoB,IAAI,IAAI;IAM5B,kBAAkB,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI;IAS1C,mBAAmB,IAAI,OAAO,CAAC,GAAG,CAAC;IAQnC,wBAAwB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAoBrF,kBAAkB,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAOjE;;;;OAIG;IACG,iBAAiB,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,UAAU,CAAC;CAO5E"}
|
package/build/GLView.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { UnavailabilityError, requireNativeModule, requireNativeViewManager, CodedError, } from 'expo-modules-core';
|
|
1
|
+
import { NativeModulesProxy, UnavailabilityError, requireNativeModule, requireNativeViewManager, CodedError, } from 'expo-modules-core';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Platform, View, findNodeHandle } from 'react-native';
|
|
4
4
|
import { configureLogging } from './GLUtils';
|
|
5
5
|
import { createWorkletContextManager } from './GLWorkletContextManager';
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const ExponentGLObjectManager = requireNativeModule('ExponentGLObjectManager');
|
|
7
|
+
const { ExponentGLViewManager } = NativeModulesProxy;
|
|
8
|
+
const NativeView = requireNativeViewManager('ExponentGLView');
|
|
8
9
|
const workletContextManager = createWorkletContextManager();
|
|
9
10
|
export function getWorkletContext(contextId) {
|
|
10
11
|
'worklet';
|
|
@@ -30,7 +31,7 @@ export class GLView extends React.Component {
|
|
|
30
31
|
* @return A promise that resolves to WebGL context object. See [WebGL API](#webgl-api) for more details.
|
|
31
32
|
*/
|
|
32
33
|
static async createContextAsync() {
|
|
33
|
-
const { exglCtxId } = await
|
|
34
|
+
const { exglCtxId } = await ExponentGLObjectManager.createContextAsync();
|
|
34
35
|
return getGl(exglCtxId);
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
@@ -41,7 +42,7 @@ export class GLView extends React.Component {
|
|
|
41
42
|
static async destroyContextAsync(exgl) {
|
|
42
43
|
const exglCtxId = getContextId(exgl);
|
|
43
44
|
unregisterGLContext(exglCtxId);
|
|
44
|
-
return
|
|
45
|
+
return ExponentGLObjectManager.destroyContextAsync(exglCtxId);
|
|
45
46
|
}
|
|
46
47
|
/**
|
|
47
48
|
* Takes a snapshot of the framebuffer and saves it as a file to app's cache directory.
|
|
@@ -51,7 +52,7 @@ export class GLView extends React.Component {
|
|
|
51
52
|
*/
|
|
52
53
|
static async takeSnapshotAsync(exgl, options = {}) {
|
|
53
54
|
const exglCtxId = getContextId(exgl);
|
|
54
|
-
return
|
|
55
|
+
return ExponentGLObjectManager.takeSnapshotAsync(exglCtxId, options);
|
|
55
56
|
}
|
|
56
57
|
/**
|
|
57
58
|
* This method doesn't work inside of the worklets with new reanimated versions.
|
|
@@ -97,8 +98,15 @@ export class GLView extends React.Component {
|
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
// @docsMissing
|
|
101
|
+
async startARSessionAsync() {
|
|
102
|
+
if (!ExponentGLViewManager.startARSessionAsync) {
|
|
103
|
+
throw new UnavailabilityError('expo-gl', 'startARSessionAsync');
|
|
104
|
+
}
|
|
105
|
+
return await ExponentGLViewManager.startARSessionAsync(findNodeHandle(this.nativeRef));
|
|
106
|
+
}
|
|
107
|
+
// @docsMissing
|
|
100
108
|
async createCameraTextureAsync(cameraRefOrHandle) {
|
|
101
|
-
if (!
|
|
109
|
+
if (!ExponentGLObjectManager.createCameraTextureAsync) {
|
|
102
110
|
throw new UnavailabilityError('expo-gl', 'createCameraTextureAsync');
|
|
103
111
|
}
|
|
104
112
|
const { exglCtxId } = this;
|
|
@@ -106,15 +114,15 @@ export class GLView extends React.Component {
|
|
|
106
114
|
throw new Error("GLView's surface is not created yet!");
|
|
107
115
|
}
|
|
108
116
|
const cameraTag = findNodeHandle(cameraRefOrHandle);
|
|
109
|
-
const { exglObjId } = await
|
|
117
|
+
const { exglObjId } = await ExponentGLObjectManager.createCameraTextureAsync(exglCtxId, cameraTag);
|
|
110
118
|
return { id: exglObjId };
|
|
111
119
|
}
|
|
112
120
|
// @docsMissing
|
|
113
121
|
async destroyObjectAsync(glObject) {
|
|
114
|
-
if (!
|
|
122
|
+
if (!ExponentGLObjectManager.destroyObjectAsync) {
|
|
115
123
|
throw new UnavailabilityError('expo-gl', 'destroyObjectAsync');
|
|
116
124
|
}
|
|
117
|
-
return await
|
|
125
|
+
return await ExponentGLObjectManager.destroyObjectAsync(glObject.id);
|
|
118
126
|
}
|
|
119
127
|
/**
|
|
120
128
|
* Same as static [`takeSnapshotAsync()`](#takesnapshotasyncoptions),
|
package/build/GLView.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GLView.js","sourceRoot":"","sources":["../src/GLView.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAS7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AASxE,MAAM,cAAc,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AACrD,MAAM,UAAU,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;AACtD,MAAM,qBAAqB,GAAG,2BAA2B,EAAE,CAAC;AAE5D,MA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,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;;AAGH,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;AAE/B,SAAS,mBAAmB,CAAC,SAAiB;IAC5C,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,qBAAqB,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC;AAED,6CAA6C;AAC7C,MAAM,KAAK,GAAG,CAAC,SAAiB,EAA6B,EAAE;IAC7D,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QAC3B,MAAM,IAAI,UAAU,CAClB,sBAAsB,EACtB,mHAAmH,CACpH,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAEpD,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAErB,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,IAAyC,EAAU,EAAE;IACzE,MAAM,SAAS,GAAG,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IAE3E,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import {\n UnavailabilityError,\n requireNativeModule,\n requireNativeViewManager,\n CodedError,\n} from 'expo-modules-core';\nimport * as React from 'react';\nimport { Platform, View, findNodeHandle } from 'react-native';\n\nimport { configureLogging } from './GLUtils';\nimport {\n ComponentOrHandle,\n SurfaceCreateEvent,\n GLSnapshot,\n ExpoWebGLRenderingContext,\n SnapshotOptions,\n GLViewProps,\n} from './GLView.types';\nimport { createWorkletContextManager } from './GLWorkletContextManager';\n\n// @docsMissing\nexport type WebGLObject = {\n id: number;\n};\n\ndeclare let global: any;\n\nconst GLNativeModule = requireNativeModule('ExpoGL');\nconst NativeView = requireNativeViewManager('ExpoGL');\nconst workletContextManager = createWorkletContextManager();\n\nexport function getWorkletContext(contextId: number): ExpoWebGLRenderingContext | undefined {\n 'worklet';\n return workletContextManager.getContext(contextId);\n}\n\n// @needsAudit\n/**\n * A View that acts as an OpenGL ES render target. On mounting, an OpenGL ES context is created.\n * Its drawing buffer is presented as the contents of the View every frame.\n */\nexport class GLView extends React.Component<GLViewProps> {\n static NativeView: any;\n\n static defaultProps = {\n msaaSamples: 4,\n enableExperimentalWorkletSupport: false,\n };\n\n /**\n * Imperative API that creates headless context which is devoid of underlying view.\n * It's useful for headless rendering or in case you want to keep just one context per application and share it between multiple components.\n * It is slightly faster than usual context as it doesn't swap framebuffers and doesn't present them on the canvas,\n * however it may require you to take a snapshot in order to present its results.\n * Also, keep in mind that you need to set up a viewport and create your own framebuffer and texture that you will be drawing to, before you take a snapshot.\n * @return A promise that resolves to WebGL context object. See [WebGL API](#webgl-api) for more details.\n */\n static async createContextAsync(): Promise<ExpoWebGLRenderingContext> {\n const { exglCtxId } = await GLNativeModule.createContextAsync();\n return getGl(exglCtxId);\n }\n\n /**\n * Destroys given context.\n * @param exgl WebGL context to destroy.\n * @return A promise that resolves to boolean value that is `true` if given context existed and has been destroyed successfully.\n */\n static async destroyContextAsync(exgl?: ExpoWebGLRenderingContext | number): Promise<boolean> {\n const exglCtxId = getContextId(exgl);\n unregisterGLContext(exglCtxId);\n return GLNativeModule.destroyContextAsync(exglCtxId);\n }\n\n /**\n * Takes a snapshot of the framebuffer and saves it as a file to app's cache directory.\n * @param exgl WebGL context to take a snapshot from.\n * @param options\n * @return A promise that resolves to `GLSnapshot` object.\n */\n static async takeSnapshotAsync(\n exgl?: ExpoWebGLRenderingContext | number,\n options: SnapshotOptions = {}\n ): Promise<GLSnapshot> {\n const exglCtxId = getContextId(exgl);\n return GLNativeModule.takeSnapshotAsync(exglCtxId, options);\n }\n\n /**\n * This method doesn't work inside of the worklets with new reanimated versions.\n * @deprecated Use `getWorkletContext` from the global scope instead.\n */\n static getWorkletContext: (contextId: number) => ExpoWebGLRenderingContext | undefined =\n workletContextManager.getContext;\n\n nativeRef: ComponentOrHandle = null;\n exglCtxId?: number;\n\n render() {\n const { onContextCreate, msaaSamples, enableExperimentalWorkletSupport, ...viewProps } =\n this.props;\n\n return (\n <View {...viewProps}>\n <NativeView\n ref={this._setNativeRef}\n style={{\n flex: 1,\n ...(Platform.OS === 'ios'\n ? {\n backgroundColor: 'transparent',\n }\n : {}),\n }}\n onSurfaceCreate={this._onSurfaceCreate}\n enableExperimentalWorkletSupport={enableExperimentalWorkletSupport}\n msaaSamples={Platform.OS === 'ios' ? msaaSamples : undefined}\n />\n </View>\n );\n }\n\n _setNativeRef = (nativeRef: ComponentOrHandle): void => {\n if (this.props.nativeRef_EXPERIMENTAL) {\n this.props.nativeRef_EXPERIMENTAL(nativeRef);\n }\n this.nativeRef = nativeRef;\n };\n\n _onSurfaceCreate = ({ nativeEvent: { exglCtxId } }: SurfaceCreateEvent): void => {\n const gl = getGl(exglCtxId);\n\n this.exglCtxId = exglCtxId;\n\n if (this.props.onContextCreate) {\n this.props.onContextCreate(gl);\n }\n };\n\n componentWillUnmount(): void {\n if (this.exglCtxId) {\n unregisterGLContext(this.exglCtxId);\n }\n }\n\n componentDidUpdate(prevProps: GLViewProps): void {\n if (\n this.props.enableExperimentalWorkletSupport !== prevProps.enableExperimentalWorkletSupport\n ) {\n console.warn('Updating prop enableExperimentalWorkletSupport is not supported');\n }\n }\n\n // @docsMissing\n async createCameraTextureAsync(cameraRefOrHandle: ComponentOrHandle): Promise<WebGLTexture> {\n if (!GLNativeModule.createCameraTextureAsync) {\n throw new UnavailabilityError('expo-gl', 'createCameraTextureAsync');\n }\n\n const { exglCtxId } = this;\n\n if (!exglCtxId) {\n throw new Error(\"GLView's surface is not created yet!\");\n }\n\n const cameraTag = findNodeHandle(cameraRefOrHandle);\n const { exglObjId } = await GLNativeModule.createCameraTextureAsync(exglCtxId, cameraTag);\n return { id: exglObjId } as WebGLTexture;\n }\n\n // @docsMissing\n async destroyObjectAsync(glObject: WebGLObject): Promise<boolean> {\n if (!GLNativeModule.destroyObjectAsync) {\n throw new UnavailabilityError('expo-gl', 'destroyObjectAsync');\n }\n return await GLNativeModule.destroyObjectAsync(glObject.id);\n }\n\n /**\n * Same as static [`takeSnapshotAsync()`](#takesnapshotasyncoptions),\n * but uses WebGL context that is associated with the view on which the method is called.\n * @param options\n */\n async takeSnapshotAsync(options: SnapshotOptions = {}): Promise<GLSnapshot> {\n if (!GLView.takeSnapshotAsync) {\n throw new UnavailabilityError('expo-gl', 'takeSnapshotAsync');\n }\n const { exglCtxId } = this;\n return await GLView.takeSnapshotAsync(exglCtxId, options);\n }\n}\n\nGLView.NativeView = NativeView;\n\nfunction unregisterGLContext(exglCtxId: number) {\n if (global.__EXGLContexts) {\n delete global.__EXGLContexts[String(exglCtxId)];\n }\n workletContextManager.unregister?.(exglCtxId);\n}\n\n// Get the GL interface from an EXGLContextId\nconst getGl = (exglCtxId: number): ExpoWebGLRenderingContext => {\n if (!global.__EXGLContexts) {\n throw new CodedError(\n 'ERR_GL_NOT_AVAILABLE',\n 'GL is currently not available. (Have you enabled remote debugging? GL is not available while debugging remotely.)'\n );\n }\n const gl = global.__EXGLContexts[String(exglCtxId)];\n\n configureLogging(gl);\n\n return gl;\n};\n\nconst getContextId = (exgl?: ExpoWebGLRenderingContext | number): number => {\n const exglCtxId = exgl && typeof exgl === 'object' ? exgl.contextId : exgl;\n\n if (!exglCtxId || typeof exglCtxId !== 'number') {\n throw new Error(`Invalid EXGLContext id: ${String(exglCtxId)}`);\n }\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CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC;AAED,6CAA6C;AAC7C,MAAM,KAAK,GAAG,CAAC,SAAiB,EAA6B,EAAE;IAC7D,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QAC3B,MAAM,IAAI,UAAU,CAClB,sBAAsB,EACtB,mHAAmH,CACpH,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAEpD,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAErB,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,IAAyC,EAAU,EAAE;IACzE,MAAM,SAAS,GAAG,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IAE3E,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import {\n NativeModulesProxy,\n UnavailabilityError,\n requireNativeModule,\n requireNativeViewManager,\n CodedError,\n} from 'expo-modules-core';\nimport * as React from 'react';\nimport { Platform, View, findNodeHandle } from 'react-native';\n\nimport { configureLogging } from './GLUtils';\nimport {\n ComponentOrHandle,\n SurfaceCreateEvent,\n GLSnapshot,\n ExpoWebGLRenderingContext,\n SnapshotOptions,\n GLViewProps,\n} from './GLView.types';\nimport { createWorkletContextManager } from './GLWorkletContextManager';\n\n// @docsMissing\nexport type WebGLObject = {\n id: number;\n};\n\ndeclare let global: any;\n\nconst ExponentGLObjectManager = requireNativeModule('ExponentGLObjectManager');\nconst { ExponentGLViewManager } = NativeModulesProxy;\n\nconst NativeView = requireNativeViewManager('ExponentGLView');\nconst workletContextManager = createWorkletContextManager();\n\nexport function getWorkletContext(contextId: number): ExpoWebGLRenderingContext | undefined {\n 'worklet';\n return workletContextManager.getContext(contextId);\n}\n\n// @needsAudit\n/**\n * A View that acts as an OpenGL ES render target. On mounting, an OpenGL ES context is created.\n * Its drawing buffer is presented as the contents of the View every frame.\n */\nexport class GLView extends React.Component<GLViewProps> {\n static NativeView: any;\n\n static defaultProps = {\n msaaSamples: 4,\n enableExperimentalWorkletSupport: false,\n };\n\n /**\n * Imperative API that creates headless context which is devoid of underlying view.\n * It's useful for headless rendering or in case you want to keep just one context per application and share it between multiple components.\n * It is slightly faster than usual context as it doesn't swap framebuffers and doesn't present them on the canvas,\n * however it may require you to take a snapshot in order to present its results.\n * Also, keep in mind that you need to set up a viewport and create your own framebuffer and texture that you will be drawing to, before you take a snapshot.\n * @return A promise that resolves to WebGL context object. See [WebGL API](#webgl-api) for more details.\n */\n static async createContextAsync(): Promise<ExpoWebGLRenderingContext> {\n const { exglCtxId } = await ExponentGLObjectManager.createContextAsync();\n return getGl(exglCtxId);\n }\n\n /**\n * Destroys given context.\n * @param exgl WebGL context to destroy.\n * @return A promise that resolves to boolean value that is `true` if given context existed and has been destroyed successfully.\n */\n static async destroyContextAsync(exgl?: ExpoWebGLRenderingContext | number): Promise<boolean> {\n const exglCtxId = getContextId(exgl);\n unregisterGLContext(exglCtxId);\n return ExponentGLObjectManager.destroyContextAsync(exglCtxId);\n }\n\n /**\n * Takes a snapshot of the framebuffer and saves it as a file to app's cache directory.\n * @param exgl WebGL context to take a snapshot from.\n * @param options\n * @return A promise that resolves to `GLSnapshot` object.\n */\n static async takeSnapshotAsync(\n exgl?: ExpoWebGLRenderingContext | number,\n options: SnapshotOptions = {}\n ): Promise<GLSnapshot> {\n const exglCtxId = getContextId(exgl);\n return ExponentGLObjectManager.takeSnapshotAsync(exglCtxId, options);\n }\n\n /**\n * This method doesn't work inside of the worklets with new reanimated versions.\n * @deprecated Use `getWorkletContext` from the global scope instead.\n */\n static getWorkletContext: (contextId: number) => ExpoWebGLRenderingContext | undefined =\n workletContextManager.getContext;\n\n nativeRef: ComponentOrHandle = null;\n exglCtxId?: number;\n\n render() {\n const { onContextCreate, msaaSamples, enableExperimentalWorkletSupport, ...viewProps } =\n this.props;\n\n return (\n <View {...viewProps}>\n <NativeView\n ref={this._setNativeRef}\n style={{\n flex: 1,\n ...(Platform.OS === 'ios'\n ? {\n backgroundColor: 'transparent',\n }\n : {}),\n }}\n onSurfaceCreate={this._onSurfaceCreate}\n enableExperimentalWorkletSupport={enableExperimentalWorkletSupport}\n msaaSamples={Platform.OS === 'ios' ? msaaSamples : undefined}\n />\n </View>\n );\n }\n\n _setNativeRef = (nativeRef: ComponentOrHandle): void => {\n if (this.props.nativeRef_EXPERIMENTAL) {\n this.props.nativeRef_EXPERIMENTAL(nativeRef);\n }\n this.nativeRef = nativeRef;\n };\n\n _onSurfaceCreate = ({ nativeEvent: { exglCtxId } }: SurfaceCreateEvent): void => {\n const gl = getGl(exglCtxId);\n\n this.exglCtxId = exglCtxId;\n\n if (this.props.onContextCreate) {\n this.props.onContextCreate(gl);\n }\n };\n\n componentWillUnmount(): void {\n if (this.exglCtxId) {\n unregisterGLContext(this.exglCtxId);\n }\n }\n\n componentDidUpdate(prevProps: GLViewProps): void {\n if (\n this.props.enableExperimentalWorkletSupport !== prevProps.enableExperimentalWorkletSupport\n ) {\n console.warn('Updating prop enableExperimentalWorkletSupport is not supported');\n }\n }\n\n // @docsMissing\n async startARSessionAsync(): Promise<any> {\n if (!ExponentGLViewManager.startARSessionAsync) {\n throw new UnavailabilityError('expo-gl', 'startARSessionAsync');\n }\n return await ExponentGLViewManager.startARSessionAsync(findNodeHandle(this.nativeRef));\n }\n\n // @docsMissing\n async createCameraTextureAsync(cameraRefOrHandle: ComponentOrHandle): Promise<WebGLTexture> {\n if (!ExponentGLObjectManager.createCameraTextureAsync) {\n throw new UnavailabilityError('expo-gl', 'createCameraTextureAsync');\n }\n\n const { exglCtxId } = this;\n\n if (!exglCtxId) {\n throw new Error(\"GLView's surface is not created yet!\");\n }\n\n const cameraTag = findNodeHandle(cameraRefOrHandle);\n const { exglObjId } = await ExponentGLObjectManager.createCameraTextureAsync(\n exglCtxId,\n cameraTag\n );\n return { id: exglObjId } as WebGLTexture;\n }\n\n // @docsMissing\n async destroyObjectAsync(glObject: WebGLObject): Promise<boolean> {\n if (!ExponentGLObjectManager.destroyObjectAsync) {\n throw new UnavailabilityError('expo-gl', 'destroyObjectAsync');\n }\n return await ExponentGLObjectManager.destroyObjectAsync(glObject.id);\n }\n\n /**\n * Same as static [`takeSnapshotAsync()`](#takesnapshotasyncoptions),\n * but uses WebGL context that is associated with the view on which the method is called.\n * @param options\n */\n async takeSnapshotAsync(options: SnapshotOptions = {}): Promise<GLSnapshot> {\n if (!GLView.takeSnapshotAsync) {\n throw new UnavailabilityError('expo-gl', 'takeSnapshotAsync');\n }\n const { exglCtxId } = this;\n return await GLView.takeSnapshotAsync(exglCtxId, options);\n }\n}\n\nGLView.NativeView = NativeView;\n\nfunction unregisterGLContext(exglCtxId: number) {\n if (global.__EXGLContexts) {\n delete global.__EXGLContexts[String(exglCtxId)];\n }\n workletContextManager.unregister?.(exglCtxId);\n}\n\n// Get the GL interface from an EXGLContextId\nconst getGl = (exglCtxId: number): ExpoWebGLRenderingContext => {\n if (!global.__EXGLContexts) {\n throw new CodedError(\n 'ERR_GL_NOT_AVAILABLE',\n 'GL is currently not available. (Have you enabled remote debugging? GL is not available while debugging remotely.)'\n );\n }\n const gl = global.__EXGLContexts[String(exglCtxId)];\n\n configureLogging(gl);\n\n return gl;\n};\n\nconst getContextId = (exgl?: ExpoWebGLRenderingContext | number): number => {\n const exglCtxId = exgl && typeof exgl === 'object' ? exgl.contextId : exgl;\n\n if (!exglCtxId || typeof exglCtxId !== 'number') {\n throw new Error(`Invalid EXGLContext id: ${String(exglCtxId)}`);\n }\n return exglCtxId;\n};\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"platforms": ["apple", "android"],
|
|
3
3
|
"apple": {
|
|
4
4
|
"podspecPath": "./ExpoGL.podspec",
|
|
5
|
-
"modules": ["
|
|
5
|
+
"modules": ["GLViewModule"]
|
|
6
6
|
},
|
|
7
7
|
"android": {
|
|
8
|
-
"modules": ["expo.modules.gl.
|
|
8
|
+
"modules": ["expo.modules.gl.GLViewModule", "expo.modules.gl.GLObjectManagerModule"],
|
|
9
9
|
"publication": {
|
|
10
10
|
"groupId": "host.exp.exponent",
|
|
11
11
|
"artifactId": "expo.modules.gl",
|
|
12
|
-
"version": "16.0.9
|
|
12
|
+
"version": "16.0.9",
|
|
13
13
|
"repository": "local-maven-repo"
|
|
14
14
|
}
|
|
15
15
|
}
|
package/ios/EXGLContext.mm
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
@property (nonatomic, strong) dispatch_queue_t glQueue;
|
|
19
19
|
@property (nonatomic, weak) EXModuleRegistry *moduleRegistry;
|
|
20
|
+
@property (nonatomic, weak) EXGLObjectManager *objectManager;
|
|
20
21
|
@property (nonatomic, assign) BOOL isContextReady;
|
|
21
22
|
@property (nonatomic, assign) BOOL wasPrepareCalled;
|
|
22
23
|
@property (nonatomic) BOOL appIsBackgrounded;
|
|
@@ -32,6 +33,7 @@
|
|
|
32
33
|
self.delegate = delegate;
|
|
33
34
|
|
|
34
35
|
_moduleRegistry = moduleRegistry;
|
|
36
|
+
_objectManager = (EXGLObjectManager *)[_moduleRegistry getExportedModuleOfClass:[EXGLObjectManager class]];
|
|
35
37
|
_glQueue = dispatch_queue_create("host.exp.gl", DISPATCH_QUEUE_SERIAL);
|
|
36
38
|
_eaglCtx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3] ?: [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
|
37
39
|
_isContextReady = NO;
|
|
@@ -73,7 +75,7 @@
|
|
|
73
75
|
- (void)initialize
|
|
74
76
|
{
|
|
75
77
|
self->_contextId = EXGLContextCreate();
|
|
76
|
-
[
|
|
78
|
+
[self->_objectManager saveContext:self];
|
|
77
79
|
|
|
78
80
|
// listen for foreground/background transitions
|
|
79
81
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
@@ -180,7 +182,7 @@
|
|
|
180
182
|
EXGLContextDestroy(self->_contextId);
|
|
181
183
|
|
|
182
184
|
// Remove from dictionary of contexts
|
|
183
|
-
[
|
|
185
|
+
[self->_objectManager deleteContextWithId:@(self->_contextId)];
|
|
184
186
|
}];
|
|
185
187
|
}];
|
|
186
188
|
}
|
package/ios/EXGLObjectManager.h
CHANGED
|
@@ -1,30 +1,17 @@
|
|
|
1
1
|
// Copyright 2016-present 650 Industries. All rights reserved.
|
|
2
2
|
|
|
3
|
-
#import <ExpoModulesCore/
|
|
3
|
+
#import <ExpoModulesCore/EXExportedModule.h>
|
|
4
|
+
#import <ExpoModulesCore/EXModuleRegistryConsumer.h>
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
#import <ExpoModulesCore/EXUIManager.h>
|
|
7
|
+
#import <ExpoModulesCore/EXFileSystemInterface.h>
|
|
6
8
|
|
|
7
|
-
@
|
|
9
|
+
@interface EXGLObjectManager : EXExportedModule <EXModuleRegistryConsumer>
|
|
10
|
+
|
|
11
|
+
@property (nonatomic, weak, nullable) id<EXUIManager> uiManager;
|
|
12
|
+
@property (nonatomic, weak, nullable) id<EXFileSystemInterface> fileSystem;
|
|
8
13
|
|
|
9
14
|
- (void)saveContext:(nonnull id)glContext;
|
|
10
15
|
- (void)deleteContextWithId:(nonnull NSNumber *)contextId;
|
|
11
16
|
|
|
12
|
-
- (void)takeSnapshotWithContextId:(nonnull NSNumber *)exglCtxId
|
|
13
|
-
andOptions:(nonnull NSDictionary *)options
|
|
14
|
-
resolver:(nonnull EXPromiseResolveBlock)resolve
|
|
15
|
-
rejecter:(nonnull EXPromiseRejectBlock)reject;
|
|
16
|
-
|
|
17
|
-
- (void)destroyContextWithId:(nonnull NSNumber *)exglCtxId
|
|
18
|
-
resolve:(nonnull EXPromiseResolveBlock)resolve
|
|
19
|
-
reject:(nonnull EXPromiseRejectBlock)reject;
|
|
20
|
-
|
|
21
|
-
- (void)destroyObjectAsync:(nonnull NSNumber *)exglObjId
|
|
22
|
-
resolve:(nonnull EXPromiseResolveBlock)resolve
|
|
23
|
-
reject:(nonnull EXPromiseRejectBlock)reject;
|
|
24
|
-
|
|
25
|
-
- (void)createTextureForContextWithId:(nonnull NSNumber *)exglCtxId
|
|
26
|
-
cameraView:(nonnull id<EXCameraInterface>)cameraView
|
|
27
|
-
resolver:(nonnull EXPromiseResolveBlock)resolve
|
|
28
|
-
rejecter:(nonnull EXPromiseRejectBlock)reject;
|
|
29
|
-
|
|
30
17
|
@end
|
package/ios/EXGLObjectManager.mm
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
#import <ExpoModulesCore/EXModuleRegistry.h>
|
|
4
4
|
#import <ExpoModulesCore/EXUIManager.h>
|
|
5
|
+
#import <ExpoModulesCore/EXCameraInterface.h>
|
|
5
6
|
|
|
6
7
|
#import <ExpoGL/EXGLObjectManager.h>
|
|
7
8
|
#import <ExpoGL/EXGLObject.h>
|
|
@@ -9,6 +10,7 @@
|
|
|
9
10
|
|
|
10
11
|
@interface EXGLObjectManager ()
|
|
11
12
|
|
|
13
|
+
@property (nonatomic, weak) EXModuleRegistry *moduleRegistry;
|
|
12
14
|
@property (nonatomic, strong) NSMutableDictionary<NSNumber *, EXGLContext *> *glContexts;
|
|
13
15
|
@property (nonatomic, strong) NSMutableDictionary<NSNumber *, EXGLObject *> *objects; // Key is `EXGLObjectId`
|
|
14
16
|
|
|
@@ -16,14 +18,11 @@
|
|
|
16
18
|
|
|
17
19
|
@implementation EXGLObjectManager
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
EX_REGISTER_MODULE();
|
|
22
|
+
|
|
23
|
+
+ (const NSString *)exportedModuleName
|
|
20
24
|
{
|
|
21
|
-
|
|
22
|
-
static dispatch_once_t onceToken;
|
|
23
|
-
dispatch_once(&onceToken, ^{
|
|
24
|
-
sharedInstance = [[EXGLObjectManager alloc] init];
|
|
25
|
-
});
|
|
26
|
-
return sharedInstance;
|
|
25
|
+
return @"ExponentGLObjectManager";
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
- (instancetype)init
|
|
@@ -35,6 +34,18 @@
|
|
|
35
34
|
return self;
|
|
36
35
|
}
|
|
37
36
|
|
|
37
|
+
- (dispatch_queue_t)methodQueue
|
|
38
|
+
{
|
|
39
|
+
return dispatch_queue_create("host.exp.exponent.GLObjectManager", DISPATCH_QUEUE_SERIAL);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
- (void)setModuleRegistry:(EXModuleRegistry *)moduleRegistry
|
|
43
|
+
{
|
|
44
|
+
_moduleRegistry = moduleRegistry;
|
|
45
|
+
_uiManager = [moduleRegistry getModuleImplementingProtocol:@protocol(EXUIManager)];
|
|
46
|
+
_fileSystem = [moduleRegistry getModuleImplementingProtocol:@protocol(EXFileSystemInterface)];
|
|
47
|
+
}
|
|
48
|
+
|
|
38
49
|
- (EXGLContext *)getContextWithId:(NSNumber *)contextId
|
|
39
50
|
{
|
|
40
51
|
return _glContexts[contextId];
|
|
@@ -62,10 +73,11 @@
|
|
|
62
73
|
|
|
63
74
|
# pragma mark - Snapshots
|
|
64
75
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
EX_EXPORT_METHOD_AS(takeSnapshotAsync,
|
|
77
|
+
takeSnapshotWithContextId:(nonnull NSNumber *)exglCtxId
|
|
78
|
+
andOptions:(nonnull NSDictionary *)options
|
|
79
|
+
resolver:(EXPromiseResolveBlock)resolve
|
|
80
|
+
rejecter:(EXPromiseRejectBlock)reject)
|
|
69
81
|
{
|
|
70
82
|
EXGLContext *glContext = [self getContextWithId:exglCtxId];
|
|
71
83
|
|
|
@@ -77,9 +89,32 @@
|
|
|
77
89
|
[glContext takeSnapshotWithOptions:options resolve:resolve reject:reject];
|
|
78
90
|
}
|
|
79
91
|
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
|
|
92
|
+
# pragma mark - Headless Context
|
|
93
|
+
|
|
94
|
+
EX_EXPORT_METHOD_AS(createContextAsync,
|
|
95
|
+
createContext:(EXPromiseResolveBlock)resolve
|
|
96
|
+
reject:(EXPromiseRejectBlock)reject)
|
|
97
|
+
{
|
|
98
|
+
EXGLContext *glContext = [[EXGLContext alloc] initWithDelegate:nil
|
|
99
|
+
andModuleRegistry:_moduleRegistry];
|
|
100
|
+
|
|
101
|
+
[glContext prepare:^(BOOL success) {
|
|
102
|
+
if (success) {
|
|
103
|
+
resolve(@{ @"exglCtxId": @(glContext.contextId) });
|
|
104
|
+
} else {
|
|
105
|
+
reject(
|
|
106
|
+
@"E_GL_CONTEXT_NOT_INITIALIZED",
|
|
107
|
+
nil,
|
|
108
|
+
EXErrorWithMessage(@"ExponentGLObjectManager.createContextAsync: Unexpected error occurred when initializing headless context")
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
} andEnableExperimentalWorkletSupport:NO];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
EX_EXPORT_METHOD_AS(destroyContextAsync,
|
|
115
|
+
destroyContextWithId:(nonnull NSNumber *)exglCtxId
|
|
116
|
+
resolve:(EXPromiseResolveBlock)resolve
|
|
117
|
+
reject:(EXPromiseRejectBlock)reject)
|
|
83
118
|
{
|
|
84
119
|
EXGLContext *glContext = [self getContextWithId:exglCtxId];
|
|
85
120
|
|
|
@@ -93,30 +128,39 @@
|
|
|
93
128
|
|
|
94
129
|
# pragma mark - Camera integration
|
|
95
130
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
131
|
+
EX_EXPORT_METHOD_AS(destroyObjectAsync,
|
|
132
|
+
destroyObjectAsync:(nonnull NSNumber *)exglObjId
|
|
133
|
+
resolve:(EXPromiseResolveBlock)resolve
|
|
134
|
+
reject:(EXPromiseRejectBlock)reject)
|
|
99
135
|
{
|
|
100
136
|
_objects[exglObjId] = nil;
|
|
101
137
|
resolve(@(YES));
|
|
102
138
|
}
|
|
103
139
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
140
|
+
EX_EXPORT_METHOD_AS(createCameraTextureAsync,
|
|
141
|
+
createTextureForContextWithId:(nonnull NSNumber *)exglCtxId
|
|
142
|
+
andCameraWithReactTag:(nonnull NSNumber *)cameraViewTag
|
|
143
|
+
resolver:(EXPromiseResolveBlock)resolve
|
|
144
|
+
rejecter:(EXPromiseRejectBlock)reject)
|
|
108
145
|
{
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
146
|
+
[_uiManager executeUIBlock:^(id view) {
|
|
147
|
+
EXGLContext *glContext = [self getContextWithId:exglCtxId];
|
|
148
|
+
id<EXCameraInterface> cameraView = (id<EXCameraInterface>)view;
|
|
149
|
+
|
|
150
|
+
if (glContext == nil) {
|
|
151
|
+
reject(@"E_GL_BAD_VIEW_TAG", nil, EXErrorWithMessage(@"ExponentGLObjectManager.createCameraTextureAsync: Expected a GLView"));
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (cameraView == nil) {
|
|
155
|
+
reject(@"E_GL_BAD_CAMERA_VIEW_TAG", nil, EXErrorWithMessage(@"ExponentGLObjectManager.createCameraTextureAsync: Expected an EXCamera"));
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
EXGLCameraObject *cameraTexture = [[EXGLCameraObject alloc] initWithContext:glContext andCamera:cameraView];
|
|
160
|
+
|
|
161
|
+
self->_objects[@(cameraTexture.exglObjId)] = cameraTexture;
|
|
162
|
+
resolve(@{ @"exglObjId": @(cameraTexture.exglObjId) });
|
|
163
|
+
} forView:cameraViewTag implementingProtocol:@protocol(EXCameraInterface)];
|
|
120
164
|
}
|
|
121
165
|
|
|
122
166
|
@end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
import ExpoModulesCore
|
|
4
|
+
|
|
5
|
+
public final class GLViewModule: Module {
|
|
6
|
+
public func definition() -> ModuleDefinition {
|
|
7
|
+
Name("ExponentGLView")
|
|
8
|
+
|
|
9
|
+
View(GLView.self) {
|
|
10
|
+
Events("onSurfaceCreate")
|
|
11
|
+
|
|
12
|
+
Prop("msaaSamples") { (view, msaaSamples: Int) in
|
|
13
|
+
view.msaaSamples = msaaSamples
|
|
14
|
+
}
|
|
15
|
+
Prop("enableExperimentalWorkletSupport") { (view, enableExperimentalWorkletSupport: Bool) in
|
|
16
|
+
view.enableExperimentalWorkletSupport = enableExperimentalWorkletSupport
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9-sources.jar
ADDED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
06e25696d702c60602274564533d18bc
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
9320c91f795454db182a73ea736fbe26dfdebd04
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e8892c6837d1eb5093b2c3b063883d7511799b0e246940c5b70f1515cb4451cd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1cab724074b050f7459a884ac9e98fbf2d009d8239810ca6384c5113f52dd33e5ac40a72ec7174b297e1b10521e56682d73f533715316be5be66ce0e482356d8
|
|
Binary file
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.aar.md5
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1abb98e8610bb2a7f4cb1d021734c3df
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.aar.sha1
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
deabe400ff5b72247c57f082599a72f70cc4695f
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.aar.sha256
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8186fb60e412173d54765cf18008aae25e6463fd459bf6b3f992a60d13b535a8
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.aar.sha512
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ef9e2bc8440d401eaa7e5f2050b895e0567c88cf481d0dbf7f5c89a55ed9398697791a2571605b4bc7dfa338059ed7cb9939857f851cb6c25a810faa64e2cee4
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.module
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"formatVersion": "1.1",
|
|
3
|
+
"component": {
|
|
4
|
+
"group": "host.exp.exponent",
|
|
5
|
+
"module": "expo.modules.gl",
|
|
6
|
+
"version": "16.0.9",
|
|
7
|
+
"attributes": {
|
|
8
|
+
"org.gradle.status": "release"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"createdBy": {
|
|
12
|
+
"gradle": {
|
|
13
|
+
"version": "8.14.3"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"variants": [
|
|
17
|
+
{
|
|
18
|
+
"name": "releaseVariantReleaseApiPublication",
|
|
19
|
+
"attributes": {
|
|
20
|
+
"org.gradle.category": "library",
|
|
21
|
+
"org.gradle.dependency.bundling": "external",
|
|
22
|
+
"org.gradle.libraryelements": "aar",
|
|
23
|
+
"org.gradle.usage": "java-api"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
{
|
|
27
|
+
"name": "expo.modules.gl-16.0.9.aar",
|
|
28
|
+
"url": "expo.modules.gl-16.0.9.aar",
|
|
29
|
+
"size": 983793,
|
|
30
|
+
"sha512": "ef9e2bc8440d401eaa7e5f2050b895e0567c88cf481d0dbf7f5c89a55ed9398697791a2571605b4bc7dfa338059ed7cb9939857f851cb6c25a810faa64e2cee4",
|
|
31
|
+
"sha256": "8186fb60e412173d54765cf18008aae25e6463fd459bf6b3f992a60d13b535a8",
|
|
32
|
+
"sha1": "deabe400ff5b72247c57f082599a72f70cc4695f",
|
|
33
|
+
"md5": "1abb98e8610bb2a7f4cb1d021734c3df"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "releaseVariantReleaseRuntimePublication",
|
|
39
|
+
"attributes": {
|
|
40
|
+
"org.gradle.category": "library",
|
|
41
|
+
"org.gradle.dependency.bundling": "external",
|
|
42
|
+
"org.gradle.libraryelements": "aar",
|
|
43
|
+
"org.gradle.usage": "java-runtime"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": [
|
|
46
|
+
{
|
|
47
|
+
"group": "org.jetbrains.kotlin",
|
|
48
|
+
"module": "kotlin-stdlib-jdk7",
|
|
49
|
+
"version": {
|
|
50
|
+
"requires": "2.1.20"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"files": [
|
|
55
|
+
{
|
|
56
|
+
"name": "expo.modules.gl-16.0.9.aar",
|
|
57
|
+
"url": "expo.modules.gl-16.0.9.aar",
|
|
58
|
+
"size": 983793,
|
|
59
|
+
"sha512": "ef9e2bc8440d401eaa7e5f2050b895e0567c88cf481d0dbf7f5c89a55ed9398697791a2571605b4bc7dfa338059ed7cb9939857f851cb6c25a810faa64e2cee4",
|
|
60
|
+
"sha256": "8186fb60e412173d54765cf18008aae25e6463fd459bf6b3f992a60d13b535a8",
|
|
61
|
+
"sha1": "deabe400ff5b72247c57f082599a72f70cc4695f",
|
|
62
|
+
"md5": "1abb98e8610bb2a7f4cb1d021734c3df"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "releaseVariantReleaseSourcePublication",
|
|
68
|
+
"attributes": {
|
|
69
|
+
"org.gradle.category": "documentation",
|
|
70
|
+
"org.gradle.dependency.bundling": "external",
|
|
71
|
+
"org.gradle.docstype": "sources",
|
|
72
|
+
"org.gradle.usage": "java-runtime"
|
|
73
|
+
},
|
|
74
|
+
"files": [
|
|
75
|
+
{
|
|
76
|
+
"name": "expo.modules.gl-16.0.9-sources.jar",
|
|
77
|
+
"url": "expo.modules.gl-16.0.9-sources.jar",
|
|
78
|
+
"size": 12381,
|
|
79
|
+
"sha512": "1cab724074b050f7459a884ac9e98fbf2d009d8239810ca6384c5113f52dd33e5ac40a72ec7174b297e1b10521e56682d73f533715316be5be66ce0e482356d8",
|
|
80
|
+
"sha256": "e8892c6837d1eb5093b2c3b063883d7511799b0e246940c5b70f1515cb4451cd",
|
|
81
|
+
"sha1": "9320c91f795454db182a73ea736fbe26dfdebd04",
|
|
82
|
+
"md5": "06e25696d702c60602274564533d18bc"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.module.md5
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
870fd4c2a1f63d4d7b22118ff279e832
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.module.sha1
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a5bc89efdeade18be47933a32a50515acf86253c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ff1a7de26e559d44cbadc9b58889a4cf3d4e81be8992cacf02fe9632ebf7c6e2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a6fd85d62d58dde758c649e991ebac36bd501bbbdda551d16b0e93567ee98ccd7196a68daef8db320ffcee5fc8fd485428bc5b5835a9d11323d46c4835c7bdd4
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>host.exp.exponent</groupId>
|
|
11
11
|
<artifactId>expo.modules.gl</artifactId>
|
|
12
|
-
<version>16.0.9
|
|
12
|
+
<version>16.0.9</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.gl</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.pom.md5
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a16f5e495f2d464b62f559b35400ae9a
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.pom.sha1
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d752d256bfe116a2ed0e4b45948c0b80c9a562fa
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.pom.sha256
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cc5421f7ad9fc42605ccdcf90141bd11270eaabf270432723bbac19f6f09a17a
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/16.0.9/expo.modules.gl-16.0.9.pom.sha512
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d42f95c845d5ab14b8213c69d7cb9beae2b6d45eb9ec889622b2dab754ff1a14769a09d5b215dce506d43d562cc207253c909a372a29d862f2e07920a05b0b0a
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>host.exp.exponent</groupId>
|
|
4
4
|
<artifactId>expo.modules.gl</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>16.0.9
|
|
7
|
-
<release>16.0.9
|
|
6
|
+
<latest>16.0.9</latest>
|
|
7
|
+
<release>16.0.9</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>16.0.9
|
|
9
|
+
<version>16.0.9</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20251211203626</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
535ced1de5f1cdf7f9cbf78bfb15d9c0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4bf8a1b7b026a674fceb50ebed59e7fe9bf2c063
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
22da90bd303ad785a1d3455f681a7c0156de4d39c43d84ea7df4da8c020869ce
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
41fb83d533938074517c246639821386750b3fc8604618549e52167c8fda7676be40fca9dcc8e87eb44a86de4378598bd23391dc98b6268c1e7859a5f7e2a69e
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-gl",
|
|
3
|
-
"version": "16.0.9
|
|
3
|
+
"version": "16.0.9",
|
|
4
4
|
"description": "Provides GLView that acts as OpenGL ES render target and gives GL context object implementing WebGL 2.0 specification.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@types/invariant": "^2.2.33",
|
|
44
44
|
"@types/offscreencanvas": "2019.6.4",
|
|
45
45
|
"@types/webgl2": "^0.0.6",
|
|
46
|
-
"expo-module-scripts": "5.
|
|
47
|
-
"react-test-renderer": "19.
|
|
46
|
+
"expo-module-scripts": "^5.0.8",
|
|
47
|
+
"react-test-renderer": "19.1.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"expo": "
|
|
50
|
+
"expo": "*",
|
|
51
51
|
"react": "*",
|
|
52
52
|
"react-dom": "*",
|
|
53
53
|
"react-native": "*",
|
|
@@ -64,5 +64,6 @@
|
|
|
64
64
|
"react-native-web": {
|
|
65
65
|
"optional": true
|
|
66
66
|
}
|
|
67
|
-
}
|
|
67
|
+
},
|
|
68
|
+
"gitHead": "b6d1de9d53724e311e417c51dd0a9f9bee1c040d"
|
|
68
69
|
}
|
package/src/GLView.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
NativeModulesProxy,
|
|
2
3
|
UnavailabilityError,
|
|
3
4
|
requireNativeModule,
|
|
4
5
|
requireNativeViewManager,
|
|
@@ -25,8 +26,10 @@ export type WebGLObject = {
|
|
|
25
26
|
|
|
26
27
|
declare let global: any;
|
|
27
28
|
|
|
28
|
-
const
|
|
29
|
-
const
|
|
29
|
+
const ExponentGLObjectManager = requireNativeModule('ExponentGLObjectManager');
|
|
30
|
+
const { ExponentGLViewManager } = NativeModulesProxy;
|
|
31
|
+
|
|
32
|
+
const NativeView = requireNativeViewManager('ExponentGLView');
|
|
30
33
|
const workletContextManager = createWorkletContextManager();
|
|
31
34
|
|
|
32
35
|
export function getWorkletContext(contextId: number): ExpoWebGLRenderingContext | undefined {
|
|
@@ -56,7 +59,7 @@ export class GLView extends React.Component<GLViewProps> {
|
|
|
56
59
|
* @return A promise that resolves to WebGL context object. See [WebGL API](#webgl-api) for more details.
|
|
57
60
|
*/
|
|
58
61
|
static async createContextAsync(): Promise<ExpoWebGLRenderingContext> {
|
|
59
|
-
const { exglCtxId } = await
|
|
62
|
+
const { exglCtxId } = await ExponentGLObjectManager.createContextAsync();
|
|
60
63
|
return getGl(exglCtxId);
|
|
61
64
|
}
|
|
62
65
|
|
|
@@ -68,7 +71,7 @@ export class GLView extends React.Component<GLViewProps> {
|
|
|
68
71
|
static async destroyContextAsync(exgl?: ExpoWebGLRenderingContext | number): Promise<boolean> {
|
|
69
72
|
const exglCtxId = getContextId(exgl);
|
|
70
73
|
unregisterGLContext(exglCtxId);
|
|
71
|
-
return
|
|
74
|
+
return ExponentGLObjectManager.destroyContextAsync(exglCtxId);
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
/**
|
|
@@ -82,7 +85,7 @@ export class GLView extends React.Component<GLViewProps> {
|
|
|
82
85
|
options: SnapshotOptions = {}
|
|
83
86
|
): Promise<GLSnapshot> {
|
|
84
87
|
const exglCtxId = getContextId(exgl);
|
|
85
|
-
return
|
|
88
|
+
return ExponentGLObjectManager.takeSnapshotAsync(exglCtxId, options);
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
/**
|
|
@@ -150,9 +153,17 @@ export class GLView extends React.Component<GLViewProps> {
|
|
|
150
153
|
}
|
|
151
154
|
}
|
|
152
155
|
|
|
156
|
+
// @docsMissing
|
|
157
|
+
async startARSessionAsync(): Promise<any> {
|
|
158
|
+
if (!ExponentGLViewManager.startARSessionAsync) {
|
|
159
|
+
throw new UnavailabilityError('expo-gl', 'startARSessionAsync');
|
|
160
|
+
}
|
|
161
|
+
return await ExponentGLViewManager.startARSessionAsync(findNodeHandle(this.nativeRef));
|
|
162
|
+
}
|
|
163
|
+
|
|
153
164
|
// @docsMissing
|
|
154
165
|
async createCameraTextureAsync(cameraRefOrHandle: ComponentOrHandle): Promise<WebGLTexture> {
|
|
155
|
-
if (!
|
|
166
|
+
if (!ExponentGLObjectManager.createCameraTextureAsync) {
|
|
156
167
|
throw new UnavailabilityError('expo-gl', 'createCameraTextureAsync');
|
|
157
168
|
}
|
|
158
169
|
|
|
@@ -163,16 +174,19 @@ export class GLView extends React.Component<GLViewProps> {
|
|
|
163
174
|
}
|
|
164
175
|
|
|
165
176
|
const cameraTag = findNodeHandle(cameraRefOrHandle);
|
|
166
|
-
const { exglObjId } = await
|
|
177
|
+
const { exglObjId } = await ExponentGLObjectManager.createCameraTextureAsync(
|
|
178
|
+
exglCtxId,
|
|
179
|
+
cameraTag
|
|
180
|
+
);
|
|
167
181
|
return { id: exglObjId } as WebGLTexture;
|
|
168
182
|
}
|
|
169
183
|
|
|
170
184
|
// @docsMissing
|
|
171
185
|
async destroyObjectAsync(glObject: WebGLObject): Promise<boolean> {
|
|
172
|
-
if (!
|
|
186
|
+
if (!ExponentGLObjectManager.destroyObjectAsync) {
|
|
173
187
|
throw new UnavailabilityError('expo-gl', 'destroyObjectAsync');
|
|
174
188
|
}
|
|
175
|
-
return await
|
|
189
|
+
return await ExponentGLObjectManager.destroyObjectAsync(glObject.id);
|
|
176
190
|
}
|
|
177
191
|
|
|
178
192
|
/**
|
package/ios/ExpoGLModule.swift
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
import ExpoModulesCore
|
|
4
|
-
|
|
5
|
-
public final class ExpoGLModule: Module {
|
|
6
|
-
public func definition() -> ModuleDefinition {
|
|
7
|
-
Name("ExpoGL")
|
|
8
|
-
|
|
9
|
-
AsyncFunction("takeSnapshotAsync") { (contextId: UInt, options: [String: Any], promise: Promise) in
|
|
10
|
-
EXGLObjectManager.shared.takeSnapshot(
|
|
11
|
-
withContextId: contextId as NSNumber,
|
|
12
|
-
andOptions: options,
|
|
13
|
-
resolver: promise.resolver,
|
|
14
|
-
rejecter: promise.legacyRejecter
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
AsyncFunction("createContextAsync") { (promise: Promise) in
|
|
19
|
-
guard let legacyModuleRegistry = appContext?.legacyModuleRegistry else {
|
|
20
|
-
promise.reject("E_GL_MODULE_REGISTRY_NOT_FOUND", "ExpoGL.createContextAsync: Unable to find the module registry")
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
let glContext = EXGLContext(delegate: nil, andModuleRegistry: legacyModuleRegistry)
|
|
24
|
-
|
|
25
|
-
glContext.prepare({ success in
|
|
26
|
-
if success {
|
|
27
|
-
promise.resolve(["exglCtxId": glContext.contextId as NSNumber])
|
|
28
|
-
} else {
|
|
29
|
-
promise.reject("E_GL_CONTEXT_NOT_INITIALIZED", "ExpoGL.createContextAsync: Unexpected error occurred when initializing headless context")
|
|
30
|
-
}
|
|
31
|
-
}, andEnableExperimentalWorkletSupport: false)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
AsyncFunction("destroyContextAsync") { (contextId: UInt, promise: Promise) in
|
|
35
|
-
EXGLObjectManager.shared.destroyContext(
|
|
36
|
-
withId: contextId as NSNumber,
|
|
37
|
-
resolve: promise.resolver,
|
|
38
|
-
reject: promise.legacyRejecter
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
AsyncFunction("destroyObjectAsync") { (objectId: UInt, promise: Promise) in
|
|
43
|
-
EXGLObjectManager.shared.destroyObjectAsync(
|
|
44
|
-
objectId as NSNumber,
|
|
45
|
-
resolve: promise.resolver,
|
|
46
|
-
reject: promise.legacyRejecter
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
AsyncFunction("createCameraTextureAsync") { (contextId: UInt, cameraViewTag: Int, promise: Promise) in
|
|
51
|
-
guard let cameraView = appContext?.findView(withTag: cameraViewTag, ofType: EXCameraInterface.self) else {
|
|
52
|
-
promise.reject("E_GL_BAD_CAMERA_VIEW_TAG", "ExpoGL.createCameraTextureAsync: Expected a camera view")
|
|
53
|
-
return
|
|
54
|
-
}
|
|
55
|
-
EXGLObjectManager.shared.createTextureForContext(
|
|
56
|
-
withId: contextId as NSNumber,
|
|
57
|
-
cameraView: cameraView,
|
|
58
|
-
resolver: promise.resolver,
|
|
59
|
-
rejecter: promise.legacyRejecter
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
.runOnQueue(.main)
|
|
63
|
-
|
|
64
|
-
View(GLView.self) {
|
|
65
|
-
Events("onSurfaceCreate")
|
|
66
|
-
|
|
67
|
-
Prop("msaaSamples") { (view, msaaSamples: Int) in
|
|
68
|
-
view.msaaSamples = msaaSamples
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
Prop("enableExperimentalWorkletSupport") { (view, enableExperimentalWorkletSupport: Bool) in
|
|
72
|
-
view.enableExperimentalWorkletSupport = enableExperimentalWorkletSupport
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
82c85258009a79435ad0ffbfde08e7cc
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
e0997b0887893b0554ab4c1ffb972f92f0962cad
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
34258c1facd47505795431b582b01ae721e99682f193a8029e6d33b419247f80
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
11a34a55c37c76b33f3931b9caa588e4d4ac4c204f943b6bc46580a3587fd782a3c1814ad275da5a086860e42b60cdf7de12d16eb835d14ecef8bedd4e0a1209
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
bab52ec465ce78611f9de353ed5a09b6
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
09a064ca3310bc0bbdf62769c19cd78eeda0570a
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7f4b4884197301ff6c2e3b312f3ff87133e318892e9aa26e9adbd06c1f75df46
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
49402e20958a1f2e59c6922e8fea2d39df073102827f2c440f6b6793b71153a48420d08512fa2024f802ea359237f6674cf7f551f1892e25b3c79e39acd256a4
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"formatVersion": "1.1",
|
|
3
|
-
"component": {
|
|
4
|
-
"group": "host.exp.exponent",
|
|
5
|
-
"module": "expo.modules.gl",
|
|
6
|
-
"version": "16.0.9-canary-20251210-1f163e3",
|
|
7
|
-
"attributes": {
|
|
8
|
-
"org.gradle.status": "release"
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"createdBy": {
|
|
12
|
-
"gradle": {
|
|
13
|
-
"version": "9.0.0"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"variants": [
|
|
17
|
-
{
|
|
18
|
-
"name": "releaseVariantReleaseApiPublication",
|
|
19
|
-
"attributes": {
|
|
20
|
-
"org.gradle.category": "library",
|
|
21
|
-
"org.gradle.dependency.bundling": "external",
|
|
22
|
-
"org.gradle.libraryelements": "aar",
|
|
23
|
-
"org.gradle.usage": "java-api"
|
|
24
|
-
},
|
|
25
|
-
"files": [
|
|
26
|
-
{
|
|
27
|
-
"name": "expo.modules.gl-16.0.9-canary-20251210-1f163e3.aar",
|
|
28
|
-
"url": "expo.modules.gl-16.0.9-canary-20251210-1f163e3.aar",
|
|
29
|
-
"size": 981245,
|
|
30
|
-
"sha512": "49402e20958a1f2e59c6922e8fea2d39df073102827f2c440f6b6793b71153a48420d08512fa2024f802ea359237f6674cf7f551f1892e25b3c79e39acd256a4",
|
|
31
|
-
"sha256": "7f4b4884197301ff6c2e3b312f3ff87133e318892e9aa26e9adbd06c1f75df46",
|
|
32
|
-
"sha1": "09a064ca3310bc0bbdf62769c19cd78eeda0570a",
|
|
33
|
-
"md5": "bab52ec465ce78611f9de353ed5a09b6"
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"name": "releaseVariantReleaseRuntimePublication",
|
|
39
|
-
"attributes": {
|
|
40
|
-
"org.gradle.category": "library",
|
|
41
|
-
"org.gradle.dependency.bundling": "external",
|
|
42
|
-
"org.gradle.libraryelements": "aar",
|
|
43
|
-
"org.gradle.usage": "java-runtime"
|
|
44
|
-
},
|
|
45
|
-
"dependencies": [
|
|
46
|
-
{
|
|
47
|
-
"group": "org.jetbrains.kotlin",
|
|
48
|
-
"module": "kotlin-stdlib-jdk7",
|
|
49
|
-
"version": {
|
|
50
|
-
"requires": "2.1.20"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
"files": [
|
|
55
|
-
{
|
|
56
|
-
"name": "expo.modules.gl-16.0.9-canary-20251210-1f163e3.aar",
|
|
57
|
-
"url": "expo.modules.gl-16.0.9-canary-20251210-1f163e3.aar",
|
|
58
|
-
"size": 981245,
|
|
59
|
-
"sha512": "49402e20958a1f2e59c6922e8fea2d39df073102827f2c440f6b6793b71153a48420d08512fa2024f802ea359237f6674cf7f551f1892e25b3c79e39acd256a4",
|
|
60
|
-
"sha256": "7f4b4884197301ff6c2e3b312f3ff87133e318892e9aa26e9adbd06c1f75df46",
|
|
61
|
-
"sha1": "09a064ca3310bc0bbdf62769c19cd78eeda0570a",
|
|
62
|
-
"md5": "bab52ec465ce78611f9de353ed5a09b6"
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"name": "releaseVariantReleaseSourcePublication",
|
|
68
|
-
"attributes": {
|
|
69
|
-
"org.gradle.category": "documentation",
|
|
70
|
-
"org.gradle.dependency.bundling": "external",
|
|
71
|
-
"org.gradle.docstype": "sources",
|
|
72
|
-
"org.gradle.usage": "java-runtime"
|
|
73
|
-
},
|
|
74
|
-
"files": [
|
|
75
|
-
{
|
|
76
|
-
"name": "expo.modules.gl-16.0.9-canary-20251210-1f163e3-sources.jar",
|
|
77
|
-
"url": "expo.modules.gl-16.0.9-canary-20251210-1f163e3-sources.jar",
|
|
78
|
-
"size": 12052,
|
|
79
|
-
"sha512": "11a34a55c37c76b33f3931b9caa588e4d4ac4c204f943b6bc46580a3587fd782a3c1814ad275da5a086860e42b60cdf7de12d16eb835d14ecef8bedd4e0a1209",
|
|
80
|
-
"sha256": "34258c1facd47505795431b582b01ae721e99682f193a8029e6d33b419247f80",
|
|
81
|
-
"sha1": "e0997b0887893b0554ab4c1ffb972f92f0962cad",
|
|
82
|
-
"md5": "82c85258009a79435ad0ffbfde08e7cc"
|
|
83
|
-
}
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2d6175855d9969a45702dad5ea8792e4
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
d2f927ad08c99c36b21c913e5bb0fdd644f72aee
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
fb91acb185396260c8853bbb4f96a3f7436f66889da29e5265fb0a9bb5910025
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0d7af4dbc3d2d33f48fcc1d5d6d6f6da1bc4e8782d659a6ac0965f8054e400073f9812f2324eb24075c347cd09ebaf7421767731fceef45bca91b22e878d2069
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
c363a7ce0809d074484c4b104ecafbc5
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
9449e48ded4153bca62d2fab6c6f21cbd69ee5cb
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1df3ff83bd08223476d2bd8ca5baebdb81a634d36394b9add30033e90443b466
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1ca69a93b909209c72092af10ece771c41f311c62fe608245aacc6405197b94327ec784f4f660d498482ef69cfca1efe36caa6d03daae1359a87478eb16a049d
|