diff --git a/documentation/docs/05-changelog.md b/documentation/docs/05-changelog.md
index dd3a4c24e..3d01acd7a 100644
--- a/documentation/docs/05-changelog.md
+++ b/documentation/docs/05-changelog.md
@@ -1,9 +1,13 @@
-## CHANGELOG
+## CHANGELOG
### v.1.4.2
*??/??/2018*
##### New Features
- Add `OnUpdated` event to `AbstractMap`. Enables subscribers to get a notification when the map location and/or zoom gets updated.
+
+##### Improvements
+- `UnityARInterface` updated to [commit 67351b6](https://github.com/Unity-Technologies/experimental-ARInterface/commit/67351b66ff9af28380e7dd5f5b2f4ba1bf802ca8) from March 1st 2018
+
### v.1.4.1
*04/17/2018*
diff --git a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/libarcore_camera_utility.so b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/libarcore_camera_utility.so
index c43564e86..139eb4d95 100644
Binary files a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/libarcore_camera_utility.so and b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/libarcore_camera_utility.so differ
diff --git a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/src/arcore_camera_utility.zip b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/src/arcore_camera_utility.zip
index aea81e32d..a77736e07 100644
Binary files a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/src/arcore_camera_utility.zip and b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Plugins/src/arcore_camera_utility.zip differ
diff --git a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scenes/ComputerVision.unity b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scenes/ComputerVision.unity
index e8040ac8d..e75eb2119 100644
--- a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scenes/ComputerVision.unity
+++ b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scenes/ComputerVision.unity
@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
- m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1}
+ m_IndirectSpecularColor: {r: 0.37311947, g: 0.38074005, b: 0.35872722, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
@@ -128,12 +128,17 @@ Prefab:
propertyPath: BackgroundMaterial
value:
objectReference: {fileID: 2100000, guid: 44aa46aeaaf4d46a79e18f3e2da31ccc, type: 2}
+ - target: {fileID: 114876698896786350, guid: c10877f7cd5764de18d46d7b777d1faa,
+ type: 2}
+ propertyPath: BackgroundMaterial
+ value:
+ objectReference: {fileID: 2100000, guid: 44aa46aeaaf4d46a79e18f3e2da31ccc, type: 2}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c10877f7cd5764de18d46d7b777d1faa, type: 2}
m_IsPrefabParent: 0
---- !u!114 &273323148 stripped
+--- !u!114 &517579873 stripped
MonoBehaviour:
- m_PrefabParentObject: {fileID: 114923820857209294, guid: c10877f7cd5764de18d46d7b777d1faa,
+ m_PrefabParentObject: {fileID: 114876698896786350, guid: c10877f7cd5764de18d46d7b777d1faa,
type: 2}
m_PrefabInternal: {fileID: 60865845}
m_Script: {fileID: 11500000, guid: eb172c260d42e4f62945afda50892c0c, type: 3}
@@ -179,7 +184,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
TextureReaderComponent: {fileID: 1465104024}
- BackgroundRenderer: {fileID: 273323148}
+ BackgroundRenderer: {fileID: 517579873}
--- !u!114 &1465104024
MonoBehaviour:
m_ObjectHideFlags: 0
diff --git a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scripts/ComputerVisionController.cs b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scripts/ComputerVisionController.cs
index 9f7a0fc97..0f9b12ab9 100644
--- a/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scripts/ComputerVisionController.cs
+++ b/sdkproject/Assets/GoogleARCore/Examples/ComputerVision/Scripts/ComputerVisionController.cs
@@ -40,7 +40,7 @@ public class ComputerVisionController : MonoBehaviour
/// Background renderer to inject our texture into.
///
public ARCoreBackgroundRenderer BackgroundRenderer;
-
+
///
/// True if the app is in the process of quitting due to an ARCore connection error, otherwise false.
///
@@ -71,6 +71,11 @@ public void Start()
///
public void Update()
{
+ if (Input.GetKey(KeyCode.Escape))
+ {
+ Application.Quit();
+ }
+
_QuitOnConnectionErrors();
_HandleTouchInput();
}
@@ -179,7 +184,7 @@ private float _GetTouchDelta()
return 0;
}
}
-
+
///
/// Actually quit the application.
///
@@ -199,13 +204,13 @@ private void _QuitOnConnectionErrors()
}
// Quit if ARCore was unable to connect and give Unity some time for the toast to appear.
- if (Session.ConnectionState == SessionConnectionState.UserRejectedNeededPermission)
+ if (Session.Status == SessionStatus.ErrorPermissionNotGranted)
{
_ShowAndroidToastMessage("Camera permission is needed to run this application.");
m_IsQuitting = true;
Invoke("DoQuit", 0.5f);
}
- else if (Session.ConnectionState == SessionConnectionState.ConnectToServiceFailed)
+ else if (Session.Status == SessionStatus.FatalError)
{
_ShowAndroidToastMessage("ARCore encountered a problem connecting. Please start the app again.");
m_IsQuitting = true;
diff --git a/sdkproject/Assets/GoogleARCore/LICENSE b/sdkproject/Assets/GoogleARCore/LICENSE
deleted file mode 100644
index 644835619..000000000
--- a/sdkproject/Assets/GoogleARCore/LICENSE
+++ /dev/null
@@ -1,158 +0,0 @@
-Copyright (c) 2017, Google Inc.
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-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.
- 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
diff --git a/sdkproject/Assets/GoogleARCore/Prefabs/ARCore Device.prefab b/sdkproject/Assets/GoogleARCore/Prefabs/ARCore Device.prefab
index 1dd0dbb41..b1f1c63bd 100644
--- a/sdkproject/Assets/GoogleARCore/Prefabs/ARCore Device.prefab
+++ b/sdkproject/Assets/GoogleARCore/Prefabs/ARCore Device.prefab
@@ -9,75 +9,75 @@ Prefab:
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
- m_RootGameObject: {fileID: 1905656715913530}
+ m_RootGameObject: {fileID: 1772147192650458}
m_IsPrefabParent: 1
---- !u!1 &1905656715913530
+--- !u!1 &1637996540812124
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- - component: {fileID: 4892153982037908}
- - component: {fileID: 114254441574086558}
+ - component: {fileID: 4497055787654456}
+ - component: {fileID: 20155940112608238}
+ - component: {fileID: 114963366853050710}
+ - component: {fileID: 114876698896786350}
m_Layer: 0
- m_Name: ARCore Device
+ m_Name: First Person Camera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
---- !u!1 &1960903772876386
+--- !u!1 &1772147192650458
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- - component: {fileID: 4923070639190690}
- - component: {fileID: 20362215073346118}
- - component: {fileID: 114720632237736846}
- - component: {fileID: 114923820857209294}
+ - component: {fileID: 4442908887562770}
+ - component: {fileID: 114451889682527732}
m_Layer: 0
- m_Name: First Person Camera
+ m_Name: ARCore Device
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
---- !u!4 &4892153982037908
+--- !u!4 &4442908887562770
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
- m_GameObject: {fileID: 1905656715913530}
+ m_GameObject: {fileID: 1772147192650458}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- - {fileID: 4923070639190690}
+ - {fileID: 4497055787654456}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
---- !u!4 &4923070639190690
+--- !u!4 &4497055787654456
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
- m_GameObject: {fileID: 1960903772876386}
+ m_GameObject: {fileID: 1637996540812124}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
- m_Father: {fileID: 4892153982037908}
+ m_Father: {fileID: 4442908887562770}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
---- !u!20 &20362215073346118
+--- !u!20 &20155940112608238
Camera:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
- m_GameObject: {fileID: 1960903772876386}
+ m_GameObject: {fileID: 1637996540812124}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
@@ -108,44 +108,43 @@ Camera:
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
---- !u!114 &114254441574086558
+--- !u!114 &114451889682527732
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
- m_GameObject: {fileID: 1905656715913530}
+ m_GameObject: {fileID: 1772147192650458}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d4ca0c6a3af6b4635b7e98c6ea0a0cf9, type: 3}
m_Name:
m_EditorClassIdentifier:
SessionConfig: {fileID: 11400000, guid: 9586a84d6c32f46b6ab7aeb6042f160d, type: 2}
- ConnectOnAwake: 1
---- !u!114 &114720632237736846
+--- !u!114 &114876698896786350
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
- m_GameObject: {fileID: 1960903772876386}
+ m_GameObject: {fileID: 1637996540812124}
m_Enabled: 1
m_EditorHideFlags: 0
- m_Script: {fileID: 1742909100, guid: 3a84de5cd0624681b6b6dcd8921d912a, type: 3}
+ m_Script: {fileID: 11500000, guid: eb172c260d42e4f62945afda50892c0c, type: 3}
m_Name:
m_EditorClassIdentifier:
- m_Device: 0
- m_PoseSource: 6
- m_TrackingType: 0
- m_UpdateType: 2
- m_UseRelativeTransform: 1
---- !u!114 &114923820857209294
+ BackgroundMaterial: {fileID: 2100000, guid: 03ad0130a037647aeb60218f61aca114, type: 2}
+--- !u!114 &114963366853050710
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
- m_GameObject: {fileID: 1960903772876386}
+ m_GameObject: {fileID: 1637996540812124}
m_Enabled: 1
m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: eb172c260d42e4f62945afda50892c0c, type: 3}
+ m_Script: {fileID: 1742909100, guid: 3a84de5cd0624681b6b6dcd8921d912a, type: 3}
m_Name:
m_EditorClassIdentifier:
- BackgroundMaterial: {fileID: 2100000, guid: 03ad0130a037647aeb60218f61aca114, type: 2}
+ m_Device: 0
+ m_PoseSource: 6
+ m_TrackingType: 0
+ m_UpdateType: 2
+ m_UseRelativeTransform: 1
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview.meta
new file mode 100644
index 000000000..4a8208577
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: e1e9a08d000a446c9ad506ecb3a4d083
+folderAsset: yes
+timeCreated: 1513969093
+licenseType: Pro
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins.meta
new file mode 100644
index 000000000..6d4a6474e
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: ede998a9371e74aa6a759743f41b3eb6
+folderAsset: yes
+timeCreated: 1513969093
+licenseType: Pro
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64.meta
new file mode 100644
index 000000000..ed36e8810
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 42098948be8564f678777d26e6906df3
+folderAsset: yes
+timeCreated: 1513969093
+licenseType: Pro
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_shared.dll b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_shared.dll
new file mode 100644
index 000000000..2e6e5f7e4
Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_shared.dll differ
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_shared.dll.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_shared.dll.meta
new file mode 100644
index 000000000..aa02256a0
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_shared.dll.meta
@@ -0,0 +1,95 @@
+fileFormatVersion: 2
+guid: 3a5f7d59b4b729446a1d2a9999f62bdb
+timeCreated: 1513200317
+licenseType: Pro
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ isPreloaded: 0
+ isOverridable: 0
+ platformData:
+ - first:
+ '': Any
+ second:
+ enabled: 0
+ settings:
+ Exclude Android: 1
+ Exclude Editor: 0
+ Exclude Linux: 1
+ Exclude Linux64: 1
+ Exclude LinuxUniversal: 1
+ Exclude OSXUniversal: 1
+ Exclude Win: 1
+ Exclude Win64: 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:
+ Facebook: Win
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Facebook: Win64
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Linux
+ second:
+ enabled: 0
+ settings:
+ CPU: x86
+ - first:
+ Standalone: Linux64
+ second:
+ enabled: 0
+ settings:
+ CPU: x86_64
+ - first:
+ Standalone: LinuxUniversal
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ Standalone: OSXUniversal
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Win
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Win64
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle.meta
new file mode 100644
index 000000000..0683b5e74
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle.meta
@@ -0,0 +1,101 @@
+fileFormatVersion: 2
+guid: 1785ef67a37b1402f8f80e1f0658e486
+folderAsset: yes
+timeCreated: 1515110710
+licenseType: Pro
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ isPreloaded: 0
+ isOverridable: 0
+ platformData:
+ - first:
+ '': Any
+ second:
+ enabled: 0
+ settings:
+ Exclude Editor: 0
+ Exclude Linux: 1
+ Exclude Linux64: 1
+ Exclude LinuxUniversal: 1
+ Exclude OSXUniversal: 1
+ Exclude Win: 1
+ Exclude Win64: 1
+ - first:
+ '': OSXIntel
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ '': OSXIntel64
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ - first:
+ Any:
+ second:
+ enabled: 0
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 1
+ settings:
+ CPU: x86_64
+ DefaultValueInitialized: true
+ OS: OSX
+ - first:
+ Facebook: Win
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ Facebook: Win64
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Linux
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ Standalone: Linux64
+ second:
+ enabled: 0
+ settings:
+ CPU: x86_64
+ - first:
+ Standalone: LinuxUniversal
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ Standalone: OSXUniversal
+ second:
+ enabled: 0
+ settings:
+ CPU: x86_64
+ - first:
+ Standalone: Win
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ Standalone: Win64
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents.meta
new file mode 100644
index 000000000..cdd5fcc29
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c22c793c4b5f447bbb532e92cb93d5ac
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS.meta
new file mode 100644
index 000000000..ff6f0ebec
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 33d076be2f74340b98cb58cefe9122f7
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/instant_preview_unity_plugin b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/instant_preview_unity_plugin
new file mode 100644
index 000000000..5e21d15e5
Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/instant_preview_unity_plugin differ
diff --git a/sdkproject/Assets/GoogleARCore/LICENSE.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/instant_preview_unity_plugin.meta
similarity index 67%
rename from sdkproject/Assets/GoogleARCore/LICENSE.meta
rename to sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/instant_preview_unity_plugin.meta
index 4616bef18..9eab1b004 100644
--- a/sdkproject/Assets/GoogleARCore/LICENSE.meta
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/instant_preview_unity_plugin.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
-guid: 29a90add1a7164050863c7e390cc97be
-timeCreated: 1515457486
+guid: 27a7f7613c41541ef8517d1b5390962b
+timeCreated: 1516418595
licenseType: Pro
DefaultImporter:
externalObjects: {}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/libinstant_preview_shared.dylib b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/libinstant_preview_shared.dylib
new file mode 100644
index 000000000..a2c5a41e0
Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/libinstant_preview_shared.dylib differ
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/libinstant_preview_shared.dylib.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/libinstant_preview_shared.dylib.meta
new file mode 100644
index 000000000..481ccf42d
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.bundle/Contents/MacOS/libinstant_preview_shared.dylib.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 9a49dee3272c24e7794351bb17e92bd3
+timeCreated: 1516418595
+licenseType: Pro
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.dll b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.dll
new file mode 100644
index 000000000..06e205666
Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.dll differ
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.dll.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.dll.meta
new file mode 100644
index 000000000..54fbaede5
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Plugins/x86_64/instant_preview_unity_plugin.dll.meta
@@ -0,0 +1,95 @@
+fileFormatVersion: 2
+guid: d80cb1919279b7348924bc747e2ada70
+timeCreated: 1513200317
+licenseType: Pro
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ isPreloaded: 0
+ isOverridable: 0
+ platformData:
+ - first:
+ '': Any
+ second:
+ enabled: 0
+ settings:
+ Exclude Android: 1
+ Exclude Editor: 0
+ Exclude Linux: 1
+ Exclude Linux64: 1
+ Exclude LinuxUniversal: 1
+ Exclude OSXUniversal: 1
+ Exclude Win: 1
+ Exclude Win64: 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:
+ Facebook: Win
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Facebook: Win64
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Linux
+ second:
+ enabled: 0
+ settings:
+ CPU: x86
+ - first:
+ Standalone: Linux64
+ second:
+ enabled: 0
+ settings:
+ CPU: x86_64
+ - first:
+ Standalone: LinuxUniversal
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ Standalone: OSXUniversal
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Win
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Win64
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts.meta
new file mode 100644
index 000000000..c1960e641
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: a10b012db03ac404a87dcb0519846527
+folderAsset: yes
+timeCreated: 1513969093
+licenseType: Pro
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs
new file mode 100644
index 000000000..f628d10a7
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs
@@ -0,0 +1,186 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCore
+{
+ using System;
+ using System.Diagnostics.CodeAnalysis;
+ using System.Runtime.InteropServices;
+ using GoogleARCoreInternal;
+ using UnityEngine;
+
+ ///
+ /// Helper class that provides touch input in lieu of Input.GetTouch when
+ /// running the Unity Editor.
+ ///
+ public static class InstantPreviewInput
+ {
+ private static Touch[] s_Touches = new Touch[0];
+
+ ///
+ /// Gets the available touch inputs from Instant Preview since the last
+ /// update.
+ ///
+ [SuppressMessage("UnityRules.UnityStyleRules", "US1000:FieldsMustBeUpperCamelCase",
+ Justification = "Overridden field.")]
+ public static Touch[] touches
+ {
+ get
+ {
+ return s_Touches;
+ }
+ }
+
+ ///
+ /// Gets the number of touches available from Instant preview since the
+ /// last update.
+ ///
+ [SuppressMessage("UnityRules.UnityStyleRules", "US1000:FieldsMustBeUpperCamelCase",
+ Justification = "Overridden field.")]
+ public static int touchCount
+ {
+ get
+ {
+ return touches.Length;
+ }
+ }
+
+ ///
+ /// Gets return value of Input.mousePosition.
+ ///
+ [SuppressMessage("UnityRules.UnityStyleRules", "US1000:FieldsMustBeUpperCamelCase",
+ Justification = "Overridden field.")]
+ public static Vector3 mousePosition
+ {
+ get
+ {
+ return Input.mousePosition;
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether a mouse device is detected.
+ ///
+ [SuppressMessage("UnityRules.UnityStyleRules", "US1000:FieldsMustBeUpperCamelCase",
+ Justification = "Overridden field.")]
+ public static bool mousePresent
+ {
+ get
+ {
+ return Input.mousePresent;
+ }
+ }
+
+ ///
+ /// Gets a specific touch input from Instant Preview by index.
+ ///
+ /// Index of touch input to get.
+ /// Touch data.
+ public static Touch GetTouch(int index)
+ {
+ return touches[index];
+ }
+
+ ///
+ /// Passthrough function to Input.GetKey.
+ ///
+ /// Key parameter to pass to Input.GetKey.
+ /// Key state returned from Input.GetKey.
+ public static bool GetKey(KeyCode keyCode)
+ {
+ return Input.GetKey(keyCode);
+ }
+
+ ///
+ /// Passthrough function to Input.GetMouseButton.
+ ///
+ /// Button index.
+ /// Return value of Input.GetMouseButton.
+ public static bool GetMouseButton(int button)
+ {
+ return Input.GetMouseButton(button);
+ }
+
+ ///
+ /// Passthrough function to Input.GetMouseButtonDown.
+ ///
+ /// Button index.
+ /// Return value of Input.GetMouseButtonDown.
+ public static bool GetMouseButtonDown(int button)
+ {
+ return Input.GetMouseButtonDown(button);
+ }
+
+ ///
+ /// Passthrough function to Input.GetMouseButtonUp.
+ ///
+ /// Button index.
+ /// Return value of Input.GetMouseButtonUp.
+ public static bool GetMouseButtonUp(int button)
+ {
+ return Input.GetMouseButtonUp(button);
+ }
+
+ ///
+ /// Refreshes touch inputs from Instant Preview to reflect the state
+ /// since the last time Update was called.
+ ///
+ public static void Update()
+ {
+ if (!Application.isEditor)
+ {
+ return;
+ }
+
+ IntPtr nativeTouchesPtr;
+ int nativeTouchCount;
+ NativeApi.GetTouches(out nativeTouchesPtr, out nativeTouchCount);
+
+ var structSize = Marshal.SizeOf(typeof(NativeTouch));
+ s_Touches = new Touch[nativeTouchCount];
+ for (var i = 0; i < nativeTouchCount; ++i)
+ {
+ var source = new IntPtr(nativeTouchesPtr.ToInt64() + (i * structSize));
+ var nativeTouch = (NativeTouch)Marshal.PtrToStructure(source, typeof(NativeTouch));
+
+ s_Touches[i] = new Touch()
+ {
+ phase = nativeTouch.Phase,
+
+ // Note that the Unity's screen coordinate (0, 0) starts from bottom left.
+ position = new Vector2(nativeTouch.X, Screen.height - nativeTouch.Y),
+ };
+ }
+ }
+
+ private struct NativeTouch
+ {
+ public TouchPhase Phase;
+ public float X;
+ public float Y;
+ }
+
+ private struct NativeApi
+ {
+ [DllImport(InstantPreviewManager.InstantPreviewNativeApi)]
+ public static extern void GetTouches(out IntPtr touches, out int count);
+ }
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/CameraMetadataManager.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs.meta
similarity index 77%
rename from sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/CameraMetadataManager.cs.meta
rename to sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs.meta
index 6b534b6ea..040ca2529 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/CameraMetadataManager.cs.meta
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
-guid: 5f09b2ba21eed493084a67bd51b5d3a0
-timeCreated: 1511395337
+guid: ed2d2995c742a6c4490fa51080dbf4cf
+timeCreated: 1512422473
licenseType: Pro
MonoImporter:
externalObjects: {}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs
new file mode 100644
index 000000000..a3d84f8b7
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs
@@ -0,0 +1,470 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System;
+ using System.Collections;
+ using System.IO;
+ using System.Runtime.InteropServices;
+ using System.Text;
+ using System.Threading;
+ using GoogleARCore;
+ using UnityEngine;
+ using UnityEngine.Rendering;
+ using UnityEngine.SpatialTracking;
+
+ ///
+ /// Contains methods for managing communication to the Instant Preview
+ /// plugin.
+ ///
+ public static class InstantPreviewManager
+ {
+ ///
+ /// Name of the Instant Preview plugin library.
+ ///
+ public const string InstantPreviewNativeApi = "instant_preview_unity_plugin";
+
+ // Guid is taken from meta file and should never change.
+ private const string k_ApkGuid = "cf7b10762fe921e40a18151a6c92a8a6";
+ private const string k_NoDevicesFoundAdbResult = "error: no devices/emulators found";
+ private const float k_MaxTolerableAspectRatioDifference = 0.1f;
+ private const string k_MismatchedAspectRatioWarningFormatString =
+ "The aspect ratio of your game window is different from the aspect ratio of your Instant Preview camera " +
+ "texture. Please resize your game window's aspect ratio to match, or your preview will be distorted. The " +
+ "camera texture resolution is {0}, {1}.";
+
+ private static readonly WaitForEndOfFrame k_WaitForEndOfFrame = new WaitForEndOfFrame();
+
+ ///
+ /// Coroutine method that communicates to the Instant Preview plugin
+ /// every frame.
+ ///
+ /// If not running in the editor, this does nothing.
+ ///
+ /// Enumerator for a coroutine that updates Instant Preview
+ /// every frame.
+ public static IEnumerator InitializeIfNeeded()
+ {
+ // Terminates if not running in editor.
+ if (!Application.isEditor)
+ {
+ yield break;
+ }
+
+ // User may have explicitly disabled Instant Preview.
+ if (ARCoreProjectSettings.Instance != null &&
+ !ARCoreProjectSettings.Instance.IsInstantPreviewEnabled)
+ {
+ yield break;
+ }
+
+ var adbPath = InstantPreviewManager.GetAdbPath();
+ if (adbPath == null)
+ {
+ Debug.LogError("Instant Preview requires your Unity Android SDK path to be set. Please set it under " +
+ "Preferences/External Tools/Android. You may need to install the Android SDK first.");
+ yield break;
+ }
+ else if (!File.Exists(adbPath))
+ {
+ Debug.LogErrorFormat("adb not found at \"{0}\". Please add adb to your SDK path and restart the Unity editor.", adbPath);
+ yield break;
+ }
+
+ string localVersion;
+ if (!StartServer(adbPath, out localVersion))
+ {
+ yield break;
+ }
+
+ yield return InstallApkAndRunIfConnected(adbPath, localVersion);
+
+ yield return UpdateLoop();
+ }
+
+ ///
+ /// Uploads the latest camera video frame received from Instant Preview
+ /// to the specified texture. The texture might be recreated if it is
+ /// not the right size or null.
+ ///
+ /// Texture variable to store the latest
+ /// Instant Preview video frame.
+ /// True if InstantPreview updated the background texture,
+ /// false if it did not and the texture still needs updating.
+ public static bool UpdateBackgroundTextureIfNeeded(ref Texture2D backgroundTexture)
+ {
+ if (!Application.isEditor)
+ {
+ return false;
+ }
+
+ IntPtr pixelBytes;
+ int width;
+ int height;
+ if (NativeApi.LockCameraTexture(out pixelBytes, out width, out height))
+ {
+ if (backgroundTexture == null || width != backgroundTexture.width ||
+ height != backgroundTexture.height)
+ {
+ backgroundTexture = new Texture2D(width, height, TextureFormat.BGRA32, false);
+ }
+
+ backgroundTexture.LoadRawTextureData(pixelBytes, width * height * 4);
+ backgroundTexture.Apply();
+
+ NativeApi.UnlockCameraTexture();
+ }
+
+ return true;
+ }
+
+ private static IEnumerator UpdateLoop()
+ {
+ // Creates a target texture to capture the preview window onto.
+ // Some video encoders prefer the dimensions to be a multiple of 16.
+ var targetWidth = RoundUpToNearestMultipleOf16(Screen.width);
+ var targetHeight = RoundUpToNearestMultipleOf16(Screen.height);
+ var screenTexture = new RenderTexture(targetWidth, targetHeight, 0);
+
+ var renderEventFunc = NativeApi.GetRenderEventFunc();
+ var shouldConvertToBrgra = SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11;
+ var targetTexture = screenTexture;
+ RenderTexture bgrTexture = null;
+ if (shouldConvertToBrgra)
+ {
+ bgrTexture = new RenderTexture(screenTexture.width, screenTexture.height, 0, RenderTextureFormat.BGRA32);
+ targetTexture = bgrTexture;
+ }
+
+ var loggedAspectRatioWarning = false;
+
+ // Begins update loop. The coroutine will cease when the
+ // ARCoreSession component it's called from is destroyed.
+ for (;;)
+ {
+ yield return k_WaitForEndOfFrame;
+ NativeApi.Update();
+ InstantPreviewInput.Update();
+ AddInstantPreviewTrackedPoseDriverWhenNeeded();
+
+ Graphics.Blit(null, screenTexture);
+
+ if (shouldConvertToBrgra)
+ {
+ Graphics.Blit(screenTexture, bgrTexture);
+ }
+
+ var cameraTexture = Frame.CameraImage.Texture;
+ if (!loggedAspectRatioWarning && cameraTexture != null)
+ {
+ var sourceWidth = cameraTexture.width;
+ var sourceHeight = cameraTexture.height;
+ var sourceAspectRatio = (float)sourceWidth / sourceHeight;
+ var destinationWidth = Screen.width;
+ var destinationHeight = Screen.height;
+ var destinationAspectRatio = (float)destinationWidth / destinationHeight;
+
+ if (Mathf.Abs(sourceAspectRatio - destinationAspectRatio) >
+ k_MaxTolerableAspectRatioDifference)
+ {
+ Debug.LogWarning(string.Format(k_MismatchedAspectRatioWarningFormatString, sourceWidth,
+ sourceHeight));
+ loggedAspectRatioWarning = true;
+ }
+ }
+
+ NativeApi.SendFrame(targetTexture.GetNativeTexturePtr());
+ GL.IssuePluginEvent(renderEventFunc, 69);
+ }
+ }
+
+ private static void AddInstantPreviewTrackedPoseDriverWhenNeeded()
+ {
+ foreach (var poseDriver in Component.FindObjectsOfType())
+ {
+ poseDriver.enabled = false;
+ var gameObject = poseDriver.gameObject;
+ var hasInstantPreviewTrackedPoseDriver =
+ gameObject.GetComponent() != null;
+ if (!hasInstantPreviewTrackedPoseDriver)
+ {
+ gameObject.AddComponent();
+ }
+ }
+ }
+
+ private static string GetAdbPath()
+ {
+ string sdkRoot = null;
+#if UNITY_EDITOR
+ // Gets adb path and starts instant preview server.
+ sdkRoot = UnityEditor.EditorPrefs.GetString("AndroidSdkRoot");
+#endif // UNITY_EDITOR
+
+ if (string.IsNullOrEmpty(sdkRoot))
+ {
+ return null;
+ }
+
+ // Gets adb path from known directory.
+ var adbPath = Path.Combine(Path.GetFullPath(sdkRoot), "platform-tools" + Path.DirectorySeparatorChar + "adb");
+
+ if (Application.platform == RuntimePlatform.WindowsEditor)
+ {
+ adbPath = Path.ChangeExtension(adbPath, "exe");
+ }
+
+ return adbPath;
+ }
+
+ ///
+ /// Tries to install and run the Instant Preview android app.
+ ///
+ /// Path to adb to use for installing.
+ /// Local version of Instant Preview plugin to compare installed APK against.
+ /// Enumerator for coroutine that handles installation if necessary.
+ private static IEnumerator InstallApkAndRunIfConnected(string adbPath, string localVersion)
+ {
+ string apkPath = null;
+
+#if UNITY_EDITOR
+ apkPath = UnityEditor.AssetDatabase.GUIDToAssetPath(k_ApkGuid);
+#endif // !UNITY_EDITOR
+
+ // Early outs if set to install but the apk can't be found.
+ if (!File.Exists(apkPath))
+ {
+ Debug.LogError(
+ string.Format("Trying to install Instant Preview apk but reference to InstantPreview.apk is " +
+ "broken. Couldn't find an asset with .meta file guid={0}", k_ApkGuid));
+ yield break;
+ }
+
+ Result result = new Result();
+
+ Thread checkAdbThread = new Thread((object obj) =>
+ {
+ Result res = (Result)obj;
+ string output;
+ string errors;
+
+ // Gets version of installed apk.
+ RunAdbCommand(adbPath, "shell dumpsys package com.google.ar.core.instantpreview | grep versionName",
+ out output, out errors);
+ string installedVersion = null;
+ if (!string.IsNullOrEmpty(output) && string.IsNullOrEmpty(errors))
+ {
+ installedVersion = output.Substring(output.IndexOf('=') + 1);
+ }
+
+ // Early outs if no device is connected.
+ if (string.Compare(errors, k_NoDevicesFoundAdbResult) == 0)
+ {
+ return;
+ }
+
+ // Prints errors and exits on failure.
+ if (!string.IsNullOrEmpty(errors))
+ {
+ Debug.LogError(errors);
+ return;
+ }
+
+ if (installedVersion == null)
+ {
+ Debug.Log(string.Format(
+ "Instant Preview: app not found on device, attempting to install it from {0}.",
+ apkPath));
+ }
+ else if (installedVersion != localVersion)
+ {
+ Debug.Log(string.Format(
+ "Instant Preview: installed version \"{0}\" does not match local version \"{1}\", attempting upgrade.",
+ installedVersion, localVersion));
+ }
+
+ res.ShouldPromptForInstall = installedVersion != localVersion;
+ });
+ checkAdbThread.Start(result);
+
+ while (!checkAdbThread.Join(0))
+ {
+ yield return 0;
+ }
+
+ if (result.ShouldPromptForInstall)
+ {
+ if (PromptToInstall())
+ {
+ Thread installThread = new Thread(() =>
+ {
+ string output;
+ string errors;
+
+ RunAdbCommand(adbPath,
+ string.Format("uninstall com.google.ar.core.instantpreview", apkPath),
+ out output, out errors);
+
+ RunAdbCommand(adbPath,
+ string.Format("install \"{0}\"", apkPath),
+ out output, out errors);
+
+ // Prints any output from trying to install.
+ if (!string.IsNullOrEmpty(output))
+ {
+ Debug.Log(output);
+ }
+
+ if (!string.IsNullOrEmpty(errors))
+ {
+ if (string.Equals(errors, "Success"))
+ {
+ Debug.Log("Successfully installed Instant Preview app.");
+ }
+ else
+ {
+ Debug.LogError(errors);
+ }
+ }
+ });
+ installThread.Start();
+
+ while (!installThread.Join(0))
+ {
+ yield return 0;
+ }
+ }
+ else
+ {
+ yield break;
+ }
+ }
+
+ if (!NativeApi.IsConnected())
+ {
+ new Thread(() =>
+ {
+ string output;
+ string errors;
+ RunAdbCommand(adbPath,
+ "shell am start -n com.google.ar.core.instantpreview/.InstantPreviewActivity",
+ out output, out errors);
+ }).Start();
+ }
+ }
+
+ private static bool PromptToInstall()
+ {
+#if UNITY_EDITOR
+ return UnityEditor.EditorUtility.DisplayDialog("Instant Preview",
+ "To instantly reflect your changes on device, the " +
+ "Instant Preview app will be installed on your " +
+ "connected phone.\n\nTo permanently disable Instant Preview, " +
+ "uncheck the InstantPreviewEnabled checkbox in Edit/Project Settings/ARCore Instant Preview Enabled.", "Okay", "Don't Install This Time");
+#else
+ return false;
+#endif
+ }
+
+ private static void RunAdbCommand(string fileName, string arguments, out string output, out string errors)
+ {
+ using (var process = new System.Diagnostics.Process())
+ {
+ var startInfo = new System.Diagnostics.ProcessStartInfo(fileName, arguments);
+ startInfo.UseShellExecute = false;
+ startInfo.RedirectStandardError = true;
+ startInfo.RedirectStandardOutput = true;
+ startInfo.CreateNoWindow = true;
+ process.StartInfo = startInfo;
+
+ var outputBuilder = new StringBuilder();
+ var errorBuilder = new StringBuilder();
+ process.OutputDataReceived += (sender, ef) => outputBuilder.Append(ef.Data);
+ process.ErrorDataReceived += (sender, ef) => errorBuilder.Append(ef.Data);
+
+ process.Start();
+ process.BeginOutputReadLine();
+ process.BeginErrorReadLine();
+ process.WaitForExit();
+ process.Close();
+
+ // Trims the output strings to make comparison easier.
+ output = outputBuilder.ToString().Trim();
+ errors = errorBuilder.ToString().Trim();
+ }
+ }
+
+ private static bool StartServer(string adbPath, out string version)
+ {
+ // Tries to start server.
+ const int k_InstantPreviewVersionStringMaxLength = 64;
+ var versionStringBuilder = new StringBuilder(k_InstantPreviewVersionStringMaxLength);
+ var started = NativeApi.InitializeInstantPreview(adbPath, versionStringBuilder,
+ versionStringBuilder.Capacity);
+ if (!started)
+ {
+ Debug.LogErrorFormat("Couldn't start Instant Preview server with adb path: {0}.", adbPath);
+ version = null;
+ return false;
+ }
+
+ version = versionStringBuilder.ToString();
+ Debug.Log("Instant Preview Version: " + version);
+ return true;
+ }
+
+ private static int RoundUpToNearestMultipleOf16(int value)
+ {
+ return (value + 15) & ~15;
+ }
+
+ private struct NativeApi
+ {
+ [DllImport(InstantPreviewNativeApi)]
+ public static extern bool InitializeInstantPreview(
+ string adbPath, StringBuilder version, int versionStringLength);
+
+ [DllImport(InstantPreviewNativeApi)]
+ public static extern void Update();
+
+ [DllImport(InstantPreviewNativeApi)]
+ public static extern IntPtr GetRenderEventFunc();
+
+ [DllImport(InstantPreviewNativeApi)]
+ public static extern void SendFrame(IntPtr renderTexture);
+
+ [DllImport(InstantPreviewNativeApi)]
+ public static extern bool LockCameraTexture(out IntPtr pixelBytes, out int width,
+ out int height);
+
+ [DllImport(InstantPreviewNativeApi)]
+ public static extern void UnlockCameraTexture();
+
+ [DllImport(InstantPreviewNativeApi)]
+ public static extern bool IsConnected();
+ }
+
+ private class Result
+ {
+ public bool ShouldPromptForInstall = false;
+ }
+ }
+}
diff --git a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteVideo.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs.meta
similarity index 77%
rename from sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteVideo.cs.meta
rename to sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs.meta
index 5882d805e..101cb5a44 100644
--- a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteVideo.cs.meta
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
-guid: c700c8e0285e78d43be3948bfe834b2d
-timeCreated: 1508289706
+guid: 8d78f35e6ec68ed4ba199eddf266e308
+timeCreated: 1513720134
licenseType: Pro
MonoImporter:
externalObjects: {}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs
new file mode 100644
index 000000000..4515e1269
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs
@@ -0,0 +1,46 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCore
+{
+ using UnityEngine;
+
+ ///
+ /// Drives cameras when using Instant Preview, since there is no easy way to
+ /// provide data to Unity's TrackedPoseDriver.
+ ///
+ public class InstantPreviewTrackedPoseDriver : MonoBehaviour
+ {
+ ///
+ /// Updates the game object's transform to that of the latest pose
+ /// received by Instant Preview.
+ ///
+ public void Update()
+ {
+ if (!Application.isEditor)
+ {
+ return;
+ }
+
+ transform.position = Frame.Pose.position;
+ transform.rotation = Frame.Pose.rotation;
+ }
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/FrameManager.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs.meta
similarity index 71%
rename from sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/FrameManager.cs.meta
rename to sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs.meta
index 9ed0f4d32..f56757ea9 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/FrameManager.cs.meta
+++ b/sdkproject/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs.meta
@@ -1,7 +1,7 @@
fileFormatVersion: 2
-guid: a14d5807914814ffe873a6ae84fcd5dd
-timeCreated: 1510945633
-licenseType: Free
+guid: 307167e96a9af144789862588807c91b
+timeCreated: 1512450063
+licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Materials/ARBackground.shader b/sdkproject/Assets/GoogleARCore/SDK/Materials/ARBackground.shader
index 65273bc55..a05825d8d 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Materials/ARBackground.shader
+++ b/sdkproject/Assets/GoogleARCore/SDK/Materials/ARBackground.shader
@@ -58,5 +58,60 @@
}
}
- FallBack Off
+ Subshader
+ {
+ Pass
+ {
+ ZWrite Off
+
+ CGPROGRAM
+
+ #pragma exclude_renderers gles3
+ #pragma vertex vert
+ #pragma fragment frag
+
+ #include "UnityCG.cginc"
+
+ uniform float4 _UvTopLeftRight;
+ uniform float4 _UvBottomLeftRight;
+
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float2 uv : TEXCOORD0;
+ };
+
+ struct v2f
+ {
+ float2 uv : TEXCOORD0;
+ float4 vertex : SV_POSITION;
+ };
+
+ v2f vert(appdata v)
+ {
+ float2 uvTop = lerp(_UvTopLeftRight.xy, _UvTopLeftRight.zw, v.uv.x);
+ float2 uvBottom = lerp(_UvBottomLeftRight.xy, _UvBottomLeftRight.zw, v.uv.x);
+
+ v2f o;
+ o.vertex = UnityObjectToClipPos(v.vertex);
+ o.uv = lerp(uvTop, uvBottom, v.uv.y);
+
+ // Instant preview's texture is transformed differently.
+ o.uv = o.uv.yx;
+ o.uv.x = 1.0 - o.uv.x;
+
+ return o;
+ }
+
+ sampler2D _MainTex;
+
+ fixed4 frag(v2f i) : SV_Target
+ {
+ return tex2D(_MainTex, i.uv);
+ }
+ ENDCG
+ }
+ }
+
+ FallBack Off
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar b/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar
index 43b413be2..9d9732ffe 100644
Binary files a/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar differ
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar.meta b/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar.meta
index 37152d392..a5cc8b2e5 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar.meta
+++ b/sdkproject/Assets/GoogleARCore/SDK/Plugins/arcore_client.aar.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 19eddef6ceb6961489b26fb8bf19f1e5
-timeCreated: 1510180815
+timeCreated: 1517361316
licenseType: Pro
PluginImporter:
externalObjects: {}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar
new file mode 100644
index 000000000..8a1817891
Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar differ
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar.meta b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar.meta
new file mode 100644
index 000000000..b610eba46
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar.meta
@@ -0,0 +1,31 @@
+fileFormatVersion: 2
+guid: e2fd4640a9f7349438a5920ea2fb35f2
+timeCreated: 1518222616
+licenseType: Pro
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ isPreloaded: 0
+ isOverridable: 0
+ 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/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar
new file mode 100644
index 000000000..be40e73d9
Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar differ
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar.meta b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar.meta
new file mode 100644
index 000000000..3c485d19f
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar.meta
@@ -0,0 +1,31 @@
+fileFormatVersion: 2
+guid: cb4b89ba21eac484797cfca938a1a5ea
+timeCreated: 1518222591
+licenseType: Pro
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ isPreloaded: 0
+ isOverridable: 0
+ 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/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so
index 63a0d85d0..11694aa5f 100644
Binary files a/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so differ
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so.meta b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so.meta
index 9dbfe25cb..9272c6dc6 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so.meta
+++ b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarcore_unity_api.so.meta
@@ -23,6 +23,7 @@ PluginImporter:
Exclude OSXUniversal: 1
Exclude Win: 1
Exclude Win64: 1
+ Exclude iOS: 1
- first:
Android: Android
second:
@@ -30,7 +31,7 @@ PluginImporter:
settings:
CPU: ARMv7
- first:
- Any:
+ Any:
second:
enabled: 0
settings: {}
@@ -90,6 +91,13 @@ PluginImporter:
enabled: 0
settings:
CPU: AnyCPU
- userData:
- assetBundleName:
- assetBundleVariant:
+ - first:
+ iPhone: iOS
+ second:
+ enabled: 0
+ settings:
+ CompileFlags:
+ FrameworkDependencies:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarpresto_api.so b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarpresto_api.so
new file mode 100644
index 000000000..2b010c931
Binary files /dev/null and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarpresto_api.so differ
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarpresto_api.so.meta b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarpresto_api.so.meta
new file mode 100644
index 000000000..e803faa08
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Plugins/libarpresto_api.so.meta
@@ -0,0 +1,95 @@
+fileFormatVersion: 2
+guid: ccde220b10a8b441a9b728f80d014cfe
+timeCreated: 1513372698
+licenseType: Pro
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ isPreloaded: 0
+ isOverridable: 0
+ platformData:
+ - first:
+ '': Any
+ second:
+ enabled: 0
+ settings:
+ Exclude Android: 0
+ Exclude Editor: 1
+ Exclude Linux: 1
+ Exclude Linux64: 1
+ Exclude LinuxUniversal: 1
+ Exclude OSXUniversal: 1
+ Exclude Win: 1
+ Exclude Win64: 1
+ - first:
+ Android: Android
+ second:
+ enabled: 1
+ settings:
+ CPU: ARMv7
+ - first:
+ Any:
+ second:
+ enabled: 0
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ DefaultValueInitialized: true
+ OS: AnyOS
+ - first:
+ Facebook: Win
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Facebook: Win64
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Linux
+ second:
+ enabled: 0
+ settings:
+ CPU: x86
+ - first:
+ Standalone: Linux64
+ second:
+ enabled: 0
+ settings:
+ CPU: x86_64
+ - first:
+ Standalone: LinuxUniversal
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ Standalone: OSXUniversal
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Win
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Win64
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/unityandroidpermissions.aar b/sdkproject/Assets/GoogleARCore/SDK/Plugins/unityandroidpermissions.aar
index 44adf1b1e..acb6aa5a5 100644
Binary files a/sdkproject/Assets/GoogleARCore/SDK/Plugins/unityandroidpermissions.aar and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/unityandroidpermissions.aar differ
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Plugins/unitygar.aar b/sdkproject/Assets/GoogleARCore/SDK/Plugins/unitygar.aar
index 23711fe70..e180693f9 100644
Binary files a/sdkproject/Assets/GoogleARCore/SDK/Plugins/unitygar.aar and b/sdkproject/Assets/GoogleARCore/SDK/Plugins/unitygar.aar differ
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreBackgroundRenderer.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreBackgroundRenderer.cs
index 9e85dccae..cb49abfe8 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreBackgroundRenderer.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreBackgroundRenderer.cs
@@ -26,9 +26,6 @@ namespace GoogleARCore
using UnityEngine;
using UnityEngine.XR;
- //// TODO (mtsmall): Consider if this component is the best way to expose background rendering and discuss approach
- //// with Unity.
-
///
/// Renders the device's camera as a background to the attached Unity camera component.
///
@@ -47,12 +44,6 @@ public class ARCoreBackgroundRenderer : MonoBehaviour
private void OnEnable()
{
- if (Application.isEditor)
- {
- enabled = false;
- return;
- }
-
if (BackgroundMaterial == null)
{
Debug.LogError("ArCameraBackground:: No material assigned.");
@@ -64,24 +55,21 @@ private void OnEnable()
private void OnDisable()
{
- if (m_BackgroundRenderer != null)
- {
- m_BackgroundRenderer.camera = null;
- m_BackgroundRenderer = null;
- }
+ Disable();
}
private void Update()
{
if (BackgroundMaterial == null)
{
- // A background rending material has not been assigned.
+ Disable();
return;
}
- else if (Frame.CameraImage.Texture == null)
+
+ Texture backgroundTexture = Frame.CameraImage.Texture;
+ if (backgroundTexture == null)
{
- // TODO (mtsmall): Consider rendering a default background in this case.
- // No texture is available.
+ Disable();
return;
}
@@ -89,16 +77,16 @@ private void Update()
const string topLeftRightVar = "_UvTopLeftRight";
const string bottomLeftRightVar = "_UvBottomLeftRight";
- BackgroundMaterial.SetTexture(mainTexVar, Frame.CameraImage.Texture);
-
- ApiDisplayUvCoords uvQuad = Frame.CameraImage.DisplayUvCoords;
+ BackgroundMaterial.SetTexture(mainTexVar, backgroundTexture);
+ var uvQuad = Frame.CameraImage.DisplayUvCoords;
BackgroundMaterial.SetVector(topLeftRightVar,
new Vector4(uvQuad.TopLeft.x, uvQuad.TopLeft.y, uvQuad.TopRight.x, uvQuad.TopRight.y));
BackgroundMaterial.SetVector(bottomLeftRightVar,
new Vector4(uvQuad.BottomLeft.x, uvQuad.BottomLeft.y, uvQuad.BottomRight.x, uvQuad.BottomRight.y));
- m_Camera.projectionMatrix = Frame.CameraImage.GetCameraProjectionMatrix(m_Camera.nearClipPlane, m_Camera.farClipPlane);
+ m_Camera.projectionMatrix = Frame.CameraImage.GetCameraProjectionMatrix(
+ m_Camera.nearClipPlane, m_Camera.farClipPlane);
if (m_BackgroundRenderer == null)
{
@@ -108,5 +96,14 @@ private void Update()
m_BackgroundRenderer.mode = ARRenderMode.MaterialAsBackground;
}
}
+
+ private void Disable()
+ {
+ if (m_BackgroundRenderer != null)
+ {
+ m_BackgroundRenderer.camera = null;
+ m_BackgroundRenderer = null;
+ }
+ }
}
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreSession.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreSession.cs
index 9b025fcf9..29c000e1d 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreSession.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ARCoreSession.cs
@@ -20,11 +20,8 @@
namespace GoogleARCore
{
- using System;
- using System.Runtime.InteropServices;
using GoogleARCoreInternal;
using UnityEngine;
- using UnityEngine.XR;
///
/// A component that manages the ARCore Session in a Unity scene.
@@ -37,47 +34,12 @@ public class ARCoreSession : MonoBehaviour
[Tooltip("A scriptable object specifying the ARCore session configuration.")]
public ARCoreSessionConfig SessionConfig;
- ///
- /// Toggles whether the tango service should be automatically connected upon Awake.
- ///
- [Tooltip("Toggles whether the tango service should be automatically connected upon Awake.")]
- public bool ConnectOnAwake = false;
-
- private SessionManager m_SessionManager;
-
///
/// Unity Awake.
///
public void Awake()
{
- if (Application.isEditor)
- {
- enabled = false;
- return;
- }
-
- if (FindObjectsOfType().Length > 1)
- {
- ARDebug.LogError("Multiple SessionComponents present in the game scene. Destroying the gameobject " +
- "of the newest one.");
- Destroy(gameObject);
- return;
- }
-
- m_SessionManager = SessionManager.CreateSession();
- Session.Initialize(m_SessionManager);
-
- if (Session.ConnectionState != SessionConnectionState.Uninitialized)
- {
- ARDebug.LogError("Could not create an ARCore session. The current Unity Editor may not support this " +
- "version of ARCore.");
- return;
- }
-
- if (ConnectOnAwake)
- {
- Connect();
- }
+ LifecycleManager.Instance.CreateSession(this);
}
///
@@ -85,132 +47,23 @@ public void Awake()
///
public void OnDestroy()
{
- Frame.Destroy();
- Session.Destroy();
+ LifecycleManager.Instance.DestroySession();
}
///
- /// Unity Update.
+ /// Unity OnEnable.
///
- public void Update()
+ public void OnEnable()
{
- if (m_SessionManager == null)
- {
- return;
- }
-
- AsyncTask.OnUpdate();
+ LifecycleManager.Instance.EnableSession();
}
///
- /// Connects an ARSession using {@link sessionConfig} configuration. Note that if user permissions are needed
- /// they will be requested and thus this is an asynchronous method.
+ /// Unity OnDisable.
///
- /// An {@link AsyncTask} that completes when the connection has been made or failed.
- public AsyncTask Connect()
+ public void OnDisable()
{
- return Connect(SessionConfig);
- }
-
- ///
- /// Connects an ARSession. Note that if user permissions are needed they will be requested and thus this is an
- /// asynchronous method.
- ///
- /// The session configuration.
- /// An {@link AsyncTask} that completes when the connection has been made or failed.
- public AsyncTask Connect(ARCoreSessionConfig sessionConfig)
- {
- const string androidCameraPermissionName = "android.permission.CAMERA";
-
- if (m_SessionManager == null)
- {
- ARDebug.LogError("Cannot connect because ARCoreSession failed to initialize.");
- return new AsyncTask(SessionConnectionState.Uninitialized);
- }
-
- if (sessionConfig == null)
- {
- ARDebug.LogError("Unable to connect ARSession session due to missing ARSessionConfig.");
- m_SessionManager.ConnectionState = SessionConnectionState.MissingConfiguration;
- return new AsyncTask(Session.ConnectionState);
- }
-
- // We have already connected at least once.
- if (Session.ConnectionState != SessionConnectionState.Uninitialized)
- {
- ARDebug.LogError("Multiple attempts to connect to the ARSession. Note that the ARSession connection " +
- "spans the lifetime of the application and cannot be reconfigured. This will change in future " +
- "versions of ARCore.");
- return new AsyncTask(Session.ConnectionState);
- }
-
- // Create an asynchronous task for the potential permissions flow and service connection.
- Action onTaskComplete;
- var returnTask = new AsyncTask(out onTaskComplete);
- returnTask.ThenAction((connectionState) =>
- {
- m_SessionManager.ConnectionState = connectionState;
- });
-
- // Attempt service connection immediately if permissions are granted.
- if (AndroidPermissionsManager.IsPermissionGranted(androidCameraPermissionName))
- {
- _ResumeSession(sessionConfig, onTaskComplete);
- return returnTask;
- }
-
- // Request needed permissions and attempt service connection if granted.
- AndroidPermissionsManager.RequestPermission(androidCameraPermissionName).ThenAction((requestResult) =>
- {
- if (requestResult.IsAllGranted)
- {
- _ResumeSession(sessionConfig, onTaskComplete);
- }
- else
- {
- ARDebug.LogError("ARCore connection failed because a needed permission was rejected.");
- onTaskComplete(SessionConnectionState.UserRejectedNeededPermission);
- }
- });
-
- return returnTask;
- }
-
- ///
- /// Connects to the ARCore service.
- ///
- /// The session configuration to connect with.
- /// A callback for when the result of the connection attempt is known.
- private void _ResumeSession(ARCoreSessionConfig sessionConfig, Action onComplete)
- {
- if (!m_SessionManager.CheckSupported(sessionConfig))
- {
- ARDebug.LogError("The requested ARCore session configuration is not supported.");
- onComplete(SessionConnectionState.InvalidConfiguration);
- return;
- }
-
- if (!m_SessionManager.SetConfiguration(sessionConfig))
- {
- ARDebug.LogError("ARCore connection failed because the current configuration is not supported.");
- onComplete(SessionConnectionState.InvalidConfiguration);
- return;
- }
-
- Frame.Initialize(m_SessionManager.FrameManager);
-
- // ArSession_resume needs to be called in the UI thread due to b/69682628.
- AsyncTask.PerformActionInUIThread(() =>
- {
- if (!m_SessionManager.Resume())
- {
- onComplete(SessionConnectionState.ConnectToServiceFailed);
- }
- else
- {
- onComplete(SessionConnectionState.Connected);
- }
- });
+ LifecycleManager.Instance.DisableSession();
}
}
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Anchor.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Anchor.cs
index d28046eb0..b7e6dd43c 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Anchor.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Anchor.cs
@@ -36,7 +36,7 @@ public class Anchor : MonoBehaviour
private IntPtr m_AnchorNativeHandle = IntPtr.Zero;
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
private TrackingState m_LastFrameTrackingState = TrackingState.Stopped;
@@ -47,7 +47,21 @@ public TrackingState TrackingState
{
get
{
- return m_NativeApi.Anchor.GetTrackingState(m_AnchorNativeHandle);
+ // TODO (b/73256094): Remove isTracking when fixed.
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ var isTracking = LifecycleManager.Instance.SessionStatus == SessionStatus.Tracking;
+ if (nativeSession != m_NativeSession)
+ {
+ // Anchors from another session are considered stopped.
+ return TrackingState.Stopped;
+ }
+ else if (!isTracking)
+ {
+ // If there are no new frames coming in we must manually return paused.
+ return TrackingState.Paused;
+ }
+
+ return m_NativeSession.AnchorApi.GetTrackingState(m_AnchorNativeHandle);
}
}
@@ -55,7 +69,7 @@ public TrackingState TrackingState
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
Justification = "Internal")]
- public static Anchor AnchorFactory(IntPtr anchorNativeHandle, NativeApi nativeApi)
+ public static Anchor AnchorFactory(IntPtr anchorNativeHandle, NativeSession nativeApi, bool isCreate = true)
{
if (anchorNativeHandle == IntPtr.Zero)
{
@@ -66,18 +80,23 @@ public static Anchor AnchorFactory(IntPtr anchorNativeHandle, NativeApi nativeAp
if (s_AnchorDict.TryGetValue(anchorNativeHandle, out result))
{
// Release acquired handle and return cached result
- result.m_NativeApi.Anchor.Release(anchorNativeHandle);
+ result.m_NativeSession.AnchorApi.Release(anchorNativeHandle);
return result;
}
- Anchor anchor = (new GameObject()).AddComponent();
- anchor.gameObject.name = "Anchor";
- anchor.m_AnchorNativeHandle = anchorNativeHandle;
- anchor.m_NativeApi = nativeApi;
- anchor.Update();
+ if (isCreate)
+ {
+ Anchor anchor = (new GameObject()).AddComponent();
+ anchor.gameObject.name = "Anchor";
+ anchor.m_AnchorNativeHandle = anchorNativeHandle;
+ anchor.m_NativeSession = nativeApi;
+ anchor.Update();
+
+ s_AnchorDict.Add(anchorNativeHandle, anchor);
+ return anchor;
+ }
- s_AnchorDict.Add(anchorNativeHandle, anchor);
- return anchor;
+ return null;
}
//// @endcond
@@ -91,7 +110,7 @@ private void Update()
return;
}
- var pose = m_NativeApi.Anchor.GetPose(m_AnchorNativeHandle);
+ var pose = m_NativeSession.AnchorApi.GetPose(m_AnchorNativeHandle);
transform.position = pose.position;
transform.rotation = pose.rotation;
@@ -116,7 +135,7 @@ private void OnDestroy()
}
s_AnchorDict.Remove(m_AnchorNativeHandle);
- m_NativeApi.Anchor.Release(m_AnchorNativeHandle);
+ m_NativeSession.AnchorApi.Release(m_AnchorNativeHandle);
}
}
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/AndroidPermissionsManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/AndroidPermissionsManager.cs
index 4e3842851..36ed83f69 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/AndroidPermissionsManager.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/AndroidPermissionsManager.cs
@@ -54,6 +54,11 @@ public AndroidPermissionsManager() : base("com.unity3d.plugin.UnityAndroidPermis
/// false.
public static bool IsPermissionGranted(string permissionName)
{
+ if (Application.isEditor)
+ {
+ return true;
+ }
+
return GetPermissionsService().Call("IsPermissionGranted", GetUnityActivity(), permissionName);
}
@@ -66,6 +71,12 @@ public static bool IsPermissionGranted(string permissionName)
/// when another permissions request is pending null will be returned instead.
public static AsyncTask RequestPermission(string permissionName)
{
+ if (AndroidPermissionsManager.IsPermissionGranted(permissionName))
+ {
+ return new AsyncTask(new AndroidPermissionsRequestResult(
+ new string[] { permissionName }, new bool[] { true }));
+ }
+
if (s_CurrentRequest != null)
{
ARDebug.LogError("Attempted to make simultaneous Android permissions requests.");
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api.meta
index 257b6382b..9f5462908 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api.meta
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api.meta
@@ -1,8 +1,8 @@
fileFormatVersion: 2
-guid: 1a99e3cb6bf111645b59b61e6e275c1f
+guid: 11813694e8abb437eb9ef46ed1cc67c5
folderAsset: yes
-timeCreated: 1519217563
-licenseType: Pro
+timeCreated: 1502400396
+licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/AnchorApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/AnchorApi.cs
index 920ac862f..266e9c5c8 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/AnchorApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/AnchorApi.cs
@@ -31,33 +31,33 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class AnchorApi
{
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
- public AnchorApi(NativeApi nativeApi)
+ public AnchorApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
public Pose GetPose(IntPtr anchorHandle)
{
- var poseHandle = m_NativeApi.Pose.Create();
- ExternApi.ArAnchor_getPose(m_NativeApi.SessionHandle, anchorHandle, poseHandle);
- Pose resultPose = m_NativeApi.Pose.ExtractPoseValue(poseHandle);
- m_NativeApi.Pose.Destroy(poseHandle);
+ var poseHandle = m_NativeSession.PoseApi.Create();
+ ExternApi.ArAnchor_getPose(m_NativeSession.SessionHandle, anchorHandle, poseHandle);
+ Pose resultPose = m_NativeSession.PoseApi.ExtractPoseValue(poseHandle);
+ m_NativeSession.PoseApi.Destroy(poseHandle);
return resultPose;
}
public TrackingState GetTrackingState(IntPtr anchorHandle)
{
ApiTrackingState trackingState = ApiTrackingState.Stopped;
- ExternApi.ArAnchor_getTrackingState(m_NativeApi.SessionHandle, anchorHandle,
+ ExternApi.ArAnchor_getTrackingState(m_NativeSession.SessionHandle, anchorHandle,
ref trackingState);
return trackingState.ToTrackingState();
}
public void Detach(IntPtr anchorHandle)
{
- ExternApi.ArAnchor_detach(m_NativeApi.SessionHandle, anchorHandle);
+ ExternApi.ArAnchor_detach(m_NativeSession.SessionHandle, anchorHandle);
}
public void Release(IntPtr anchorHandle)
@@ -68,21 +68,21 @@ public void Release(IntPtr anchorHandle)
public IntPtr CreateList()
{
IntPtr listHandle = IntPtr.Zero;
- ExternApi.ArAnchorList_create(m_NativeApi.SessionHandle, ref listHandle);
+ ExternApi.ArAnchorList_create(m_NativeSession.SessionHandle, ref listHandle);
return listHandle;
}
public int GetListSize(IntPtr anchorListHandle)
{
int size = 0;
- ExternApi.ArAnchorList_getSize(m_NativeApi.SessionHandle, anchorListHandle, ref size);
+ ExternApi.ArAnchorList_getSize(m_NativeSession.SessionHandle, anchorListHandle, ref size);
return size;
}
public IntPtr AcquireListItem(IntPtr anchorListHandle, int index)
{
IntPtr anchorHandle = IntPtr.Zero;
- ExternApi.ArAnchorList_acquireItem(m_NativeApi.SessionHandle, anchorListHandle, index,
+ ExternApi.ArAnchorList_acquireItem(m_NativeSession.SessionHandle, anchorListHandle, index,
ref anchorHandle);
return anchorHandle;
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallStatusExtensions.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallStatusExtensions.cs
new file mode 100644
index 000000000..a719f1723
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallStatusExtensions.cs
@@ -0,0 +1,55 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
+ using GoogleARCore;
+
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ public static class ApiApkInstallStatusExtensions
+ {
+ public static ApkInstallationStatus ToApkInstallationStatus(this ApiApkInstallationStatus apiStatus)
+ {
+ switch (apiStatus)
+ {
+ case ApiApkInstallationStatus.Uninitialized:
+ return ApkInstallationStatus.Uninitialized;
+ case ApiApkInstallationStatus.Requested:
+ return ApkInstallationStatus.Requested;
+ case ApiApkInstallationStatus.Success:
+ return ApkInstallationStatus.Success;
+ case ApiApkInstallationStatus.Error:
+ return ApkInstallationStatus.Error;
+ case ApiApkInstallationStatus.ErrorDeviceNotCompatible:
+ return ApkInstallationStatus.ErrorDeviceNotCompatible;
+ case ApiApkInstallationStatus.ErrorAndroidVersionNotSupported:
+ return ApkInstallationStatus.ErrorAndroidVersionNotSupported;
+ case ApiApkInstallationStatus.ErrorUserDeclined:
+ return ApkInstallationStatus.ErrorUserDeclined;
+ default:
+ UnityEngine.Debug.LogErrorFormat("Unexpected ApiApkInstallStatus status {0}", apiStatus);
+ return ApkInstallationStatus.Error;
+ }
+ }
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeApi.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallStatusExtensions.cs.meta
similarity index 71%
rename from sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeApi.cs.meta
rename to sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallStatusExtensions.cs.meta
index 81823db9e..2cac95948 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeApi.cs.meta
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallStatusExtensions.cs.meta
@@ -1,7 +1,7 @@
fileFormatVersion: 2
-guid: 7d20494e9cc8541f4bf16ac8a1eec2ef
-timeCreated: 1509308701
-licenseType: Free
+guid: 3345208dea93f4ca6a361f8852a87704
+timeCreated: 1517873495
+licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallationStatus.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallationStatus.cs
new file mode 100644
index 000000000..5cb248468
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallationStatus.cs
@@ -0,0 +1,37 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System.Diagnostics.CodeAnalysis;
+
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ public enum ApiApkInstallationStatus
+ {
+ Uninitialized = 0,
+ Requested = 1,
+ Success = 100,
+ Error = 200,
+ ErrorDeviceNotCompatible = 201,
+ ErrorAndroidVersionNotSupported = 202,
+ ErrorUserDeclined = 203,
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallationStatus.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallationStatus.cs.meta
new file mode 100644
index 000000000..ec82243b8
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiApkInstallationStatus.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 7aa753c5e597b4841b03ea5f7f21326f
+timeCreated: 1517874709
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailability.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailability.cs
new file mode 100644
index 000000000..e4d652cdb
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailability.cs
@@ -0,0 +1,37 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System.Diagnostics.CodeAnalysis;
+
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ public enum ApiAvailability
+ {
+ UnknownError = 0,
+ UnknownChecking = 1,
+ UnknownTimedOut = 2,
+ UnsupportedDeviceNotCapable = 100,
+ SupportedNotInstalled = 201,
+ SupportedApkTooOld = 202,
+ SupportedInstalled = 203
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailability.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailability.cs.meta
new file mode 100644
index 000000000..3d4bcc357
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailability.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: a2ff5d80474fa4dcf979bc5ec9b89ca4
+timeCreated: 1517858100
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailabilityExtensions.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailabilityExtensions.cs
new file mode 100644
index 000000000..70abf8e0b
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailabilityExtensions.cs
@@ -0,0 +1,55 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
+ using GoogleARCore;
+
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ public static class ApiAvailabilityExtensions
+ {
+ public static ApkAvailabilityStatus ToApkAvailabilityStatus(this ApiAvailability apiStatus)
+ {
+ switch (apiStatus)
+ {
+ case ApiAvailability.UnknownError:
+ return ApkAvailabilityStatus.UnknownError;
+ case ApiAvailability.UnknownChecking:
+ return ApkAvailabilityStatus.UnknownChecking;
+ case ApiAvailability.UnknownTimedOut:
+ return ApkAvailabilityStatus.UnknownTimedOut;
+ case ApiAvailability.UnsupportedDeviceNotCapable:
+ return ApkAvailabilityStatus.UnsupportedDeviceNotCapable;
+ case ApiAvailability.SupportedNotInstalled:
+ return ApkAvailabilityStatus.SupportedNotInstalled;
+ case ApiAvailability.SupportedApkTooOld:
+ return ApkAvailabilityStatus.SupportedApkTooOld;
+ case ApiAvailability.SupportedInstalled:
+ return ApkAvailabilityStatus.SupportedInstalled;
+ default:
+ UnityEngine.Debug.LogErrorFormat("Unexpected ApiAvailability status {0}", apiStatus);
+ return ApkAvailabilityStatus.UnknownError;
+ }
+ }
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailabilityExtensions.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailabilityExtensions.cs.meta
new file mode 100644
index 000000000..8d50e66d7
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiAvailabilityExtensions.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: da78fe0b9a17c46dea099872f469ccd7
+timeCreated: 1517871435
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiConstants.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiConstants.cs
index d023330ce..6bfa7a5b6 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiConstants.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiConstants.cs
@@ -31,8 +31,13 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public static class ApiConstants
{
+#if !UNITY_EDITOR
public const string ARCoreNativeApi = "arcore_sdk";
public const string ARCoreShimApi = "arcore_unity_api";
+#else
+ public const string ARCoreNativeApi = InstantPreviewManager.InstantPreviewNativeApi;
+ public const string ARCoreShimApi = InstantPreviewManager.InstantPreviewNativeApi;
+#endif
// NDK camera API is a system API after Android 24.
public const string NdkCameraApi = "camera2ndk";
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApiLightEstimationMode.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiLightEstimationMode.cs
similarity index 100%
rename from sdkproject/Assets/GoogleARCore/SDK/Scripts/ApiLightEstimationMode.cs
rename to sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiLightEstimationMode.cs
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApiLightEstimationMode.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiLightEstimationMode.cs.meta
similarity index 77%
rename from sdkproject/Assets/GoogleARCore/SDK/Scripts/ApiLightEstimationMode.cs.meta
rename to sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiLightEstimationMode.cs.meta
index de2745c7c..e698b6147 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApiLightEstimationMode.cs.meta
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiLightEstimationMode.cs.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
-guid: 17818a5e2bd077f4fbaf893257754c05
-timeCreated: 1512178510
+guid: 31136b31f422e49a5b4307c1b3bff384
+timeCreated: 1512782847
licenseType: Pro
MonoImporter:
externalObjects: {}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoConfig.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoConfig.cs
new file mode 100644
index 000000000..76e67235b
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoConfig.cs
@@ -0,0 +1,46 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System.Diagnostics.CodeAnalysis;
+ using System.Runtime.InteropServices;
+ using GoogleARCore;
+
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ [StructLayout(LayoutKind.Sequential)]
+ public struct ApiPrestoConfig
+ {
+ public ApiUpdateMode UpdateMode;
+ public ApiPlaneFindingMode PlaneFindingMode;
+ public ApiLightEstimationMode LightEstimationMode;
+
+ public ApiPrestoConfig(ARCoreSessionConfig config)
+ {
+ UpdateMode = config.MatchCameraFramerate ?
+ ApiUpdateMode.Blocking : ApiUpdateMode.LatestCameraImage;
+ PlaneFindingMode = config.EnablePlaneFinding ?
+ ApiPlaneFindingMode.Horizontal : ApiPlaneFindingMode.Disabled;
+ LightEstimationMode = config.EnableLightEstimation ?
+ ApiLightEstimationMode.AmbientIntensity : ApiLightEstimationMode.Disabled;
+ }
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoConfig.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoConfig.cs.meta
new file mode 100644
index 000000000..66775228e
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoConfig.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: d8a0d471a5e1c486fb61de90a976a6d3
+timeCreated: 1518035095
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatus.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatus.cs
new file mode 100644
index 000000000..85bdacc6a
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatus.cs
@@ -0,0 +1,42 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System.Diagnostics.CodeAnalysis;
+
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ public enum ApiPrestoStatus
+ {
+ Uninitialized = 0,
+ RequestingApkInstall = 1,
+ RequestingPermission = 2,
+
+ Resumed = 100,
+ ResumedNotTracking = 101,
+ Paused = 102,
+
+ ErrorFatal = 200,
+ ErrorApkNotAvailable = 201,
+ ErrorPermissionNotGranted = 202,
+ ErrorSessionConfigurationNotSupported = 203,
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatus.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatus.cs.meta
new file mode 100644
index 000000000..6125bc008
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatus.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: f77bf9ab0d39f4875b26d70fce838285
+timeCreated: 1513291504
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatusExtensions.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatusExtensions.cs
new file mode 100644
index 000000000..d223292f4
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatusExtensions.cs
@@ -0,0 +1,59 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System.Diagnostics.CodeAnalysis;
+ using GoogleARCore;
+
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ public static class ApiPrestoStatusExtensions
+ {
+ public static SessionStatus ToSessionStatus(this ApiPrestoStatus prestoStatus)
+ {
+ switch (prestoStatus)
+ {
+ case ApiPrestoStatus.Uninitialized:
+ return SessionStatus.None;
+ case ApiPrestoStatus.RequestingApkInstall:
+ case ApiPrestoStatus.RequestingPermission:
+ return SessionStatus.Initializing;
+ case ApiPrestoStatus.Resumed:
+ return SessionStatus.Tracking;
+ case ApiPrestoStatus.ResumedNotTracking:
+ return SessionStatus.LostTracking;
+ case ApiPrestoStatus.Paused:
+ return SessionStatus.NotTracking;
+ case ApiPrestoStatus.ErrorFatal:
+ return SessionStatus.FatalError;
+ case ApiPrestoStatus.ErrorApkNotAvailable:
+ return SessionStatus.ErrorApkNotAvailable;
+ case ApiPrestoStatus.ErrorPermissionNotGranted:
+ return SessionStatus.ErrorPermissionNotGranted;
+ case ApiPrestoStatus.ErrorSessionConfigurationNotSupported:
+ return SessionStatus.ErrorSessionConfigurationNotSupported;
+ default:
+ UnityEngine.Debug.LogErrorFormat("Unexpected presto status {0}", prestoStatus);
+ return SessionStatus.FatalError;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatusExtensions.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatusExtensions.cs.meta
new file mode 100644
index 000000000..1a53f6ab2
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiPrestoStatusExtensions.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 20257a5d02b574ec8a372bb9e319d8b3
+timeCreated: 1513294266
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationMode.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationMode.cs
new file mode 100644
index 000000000..fdc72ad8b
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationMode.cs
@@ -0,0 +1,32 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System.Diagnostics.CodeAnalysis;
+
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ public enum ApiTrackedPointOrientationMode
+ {
+ Identity = 0,
+ SurfaceNormal = 1,
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationMode.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationMode.cs.meta
new file mode 100644
index 000000000..ac3c10cfb
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationMode.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 1e55289de34ec44b191ed1bdc5b17c9d
+timeCreated: 1517185900
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationModeExtensions.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationModeExtensions.cs
new file mode 100644
index 000000000..ef3a7668b
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationModeExtensions.cs
@@ -0,0 +1,47 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System;
+ using System.Diagnostics.CodeAnalysis;
+ using GoogleARCore;
+
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ public static class ApiTrackedPointOrientationModeExtensions
+ {
+ public static TrackedPointOrientationMode ToTrackedPointOrientationMode(
+ this ApiTrackedPointOrientationMode apiMode)
+ {
+ switch (apiMode)
+ {
+ case ApiTrackedPointOrientationMode.Identity:
+ return TrackedPointOrientationMode.Identity;
+ case ApiTrackedPointOrientationMode.SurfaceNormal:
+ return TrackedPointOrientationMode.SurfaceNormal;
+ default:
+ ARDebug.LogError("Invalid value for ApiTrackedPointOrientationMode.");
+ return TrackedPointOrientationMode.Identity;
+ }
+ }
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationModeExtensions.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationModeExtensions.cs.meta
new file mode 100644
index 000000000..c73b189fc
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/ApiTrackedPointOrientationModeExtensions.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: f7f21e3757d39475aae8f4a13d02253a
+timeCreated: 1517185900
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraApi.cs
index 1cb3847e0..aadf63a4e 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraApi.cs
@@ -31,17 +31,17 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class CameraApi
{
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
- public CameraApi(NativeApi nativeApi)
+ public CameraApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
public TrackingState GetTrackingState(IntPtr cameraHandle)
{
ApiTrackingState apiTrackingState = ApiTrackingState.Stopped;
- ExternApi.ArCamera_getTrackingState(m_NativeApi.SessionHandle,
+ ExternApi.ArCamera_getTrackingState(m_NativeSession.SessionHandle,
cameraHandle, ref apiTrackingState);
return apiTrackingState.ToTrackingState();
}
@@ -53,18 +53,18 @@ public Pose GetPose(IntPtr cameraHandle)
return Pose.identity;
}
- IntPtr poseHandle = m_NativeApi.Pose.Create();
- ExternApi.ArCamera_getDisplayOrientedPose(m_NativeApi.SessionHandle, cameraHandle,
+ IntPtr poseHandle = m_NativeSession.PoseApi.Create();
+ ExternApi.ArCamera_getDisplayOrientedPose(m_NativeSession.SessionHandle, cameraHandle,
poseHandle);
- Pose resultPose = m_NativeApi.Pose.ExtractPoseValue(poseHandle);
- m_NativeApi.Pose.Destroy(poseHandle);
+ Pose resultPose = m_NativeSession.PoseApi.ExtractPoseValue(poseHandle);
+ m_NativeSession.PoseApi.Destroy(poseHandle);
return resultPose;
}
public Matrix4x4 GetProjectionMatrix(IntPtr cameraHandle, float near, float far)
{
Matrix4x4 matrix = Matrix4x4.identity;
- ExternApi.ArCamera_getProjectionMatrix(m_NativeApi.SessionHandle, cameraHandle,
+ ExternApi.ArCamera_getProjectionMatrix(m_NativeSession.SessionHandle, cameraHandle,
near, far, ref matrix);
return matrix;
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraMetadataApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraMetadataApi.cs
index 1112b02d6..bf92df7d5 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraMetadataApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/CameraMetadataApi.cs
@@ -31,11 +31,11 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class CameraMetadataApi
{
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
- public CameraMetadataApi(NativeApi nativeApi)
+ public CameraMetadataApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
public void Release(IntPtr arCameraMetadataHandle)
@@ -47,7 +47,7 @@ public bool TryGetValues(IntPtr cameraMetadataHandle,
CameraMetadataTag tag, List resultList)
{
IntPtr ndkMetadataHandle = IntPtr.Zero;
- ExternApi.ArImageMetadata_getNdkCameraMetadata(m_NativeApi.SessionHandle,
+ ExternApi.ArImageMetadata_getNdkCameraMetadata(m_NativeSession.SessionHandle,
cameraMetadataHandle, ref ndkMetadataHandle);
resultList.Clear();
@@ -111,7 +111,7 @@ public bool TryGetValues(IntPtr cameraMetadataHandle,
public bool GetAllCameraMetadataTags(IntPtr cameraMetadataHandle, List resultList)
{
IntPtr ndkMetadataHandle = IntPtr.Zero;
- ExternApi.ArImageMetadata_getNdkCameraMetadata(m_NativeApi.SessionHandle,
+ ExternApi.ArImageMetadata_getNdkCameraMetadata(m_NativeSession.SessionHandle,
cameraMetadataHandle, ref ndkMetadataHandle);
IntPtr tagsHandle = IntPtr.Zero;
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/FrameApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/FrameApi.cs
index ce1078614..a92eee9d0 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/FrameApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/FrameApi.cs
@@ -31,87 +31,83 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class FrameApi
{
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
- public FrameApi(NativeApi nativeApi)
+ public FrameApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
- public long GetTimestamp(IntPtr frameHandle)
+ public long GetTimestamp()
{
long timestamp = 0;
- ExternApi.ArFrame_getTimestamp(m_NativeApi.SessionHandle, frameHandle,
+ ExternApi.ArFrame_getTimestamp(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle,
ref timestamp);
return timestamp;
}
- public IntPtr AcquireCamera(IntPtr frameHandle)
+ public IntPtr AcquireCamera()
{
- if (frameHandle == IntPtr.Zero)
- {
- return IntPtr.Zero;
- }
-
IntPtr cameraHandle = IntPtr.Zero;
- ExternApi.ArFrame_acquireCamera(m_NativeApi.SessionHandle, frameHandle,
+ ExternApi.ArFrame_acquireCamera(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle,
ref cameraHandle);
return cameraHandle;
}
- public IntPtr AcquirePointCloud(IntPtr frameHandle)
+ public IntPtr AcquirePointCloud()
{
IntPtr pointCloudHandle = IntPtr.Zero;
- ExternApi.ArFrame_acquirePointCloud(m_NativeApi.SessionHandle, frameHandle,
+ ExternApi.ArFrame_acquirePointCloud(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle,
ref pointCloudHandle);
return pointCloudHandle;
}
- public IntPtr AcquireImageMetadata(IntPtr frameHandle)
+ public IntPtr AcquireImageMetadata()
{
IntPtr imageMetadataHandle = IntPtr.Zero;
- ExternApi.ArFrame_acquireImageMetadata(m_NativeApi.SessionHandle, frameHandle, ref imageMetadataHandle);
+ ExternApi.ArFrame_acquireImageMetadata(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle,
+ ref imageMetadataHandle);
return imageMetadataHandle;
}
- public LightEstimate GetLightEstimate(IntPtr frameHandle)
+ public LightEstimate GetLightEstimate()
{
- IntPtr lightEstimateHandle = m_NativeApi.LightEstimate.Create();
- ExternApi.ArFrame_getLightEstimate(m_NativeApi.SessionHandle, frameHandle,
+ IntPtr lightEstimateHandle = m_NativeSession.LightEstimateApi.Create();
+ ExternApi.ArFrame_getLightEstimate(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle,
lightEstimateHandle);
- LightEstimateState state = m_NativeApi.LightEstimate.GetState(lightEstimateHandle);
- float pixelIntensity = m_NativeApi.LightEstimate.GetPixelIntensity(lightEstimateHandle);
+ LightEstimateState state = m_NativeSession.LightEstimateApi.GetState(lightEstimateHandle);
+ float pixelIntensity = m_NativeSession.LightEstimateApi.GetPixelIntensity(lightEstimateHandle);
- m_NativeApi.LightEstimate.Destroy(lightEstimateHandle);
+ m_NativeSession.LightEstimateApi.Destroy(lightEstimateHandle);
return new LightEstimate(state, pixelIntensity);
}
- public void TransformDisplayUvCoords(IntPtr frameHandle, ref ApiDisplayUvCoords uv)
+ public void TransformDisplayUvCoords(ref ApiDisplayUvCoords uv)
{
ApiDisplayUvCoords uvOut = new ApiDisplayUvCoords();
- ExternApi.ArFrame_transformDisplayUvCoords(m_NativeApi.SessionHandle, frameHandle,
+ ExternApi.ArFrame_transformDisplayUvCoords(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle,
ApiDisplayUvCoords.NumFloats, ref uv, ref uvOut);
uv = uvOut;
}
- public void GetUpdatedTrackables(IntPtr frameHandle, List trackables)
+ public void GetUpdatedTrackables(List trackables)
{
- IntPtr listHandle = m_NativeApi.TrackableList.Create();
- ExternApi.ArFrame_getUpdatedTrackables(m_NativeApi.SessionHandle, frameHandle,
+ IntPtr listHandle = m_NativeSession.TrackableListApi.Create();
+ ExternApi.ArFrame_getUpdatedTrackables(m_NativeSession.SessionHandle, m_NativeSession.FrameHandle,
ApiTrackableType.BaseTrackable, listHandle);
trackables.Clear();
- int count = m_NativeApi.TrackableList.GetCount(listHandle);
+ int count = m_NativeSession.TrackableListApi.GetCount(listHandle);
for (int i = 0; i < count; i++)
{
- IntPtr trackableHandle = m_NativeApi.TrackableList.AcquireItem(listHandle, i);
- trackables.Add(m_NativeApi.TrackableFactory(trackableHandle));
+ IntPtr trackableHandle = m_NativeSession.TrackableListApi.AcquireItem(listHandle, i);
+ trackables.Add(m_NativeSession.TrackableFactory(trackableHandle));
}
- m_NativeApi.TrackableList.Destroy(listHandle);
+ m_NativeSession.TrackableListApi.Destroy(listHandle);
}
private struct ExternApi
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/HitTestApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/HitTestApi.cs
index 3bad319df..0f6899503 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/HitTestApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/HitTestApi.cs
@@ -31,11 +31,11 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class HitTestApi
{
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
- public HitTestApi(NativeApi nativeApi)
+ public HitTestApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
public bool Raycast(IntPtr frameHandle, float x, float y, TrackableHitFlags filter,
@@ -44,16 +44,16 @@ public bool Raycast(IntPtr frameHandle, float x, float y, TrackableHitFlags filt
outHitList.Clear();
IntPtr hitResultListHandle = IntPtr.Zero;
- ExternApi.ArHitResultList_create(m_NativeApi.SessionHandle, ref hitResultListHandle);
- ExternApi.ArFrame_hitTest(m_NativeApi.SessionHandle, frameHandle, x, y, hitResultListHandle);
+ ExternApi.ArHitResultList_create(m_NativeSession.SessionHandle, ref hitResultListHandle);
+ ExternApi.ArFrame_hitTest(m_NativeSession.SessionHandle, frameHandle, x, y, hitResultListHandle);
int hitListSize = 0;
- ExternApi.ArHitResultList_getSize(m_NativeApi.SessionHandle, hitResultListHandle, ref hitListSize);
+ ExternApi.ArHitResultList_getSize(m_NativeSession.SessionHandle, hitResultListHandle, ref hitListSize);
for (int i = 0; i < hitListSize; i++)
{
- TrackableHit trackableHit = new TrackableHit();
- if (HitResultListGetItemAt(hitResultListHandle, i, ref trackableHit))
+ TrackableHit trackableHit;
+ if (HitResultListGetItemAt(hitResultListHandle, i, out trackableHit))
{
if ((filter & trackableHit.Flags) != TrackableHitFlags.None)
{
@@ -66,12 +66,14 @@ public bool Raycast(IntPtr frameHandle, float x, float y, TrackableHitFlags filt
return outHitList.Count != 0;
}
- private bool HitResultListGetItemAt(IntPtr hitResultListHandle, int index, ref TrackableHit outTrackableHit)
+ private bool HitResultListGetItemAt(IntPtr hitResultListHandle, int index, out TrackableHit outTrackableHit)
{
+ outTrackableHit = new TrackableHit();
+
// Query the hit result.
IntPtr hitResultHandle = IntPtr.Zero;
- ExternApi.ArHitResult_create(m_NativeApi.SessionHandle, ref hitResultHandle);
- ExternApi.ArHitResultList_getItem(m_NativeApi.SessionHandle, hitResultListHandle, index, hitResultHandle);
+ ExternApi.ArHitResult_create(m_NativeSession.SessionHandle, ref hitResultHandle);
+ ExternApi.ArHitResultList_getItem(m_NativeSession.SessionHandle, hitResultListHandle, index, hitResultHandle);
if (hitResultHandle == IntPtr.Zero)
{
ExternApi.ArHitResult_destroy(hitResultHandle);
@@ -79,36 +81,36 @@ private bool HitResultListGetItemAt(IntPtr hitResultListHandle, int index, ref T
}
// Query the pose from hit result.
- IntPtr poseHandle = m_NativeApi.Pose.Create();
- ExternApi.ArHitResult_getHitPose(m_NativeApi.SessionHandle, hitResultHandle, poseHandle);
- Pose hitPose = m_NativeApi.Pose.ExtractPoseValue(poseHandle);
+ IntPtr poseHandle = m_NativeSession.PoseApi.Create();
+ ExternApi.ArHitResult_getHitPose(m_NativeSession.SessionHandle, hitResultHandle, poseHandle);
+ Pose hitPose = m_NativeSession.PoseApi.ExtractPoseValue(poseHandle);
// Query the distance from hit result.
float hitDistance = 0.0f;
- ExternApi.ArHitResult_getDistance(m_NativeApi.SessionHandle, hitResultHandle, ref hitDistance);
+ ExternApi.ArHitResult_getDistance(m_NativeSession.SessionHandle, hitResultHandle, ref hitDistance);
// Query the trackable from hit result.
IntPtr trackableHandle = IntPtr.Zero;
- ExternApi.ArHitResult_acquireTrackable(m_NativeApi.SessionHandle, hitResultHandle, ref trackableHandle);
- Trackable trackable = m_NativeApi.TrackableFactory(trackableHandle);
- m_NativeApi.Trackable.Release(trackableHandle);
+ ExternApi.ArHitResult_acquireTrackable(m_NativeSession.SessionHandle, hitResultHandle, ref trackableHandle);
+ Trackable trackable = m_NativeSession.TrackableFactory(trackableHandle);
+ m_NativeSession.TrackableApi.Release(trackableHandle);
// Calculate trackable hit flags.
TrackableHitFlags flag = TrackableHitFlags.None;
if (trackable == null)
{
Debug.Log("Could not create trackable from hit result.");
- m_NativeApi.Pose.Destroy(poseHandle);
+ m_NativeSession.PoseApi.Destroy(poseHandle);
return false;
}
else if (trackable is TrackedPlane)
{
- if (m_NativeApi.Plane.IsPoseInPolygon(trackableHandle, poseHandle))
+ if (m_NativeSession.PlaneApi.IsPoseInPolygon(trackableHandle, poseHandle))
{
flag |= TrackableHitFlags.PlaneWithinPolygon;
}
- if (m_NativeApi.Plane.IsPoseInExtents(trackableHandle, poseHandle))
+ if (m_NativeSession.PlaneApi.IsPoseInExtents(trackableHandle, poseHandle))
{
flag |= TrackableHitFlags.PlaneWithinBounds;
}
@@ -117,16 +119,21 @@ private bool HitResultListGetItemAt(IntPtr hitResultListHandle, int index, ref T
}
else if (trackable is TrackedPoint)
{
- flag |= TrackableHitFlags.PointCloud;
+ var point = trackable as TrackedPoint;
+ flag |= TrackableHitFlags.FeaturePoint;
+ if (point.OrientationMode == TrackedPointOrientationMode.SurfaceNormal)
+ {
+ flag |= TrackableHitFlags.FeaturePointWithSurfaceNormal;
+ }
}
else
{
- m_NativeApi.Pose.Destroy(poseHandle);
+ m_NativeSession.PoseApi.Destroy(poseHandle);
return false;
}
outTrackableHit = new TrackableHit(hitPose, hitDistance, flag, trackable);
- m_NativeApi.Pose.Destroy(poseHandle);
+ m_NativeSession.PoseApi.Destroy(poseHandle);
return true;
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/LightEstimateApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/LightEstimateApi.cs
index 318e7699f..ddf7da698 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/LightEstimateApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/LightEstimateApi.cs
@@ -29,17 +29,17 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class LightEstimateApi
{
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
- public LightEstimateApi(NativeApi nativeApi)
+ public LightEstimateApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
public IntPtr Create()
{
IntPtr lightEstimateHandle = IntPtr.Zero;
- ExternApi.ArLightEstimate_create(m_NativeApi.SessionHandle, ref lightEstimateHandle);
+ ExternApi.ArLightEstimate_create(m_NativeSession.SessionHandle, ref lightEstimateHandle);
return lightEstimateHandle;
}
@@ -51,14 +51,14 @@ public void Destroy(IntPtr lightEstimateHandle)
public LightEstimateState GetState(IntPtr lightEstimateHandle)
{
ApiLightEstimateState state = ApiLightEstimateState.NotValid;
- ExternApi.ArLightEstimate_getState(m_NativeApi.SessionHandle, lightEstimateHandle, ref state);
+ ExternApi.ArLightEstimate_getState(m_NativeSession.SessionHandle, lightEstimateHandle, ref state);
return state.ToLightEstimateState();
}
public float GetPixelIntensity(IntPtr lightEstimateHandle)
{
float pixelIntensity = 0;
- ExternApi.ArLightEstimate_getPixelIntensity(m_NativeApi.SessionHandle,
+ ExternApi.ArLightEstimate_getPixelIntensity(m_NativeSession.SessionHandle,
lightEstimateHandle, ref pixelIntensity);
return pixelIntensity;
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeApi.cs
deleted file mode 100644
index 599ec8998..000000000
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeApi.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-//-----------------------------------------------------------------------
-//
-//
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// 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.
-//
-//
-//-----------------------------------------------------------------------
-
-namespace GoogleARCoreInternal
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.InteropServices;
- using GoogleARCore;
- using UnityEngine;
-
- [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
- Justification = "Internal")]
- public class NativeApi
- {
- private Dictionary m_TrackableDict = new Dictionary(new IntPtrEqualityComparer());
-
- private IntPtr m_SessionHandle = IntPtr.Zero;
-
- private EarlyUpdateCallback m_OnEarlyUpdate;
-
- private NativeApi()
- {
- }
-
- ~NativeApi()
- {
- Destroy();
- }
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- public delegate void EarlyUpdateCallback(IntPtr frameHandle, int textureId);
-
- public IntPtr SessionHandle
- {
- get
- {
- return m_SessionHandle;
- }
- }
-
- public AnchorApi Anchor { get; private set; }
-
- public CameraApi Camera { get; private set; }
-
- public FrameApi Frame { get; private set; }
-
- public HitTestApi HitTest { get; private set; }
-
- public LightEstimateApi LightEstimate { get; private set; }
-
- public PlaneApi Plane { get; private set; }
-
- public PointApi Point { get; private set; }
-
- public PointCloudApi PointCloud { get; private set; }
-
- public PoseApi Pose { get; private set; }
-
- public SessionApi Session { get; private set; }
-
- public SessionConfigApi SessionConfig { get; private set; }
-
- public TrackableApi Trackable { get; private set; }
-
- public TrackableListApi TrackableList { get; private set; }
-
- public CameraMetadataApi CameraMetadata { get; private set; }
-
- public static NativeApi CreateSession()
- {
- NativeApi nativeApi = new NativeApi();
- ExternApi.ArCoreUnity_createSession(ref nativeApi.m_SessionHandle);
-
- if (nativeApi.m_SessionHandle == IntPtr.Zero)
- {
- Debug.LogError("ARCore failed to create a session.");
- return null;
- }
-
- nativeApi.Anchor = new AnchorApi(nativeApi);
- nativeApi.Camera = new CameraApi(nativeApi);
- nativeApi.Frame = new FrameApi(nativeApi);
- nativeApi.HitTest = new HitTestApi(nativeApi);
- nativeApi.LightEstimate = new LightEstimateApi(nativeApi);
- nativeApi.Plane = new PlaneApi(nativeApi);
- nativeApi.Point = new PointApi(nativeApi);
- nativeApi.PointCloud = new PointCloudApi(nativeApi);
- nativeApi.Pose = new PoseApi(nativeApi);
- nativeApi.Session = new SessionApi(nativeApi);
- nativeApi.SessionConfig = new SessionConfigApi(nativeApi);
- nativeApi.Trackable = new TrackableApi(nativeApi);
- nativeApi.TrackableList = new TrackableListApi(nativeApi);
- nativeApi.CameraMetadata = new CameraMetadataApi(nativeApi);
-
- nativeApi.Session.ReportEngineType();
-
- return nativeApi;
- }
-
- public void Destroy()
- {
- if (m_SessionHandle != IntPtr.Zero)
- {
- ExternApi.ArCoreUnity_destroySession();
- m_SessionHandle = IntPtr.Zero;
- }
- }
-
- public bool Resume(EarlyUpdateCallback onEarlyUpdate)
- {
- m_OnEarlyUpdate = onEarlyUpdate;
- return ExternApi.ArCoreUnity_resumeSession(m_OnEarlyUpdate);
- }
-
- ///
- /// Factory method for creating and reusing TrackedPlane references from native handles.
- ///
- /// A native handle to a plane that has been acquired. RELEASE WILL BE HANDLED BY
- /// THIS METHOD.
- /// A reference to a tracked plane.
- public Trackable TrackableFactory(IntPtr nativeHandle)
- {
- if (nativeHandle == IntPtr.Zero)
- {
- return null;
- }
-
- Trackable result;
- if (m_TrackableDict.TryGetValue(nativeHandle, out result))
- {
- // Release aquired handle and return cached result.
- Trackable.Release(nativeHandle);
- return result;
- }
-
- ApiTrackableType trackableType = Trackable.GetType(nativeHandle);
- if (trackableType == ApiTrackableType.Plane)
- {
- result = new TrackedPlane(nativeHandle, this);
- }
- else if (trackableType == ApiTrackableType.Point)
- {
- result = new TrackedPoint(nativeHandle, this);
- }
- else
- {
- UnityEngine.Debug.LogFormat("Cant find {0}", trackableType);
- throw new NotImplementedException("TrackableFactory:: No contructor for requested trackable type.");
- }
-
- m_TrackableDict.Add(nativeHandle, result);
- return result;
- }
-
- private struct ExternApi
- {
- [DllImport(ApiConstants.ARCoreShimApi)]
- public static extern void ArCoreUnity_createSession(ref IntPtr sessionHandle);
-
- [DllImport(ApiConstants.ARCoreShimApi)]
- public static extern void ArCoreUnity_destroySession();
-
- [DllImport(ApiConstants.ARCoreShimApi)]
- public static extern bool ArCoreUnity_resumeSession(EarlyUpdateCallback earlyUpdate);
- }
- }
-}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeSession.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeSession.cs
new file mode 100644
index 000000000..0c83d5545
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeSession.cs
@@ -0,0 +1,161 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
+ using System.Runtime.InteropServices;
+ using GoogleARCore;
+ using UnityEngine;
+
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ public class NativeSession
+ {
+ private IntPtr m_SessionHandle = IntPtr.Zero;
+
+ private IntPtr m_FrameHandle = IntPtr.Zero;
+
+ private IntPtr m_PointCloudHandle = IntPtr.Zero;
+
+ private float m_LastReleasedPointcloudTimestamp = 0.0f;
+
+ private TrackableManager m_TrackableManager = null;
+
+ public NativeSession(IntPtr sessionHandle, IntPtr frameHandle)
+ {
+ m_SessionHandle = sessionHandle;
+ m_FrameHandle = frameHandle;
+ m_TrackableManager = new TrackableManager(this);
+
+ AnchorApi = new AnchorApi(this);
+ CameraApi = new CameraApi(this);
+ CameraMetadataApi = new CameraMetadataApi(this);
+ FrameApi = new FrameApi(this);
+ HitTestApi = new HitTestApi(this);
+ LightEstimateApi = new LightEstimateApi(this);
+ PlaneApi = new PlaneApi(this);
+ PointApi = new PointApi(this);
+ PointCloudApi = new PointCloudApi(this);
+ PoseApi = new PoseApi(this);
+ SessionApi = new SessionApi(this);
+ SessionConfigApi = new SessionConfigApi(this);
+ TrackableApi = new TrackableApi(this);
+ TrackableListApi = new TrackableListApi(this);
+ }
+
+ public IntPtr SessionHandle
+ {
+ get
+ {
+ return m_SessionHandle;
+ }
+ }
+
+ public IntPtr FrameHandle
+ {
+ get
+ {
+ return m_FrameHandle;
+ }
+ }
+
+ public IntPtr PointCloudHandle
+ {
+ get
+ {
+ return m_PointCloudHandle;
+ }
+ }
+
+ public bool IsPointCloudNew
+ {
+ get
+ {
+ // TODO (b/73256094): Remove when fixed.
+ if (LifecycleManager.Instance.SessionStatus != SessionStatus.Tracking)
+ {
+ var previousLastTimestamp = m_LastReleasedPointcloudTimestamp;
+ m_LastReleasedPointcloudTimestamp = 0.0f;
+ return previousLastTimestamp != 0;
+ }
+
+ return PointCloudApi.GetTimestamp(PointCloudHandle) != m_LastReleasedPointcloudTimestamp;
+ }
+ }
+
+ public AnchorApi AnchorApi { get; private set; }
+
+ public CameraApi CameraApi { get; private set; }
+
+ public CameraMetadataApi CameraMetadataApi { get; private set; }
+
+ public FrameApi FrameApi { get; private set; }
+
+ public HitTestApi HitTestApi { get; private set; }
+
+ public LightEstimateApi LightEstimateApi { get; private set; }
+
+ public PlaneApi PlaneApi { get; private set; }
+
+ public PointApi PointApi { get; private set; }
+
+ public PointCloudApi PointCloudApi { get; private set; }
+
+ public PoseApi PoseApi { get; private set; }
+
+ public SessionApi SessionApi { get; private set; }
+
+ public SessionConfigApi SessionConfigApi { get; private set; }
+
+ public TrackableApi TrackableApi { get; private set; }
+
+ public TrackableListApi TrackableListApi { get; private set; }
+
+ public Trackable TrackableFactory(IntPtr nativeHandle)
+ {
+ return m_TrackableManager.TrackableFactory(nativeHandle);
+ }
+
+ public void GetTrackables(List trackables, TrackableQueryFilter filter) where T : Trackable
+ {
+ m_TrackableManager.GetTrackables(trackables, filter);
+ }
+
+ public void OnUpdate()
+ {
+ // After first frame, release previous frame's point cloud.
+ if (m_PointCloudHandle != IntPtr.Zero)
+ {
+ m_LastReleasedPointcloudTimestamp = PointCloudApi.GetTimestamp(m_PointCloudHandle);
+ PointCloudApi.Release(m_PointCloudHandle);
+ m_PointCloudHandle = IntPtr.Zero;
+ }
+
+ // TODO (b/73256094): Remove when fixed.
+ if (LifecycleManager.Instance.SessionStatus == SessionStatus.Tracking)
+ {
+ m_PointCloudHandle = FrameApi.AcquirePointCloud();
+ }
+ }
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeSession.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeSession.cs.meta
new file mode 100644
index 000000000..23addb5f7
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/NativeSession.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: d592900cfcf4d46c69256dbe400dec56
+timeCreated: 1516388608
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PlaneApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PlaneApi.cs
index 9355ba215..a8e752c9f 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PlaneApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PlaneApi.cs
@@ -32,13 +32,13 @@ namespace GoogleARCoreInternal
public class PlaneApi
{
private const int k_MaxPolygonSize = 1024;
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
private float[] m_TmpPoints;
private GCHandle m_TmpPointsHandle;
- public PlaneApi(NativeApi nativeApi)
+ public PlaneApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
m_TmpPoints = new float[k_MaxPolygonSize * 2];
m_TmpPointsHandle = GCHandle.Alloc(m_TmpPoints, GCHandleType.Pinned);
}
@@ -50,24 +50,24 @@ public PlaneApi(NativeApi nativeApi)
public Pose GetCenterPose(IntPtr planeHandle)
{
- var poseHandle = m_NativeApi.Pose.Create();
- ExternApi.ArPlane_getCenterPose(m_NativeApi.SessionHandle, planeHandle, poseHandle);
- Pose resultPose = m_NativeApi.Pose.ExtractPoseValue(poseHandle);
- m_NativeApi.Pose.Destroy(poseHandle);
+ var poseHandle = m_NativeSession.PoseApi.Create();
+ ExternApi.ArPlane_getCenterPose(m_NativeSession.SessionHandle, planeHandle, poseHandle);
+ Pose resultPose = m_NativeSession.PoseApi.ExtractPoseValue(poseHandle);
+ m_NativeSession.PoseApi.Destroy(poseHandle);
return resultPose;
}
public float GetExtentX(IntPtr planeHandle)
{
float extentX = 0.0f;
- ExternApi.ArPlane_getExtentX(m_NativeApi.SessionHandle, planeHandle, ref extentX);
+ ExternApi.ArPlane_getExtentX(m_NativeSession.SessionHandle, planeHandle, ref extentX);
return extentX;
}
public float GetExtentZ(IntPtr planeHandle)
{
float extentZ = 0.0f;
- ExternApi.ArPlane_getExtentZ(m_NativeApi.SessionHandle, planeHandle, ref extentZ);
+ ExternApi.ArPlane_getExtentZ(m_NativeSession.SessionHandle, planeHandle, ref extentZ);
return extentZ;
}
@@ -75,7 +75,7 @@ public void GetPolygon(IntPtr planeHandle, List points)
{
points.Clear();
int pointCount = 0;
- ExternApi.ArPlane_getPolygonSize(m_NativeApi.SessionHandle, planeHandle, ref pointCount);
+ ExternApi.ArPlane_getPolygonSize(m_NativeSession.SessionHandle, planeHandle, ref pointCount);
if (pointCount < 1)
{
return;
@@ -86,7 +86,7 @@ public void GetPolygon(IntPtr planeHandle, List points)
pointCount = k_MaxPolygonSize;
}
- ExternApi.ArPlane_getPolygon(m_NativeApi.SessionHandle, planeHandle, m_TmpPointsHandle.AddrOfPinnedObject());
+ ExternApi.ArPlane_getPolygon(m_NativeSession.SessionHandle, planeHandle, m_TmpPointsHandle.AddrOfPinnedObject());
var planeCenter = GetCenterPose(planeHandle);
var unityWorldTPlane = Matrix4x4.TRS(planeCenter.position, planeCenter.rotation, Vector3.one);
@@ -100,17 +100,17 @@ public void GetPolygon(IntPtr planeHandle, List points)
public TrackedPlane GetSubsumedBy(IntPtr planeHandle)
{
IntPtr subsumerHandle = IntPtr.Zero;
- ExternApi.ArPlane_acquireSubsumedBy(m_NativeApi.SessionHandle, planeHandle, ref subsumerHandle);
- return m_NativeApi.TrackableFactory(subsumerHandle) as TrackedPlane;
+ ExternApi.ArPlane_acquireSubsumedBy(m_NativeSession.SessionHandle, planeHandle, ref subsumerHandle);
+ return m_NativeSession.TrackableFactory(subsumerHandle) as TrackedPlane;
}
public bool IsPoseInExtents(IntPtr planeHandle, Pose pose)
{
// The int is used as a boolean value as the C API expects a int32_t value to represent a boolean.
int isPoseInExtents = 0;
- var poseHandle = m_NativeApi.Pose.Create(pose);
- ExternApi.ArPlane_isPoseInExtents(m_NativeApi.SessionHandle, planeHandle, poseHandle, ref isPoseInExtents);
- m_NativeApi.Pose.Destroy(poseHandle);
+ var poseHandle = m_NativeSession.PoseApi.Create(pose);
+ ExternApi.ArPlane_isPoseInExtents(m_NativeSession.SessionHandle, planeHandle, poseHandle, ref isPoseInExtents);
+ m_NativeSession.PoseApi.Destroy(poseHandle);
return isPoseInExtents != 0;
}
@@ -118,7 +118,7 @@ public bool IsPoseInExtents(IntPtr planeHandle, IntPtr poseHandle)
{
// The int is used as a boolean value as the C API expects a int32_t value to represent a boolean.
int isPoseInExtents = 0;
- ExternApi.ArPlane_isPoseInExtents(m_NativeApi.SessionHandle, planeHandle, poseHandle, ref isPoseInExtents);
+ ExternApi.ArPlane_isPoseInExtents(m_NativeSession.SessionHandle, planeHandle, poseHandle, ref isPoseInExtents);
return isPoseInExtents != 0;
}
@@ -126,9 +126,9 @@ public bool IsPoseInPolygon(IntPtr planeHandle, Pose pose)
{
// The int is used as a boolean value as the C API expects a int32_t value to represent a boolean.
int isPoseInPolygon = 0;
- var poseHandle = m_NativeApi.Pose.Create(pose);
- ExternApi.ArPlane_isPoseInPolygon(m_NativeApi.SessionHandle, planeHandle, poseHandle, ref isPoseInPolygon);
- m_NativeApi.Pose.Destroy(poseHandle);
+ var poseHandle = m_NativeSession.PoseApi.Create(pose);
+ ExternApi.ArPlane_isPoseInPolygon(m_NativeSession.SessionHandle, planeHandle, poseHandle, ref isPoseInPolygon);
+ m_NativeSession.PoseApi.Destroy(poseHandle);
return isPoseInPolygon != 0;
}
@@ -136,7 +136,7 @@ public bool IsPoseInPolygon(IntPtr planeHandle, IntPtr poseHandle)
{
// The int is used as a boolean value as the C API expects a int32_t value to represent a boolean.
int isPoseInPolygon = 0;
- ExternApi.ArPlane_isPoseInPolygon(m_NativeApi.SessionHandle, planeHandle, poseHandle, ref isPoseInPolygon);
+ ExternApi.ArPlane_isPoseInPolygon(m_NativeSession.SessionHandle, planeHandle, poseHandle, ref isPoseInPolygon);
return isPoseInPolygon != 0;
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointApi.cs
index dc2d3103c..05a81f759 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointApi.cs
@@ -31,26 +31,39 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class PointApi
{
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
- public PointApi(NativeApi nativeApi)
+ public PointApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
- public Pose GetPose(IntPtr planeHandle)
+ public Pose GetPose(IntPtr pointHandle)
{
- var poseHandle = m_NativeApi.Pose.Create();
- ExternApi.ArPoint_getPose(m_NativeApi.SessionHandle, planeHandle, poseHandle);
- Pose resultPose = m_NativeApi.Pose.ExtractPoseValue(poseHandle);
- m_NativeApi.Pose.Destroy(poseHandle);
+ var poseHandle = m_NativeSession.PoseApi.Create();
+ ExternApi.ArPoint_getPose(m_NativeSession.SessionHandle, pointHandle, poseHandle);
+ Pose resultPose = m_NativeSession.PoseApi.ExtractPoseValue(poseHandle);
+ m_NativeSession.PoseApi.Destroy(poseHandle);
return resultPose;
}
+ public TrackedPointOrientationMode GetOrientationMode(IntPtr pointHandle)
+ {
+ ApiTrackedPointOrientationMode orientationMode =
+ ApiTrackedPointOrientationMode.Identity;
+ ExternApi.ArPoint_getOrientationMode(m_NativeSession.SessionHandle, pointHandle,
+ ref orientationMode);
+ return orientationMode.ToTrackedPointOrientationMode();
+ }
+
private struct ExternApi
{
[DllImport(ApiConstants.ARCoreNativeApi)]
public static extern void ArPoint_getPose(IntPtr session, IntPtr point, IntPtr out_pose);
+
+ [DllImport(ApiConstants.ARCoreNativeApi)]
+ public static extern void ArPoint_getOrientationMode(IntPtr session, IntPtr point,
+ ref ApiTrackedPointOrientationMode orientationMode);
}
}
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointCloudApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointCloudApi.cs
index 8aac312de..c120520c4 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointCloudApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PointCloudApi.cs
@@ -31,35 +31,34 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class PointCloudApi
{
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
private float[] m_CachedVector = new float[4];
- public PointCloudApi(NativeApi nativeApi)
+ public PointCloudApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
public long GetTimestamp(IntPtr pointCloudHandle)
{
long timestamp = 0;
- ExternApi.ArPointCloud_getTimestamp(m_NativeApi.SessionHandle, pointCloudHandle, ref timestamp);
+ ExternApi.ArPointCloud_getTimestamp(m_NativeSession.SessionHandle, pointCloudHandle, ref timestamp);
return timestamp;
}
public int GetNumberOfPoints(IntPtr pointCloudHandle)
{
int pointCount = 0;
- ExternApi.ArPointCloud_getNumberOfPoints(m_NativeApi.SessionHandle, pointCloudHandle, ref pointCount);
+ ExternApi.ArPointCloud_getNumberOfPoints(m_NativeSession.SessionHandle, pointCloudHandle, ref pointCount);
- // TODO (xuguo): remove the divide by 4 after b/69389164 is fixed.
- return pointCount / 4;
+ return pointCount;
}
public Vector4 GetPoint(IntPtr pointCloudHandle, int index)
{
IntPtr pointCloudNativeHandle = IntPtr.Zero;
- ExternApi.ArPointCloud_getData(m_NativeApi.SessionHandle, pointCloudHandle, ref pointCloudNativeHandle);
+ ExternApi.ArPointCloud_getData(m_NativeSession.SessionHandle, pointCloudHandle, ref pointCloudNativeHandle);
IntPtr pointHandle = new IntPtr(pointCloudNativeHandle.ToInt64() +
(Marshal.SizeOf(typeof(Vector4)) * index));
Marshal.Copy(pointHandle, m_CachedVector, 0, 4);
@@ -75,7 +74,7 @@ public void CopyPoints(IntPtr pointCloudHandle, List points)
IntPtr pointCloudNativeHandle = IntPtr.Zero;
int pointCloudSize = GetNumberOfPoints(pointCloudHandle);
- ExternApi.ArPointCloud_getData(m_NativeApi.SessionHandle, pointCloudHandle, ref pointCloudNativeHandle);
+ ExternApi.ArPointCloud_getData(m_NativeSession.SessionHandle, pointCloudHandle, ref pointCloudNativeHandle);
MarshalingHelper.AddUnmanagedStructArrayToList(pointCloudNativeHandle,
pointCloudSize, points);
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PoseApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PoseApi.cs
index a1910d18e..b7b9ba203 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PoseApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/PoseApi.cs
@@ -31,11 +31,11 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class PoseApi
{
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
- public PoseApi(NativeApi nativeApi)
+ public PoseApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
public IntPtr Create()
@@ -48,7 +48,7 @@ public IntPtr Create(Pose pose)
ApiPoseData rawPose = new ApiPoseData(pose);
IntPtr poseHandle = IntPtr.Zero;
- ExternApi.ArPose_create(m_NativeApi.SessionHandle, ref rawPose, ref poseHandle);
+ ExternApi.ArPose_create(m_NativeSession.SessionHandle, ref rawPose, ref poseHandle);
return poseHandle;
}
@@ -60,7 +60,7 @@ public void Destroy(IntPtr nativePose)
public Pose ExtractPoseValue(IntPtr poseHandle)
{
ApiPoseData poseValue = new ApiPoseData(Pose.identity);
- ExternApi.ArPose_getPoseRaw(m_NativeApi.SessionHandle, poseHandle, ref poseValue);
+ ExternApi.ArPose_getPoseRaw(m_NativeSession.SessionHandle, poseHandle, ref poseValue);
return poseValue.ToUnityPose();
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionApi.cs
index 5161a7b86..b57e0f2f9 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionApi.cs
@@ -31,16 +31,16 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class SessionApi
{
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
- public SessionApi(NativeApi nativeApi)
+ public SessionApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
public void ReportEngineType()
{
- ExternApi.ArSession_reportEngineType(m_NativeApi.SessionHandle, "Unity",
+ ExternApi.ArSession_reportEngineType(m_NativeSession.SessionHandle, "Unity",
Application.unityVersion);
}
@@ -54,49 +54,49 @@ public ApiArStatus CheckSupported(ARCoreSessionConfig config)
}
else
{
- configHandle = m_NativeApi.SessionConfig.Create();
- m_NativeApi.SessionConfig.UpdateApiConfigWithArCoreSessionConfig(configHandle, config);
+ configHandle = m_NativeSession.SessionConfigApi.Create();
+ m_NativeSession.SessionConfigApi.UpdateApiConfigWithArCoreSessionConfig(configHandle, config);
}
- ApiArStatus ret = ExternApi.ArSession_checkSupported(m_NativeApi.SessionHandle, configHandle);
- m_NativeApi.SessionConfig.Destroy(configHandle);
+ ApiArStatus ret = ExternApi.ArSession_checkSupported(m_NativeSession.SessionHandle, configHandle);
+ m_NativeSession.SessionConfigApi.Destroy(configHandle);
return ret;
}
public bool SetConfiguration(ARCoreSessionConfig sessionConfig)
{
- IntPtr configHandle = m_NativeApi.SessionConfig.Create();
- m_NativeApi.SessionConfig.UpdateApiConfigWithArCoreSessionConfig(configHandle, sessionConfig);
+ IntPtr configHandle = m_NativeSession.SessionConfigApi.Create();
+ m_NativeSession.SessionConfigApi.UpdateApiConfigWithArCoreSessionConfig(configHandle, sessionConfig);
- bool ret = ExternApi.ArSession_configure(m_NativeApi.SessionHandle, configHandle) == 0;
- m_NativeApi.SessionConfig.Destroy(configHandle);
+ bool ret = ExternApi.ArSession_configure(m_NativeSession.SessionHandle, configHandle) == 0;
+ m_NativeSession.SessionConfigApi.Destroy(configHandle);
return ret;
}
public void GetAllTrackables(List trackables)
{
- IntPtr listHandle = m_NativeApi.TrackableList.Create();
- ExternApi.ArSession_getAllTrackables(m_NativeApi.SessionHandle, ApiTrackableType.BaseTrackable, listHandle);
+ IntPtr listHandle = m_NativeSession.TrackableListApi.Create();
+ ExternApi.ArSession_getAllTrackables(m_NativeSession.SessionHandle, ApiTrackableType.BaseTrackable, listHandle);
trackables.Clear();
- int count = m_NativeApi.TrackableList.GetCount(listHandle);
+ int count = m_NativeSession.TrackableListApi.GetCount(listHandle);
for (int i = 0; i < count; i++)
{
- IntPtr trackableHandle = m_NativeApi.TrackableList.AcquireItem(listHandle, i);
- trackables.Add(m_NativeApi.TrackableFactory(trackableHandle));
+ IntPtr trackableHandle = m_NativeSession.TrackableListApi.AcquireItem(listHandle, i);
+ trackables.Add(m_NativeSession.TrackableFactory(trackableHandle));
}
- m_NativeApi.TrackableList.Destroy(listHandle);
+ m_NativeSession.TrackableListApi.Destroy(listHandle);
}
public Anchor CreateAnchor(Pose pose)
{
- IntPtr poseHandle = m_NativeApi.Pose.Create(pose);
+ IntPtr poseHandle = m_NativeSession.PoseApi.Create(pose);
IntPtr anchorHandle = IntPtr.Zero;
- ExternApi.ArSession_acquireNewAnchor(m_NativeApi.SessionHandle, poseHandle, ref anchorHandle);
- var anchorResult = Anchor.AnchorFactory(anchorHandle, m_NativeApi);
- m_NativeApi.Pose.Destroy(poseHandle);
+ ExternApi.ArSession_acquireNewAnchor(m_NativeSession.SessionHandle, poseHandle, ref anchorHandle);
+ var anchorResult = Anchor.AnchorFactory(anchorHandle, m_NativeSession);
+ m_NativeSession.PoseApi.Destroy(poseHandle);
return anchorResult;
}
@@ -125,7 +125,7 @@ public void SetDisplayGeometry(ScreenOrientation orientation, int width, int hei
break;
}
- ExternApi.ArSession_setDisplayGeometry(m_NativeApi.SessionHandle, androidOrientation, width, height);
+ ExternApi.ArSession_setDisplayGeometry(m_NativeSession.SessionHandle, androidOrientation, width, height);
}
private struct ExternApi
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionConfigApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionConfigApi.cs
index e8a160a38..8f9e91ad7 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionConfigApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/SessionConfigApi.cs
@@ -31,17 +31,17 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class SessionConfigApi
{
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
- public SessionConfigApi(NativeApi nativeApi)
+ public SessionConfigApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
public IntPtr Create()
{
IntPtr configHandle = IntPtr.Zero;
- ExternApi.ArConfig_create(m_NativeApi.SessionHandle, ref configHandle);
+ ExternApi.ArConfig_create(m_NativeSession.SessionHandle, ref configHandle);
return configHandle;
}
@@ -58,7 +58,7 @@ public void UpdateApiConfigWithArCoreSessionConfig(IntPtr configHandle, ARCoreSe
lightingMode = ApiLightEstimationMode.AmbientIntensity;
}
- ExternApi.ArConfig_setLightEstimationMode(m_NativeApi.SessionHandle, configHandle, lightingMode);
+ ExternApi.ArConfig_setLightEstimationMode(m_NativeSession.SessionHandle, configHandle, lightingMode);
var planeFindingMode = ApiPlaneFindingMode.Disabled;
if (arCoreSessionConfig.EnablePlaneFinding)
@@ -66,7 +66,7 @@ public void UpdateApiConfigWithArCoreSessionConfig(IntPtr configHandle, ARCoreSe
planeFindingMode = ApiPlaneFindingMode.Horizontal;
}
- ExternApi.ArConfig_setPlaneFindingMode(m_NativeApi.SessionHandle, configHandle, planeFindingMode);
+ ExternApi.ArConfig_setPlaneFindingMode(m_NativeSession.SessionHandle, configHandle, planeFindingMode);
var updateMode = ApiUpdateMode.LatestCameraImage;
if (arCoreSessionConfig.MatchCameraFramerate)
@@ -77,7 +77,7 @@ public void UpdateApiConfigWithArCoreSessionConfig(IntPtr configHandle, ARCoreSe
QualitySettings.vSyncCount = 0;
}
- ExternApi.ArConfig_setUpdateMode(m_NativeApi.SessionHandle, configHandle, updateMode);
+ ExternApi.ArConfig_setUpdateMode(m_NativeSession.SessionHandle, configHandle, updateMode);
}
private struct ExternApi
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableApi.cs
index fc7209ec7..52290b99e 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableApi.cs
@@ -31,35 +31,35 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class TrackableApi
{
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
- public TrackableApi(NativeApi nativeApi)
+ public TrackableApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
public ApiTrackableType GetType(IntPtr trackableHandle)
{
ApiTrackableType type = ApiTrackableType.Plane;
- ExternApi.ArTrackable_getType(m_NativeApi.SessionHandle, trackableHandle, ref type);
+ ExternApi.ArTrackable_getType(m_NativeSession.SessionHandle, trackableHandle, ref type);
return type;
}
public TrackingState GetTrackingState(IntPtr trackableHandle)
{
ApiTrackingState apiTrackingState = ApiTrackingState.Stopped;
- ExternApi.ArTrackable_getTrackingState(m_NativeApi.SessionHandle, trackableHandle,
+ ExternApi.ArTrackable_getTrackingState(m_NativeSession.SessionHandle, trackableHandle,
ref apiTrackingState);
return apiTrackingState.ToTrackingState();
}
public bool AcquireNewAnchor(IntPtr trackableHandle, Pose pose, out IntPtr anchorHandle)
{
- IntPtr poseHandle = m_NativeApi.Pose.Create(pose);
+ IntPtr poseHandle = m_NativeSession.PoseApi.Create(pose);
anchorHandle = IntPtr.Zero;
- int status = ExternApi.ArTrackable_acquireNewAnchor(m_NativeApi.SessionHandle, trackableHandle, poseHandle,
+ int status = ExternApi.ArTrackable_acquireNewAnchor(m_NativeSession.SessionHandle, trackableHandle, poseHandle,
ref anchorHandle);
- m_NativeApi.Pose.Destroy(poseHandle);
+ m_NativeSession.PoseApi.Destroy(poseHandle);
return status == 0;
}
@@ -70,15 +70,15 @@ public void Release(IntPtr trackableHandle)
public void GetAnchors(IntPtr trackableHandle, List anchors)
{
- IntPtr anchorListHandle = m_NativeApi.Anchor.CreateList();
- ExternApi.ArTrackable_getAnchors(m_NativeApi.SessionHandle, trackableHandle, anchorListHandle);
+ IntPtr anchorListHandle = m_NativeSession.AnchorApi.CreateList();
+ ExternApi.ArTrackable_getAnchors(m_NativeSession.SessionHandle, trackableHandle, anchorListHandle);
anchors.Clear();
- int anchorCount = m_NativeApi.Anchor.GetListSize(anchorListHandle);
+ int anchorCount = m_NativeSession.AnchorApi.GetListSize(anchorListHandle);
for (int i = 0; i < anchorCount; i++)
{
- IntPtr anchorHandle = m_NativeApi.Anchor.AcquireListItem(anchorListHandle, i);
- Anchor anchor = Anchor.AnchorFactory(anchorHandle, m_NativeApi);
+ IntPtr anchorHandle = m_NativeSession.AnchorApi.AcquireListItem(anchorListHandle, i);
+ Anchor anchor = Anchor.AnchorFactory(anchorHandle, m_NativeSession, false);
if (anchor == null)
{
Debug.LogFormat("Unable to find Anchor component for handle {0}", anchorHandle);
@@ -88,8 +88,8 @@ public void GetAnchors(IntPtr trackableHandle, List anchors)
anchors.Add(anchor);
}
}
-
- m_NativeApi.Anchor.DestroyList(anchorListHandle);
+
+ m_NativeSession.AnchorApi.DestroyList(anchorListHandle);
}
private struct ExternApi
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableListApi.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableListApi.cs
index 6893674f9..44c4bd745 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableListApi.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Api/TrackableListApi.cs
@@ -31,17 +31,17 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class TrackableListApi
{
- private NativeApi m_NativeApi;
+ private NativeSession m_NativeSession;
- public TrackableListApi(NativeApi nativeApi)
+ public TrackableListApi(NativeSession nativeSession)
{
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
public IntPtr Create()
{
IntPtr handle = IntPtr.Zero;
- ExternApi.ArTrackableList_create(m_NativeApi.SessionHandle, ref handle);
+ ExternApi.ArTrackableList_create(m_NativeSession.SessionHandle, ref handle);
return handle;
}
@@ -53,14 +53,14 @@ public void Destroy(IntPtr listHandle)
public int GetCount(IntPtr listHandle)
{
int count = 0;
- ExternApi.ArTrackableList_getSize(m_NativeApi.SessionHandle, listHandle, ref count);
+ ExternApi.ArTrackableList_getSize(m_NativeSession.SessionHandle, listHandle, ref count);
return count;
}
public IntPtr AcquireItem(IntPtr listHandle, int index)
{
IntPtr trackableHandle = IntPtr.Zero;
- ExternApi.ArTrackableList_acquireItem(m_NativeApi.SessionHandle, listHandle, index,
+ ExternApi.ArTrackableList_acquireItem(m_NativeSession.SessionHandle, listHandle, index,
ref trackableHandle);
return trackableHandle;
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkAvailabilityStatus.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkAvailabilityStatus.cs
new file mode 100644
index 000000000..67183481f
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkAvailabilityStatus.cs
@@ -0,0 +1,36 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCore
+{
+ ///
+ /// Possible statuses for the ARCore APK availability on a device.
+ ///
+ public enum ApkAvailabilityStatus
+ {
+ UnknownError = 0,
+ UnknownChecking = 1,
+ UnknownTimedOut = 2,
+ UnsupportedDeviceNotCapable = 100,
+ SupportedNotInstalled = 201,
+ SupportedApkTooOld = 202,
+ SupportedInstalled = 203
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkAvailabilityStatus.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkAvailabilityStatus.cs.meta
new file mode 100644
index 000000000..dfb8a7e0b
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkAvailabilityStatus.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 56892237bd519491d9a60f5ebd3e0f72
+timeCreated: 1517868046
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkInstallationStatus.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkInstallationStatus.cs
new file mode 100644
index 000000000..c0d96a7b9
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkInstallationStatus.cs
@@ -0,0 +1,36 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCore
+{
+ ///
+ /// Possible statuses for an ARCore APK installation request on a device.
+ ///
+ public enum ApkInstallationStatus
+ {
+ Uninitialized = 0,
+ Requested = 1,
+ Success = 100,
+ Error = 200,
+ ErrorDeviceNotCompatible = 201,
+ ErrorAndroidVersionNotSupported = 202,
+ ErrorUserDeclined = 203,
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkInstallationStatus.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkInstallationStatus.cs.meta
new file mode 100644
index 000000000..a5e7994a5
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/ApkInstallationStatus.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: a1de1e6e76a30499e970bb552522dec7
+timeCreated: 1517858804
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/AsyncTask.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/AsyncTask.cs
index 5cbe9bfac..428ce1ef5 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/AsyncTask.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/AsyncTask.cs
@@ -132,42 +132,8 @@ public AsyncTask ThenAction(Action doAfterTaskComplete)
public class AsyncTask
{
private static Queue s_UpdateActionQueue = new Queue();
-
- private static Queue s_UiThreadActionQueue = new Queue();
-
- private static AndroidJavaObject s_Activity;
-
- private static AndroidJavaRunnable s_CallOnUIThread;
-
private static object s_LockObject = new object();
- static AsyncTask()
- {
- AndroidJavaClass unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
- s_Activity = unityPlayerClass.GetStatic("currentActivity");
-
- s_CallOnUIThread = new AndroidJavaRunnable(() => { OnUIThread(); });
- }
-
- ///
- /// Queues an action to be performed on Android UI thread. This method can be called by any thread.
- ///
- /// The action to perfom.
- public static void PerformActionInUIThread(Action action)
- {
- lock (s_LockObject)
- {
- if (s_UiThreadActionQueue.Count == 0)
- {
- // Ensure that runOnUiThread is only called once if this method is called twice quickly before
- // the UI thread responds.
- s_Activity.Call("runOnUiThread", s_CallOnUIThread);
- }
-
- s_UiThreadActionQueue.Enqueue(action);
- }
- }
-
///
/// Queues an action to be performed on Unity thread in Update(). This method can be called by any thread.
///
@@ -194,18 +160,6 @@ public static void OnUpdate()
}
}
}
-
- private static void OnUIThread()
- {
- lock (s_LockObject)
- {
- while (s_UiThreadActionQueue.Count > 0)
- {
- Action action = s_UiThreadActionQueue.Dequeue();
- action();
- }
- }
- }
}
/// @endcond
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor.meta
new file mode 100644
index 000000000..2aad0c912
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: cfb05be3ca34b4826b62df99f182da2b
+folderAsset: yes
+timeCreated: 1518226182
+licenseType: Pro
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreRequiredMenuItem.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreRequiredMenuItem.cs
new file mode 100644
index 000000000..d82e27edb
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreRequiredMenuItem.cs
@@ -0,0 +1,51 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System;
+ using System.Diagnostics.CodeAnalysis;
+ using System.IO;
+ using UnityEditor;
+ using UnityEngine;
+
+ [InitializeOnLoad]
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ public static class ARCoreRequiredMenuItem
+ {
+ private const string k_MenuName = "Edit/Project Settings/ARCore/ARCore Required";
+ private const int k_MenuPriority = 901;
+
+ [MenuItem(k_MenuName, false, k_MenuPriority)]
+ private static void ToggleARCoreRequiredMenuItem()
+ {
+ ARCoreProjectSettings.Instance.IsARCoreRequired = !ARCoreProjectSettings.Instance.IsARCoreRequired;
+ ARCoreProjectSettings.Instance.Save();
+ }
+
+ [MenuItem(k_MenuName, true, k_MenuPriority)]
+ private static bool ValidateARCoreRequiredMenuItem()
+ {
+ Menu.SetChecked(k_MenuName, ARCoreProjectSettings.Instance.IsARCoreRequired);
+ return true;
+ }
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreRequiredMenuItem.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreRequiredMenuItem.cs.meta
new file mode 100644
index 000000000..eb0f191dc
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/ARCoreRequiredMenuItem.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 09ecd63d3da8a410a90244cc9a8a049f
+timeCreated: 1518228501
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/BuildHelper.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/BuildHelper.cs
new file mode 100644
index 000000000..6ec83a2cf
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/BuildHelper.cs
@@ -0,0 +1,73 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System.Diagnostics.CodeAnalysis;
+ using UnityEditor;
+ using UnityEditor.Build;
+#if UNITY_2018_1_OR_NEWER
+ using UnityEditor.Build.Reporting;
+#endif
+ using UnityEngine;
+
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ public class BuildHelper : IPreprocessBuild
+ {
+ [SuppressMessage("UnityRules.UnityStyleRules", "US1000:FieldsMustBeUpperCamelCase",
+ Justification = "Overriden property.")]
+ public int callbackOrder
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+#if UNITY_2018_1_OR_NEWER
+ public void OnPreprocessBuild(BuildReport report)
+ {
+#else
+ public void OnPreprocessBuild(BuildTarget target, string path)
+ {
+#endif
+ var isARCoreRequired = ARCoreProjectSettings.Instance.IsARCoreRequired;
+
+ Debug.LogFormat("Building application with {0} ARCore support.",
+ isARCoreRequired ? "REQUIRED" : "OPTIONAL");
+
+ const string k_RequiredAARPath = "Assets/GoogleARCore/SDK/Plugins/google_ar_required.aar";
+ const string k_OptionalAARPath = "Assets/GoogleARCore/SDK/Plugins/google_ar_optional.aar";
+ PluginImporter arRequiredAAR = AssetImporter.GetAtPath(k_RequiredAARPath) as PluginImporter;
+ PluginImporter arOptionalAAR = AssetImporter.GetAtPath(k_OptionalAARPath) as PluginImporter;
+
+ if (arRequiredAAR == null || arOptionalAAR == null)
+ {
+ throw new UnityEditor.Build.BuildFailedException(
+ "Not finding google_ar_required.aar and google_ar_optional.aar files needed for ARCore support. " +
+ "Were they moved from the ARCore SDK?");
+ }
+
+ arRequiredAAR.SetCompatibleWithPlatform(BuildTarget.Android, isARCoreRequired);
+ arOptionalAAR.SetCompatibleWithPlatform(BuildTarget.Android, !isARCoreRequired);
+ }
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/BuildHelper.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/BuildHelper.cs.meta
new file mode 100644
index 000000000..8bc81ad30
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Editor/BuildHelper.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 51b018421df5e4defbf0a70c95a5f749
+timeCreated: 1518228237
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Frame.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Frame.cs
index ab7058a60..c0b77463c 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Frame.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Frame.cs
@@ -35,32 +35,10 @@ public class Frame
{
//// @cond EXCLUDE_FROM_DOXYGEN
- ///
- /// Gets the manager for the static frame.
- ///
- private static FrameManager s_FrameManager;
+ private static List s_TmpTrackableHitList = new List();
//// @endcond
- ///
- /// Gets the tracking state of the ARCore device for the frame. If the state is not Tracking,
- /// the values in the frame may be very inaccurate and generally should not be used.
- /// Tracking loss is often caused when the camera does not have enough visual features to track (e.g. a white
- /// wall) or the device is being moved very rapidly.
- ///
- public static TrackingState TrackingState
- {
- get
- {
- if (s_FrameManager == null)
- {
- return TrackingState.Stopped;
- }
-
- return s_FrameManager.GetCameraTrackingState();
- }
- }
-
///
/// Gets the pose of the ARCore device for the frame in Unity world coordinates.
///
@@ -68,12 +46,16 @@ public static Pose Pose
{
get
{
- if (s_FrameManager == null)
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ if (nativeSession == null)
{
return Pose.identity;
}
- return s_FrameManager.GetPose();
+ var cameraHandle = nativeSession.FrameApi.AcquireCamera();
+ Pose result = nativeSession.CameraApi.GetPose(cameraHandle);
+ nativeSession.CameraApi.Release(cameraHandle);
+ return result;
}
}
@@ -84,51 +66,75 @@ public static LightEstimate LightEstimate
{
get
{
- if (s_FrameManager == null)
+ // TODO (b/73256094): Remove isTracking when fixed.
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ var isTracking = LifecycleManager.Instance.SessionStatus == SessionStatus.Tracking;
+ if (nativeSession == null || !isTracking)
{
return new LightEstimate(LightEstimateState.NotValid, 0.0f);
}
- return s_FrameManager.GetLightEstimate();
+ return nativeSession.FrameApi.GetLightEstimate();
}
}
///
- /// Gets planes ARCore has tracked.
+ /// Performs a raycast against physical objects being tracked by ARCore.
+ /// Output the closest hit from the camera.
+ /// Note that the Unity's screen coordinate (0, 0)
+ /// starts from bottom left.
///
- /// A reference to a list of TrackedPlane that will be filled by the method call.
- /// A filter on the type of data to return.
- public static void GetPlanes(List planes, TrackableQueryFilter filter = TrackableQueryFilter.All)
+ /// Horizontal touch position in Unity's screen coordiante.
+ /// Vertical touch position in Unity's screen coordiante.
+ /// A filter bitmask where each {@link TrackableHitFlag} which is set represents a category
+ /// of raycast hits the method call should consider valid.
+ /// A {@link TrackableHit} that will be set if the raycast is successful.
+ /// true if the raycast had a hit, otherwise false.
+ public static bool Raycast(float x, float y, TrackableHitFlags filter,
+ out TrackableHit hitResult)
{
- if (s_FrameManager == null)
+ hitResult = new TrackableHit();
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ if (nativeSession == null)
{
- planes.Clear();
- return;
+ return false;
}
- s_FrameManager.GetTrackables(planes, filter);
- }
+ // Note that the Unity's screen coordinate (0, 0) starts from bottom left.
+ bool foundHit = nativeSession.HitTestApi.Raycast(nativeSession.FrameHandle, x, Screen.height - y, filter,
+ s_TmpTrackableHitList, true);
- //// @cond EXCLUDE_FROM_DOXYGEN
+ if (foundHit && s_TmpTrackableHitList.Count != 0)
+ {
+ hitResult = s_TmpTrackableHitList[0];
+ }
- ///
- /// Initializes the static Frame.
- ///
- /// The manager for the static frame.
- public static void Initialize(FrameManager frameManager)
- {
- Frame.s_FrameManager = frameManager;
+ return foundHit;
}
///
- /// Cleans up the static frame.
+ /// Performs a raycast against physical objects being tracked by ARCore.
+ /// Output all hits from the camera.
+ /// Note that the Unity's screen coordinate (0, 0)
+ /// starts from bottom left.
///
- public static void Destroy()
+ /// Horizontal touch position in Unity's screen coordiante.
+ /// Vertical touch position in Unity's screen coordiante.
+ /// A filter bitmask where each {@link TrackableHitFlag} which is set represents a category
+ /// of raycast hits the method call should consider valid.
+ /// A list of {@link TrackableHit} that will be set if the raycast is successful.
+ /// true if the raycast had a hit, otherwise false.
+ public static bool RaycastAll(float x, float y, TrackableHitFlags filter, List hitResults)
{
- s_FrameManager = null;
- }
+ hitResults.Clear();
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ if (nativeSession == null)
+ {
+ return false;
+ }
- //// @endcond
+ return nativeSession.HitTestApi.Raycast(nativeSession.FrameHandle, x, Screen.height - y, filter, hitResults, true);
+ }
///
/// Container for state related to the ARCore camera image metadata for the Frame.
@@ -142,10 +148,19 @@ public static class CameraMetadata
/// Metadata type.
/// Result list of the requested values.
/// true if getting metadata value successfully, otherwise false.
- public static bool TryGetValues(CameraMetadataTag metadataTag,
- List outMetadataList)
+ public static bool TryGetValues(CameraMetadataTag metadataTag, List outMetadataList)
{
- return Frame.s_FrameManager.CameraMetadataManager.TryGetValues(metadataTag, outMetadataList);
+ outMetadataList.Clear();
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ if (nativeSession == null)
+ {
+ return false;
+ }
+
+ var metadataHandle = nativeSession.FrameApi.AcquireImageMetadata();
+ var isSuccess = nativeSession.CameraMetadataApi.TryGetValues(metadataHandle, metadataTag, outMetadataList);
+ nativeSession.CameraMetadataApi.Release(metadataHandle);
+ return isSuccess;
}
///
@@ -155,7 +170,18 @@ public static bool TryGetValues(CameraMetadataTag metadataTag,
/// true if getting tags successfully, otherwise false.
public static bool GetAllCameraMetadataTags(List outMetadataTags)
{
- return Frame.s_FrameManager.CameraMetadataManager.GetAllCameraMetadataTags(outMetadataTags);
+ outMetadataTags.Clear();
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ if (nativeSession == null)
+ {
+ return false;
+ }
+
+ var metadataHandle = nativeSession.FrameApi.AcquireImageMetadata();
+ var isSuccess = nativeSession.CameraMetadataApi.GetAllCameraMetadataTags(metadataHandle,
+ outMetadataTags);
+ nativeSession.CameraMetadataApi.Release(metadataHandle);
+ return isSuccess;
}
}
@@ -173,12 +199,13 @@ public static bool IsUpdatedThisFrame
{
get
{
- if (Frame.s_FrameManager == null)
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ if (nativeSession == null)
{
return false;
}
- return Frame.s_FrameManager.PointCloudManager.GetIsUpdatedThisFrame();
+ return nativeSession.IsPointCloudNew;
}
}
@@ -189,12 +216,15 @@ public static int PointCount
{
get
{
- if (Frame.s_FrameManager == null)
+ // TODO (b/73256094): Remove isTracking when fixed.
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ var isTracking = LifecycleManager.Instance.SessionStatus == SessionStatus.Tracking;
+ if (nativeSession == null || !isTracking)
{
return 0;
}
- return Frame.s_FrameManager.PointCloudManager.GetPointCount();
+ return nativeSession.PointCloudApi.GetNumberOfPoints(nativeSession.PointCloudHandle);
}
}
@@ -205,12 +235,13 @@ public static int PointCount
/// The point from the point cloud at index.
public static Vector3 GetPoint(int index)
{
- if (Frame.s_FrameManager == null)
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ if (nativeSession == null)
{
return Vector3.zero;
}
- return Frame.s_FrameManager.PointCloudManager.GetPoint(index);
+ return nativeSession.PointCloudApi.GetPoint(nativeSession.PointCloudHandle, index);
}
///
@@ -219,18 +250,19 @@ public static Vector3 GetPoint(int index)
/// A list that will be filled with point cloud points by this method call.
public static void CopyPoints(List points)
{
- if (Frame.s_FrameManager == null)
+ points.Clear();
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ if (nativeSession == null)
{
- points.Clear();
return;
}
- Frame.s_FrameManager.PointCloudManager.CopyPoints(points);
+ nativeSession.PointCloudApi.CopyPoints(nativeSession.PointCloudHandle, points);
}
}
///
- /// Container for state related to the ARCore camera for the Frame.
+ /// Container for state related to the ARCore camera for the frame.
///
public static class CameraImage
{
@@ -241,12 +273,7 @@ public static Texture Texture
{
get
{
- if (Frame.s_FrameManager == null)
- {
- return null;
- }
-
- return Frame.s_FrameManager.GetCameraTexture();
+ return LifecycleManager.Instance.BackgroundTexture;
}
}
@@ -260,30 +287,35 @@ public static ApiDisplayUvCoords DisplayUvCoords
ApiDisplayUvCoords displayUvCoords = new ApiDisplayUvCoords(new Vector2(0, 1),
new Vector2(1, 1), new Vector2(0, 0), new Vector2(1, 0));
- if (Frame.s_FrameManager == null)
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ if (nativeSession == null || Texture == null)
{
return displayUvCoords;
}
- Frame.s_FrameManager.TransformDisplayUvCoords(ref displayUvCoords);
+ nativeSession.FrameApi.TransformDisplayUvCoords(ref displayUvCoords);
return displayUvCoords;
}
}
///
- /// Gets the current projection matrix for this frame.
- /// The near clipping plane for the projection matrix.
- /// The near clipping plane for the projection matrix.
+ /// The far clipping plane for the projection matrix.
+ /// The projection matrix for the frame.
public static Matrix4x4 GetCameraProjectionMatrix(float nearClipping, float farClipping)
{
- if (Frame.s_FrameManager == null)
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ if (nativeSession == null || Texture == null)
{
return Matrix4x4.identity;
}
- return Frame.s_FrameManager.GetCameraProjectionMatrix(nearClipping, farClipping);
+ var cameraHandle = nativeSession.FrameApi.AcquireCamera();
+ var result = nativeSession.CameraApi.GetProjectionMatrix(cameraHandle, nearClipping, farClipping);
+ nativeSession.CameraApi.Release(cameraHandle);
+ return result;
}
}
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/CameraMetadataManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/CameraMetadataManager.cs
deleted file mode 100644
index 8e77aabfe..000000000
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/CameraMetadataManager.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-//-----------------------------------------------------------------------
-//
-//
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// 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.
-//
-//
-//-----------------------------------------------------------------------
-
-namespace GoogleARCoreInternal
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using GoogleARCore;
- using UnityEngine;
-
- [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
- Justification = "Internal")]
- public class CameraMetadataManager
- {
- private NativeApi m_NativeApi;
-
- private IntPtr m_ArCameraMetadataHandle = IntPtr.Zero;
-
- public CameraMetadataManager(NativeApi nativeApi)
- {
- m_NativeApi = nativeApi;
- }
-
- public void UpdateFrame(IntPtr frameHandle)
- {
- if (m_ArCameraMetadataHandle != IntPtr.Zero)
- {
- // After first frame, release previous frame's image metadata.
- m_NativeApi.CameraMetadata.Release(m_ArCameraMetadataHandle);
- m_ArCameraMetadataHandle = IntPtr.Zero;
- }
-
- m_ArCameraMetadataHandle = m_NativeApi.Frame.AcquireImageMetadata(frameHandle);
- }
-
- public bool TryGetValues(CameraMetadataTag metadataTag, List outMetadataList)
- {
- if (m_ArCameraMetadataHandle == IntPtr.Zero)
- {
- // Intentionally ignored logging as the camera metadata is expected to be
- // unavailable in between frames.
- return false;
- }
-
- return m_NativeApi.CameraMetadata.TryGetValues(m_ArCameraMetadataHandle,
- metadataTag, outMetadataList);
- }
-
- public bool GetAllCameraMetadataTags(List outMetadataTags)
- {
- return m_NativeApi.CameraMetadata.GetAllCameraMetadataTags(m_ArCameraMetadataHandle,
- outMetadataTags);
- }
- }
-}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/FrameManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/FrameManager.cs
deleted file mode 100644
index 5a5e100ec..000000000
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/FrameManager.cs
+++ /dev/null
@@ -1,150 +0,0 @@
-//-----------------------------------------------------------------------
-//
-//
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// 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.
-//
-//
-//-----------------------------------------------------------------------
-
-namespace GoogleARCoreInternal
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using GoogleARCore;
- using UnityEngine;
-
- [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
- Justification = "Internal")]
- public class FrameManager
- {
- private NativeApi m_NativeApi;
-
- private IntPtr m_FrameHandle = IntPtr.Zero;
-
- private Texture2D m_BackgroundTexture;
-
- private TrackableManager m_TrackableManager;
-
- private List m_TrackableHitList = new List();
-
- public FrameManager(NativeApi nativeApi)
- {
- m_NativeApi = nativeApi;
- m_TrackableManager = new TrackableManager(nativeApi);
- PointCloudManager = new PointCloudManager(nativeApi);
- CameraMetadataManager = new CameraMetadataManager(nativeApi);
- }
-
- public PointCloudManager PointCloudManager { get; private set; }
-
- public CameraMetadataManager CameraMetadataManager { get; private set; }
-
- public Pose GetPose()
- {
- var cameraHandle = m_NativeApi.Frame.AcquireCamera(m_FrameHandle);
- Pose result = m_NativeApi.Camera.GetPose(cameraHandle);
- m_NativeApi.Camera.Release(cameraHandle);
- return result;
- }
-
- public LightEstimate GetLightEstimate()
- {
- return m_NativeApi.Frame.GetLightEstimate(m_FrameHandle);
- }
-
- public Texture GetCameraTexture()
- {
- return m_BackgroundTexture;
- }
-
- public void TransformDisplayUvCoords(ref ApiDisplayUvCoords uvQuad)
- {
- m_NativeApi.Frame.TransformDisplayUvCoords(m_FrameHandle, ref uvQuad);
- }
-
- public Matrix4x4 GetCameraProjectionMatrix(float nearClipping, float farClipping)
- {
- var cameraHandle = m_NativeApi.Frame.AcquireCamera(m_FrameHandle);
- var result = m_NativeApi.Camera.GetProjectionMatrix(cameraHandle, nearClipping, farClipping);
- m_NativeApi.Camera.Release(cameraHandle);
- return result;
- }
-
- public TrackingState GetCameraTrackingState()
- {
- var cameraHandle = m_NativeApi.Frame.AcquireCamera(m_FrameHandle);
- TrackingState result = m_NativeApi.Camera.GetTrackingState(cameraHandle);
- m_NativeApi.Camera.Release(cameraHandle);
- return result;
- }
-
- public void GetTrackables(List trackables, TrackableQueryFilter filter) where T : Trackable
- {
- m_TrackableManager.GetTrackables(trackables, filter);
- }
-
- public bool Raycast(float x, float y, TrackableHitFlags filter, out TrackableHit hitResult)
- {
- hitResult = new TrackableHit();
-
- // Note that the Unity's screen coordinate (0, 0) starts from bottom left.
- bool ret = m_NativeApi.HitTest.Raycast(m_FrameHandle, x, Screen.height - y, filter, m_TrackableHitList,
- true);
- if (ret && m_TrackableHitList.Count != 0)
- {
- hitResult = m_TrackableHitList[0];
- }
-
- return ret;
- }
-
- public bool RaycastAll(float x, float y, TrackableHitFlags filter, List hitResults)
- {
- // Note that the Unity's screen coordinate (0, 0) starts from bottom left.
- return m_NativeApi.HitTest.Raycast(m_FrameHandle, x, Screen.height - y, filter, hitResults, true);
- }
-
- public void UpdateFrame(IntPtr frameHandle, uint cameraTextureId)
- {
- m_FrameHandle = frameHandle;
- _UpdateTextureIfNeeded(cameraTextureId);
- PointCloudManager.UpdateFrame(m_FrameHandle);
- CameraMetadataManager.UpdateFrame(m_FrameHandle);
- }
-
- private void _UpdateTextureIfNeeded(uint cameraTextureId)
- {
- if (m_BackgroundTexture != null &&
- m_BackgroundTexture.GetNativeTexturePtr().ToInt32() == cameraTextureId)
- {
- return;
- }
-
- if (m_BackgroundTexture == null)
- {
- // The Unity-cached size and format of the texture (0x0, ARGB) is not the
- // actual format of the texture. This is okay because the texture is not
- // accessed by pixels, it is accessed with UV coordinates.
- m_BackgroundTexture = Texture2D.CreateExternalTexture(0, 0, TextureFormat.ARGB32, false,
- false, new IntPtr(cameraTextureId));
- }
- else
- {
- m_BackgroundTexture.UpdateExternalTexture(new IntPtr(cameraTextureId));
- }
- }
- }
-}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/LifecycleManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/LifecycleManager.cs
new file mode 100644
index 000000000..27daf42d2
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/LifecycleManager.cs
@@ -0,0 +1,361 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
+ using System.Runtime.InteropServices;
+ using GoogleARCore;
+ using UnityEngine;
+
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ public class LifecycleManager
+ {
+ private static LifecycleManager s_Instance = new LifecycleManager();
+
+ private CheckApkAvailabilityResultCallback m_CheckApkAvailabilityResultCallback;
+
+ private RequestApkInstallationResultCallback m_RequestApkInstallationResultCallback;
+
+ private CameraPermissionRequestProvider m_RequestCameraPermissionCallback;
+
+ private EarlyUpdateCallback m_EarlyUpdateCallback;
+
+ private Texture2D m_BackgroundTexture;
+
+ private ARCoreSession m_SessionComponent;
+
+ private NativeSession m_NativeSession;
+
+ private List> m_PendingAvailabilityCheckCallbacks =
+ new List>();
+
+ private List> m_PendingInstallationRequestCallbacks =
+ new List>();
+
+ static LifecycleManager()
+ {
+ Instance._Initialize();
+ }
+
+ private delegate void CheckApkAvailabilityResultCallback(ApiAvailability status,
+ IntPtr context);
+
+ private delegate void RequestApkInstallationResultCallback(
+ ApiApkInstallationStatus status, IntPtr context);
+
+ private delegate void CameraPermissionsResultCallback(bool granted,
+ IntPtr context);
+
+ private delegate void CameraPermissionRequestProvider(
+ CameraPermissionsResultCallback onComplete, IntPtr context);
+
+ private delegate void SessionCreationResultCallback(
+ IntPtr sessionHandle, IntPtr frameHandle, IntPtr context, ApiArStatus status);
+
+ private delegate void EarlyUpdateCallback();
+
+ public static LifecycleManager Instance
+ {
+ get
+ {
+ return s_Instance;
+ }
+ }
+
+ public Texture2D BackgroundTexture
+ {
+ get
+ {
+ return m_BackgroundTexture;
+ }
+ }
+
+ public NativeSession NativeSession
+ {
+ get
+ {
+ if (m_NativeSession != null)
+ {
+ return m_NativeSession;
+ }
+
+ IntPtr sessionHandle = IntPtr.Zero;
+ ExternApi.ArPresto_getSession(ref sessionHandle);
+
+ IntPtr frameHandle = IntPtr.Zero;
+ ExternApi.ArPresto_getFrame(ref frameHandle);
+
+ if (sessionHandle == IntPtr.Zero || frameHandle == IntPtr.Zero)
+ {
+ return null;
+ }
+
+ m_NativeSession = new NativeSession(sessionHandle, frameHandle);
+ return m_NativeSession;
+ }
+ }
+
+ public SessionStatus SessionStatus
+ {
+ get
+ {
+ ApiPrestoStatus prestoStatus = ApiPrestoStatus.Uninitialized;
+ ExternApi.ArPresto_getStatus(ref prestoStatus);
+ return prestoStatus.ToSessionStatus();
+ }
+ }
+
+ public void CreateSession(ARCoreSession session)
+ {
+ session.StartCoroutine(InstantPreviewManager.InitializeIfNeeded());
+
+ if (m_SessionComponent != null)
+ {
+ Debug.LogError("Multiple session components cannot exist in the scene. " +
+ "Destroying the newest.");
+ GameObject.Destroy(session);
+ return;
+ }
+
+ m_SessionComponent = session;
+ }
+
+ public void EnableSession()
+ {
+ var config = m_SessionComponent.SessionConfig;
+ if (config != null)
+ {
+ ExternApi.ArPresto_setConfiguration(new ApiPrestoConfig(config));
+ }
+
+ ExternApi.ArPresto_setEnabled(true);
+ }
+
+ public void DisableSession()
+ {
+ ExternApi.ArPresto_setEnabled(false);
+ }
+
+ public void DestroySession()
+ {
+ m_SessionComponent = null;
+ }
+
+ public AsyncTask CheckApkAvailability()
+ {
+ Action onComplete;
+ AsyncTask task =
+ new AsyncTask(out onComplete);
+
+ ExternApi.ArPresto_checkApkAvailability(m_CheckApkAvailabilityResultCallback,
+ IntPtr.Zero);
+
+ m_PendingAvailabilityCheckCallbacks.Add(onComplete);
+
+ return task;
+ }
+
+ public AsyncTask RequestApkInstallation(bool userRequested)
+ {
+ Action onComplete;
+ AsyncTask task =
+ new AsyncTask(out onComplete);
+
+ ExternApi.ArPresto_requestApkInstallation(userRequested,
+ m_RequestApkInstallationResultCallback, IntPtr.Zero);
+
+ m_PendingInstallationRequestCallbacks.Add(onComplete);
+
+ return task;
+ }
+
+ [AOT.MonoPInvokeCallback(typeof(CheckApkAvailabilityResultCallback))]
+ private static void OnCheckApkAvailabilityResultTrampoline(
+ ApiAvailability status, IntPtr context)
+ {
+ Instance._OnCheckApkAvailabilityResult(status.ToApkAvailabilityStatus());
+ }
+
+ [AOT.MonoPInvokeCallback(typeof(RequestApkInstallationResultCallback))]
+ private static void OnApkInstallationResultTrampoline(
+ ApiApkInstallationStatus status, IntPtr context)
+ {
+ Instance._OnRequestApkInstallationResult(status.ToApkInstallationStatus());
+ }
+
+ [AOT.MonoPInvokeCallback(typeof(CameraPermissionRequestProvider))]
+ private static void RequestCameraPermissionTrampoline(
+ CameraPermissionsResultCallback onComplete, IntPtr context)
+ {
+ Instance._RequestCameraPermission(onComplete, context);
+ }
+
+ [AOT.MonoPInvokeCallback(typeof(EarlyUpdateCallback))]
+ private static void EarlyUpdateTrampoline()
+ {
+ Instance._EarlyUpdate();
+ }
+
+ private void _Initialize()
+ {
+ m_EarlyUpdateCallback = new EarlyUpdateCallback(EarlyUpdateTrampoline);
+ ExternApi.ArCoreUnity_setArPrestoInitialized(m_EarlyUpdateCallback);
+
+ IntPtr javaVMHandle = IntPtr.Zero;
+ IntPtr activityHandle = IntPtr.Zero;
+ ExternApi.ArCoreUnity_getJniInfo(ref javaVMHandle, ref activityHandle);
+
+ m_CheckApkAvailabilityResultCallback =
+ new CheckApkAvailabilityResultCallback(OnCheckApkAvailabilityResultTrampoline);
+
+ m_RequestApkInstallationResultCallback =
+ new RequestApkInstallationResultCallback(OnApkInstallationResultTrampoline);
+
+ m_RequestCameraPermissionCallback =
+ new CameraPermissionRequestProvider(RequestCameraPermissionTrampoline);
+
+ ExternApi.ArPresto_initialize(javaVMHandle, activityHandle,
+ m_RequestCameraPermissionCallback);
+ }
+
+ private void _RequestCameraPermission(CameraPermissionsResultCallback onComplete,
+ IntPtr context)
+ {
+ const string cameraPermissionName = "android.permission.CAMERA";
+ AndroidPermissionsManager.RequestPermission(cameraPermissionName).ThenAction((grantResult) =>
+ {
+ onComplete(grantResult.IsAllGranted, context);
+ });
+ }
+
+ private void _EarlyUpdate()
+ {
+ AsyncTask.OnUpdate();
+ _UpdateTextureIfNeeded();
+
+ if (m_NativeSession != null)
+ {
+ m_NativeSession.SessionApi.SetDisplayGeometry(
+ Screen.orientation, Screen.width, Screen.height);
+ m_NativeSession.OnUpdate();
+ }
+ }
+
+ private void _OnCheckApkAvailabilityResult(ApkAvailabilityStatus status)
+ {
+ foreach (var onComplete in m_PendingAvailabilityCheckCallbacks)
+ {
+ onComplete(status);
+ }
+
+ m_PendingAvailabilityCheckCallbacks.Clear();
+ }
+
+ private void _OnRequestApkInstallationResult(ApkInstallationStatus status)
+ {
+ foreach (var onComplete in m_PendingInstallationRequestCallbacks)
+ {
+ onComplete(status);
+ }
+
+ m_PendingInstallationRequestCallbacks.Clear();
+ }
+
+ private void _UpdateTextureIfNeeded()
+ {
+ // If running in editor, updates background texture from Instant Preview only.
+ if (InstantPreviewManager.UpdateBackgroundTextureIfNeeded(ref m_BackgroundTexture))
+ {
+ return;
+ }
+
+ int backgroundTextureId = ExternApi.ArCoreUnity_getBackgroundTextureId();
+
+ if (NativeSession == null)
+ {
+ // This prevents using a texture that has not been filled out by ARCore.
+ return;
+ }
+ else if (backgroundTextureId == -1)
+ {
+ return;
+ }
+ else if (m_BackgroundTexture != null &&
+ m_BackgroundTexture.GetNativeTexturePtr().ToInt32() == backgroundTextureId)
+ {
+ return;
+ }
+ else if (m_BackgroundTexture == null)
+ {
+ // The Unity-cached size and format of the texture (0x0, ARGB) is not the
+ // actual format of the texture. This is okay because the texture is not
+ // accessed by pixels, it is accessed with UV coordinates.
+ m_BackgroundTexture = Texture2D.CreateExternalTexture(0, 0, TextureFormat.ARGB32, false,
+ false, new IntPtr(backgroundTextureId));
+ return;
+ }
+
+ m_BackgroundTexture.UpdateExternalTexture(new IntPtr(backgroundTextureId));
+ }
+
+ private struct ExternApi
+ {
+ [DllImport(ApiConstants.ARCoreShimApi)]
+ public static extern void ArCoreUnity_getJniInfo(ref IntPtr javaVM, ref IntPtr activity);
+
+ [DllImport(ApiConstants.ARCoreShimApi)]
+ public static extern void ArCoreUnity_setArPrestoInitialized(EarlyUpdateCallback onEarlyUpdate);
+
+ [DllImport(ApiConstants.ARCoreShimApi)]
+ public static extern int ArCoreUnity_getBackgroundTextureId();
+
+ [DllImport(ApiConstants.ARCoreShimApi)]
+ public static extern void ArPresto_initialize(IntPtr javaVM, IntPtr activity,
+ CameraPermissionRequestProvider requestCameraPermission);
+
+ [DllImport(ApiConstants.ARCoreShimApi)]
+ public static extern void ArPresto_checkApkAvailability(
+ CheckApkAvailabilityResultCallback onResult, IntPtr context);
+
+ [DllImport(ApiConstants.ARCoreShimApi)]
+ public static extern void ArPresto_requestApkInstallation(bool user_requested,
+ RequestApkInstallationResultCallback onResult, IntPtr context);
+
+ [DllImport(ApiConstants.ARCoreShimApi)]
+ public static extern void ArPresto_getSession(ref IntPtr sessionHandle);
+
+ [DllImport(ApiConstants.ARCoreShimApi)]
+ public static extern void ArPresto_setConfiguration(ApiPrestoConfig config);
+
+ [DllImport(ApiConstants.ARCoreShimApi)]
+ public static extern void ArPresto_setEnabled(bool isEnabled);
+
+ [DllImport(ApiConstants.ARCoreShimApi)]
+ public static extern void ArPresto_getFrame(ref IntPtr frameHandle);
+
+ [DllImport(ApiConstants.ARCoreShimApi)]
+ public static extern void ArPresto_getStatus(ref ApiPrestoStatus prestoStatus);
+ }
+ }
+}
\ No newline at end of file
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/LifecycleManager.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/LifecycleManager.cs.meta
new file mode 100644
index 000000000..47689ce8e
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/LifecycleManager.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 864c8242be03c4aec8427b8a2286c601
+timeCreated: 1517519681
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/PointCloudManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/PointCloudManager.cs
deleted file mode 100644
index 4c84f79d7..000000000
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/PointCloudManager.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-//-----------------------------------------------------------------------
-//
-//
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// 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.
-//
-//
-//-----------------------------------------------------------------------
-
-namespace GoogleARCoreInternal
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using GoogleARCore;
- using UnityEngine;
-
- [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
- Justification = "Internal")]
- public class PointCloudManager
- {
- private NativeApi m_NativeApi;
-
- private IntPtr m_PointCloudHandle = IntPtr.Zero;
-
- private long m_LastUpdateTimeStamp = -1;
-
- public PointCloudManager(NativeApi nativeApi)
- {
- m_NativeApi = nativeApi;
- }
-
- public void UpdateFrame(IntPtr frameHandle)
- {
- if (m_PointCloudHandle != IntPtr.Zero)
- {
- // After first frame, release previous frame's point cloud.
- m_NativeApi.PointCloud.Release(m_PointCloudHandle);
- }
-
- m_PointCloudHandle = m_NativeApi.Frame.AcquirePointCloud(frameHandle);
- }
-
- public bool GetIsUpdatedThisFrame()
- {
- long currentTimestamp = m_NativeApi.PointCloud.GetTimestamp(m_PointCloudHandle);
- if (m_LastUpdateTimeStamp != currentTimestamp)
- {
- m_LastUpdateTimeStamp = currentTimestamp;
- return true;
- }
-
- return false;
- }
-
- public int GetPointCount()
- {
- return m_NativeApi.PointCloud.GetNumberOfPoints(m_PointCloudHandle);
- }
-
- public Vector4 GetPoint(int index)
- {
- return m_NativeApi.PointCloud.GetPoint(m_PointCloudHandle, index);
- }
-
- public void CopyPoints(List points)
- {
- m_NativeApi.PointCloud.CopyPoints(m_PointCloudHandle, points);
- }
- }
-}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/PointCloudManager.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/PointCloudManager.cs.meta
deleted file mode 100644
index 3d846d1e6..000000000
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/PointCloudManager.cs.meta
+++ /dev/null
@@ -1,13 +0,0 @@
-fileFormatVersion: 2
-guid: f6b4b7c51c87443799d4fbeda15e9bdd
-timeCreated: 1510945633
-licenseType: Free
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/SessionManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/SessionManager.cs
deleted file mode 100644
index 06362c492..000000000
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/SessionManager.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-//-----------------------------------------------------------------------
-//
-//
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// 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.
-//
-//
-//-----------------------------------------------------------------------
-
-namespace GoogleARCoreInternal
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using GoogleARCore;
- using UnityEngine;
-
- [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
- Justification = "Internal")]
- public class SessionManager
- {
- private NativeApi m_NativeApi;
-
- private SessionManager()
- {
- }
-
- ~SessionManager()
- {
- Destroy();
- }
-
- public SessionConnectionState ConnectionState { get; set; }
-
- public FrameManager FrameManager { get; private set; }
-
- public static SessionManager CreateSession()
- {
- var sessionManager = new SessionManager();
- sessionManager.m_NativeApi = NativeApi.CreateSession();
- if (sessionManager.m_NativeApi != null)
- {
- sessionManager.FrameManager = new FrameManager(sessionManager.m_NativeApi);
- sessionManager.ConnectionState = SessionConnectionState.Uninitialized;
- }
- else
- {
- // Eventually we will provide more detail here: ARCore not installed, device not
- // supported, ARCore version not supported, etc.; however the API to support these
- // details does not exist yet.
- //
- // For now, just bundle all the possible errors into a generic connection failed.
- sessionManager.ConnectionState = SessionConnectionState.ConnectToServiceFailed;
- }
-
- return sessionManager;
- }
-
- public void Destroy()
- {
- if (m_NativeApi != null)
- {
- m_NativeApi.Destroy();
- m_NativeApi = null;
- }
- }
-
- public bool CheckSupported(ARCoreSessionConfig config)
- {
- return m_NativeApi.Session.CheckSupported(config) == ApiArStatus.Success;
- }
-
- public bool SetConfiguration(ARCoreSessionConfig config)
- {
- return m_NativeApi.Session.SetConfiguration(config);
- }
-
- public bool Resume()
- {
- return m_NativeApi.Resume(_EarlyUpdate);
- }
-
- public Anchor CreateWorldAnchor(Pose pose)
- {
- return m_NativeApi.Session.CreateAnchor(pose);
- }
-
- private void _EarlyUpdate(IntPtr frameHandle, int textureId)
- {
- m_NativeApi.Session.SetDisplayGeometry(Screen.orientation, Screen.width, Screen.height);
- FrameManager.UpdateFrame(frameHandle, (uint)textureId);
- }
- }
-}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/SessionManager.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/SessionManager.cs.meta
deleted file mode 100644
index 32769b3a8..000000000
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/SessionManager.cs.meta
+++ /dev/null
@@ -1,13 +0,0 @@
-fileFormatVersion: 2
-guid: 13c569393eedb4ed39120c82612bdd06
-timeCreated: 1510966847
-licenseType: Free
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/TrackableManager.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/TrackableManager.cs
index a607d76b9..0484e0925 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/TrackableManager.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Managers/TrackableManager.cs
@@ -30,7 +30,10 @@ namespace GoogleARCoreInternal
Justification = "Internal")]
public class TrackableManager
{
- private NativeApi m_NativeApi;
+ private Dictionary m_TrackableDict =
+ new Dictionary(new IntPtrEqualityComparer());
+
+ private NativeSession m_NativeSession;
private int m_LastUpdateFrame = -1;
@@ -38,19 +41,64 @@ public class TrackableManager
private List m_AllTrackables = new List();
+ private List m_UpdatedTrackables = new List();
+
private HashSet m_OldTrackables = new HashSet();
- public TrackableManager(NativeApi nativeApi)
+ public TrackableManager(NativeSession nativeSession)
+ {
+ m_NativeSession = nativeSession;
+ }
+
+ ///
+ /// Factory method for creating and reusing TrackedPlane references from native handles.
+ ///
+ /// A native handle to a plane that has been acquired. RELEASE WILL BE HANDLED BY
+ /// THIS METHOD.
+ /// A reference to a tracked plane.
+ public Trackable TrackableFactory(IntPtr nativeHandle)
{
- m_NativeApi = nativeApi;
+ if (nativeHandle == IntPtr.Zero)
+ {
+ return null;
+ }
+
+ Trackable result;
+ if (m_TrackableDict.TryGetValue(nativeHandle, out result))
+ {
+ // Release aquired handle and return cached result.
+ m_NativeSession.TrackableApi.Release(nativeHandle);
+ return result;
+ }
+
+ ApiTrackableType trackableType = m_NativeSession.TrackableApi.GetType(nativeHandle);
+ if (trackableType == ApiTrackableType.Plane)
+ {
+ result = new TrackedPlane(nativeHandle, m_NativeSession);
+ }
+ else if (trackableType == ApiTrackableType.Point)
+ {
+ result = new TrackedPoint(nativeHandle, m_NativeSession);
+ }
+ else
+ {
+ UnityEngine.Debug.LogFormat("Cant find {0}", trackableType);
+ throw new NotImplementedException("TrackableFactory:: No constructor for requested trackable type.");
+ }
+
+ m_TrackableDict.Add(nativeHandle, result);
+ return result;
}
public void GetTrackables(List trackables, TrackableQueryFilter filter) where T : Trackable
{
if (m_LastUpdateFrame < Time.frameCount)
{
+ // Get trackables updated this frame.
+ m_NativeSession.FrameApi.GetUpdatedTrackables(m_UpdatedTrackables);
+
// Get all the trackables in the session.
- m_NativeApi.Session.GetAllTrackables(m_AllTrackables);
+ m_NativeSession.SessionApi.GetAllTrackables(m_AllTrackables);
// Find trackables that are not in the hashset (new).
m_NewTrackables.Clear();
@@ -83,6 +131,13 @@ public void GetTrackables(List trackables, TrackableQueryFilter filter) wh
_SafeAdd(m_NewTrackables[i], trackables);
}
}
+ else if (filter == TrackableQueryFilter.Updated)
+ {
+ for (int i = 0; i < m_NewTrackables.Count; i++)
+ {
+ _SafeAdd(m_UpdatedTrackables[i], trackables);
+ }
+ }
}
private void _SafeAdd(Trackable trackable, List trackables) where T : Trackable
@@ -93,4 +148,4 @@ private void _SafeAdd(Trackable trackable, List trackables) where T : Trac
}
}
}
-}
\ No newline at end of file
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Session.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Session.cs
index 34b9c727a..0cb911cd0 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Session.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Session.cs
@@ -33,127 +33,80 @@ namespace GoogleARCore
///
public static class Session
{
- //// @cond EXCLUDE_FROM_DOXYGEN
-
- ///
- /// Gets the manager for the sttatic session.
- ///
- public static SessionManager SessionManager { get; private set; }
-
- //// @endcond
-
///
- /// Gets current connection state.
- ///
- /// Members of the Session class (apart from ConnectionState itself) are only considered valid for access when
- /// Session.ConnectionState == SessionConnectionState.Connected. Access to members of Session outside of this
- /// state is considered undefined and may use stale data or throw an exception.
+ /// Gets current session status.
///
- public static SessionConnectionState ConnectionState
+ public static SessionStatus Status
{
get
{
- if (SessionManager == null)
- {
- return SessionConnectionState.Uninitialized;
- }
-
- return SessionManager.ConnectionState;
+ return LifecycleManager.Instance.SessionStatus;
}
}
///
- /// Creates a new anchor at a world pose. As ARCore updates its understading of the space, it will update the
+ /// Creates a new Anchor at the given Pose that is attached to the Trackable.
+ /// If trackable is null, it creates a new anchor at a world pose.
+ /// As ARCore updates its understading of the space, it will update the
/// virtual pose of the of the anchor to attempt to keep the anchor in the same real world location.
///
/// The Unity world pose where the anchor is to be creates.
+ /// The Trackable to attach the Anchor to.
/// The newly created anchor or null.
- public static Anchor CreateWorldAnchor(Pose pose)
+ public static Anchor CreateAnchor(Pose pose, Trackable trackable = null)
{
- if (SessionManager == null)
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ if (nativeSession == null)
{
return null;
}
- return SessionManager.CreateWorldAnchor(pose);
- }
-
- ///
- /// Performs a raycast against physical objects being tracked by ARCore.
- /// Output the closest hit from the camera.
- /// Note that the Unity's screen coordinate (0, 0)
- /// starts from bottom left.
- ///
- /// Horizontal touch position in Unity's screen coordiante.
- /// Vertical touch position in Unity's screen coordiante.
- /// A filter bitmask where each {@link TrackableHitFlag} which is set represents a category
- /// of raycast hits the method call should consider valid.
- /// A {@link TrackableHit} that will be set if the raycast is successful.
- /// true if the raycast had a hit, otherwise false.
- public static bool Raycast(float x, float y, TrackableHitFlags filter,
- out TrackableHit hitResult)
- {
- if (SessionManager == null)
+ if (trackable == null)
{
- hitResult = new TrackableHit();
- return false;
+ return nativeSession.SessionApi.CreateAnchor(pose);
+ }
+ else
+ {
+ return trackable.CreateAnchor(pose);
}
-
- return SessionManager.FrameManager.Raycast(x, y, filter, out hitResult);
}
///
- /// Performs a raycast against physical objects being tracked by ARCore.
- /// Output all hits from the camera.
- /// Note that the Unity's screen coordinate (0, 0)
- /// starts from bottom left.
+ /// Gets Trackables ARCore has tracked.
///
- /// Horizontal touch position in Unity's screen coordiante.
- /// Vertical touch position in Unity's screen coordiante.
- /// A filter bitmask where each {@link TrackableHitFlag} which is set represents a category
- /// of raycast hits the method call should consider valid.
- /// A list of {@link TrackableHit} that will be set if the raycast is successful.
- /// true if the raycast had a hit, otherwise false.
- public static bool RaycastAll(float x, float y, TrackableHitFlags filter, List hitResults)
+ /// The Trackable type to get.
+ /// A reference to a list of T that will be filled by the method call.
+ /// A filter on the type of data to return.
+ public static void GetTrackables(List trackables, TrackableQueryFilter filter = TrackableQueryFilter.All) where T : Trackable
{
- if (SessionManager == null)
+ trackables.Clear();
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ if (nativeSession == null)
{
- hitResults.Clear();
- return false;
+ return;
}
- return SessionManager.FrameManager.RaycastAll(x, Screen.height - y, filter, hitResults);
+ nativeSession.GetTrackables(trackables, filter);
}
- //// @cond EXCLUDE_FROM_DOXYGEN
-
///
- /// Initialized the static session.
+ /// Checks the availability of the ARCore APK on the device.
///
- /// The manaager for the static session.
- public static void Initialize(SessionManager sessionManager)
+ /// An AsyncTask that completes with an ApkAvailabilityStatus when the availability is known.
+ public static AsyncTask CheckApkAvailability()
{
- if (Session.SessionManager != null)
- {
- Debug.LogWarning("Cleaning up old session that was not destroyed.");
- Session.SessionManager.Destroy();
- }
-
- Session.SessionManager = sessionManager;
+ return LifecycleManager.Instance.CheckApkAvailability();
}
///
- /// Destroys the context of the static session class.
+ /// Requests an installation of the ARCore APK on the device.
///
- public static void Destroy()
+ /// Whether the installation was requested explicity by a user action.
+ /// An AsyncTask that completes with an ApkInstallationStatus when the installation
+ /// status is resolved.
+ public static AsyncTask RequestApkInstallation(bool userRequested)
{
- if (SessionManager != null)
- {
- SessionManager.Destroy();
- SessionManager = null;
- }
+ return LifecycleManager.Instance.RequestApkInstallation(userRequested);
}
-
- //// @endcond
}
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionConnectionState.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionConnectionState.cs
deleted file mode 100644
index 056876fb4..000000000
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionConnectionState.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-//-----------------------------------------------------------------------
-//
-//
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// 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.
-//
-//
-//-----------------------------------------------------------------------
-
-namespace GoogleARCore
-{
- ///
- /// Possible states for the ARCore session connection.
- ///
- public enum SessionConnectionState
- {
- ///
- /// The ARCore session has not been initialized.
- ///
- Uninitialized = 0,
-
- ///
- /// The ARCore session is connected.
- ///
- Connected,
-
- ///
- /// The ARCore session failed to connect because no configuration was supplied.
- ///
- MissingConfiguration,
-
- ///
- /// The ARCore session failed to connect because an invalid configuration was supplied.
- ///
- InvalidConfiguration,
-
- ///
- /// The ARCore session failed to connect because the user rejected at least one needed permission.
- ///
- UserRejectedNeededPermission,
-
- ///
- /// The ARCore session failed to connect for unknown reason.
- ///
- ConnectToServiceFailed,
- }
-}
\ No newline at end of file
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionConnectionState.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionConnectionState.cs.meta
deleted file mode 100644
index 85e8f1618..000000000
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionConnectionState.cs.meta
+++ /dev/null
@@ -1,13 +0,0 @@
-fileFormatVersion: 2
-guid: 8ee375b70bec246e2ba1aa45b534a9c6
-timeCreated: 1503354175
-licenseType: Free
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatus.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatus.cs
new file mode 100644
index 000000000..6de73ac2c
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatus.cs
@@ -0,0 +1,74 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCore
+{
+ ///
+ /// Possible states for the ARCore session.
+ ///
+ public enum SessionStatus
+ {
+ ///
+ /// The ARCore session has not been initialized.
+ ///
+ None = 0,
+
+ ///
+ /// The ARCore session is initializing.
+ ///
+ Initializing = 1,
+
+ ///
+ /// The ARCore session is tracking.
+ ///
+ Tracking = 100,
+
+ ///
+ /// The ARCore session has lost tracking and is attempting to recover.
+ ///
+ LostTracking = 101,
+
+ ///
+ /// The ARCore session is paused.
+ ///
+ NotTracking = 102,
+
+ ///
+ /// An ARCore session cannot begin tracking because a fatal error was encountered.
+ ///
+ FatalError = 200,
+
+ ///
+ /// An ARCore session cannot begin tracking because the ARCore service APK is not available on the device.
+ ///
+ ErrorApkNotAvailable = 201,
+
+ ///
+ /// An ARCore session cannot begin tracking because the Android camera permission is not granted.
+ ///
+ ErrorPermissionNotGranted = 202,
+
+ ///
+ /// An ARCore session cannot begin tracking because the session configuration supplied is not supported or no
+ /// session configuration was supplied.
+ ///
+ ErrorSessionConfigurationNotSupported = 203,
+ }
+}
\ No newline at end of file
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatus.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatus.cs.meta
new file mode 100644
index 000000000..40427c87d
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatus.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 30a41262cba2646c98f6d3cf4e46fb2a
+timeCreated: 1516741153
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatusExtensions.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatusExtensions.cs
new file mode 100644
index 000000000..6a0851328
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatusExtensions.cs
@@ -0,0 +1,70 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCore
+{
+ using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
+
+ ///
+ /// Extension methods for the SessionStatus enumeration.
+ ///
+ public static class SessionStatusExtensions
+ {
+ private const int k_NotInitializedGroupStart = 0;
+ private const int k_ValidSessionGroupStart = 100;
+ private const int k_ErrorGroupStart = 200;
+
+ ///
+ /// Gets whether a SessionStatus is not yet initialized.
+ ///
+ /// The SessionStatus to check.
+ /// true if the SessionStatus is not initialized, otherwise false.
+ public static bool IsNotInitialized(this SessionStatus status)
+ {
+ int normalizedValue = (int)status - k_NotInitializedGroupStart;
+ return normalizedValue >= 0 && normalizedValue < 100;
+ }
+
+ ///
+ /// Gets whether a SessionStatus is initialized and valid.
+ ///
+ /// The SessionStatus to check.
+ /// true if the SessionStatus is initialized and valid,
+ /// otherwise false.
+ public static bool IsValid(this SessionStatus status)
+ {
+ int normalizedValue = (int)status - k_ValidSessionGroupStart;
+ return normalizedValue >= 0 && normalizedValue < 100;
+ }
+
+ ///
+ /// Gets whether a SessionStatus is an error.
+ ///
+ /// The SessionStatus to check.
+ /// true if the SessionStatus is an error,
+ /// otherwise false.
+ public static bool IsError(this SessionStatus status)
+ {
+ int normalizedValue = (int)status - k_ErrorGroupStart;
+ return normalizedValue >= 0 && normalizedValue < 100;
+ }
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatusExtensions.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatusExtensions.cs.meta
new file mode 100644
index 000000000..5e626eed2
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/SessionStatusExtensions.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: b8d6e0fc3b3bc44218e96690668c05b4
+timeCreated: 1517519681
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Trackable.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Trackable.cs
index d4857ed24..e6da5d780 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Trackable.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Trackable.cs
@@ -40,7 +40,7 @@ public abstract class Trackable
///
/// The native api for ARCore.
///
- protected NativeApi m_NativeApi;
+ protected NativeSession m_NativeSession;
///
/// Constructs a new ARCore Trackable.
@@ -53,16 +53,16 @@ protected Trackable()
/// Constructs a new ARCore Trackable.
///
/// The native handle.
- /// The native api.
- protected Trackable(IntPtr trackableNativeHandle, NativeApi nativeApi)
+ /// The native session.
+ protected Trackable(IntPtr trackableNativeHandle, NativeSession nativeSession)
{
m_TrackableNativeHandle = trackableNativeHandle;
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeSession;
}
~Trackable()
{
- m_NativeApi.Trackable.Release(m_TrackableNativeHandle);
+ m_NativeSession.TrackableApi.Release(m_TrackableNativeHandle);
}
//// @endcond
@@ -75,7 +75,21 @@ public virtual TrackingState TrackingState
{
get
{
- return m_NativeApi.Trackable.GetTrackingState(m_TrackableNativeHandle);
+ // TODO (b/73256094): Remove isTracking when fixed.
+ var nativeSession = LifecycleManager.Instance.NativeSession;
+ var isTracking = LifecycleManager.Instance.SessionStatus == SessionStatus.Tracking;
+ if (nativeSession != m_NativeSession)
+ {
+ // Trackables from another session are considered stopped.
+ return TrackingState.Stopped;
+ }
+ else if (!isTracking)
+ {
+ // If there are no new frames coming in we must manually return paused.
+ return TrackingState.Paused;
+ }
+
+ return m_NativeSession.TrackableApi.GetTrackingState(m_TrackableNativeHandle);
}
}
@@ -90,13 +104,13 @@ public virtual TrackingState TrackingState
public virtual Anchor CreateAnchor(Pose pose)
{
IntPtr anchorHandle;
- if (!m_NativeApi.Trackable.AcquireNewAnchor(m_TrackableNativeHandle, pose, out anchorHandle))
+ if (!m_NativeSession.TrackableApi.AcquireNewAnchor(m_TrackableNativeHandle, pose, out anchorHandle))
{
Debug.Log("Failed to create anchor on trackable.");
return null;
}
- return Anchor.AnchorFactory(anchorHandle, m_NativeApi);
+ return Anchor.AnchorFactory(anchorHandle, m_NativeSession);
}
///
@@ -105,7 +119,7 @@ public virtual Anchor CreateAnchor(Pose pose)
/// A list of anchors to be filled by the method.
public virtual void GetAllAnchors(List anchors)
{
- m_NativeApi.Trackable.GetAnchors(m_TrackableNativeHandle, anchors);
+ m_NativeSession.TrackableApi.GetAnchors(m_TrackableNativeHandle, anchors);
}
}
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableHitFlags.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableHitFlags.cs
index 6b129203e..8827d6e9e 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableHitFlags.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableHitFlags.cs
@@ -34,27 +34,33 @@ public enum TrackableHitFlags
///
/// If you pass this into Raycast, you will not get any collision results.
///
- None = 0,
+ None = 0,
///
/// The collision is within the the TrackedPlane's convex bounding polygon.
///
- PlaneWithinPolygon = 1 << 0,
+ PlaneWithinPolygon = 1 << 0,
///
/// The collision is within the TrackedPlane's bounding box.
///
- PlaneWithinBounds = 1 << 1,
+ PlaneWithinBounds = 1 << 1,
///
/// The collision is on the TrackedPlane, but not limited to the bounding box or polygon.
/// This acts as if the plane extends out to infinity.
///
- PlaneWithinInfinity = 1 << 2,
+ PlaneWithinInfinity = 1 << 2,
///
- /// The collision is on points in the current frame's point cloud.
+ /// The collision is on a feature point in the current frame's point cloud.
///
- PointCloud = 1 << 3,
+ FeaturePoint = 1 << 3,
+
+ ///
+ /// The collision is on a feature point in the current frame's point cloud
+ /// that has a surface normal estimate (orientation).
+ ///
+ FeaturePointWithSurfaceNormal = 1 << 4,
}
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableQueryFilter.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableQueryFilter.cs
index 74d474892..4b5fe7bf3 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableQueryFilter.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackableQueryFilter.cs
@@ -39,5 +39,10 @@ public enum TrackableQueryFilter
/// Indicates new trackables detected in the current ARCore Frame.
///
New,
+
+ ///
+ /// Indicates trackables that were updated in the current ARCore Frame.
+ ///
+ Updated,
}
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPlane.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPlane.cs
index 79866abdf..5d7ee6e48 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPlane.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPlane.cs
@@ -38,11 +38,11 @@ public class TrackedPlane : Trackable
///
/// A handle to the native ARCore API Trackable.
/// The ARCore native api.
- public TrackedPlane(IntPtr nativeHandle, NativeApi nativeApi)
+ public TrackedPlane(IntPtr nativeHandle, NativeSession nativeApi)
: base(nativeHandle, nativeApi)
{
m_TrackableNativeHandle = nativeHandle;
- m_NativeApi = nativeApi;
+ m_NativeSession = nativeApi;
}
//// @endcond
@@ -55,29 +55,18 @@ public TrackedPlane SubsumedBy
{
get
{
- return m_NativeApi.Plane.GetSubsumedBy(m_TrackableNativeHandle);
+ return m_NativeSession.PlaneApi.GetSubsumedBy(m_TrackableNativeHandle);
}
}
///
- /// Gets the center position of the plane.
+ /// Gets the position and orientation of the plane's center.
///
- public Vector3 Position
+ public Pose CenterPose
{
get
{
- return m_NativeApi.Plane.GetCenterPose(m_TrackableNativeHandle).position;
- }
- }
-
- ///
- /// Gets the rotation of the plane.
- ///
- public Quaternion Rotation
- {
- get
- {
- return m_NativeApi.Plane.GetCenterPose(m_TrackableNativeHandle).rotation;
+ return m_NativeSession.PlaneApi.GetCenterPose(m_TrackableNativeHandle);
}
}
@@ -88,7 +77,7 @@ public float ExtentX
{
get
{
- return m_NativeApi.Plane.GetExtentX(m_TrackableNativeHandle);
+ return m_NativeSession.PlaneApi.GetExtentX(m_TrackableNativeHandle);
}
}
@@ -99,7 +88,7 @@ public float ExtentZ
{
get
{
- return m_NativeApi.Plane.GetExtentZ(m_TrackableNativeHandle);
+ return m_NativeSession.PlaneApi.GetExtentZ(m_TrackableNativeHandle);
}
}
@@ -110,7 +99,7 @@ public float ExtentZ
/// A list of Vector3 to be filled by the method call.
public void GetBoundaryPolygon(List boundaryPolygonPoints)
{
- m_NativeApi.Plane.GetPolygon(m_TrackableNativeHandle, boundaryPolygonPoints);
+ m_NativeSession.PlaneApi.GetPolygon(m_TrackableNativeHandle, boundaryPolygonPoints);
}
}
}
\ No newline at end of file
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPoint.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPoint.cs
index 5f5ffa1f8..b7c90a01b 100644
--- a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPoint.cs
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPoint.cs
@@ -38,20 +38,31 @@ public class TrackedPoint : Trackable
///
/// A handle to the native ARCore API Trackable.
/// The ARCore native api.
- public TrackedPoint(IntPtr nativeHandle, NativeApi nativeApi) : base(nativeHandle, nativeApi)
+ public TrackedPoint(IntPtr nativeHandle, NativeSession nativeApi) : base(nativeHandle, nativeApi)
{
}
//// @endcond
///
- /// Gets the pose of the point.
+ /// Gets the pose of the TrackedPoint.
///
public Pose Pose
{
get
{
- return m_NativeApi.Point.GetPose(m_TrackableNativeHandle);
+ return m_NativeSession.PointApi.GetPose(m_TrackableNativeHandle);
+ }
+ }
+
+ ///
+ /// Gets the orientation mode of the TrackedPoint.
+ ///
+ public TrackedPointOrientationMode OrientationMode
+ {
+ get
+ {
+ return m_NativeSession.PointApi.GetOrientationMode(m_TrackableNativeHandle);
}
}
}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPointOrientationMode.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPointOrientationMode.cs
new file mode 100644
index 000000000..bd381cc8b
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPointOrientationMode.cs
@@ -0,0 +1,31 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCore
+{
+ ///
+ /// The orientation mode for a TrackedPoint.
+ ///
+ public enum TrackedPointOrientationMode
+ {
+ Identity = 0,
+ SurfaceNormal = 1,
+ }
+}
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPointOrientationMode.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPointOrientationMode.cs.meta
new file mode 100644
index 000000000..582f1e37b
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/TrackedPointOrientationMode.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: f605e8f0dd31a453083b47fb68477792
+timeCreated: 1516989852
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Utility/ARCoreProjectSettings.cs b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Utility/ARCoreProjectSettings.cs
new file mode 100644
index 000000000..35461c2c6
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Utility/ARCoreProjectSettings.cs
@@ -0,0 +1,75 @@
+//-----------------------------------------------------------------------
+//
+//
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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.
+//
+//
+//-----------------------------------------------------------------------
+
+namespace GoogleARCoreInternal
+{
+ using System;
+ using System.Diagnostics.CodeAnalysis;
+ using System.IO;
+ using UnityEngine;
+
+ [Serializable]
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
+ Justification = "Internal")]
+ public class ARCoreProjectSettings
+ {
+ public string Version;
+ public bool IsARCoreRequired;
+ public bool IsInstantPreviewEnabled;
+ private const string k_VersionString = "V1.0.0";
+ private const string k_ProjectSettingsPath = "ProjectSettings/ARCoreProjectSettings.json";
+
+ static ARCoreProjectSettings()
+ {
+ if (Application.isEditor)
+ {
+ Instance = new ARCoreProjectSettings();
+ Instance.Load();
+ }
+ else
+ {
+ Instance = null;
+ Debug.LogError("Cannot access ARCoreProjectSettings outside of Unity Editor.");
+ }
+ }
+
+ public static ARCoreProjectSettings Instance { get; private set; }
+
+ public void Load()
+ {
+ Version = k_VersionString;
+ IsARCoreRequired = true;
+ IsInstantPreviewEnabled = false;
+
+ if (File.Exists(k_ProjectSettingsPath))
+ {
+ ARCoreProjectSettings settings = JsonUtility.FromJson(
+ File.ReadAllText(k_ProjectSettingsPath));
+ Version = settings.Version;
+ IsARCoreRequired = settings.IsARCoreRequired;
+ }
+ }
+
+ public void Save()
+ {
+ File.WriteAllText(k_ProjectSettingsPath, JsonUtility.ToJson(this));
+ }
+ }
+}
\ No newline at end of file
diff --git a/sdkproject/Assets/GoogleARCore/SDK/Scripts/Utility/ARCoreProjectSettings.cs.meta b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Utility/ARCoreProjectSettings.cs.meta
new file mode 100644
index 000000000..5a47a84f5
--- /dev/null
+++ b/sdkproject/Assets/GoogleARCore/SDK/Scripts/Utility/ARCoreProjectSettings.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 68605a05829544832b871afc8bf03168
+timeCreated: 1518470830
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteDevice.cs b/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteDevice.cs
index 886d5d503..5404eb423 100644
--- a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteDevice.cs
+++ b/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteDevice.cs
@@ -28,6 +28,22 @@ public class ARRemoteDevice : MonoBehaviour
private Dictionary> m_MessageHandler =
new Dictionary>();
+ private bool m_BackgroundRendering;
+ public bool BackgroundRendering
+ {
+ get
+ {
+ return m_BackgroundRendering;
+ }
+ set
+ {
+ m_BackgroundRendering = value;
+ if (m_ARInterface != null){
+ m_ARInterface.BackgroundRendering = m_BackgroundRendering;
+ }
+ }
+ }
+
public bool IsRunning
{
get
@@ -59,6 +75,7 @@ void Start()
Register(ARMessageIds.SubMessageIds.startService, StartServiceMessageHandler);
Register(ARMessageIds.SubMessageIds.stopService, StopServiceMessageHandler);
Register(ARMessageIds.SubMessageIds.enableVideo, EnableVideoMessageHandler);
+ Register(ARMessageIds.SubMessageIds.backgroundRendering, BackgroundRenderingMessageHandler);
}
private void OnDisable()
@@ -111,6 +128,12 @@ void EnableVideoMessageHandler(SerializableSubMessage message)
m_HaveSentCameraParams = false;
}
+ void BackgroundRenderingMessageHandler(SerializableSubMessage message)
+ {
+ var requestedBackgroundRenderingState = message.GetDataAs();
+ BackgroundRendering = requestedBackgroundRenderingState.backgroundRendering;
+ }
+
void StartServiceMessageHandler(SerializableSubMessage message)
{
var settings = message.GetDataAs();
@@ -157,6 +180,7 @@ IEnumerator StartServiceRoutine()
m_ARInterface = arInterface;
m_ARInterface.SetupCamera(m_ARCamera);
+ m_ARInterface.BackgroundRendering = BackgroundRendering;
ARInterface.planeAdded += PlaneAddedHandler;
ARInterface.planeUpdated += PlaneUpdatedHandler;
@@ -271,7 +295,7 @@ private void Update()
SendToEditor(ARMessageIds.lightEstimate, serializedLightEstimate);
}
- if (m_SendVideo)
+ if (m_SendVideo && m_ARInterface.BackgroundRendering)
{
if (m_ARInterface.TryGetCameraImage(ref m_CameraImage))
{
diff --git a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteEditor.cs b/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteEditor.cs
index 92ee8d648..37e7bd7de 100644
--- a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteEditor.cs
+++ b/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteEditor.cs
@@ -25,6 +25,20 @@ public bool sendVideo
}
}
+ public override bool BackgroundRendering
+ {
+ get { return base.BackgroundRendering; }
+
+ set
+ {
+ if (m_RemoteInterface != null)
+ {
+ m_RemoteInterface.BackgroundRendering = base.BackgroundRendering = value;
+ }
+ }
+ }
+
+
ARRemoteEditorInterface m_RemoteInterface;
EditorConnection m_EditorConnection;
@@ -175,6 +189,7 @@ protected override void SetupARInterface()
m_ARInterface = m_RemoteInterface;
ARInterface.SetInterface(m_RemoteInterface);
m_RemoteInterface.sendVideo = sendVideo;
+ m_RemoteInterface.BackgroundRendering = BackgroundRendering;
}
private void OnDisable()
diff --git a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteEditorInterface.cs b/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteEditorInterface.cs
index 73e882d35..db04d7dd8 100644
--- a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteEditorInterface.cs
+++ b/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteEditorInterface.cs
@@ -3,6 +3,7 @@
using UnityEngine.Networking.PlayerConnection;
using Utils;
using System.Collections;
+using UnityEngine.XR;
#if UNITY_EDITOR
using UnityEditor.Networking.PlayerConnection;
@@ -34,13 +35,39 @@ public bool sendVideo
private SerializableFrame m_Frame = null;
private Settings m_CachedSettings;
private Camera m_CachedCamera;
- private ARRemoteVideo m_ARVideo;
private LightEstimate m_LightEstimate;
+ private CameraImage m_CameraImage;
+ private ARBackgroundRenderer m_BackgroundRenderer;
public bool connected { get { return m_CurrentPlayerId != -1; } }
public int playerId { get { return m_CurrentPlayerId; } }
public bool IsRemoteServiceRunning { get; protected set; }
+ private bool m_BackgroundRendering;
+ public override bool BackgroundRendering
+ {
+ get
+ {
+ return m_BackgroundRendering;
+ }
+ set
+ {
+ m_BackgroundRendering = value;
+
+ if (m_BackgroundRenderer != null){
+ m_BackgroundRenderer.mode = m_BackgroundRendering ?
+ ARRenderMode.MaterialAsBackground : ARRenderMode.StandardBackground;
+ }
+
+ if (editorConnection != null)
+ {
+ SendToPlayer(
+ ARMessageIds.SubMessageIds.backgroundRendering,
+ new SerializableBackgroundRendering(m_BackgroundRendering));
+ }
+ }
+ }
+
Texture2D m_RemoteScreenYTexture;
Texture2D m_RemoteScreenUVTexture;
@@ -77,20 +104,30 @@ public void ScreenCaptureParamsMessageHandler(MessageEventArgs message)
TextureFormat.RG16, false, true);
}
- m_ARVideo = m_CachedCamera.GetComponent();
- if (m_ARVideo == null)
- {
- m_ARVideo = m_CachedCamera.gameObject.AddComponent();
- m_ARVideo.clearMaterial = Resources.Load("YUVMaterial", typeof(Material)) as Material;
- m_CachedCamera.clearFlags = CameraClearFlags.Depth;
+ Material YUVMaterial = Resources.Load("YUVMaterial", typeof(Material)) as Material;
+ YUVMaterial.SetMatrix("_DisplayTransform", GetDisplayTransform());
+ YUVMaterial.SetTexture("_textureY", m_RemoteScreenYTexture);
+ YUVMaterial.SetTexture("_textureCbCr", m_RemoteScreenUVTexture);
+
+ if(m_BackgroundRenderer != null){
+ m_BackgroundRenderer.backgroundMaterial = null;
+ m_BackgroundRenderer.camera = null;
}
- m_ARVideo.videoTextureY = m_RemoteScreenYTexture;
- m_ARVideo.videoTextureCbCr = m_RemoteScreenUVTexture;
+ m_BackgroundRenderer = new ARBackgroundRenderer();
+ m_BackgroundRenderer.backgroundMaterial = YUVMaterial;
+ m_BackgroundRenderer.camera = m_CachedCamera;
+ //Set mode and send to player
+ BackgroundRendering = m_BackgroundRendering;
+
+ m_CameraImage.width = screenCaptureParams.width;
+ m_CameraImage.height = screenCaptureParams.height;
}
public void ScreenCaptureYMessageHandler(MessageEventArgs message)
{
+ m_CameraImage.y = message.data;
+
if (m_RemoteScreenYTexture == null)
return;
@@ -100,6 +137,8 @@ public void ScreenCaptureYMessageHandler(MessageEventArgs message)
public void ScreenCaptureUVMessageHandler(MessageEventArgs message)
{
+ m_CameraImage.uv = message.data;
+
//In case of ARCore sending grayscale image, UV data would be null.
if (m_RemoteScreenUVTexture == null || message.data == null)
return;
@@ -214,7 +253,19 @@ public override bool TryGetUnscaledPose(ref Pose pose)
public override bool TryGetCameraImage(ref CameraImage cameraImage)
{
- return false;
+ //If remote device is not sending video, we can assume that the current cached frame is out of date.
+ if (!m_SendVideo)
+ return false;
+ //We only return a cached frame if it has all it's components
+ if (m_CameraImage.height == 0 || m_CameraImage.width == 0 || m_CameraImage.y == null || m_CameraImage.uv == null)
+ return false;
+
+ cameraImage.width = m_CameraImage.width;
+ cameraImage.height = m_CameraImage.height;
+ cameraImage.y = m_CameraImage.y;
+ cameraImage.uv = m_CameraImage.uv;
+
+ return true;
}
public override bool TryGetPointCloud(ref PointCloud pointCloud)
@@ -254,13 +305,12 @@ public override void UpdateCamera(Camera camera)
if (m_Frame != null)
{
camera.projectionMatrix = m_Frame.projectionMatrix;
- if (m_ARVideo)
+ if (m_BackgroundRenderer != null)
{
- m_ARVideo.UpdateDisplayTransform(GetDisplayTransform());
+ m_BackgroundRenderer.backgroundMaterial.SetMatrix("_DisplayTransform",GetDisplayTransform());
}
}
}
-
}
}
#endif
diff --git a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteVideo.cs b/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteVideo.cs
deleted file mode 100644
index 23ad7ec9f..000000000
--- a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARRemoteVideo.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using UnityEngine;
-using UnityEngine.Rendering;
-
-namespace UnityARInterface
-{
- public class ARRemoteVideo : MonoBehaviour
- {
- public Material clearMaterial;
- public Texture2D videoTextureY;
- public Texture2D videoTextureCbCr;
-
- private CommandBuffer m_VideoCommandBuffer;
- private bool m_CommandBufferInitialized;
- private Matrix4x4 m_DisplayTransform;
-
-
- public void Start()
- {
- m_CommandBufferInitialized = false;
- }
-
- void InitializeCommandBuffer()
- {
- m_VideoCommandBuffer = new CommandBuffer();
- m_VideoCommandBuffer.Blit(null, BuiltinRenderTextureType.CurrentActive, clearMaterial);
- GetComponent().AddCommandBuffer(CameraEvent.BeforeForwardOpaque, m_VideoCommandBuffer);
- m_CommandBufferInitialized = true;
- }
-
- void OnDestroy()
- {
- GetComponent().RemoveCommandBuffer(CameraEvent.BeforeForwardOpaque, m_VideoCommandBuffer);
- m_CommandBufferInitialized = false;
- }
-
- public void UpdateDisplayTransform(Matrix4x4 displayMatrix)
- {
- m_DisplayTransform.SetColumn (0, displayMatrix.GetColumn (0));
- m_DisplayTransform.SetColumn (1, displayMatrix.GetColumn (1));
- m_DisplayTransform.SetColumn (2, displayMatrix.GetColumn (2));
- m_DisplayTransform.SetColumn (3, displayMatrix.GetColumn (3));
-
- }
-
- public void OnPreRender()
- {
- if (!m_CommandBufferInitialized)
- InitializeCommandBuffer ();
-
- clearMaterial.SetTexture("_textureY", videoTextureY);
- clearMaterial.SetTexture("_textureCbCr", videoTextureCbCr);
- clearMaterial.SetMatrix("_DisplayTransform", m_DisplayTransform);
-
- }
- }
-}
diff --git a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARSerializableObjects.cs b/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARSerializableObjects.cs
index 2047df000..908f9bd38 100644
--- a/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARSerializableObjects.cs
+++ b/sdkproject/Assets/UnityARInterface/ARRemote/Scripts/ARSerializableObjects.cs
@@ -189,6 +189,16 @@ public SerializableEnableVideo(bool enableVideo)
}
}
+ [Serializable]
+ public class SerializableBackgroundRendering
+ {
+ public bool backgroundRendering;
+ public SerializableBackgroundRendering(bool backgroundRendering)
+ {
+ this.backgroundRendering = backgroundRendering;
+ }
+ }
+
[Serializable]
public class SerializableARSettings
{
diff --git a/sdkproject/Assets/UnityARInterface/Examples/Common/Shaders/InstancedSurfaceShader.shader b/sdkproject/Assets/UnityARInterface/Examples/Common/Shaders/InstancedSurfaceShader.shader
index 7b4f912f5..f1c613b32 100644
--- a/sdkproject/Assets/UnityARInterface/Examples/Common/Shaders/InstancedSurfaceShader.shader
+++ b/sdkproject/Assets/UnityARInterface/Examples/Common/Shaders/InstancedSurfaceShader.shader
@@ -1,19 +1,16 @@
// Upgrade NOTE: upgraded instancing buffer 'Props' to new syntax.
-Shader "Custom/InstancedSurfaceShader"
-{
- Properties
- {
- _Color("Color", Color) = (1,1,1,1)
- _MainTex("Albedo (RGB)", 2D) = "white" {}
- _Glossiness("Smoothness", Range(0,1)) = 0.5
- _Metallic("Metallic", Range(0,1)) = 0.0
+Shader "Custom/InstancedSurfaceShader" {
+ Properties {
+ _Color ("Color", Color) = (1,1,1,1)
+ _MainTex ("Albedo (RGB)", 2D) = "white" {}
+ _Glossiness ("Smoothness", Range(0,1)) = 0.5
+ _Metallic ("Metallic", Range(0,1)) = 0.0
}
- SubShader
- {
- Tags { "RenderType" = "Opaque" }
+ SubShader {
+ Tags { "RenderType"="Opaque" }
LOD 200
-
+
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
@@ -23,8 +20,7 @@ Shader "Custom/InstancedSurfaceShader"
sampler2D _MainTex;
- struct Input
- {
+ struct Input {
float2 uv_MainTex;
};
@@ -36,15 +32,14 @@ Shader "Custom/InstancedSurfaceShader"
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
- // put more per-instance properties here
- UNITY_DEFINE_INSTANCED_PROP(fixed4, _InstanceColor)
- #define _InstanceColor_arr Props
+ // put more per-instance properties here
+ UNITY_DEFINE_INSTANCED_PROP (fixed4, _InstanceColor)
+#define _InstanceColor_arr Props
UNITY_INSTANCING_BUFFER_END(Props)
- void surf(Input IN, inout SurfaceOutputStandard o)
- {
+ void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
- fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * UNITY_ACCESS_INSTANCED_PROP(_InstanceColor_arr, _InstanceColor);
+ fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * UNITY_ACCESS_INSTANCED_PROP (_InstanceColor_arr, _InstanceColor);
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
diff --git a/sdkproject/Assets/UnityARInterface/Scripts/ARAnchor.cs b/sdkproject/Assets/UnityARInterface/Scripts/ARAnchor.cs
new file mode 100644
index 000000000..911d576f7
--- /dev/null
+++ b/sdkproject/Assets/UnityARInterface/Scripts/ARAnchor.cs
@@ -0,0 +1,49 @@
+using UnityEngine;
+
+namespace UnityARInterface
+{
+ public class ARAnchor : ARBase
+ {
+ [HideInInspector]
+ public string anchorID;
+
+ private ARInterface m_ARInterface;
+ private bool started;
+
+ private void Awake()
+ {
+ m_ARInterface = ARInterface.GetInterface();
+ if (m_ARInterface == null)
+ Destroy(this);
+ }
+
+ void Start()
+ {
+ UpdateAnchor();
+ started = true;
+ }
+
+ private void OnEnable()
+ {
+ if (started)
+ UpdateAnchor();
+ }
+
+ private void OnDisable()
+ {
+ m_ARInterface.DestroyAnchor(this);
+ }
+
+ private void OnDestroy()
+ {
+ m_ARInterface.DestroyAnchor(this);
+ }
+
+ public void UpdateAnchor()
+ {
+ m_ARInterface.DestroyAnchor(this);
+ m_ARInterface.ApplyAnchor(this);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/sdkproject/Assets/UnityARInterface/Scripts/ARAnchor.cs.meta b/sdkproject/Assets/UnityARInterface/Scripts/ARAnchor.cs.meta
new file mode 100644
index 000000000..1c004021e
--- /dev/null
+++ b/sdkproject/Assets/UnityARInterface/Scripts/ARAnchor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7fb52f11595a74c1ca6ad8025865fdb9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/UnityARInterface/Scripts/ARController.cs b/sdkproject/Assets/UnityARInterface/Scripts/ARController.cs
index 6f10d2933..f57d3eedb 100644
--- a/sdkproject/Assets/UnityARInterface/Scripts/ARController.cs
+++ b/sdkproject/Assets/UnityARInterface/Scripts/ARController.cs
@@ -25,9 +25,22 @@ public class ARController : MonoBehaviour
[SerializeField]
private bool m_PointCloud;
+ [SerializeField]
+ private bool m_BackgroundRendering = true;
+
[SerializeField]
private float m_Scale = 1f;
+ public virtual bool BackgroundRendering {
+ get { return m_BackgroundRendering; }
+
+ set {
+ if(m_ARInterface != null){
+ m_ARInterface.BackgroundRendering = m_BackgroundRendering = value;
+ }
+ }
+ }
+
public float scale
{
set
@@ -134,6 +147,7 @@ IEnumerator StartServiceRoutine()
if (IsRunning)
{
m_ARInterface.SetupCamera(m_ARCamera);
+ m_ARInterface.BackgroundRendering = BackgroundRendering;
Application.onBeforeRender += OnBeforeRender;
}
else
diff --git a/sdkproject/Assets/UnityARInterface/Scripts/ARCoreInterface.cs b/sdkproject/Assets/UnityARInterface/Scripts/ARCoreInterface.cs
index 1637831db..0b70bf832 100644
--- a/sdkproject/Assets/UnityARInterface/Scripts/ARCoreInterface.cs
+++ b/sdkproject/Assets/UnityARInterface/Scripts/ARCoreInterface.cs
@@ -1,10 +1,10 @@
-using System;
+using System;
using System.Collections.Generic;
using UnityEngine;
using GoogleARCore;
-using GoogleARCoreInternal;
using System.Collections;
using System.Runtime.InteropServices;
+using UnityEngine.XR;
namespace UnityARInterface
{
@@ -46,23 +46,38 @@ private enum ImageFormatType
private List m_TrackedPlaneBuffer = new List();
private ScreenOrientation m_CachedScreenOrientation;
private Dictionary m_TrackedPlanes = new Dictionary();
- private SessionManager m_SessionManager;
+ private ARCoreSession m_ARCoreSession;
private ARCoreSessionConfig m_ARCoreSessionConfig;
- private ARCoreBackgroundRenderer m_BackgroundRenderer;
+ private ARBackgroundRenderer m_BackgroundRenderer;
private Matrix4x4 m_DisplayTransform = Matrix4x4.identity;
private List m_TempPointCloud = new List();
+ private Dictionary m_Anchors = new Dictionary();
+ private bool m_BackgroundRendering;
public override bool IsSupported
{
get
{
- if (m_SessionManager == null)
- m_SessionManager = SessionManager.CreateSession();
+ return
+ Session.Status != SessionStatus.ErrorApkNotAvailable &&
+ Session.Status != SessionStatus.ErrorSessionConfigurationNotSupported;
+ }
+ }
- if (m_ARCoreSessionConfig == null)
- m_ARCoreSessionConfig = ScriptableObject.CreateInstance();
+ public override bool BackgroundRendering
+ {
+ get
+ {
+ return m_BackgroundRendering;
+ }
+ set
+ {
+ if (m_BackgroundRenderer == null)
+ return;
- return m_SessionManager.CheckSupported((m_ARCoreSessionConfig));
+ m_BackgroundRendering = value;
+ m_BackgroundRenderer.mode = m_BackgroundRendering ?
+ ARRenderMode.MaterialAsBackground : ARRenderMode.StandardBackground;
}
}
@@ -74,141 +89,89 @@ public override IEnumerator StartService(Settings settings)
m_ARCoreSessionConfig.EnableLightEstimation = settings.enableLightEstimation;
m_ARCoreSessionConfig.EnablePlaneFinding = settings.enablePlaneDetection;
//Do we want to match framerate to the camera?
- m_ARCoreSessionConfig.MatchCameraFramerate = false;
+ m_ARCoreSessionConfig.MatchCameraFramerate = true;
- //Using the SessionManager instead of ARCoreSession allows us to check if the config is supported,
- //And also using the session without the need for a GameObject or an additional MonoBehaviour.
- if (m_SessionManager == null)
+ // Create a GameObject on which the session component will live.
+ if (m_ARCoreSession == null)
{
- m_SessionManager = SessionManager.CreateSession();
- if (!IsSupported){
- ARDebug.LogError("The requested ARCore session configuration is not supported.");
- yield break;
- }
-
- Session.Initialize(m_SessionManager);
-
- if (Session.ConnectionState != SessionConnectionState.Uninitialized)
- {
- ARDebug.LogError("Could not create an ARCore session. The current Unity Editor may not support this " +
- "version of ARCore.");
- yield break;
- }
+ var go = new GameObject("ARCore Session");
+ go.SetActive(false);
+ m_ARCoreSession = go.AddComponent();
+ m_ARCoreSession.SessionConfig = m_ARCoreSessionConfig;
+ go.SetActive(true);
}
- //We ask for permission to use the camera and wait
- var task = AskForPermissionAndConnect(m_ARCoreSessionConfig);
- yield return task.WaitForCompletion();
- //After the operation is done, we double check if the connection was successful
- IsRunning = task.Result == SessionConnectionState.Connected;
-
- if (IsRunning)
- TextureReader_create((int)k_ImageFormatType, k_ARCoreTextureWidth, k_ARCoreTextureHeight, true);
- }
-
- //Checks if we can establish a connection, and ask for permission
- private AsyncTask AskForPermissionAndConnect(ARCoreSessionConfig sessionConfig)
- {
- const string androidCameraPermissionName = "android.permission.CAMERA";
+ // Enabling the session triggers the connection
+ m_ARCoreSession.SessionConfig = m_ARCoreSessionConfig;
+ m_ARCoreSession.enabled = true;
- if (m_SessionManager == null)
+ if (!IsSupported)
{
- ARDebug.LogError("Cannot connect because ARCoreSession failed to initialize.");
- return new AsyncTask(SessionConnectionState.Uninitialized);
- }
-
- if (sessionConfig == null)
- {
- ARDebug.LogError("Unable to connect ARSession session due to missing ARSessionConfig.");
- m_SessionManager.ConnectionState = SessionConnectionState.MissingConfiguration;
- return new AsyncTask(Session.ConnectionState);
- }
-
- // We have already connected at least once.
- if (Session.ConnectionState != SessionConnectionState.Uninitialized)
- {
- ARDebug.LogError("Multiple attempts to connect to the ARSession. Note that the ARSession connection " +
- "spans the lifetime of the application and cannot be reconfigured. This will change in future " +
- "versions of ARCore.");
- return new AsyncTask(Session.ConnectionState);
+ switch (Session.Status)
+ {
+ case SessionStatus.ErrorApkNotAvailable:
+ Debug.LogError("ARCore APK is not installed");
+ yield break;
+ case SessionStatus.ErrorPermissionNotGranted:
+ Debug.LogError("A needed permission (likely the camera) has not been granted");
+ yield break;
+ case SessionStatus.ErrorSessionConfigurationNotSupported:
+ Debug.LogError("The given ARCore session configuration is not supported on this device");
+ yield break;
+ case SessionStatus.FatalError:
+ Debug.LogError("A fatal error was encountered trying to start the ARCore session");
+ yield break;
+ }
}
- // Create an asynchronous task for the potential permissions flow and service connection.
- Action onTaskComplete;
- var returnTask = new AsyncTask(out onTaskComplete);
- returnTask.ThenAction((connectionState) =>
+ while (!Session.Status.IsValid())
{
- m_SessionManager.ConnectionState = connectionState;
- });
+ IsRunning = false;
- // Attempt service connection immediately if permissions are granted.
- if (AndroidPermissionsManager.IsPermissionGranted(androidCameraPermissionName))
- {
- Connect(sessionConfig, onTaskComplete);
- return returnTask;
- }
-
- // Request needed permissions and attempt service connection if granted.
- AndroidPermissionsManager.RequestPermission(androidCameraPermissionName).ThenAction((requestResult) =>
- {
- if (requestResult.IsAllGranted)
+ if (Session.Status.IsError())
{
- Connect(sessionConfig, onTaskComplete);
- }
- else
- {
- ARDebug.LogError("ARCore connection failed because a needed permission was rejected.");
- onTaskComplete(SessionConnectionState.UserRejectedNeededPermission);
+ switch (Session.Status)
+ {
+ case SessionStatus.ErrorPermissionNotGranted:
+ Debug.LogError("A needed permission (likely the camera) has not been granted");
+ yield break;
+ case SessionStatus.FatalError:
+ Debug.LogError("A fatal error was encountered trying to start the ARCore session");
+ yield break;
+ }
}
- });
- return returnTask;
- }
-
- //Connect is called once the permission to use the camera is granted.
- private void Connect(ARCoreSessionConfig sessionConfig, Action onComplete)
- {
- if (!m_SessionManager.CheckSupported(sessionConfig))
- {
- ARDebug.LogError("The requested ARCore session configuration is not supported.");
- onComplete(SessionConnectionState.InvalidConfiguration);
- return;
+ yield return null;
}
- if (!m_SessionManager.SetConfiguration(sessionConfig))
- {
- ARDebug.LogError("ARCore connection failed because the current configuration is not supported.");
- onComplete(SessionConnectionState.InvalidConfiguration);
- return;
- }
+ // If we make it out of the while loop, then the session is initialized and valid
+ IsRunning = true;
- Frame.Initialize(m_SessionManager.FrameManager);
+ if (IsRunning)
+ TextureReader_create((int)k_ImageFormatType, k_ARCoreTextureWidth, k_ARCoreTextureHeight, true);
- // ArSession_resume needs to be called in the UI thread due to b/69682628.
- AsyncTask.PerformActionInUIThread(() =>
- {
- if (!m_SessionManager.Resume())
- {
- onComplete(SessionConnectionState.ConnectToServiceFailed);
- }
- else
- {
- onComplete(SessionConnectionState.Connected);
- }
- });
}
public override void StopService()
{
- Frame.Destroy();
- Session.Destroy();
+ var anchors = m_Anchors.Keys;
+ foreach (var anchor in anchors)
+ {
+ DestroyAnchor(anchor);
+ }
+
+ m_ARCoreSession.enabled = false;
TextureReader_destroy();
+ BackgroundRendering = false;
+ m_BackgroundRenderer.backgroundMaterial = null;
+ m_BackgroundRenderer.camera = null;
+ m_BackgroundRenderer = null;
IsRunning = false;
}
public override bool TryGetUnscaledPose(ref Pose pose)
{
- if (Frame.TrackingState != TrackingState.Tracking)
+ if (Session.Status != SessionStatus.Tracking)
return false;
pose.position = Frame.Pose.position;
@@ -218,7 +181,7 @@ public override bool TryGetUnscaledPose(ref Pose pose)
public override bool TryGetCameraImage(ref CameraImage cameraImage)
{
- if (Frame.TrackingState != TrackingState.Tracking)
+ if (Session.Status != SessionStatus.Tracking)
return false;
if (Frame.CameraImage.Texture == null || Frame.CameraImage.Texture.GetNativeTexturePtr() == IntPtr.Zero)
@@ -299,7 +262,7 @@ private void PixelBuffertoYUV2(byte[] rgba, int width, int height,ImageFormatTyp
public override bool TryGetPointCloud(ref PointCloud pointCloud)
{
- if (Frame.TrackingState != TrackingState.Tracking)
+ if (Session.Status != SessionStatus.Tracking)
return false;
// Fill in the data to draw the point cloud.
@@ -321,7 +284,7 @@ public override bool TryGetPointCloud(ref PointCloud pointCloud)
public override LightEstimate GetLightEstimate()
{
- if (Session.ConnectionState == SessionConnectionState.Connected && Frame.LightEstimate.State == LightEstimateState.Valid)
+ if (Session.Status.IsValid() && Frame.LightEstimate.State == LightEstimateState.Valid)
{
return new LightEstimate()
{
@@ -374,50 +337,45 @@ private void CalculateDisplayTransform()
public override void SetupCamera(Camera camera)
{
- camera.gameObject.SetActive(false);
- m_BackgroundRenderer = camera.gameObject.AddComponent();
- m_BackgroundRenderer.BackgroundMaterial = Resources.Load("Materials/ARBackground", typeof(Material)) as Material;
- camera.gameObject.SetActive(true);
- }
+ ARCoreBackgroundRenderer backgroundRenderer =
+ camera.GetComponent();
- public override void UpdateCamera(Camera camera)
- {
- if (Screen.orientation == m_CachedScreenOrientation)
- return;
-
- CalculateDisplayTransform();
- m_CachedScreenOrientation = Screen.orientation;
+ if (backgroundRenderer == null)
+ {
+ camera.gameObject.SetActive(false);
+ backgroundRenderer = camera.gameObject.AddComponent();
+ backgroundRenderer.BackgroundMaterial = Resources.Load("Materials/ARBackground", typeof(Material)) as Material;
+ camera.gameObject.SetActive(true);
+ }
}
-
- private bool FloatCompare(float a, float b)
+ public override void UpdateCamera(Camera camera)
{
- return Mathf.Abs(a - b) < 9.99999944E-11f;
+ // This is handled for us by the ARCoreBackgroundRenderer
}
private bool PlaneUpdated(TrackedPlane tp, BoundedPlane bp)
{
- var extents = (!FloatCompare(tp.ExtentX, bp.extents.x) || !FloatCompare(tp.ExtentZ, bp.extents.y));
- var rotation = tp.Rotation != bp.rotation;
- var position = tp.Position != bp.center;
+ var tpExtents = new Vector2(tp.ExtentX, tp.ExtentZ);
+ var extents = Vector2.Distance(tpExtents, bp.extents) > 0.005f;
+ var rotation = tp.CenterPose.rotation != bp.rotation;
+ var position = Vector2.Distance(tp.CenterPose.position, bp.center) > 0.005f;
return (extents || rotation || position);
}
public override void Update()
{
- if (m_SessionManager == null)
- {
+ if (m_ARCoreSession == null)
return;
- }
AsyncTask.OnUpdate();
- if (Frame.TrackingState != TrackingState.Tracking)
+ if (Session.Status != SessionStatus.Tracking)
return;
if(m_ARCoreSessionConfig.EnablePlaneFinding)
{
- Frame.GetPlanes(m_TrackedPlaneBuffer);
+ Session.GetTrackables(m_TrackedPlaneBuffer, TrackableQueryFilter.All);
foreach (var trackedPlane in m_TrackedPlaneBuffer)
{
BoundedPlane boundedPlane;
@@ -432,10 +390,11 @@ public override void Update()
// update any planes with changed extents
else if (PlaneUpdated(trackedPlane, boundedPlane))
{
- boundedPlane.center = trackedPlane.Position;
- boundedPlane.rotation = trackedPlane.Rotation;
+ boundedPlane.center = trackedPlane.CenterPose.position;
+ boundedPlane.rotation = trackedPlane.CenterPose.rotation;
boundedPlane.extents.x = trackedPlane.ExtentX;
boundedPlane.extents.y = trackedPlane.ExtentZ;
+ m_TrackedPlanes[trackedPlane] = boundedPlane;
OnPlaneUpdated(boundedPlane);
}
}
@@ -445,8 +404,8 @@ public override void Update()
boundedPlane = new BoundedPlane()
{
id = Guid.NewGuid().ToString(),
- center = trackedPlane.Position,
- rotation = trackedPlane.Rotation,
+ center = trackedPlane.CenterPose.position,
+ rotation = trackedPlane.CenterPose.rotation,
extents = new Vector2(trackedPlane.ExtentX, trackedPlane.ExtentZ)
};
@@ -471,6 +430,38 @@ public override void Update()
m_TrackedPlanes.Remove(plane);
}
+
+ //Update Anchors
+ foreach(var anchor in m_Anchors){
+ anchor.Key.transform.position = anchor.Value.transform.position;
+ anchor.Key.transform.rotation = anchor.Value.transform.rotation;
+ }
+ }
+
+ public override void ApplyAnchor(ARAnchor arAnchor)
+ {
+ if (!IsRunning)
+ return;
+ //Since ARCore wants to create it's own GameObject, we can keep a reference to it and copy its Pose.
+ //Not the best, but probably will change when ARCore releases.
+ Anchor arCoreAnchor = Session.CreateAnchor(new Pose(arAnchor.transform.position, arAnchor.transform.rotation));
+ arAnchor.anchorID = Guid.NewGuid().ToString();
+ m_Anchors[arAnchor] = arCoreAnchor;
+ }
+
+ public override void DestroyAnchor(ARAnchor arAnchor)
+ {
+ if (!string.IsNullOrEmpty(arAnchor.anchorID))
+ {
+ Anchor arCoreAnchor;
+ if(m_Anchors.TryGetValue(arAnchor, out arCoreAnchor)){
+ UnityEngine.Object.Destroy(arCoreAnchor);
+ m_Anchors.Remove(arAnchor);
+ }
+
+ arAnchor.anchorID = null;
+
+ }
}
}
}
diff --git a/sdkproject/Assets/UnityARInterface/Scripts/ARInterface.cs b/sdkproject/Assets/UnityARInterface/Scripts/ARInterface.cs
index 5ec4cfc03..3eaba9d3b 100644
--- a/sdkproject/Assets/UnityARInterface/Scripts/ARInterface.cs
+++ b/sdkproject/Assets/UnityARInterface/Scripts/ARInterface.cs
@@ -50,6 +50,8 @@ public struct LightEstimate
public virtual bool IsSupported { get { return true; } }
+ public virtual bool BackgroundRendering { get { return false; } set{ } }
+
public abstract IEnumerator StartService(Settings settings);
public abstract void StopService();
@@ -95,6 +97,14 @@ protected void OnPlaneRemoved(BoundedPlane plane)
planeRemoved(plane);
}
+ public virtual void ApplyAnchor(ARAnchor arAnchor)
+ {
+ }
+
+ public virtual void DestroyAnchor(ARAnchor arAnchor)
+ {
+ }
+
private static ARInterface m_Interface;
public static ARInterface GetInterface()
diff --git a/sdkproject/Assets/UnityARInterface/Scripts/ARKitInterface.cs b/sdkproject/Assets/UnityARInterface/Scripts/ARKitInterface.cs
index 8a363de5e..3df57144a 100644
--- a/sdkproject/Assets/UnityARInterface/Scripts/ARKitInterface.cs
+++ b/sdkproject/Assets/UnityARInterface/Scripts/ARKitInterface.cs
@@ -3,13 +3,15 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
+using UnityEngine.Rendering;
+using UnityEngine.XR;
using UnityEngine.XR.iOS;
namespace UnityARInterface
{
public class ARKitInterface : ARInterface
{
- private Material m_CachedClearMaterial;
+ private Material m_ClearMaterial;
private UnityARSessionNativeInterface nativeInterface
{ get { return UnityARSessionNativeInterface.GetARSessionNativeInterface(); } }
@@ -21,12 +23,21 @@ private UnityARSessionNativeInterface nativeInterface
private byte[] m_TextureUVBytes;
private byte[] m_TextureYBytes2;
private byte[] m_TextureUVBytes2;
+ private ARBackgroundRenderer m_BackgroundRenderer;
+ private Texture2D _videoTextureY;
+ private Texture2D _videoTextureCbCr;
private GCHandle m_PinnedYArray;
private GCHandle m_PinnedUVArray;
private Vector3[] m_PointCloudData;
private LightEstimate m_LightEstimate;
- private Matrix4x4 m_DisplayTransform;
+ private Matrix4x4 m_DisplayTransform;
private ARKitWorldTrackingSessionConfiguration m_SessionConfig;
+ private Dictionary m_Anchors = new Dictionary();
+ private bool m_BackgroundRendering;
+ private bool m_CanRenderBackground;
+ private Camera m_Camera;
+ private float m_CurrentNearZ;
+ private float m_CurrentFarZ;
public override bool IsSupported
{
@@ -36,6 +47,26 @@ public override bool IsSupported
}
}
+ public override bool BackgroundRendering
+ {
+ get
+ {
+ return m_BackgroundRendering && m_CanRenderBackground;
+ }
+ set
+ {
+ if (m_BackgroundRenderer == null)
+ return;
+
+ m_BackgroundRendering = value;
+ m_BackgroundRenderer.mode = m_BackgroundRendering && m_CanRenderBackground ?
+ ARRenderMode.MaterialAsBackground : ARRenderMode.StandardBackground;
+
+ m_Camera.clearFlags = CameraClearFlags.SolidColor;
+ m_Camera.backgroundColor = Color.black;
+ }
+ }
+
// Use this for initialization
public override IEnumerator StartService(Settings settings)
{
@@ -63,6 +94,7 @@ public override IEnumerator StartService(Settings settings)
UnityARSessionNativeInterface.ARAnchorUpdatedEvent += UpdateAnchor;
UnityARSessionNativeInterface.ARAnchorRemovedEvent += RemoveAnchor;
UnityARSessionNativeInterface.ARFrameUpdatedEvent += UpdateFrame;
+ UnityARSessionNativeInterface.ARUserAnchorUpdatedEvent += UpdateUserAnchor;
IsRunning = true;
@@ -107,18 +139,18 @@ void UpdateFrame(UnityARCamera camera)
m_PointCloudData = camera.pointCloudData;
m_LightEstimate.capabilities = LightEstimateCapabilities.AmbientColorTemperature | LightEstimateCapabilities.AmbientIntensity;
- m_LightEstimate.ambientColorTemperature = camera.lightData.arLightEstimate.ambientColorTemperature;
+ m_LightEstimate.ambientColorTemperature = camera.lightData.arLightEstimate.ambientColorTemperature;
// Convert ARKit intensity to Unity intensity
// ARKit ambient intensity ranges 0-2000
// Unity ambient intensity ranges 0-8 (for over-bright lights)
- m_LightEstimate.ambientIntensity = camera.lightData.arLightEstimate.ambientIntensity / 1000f;
+ m_LightEstimate.ambientIntensity = camera.lightData.arLightEstimate.ambientIntensity / 1000f;
- //get display transform matrix sent up from sdk
- m_DisplayTransform.SetColumn(0, camera.displayTransform.column0);
- m_DisplayTransform.SetColumn(1, camera.displayTransform.column1);
- m_DisplayTransform.SetColumn(2, camera.displayTransform.column2);
- m_DisplayTransform.SetColumn(3, camera.displayTransform.column3);
+ //get display transform matrix sent up from sdk
+ m_DisplayTransform.SetColumn(0, camera.displayTransform.column0);
+ m_DisplayTransform.SetColumn(1, camera.displayTransform.column1);
+ m_DisplayTransform.SetColumn(2, camera.displayTransform.column2);
+ m_DisplayTransform.SetColumn(3, camera.displayTransform.column3);
}
IntPtr PinByteArray(ref GCHandle handle, byte[] array)
@@ -158,8 +190,30 @@ private void UpdateAnchor(ARPlaneAnchor arPlaneAnchor)
OnPlaneUpdated(GetBoundedPlane(arPlaneAnchor));
}
+ private void UpdateUserAnchor(ARUserAnchor anchorData)
+ {
+ ARAnchor anchor;
+ if (m_Anchors.TryGetValue(anchorData.identifier, out anchor))
+ {
+ anchor.transform.position = anchorData.transform.GetColumn(3);
+ anchor.transform.rotation = anchorData.transform.rotation;
+ }
+ }
+
+
public override void StopService()
{
+ var anchors = m_Anchors.Values;
+ foreach (var anchor in anchors)
+ {
+ DestroyAnchor(anchor);
+ }
+
+ UnityARSessionNativeInterface.ARAnchorAddedEvent -= AddAnchor;
+ UnityARSessionNativeInterface.ARAnchorUpdatedEvent -= UpdateAnchor;
+ UnityARSessionNativeInterface.ARAnchorRemovedEvent -= RemoveAnchor;
+ UnityARSessionNativeInterface.ARFrameUpdatedEvent -= UpdateFrame;
+ UnityARSessionNativeInterface.ARUserAnchorUpdatedEvent -= UpdateUserAnchor;
UnityARSessionNativeInterface.GetARSessionNativeInterface().Pause();
nativeInterface.SetCapturePixelData(false, IntPtr.Zero, IntPtr.Zero);
@@ -167,6 +221,11 @@ public override void StopService()
m_PinnedUVArray.Free();
m_TexturesInitialized = false;
+ BackgroundRendering = false;
+ m_CanRenderBackground = false;
+ m_BackgroundRenderer.backgroundMaterial = null;
+ m_BackgroundRenderer.camera = null;
+ m_BackgroundRenderer = null;
IsRunning = false;
}
@@ -218,41 +277,104 @@ public override LightEstimate GetLightEstimate()
return m_LightEstimate;
}
- public override Matrix4x4 GetDisplayTransform()
- {
- return m_DisplayTransform;
- }
+ public override Matrix4x4 GetDisplayTransform()
+ {
+ return m_DisplayTransform;
+ }
public override void SetupCamera(Camera camera)
{
- UnityARVideo unityARVideo = camera.GetComponent();
- if (unityARVideo == null)
+ m_Camera = camera;
+ m_ClearMaterial = Resources.Load("YUVMaterial", typeof(Material)) as Material;
+
+ m_BackgroundRenderer = new ARBackgroundRenderer();
+ m_BackgroundRenderer.backgroundMaterial = m_ClearMaterial;
+ m_BackgroundRenderer.camera = camera;
+ }
+
+ public override void UpdateCamera(Camera camera)
+ {
+ camera.projectionMatrix = nativeInterface.GetCameraProjection();
+
+ if (!m_BackgroundRendering)
+ return;
+
+ ARTextureHandles handles = UnityARSessionNativeInterface.GetARSessionNativeInterface().GetARVideoTextureHandles();
+ if (handles.textureY == System.IntPtr.Zero || handles.textureCbCr == System.IntPtr.Zero)
{
- m_CachedClearMaterial = Resources.Load("YUVMaterial", typeof(Material)) as Material;
+ m_CanRenderBackground = false;
+ return;
}
- else
+
+ m_CanRenderBackground = true;
+ BackgroundRendering = m_BackgroundRendering;
+
+ Resolution currentResolution = Screen.currentResolution;
+
+ // Texture Y
+ if (_videoTextureY == null)
{
- m_CachedClearMaterial = unityARVideo.m_ClearMaterial;
- GameObject.Destroy(unityARVideo);
+ _videoTextureY = Texture2D.CreateExternalTexture(currentResolution.width, currentResolution.height,
+ TextureFormat.R8, false, false, (System.IntPtr)handles.textureY);
+ _videoTextureY.filterMode = FilterMode.Bilinear;
+ _videoTextureY.wrapMode = TextureWrapMode.Repeat;
+ m_ClearMaterial.SetTexture("_textureY", _videoTextureY);
}
- unityARVideo = camera.gameObject.AddComponent();
- unityARVideo.m_ClearMaterial = m_CachedClearMaterial;
+ // Texture CbCr
+ if (_videoTextureCbCr == null)
+ {
+ _videoTextureCbCr = Texture2D.CreateExternalTexture(currentResolution.width, currentResolution.height,
+ TextureFormat.RG16, false, false, (System.IntPtr)handles.textureCbCr);
+ _videoTextureCbCr.filterMode = FilterMode.Bilinear;
+ _videoTextureCbCr.wrapMode = TextureWrapMode.Repeat;
+ m_ClearMaterial.SetTexture("_textureCbCr", _videoTextureCbCr);
+ }
- if (camera.GetComponent() == null)
- camera.gameObject.AddComponent();
+ _videoTextureY.UpdateExternalTexture(handles.textureY);
+ _videoTextureCbCr.UpdateExternalTexture(handles.textureCbCr);
- camera.clearFlags = CameraClearFlags.Depth;
+ m_ClearMaterial.SetMatrix("_DisplayTransform", m_DisplayTransform);
}
- public override void UpdateCamera(Camera camera)
+ public override void Update()
{
- camera.projectionMatrix = nativeInterface.GetCameraProjection();
+ if (m_CurrentNearZ != m_Camera.nearClipPlane || m_CurrentFarZ != m_Camera.farClipPlane)
+ {
+ m_CurrentNearZ = m_Camera.nearClipPlane;
+ m_CurrentFarZ = m_Camera.farClipPlane;
+ UnityARSessionNativeInterface.GetARSessionNativeInterface().SetCameraClipPlanes(m_CurrentNearZ, m_CurrentFarZ);
+ }
}
- public override void Update()
+ public override void ApplyAnchor(ARAnchor arAnchor)
{
+ if (!IsRunning)
+ return;
+
+ Matrix4x4 matrix = Matrix4x4.TRS(arAnchor.transform.position, arAnchor.transform.rotation, arAnchor.transform.localScale);
+ UnityARUserAnchorData anchorData = new UnityARUserAnchorData();
+ anchorData.transform.column0 = matrix.GetColumn(0);
+ anchorData.transform.column1 = matrix.GetColumn(1);
+ anchorData.transform.column2 = matrix.GetColumn(2);
+ anchorData.transform.column3 = matrix.GetColumn(3);
+
+ anchorData = UnityARSessionNativeInterface.GetARSessionNativeInterface().AddUserAnchor(anchorData);
+ arAnchor.anchorID = anchorData.identifierStr;
+ m_Anchors[arAnchor.anchorID] = arAnchor;
+ }
+ public override void DestroyAnchor(ARAnchor arAnchor)
+ {
+ if (!string.IsNullOrEmpty(arAnchor.anchorID))
+ {
+ UnityARSessionNativeInterface.GetARSessionNativeInterface().RemoveUserAnchor(arAnchor.anchorID);
+ if (m_Anchors.ContainsKey(arAnchor.anchorID))
+ {
+ m_Anchors.Remove(arAnchor.anchorID);
+ }
+ arAnchor.anchorID = null;
+ }
}
}
-}
+}
\ No newline at end of file
diff --git a/sdkproject/Assets/UnityARInterface/Scripts/ARMessageIds.cs b/sdkproject/Assets/UnityARInterface/Scripts/ARMessageIds.cs
index b0d4a71ca..f735d3c3e 100644
--- a/sdkproject/Assets/UnityARInterface/Scripts/ARMessageIds.cs
+++ b/sdkproject/Assets/UnityARInterface/Scripts/ARMessageIds.cs
@@ -20,6 +20,7 @@ public static class SubMessageIds
public static Guid startService { get { return new Guid("0b3e1cb1-d233-43ba-afd0-6c2890159b4b"); } }
public static Guid stopService { get { return new Guid("8b8504e1-d673-4fb6-95b7-88a3a23d2ebc"); } }
public static Guid enableVideo { get { return new Guid("f2d57d81-1b8e-4d54-8ce8-8bc42b97b5d2"); } }
+ public static Guid backgroundRendering { get { return new Guid("b95af19e-39db-4bd2-acca-e353fd822689"); } }
}
}
}
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models.meta b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models.meta
new file mode 100644
index 000000000..51fa2ac59
--- /dev/null
+++ b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: a7bb5a53dd8ac49759db6bf17162dd20
+folderAsset: yes
+timeCreated: 1503626045
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters.meta b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters.meta
new file mode 100644
index 000000000..e4c0349b3
--- /dev/null
+++ b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters.meta
@@ -0,0 +1,5 @@
+fileFormatVersion: 2
+guid: a2db6ed60f35771478d3b31828b24fe8
+folderAsset: yes
+DefaultImporter:
+ userData:
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Materials.meta b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Materials.meta
new file mode 100644
index 000000000..5c854227f
--- /dev/null
+++ b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Materials.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 9e9efecd428e54b9aabf3e5fc4fbc526
+folderAsset: yes
+timeCreated: 1501101803
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Materials/GunMaterial.mat b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Materials/GunMaterial.mat
new file mode 100644
index 000000000..5e01d4e5d
--- /dev/null
+++ b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Materials/GunMaterial.mat
@@ -0,0 +1,76 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: GunMaterial
+ m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
+ m_ShaderKeywords:
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 0
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: -1
+ stringTagMap: {}
+ disabledShaderPasses: []
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - _BumpMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailAlbedoMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicGlossMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _OcclusionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - _BumpScale: 1
+ - _Cutoff: 0.5
+ - _DetailNormalMapScale: 1
+ - _DstBlend: 0
+ - _GlossMapScale: 1
+ - _Glossiness: 0.5
+ - _GlossyReflections: 1
+ - _Metallic: 0
+ - _Mode: 0
+ - _OcclusionStrength: 1
+ - _Parallax: 0.02
+ - _SmoothnessTextureChannel: 0
+ - _SpecularHighlights: 1
+ - _SrcBlend: 1
+ - _UVSec: 0
+ - _ZWrite: 1
+ m_Colors:
+ - _Color: {r: 1, g: 1, b: 1, a: 1}
+ - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Materials/GunMaterial.mat.meta b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Materials/GunMaterial.mat.meta
new file mode 100644
index 000000000..48243ac4e
--- /dev/null
+++ b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Materials/GunMaterial.mat.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: fb5e14eb1d53543c2a0f0fb4f0bedcd8
+timeCreated: 1501101803
+licenseType: Pro
+NativeFormatImporter:
+ mainObjectFileID: 2100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Player.fbx b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Player.fbx
new file mode 100644
index 000000000..e1947f28d
Binary files /dev/null and b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Player.fbx differ
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Player.fbx.meta b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Player.fbx.meta
new file mode 100644
index 000000000..a2af3d547
--- /dev/null
+++ b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Models/Characters/Player.fbx.meta
@@ -0,0 +1,729 @@
+fileFormatVersion: 2
+guid: f1d84cc28597f5641a3d9cbc4df7e306
+ModelImporter:
+ serializedVersion: 16
+ fileIDToRecycleName:
+ 100000: Ctrl_Grp
+ 100002: Gun
+ 100004: Gun 1
+ 100006: GunBarrelEnd
+ 100008: GunBarrelStretch
+ 100010: Hat1
+ 100012: Hat2
+ 100014: Hat3
+ 100016: Hat4
+ 100018: Hat5
+ 100020: HatEnd
+ 100022: Head
+ 100024: Hips
+ 100026: HipSway
+ 100028: LeftBrow1
+ 100030: LeftBrow1End
+ 100032: LeftBrow2
+ 100034: LeftBrow2End
+ 100036: LeftBrow3
+ 100038: LeftBrow3End
+ 100040: LeftHand1
+ 100042: LeftHand2
+ 100044: LeftLeg
+ 100046: LeftLowerArm
+ 100048: LeftLowerArm2
+ 100050: LeftLowerArm2_IK
+ 100052: LeftLowerArm_2_FK
+ 100054: LeftLowerArm_FK
+ 100056: LeftLowerArm_IK
+ 100058: LeftShoulder
+ 100060: LeftThumb1
+ 100062: LeftThumb2
+ 100064: LeftToe
+ 100066: LeftUpperArm
+ 100068: LeftUpperArm_FK
+ 100070: LeftUpperArm_IK
+ 100072: LeftWrist
+ 100074: LeftWrist_FK
+ 100076: LeftWrist_IK
+ 100078: //RootNode
+ 100080: Player
+ 100082: PlayerCtrl
+ 100084: RightBrow1
+ 100086: RightBrow1End
+ 100088: RightBrow2
+ 100090: RightBrow2End
+ 100092: RightBrow3
+ 100094: RightBrow3End
+ 100096: RightHand1
+ 100098: RightHand2
+ 100100: RightLeg
+ 100102: RightLowerArm
+ 100104: RightLowerArm2
+ 100106: RightLowerArm2_FK
+ 100108: RightLowerArm2_IK
+ 100110: RightLowerArm_FK
+ 100112: RightLowerArm_IK
+ 100114: RightShoulder
+ 100116: RightThumb1
+ 100118: RightThumb2
+ 100120: RightToe
+ 100122: RightUpperArm
+ 100124: RightUpperArm_FK
+ 100126: RightUpperArm_IK
+ 100128: RightWrist
+ 100130: RightWrist_FK
+ 100132: RightWrist_IK
+ 100134: Root
+ 100136: Spine
+ 100138: Tail1
+ 100140: Tail2
+ 100142: Tail3
+ 400000: Ctrl_Grp
+ 400002: Gun
+ 400004: Gun 1
+ 400006: GunBarrelEnd
+ 400008: GunBarrelStretch
+ 400010: Hat1
+ 400012: Hat2
+ 400014: Hat3
+ 400016: Hat4
+ 400018: Hat5
+ 400020: HatEnd
+ 400022: Head
+ 400024: Hips
+ 400026: HipSway
+ 400028: LeftBrow1
+ 400030: LeftBrow1End
+ 400032: LeftBrow2
+ 400034: LeftBrow2End
+ 400036: LeftBrow3
+ 400038: LeftBrow3End
+ 400040: LeftHand1
+ 400042: LeftHand2
+ 400044: LeftLeg
+ 400046: LeftLowerArm
+ 400048: LeftLowerArm2
+ 400050: LeftLowerArm2_IK
+ 400052: LeftLowerArm_2_FK
+ 400054: LeftLowerArm_FK
+ 400056: LeftLowerArm_IK
+ 400058: LeftShoulder
+ 400060: LeftThumb1
+ 400062: LeftThumb2
+ 400064: LeftToe
+ 400066: LeftUpperArm
+ 400068: LeftUpperArm_FK
+ 400070: LeftUpperArm_IK
+ 400072: LeftWrist
+ 400074: LeftWrist_FK
+ 400076: LeftWrist_IK
+ 400078: Player
+ 400080: //RootNode
+ 400082: PlayerCtrl
+ 400084: RightBrow1
+ 400086: RightBrow1End
+ 400088: RightBrow2
+ 400090: RightBrow2End
+ 400092: RightBrow3
+ 400094: RightBrow3End
+ 400096: RightHand1
+ 400098: RightHand2
+ 400100: RightLeg
+ 400102: RightLowerArm
+ 400104: RightLowerArm2
+ 400106: RightLowerArm2_FK
+ 400108: RightLowerArm2_IK
+ 400110: RightLowerArm_FK
+ 400112: RightLowerArm_IK
+ 400114: RightShoulder
+ 400116: RightThumb1
+ 400118: RightThumb2
+ 400120: RightToe
+ 400122: RightUpperArm
+ 400124: RightUpperArm_FK
+ 400126: RightUpperArm_IK
+ 400128: RightWrist
+ 400130: RightWrist_FK
+ 400132: RightWrist_IK
+ 400134: Root
+ 400136: Spine
+ 400138: Tail1
+ 400140: Tail2
+ 400142: Tail3
+ 4300000: Gun
+ 4300002: Player
+ 7400000: Move
+ 7400002: Idle
+ 7400004: Death
+ 9500000: //RootNode
+ 13700000: Gun
+ 13700002: Player
+ materials:
+ importMaterials: 1
+ materialName: 1
+ materialSearch: 1
+ animations:
+ legacyGenerateAnimations: 4
+ bakeSimulation: 0
+ optimizeGameObjects: 1
+ motionNodeName:
+ animationCompression: 1
+ animationRotationError: .5
+ animationPositionError: .5
+ animationScaleError: .5
+ animationWrapMode: 0
+ extraExposedTransformPaths:
+ - PlayerCtrl/Ctrl_Grp/Gun 1/GunBarrelStretch/GunBarrelEnd
+ clipAnimations:
+ - serializedVersion: 16
+ name: Move
+ takeName: Take 001
+ firstFrame: 1
+ lastFrame: 25
+ wrapMode: 0
+ orientationOffsetY: 0
+ level: 0
+ cycleOffset: 0
+ loop: 0
+ loopTime: 1
+ loopBlend: 1
+ loopBlendOrientation: 0
+ loopBlendPositionY: 0
+ loopBlendPositionXZ: 0
+ keepOriginalOrientation: 0
+ keepOriginalPositionY: 1
+ keepOriginalPositionXZ: 0
+ heightFromFeet: 0
+ mirror: 0
+ bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
+ curves: []
+ events: []
+ transformMask:
+ - path:
+ weight: 1
+ - path: Gun
+ weight: 1
+ - path: Player
+ weight: 1
+ - path: PlayerCtrl
+ weight: 1
+ - path: PlayerCtrl/Ctrl_Grp
+ weight: 1
+ - path: PlayerCtrl/Ctrl_Grp/Gun 1
+ weight: 1
+ - path: PlayerCtrl/Ctrl_Grp/Gun 1/GunBarrelStretch
+ weight: 1
+ - path: PlayerCtrl/Ctrl_Grp/Gun 1/GunBarrelStretch/GunBarrelEnd
+ weight: 1
+ - path: PlayerCtrl/Root
+ weight: 1
+ - path: PlayerCtrl/Root/Hips
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway/LeftLeg
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway/LeftLeg/LeftToe
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway/RightLeg
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway/RightLeg/RightToe
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2/Hat3
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2/Hat3/Hat4
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2/Hat3/Hat4/Hat5
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2/Hat3/Hat4/Hat5/HatEnd
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow1/LeftBrow1End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow2/LeftBrow2End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow3
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow3/LeftBrow3End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow1/RightBrow1End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow2/RightBrow2End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow3
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow3/RightBrow3End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist/LeftHand1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist/LeftHand1/LeftHand2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist/LeftThumb1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist/LeftThumb1/LeftThumb2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_FK/LeftLowerArm_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_FK/LeftLowerArm_FK/LeftLowerArm_2_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_FK/LeftLowerArm_FK/LeftLowerArm_2_FK/LeftWrist_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_IK/LeftLowerArm_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_IK/LeftLowerArm_IK/LeftLowerArm2_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_IK/LeftLowerArm_IK/LeftLowerArm2_IK/LeftWrist_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist/RightHand1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist/RightHand1/RightHand2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist/RightThumb1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist/RightThumb1/RightThumb2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_FK/RightLowerArm_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_FK/RightLowerArm_FK/RightLowerArm2_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_FK/RightLowerArm_FK/RightLowerArm2_FK/RightWrist_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_IK/RightLowerArm_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_IK/RightLowerArm_IK/RightLowerArm2_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_IK/RightLowerArm_IK/RightLowerArm2_IK/RightWrist_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Tail1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Tail1/Tail2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Tail1/Tail2/Tail3
+ weight: 1
+ maskType: 0
+ maskSource: {instanceID: 0}
+ - serializedVersion: 16
+ name: Idle
+ takeName: Take 001
+ firstFrame: 137
+ lastFrame: 512
+ wrapMode: 0
+ orientationOffsetY: 0
+ level: 0
+ cycleOffset: 0
+ loop: 0
+ loopTime: 0
+ loopBlend: 0
+ loopBlendOrientation: 0
+ loopBlendPositionY: 0
+ loopBlendPositionXZ: 0
+ keepOriginalOrientation: 0
+ keepOriginalPositionY: 1
+ keepOriginalPositionXZ: 0
+ heightFromFeet: 0
+ mirror: 0
+ bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
+ curves: []
+ events: []
+ transformMask:
+ - path:
+ weight: 1
+ - path: Gun
+ weight: 1
+ - path: Player
+ weight: 1
+ - path: PlayerCtrl
+ weight: 1
+ - path: PlayerCtrl/Ctrl_Grp
+ weight: 1
+ - path: PlayerCtrl/Ctrl_Grp/Gun 1
+ weight: 1
+ - path: PlayerCtrl/Ctrl_Grp/Gun 1/GunBarrelStretch
+ weight: 1
+ - path: PlayerCtrl/Ctrl_Grp/Gun 1/GunBarrelStretch/GunBarrelEnd
+ weight: 1
+ - path: PlayerCtrl/Root
+ weight: 1
+ - path: PlayerCtrl/Root/Hips
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway/LeftLeg
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway/LeftLeg/LeftToe
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway/RightLeg
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway/RightLeg/RightToe
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2/Hat3
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2/Hat3/Hat4
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2/Hat3/Hat4/Hat5
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2/Hat3/Hat4/Hat5/HatEnd
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow1/LeftBrow1End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow2/LeftBrow2End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow3
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow3/LeftBrow3End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow1/RightBrow1End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow2/RightBrow2End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow3
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow3/RightBrow3End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist/LeftHand1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist/LeftHand1/LeftHand2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist/LeftThumb1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist/LeftThumb1/LeftThumb2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_FK/LeftLowerArm_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_FK/LeftLowerArm_FK/LeftLowerArm_2_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_FK/LeftLowerArm_FK/LeftLowerArm_2_FK/LeftWrist_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_IK/LeftLowerArm_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_IK/LeftLowerArm_IK/LeftLowerArm2_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_IK/LeftLowerArm_IK/LeftLowerArm2_IK/LeftWrist_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist/RightHand1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist/RightHand1/RightHand2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist/RightThumb1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist/RightThumb1/RightThumb2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_FK/RightLowerArm_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_FK/RightLowerArm_FK/RightLowerArm2_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_FK/RightLowerArm_FK/RightLowerArm2_FK/RightWrist_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_IK/RightLowerArm_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_IK/RightLowerArm_IK/RightLowerArm2_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_IK/RightLowerArm_IK/RightLowerArm2_IK/RightWrist_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Tail1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Tail1/Tail2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Tail1/Tail2/Tail3
+ weight: 1
+ maskType: 0
+ maskSource: {instanceID: 0}
+ - serializedVersion: 16
+ name: Death
+ takeName: Take 001
+ firstFrame: 525
+ lastFrame: 650
+ wrapMode: 0
+ orientationOffsetY: 0
+ level: 0
+ cycleOffset: 0
+ loop: 0
+ loopTime: 0
+ loopBlend: 0
+ loopBlendOrientation: 0
+ loopBlendPositionY: 0
+ loopBlendPositionXZ: 0
+ keepOriginalOrientation: 0
+ keepOriginalPositionY: 1
+ keepOriginalPositionXZ: 0
+ heightFromFeet: 0
+ mirror: 0
+ bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
+ curves: []
+ events:
+ - time: .997762918
+ functionName: RestartLevel
+ data:
+ objectReferenceParameter: {instanceID: 0}
+ floatParameter: 0
+ intParameter: 0
+ messageOptions: 0
+ transformMask:
+ - path:
+ weight: 1
+ - path: Gun
+ weight: 1
+ - path: Player
+ weight: 1
+ - path: PlayerCtrl
+ weight: 1
+ - path: PlayerCtrl/Ctrl_Grp
+ weight: 1
+ - path: PlayerCtrl/Ctrl_Grp/Gun 1
+ weight: 1
+ - path: PlayerCtrl/Ctrl_Grp/Gun 1/GunBarrelStretch
+ weight: 1
+ - path: PlayerCtrl/Ctrl_Grp/Gun 1/GunBarrelStretch/GunBarrelEnd
+ weight: 1
+ - path: PlayerCtrl/Root
+ weight: 1
+ - path: PlayerCtrl/Root/Hips
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway/LeftLeg
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway/LeftLeg/LeftToe
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway/RightLeg
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/HipSway/RightLeg/RightToe
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2/Hat3
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2/Hat3/Hat4
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2/Hat3/Hat4/Hat5
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/Hat1/Hat2/Hat3/Hat4/Hat5/HatEnd
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow1/LeftBrow1End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow2/LeftBrow2End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow3
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/LeftBrow3/LeftBrow3End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow1/RightBrow1End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow2/RightBrow2End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow3
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/Head/RightBrow3/RightBrow3End
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist/LeftHand1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist/LeftHand1/LeftHand2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist/LeftThumb1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm/LeftLowerArm/LeftLowerArm2/LeftWrist/LeftThumb1/LeftThumb2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_FK/LeftLowerArm_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_FK/LeftLowerArm_FK/LeftLowerArm_2_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_FK/LeftLowerArm_FK/LeftLowerArm_2_FK/LeftWrist_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_IK/LeftLowerArm_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_IK/LeftLowerArm_IK/LeftLowerArm2_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/LeftShoulder/LeftUpperArm_IK/LeftLowerArm_IK/LeftLowerArm2_IK/LeftWrist_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist/RightHand1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist/RightHand1/RightHand2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist/RightThumb1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm/RightLowerArm/RightLowerArm2/RightWrist/RightThumb1/RightThumb2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_FK/RightLowerArm_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_FK/RightLowerArm_FK/RightLowerArm2_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_FK/RightLowerArm_FK/RightLowerArm2_FK/RightWrist_FK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_IK/RightLowerArm_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_IK/RightLowerArm_IK/RightLowerArm2_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Spine/RightShoulder/RightUpperArm_IK/RightLowerArm_IK/RightLowerArm2_IK/RightWrist_IK
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Tail1
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Tail1/Tail2
+ weight: 1
+ - path: PlayerCtrl/Root/Hips/Tail1/Tail2/Tail3
+ weight: 1
+ maskType: 0
+ maskSource: {instanceID: 0}
+ isReadable: 1
+ meshes:
+ lODScreenPercentages: []
+ globalScale: .00999999978
+ meshCompression: 0
+ addColliders: 0
+ importBlendShapes: 1
+ swapUVChannels: 0
+ generateSecondaryUV: 0
+ useFileUnits: 1
+ optimizeMeshForGPU: 1
+ weldVertices: 1
+ secondaryUVAngleDistortion: 8
+ secondaryUVAreaDistortion: 15.000001
+ secondaryUVHardAngle: 88
+ secondaryUVPackMargin: 4
+ tangentSpace:
+ normalSmoothAngle: 180
+ splitTangentsAcrossUV: 1
+ normalImportMode: 1
+ tangentImportMode: 1
+ importAnimation: 1
+ copyAvatar: 0
+ humanDescription:
+ human: []
+ skeleton: []
+ armTwist: .5
+ foreArmTwist: .5
+ upperLegTwist: .5
+ legTwist: .5
+ armStretch: .0500000007
+ legStretch: .0500000007
+ feetSpacing: 0
+ rootMotionBoneName:
+ lastHumanDescriptionAvatarSource: {instanceID: 0}
+ animationType: 2
+ additionalBone: 0
+ userData:
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Shaders/InstancedSurfaceShader.shader b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Shaders/InstancedSurfaceShader.shader
index bf079a651..f1c613b32 100644
--- a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Shaders/InstancedSurfaceShader.shader
+++ b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Shaders/InstancedSurfaceShader.shader
@@ -1,16 +1,13 @@
// Upgrade NOTE: upgraded instancing buffer 'Props' to new syntax.
-Shader "Custom/InstancedSurfaceShader"
-{
- Properties
- {
+Shader "Custom/InstancedSurfaceShader" {
+ Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
- SubShader
- {
+ SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
@@ -23,8 +20,7 @@ Shader "Custom/InstancedSurfaceShader"
sampler2D _MainTex;
- struct Input
- {
+ struct Input {
float2 uv_MainTex;
};
@@ -36,9 +32,9 @@ Shader "Custom/InstancedSurfaceShader"
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
- // put more per-instance properties here
- UNITY_DEFINE_INSTANCED_PROP (fixed4, _InstanceColor)
- #define _InstanceColor_arr Props
+ // put more per-instance properties here
+ UNITY_DEFINE_INSTANCED_PROP (fixed4, _InstanceColor)
+#define _InstanceColor_arr Props
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutputStandard o) {
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerDiffuse.png b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerDiffuse.png
new file mode 100644
index 000000000..711c6cf52
Binary files /dev/null and b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerDiffuse.png differ
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerDiffuse.png.meta b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerDiffuse.png.meta
new file mode 100644
index 000000000..926c7410b
--- /dev/null
+++ b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerDiffuse.png.meta
@@ -0,0 +1,52 @@
+fileFormatVersion: 2
+guid: a3cc890ba79fb47449fb51893aa9b363
+TextureImporter:
+ fileIDToRecycleName: {}
+ serializedVersion: 2
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ linearTexture: 0
+ correctGamma: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: .25
+ normalMapFilter: 0
+ isReadable: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 0
+ cubemapConvolution: 0
+ cubemapConvolutionSteps: 8
+ cubemapConvolutionExponent: 1.5
+ seamlessCubemap: 0
+ textureFormat: -1
+ maxTextureSize: 1024
+ textureSettings:
+ filterMode: -1
+ aniso: -1
+ mipBias: -1
+ wrapMode: -1
+ nPOTScale: 1
+ lightmap: 0
+ rGBM: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: .5, y: .5}
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spritePixelsToUnits: 100
+ alphaIsTransparency: 0
+ textureType: -1
+ buildTargetSettings: []
+ spriteSheet:
+ sprites: []
+ spritePackingTag:
+ userData:
+ assetBundleName:
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerNormals.png b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerNormals.png
new file mode 100644
index 000000000..06b143f48
Binary files /dev/null and b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerNormals.png differ
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerNormals.png.meta b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerNormals.png.meta
new file mode 100644
index 000000000..c71477bb3
--- /dev/null
+++ b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerNormals.png.meta
@@ -0,0 +1,52 @@
+fileFormatVersion: 2
+guid: d98be175031405b4fb3f6a5f459a22e4
+TextureImporter:
+ fileIDToRecycleName: {}
+ serializedVersion: 2
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ linearTexture: 1
+ correctGamma: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 1
+ heightScale: .25
+ normalMapFilter: 0
+ isReadable: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 0
+ cubemapConvolution: 0
+ cubemapConvolutionSteps: 8
+ cubemapConvolutionExponent: 1.5
+ seamlessCubemap: 0
+ textureFormat: -1
+ maxTextureSize: 1024
+ textureSettings:
+ filterMode: -1
+ aniso: -1
+ mipBias: -1
+ wrapMode: -1
+ nPOTScale: 1
+ lightmap: 0
+ rGBM: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: .5, y: .5}
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spritePixelsToUnits: 100
+ alphaIsTransparency: 0
+ textureType: 1
+ buildTargetSettings: []
+ spriteSheet:
+ sprites: []
+ spritePackingTag:
+ userData:
+ assetBundleName:
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerOcclusion.png b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerOcclusion.png
new file mode 100644
index 000000000..7d9147b10
Binary files /dev/null and b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerOcclusion.png differ
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerOcclusion.png.meta b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerOcclusion.png.meta
new file mode 100644
index 000000000..b34c1584e
--- /dev/null
+++ b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerOcclusion.png.meta
@@ -0,0 +1,52 @@
+fileFormatVersion: 2
+guid: 6ae2af98f5c9f0243806bfb6ccbbdd19
+TextureImporter:
+ fileIDToRecycleName: {}
+ serializedVersion: 2
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ linearTexture: 0
+ correctGamma: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: .25
+ normalMapFilter: 0
+ isReadable: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 0
+ cubemapConvolution: 0
+ cubemapConvolutionSteps: 8
+ cubemapConvolutionExponent: 1.5
+ seamlessCubemap: 0
+ textureFormat: -1
+ maxTextureSize: 1024
+ textureSettings:
+ filterMode: -1
+ aniso: -1
+ mipBias: -1
+ wrapMode: -1
+ nPOTScale: 1
+ lightmap: 0
+ rGBM: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: .5, y: .5}
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spritePixelsToUnits: 100
+ alphaIsTransparency: 0
+ textureType: -1
+ buildTargetSettings: []
+ spriteSheet:
+ sprites: []
+ spritePackingTag:
+ userData:
+ assetBundleName:
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerSpecular.tif b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerSpecular.tif
new file mode 100644
index 000000000..b79174c79
Binary files /dev/null and b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerSpecular.tif differ
diff --git a/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerSpecular.tif.meta b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerSpecular.tif.meta
new file mode 100644
index 000000000..3b5799ffd
--- /dev/null
+++ b/sdkproject/Assets/UnityARKitPlugin/Examples/Common/Textures/PlayerSpecular.tif.meta
@@ -0,0 +1,52 @@
+fileFormatVersion: 2
+guid: bc9b1c6383841ea4f9e532a49c651ff6
+TextureImporter:
+ fileIDToRecycleName: {}
+ serializedVersion: 2
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ linearTexture: 0
+ correctGamma: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: .25
+ normalMapFilter: 0
+ isReadable: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 0
+ cubemapConvolution: 0
+ cubemapConvolutionSteps: 8
+ cubemapConvolutionExponent: 1.5
+ seamlessCubemap: 0
+ textureFormat: -1
+ maxTextureSize: 2048
+ textureSettings:
+ filterMode: -1
+ aniso: -1
+ mipBias: -1
+ wrapMode: -1
+ nPOTScale: 1
+ lightmap: 0
+ rGBM: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: .5, y: .5}
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spritePixelsToUnits: 100
+ alphaIsTransparency: 0
+ textureType: -1
+ buildTargetSettings: []
+ spriteSheet:
+ sprites: []
+ spritePackingTag:
+ userData:
+ assetBundleName: