text:
Shader "Neuston/ARSurface"
{
	Properties
	{
		_Cutoff("Cutout", Range(0, 1)) = 0.5
	}

	SubShader
	{
		Pass
		{
			// Set up blending so that final fragment color = already rendered color (AR background) * shadow color at this fragment.
			// Shadow color is closer to black when in shadow, otherwise white.
			// Syntax: Blend SrcFactor DstFactor.
			Blend Zero SrcColor

			// If ZWrite is on objects below the surface will not render.
			// Turn off if you want to render a hole through the floor.
			ZWrite On

			CGPROGRAM

				#include "UnityCG.cginc"
				#include "AutoLight.cginc"

				#pragma vertex vert
				#pragma fragment frag
				#pragma multi_compile_fwdbase

				struct v2f
				{
					float4 pos : SV_POSITION;
					LIGHTING_COORDS(0, 1)
				};

				v2f vert(appdata_base v)
				{
					// Transfer information from vertex shader to fragment shader.
					v2f o;
					o.pos = UnityObjectToClipPos(v.vertex);
					TRANSFER_VERTEX_TO_FRAGMENT(o);
					return o;
				}

				fixed4 frag(v2f i) : COLOR
				{
					// This considers whether this fragment is lit or in shadow.
					float attenuation = LIGHT_ATTENUATION(i);
					return attenuation;
				}

			ENDCG
		}
	}
}


text:
fileFormatVersion: 2
guid: 678759046efc74b44ad1c8a727c1246a
timeCreated: 1504094883
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:

repo_name: jonas-johansson/ARCoreUtils

repo_language: C#

mime_type: text/plain


text:
fileFormatVersion: 2
guid: a00108229b1e04acd805e57abcdff773
folderAsset: yes
timeCreated: 1492558533
licenseType: Pro
DefaultImporter:
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: 84e45386d8da3497591c38deb2bccd02
folderAsset: yes
timeCreated: 1502400656
licenseType: Free
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: 165068a6255814b639ac5e322836d8bb
folderAsset: yes
timeCreated: 1512499966
licenseType: Pro
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: 6b1cded3497844b35a3bfac966b428f2
folderAsset: yes
timeCreated: 1496364746
licenseType: Pro
DefaultImporter:
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: 93be2b9777c348648a2d9151b7e233fc
folderAsset: yes
timeCreated: 1501825151
licenseType: Free
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: b2c4e904b5e6b425f8ab111db67d7908
folderAsset: yes
timeCreated: 1497981256
licenseType: Pro
DefaultImporter:
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: 8f3875959d8dd4bdeb9620e0eb96fb3b
folderAsset: yes
timeCreated: 1501446012
licenseType: Free
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: e1e9a08d000a446c9ad506ecb3a4d083
folderAsset: yes
timeCreated: 1513969093
licenseType: Pro
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
//-----------------------------------------------------------------------
// <copyright file="DisplayUvCoords.cs" company="Google">
//
// Copyright 2018 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using UnityEngine;

    /// <summary>
    /// Stores UV display coordinates for mapping the four corners of the display.
    /// </summary>
    public struct DisplayUvCoords
    {
        /// <summary>
        /// The top-left UV coordinates for the display.
        /// </summary>
        public Vector2 TopLeft;

        /// <summary>
        /// The top-right UV coordinates for the display.
        /// </summary>
        public Vector2 TopRight;

        /// <summary>
        /// The bottom-left UV coordinates for the display.
        /// </summary>
        public Vector2 BottomLeft;

        /// <summary>
        /// The bottom-right UV coordinates for the display.
        /// </summary>
        public Vector2 BottomRight;

        /// <summary>
        /// Initializes the DisplayUvCoords structure.
        /// </summary>
        /// <param name="topLeft">The top-left UV coordinates for the display.</param>
        /// <param name="topRight">The top-right UV coordinates for the display.</param>
        /// <param name="bottomLeft">The bottom-left UV coordinates for the display.</param>
        /// <param name="bottomRight">The bottom-right UV coordinates for the display.</param>
        public DisplayUvCoords(Vector2 topLeft, Vector2 topRight, Vector2 bottomLeft, Vector2 bottomRight)
        {
            TopLeft = topLeft;
            TopRight = topRight;
            BottomLeft = bottomLeft;
            BottomRight = bottomRight;
        }

        //// @cond EXCLUDE_FROM_DOXYGEN

        [System.Obsolete("The type ApiDisplayCoords is deprecated.  Please use GoogleARCore.DisplayUvCoords.")]
        [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules",
            "SA1600:ElementsMustBeDocumented", Justification = "Deprecated")]
        public static implicit operator GoogleARCoreInternal.ApiDisplayUvCoords(DisplayUvCoords coords)
        {
            return new GoogleARCoreInternal.ApiDisplayUvCoords(coords.TopLeft, coords.TopRight, coords.BottomLeft,
                coords.BottomRight);
        }

        //// @endcond
    }
}


text:
//-----------------------------------------------------------------------
// <copyright file="EnvironmentalLight.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using UnityEngine;
    using UnityEngine.Rendering;

    /// <summary>
    /// A component that automatically adjust lighting settings for the scene
    /// to be inline with those estimated by ARCore.
    /// </summary>
    [ExecuteInEditMode]
    public class EnvironmentalLight : MonoBehaviour
    {
        /// <summary>
        /// Unity update method that sets global light estimation shader constant to match
        /// ARCore's calculated values.
        /// </summary>
        public void Update()
        {
            if (Application.isEditor && !GoogleARCoreInternal.ARCoreProjectSettings.Instance.IsInstantPreviewEnabled)
            {
                // Set _GlobalColorCorrection to white in editor, if the value is not set, all materials
                // using light estimation shaders will be black.
                Shader.SetGlobalColor("_GlobalColorCorrection", Color.white);
                return;
            }

            if (Frame.LightEstimate.State != LightEstimateState.Valid)
            {
                return;
            }

            // Normalize pixel intensity by middle gray in gamma space.
            const float middleGray = 0.466f;
            float normalizedIntensity = Frame.LightEstimate.PixelIntensity / middleGray;

            // Apply color correction along with normalized pixel intensity in gamma space.
            Shader.SetGlobalColor("_GlobalColorCorrection", Frame.LightEstimate.ColorCorrection * normalizedIntensity);
        }
    }
}


text:
fileFormatVersion: 2
guid: 0e71c3224f80341e8bce7e10bfca6462
folderAsset: yes
timeCreated: 1510945633
licenseType: Free
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: 4f3ad9d6ff6f214438ef1a961ef9b921
timeCreated: 1510799673
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
//-----------------------------------------------------------------------
// <copyright file="Session.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using System;
    using System.Collections.Generic;
    using GoogleARCoreInternal;
    using UnityEngine;

    /// <summary>
    /// Represents an ARCore session, which is an attachment point from the app
    /// to the ARCore service. Holds information about the global state for
    /// ARCore, manages tracking of Anchors and Planes, and performs hit tests
    /// against objects ARCore is tracking in the world.
    /// </summary>
    public static class Session
    {
        /// <summary>
        /// Gets current session status.
        /// </summary>
        public static SessionStatus Status
        {
            get
            {
                return LifecycleManager.Instance.SessionStatus;
            }
        }

        /// <summary>
        /// Creates a new Anchor at the given <c>Pose</c> that is attached to the <c>Trackable</c>.
        /// 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.
        /// </summary>
        /// <param name="pose">The Unity world pose where the anchor is to be creates.</param>
        /// <param name="trackable">The Trackable to attach the Anchor to.</param>
        /// <returns>The newly created anchor or null.</returns>
        public static Anchor CreateAnchor(Pose pose, Trackable trackable = null)
        {
            var nativeSession = LifecycleManager.Instance.NativeSession;
            if (nativeSession == null)
            {
                return null;
            }

            if (trackable == null)
            {
                return nativeSession.SessionApi.CreateAnchor(pose);
            }
            else
            {
                return trackable.CreateAnchor(pose);
            }
        }

        /// <summary>
        /// Gets Trackables ARCore has tracked.
        /// </summary>
        /// <typeparam name="T">The Trackable type to get.</typeparam>
        /// <param name="trackables">A reference to a list of T that will be filled by the method call.</param>
        /// <param name="filter">A filter on the type of data to return.</param>
        public static void GetTrackables<T>(List<T> trackables, TrackableQueryFilter filter = TrackableQueryFilter.All) where T : Trackable
        {
            trackables.Clear();
            var nativeSession = LifecycleManager.Instance.NativeSession;
            if (nativeSession == null)
            {
                return;
            }

            nativeSession.GetTrackables<T>(trackables, filter);
        }

        /// <summary>
        /// Checks the availability of the ARCore APK on the device.
        /// </summary>
        /// <returns>An AsyncTask that completes with an ApkAvailabilityStatus when the availability is known.</returns>
        public static AsyncTask<ApkAvailabilityStatus> CheckApkAvailability()
        {
            return LifecycleManager.Instance.CheckApkAvailability();
        }

        /// <summary>
        /// Requests an installation of the ARCore APK on the device.
        /// </summary>
        /// <param name="userRequested">Whether the installation was requested explicity by a user action.</param>
        /// <returns>An AsyncTask that completes with an ApkInstallationStatus when the installation
        /// status is resolved.</returns>
        public static AsyncTask<ApkInstallationStatus> RequestApkInstallation(bool userRequested)
        {
            return LifecycleManager.Instance.RequestApkInstallation(userRequested);
        }
    }
}


text:
fileFormatVersion: 2
guid: c0726c8b601b041069fad86754497703
timeCreated: 1502330118
licenseType: Free
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
//-----------------------------------------------------------------------
// <copyright file="TrackedPlane.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics.CodeAnalysis;
    using GoogleARCoreInternal;
    using UnityEngine;

    /// <summary>
    /// A planar surface in the real world detected and tracked by ARCore.
    /// </summary>
    public class TrackedPlane : Trackable
    {
        //// @cond EXCLUDE_FROM_DOXYGEN

        /// <summary>
        /// Construct TrackedPlane from a native handle.
        /// </summary>
        /// <param name="nativeHandle">A handle to the native ARCore API Trackable.</param>
        /// <param name="nativeApi">The ARCore native api.</param>
        public TrackedPlane(IntPtr nativeHandle, NativeSession nativeApi)
            : base(nativeHandle, nativeApi)
        {
            m_TrackableNativeHandle = nativeHandle;
            m_NativeSession = nativeApi;
        }

        //// @endcond

        /// <summary>
        /// Gets a reference to the plane subsuming this plane, if any.  If not null, only the subsuming plane should be
        /// considered valid for rendering.
        /// </summary>
        public TrackedPlane SubsumedBy
        {
            get
            {
                if (_IsSessionDestroyed())
                {
                    Debug.LogError("SubsumedBy:: Trying to access a session that has already been destroyed.");
                    return null;
                }

                return m_NativeSession.PlaneApi.GetSubsumedBy(m_TrackableNativeHandle);
            }
        }

        /// <summary>
        /// Gets the position and orientation of the plane's center.
        /// </summary>
        public Pose CenterPose
        {
            get
            {
                if (_IsSessionDestroyed())
                {
                    Debug.LogError("CenterPose:: Trying to access a session that has already been destroyed.");
                    return new Pose();
                }

                return m_NativeSession.PlaneApi.GetCenterPose(m_TrackableNativeHandle);
            }
        }

        /// <summary>
        /// Gets the extent of the plane in the X dimension, centered on the plane position.
        /// </summary>
        public float ExtentX
        {
            get
            {
                if (_IsSessionDestroyed())
                {
                    Debug.LogError("ExtentX:: Trying to access a session that has already been destroyed.");
                    return 0f;
                }

                return m_NativeSession.PlaneApi.GetExtentX(m_TrackableNativeHandle);
            }
        }

        /// <summary>
        /// Gets the extent of the plane in the Z dimension, centered on the plane position.
        /// </summary>
        public float ExtentZ
        {
            get
            {
                if (_IsSessionDestroyed())
                {
                    Debug.LogError("ExtentZ:: Trying to access a session that has already been destroyed.");
                    return 0f;
                }

                return m_NativeSession.PlaneApi.GetExtentZ(m_TrackableNativeHandle);
            }
        }

        /// <summary>
        /// Gets a list of points (in clockwise order) in Unity world space representing a boundary polygon for
        /// the plane.
        /// </summary>
        /// <param name="boundaryPolygonPoints">A list of <b>Vector3</b> to be filled by the method call.</param>
        public void GetBoundaryPolygon(List<Vector3> boundaryPolygonPoints)
        {
            if (_IsSessionDestroyed())
            {
                Debug.LogError("GetBoundaryPolygon:: Trying to access a session that has already been destroyed.");
                return;
            }

            m_NativeSession.PlaneApi.GetPolygon(m_TrackableNativeHandle, boundaryPolygonPoints);
        }
    }
}


text:
fileFormatVersion: 2
guid: df74476279e4c4797bdcc1ff52177a3e
folderAsset: yes
timeCreated: 1502401080
licenseType: Free
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: d48675563f8a14e85bb73c0a6d45d9f0
timeCreated: 1503943281
licenseType: Free
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
//-----------------------------------------------------------------------
// <copyright file="AsyncTask.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using System;
    using System.Collections.Generic;
    using System.Threading;
    using GoogleARCoreInternal;
    using UnityEngine;

    /// <summary>
    /// A class used for monitoring the status of an asynchronous task.
    /// </summary>
    /// <typeparam name="T">The resultant type of the task.</typeparam>
    public class AsyncTask<T>
    {
        /// <summary>
        /// A collection of actons to perform on the main Unity thread after the task is complete.
        /// </summary>
        private List<Action<T>> m_ActionsUponTaskCompletion;

        /// @cond EXCLUDE_FROM_DOXYGEN
        /// <summary>
        /// Constructor for AsyncTask.
        /// </summary>
        /// <param name="asyncOperationComplete">A callback that, when invoked, changes the status of the task to
        /// complete and sets the result based on the argument supplied.</param>
        public AsyncTask(out Action<T> asyncOperationComplete)
        {
            IsComplete = false;
            asyncOperationComplete = delegate(T result)
            {
                this.Result = result;
                IsComplete = true;
                if (m_ActionsUponTaskCompletion != null)
                {
                    AsyncTask.PerformActionInUpdate(() =>
                    {
                        for (int i = 0; i < m_ActionsUponTaskCompletion.Count; i++)
                        {
                            m_ActionsUponTaskCompletion[i](result);
                        }
                    });
                }
            };
        }

        /// @endcond

        /// @cond EXCLUDE_FROM_DOXYGEN
        /// <summary>
        /// Constructor for AsyncTask that creates a completed task.
        /// </summary>
        /// <param name="result">The result of the completed task.</param>
        public AsyncTask(T result)
        {
            Result = result;
            IsComplete = true;
        }

        /// @endcond

        /// <summary>
        /// Gets a value indicating whether the task is complete.
        /// </summary>
        /// <value><c>true</c> if the task is complete, otherwise <c>false</c>.</value>
        public bool IsComplete { get; private set; }

        /// <summary>
        /// Gets the result of a completed task.
        /// </summary>
        /// <value>The result of the completed task.</value>
        public T Result { get; private set; }

        /// <summary>
        /// Returns a yield instruction that monitors this task for completion within a coroutine.
        /// </summary>
        /// <returns>A yield instruction that monitors this task for completion.</returns>
        public CustomYieldInstruction WaitForCompletion()
        {
            return new WaitForTaskCompletionYieldInstruction<T>(this);
        }

        /// <summary>
        /// Performs an action (callback) in the first Unity Update() call after task completion.
        /// </summary>
        /// <param name="doAfterTaskComplete">The action to invoke when task is complete.  The result of the task will
        /// be passed as an argument to the action.</param>
        /// <returns>The invoking asynchronous task.</returns>
        public AsyncTask<T> ThenAction(Action<T> doAfterTaskComplete)
        {
            // Perform action now if task is already complete.
            if (IsComplete)
            {
                doAfterTaskComplete(Result);
                return this;
            }

            // Allocate list if needed (avoids allocation if then is not used).
            if (m_ActionsUponTaskCompletion == null)
            {
                m_ActionsUponTaskCompletion = new List<Action<T>>();
            }

            m_ActionsUponTaskCompletion.Add(doAfterTaskComplete);
            return this;
        }
    }

    /// @cond EXCLUDE_FROM_DOXYGEN
    /// <summary>
    /// Helper methods for dealing with asynchronous tasks.
    /// </summary>
    public class AsyncTask
    {
        private static Queue<Action> s_UpdateActionQueue = new Queue<Action>();
        private static object s_LockObject = new object();

        /// <summary>
        /// Queues an action to be performed on Unity thread in Update().  This method can be called by any thread.
        /// </summary>
        /// <param name="action">The action to perform.</param>
        public static void PerformActionInUpdate(Action action)
        {
            lock (s_LockObject)
            {
                s_UpdateActionQueue.Enqueue(action);
            }
        }

        /// <summary>
        /// An Update handler called each frame.
        /// </summary>
        public static void OnUpdate()
        {
            lock (s_LockObject)
            {
                while (s_UpdateActionQueue.Count > 0)
                {
                    Action action = s_UpdateActionQueue.Dequeue();
                    action();
                }
            }
        }
    }

    /// @endcond
}


text:
fileFormatVersion: 2
guid: 190efca65a78647b7a60e0e4b2288b27
timeCreated: 1510509514
licenseType: Free
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: eb172c260d42e4f62945afda50892c0c
timeCreated: 1510461368
licenseType: Free
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
//-----------------------------------------------------------------------
// <copyright file="ApkInstallationStatus.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    /// <summary>
    /// Possible statuses for an ARCore APK installation request on a device.
    /// </summary>
    public enum ApkInstallationStatus
    {
        Uninitialized = 0,
        Requested = 1,
        Success = 100,
        Error = 200,
        ErrorDeviceNotCompatible = 201,

        [System.Obsolete("Merged with ErrorDeviceNotCompatible. Use that instead.")]
        ErrorAndroidVersionNotSupported = 202,

        ErrorUserDeclined = 203,
    }
}


text:
//-----------------------------------------------------------------------
// <copyright file="TrackableHit.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using UnityEngine;

    /// <summary>
    /// Contains information about a raycast hit against a physical object tracked by ARCore.
    /// </summary>
    public struct TrackableHit
    {
        //// @cond EXCLUDE_FROM_DOXYGEN

        /// <summary>
        /// Constructs a TrackableHit.
        /// </summary>
        /// <param name="pose">Hit's pose.</param>
        /// <param name="distance">Hit's distance from the origin of the ray to the hit.</param>
        /// <param name="flags">Type of the hit.</param>
        /// <param name="trackable">Trackable object of the hit.</param>
        public TrackableHit(Pose pose, float distance, TrackableHitFlags flags, Trackable trackable)
        {
            Pose = pose;
            Distance = distance;
            Flags = flags;
            Trackable = trackable;
        }

        //// @endcond

        /// <summary>
        /// Gets the pose where the raycast hit the object in Unity world coordinates.
        /// </summary>
        public Pose Pose { get; private set; }

        /// <summary>
        /// Gets the distance from the origin of the ray to the hit.
        /// </summary>
        public float Distance { get; private set; }

        /// <summary>
        /// Gets a bitmask where set TrackableHitFlag flags correspond to categories of objects
        /// the hit belongs to.
        /// </summary>
        public TrackableHitFlags Flags { get; private set; }

        /// <summary>
        /// Gets the hit's trackable object.
        /// </summary>
        public Trackable Trackable { get; private set; }
    }
}


text:
fileFormatVersion: 2
guid: 37d4175d892ef4e6190e38f26d22434c
timeCreated: 1502156672
licenseType: Free
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: bd5c45a099b834b8d847a3ba64b2c8ec
timeCreated: 1502157890
licenseType: Free
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: -16000
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
//-----------------------------------------------------------------------
// <copyright file="Anchor.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics.CodeAnalysis;
    using GoogleARCoreInternal;
    using UnityEngine;

    /// <summary>
    /// Attaches a GameObject to an ARCore {@link Trackable}.  The transform of the GameObject will be updated to
    /// maintain the semantics of the attachment relationship, which varies between sub-types of Trackable.
    /// </summary>
    public class Anchor : MonoBehaviour
    {
        private static Dictionary<IntPtr, Anchor> s_AnchorDict = new Dictionary<IntPtr, Anchor>(new IntPtrEqualityComparer());

        private IntPtr m_AnchorNativeHandle = IntPtr.Zero;

        private NativeSession m_NativeSession;

        private TrackingState m_LastFrameTrackingState = TrackingState.Stopped;

        private bool m_IsSessionDestroyed = false;

        /// <summary>
        /// Gets the tracking state of the anchor.
        /// </summary>
        public TrackingState TrackingState
        {
            get
            {
                // TODO (b/73256094): Remove isTracking when fixed.
                var isTracking = LifecycleManager.Instance.SessionStatus == SessionStatus.Tracking;
                if (_IsSessionDestroyed())
                {
                    // 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);
            }
        }

        //// @cond EXCLUDE_FROM_DOXYGEN

        [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
        Justification = "Internal")]
        public static Anchor AnchorFactory(IntPtr anchorNativeHandle, NativeSession nativeApi, bool isCreate = true)
        {
            if (anchorNativeHandle == IntPtr.Zero)
            {
                return null;
            }

            Anchor result;
            if (s_AnchorDict.TryGetValue(anchorNativeHandle, out result))
            {
                // Release acquired handle and return cached result
                result.m_NativeSession.AnchorApi.Release(anchorNativeHandle);
                return result;
            }

            if (isCreate)
            {
               Anchor anchor = (new GameObject()).AddComponent<Anchor>();
               anchor.gameObject.name = "Anchor";
               anchor.m_AnchorNativeHandle = anchorNativeHandle;
               anchor.m_NativeSession = nativeApi;
               anchor.Update();

               s_AnchorDict.Add(anchorNativeHandle, anchor);
               return anchor;
            }

            return null;
        }

        //// @endcond

        private void Update()
        {
            if (m_AnchorNativeHandle == IntPtr.Zero)
            {
                Debug.LogError("Anchor components instantiated outside of ARCore are not supported. " +
                    "Please use a 'Create' method within ARCore to instantiate anchors.");
                return;
            }

            if (_IsSessionDestroyed())
            {
                return;
            }

            var pose = m_NativeSession.AnchorApi.GetPose(m_AnchorNativeHandle);
            transform.position = pose.position;
            transform.rotation = pose.rotation;

            TrackingState currentFrameTrackingState = TrackingState;
            if (m_LastFrameTrackingState != currentFrameTrackingState)
            {
                bool isAnchorTracking = currentFrameTrackingState == TrackingState.Tracking;
                foreach (Transform child in transform)
                {
                    child.gameObject.SetActive(isAnchorTracking);
                }

                m_LastFrameTrackingState = currentFrameTrackingState;
            }
        }

        private void OnDestroy()
        {
            if (m_AnchorNativeHandle == IntPtr.Zero)
            {
                return;
            }

            s_AnchorDict.Remove(m_AnchorNativeHandle);
            if (!_IsSessionDestroyed())
            {
                m_NativeSession.AnchorApi.Detach(m_AnchorNativeHandle);
            }

            m_NativeSession.AnchorApi.Release(m_AnchorNativeHandle);
        }

        private bool _IsSessionDestroyed()
        {
            if (!m_IsSessionDestroyed)
            {
                var nativeSession = LifecycleManager.Instance.NativeSession;
                if (nativeSession != m_NativeSession)
                {
                    Debug.LogErrorFormat("The session which created this anchor has been destroyed. " +
                    "The anchor on GameObject {0} can no longer update.",
                        this.gameObject != null ? this.gameObject.name : "Unknown");
                    m_IsSessionDestroyed = true;
                }
            }

            return m_IsSessionDestroyed;
        }
    }
}


text:
//-----------------------------------------------------------------------
// <copyright file="LightEstimate.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using UnityEngine;

    /// <summary>
    /// An estimate of lighting conditions in the environment corresponding to
    /// an AR frame.
    /// </summary>
    public struct LightEstimate
    {
        /// <summary>
        /// Constructor for a LightEstimate.
        /// </summary>
        /// <param name="state">State of the estimate.</param>
        /// <param name="pixelIntensity">Average pixel intensity. Values range from 0.0
        /// to 1.0, where 0.0 represents black and 1.0 represents white.</param>
        /// <param name="colorCorrection">Color correction RGB scaling factors to be
        /// applied to the final color computed by the fragment shader to match the
        /// ambient color.</param>
        public LightEstimate(LightEstimateState state, float pixelIntensity, Color colorCorrection)
        {
            State = state;
            PixelIntensity = pixelIntensity;
            ColorCorrection = colorCorrection;
        }

        /// <summary>
        /// Gets the state of the current estimate.
        /// </summary>
        public LightEstimateState State { get; private set; }

        /// <summary>
        /// Gets an average pixel intensity. Values range from 0.0 to 1.0, where 0.0
        /// represents black and 1.0 represents white.
        /// </summary>
        public float PixelIntensity { get; private set; }

        /// <summary>
        /// Gets the color correction RGB scaling factors to be applied to the final color computed by
        /// the fragment shader to match the ambient color.
        /// </summary>
        public Color ColorCorrection { get; private set; }
    }
}


text:
fileFormatVersion: 2
guid: d7990c0cac50a48a29eba12ee1f730bc
timeCreated: 1510616957
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: 56892237bd519491d9a60f5ebd3e0f72
timeCreated: 1517868046
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: f605e8f0dd31a453083b47fb68477792
timeCreated: 1516989852
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: d7676570d2869469a8e061cbd3d90c9f
timeCreated: 1502330118
licenseType: Free
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
//-----------------------------------------------------------------------
// <copyright file="Trackable.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using System;
    using System.Collections.Generic;
    using GoogleARCoreInternal;
    using UnityEngine;

    /// <summary>
    /// An object ARCore is tracking in the real world.
    /// </summary>
    public abstract class Trackable
    {
        //// @cond EXCLUDE_FROM_DOXYGEN

        /// <summary>
        /// A native handle for the ARCore trackable.
        /// </summary>
        protected IntPtr m_TrackableNativeHandle = IntPtr.Zero;

        /// <summary>
        /// The native api for ARCore.
        /// </summary>
        protected NativeSession m_NativeSession;

        private bool m_IsSessionDestroyed = false;

        /// <summary>
        /// Constructs a new ARCore Trackable.
        /// </summary>
        protected Trackable()
        {
        }

        /// <summary>
        /// Constructs a new ARCore Trackable.
        /// </summary>
        /// <param name="trackableNativeHandle">The native handle.</param>
        /// <param name="nativeSession">The native session.</param>
        protected Trackable(IntPtr trackableNativeHandle, NativeSession nativeSession)
        {
            m_TrackableNativeHandle = trackableNativeHandle;
            m_NativeSession = nativeSession;
        }

        ~Trackable()
        {
            m_NativeSession.TrackableApi.Release(m_TrackableNativeHandle);
        }

        //// @endcond

        /// <summary>
        /// Gets the tracking state of for the Trackable in the current frame.
        /// </summary>
        /// <returns>The tracking state of for the Trackable in the current frame.</returns>
        public virtual TrackingState TrackingState
        {
            get
            {
                // TODO (b/73256094): Remove isTracking when fixed.
                var isTracking = LifecycleManager.Instance.SessionStatus == SessionStatus.Tracking;
                if (_IsSessionDestroyed())
                {
                    // 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);
            }
        }

        /// <summary>
        /// Creates an Anchor at the given <c>Pose</c> that is attached to the Trackable where semantics of the
        /// attachment relationship are defined by the subcass of Trackable (e.g. TrackedPlane).   Note that the
        /// relative offset between the Pose of multiple Anchors attached to the same Trackable may change
        /// over time as ARCore refines its understanding of the world.
        /// </summary>
        /// <param name="pose">The Pose of the location to create the anchor.</param>
        /// <returns>An Anchor attached to the Trackable at <c>Pose</c>.</returns>
        public virtual Anchor CreateAnchor(Pose pose)
        {
            if (_IsSessionDestroyed())
            {
                Debug.LogError("CreateAnchor:: Trying to access a session that has already been destroyed.");
                return null;
            }

            IntPtr 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_NativeSession);
        }

        /// <summary>
        /// Gets all anchors attached to the Trackable.
        /// </summary>
        /// <param name="anchors">A list of anchors to be filled by the method.</param>
        public virtual void GetAllAnchors(List<Anchor> anchors)
        {
            if (_IsSessionDestroyed())
            {
                Debug.LogError("GetAllAnchors:: Trying to access a session that has already been destroyed.");
                anchors.Clear();
                return;
            }

            m_NativeSession.TrackableApi.GetAnchors(m_TrackableNativeHandle, anchors);
        }

        /// <summary>
        /// Tells if the session was destroyed.
        /// </summary>
        /// <returns><c>true</c> if the session this Trackable belong to was destroyed,
        /// <c>false</c> otherwise.</returns>
        protected bool _IsSessionDestroyed()
        {
            if (!m_IsSessionDestroyed)
            {
                var nativeSession = LifecycleManager.Instance.NativeSession;
                if (nativeSession != m_NativeSession)
                {
                    m_IsSessionDestroyed = true;
                }
            }

            return m_IsSessionDestroyed;
        }
    }
}


text:
//-----------------------------------------------------------------------
// <copyright file="ARCoreSession.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using GoogleARCoreInternal;
    using UnityEngine;

    /// <summary>
    /// A component that manages the ARCore Session in a Unity scene.
    /// </summary>
    public class ARCoreSession : MonoBehaviour
    {
        /// <summary>
        /// A scriptable object specifying the ARCore session configuration.
        /// </summary>
        [Tooltip("A scriptable object specifying the ARCore session configuration.")]
        public ARCoreSessionConfig SessionConfig;

        /// <summary>
        /// Unity Start.
        /// </summary>
        public void Start()
        {
            LifecycleManager.Instance.CreateSession(this);
        }

        /// <summary>
        /// Unity OnDestroy.
        /// </summary>
        public void OnDestroy()
        {
            LifecycleManager.Instance.DestroySession();
        }

        /// <summary>
        /// Unity OnEnable.
        /// </summary>
        public void OnEnable()
        {
            LifecycleManager.Instance.EnableSession();
        }

        /// <summary>
        /// Unity OnDisable.
        /// </summary>
        public void OnDisable()
        {
            LifecycleManager.Instance.DisableSession();
        }
    }
}


text:
fileFormatVersion: 2
guid: 68f2bf600965540b080a2244b1221f8e
timeCreated: 1511913936
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: f69a232195c4d4a699cc8501f6ee7649
timeCreated: 1502302494
licenseType: Free
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
//-----------------------------------------------------------------------
// <copyright file="TrackableQueryFilter.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using System;
    using System.Collections.Generic;
    using GoogleARCoreInternal;
    using UnityEngine;

    /// <summary>
    /// A filter for trackable queries.
    /// </summary>
    public enum TrackableQueryFilter
    {
        /// <summary>
        /// Indicates available trackables.
        /// </summary>
        All,

        /// <summary>
        /// Indicates new trackables detected in the current ARCore Frame.
        /// </summary>
        New,

        /// <summary>
        /// Indicates trackables that were updated in the current ARCore Frame.
        /// </summary>
        Updated,
    }
}


text:
fileFormatVersion: 2
guid: 11813694e8abb437eb9ef46ed1cc67c5
folderAsset: yes
timeCreated: 1502400396
licenseType: Free
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: f23179d83fac54b6898d7f842a3ecf83
timeCreated: 1503161028
licenseType: Free
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: fda591ded80f4d6489368b5527603e86
timeCreated: 1502160887
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: 92a4cf446a0c7334aaceb5457be27894
timeCreated: 1510799851
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: d4ca0c6a3af6b4635b7e98c6ea0a0cf9
timeCreated: 1510461671
licenseType: Free
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: b8d6e0fc3b3bc44218e96690668c05b4
timeCreated: 1517519681
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: 21d75659f8470494cbefd71c8b7f25bd
timeCreated: 1510770155
licenseType: Free
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
//-----------------------------------------------------------------------
// <copyright file="PointCloudPoint.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using UnityEngine;

    /// <summary>
    /// A point in a point cloud.
    /// </summary>
    public struct PointCloudPoint
    {
        /// <summary>
        /// The x-position of the point.
        /// </summary>
        public float X;

        /// <summary>
        /// The y-position of the point.
        /// </summary>
        public float Y;

        /// <summary>
        /// The z-position of the point.
        /// </summary>
        public float Z;

        /// <summary>
        /// A normalized confidence value for the point.
        /// </summary>
        public float Confidence;

        /// <summary>
        /// Constructs a new PointCloudPoint.
        /// </summary>
        /// <param name="x">The x-position of the point.</param>
        /// <param name="y">The y-position of the point.</param>
        /// <param name="z">The z-position of the point.</param>
        /// <param name="confidence">The confidence of the point.</param>
        public PointCloudPoint(float x, float y, float z, float confidence)
        {
            this.X = x;
            this.Y = y;
            this.Z = z;
            this.Confidence = confidence;
        }

        /// <summary>
        /// Implicitly converts a PointCloudPoint to a Vector4.
        /// </summary>
        /// <param name="point">The point to convert.</param>
        public static implicit operator Vector4(PointCloudPoint point)
        {
            return new Vector4(point.X, point.Y, point.Z, point.Confidence);
        }

        /// <summary>
        /// Implicitly converts a Vector4 to a PointCloudPoint.
        /// </summary>
        /// <param name="vectorPoint">The Vector3 to convert.</param>
        public static implicit operator PointCloudPoint(Vector4 vectorPoint)
        {
            return new PointCloudPoint(vectorPoint.x, vectorPoint.y, vectorPoint.z, vectorPoint.w);
        }
    }
}


text:
//-----------------------------------------------------------------------
// <copyright file="TrackingState.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    /// <summary>
    /// Possible tracking states for ARCore.
    /// </summary>
    public enum TrackingState
    {
        /// <summary>
        /// The entity is actively being tracked.
        /// </summary>
        Tracking = 0,

        /// <summary>
        /// ARCore has paused tracking the entity but may resume tracking it in the future.
        /// </summary>
        Paused = 1,

        /// <summary>
        /// ARCore has stopped tracking the entity and will never resume tracking it.
        /// </summary>
        Stopped = 2,
    }
}


text:
fileFormatVersion: 2
guid: a541164e523764394a27cc3803637e58
timeCreated: 1502302494
licenseType: Free
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: a9e4048a8fa07415da1df0c57b405bf1
timeCreated: 1520292979
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
//-----------------------------------------------------------------------
// <copyright file="ApkAvailabilityStatus.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    /// <summary>
    /// Possible statuses for the ARCore APK availability on a device.
    /// </summary>
    public enum ApkAvailabilityStatus
    {
        UnknownError = 0,
        UnknownChecking = 1,
        UnknownTimedOut = 2,
        UnsupportedDeviceNotCapable = 100,
        SupportedNotInstalled = 201,
        SupportedApkTooOld = 202,
        SupportedInstalled = 203
    }
}


text:
//-----------------------------------------------------------------------
// <copyright file="AndroidPermissionsManager.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using System;
    using GoogleARCoreInternal;
    using UnityEngine;

    /// <summary>
    /// Manages Android permissions for the Unity application.
    /// </summary>
    public class AndroidPermissionsManager : AndroidJavaProxy
    {
        private static AndroidPermissionsManager s_Instance;
        private static AndroidJavaObject s_Activity;
        private static AndroidJavaObject s_PermissionService;
        private static AsyncTask<AndroidPermissionsRequestResult> s_CurrentRequest = null;
        private static Action<AndroidPermissionsRequestResult> s_OnPermissionsRequestFinished;

        /// @cond EXCLUDE_FROM_DOXYGEN
        /// <summary>
        /// Constructs a new AndroidPermissionsManager.
        /// </summary>
        public AndroidPermissionsManager() : base("com.unity3d.plugin.UnityAndroidPermissions$IPermissionRequestResult")
        {
        }

        /// @endcond

        /// <summary>
        /// Checks if an Android permission is granted to the application.
        /// </summary>
        /// <param name="permissionName">The full name of the Android permission to check (e.g.
        /// android.permission.CAMERA).</param>
        /// <returns><c>true</c> if <c>permissionName</c> is granted to the application, otherwise
        /// <c>false</c>.</returns>
        public static bool IsPermissionGranted(string permissionName)
        {
            if (Application.isEditor)
            {
                return true;
            }

            return GetPermissionsService().Call<bool>("IsPermissionGranted", GetUnityActivity(), permissionName);
        }

        /// <summary>
        /// Requests an Android permission from the user.
        /// </summary>
        /// <param name="permissionName">The permission to be requested (e.g. android.permission.CAMERA).</param>
        /// <returns>An asynchronous task the completes when the user has accepted/rejected the requested permission
        /// and yields a {@link AndroidPermissionsRequestResult} that summarizes the result.  If this method is called
        /// when another permissions request is pending <c>null</c> will be returned instead.</returns>
        public static AsyncTask<AndroidPermissionsRequestResult> RequestPermission(string permissionName)
        {
            if (AndroidPermissionsManager.IsPermissionGranted(permissionName))
            {
                return new AsyncTask<AndroidPermissionsRequestResult>(new AndroidPermissionsRequestResult(
                    new string[] { permissionName }, new bool[] { true }));
            }

            if (s_CurrentRequest != null)
            {
                ARDebug.LogError("Attempted to make simultaneous Android permissions requests.");
                return null;
            }

            GetPermissionsService().Call("RequestPermissionAsync", GetUnityActivity(),
                new[] { permissionName }, GetInstance());
            s_CurrentRequest = new AsyncTask<AndroidPermissionsRequestResult>(out s_OnPermissionsRequestFinished);

            return s_CurrentRequest;
        }

        /// @cond EXCLUDE_FROM_DOXYGEN
        /// <summary>
        /// Callback fired when a permission is granted.
        /// </summary>
        /// <param name="permissionName">The name of the permission that was granted.</param>
        public virtual void OnPermissionGranted(string permissionName)
        {
            _OnPermissionResult(permissionName, true);
        }

        /// @endcond

        /// @cond EXCLUDE_FROM_DOXYGEN
        /// <summary>
        /// Callback fired when a permission is denied.
        /// </summary>
        /// <param name="permissionName">The name of the permission that was denied.</param>
        public virtual void OnPermissionDenied(string permissionName)
        {
            _OnPermissionResult(permissionName, false);
        }

        /// @endcond

        /// @cond EXCLUDE_FROM_DOXYGEN
        /// <summary>
        /// Callback fired on an Android activity result (unused part of UnityAndroidPermissions interface).
        /// </summary>
        public virtual void OnActivityResult()
        {
        }

        private static AndroidPermissionsManager GetInstance()
        {
            if (s_Instance == null)
            {
                s_Instance = new AndroidPermissionsManager();
            }

            return s_Instance;
        }

        private static AndroidJavaObject GetUnityActivity()
        {
            if (s_Activity == null)
            {
                AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                s_Activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
            }

            return s_Activity;
        }

        private static AndroidJavaObject GetPermissionsService()
        {
            if (s_PermissionService == null)
            {
                s_PermissionService = new AndroidJavaObject("com.unity3d.plugin.UnityAndroidPermissions");
            }

            return s_PermissionService;
        }

        /// @endcond

        /// <summary>
        /// Callback fired on an Android permission result.
        /// </summary>
        /// <param name="permissionName">The name of the permission.</param>
        /// <param name="granted">If permission is granted or not.</param>
        private void _OnPermissionResult(string permissionName, bool granted)
        {
            if (s_OnPermissionsRequestFinished == null)
            {
                Debug.LogErrorFormat("AndroidPermissionsManager received an unexpected permissions result {0}",
                    permissionName);
                return;
            }

            // Cache completion method and reset request state.
            var onRequestFinished = s_OnPermissionsRequestFinished;
            s_CurrentRequest = null;
            s_OnPermissionsRequestFinished = null;

            onRequestFinished(new AndroidPermissionsRequestResult(new string[] { permissionName },
                new bool[] { granted }));
        }
    }
}


text:
//-----------------------------------------------------------------------
// <copyright file="ARCoreSessionConfig.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using UnityEngine;

    /// <summary>
    /// Holds settings that are used to configure the session.
    /// </summary>
    [CreateAssetMenu(fileName = "ARCoreSessionConfig", menuName = "GoogleARCore/SessionConfig", order = 1)]
    public class ARCoreSessionConfig : ScriptableObject
    {
        /// <summary>
        /// Toggles whether the rendering frame rate matches the background camera frame rate.
        /// Setting this to true will also set QualitySetting.vSyncCount to 0, which will make your entire app to run at the background camera frame rate (including animations, UI interaction, etc.).
        /// Setting this to false could incur extra power overhead due to rendering the same background more than once.
        /// </summary>
        [Tooltip("Toggles whether the rendering frame rate matches the background camera frame rate")]
        public bool MatchCameraFramerate = true;

        /// <summary>
        /// Toggles whether plane finding is enabled.
        /// </summary>
        [Tooltip("Toggles whether plane finding is enabled.")]
        public bool EnablePlaneFinding = true;

        /// <summary>
        /// Toggles whether light estimation is enabled.
        /// </summary>
        [Tooltip("Toggles whether light estimation is enabled.")]
        public bool EnableLightEstimation = true;
    }
}


text:
fileFormatVersion: 2
guid: f6f63f1692fd0421e84e300081d1555a
timeCreated: 1520026166
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
//-----------------------------------------------------------------------
// <copyright file="LightEstimateState.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    /// <summary>
    /// Possible states for <see cref="LightEstimate"/>.
    /// </summary>
    public enum LightEstimateState
    {
        /// <summary>
        /// Estimate is not valid and should not be used.
        /// </summary>
        NotValid,

        /// <summary>
        /// Estimate is valid.
        /// </summary>
        Valid,
    }
}


text:
fileFormatVersion: 2
guid: e7bf42f9fcf4548e8bfeb90b36d40891
timeCreated: 1511904539
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: b3aabcae5f79543dea8251d640bde6ad
folderAsset: yes
timeCreated: 1502330118
licenseType: Free
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
//-----------------------------------------------------------------------
// <copyright file="SessionStatus.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    /// <summary>
    /// Possible states for the ARCore session.
    /// </summary>
    public enum SessionStatus
    {
        /// <summary>
        /// The ARCore session has not been initialized.
        /// </summary>
        None = 0,

        /// <summary>
        /// The ARCore session is initializing.
        /// </summary>
        Initializing = 1,

        /// <summary>
        /// The ARCore session is tracking.
        /// </summary>
        Tracking = 100,

        /// <summary>
        /// The ARCore session has lost tracking and is attempting to recover.
        /// </summary>
        LostTracking = 101,

        /// <summary>
        /// The ARCore session is paused.
        /// </summary>
        NotTracking = 102,

        /// <summary>
        /// An ARCore session cannot begin tracking because a fatal error was encountered.
        /// </summary>
        FatalError = 200,

        /// <summary>
        /// An ARCore session cannot begin tracking because the ARCore service APK is not available on the device.
        /// </summary>
        ErrorApkNotAvailable = 201,

        /// <summary>
        /// An ARCore session cannot begin tracking because the Android camera permission is not granted.
        /// </summary>
        ErrorPermissionNotGranted = 202,

        /// <summary>
        /// An ARCore session cannot begin tracking because the session configuration supplied is not supported or no
        /// session configuration was supplied.
        /// </summary>
        ErrorSessionConfigurationNotSupported = 203,
    }
}


text:
//-----------------------------------------------------------------------
// <copyright file="CameraImageBytes.cs" company="Google">
//
// Copyright 2018 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using System;
    using System.Diagnostics.CodeAnalysis;
    using GoogleARCoreInternal;
    using UnityEngine;

    /// <summary>
    /// An ARCore camera image with its data accessible from the CPU in YUV-420-888 format.
    /// </summary>
    public struct CameraImageBytes : IDisposable
    {
        private IntPtr m_ImageHandle;

        internal CameraImageBytes(IntPtr imageHandle)
        {
            m_ImageHandle = imageHandle;
            if (m_ImageHandle != IntPtr.Zero)
            {
                int width, height;
                IntPtr y, u, v;
                int yRowStride, uvPixelStride, uvRowStride;
                LifecycleManager.Instance.NativeSession.ImageApi.GetImageBuffer(m_ImageHandle, out width, out height,
                    out y, out u, out v, out yRowStride, out uvPixelStride, out uvRowStride);

                IsAvailable = true;
                Width = width;
                Height = height;
                Y = y;
                U = u;
                V = v;
                YRowStride = yRowStride;
                UVPixelStride = uvPixelStride;
                UVRowStride = uvRowStride;
            }
            else
            {
                IsAvailable = false;
                Width = Height = 0;
                Y = U = V = IntPtr.Zero;
                YRowStride = UVPixelStride = UVRowStride = 0;
            }
        }

        /// <summary>
        /// Gets a value indicating whether the image bytes are available. The struct should not be accessed if
        /// this value is <c>false</c>.
        /// </summary>
        public bool IsAvailable { get; private set; }

        /// <summary>
        /// Gets the width of the image.
        /// </summary>
        public int Width { get; private set; }

        /// <summary>
        /// Gets the height of the image.
        /// </summary>
        public int Height { get; private set; }

        /// <summary>
        /// Gets a pointer to the Y buffer with a pixel stride of 1 and a row stride of <c>YRowStride</c>.
        /// </summary>
        public IntPtr Y { get; private set; }

        /// <summary>
        /// Gets a pointer to the U buffer with a pixel stride of <c>UVPixelStride</c> and a row stride of
        /// <c>UVRowStride</c>.
        /// </summary>
        public IntPtr U { get; private set; }

        /// <summary>
        /// Gets a pointer to the V buffer with a pixel stride of <c>UVPixelStride</c> and a row stride of
        /// <c>UVRowStride</c>.
        /// </summary>
        public IntPtr V { get; private set; }

        /// <summary>
        /// Gets the row stride of the Y plane.
        /// </summary>
        public int YRowStride { get; private set; }

        /// <summary>
        /// Gets the pixel stride of the U and V planes.
        /// </summary>
        public int UVPixelStride { get; private set; }

        /// <summary>
        /// Gets the row stride of the U and V planes.
        /// </summary>
        public int UVRowStride { get; private set; }

        /// <summary>
        /// Releases the camera image and associated resources, and signifies the developer will no longer access those
        /// resources.
        /// </summary>
        public void Release()
        {
            if (m_ImageHandle != IntPtr.Zero)
            {
                LifecycleManager.Instance.NativeSession.ImageApi.Release(m_ImageHandle);
                m_ImageHandle = IntPtr.Zero;
            }
        }

        /// <summary>
        /// Calls release as part of IDisposable pattern supporting 'using' statements.
        /// </summary>
        public void Dispose()
        {
            Release();
        }
    }
}


text:
//-----------------------------------------------------------------------
// <copyright file="ARCoreBackgroundRenderer.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using System.Collections;
    using System.Collections.Generic;
    using GoogleARCoreInternal;
    using UnityEngine;
    using UnityEngine.XR;

    /// <summary>
    /// Renders the device's camera as a background to the attached Unity camera component.
    /// </summary>
    [RequireComponent(typeof(Camera))]
    public class ARCoreBackgroundRenderer : MonoBehaviour
    {
        /// <summary>
        /// A material used to render the AR background image.
        /// </summary>
        [Tooltip("A material used to render the AR background image.")]
        public Material BackgroundMaterial;

        private Camera m_Camera;

        private ARBackgroundRenderer m_BackgroundRenderer;

        private void OnEnable()
        {
            if (m_BackgroundRenderer == null)
            {
                m_BackgroundRenderer = new ARBackgroundRenderer();
            }

            if (BackgroundMaterial == null)
            {
                Debug.LogError("ArCameraBackground:: No material assigned.");
                return;
            }

            m_Camera = GetComponent<Camera>();
            m_BackgroundRenderer.backgroundMaterial = BackgroundMaterial;
            m_BackgroundRenderer.camera = m_Camera;
            m_BackgroundRenderer.mode = ARRenderMode.MaterialAsBackground;
        }

        private void OnDisable()
        {
            Disable();
        }

        private void Update()
        {
            if (BackgroundMaterial == null)
            {
                return;
            }

            Texture backgroundTexture = Frame.CameraImage.Texture;
            if (backgroundTexture == null)
            {
                return;
            }

            const string mainTexVar = "_MainTex";
            const string topLeftRightVar = "_UvTopLeftRight";
            const string bottomLeftRightVar = "_UvBottomLeftRight";

            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);
        }

        private void Disable()
        {
            if (m_BackgroundRenderer != null)
            {
                m_BackgroundRenderer.camera = null;
                m_BackgroundRenderer.mode = ARRenderMode.StandardBackground;
            }
        }
    }
}


text:
//-----------------------------------------------------------------------
// <copyright file="TrackedPoint.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics.CodeAnalysis;
    using GoogleARCoreInternal;
    using UnityEngine;

    /// <summary>
    /// A point in the real world tracked by ARCore.
    /// </summary>
    public class TrackedPoint : Trackable
    {
        //// @cond EXCLUDE_FROM_DOXYGEN

        /// <summary>
        /// Construct TrackedPoint from a native handle.
        /// </summary>
        /// <param name="nativeHandle">A handle to the native ARCore API Trackable.</param>
        /// <param name="nativeApi">The ARCore native api.</param>
        public TrackedPoint(IntPtr nativeHandle, NativeSession nativeApi) : base(nativeHandle, nativeApi)
        {
        }

        //// @endcond

        /// <summary>
        /// Gets the pose of the TrackedPoint.
        /// </summary>
        public Pose Pose
        {
            get
            {
                if (_IsSessionDestroyed())
                {
                    Debug.LogError("Pose:: Trying to access a session that has already been destroyed.");
                    return new Pose();
                }

                return m_NativeSession.PointApi.GetPose(m_TrackableNativeHandle);
            }
        }

        /// <summary>
        /// Gets the orientation mode of the TrackedPoint.
        /// </summary>
        public TrackedPointOrientationMode OrientationMode
        {
            get
            {
                if (_IsSessionDestroyed())
                {
                    Debug.LogError("OrientationMode:: Trying to access a session that has already been destroyed.");
                    return TrackedPointOrientationMode.Identity;
                }

                return m_NativeSession.PointApi.GetOrientationMode(m_TrackableNativeHandle);
            }
        }
    }
}


text:
fileFormatVersion: 2
guid: df152580aca434d62a87d4dfefe9ca93
timeCreated: 1508869129
licenseType: Free
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: 53ac32fab2599402fb6d154adf4c1e40
timeCreated: 1510876906
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: f2d0f75c2c2744f5c8b7c0a18da840a6
timeCreated: 1502152830
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
fileFormatVersion: 2
guid: a1de1e6e76a30499e970bb552522dec7
timeCreated: 1517858804
licenseType: Pro
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:


text:
//-----------------------------------------------------------------------
// <copyright file="AndroidPermissionsRequestResult.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    using GoogleARCoreInternal;
    using UnityEngine;

    /// <summary>
    /// Structure holding data summarizing the result of an Android permissions request.
    /// </summary>
    public struct AndroidPermissionsRequestResult
    {
        /// <summary>
        /// Constructs a new AndroidPermissionsRequestResult.
        /// </summary>
        /// <param name="permissionNames">The value for PermissionNames.</param>
        /// <param name="grantResults">The value for GrantResults.</param>
        public AndroidPermissionsRequestResult(string[] permissionNames,  bool[] grantResults)
        {
            PermissionNames = permissionNames;
            GrantResults = grantResults;
        }

        /// <summary>
        /// Gets a collection of permissions requested.
        /// </summary>
        public string[] PermissionNames { get; private set; }

        /// <summary>
        /// Gets a collection of results corresponding to {@link PermissionNames}.
        /// </summary>
        public bool[] GrantResults { get; private set; }

        /// <summary>
        /// Gets a value indicating whether all permissions are granted.
        /// </summary>
        public bool IsAllGranted
        {
            get
            {
                if (PermissionNames == null || GrantResults == null)
                {
                    return false;
                }

                for (int i = 0; i < GrantResults.Length; i++)
                {
                    if (!GrantResults[i])
                    {
                        return false;
                    }
                }

                return true;
            }
        }
    }
}


text:
//-----------------------------------------------------------------------
// <copyright file="CameraMetadataTag.cs" company="Google">
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleARCore
{
    /// <summary>
    /// This enum follows the layout of NdkCameraMetadataTags.
    /// The values in the file are used for requesting / marshaling camera image's metadata.
    /// The comments have been removed to keep the code readable. Please refer to
    /// NdkCameraMetadataTags.h for documentation:
    /// https://developer.android.com/ndk/reference/ndk_camera_metadata_tags_8h.html .
    /// </summary>
    public enum CameraMetadataTag
    {
        SectionColorCorrection = 0,
        SectionControl = 1,
        SectionEdge = 3,
        SectionFlash = 4,
        SectionFlashInfo = 5,
        SectionHotPixel = 6,
        SectionJpeg = 7,
        SectionLens = 8,
        SectionLensInfo = 9,
        SectionNoiseReduction = 10,
        SectionRequest = 12,
        SectionScaler = 13,
        SectionSensor = 14,
        SectionSensorInfo = 15,
        SectionShading = 16,
        SectionStatistics = 17,
        SectionStatisticsInfo = 18,
        SectionTonemap = 19,
        SectionInfo = 21,
        SectionBlackLevel = 22,
        SectionSync = 23,
        SectionDepth = 25,

        // Start Value Of Each Section.
        ColorCorrectionStart = SectionColorCorrection << 16,
        ControlStart = SectionControl << 16,
        EdgeStart = SectionEdge << 16,
        FlashStart = SectionFlash << 16,
        FlashInfoStart = SectionFlashInfo << 16,
        HotPixelStart = SectionHotPixel << 16,
        JpegStart = SectionJpeg << 16,
        LensStart = SectionLens << 16,
        LensInfoStart = SectionLensInfo << 16,
        NoiseReductionStart = SectionNoiseReduction << 16,
        RequestStart = SectionRequest << 16,
        ScalerStart = SectionScaler << 16,
        SensorStart = SectionSensor << 16,
        SensorInfoStart = SectionSensorInfo << 16,
        ShadingStart = SectionShading << 16,
        StatisticsStart = SectionStatistics << 16,
        StatisticsInfoStart = SectionStatisticsInfo << 16,
        TonemapStart = SectionTonemap << 16,
        InfoStart = SectionInfo << 16,
        BlackLevelStart = SectionBlackLevel << 16,
        SyncStart = SectionSync << 16,
        DepthStart = SectionDepth << 16,

        // Note that we only expose the keys that could be used in the camera metadata from the capture
        // result. The keys may only appear in CameraCharacteristics are not exposed here.
        ColorCorrectionMode = // Byte (Enum)
                ColorCorrectionStart,

        ColorCorrectionTransform = // Rational[33]
                ColorCorrectionStart + 1,

        ColorCorrectionGains = // Float[4]
                ColorCorrectionStart + 2,

        ColorCorrectionAberrationMode = // Byte (Enum)
                ColorCorrectionStart + 3,

        ControlAeAntibandingMode = // Byte (Enum)
                ControlStart,

        ControlAeExposureCompensation = // Int32
                ControlStart + 1,

        ControlAeLock = // Byte (Enum)
                ControlStart + 2,

        ControlAeMode = // Byte (Enum)
                ControlStart + 3,

        ControlAeRegions = // Int32[5areaCount]
                ControlStart + 4,

        ControlAeTargetFpsRange = // Int32[2]
                ControlStart + 5,

        ControlAePrecaptureTrigger = // Byte (Enum)
                ControlStart + 6,

        ControlAfMode = // Byte (Enum)
                ControlStart + 7,

        ControlAfRegions = // Int32[5areaCount]
                ControlStart + 8,

        ControlAfTrigger = // Byte (Enum)
                ControlStart + 9,

        ControlAwbLock = // Byte (Enum)
                ControlStart + 10,

        ControlAwbMode = // Byte (Enum)
                ControlStart + 11,

        ControlAwbRegions = // Int32[5areaCount]
                ControlStart + 12,

        ControlCaptureIntent = // Byte (Enum)
                ControlStart + 13,

        ControlEffectMode = // Byte (Enum)
                ControlStart + 14,

        ControlMode = // Byte (Enum)
                ControlStart + 15,

        ControlSceneMode = // Byte (Enum)
                ControlStart + 16,

        ControlVideoStabilizationMode = // Byte (Enum)
                ControlStart + 17,

        ControlAeState = // Byte (Enum)
                ControlStart + 31,

        ControlAfState = // Byte (Enum)
                ControlStart + 32,

        ControlAwbState = // Byte (Enum)
                ControlStart + 34,

        ControlPostRawSensitivityBoost = // Int32
                ControlStart + 40,

        EdgeMode = // Byte (Enum)
                EdgeStart,

        FlashMode = // Byte (Enum)
                FlashStart + 2,

        FlashState = // Byte (Enum)
                FlashStart + 5,

        HotPixelMode = // Byte (Enum)
                HotPixelStart,

        JpegGpsCoordinates = // Double[3]
                JpegStart,

        JpegGpsProcessingMethod = // Byte
                JpegStart + 1,

        JpegGpsTimestamp = // Int64
                JpegStart + 2,

        JpegOrientation = // Int32
                JpegStart + 3,

        JpegQuality = // Byte
                JpegStart + 4,

        JpegThumbnailQuality = // Byte
                JpegStart + 5,

        JpegThumbnailSize = // Int32[2]
                JpegStart + 6,

        LensAperture = // Float
                LensStart,

        LensFilterDensity = // Float
                LensStart + 1,

        LensFocalLength = // Float
                LensStart + 2,

        LensFocusDistance = // Float
                LensStart + 3,

        LensOpticalStabilizationMode = // Byte (Enum)
                LensStart + 4,

        LensPoseRotation = // Float[4]
                LensStart + 6,

        LensPoseTranslation = // Float[3]
                LensStart + 7,

        LensFocusRange = // Float[2]
                LensStart + 8,

        LensState = // Byte (Enum)
                LensStart + 9,

        LensIntrinsicCalibration = // Float[5]
                LensStart + 10,

        LensRadialDistortion = // Float[6]
                LensStart + 11,

        NoiseReductionMode = // Byte (Enum)
                NoiseReductionStart,

        RequestPipelineDepth = // Byte
                RequestStart + 9,

        ScalerCropRegion = // Int32[4]
                ScalerStart,

        SensorExposureTime = // Int64
                SensorStart,

        SensorFrameDuration = // Int64
                SensorStart + 1,

        SensorSensitivity = // Int32
                SensorStart + 2,

        SensorTimestamp = // Int64
                SensorStart + 16,

        SensorNeutralColorPoint = // Rational[3]
                SensorStart + 18,

        SensorNoiseProfile = // Double[2Cfa Channels]
                SensorStart + 19,

        SensorGreenSplit = // Float
                SensorStart + 22,

        SensorTestPatternData = // Int32[4]
                SensorStart + 23,

        SensorTestPatternMode = // Int32 (Enum)
                SensorStart + 24,

        SensorRollingShutterSkew = // Int64
                SensorStart + 26,

        SensorDynamicBlackLevel = // Float[4]
                SensorStart + 28,

        SensorDynamicWhiteLevel = // Int32
                SensorStart + 29,

        ShadingMode = // Byte (Enum)
                ShadingStart,

        StatisticsFaceDetectMode = // Byte (Enum)
                StatisticsStart,

        StatisticsHotPixelMapMode = // Byte (Enum)
                StatisticsStart + 3,

        StatisticsFaceIds = // Int32[N]
                StatisticsStart + 4,

        StatisticsFaceLandmarks = // Int32[N6]
                StatisticsStart + 5,

        StatisticsFaceRectangles = // Int32[N4]
                StatisticsStart + 6,

        StatisticsFaceScores = // Byte[N]
                StatisticsStart + 7,

        StatisticsLensShadingMap = // Float[4nm]
                StatisticsStart + 11,

        StatisticsSceneFlicker = // Byte (Enum)
                StatisticsStart + 14,

        StatisticsHotPixelMap = // Int32[2n]
                StatisticsStart + 15,

        StatisticsLensShadingMapMode = // Byte (Enum)
                StatisticsStart + 16,

        TonemapCurveBlue = // Float[N2]
                TonemapStart,

        TonemapCurveGreen = // Float[N2]
                TonemapStart + 1,

        TonemapCurveRed = // Float[N2]
                TonemapStart + 2,

        TonemapMode = // Byte (Enum)
                TonemapStart + 3,

        TonemapGamma = // Float
                TonemapStart + 6,

        TonemapPresetCurve = // Byte (Enum)
                TonemapStart + 7,

        BlackLevelLock = // Byte (Enum)
                BlackLevelStart,

        SyncFrameNumber = // Int64 (Enum)
                SyncStart,
    }
}