diff --git a/Changelog.md b/Changelog.md new file mode 100644 index 0000000..c332b36 --- /dev/null +++ b/Changelog.md @@ -0,0 +1,5 @@ +## 1.0.1 ++ Upgraded to NatML 1.1.0 + +## 1.0.0 ++ First release. \ No newline at end of file diff --git a/Changelog.md.meta b/Changelog.md.meta new file mode 100644 index 0000000..2f88c6e --- /dev/null +++ b/Changelog.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 063dd64ba7a3e40b495f69d3c36ef7af +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..f49a4e1 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/LICENSE.md.meta b/LICENSE.md.meta new file mode 100644 index 0000000..6fe9ae6 --- /dev/null +++ b/LICENSE.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6f80e8988077947df9f9d21c64505ad2 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins.meta b/Plugins.meta new file mode 100644 index 0000000..ccbaccc --- /dev/null +++ b/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b7b741b6ae08349c4a0480accbdff863 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/Android.meta b/Plugins/Android.meta new file mode 100644 index 0000000..72b77b5 --- /dev/null +++ b/Plugins/Android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0529169cca62a480ba2c436e6803c396 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/Android/NatMLARFoundation.aar b/Plugins/Android/NatMLARFoundation.aar new file mode 100644 index 0000000..6ae517d Binary files /dev/null and b/Plugins/Android/NatMLARFoundation.aar differ diff --git a/Plugins/Android/NatMLARFoundation.aar.meta b/Plugins/Android/NatMLARFoundation.aar.meta new file mode 100644 index 0000000..569794d --- /dev/null +++ b/Plugins/Android/NatMLARFoundation.aar.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 5b2592b3d3f2e48d7af795b3c324e0be +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/Windows.meta b/Plugins/Windows.meta new file mode 100644 index 0000000..739fd59 --- /dev/null +++ b/Plugins/Windows.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 863d7e2e9162a1948858bf21599407d0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/Windows/NatMLARFoundation.dll b/Plugins/Windows/NatMLARFoundation.dll new file mode 100644 index 0000000..cb55273 Binary files /dev/null and b/Plugins/Windows/NatMLARFoundation.dll differ diff --git a/Plugins/Windows/NatMLARFoundation.dll.meta b/Plugins/Windows/NatMLARFoundation.dll.meta new file mode 100644 index 0000000..ae2d180 --- /dev/null +++ b/Plugins/Windows/NatMLARFoundation.dll.meta @@ -0,0 +1,81 @@ +fileFormatVersion: 2 +guid: 85429903658204992a020e9551fd0f4a +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux64: 0 + Exclude OSXUniversal: 0 + Exclude WebGL: 1 + Exclude Win: 1 + Exclude Win64: 0 + Exclude iOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: Windows + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win64 + second: + enabled: 1 + settings: + CPU: x86_64 + - first: + iPhone: iOS + second: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/iOS.meta b/Plugins/iOS.meta new file mode 100644 index 0000000..1ab8ed0 --- /dev/null +++ b/Plugins/iOS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1bc6e903e725348ea97a1b21f6a6f189 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/iOS/NatMLARFoundation.framework.meta b/Plugins/iOS/NatMLARFoundation.framework.meta new file mode 100644 index 0000000..20e3ee6 --- /dev/null +++ b/Plugins/iOS/NatMLARFoundation.framework.meta @@ -0,0 +1,81 @@ +fileFormatVersion: 2 +guid: ed07ca8f0d9ee4adb95b4cbc87c03e37 +folderAsset: yes +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 0 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: None + - first: + iPhone: iOS + second: + enabled: 1 + settings: + AddToEmbeddedBinaries: true + CPU: ARM64 + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/iOS/NatMLARFoundation.framework/Info.plist b/Plugins/iOS/NatMLARFoundation.framework/Info.plist new file mode 100644 index 0000000..3b69e3d Binary files /dev/null and b/Plugins/iOS/NatMLARFoundation.framework/Info.plist differ diff --git a/Plugins/iOS/NatMLARFoundation.framework/Info.plist.meta b/Plugins/iOS/NatMLARFoundation.framework/Info.plist.meta new file mode 100644 index 0000000..dc0a828 --- /dev/null +++ b/Plugins/iOS/NatMLARFoundation.framework/Info.plist.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e17fe1aaa2e8e43a5be14a0de3b90daa +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/iOS/NatMLARFoundation.framework/NatMLARFoundation b/Plugins/iOS/NatMLARFoundation.framework/NatMLARFoundation new file mode 100755 index 0000000..ab7c9ec Binary files /dev/null and b/Plugins/iOS/NatMLARFoundation.framework/NatMLARFoundation differ diff --git a/Plugins/iOS/NatMLARFoundation.framework/NatMLARFoundation.meta b/Plugins/iOS/NatMLARFoundation.framework/NatMLARFoundation.meta new file mode 100644 index 0000000..99cdaff --- /dev/null +++ b/Plugins/iOS/NatMLARFoundation.framework/NatMLARFoundation.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 02d0e5432333f4c5b9f8c229e4934fbd +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/macOS.meta b/Plugins/macOS.meta new file mode 100644 index 0000000..978b703 --- /dev/null +++ b/Plugins/macOS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2c03f4d42ffc54d9eb3b13bf830ed8c6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/macOS/NatMLARFoundation.bundle.meta b/Plugins/macOS/NatMLARFoundation.bundle.meta new file mode 100644 index 0000000..6bf879e --- /dev/null +++ b/Plugins/macOS/NatMLARFoundation.bundle.meta @@ -0,0 +1,82 @@ +fileFormatVersion: 2 +guid: 6c76543dddefe4dd099b73f7227ca43e +folderAsset: yes +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux64: 1 + Exclude OSXUniversal: 0 + Exclude WebGL: 1 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: OSX + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + iPhone: iOS + second: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/macOS/NatMLARFoundation.bundle/Contents.meta b/Plugins/macOS/NatMLARFoundation.bundle/Contents.meta new file mode 100644 index 0000000..784b771 --- /dev/null +++ b/Plugins/macOS/NatMLARFoundation.bundle/Contents.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: afc68122d2ab84d99af4c23ce6b72e95 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/macOS/NatMLARFoundation.bundle/Contents/Info.plist b/Plugins/macOS/NatMLARFoundation.bundle/Contents/Info.plist new file mode 100644 index 0000000..58644a4 --- /dev/null +++ b/Plugins/macOS/NatMLARFoundation.bundle/Contents/Info.plist @@ -0,0 +1,48 @@ + + + + + BuildMachineOSBuild + 21E258 + CFBundleDevelopmentRegion + en + CFBundleExecutable + NatMLARFoundation + CFBundleIdentifier + ai.natml.natml.arfoundation + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + NatMLARFoundation + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 13F100 + DTPlatformName + macosx + DTPlatformVersion + 12.3 + DTSDKBuild + 21E226 + DTSDKName + macosx12.3 + DTXcode + 1341 + DTXcodeBuild + 13F100 + LSMinimumSystemVersion + 10.15 + NSHumanReadableCopyright + + + diff --git a/Plugins/macOS/NatMLARFoundation.bundle/Contents/Info.plist.meta b/Plugins/macOS/NatMLARFoundation.bundle/Contents/Info.plist.meta new file mode 100644 index 0000000..7c5a1d3 --- /dev/null +++ b/Plugins/macOS/NatMLARFoundation.bundle/Contents/Info.plist.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 10ef299003ba24f7e919b86579e7e6df +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/macOS/NatMLARFoundation.bundle/Contents/MacOS.meta b/Plugins/macOS/NatMLARFoundation.bundle/Contents/MacOS.meta new file mode 100644 index 0000000..69cb805 --- /dev/null +++ b/Plugins/macOS/NatMLARFoundation.bundle/Contents/MacOS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f594701d323be4c0abcf405253f3d1e7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/macOS/NatMLARFoundation.bundle/Contents/MacOS/NatMLARFoundation b/Plugins/macOS/NatMLARFoundation.bundle/Contents/MacOS/NatMLARFoundation new file mode 100755 index 0000000..7567a61 Binary files /dev/null and b/Plugins/macOS/NatMLARFoundation.bundle/Contents/MacOS/NatMLARFoundation differ diff --git a/Plugins/macOS/NatMLARFoundation.bundle/Contents/MacOS/NatMLARFoundation.meta b/Plugins/macOS/NatMLARFoundation.bundle/Contents/MacOS/NatMLARFoundation.meta new file mode 100644 index 0000000..60ad58f --- /dev/null +++ b/Plugins/macOS/NatMLARFoundation.bundle/Contents/MacOS/NatMLARFoundation.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2a3c076ba17ce4580aa5f1d043ae791f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/README.md b/README.md new file mode 100644 index 0000000..23f858c --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# NatML for ARFoundation + +![NatML](https://raw.githubusercontent.com/natmlx/.github/main/natml.png) + +NatML integration library for Unity ARFoundation. + +## Installing NatML ARFoundation +Add the following items to your Unity project's `Packages/manifest.json`: +```json +{ + "scopedRegistries": [ + { + "name": "NatML", + "url": "https://registry.npmjs.com", + "scopes": ["ai.natml"] + } + ], + "dependencies": { + "ai.natml.natml.arfoundation": "1.0.1" + } +} +``` + +## Requirements +- Unity 2021.2+ +- [ARFoundation 4.1+](https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@4.1/manual/index.html) + +## Resources +- Join the [NatML community on Discord](https://natml.ai/community). +- See the [NatML documentation](https://docs.natml.ai/natml). +- See more [NatML projects on GitHub](https://github.com/natmlx). +- Contact us at [hi@natml.ai](mailto:hi@natml.ai). + +Thank you very much! \ No newline at end of file diff --git a/README.md.meta b/README.md.meta new file mode 100644 index 0000000..f01ddf7 --- /dev/null +++ b/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7141428b7de0f4d1fba787765540c632 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime.meta b/Runtime.meta new file mode 100644 index 0000000..e4f00e7 --- /dev/null +++ b/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 984a59465bf5a4f3891f7887b32c631c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Features.meta b/Runtime/Features.meta new file mode 100644 index 0000000..b428cda --- /dev/null +++ b/Runtime/Features.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6e1628cab255d40529cbd1ee3988460a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Features/MLXRCpuDepthFeature.cs b/Runtime/Features/MLXRCpuDepthFeature.cs new file mode 100644 index 0000000..7f62fbf --- /dev/null +++ b/Runtime/Features/MLXRCpuDepthFeature.cs @@ -0,0 +1,112 @@ +/* +* NatML ARFoundation +* Copyright © 2023 NatML Inc. All rights reserved. +*/ + +namespace NatML.Features { + + using System; + using System.Runtime.CompilerServices; + using UnityEngine; + using UnityEngine.XR.ARSubsystems; + using Types; + using Unity.Collections.LowLevel.Unsafe; + using static Unity.Mathematics.math; + using Format = UnityEngine.XR.ARSubsystems.XRCpuImage.Format; + + /// + /// ML augmented reality depth feature. + /// This feature cannot be used directly for inference. + /// Instead, it is used by predictors that require depth data for their computations. + /// + public sealed class MLXRCpuDepthFeature : MLDepthFeature { + + #region --Client API-- + /// + /// Create an AR depth image feature. + /// + /// Augmented reality image. + /// AR session camera. + /// Image orientation. If `Unknown`, this will default to the screen orientation. + public MLXRCpuDepthFeature ( + XRCpuImage image, + Camera camera, + ScreenOrientation orientation = 0 + ) : base(GetType(image, orientation)) { + if (image.format != Format.DepthUint16 && image.format != Format.DepthFloat32) + throw new ArgumentException($"AR depth image has invalid format: {image.format}", nameof(image)); + this.image = image; + this.camera = camera; + this.orientation = orientation; + this.rotation = GetRotation(orientation); + } + + /// + /// Sample the depth feature at a given point. + /// If the point is out of bounds, `-1` is returned. + /// + /// Point to sample in normalized viewport coordinates. + /// Depth in meters. + public override float Sample (Vector2 point) { + var s = float2(image.width, image.height); // use unoriented size + var uv = float2(point.x, point.y); + var t = Mathf.Deg2Rad * rotation; + var T = mul(float2x2(cos(t), -sin(t), sin(t), cos(t)), float2x2(1f, 0f, 0f, -1f)); + var uv_r = mul(T, uv - 0.5f) + 0.5f; + var xy = int2(uv_r * s); + if (xy.x < 0 || xy.x >= image.width || xy.y < 0 || xy.y >= image.height) + return -1; + switch (image.format) { + case Format.DepthFloat32: return Sample(xy.x, xy.y); + case Format.DepthUint16: return 0.001f * Sample(xy.x, xy.y); + default: throw new InvalidOperationException($"Cannot sample depth because image has invalid format: {image.format}"); + } + } + + /// + /// Project a 2D point into 3D space using depth. + /// + /// Point to transform in normalized viewport coordinates. + /// Projected point in 3D space. + public override Vector3 ViewportToWorldPoint (Vector2 point) { // CHECK // Camera aspect scaling + var depth = Sample(point); + var viewport = new Vector3(point.x, point.y, depth); + var world = camera.ViewportToWorldPoint(viewport); + return world; + } + #endregion + + + #region --Operations-- + private readonly XRCpuImage image; + private readonly Camera camera; + private readonly ScreenOrientation orientation; + private readonly float rotation; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private unsafe T Sample (int x, int y) where T : unmanaged { + var plane = image.GetPlane(0); + var idx = y * plane.rowStride + x * plane.pixelStride; + var data = (byte*)plane.data.GetUnsafeReadOnlyPtr(); + var sample = *(T*)&data[idx]; + return sample; + } + + private static float GetRotation (ScreenOrientation orientation) => orientation switch { + ScreenOrientation.LandscapeLeft => 0f, + ScreenOrientation.Portrait => -90f, + ScreenOrientation.LandscapeRight => -180f, + ScreenOrientation.PortraitUpsideDown => -270f, + _ => 0f, + }; + + private static MLImageType GetType (XRCpuImage image, ScreenOrientation orientation) { + orientation = orientation != 0 ? orientation : Screen.orientation; + var portrait = orientation == ScreenOrientation.Portrait || orientation == ScreenOrientation.PortraitUpsideDown; + var width = portrait ? image.height : image.width; + var height = portrait ? image.width : image.height; + return new MLImageType(width, height, 1); + } + #endregion + } +} \ No newline at end of file diff --git a/Runtime/Features/MLXRCpuDepthFeature.cs.meta b/Runtime/Features/MLXRCpuDepthFeature.cs.meta new file mode 100644 index 0000000..ece0157 --- /dev/null +++ b/Runtime/Features/MLXRCpuDepthFeature.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4edd02409e11c480898e78f8c6cc3ffb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: d6df589e0376343f7a3b406329630a74, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Features/MLXRExtensions.cs b/Runtime/Features/MLXRExtensions.cs new file mode 100644 index 0000000..5e92688 --- /dev/null +++ b/Runtime/Features/MLXRExtensions.cs @@ -0,0 +1,113 @@ +/* +* NatML ARFoundation +* Copyright © 2023 NatML Inc. All rights reserved. +*/ + +namespace NatML.Features { + + using System; + using UnityEngine; + using UnityEngine.XR.ARSubsystems; + using Unity.Collections.LowLevel.Unsafe; + using Internal; + using Types; + using Format = UnityEngine.XR.ARSubsystems.XRCpuImage.Format; + + /// + /// + public static class MLXRExtensions { + + #region --Client API-- + /// + /// Copy image data from an ARFoundation image. + /// + /// Image feature to copy data into. + /// AR image. + /// Whether AR image is from world-facing camera. + /// Image orientation. If `Unknown`, this will default to the screen orientation. + public static unsafe void CopyFrom (this MLImageFeature feature, XRCpuImage image, bool world = true, ScreenOrientation orientation = 0) { + // Check size // This implicitly checks whether the image is valid. + var (width, height) = image.GetFeatureSize(orientation); + if (feature.width != width || feature.height != height) + throw new ArgumentException($"Feature has incorrect size", nameof(image)); + // Check format + if (image.format != Format.AndroidYuv420_888 && image.format != Format.IosYpCbCr420_8BiPlanarFullRange) + throw new ArgumentException($"AR image has invalid format: {image.format}", nameof(image)); + // Populate data + var planes = stackalloc void*[image.planeCount]; + var rows = stackalloc int[image.planeCount]; + var pixels = stackalloc int[image.planeCount]; + for (var i = 0; i < image.planeCount; ++i) { + var plane = image.GetPlane(i); + planes[i] = plane.data.GetUnsafeReadOnlyPtr(); + rows[i] = plane.rowStride; + pixels[i] = plane.pixelStride; + } + // Copy + fixed (void* dst = feature) + NatMLARFoundation.CreateImageFeatureData( + planes, + image.planeCount, + image.width, + image.height, + rows, + pixels, + (int)(orientation != 0 ? orientation : Screen.orientation), + world, + dst, + out var _, + out var _ + ); + } + + /// + /// Get the ML feature type for a given AR image. + /// + /// AR image. + /// Image orientation. If `Unknown`, this will default to the screen orientation. + /// Feature type for image. + public static MLImageType GetFeatureType (this XRCpuImage image, ScreenOrientation orientation = 0) { + // Check valid + if (!image.valid) + throw new ArgumentException(@"AR image is invalid", nameof(image)); + // Create type + var (width, height) = image.GetFeatureSize(orientation); + var type = image.GetFeatureType(); + var result = new MLImageType(width, height, image.planeCount, type); + // Return + return result; + } + #endregion + + + #region --Operations-- + /// + /// Get the image feature size for a given AR image. + /// Note that the image MUST be valid. + /// + /// AR image. + /// Image orientation. If `Unknown`, this will default to the screen orientation. + /// Image feature size. + private static (int width, int height) GetFeatureSize (this XRCpuImage image, ScreenOrientation orientation = 0) => (orientation != 0 ? orientation : Screen.orientation) switch { + ScreenOrientation.Portrait => (image.height, image.width), + ScreenOrientation.PortraitUpsideDown => (image.height, image.width), + _ => (image.width, image.height), + }; + + /// + /// Get the image feature data type for a given AR image. + /// Note that the image MUST be valid. + /// + /// AR image. + /// Image feature data type. + private static Type GetFeatureType (this XRCpuImage image) => image.format switch { + Format.AndroidYuv420_888 => typeof(byte), + Format.DepthFloat32 => typeof(float), + Format.DepthUint16 => typeof(ushort), + Format.IosYpCbCr420_8BiPlanarFullRange => typeof(byte), + Format.OneComponent8 => typeof(byte), + _ => null, + }; + #endregion + } +} \ No newline at end of file diff --git a/Runtime/Features/MLXRExtensions.cs.meta b/Runtime/Features/MLXRExtensions.cs.meta new file mode 100644 index 0000000..9f83572 --- /dev/null +++ b/Runtime/Features/MLXRExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 075c1e514bd31453584b65ec1c0d342f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: d6df589e0376343f7a3b406329630a74, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Internal.meta b/Runtime/Internal.meta new file mode 100644 index 0000000..5a0c8c3 --- /dev/null +++ b/Runtime/Internal.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9f54190444076490dbca9b8af009de37 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Internal/NatMLARFoundation.cs b/Runtime/Internal/NatMLARFoundation.cs new file mode 100644 index 0000000..9cd7782 --- /dev/null +++ b/Runtime/Internal/NatMLARFoundation.cs @@ -0,0 +1,37 @@ +/* +* NatML ARFoundation +* Copyright © 2023 NatML Inc. All rights reserved. +*/ + +namespace NatML.Internal { + + using System.Runtime.InteropServices; + + public static class NatMLARFoundation { + + public const string Assembly = + #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR + @"__Internal"; + #else + @"NatMLARFoundation"; + #endif + + + #region --NMLFeature-- + [DllImport(Assembly, EntryPoint = @"NMLCreateARFoundationImageFeatureData")] + public static unsafe extern void CreateImageFeatureData ( + void** planes, + int planeCount, + int width, + int height, + int* rows, + int* pixels, + int orientation, + bool world, + void* dstBuffer, + out int dstWidth, + out int dstHeight + ); + #endregion + } +} \ No newline at end of file diff --git a/Runtime/Internal/NatMLARFoundation.cs.meta b/Runtime/Internal/NatMLARFoundation.cs.meta new file mode 100644 index 0000000..f8563c6 --- /dev/null +++ b/Runtime/Internal/NatMLARFoundation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c356999ea637b4c03b3e72da7f3c7693 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: d6df589e0376343f7a3b406329630a74, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/NatML.ML.ARFoundation.asmdef b/Runtime/NatML.ML.ARFoundation.asmdef new file mode 100644 index 0000000..d8f31cf --- /dev/null +++ b/Runtime/NatML.ML.ARFoundation.asmdef @@ -0,0 +1,25 @@ +{ + "name": "NatML.ML.ARFoundation", + "rootNamespace": "", + "references": [ + "NatML.ML", + "Unity.XR.ARFoundation", + "Unity.XR.ARSubsystems", + "Unity.Mathematics" + ], + "includePlatforms": [ + "Android", + "Editor", + "iOS", + "macOSStandalone", + "WindowsStandalone64" + ], + "excludePlatforms": [], + "allowUnsafeCode": true, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Runtime/NatML.ML.ARFoundation.asmdef.meta b/Runtime/NatML.ML.ARFoundation.asmdef.meta new file mode 100644 index 0000000..824251c --- /dev/null +++ b/Runtime/NatML.ML.ARFoundation.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2ba2dbdadeff54ea8b9f4da876f2d3ef +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/package.json b/package.json new file mode 100644 index 0000000..a21e75e --- /dev/null +++ b/package.json @@ -0,0 +1,40 @@ +{ + "name": "ai.natml.natml.arfoundation", + "version": "1.0.1", + "displayName": "ARFoundation ML", + "description": "Unity ARFoundation support library for NatML.", + "unity": "2021.2", + "dependencies": { + "ai.natml.natml": "1.1.0", + "com.unity.mathematics": "1.2.1", + "com.unity.xr.arfoundation": "4.1.7" + }, + "keywords": [ + "natml", + "machine learning", + "ml", + "aritificial intelligence", + "ai", + "computer vision", + "opencv", + "android", + "ios", + "macos", + "windows", + "coreml", + "nnapi", + "directml", + "tensorflow", + "pytorch", + "torch", + "natdevice", + "natcorder" + ], + "author": { + "name": "NatML", + "email": "hi@natml.ai", + "url": "https://github.com/natmlx" + }, + "license": "Apache-2.0", + "repository": "github:natmlx/NatML-ARFoundation" +} \ No newline at end of file diff --git a/package.json.meta b/package.json.meta new file mode 100644 index 0000000..5937437 --- /dev/null +++ b/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 57adcfa4d489a4d1193a5adf8723fdca +PackageManifestImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: