Skip to content

Commit 3766af2

Browse files
C. M. Barthryantrembghgary
authored
Consume canvas polyfill to enable text support (#251)
* update babylonnative * initialize canvas polyfill * support canvas polyfill * add engine view logic * remove no longer needed effect * remove unused _native variable * revert engine view changes in favor of content from babylon.js * iOS fixes * move to most recent master branch * fix package versions * Update to latest BabylonNative and bjs npm package 5.0.0-alpha.30 * Updates from pod install * Update to latest BabylonNative submodule 3a8ea03c * Update package-lock.json files in PackageTest Co-authored-by: Ryan Tremblay <[email protected]> Co-authored-by: Gary Hsu <[email protected]>
1 parent 3386dfa commit 3766af2

File tree

19 files changed

+16607
-13736
lines changed

19 files changed

+16607
-13736
lines changed

Apps/PackageTest/0.63.1/package-lock.json

+6,840-4,896
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Apps/PackageTest/0.63.1/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
1111
},
1212
"dependencies": {
13-
"@babylonjs/core": "^5.0.0-alpha.22",
13+
"@babylonjs/core": "^5.0.0-alpha.30",
1414
"@babylonjs/react-native": "file:../../../Package/Assembled/babylonjs-react-native-0.0.1.tgz",
1515
"react": "16.13.1",
1616
"react-native": "0.63.1",

Apps/PackageTest/0.64.0/package-lock.json

+9,687-8,815
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Apps/PackageTest/0.64.0/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
1313
},
1414
"dependencies": {
15-
"@babylonjs/core": "^5.0.0-alpha.22",
15+
"@babylonjs/core": "^5.0.0-alpha.30",
1616
"@babylonjs/react-native": "file:../../../Package/Assembled/babylonjs-react-native-0.0.1.tgz",
1717
"@babylonjs/react-native-windows": "file:../../../Package/Assembled-Windows/babylonjs-react-native-windows-0.0.1.tgz",
1818
"react": "^17.0.1",

Apps/Playground/ios/Playground.xcodeproj/project.pbxproj

+40
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
00E356EB1AD99517003FC87E /* Frameworks */,
194194
00E356EC1AD99517003FC87E /* Resources */,
195195
4DF74E02309D0674CD39F2F6 /* [CP] Copy Pods Resources */,
196+
6A13610D0DAC0E2C73213A44 /* [CP] Embed Pods Frameworks */,
196197
);
197198
buildRules = (
198199
);
@@ -215,6 +216,7 @@
215216
13B07F8E1A680F5B00A75B9A /* Resources */,
216217
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
217218
7673B7292A47C1F4F6B8C9E4 /* [CP] Copy Pods Resources */,
219+
3A005AC06E3079E06824DD42 /* [CP] Embed Pods Frameworks */,
218220
);
219221
buildRules = (
220222
);
@@ -394,6 +396,24 @@
394396
shellPath = /bin/sh;
395397
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
396398
};
399+
3A005AC06E3079E06824DD42 /* [CP] Embed Pods Frameworks */ = {
400+
isa = PBXShellScriptBuildPhase;
401+
buildActionMask = 2147483647;
402+
files = (
403+
);
404+
inputPaths = (
405+
"${PODS_ROOT}/Target Support Files/Pods-Playground/Pods-Playground-frameworks.sh",
406+
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL/OpenSSL.framework/OpenSSL",
407+
);
408+
name = "[CP] Embed Pods Frameworks";
409+
outputPaths = (
410+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OpenSSL.framework",
411+
);
412+
runOnlyForDeploymentPostprocessing = 0;
413+
shellPath = /bin/sh;
414+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Playground/Pods-Playground-frameworks.sh\"\n";
415+
showEnvVarsInLog = 0;
416+
};
397417
4DF74E02309D0674CD39F2F6 /* [CP] Copy Pods Resources */ = {
398418
isa = PBXShellScriptBuildPhase;
399419
buildActionMask = 2147483647;
@@ -412,6 +432,24 @@
412432
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Playground-PlaygroundTests/Pods-Playground-PlaygroundTests-resources.sh\"\n";
413433
showEnvVarsInLog = 0;
414434
};
435+
6A13610D0DAC0E2C73213A44 /* [CP] Embed Pods Frameworks */ = {
436+
isa = PBXShellScriptBuildPhase;
437+
buildActionMask = 2147483647;
438+
files = (
439+
);
440+
inputPaths = (
441+
"${PODS_ROOT}/Target Support Files/Pods-Playground-PlaygroundTests/Pods-Playground-PlaygroundTests-frameworks.sh",
442+
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL/OpenSSL.framework/OpenSSL",
443+
);
444+
name = "[CP] Embed Pods Frameworks";
445+
outputPaths = (
446+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OpenSSL.framework",
447+
);
448+
runOnlyForDeploymentPostprocessing = 0;
449+
shellPath = /bin/sh;
450+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Playground-PlaygroundTests/Pods-Playground-PlaygroundTests-frameworks.sh\"\n";
451+
showEnvVarsInLog = 0;
452+
};
415453
7673B7292A47C1F4F6B8C9E4 /* [CP] Copy Pods Resources */ = {
416454
isa = PBXShellScriptBuildPhase;
417455
buildActionMask = 2147483647;
@@ -768,6 +806,7 @@
768806
COPY_PHASE_STRIP = NO;
769807
ENABLE_STRICT_OBJC_MSGSEND = YES;
770808
ENABLE_TESTABILITY = YES;
809+
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 ";
771810
GCC_C_LANGUAGE_STANDARD = gnu99;
772811
GCC_DYNAMIC_NO_PIC = NO;
773812
GCC_NO_COMMON_BLOCKS = YES;
@@ -828,6 +867,7 @@
828867
COPY_PHASE_STRIP = YES;
829868
ENABLE_NS_ASSERTIONS = NO;
830869
ENABLE_STRICT_OBJC_MSGSEND = YES;
870+
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 ";
831871
GCC_C_LANGUAGE_STANDARD = gnu99;
832872
GCC_NO_COMMON_BLOCKS = YES;
833873
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;

Apps/Playground/ios/Podfile.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -467,17 +467,17 @@ EXTERNAL SOURCES:
467467
SPEC CHECKSUMS:
468468
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
469469
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
470-
DoubleConversion: cde416483dac037923206447da6e1454df403714
470+
DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de
471471
FBLazyVector: 7b423f9e248eae65987838148c36eec1dbfe0b53
472-
FBReactNativeSpec: 5d6dbb11432863ed5cd10461d91baf60af966217
472+
FBReactNativeSpec: 4cf6a7ec72a62c59d9d0cc5b558e55c462203506
473473
Flipper: d3da1aa199aad94455ae725e9f3aa43f3ec17021
474474
Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
475475
Flipper-Folly: 755929a4f851b2fb2c347d533a23f191b008554c
476476
Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6
477477
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
478478
Flipper-RSocket: 127954abe8b162fcaf68d2134d34dc2bd7076154
479479
FlipperKit: 8a20b5c5fcf9436cac58551dc049867247f64b00
480-
glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
480+
glog: 73c2498ac6884b13ede40eda8228cb1eee9d9d62
481481
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
482482
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
483483
Permission-Camera: 358081c7b8210849958af181ce9ddeb11932aa82
@@ -492,7 +492,7 @@ SPEC CHECKSUMS:
492492
React-jsi: 5de8204706bd872b78ea646aee5d2561ca1214b6
493493
React-jsiexecutor: 124e8f99992490d0d13e0649d950d3e1aae06fe9
494494
React-jsinspector: 500a59626037be5b3b3d89c5151bc3baa9abf1a9
495-
react-native-babylon: 67b39de846123d0846b28ce0e38671c7e3c4e04f
495+
react-native-babylon: 858ff09e82f9c3de4f17d66e90d6ca08dd480bb4
496496
react-native-slider: e45c8376012e5ace012e5eef62e9c85c68e50a0f
497497
React-perflogger: aad6d4b4a267936b3667260d1f649b6f6069a675
498498
React-RCTActionSheet: fc376be462c9c8d6ad82c0905442fd77f82a9d2a

Apps/Playground/package-lock.json

+11-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Apps/Playground/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"postinstall": "node scripts/postinstall.js"
1414
},
1515
"dependencies": {
16-
"@babylonjs/core": "^5.0.0-alpha.22",
17-
"@babylonjs/loaders": "^5.0.0-alpha.22",
16+
"@babylonjs/core": "^5.0.0-alpha.30",
17+
"@babylonjs/loaders": "^5.0.0-alpha.30",
1818
"@babylonjs/react-native": "file:../../Modules/@babylonjs/react-native",
1919
"@babylonjs/react-native-windows": "file:../../Modules/@babylonjs/react-native-windows",
2020
"@react-native-community/slider": "4.0.0-rc.3",

Modules/@babylonjs/react-native-windows/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"licenseFilename": "LICENSE",
2525
"readmeFilename": "README.md",
2626
"peerDependencies": {
27-
"@babylonjs/core": "^5.0.0-alpha.22",
27+
"@babylonjs/core": "^5.0.0-alpha.30",
2828
"@babylonjs/react-native":"version",
2929
"react": "^17.0.1",
3030
"react-native": "^0.64.0",

Modules/@babylonjs/react-native-windows/windows/BabylonReactNative/BabylonReactNative.vcxproj

+3
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
$(BabylonNativeBuildDir)\Plugins\NativeXr\$(Configuration);
149149
$(BabylonNativeBuildDir)\Polyfills\Window\$(Configuration);
150150
$(BabylonNativeBuildDir)\Polyfills\XMLHttpRequest\$(Configuration);
151+
$(BabylonNativeBuildDir)\Polyfills\Canvas\$(Configuration);
151152
$(BabylonNativeBuildDir)\$(Configuration);
152153
%(AdditionalLibraryDirectories);
153154
</AdditionalLibraryDirectories>
@@ -175,6 +176,7 @@
175176
bgfx.lib;
176177
bimg.lib;
177178
bx.lib;
179+
Canvas.lib;
178180
edtaa3.lib;
179181
etc1.lib;
180182
etc2.lib;
@@ -231,6 +233,7 @@
231233
bgfx.lib;
232234
bimg.lib;
233235
bx.lib;
236+
Canvas.lib;
234237
edtaa3.lib;
235238
etc1.lib;
236239
etc2.lib;

Modules/@babylonjs/react-native-windows/windows/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ target_link_libraries(BabylonNative
4444
NativeInput
4545
NativeXr
4646
Window
47-
XMLHttpRequest)
47+
XMLHttpRequest
48+
Canvas)
4849

4950
if(DEFINED EXTENSIONS_DIRS)
5051
foreach(extensionDir IN LISTS EXTENSIONS_DIRS)

Modules/@babylonjs/react-native/android/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,5 @@ target_link_libraries(BabylonNative
8080
NativeInput
8181
NativeXr
8282
Window
83-
XMLHttpRequest)
83+
XMLHttpRequest
84+
Canvas)

Modules/@babylonjs/react-native/ios/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ target_link_libraries(BabylonNative
5454
NativeInput
5555
NativeXr
5656
Window
57-
XMLHttpRequest)
57+
XMLHttpRequest
58+
Canvas)
5859

5960
# TODO: For some reason these don't work, so we specify these in the CMake command line args.
6061
set_target_properties(BabylonNative PROPERTIES

Modules/@babylonjs/react-native/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"semver": "^7.3.2"
2929
},
3030
"peerDependencies": {
31-
"@babylonjs/core": "^5.0.0-alpha.22",
31+
"@babylonjs/core": "^5.0.0-alpha.30",
3232
"react": "^16.13.1",
3333
"react-native": "^0.63.1",
3434
"react-native-permissions": "^2.1.4"

Modules/@babylonjs/react-native/react-native-babylon.podspec

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Pod::Spec.new do |s|
2222
'bgfx',
2323
'bimg',
2424
'bx',
25+
'Canvas',
2526
'GenericCodeGen',
2627
'glslang',
2728
'Graphics',

Modules/@babylonjs/react-native/shared/BabylonNative.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <Babylon/Plugins/NativeXr.h>
99
#include <Babylon/Polyfills/Window.h>
1010
#include <Babylon/Polyfills/XMLHttpRequest.h>
11+
#include <Babylon/Polyfills/Canvas.h>
1112

1213
#include <DispatchFunction.h>
1314

@@ -53,6 +54,9 @@ namespace Babylon
5354
// NOTE: React Native's XMLHttpRequest is slow and allocates a lot of memory. This does not override
5455
// React Native's implementation, but rather adds a second one scoped to Babylon and used by WebRequest.ts.
5556
Polyfills::XMLHttpRequest::Initialize(m_env);
57+
58+
// Initialize Canvas polyfill for text support
59+
Polyfills::Canvas::Initialize(m_env);
5660
}
5761

5862
~ReactNativeModule() override
Submodule BabylonNative updated 38 files

Package/gulpfile.js

+3
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ Assembled/ios/libs/libOSDependent.a
419419
Assembled/ios/libs/libXMLHttpRequest.a
420420
Assembled/ios/libs/libUrlLib.a
421421
Assembled/ios/libs/libastc-codec.a
422+
Assembled/ios/libs/libCanvas.a
422423
Assembled/ios/libs/libGenericCodeGen.a
423424
Assembled/ios/libs/libspirv-cross-core.a
424425
Assembled/ios/libs/libspirv-cross-msl.a
@@ -493,6 +494,8 @@ const build = gulp.series(buildIOS, buildAndroid, createIOSUniversalLibs, copyFi
493494
const rebuild = gulp.series(clean, build);
494495
const pack = gulp.series(rebuild, createPackage);
495496

497+
exports.validate = validate;
498+
496499
exports.buildIOS = buildIOS;
497500
exports.buildAndroid = buildAndroid;
498501
exports.createIOSUniversalLibs = createIOSUniversalLibs;

Package/iOS/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ set(PACKAGED_LIBS
88
bgfx
99
bimg
1010
bx
11+
Canvas
1112
GenericCodeGen
1213
glslang
1314
Graphics

0 commit comments

Comments
 (0)