Skip to content
This repository has been archived by the owner on Sep 14, 2021. It is now read-only.

Commit

Permalink
ARCore Unity SDK v1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nvictornvictor committed Jun 20, 2019
1 parent e93c6ba commit 0582954
Show file tree
Hide file tree
Showing 99 changed files with 2,229 additions and 664 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
MatchCameraFramerate: 1
PlaneFindingMode: 1
EnableLightEstimation: 1
LightEstimationMode: 3
EnableCloudAnchor: 0
AugmentedImageDatabase: {fileID: 0}
CameraFocusMode: 0
AugmentedFaceMode: 0
2 changes: 1 addition & 1 deletion Assets/GoogleARCore/Editor/ARCoreiOSDependencies.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dependencies>
<iosPods>
<iosPod minTargetSdk="11.0" name="ARCore" version="~&gt; 1.9.0">
<iosPod minTargetSdk="11.0" name="ARCore" version="~&gt; 1.10.0">
</iosPod>
</iosPods>
</dependencies>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
MatchCameraFramerate: 1
PlaneFindingMode: 0
EnableLightEstimation: 1
LightEstimationMode: 1
EnableCloudAnchor: 0
AugmentedImageDatabase: {fileID: 0}
CameraFocusMode: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
MatchCameraFramerate: 1
PlaneFindingMode: 0
EnableLightEstimation: 0
LightEstimationMode: 3
EnableCloudAnchor: 0
AugmentedImageDatabase: {fileID: 11400000, guid: c3e077e231877401e8d2163ebbbc9dc6,
type: 2}
CameraFocusMode: 1
AugmentedFaceMode: 0
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
MatchCameraFramerate: 1
PlaneFindingMode: 1
EnableLightEstimation: 1
LightEstimationMode: 3
EnableCloudAnchor: 1
AugmentedImageDatabase: {fileID: 0}
CameraFocusMode: 0
AugmentedFaceMode: 0
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Material:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: AnchorMaterial
m_Shader: {fileID: 4800000, guid: c4790e12ed76c486d9fd9d9ccefecb25, type: 3}
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Material:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: StarMaterial
m_Shader: {fileID: 4800000, guid: c4790e12ed76c486d9fd9d9ccefecb25, type: 3}
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
Expand All @@ -18,9 +18,59 @@ Material:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: ce5ebecd4d7a345df86f06d5730f1156, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats: []
m_Colors: []
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.43668893, g: 0.4842832, b: 0.56452656, a: 1}
m_IndirectSpecularColor: {r: 0.43668893, g: 0.48428315, b: 0.56452656, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1527,7 +1527,7 @@ MonoBehaviour:
m_GameObject: {fileID: 1077067566}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -822479833, guid: 870353891bb340e2b2a9c8707e7419ba, type: 3}
m_Script: {fileID: 11500000, guid: 571dea5f5d1d44b2893ba131d2b25467, type: 3}
m_Name:
m_EditorClassIdentifier:
m_NetworkPort: 7777
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ public class CloudAnchorsExampleController : MonoBehaviour
/// The Network Manager.
/// </summary>
#pragma warning disable 618
private NetworkManager m_NetworkManager;
private CloudAnchorsNetworkManager m_NetworkManager;
#pragma warning restore 618

private bool m_MatchStarted = false;

/// <summary>
/// Enumerates modes the example application can be in.
/// </summary>
Expand All @@ -131,8 +129,10 @@ public enum ApplicationMode
public void Start()
{
#pragma warning disable 618
m_NetworkManager = UIController.GetComponent<NetworkManager>();
m_NetworkManager = UIController.GetComponent<CloudAnchorsNetworkManager>();
#pragma warning restore 618
m_NetworkManager.OnClientConnected += _OnConnectedToServer;
m_NetworkManager.OnClientDisconnected += _OnDisconnectedFromServer;

// A Name is provided to the Game Object so it can be found by other Scripts
// instantiated as prefabs in the scene.
Expand Down Expand Up @@ -256,7 +256,7 @@ public void OnEnterHostingModeClick()
{
m_CurrentMode = ApplicationMode.Ready;
_ResetStatus();
return;
Debug.Log("Reset ApplicationMode from Hosting to Ready.");
}

m_CurrentMode = ApplicationMode.Hosting;
Expand All @@ -273,7 +273,7 @@ public void OnEnterResolvingModeClick()
{
m_CurrentMode = ApplicationMode.Ready;
_ResetStatus();
return;
Debug.Log("Reset ApplicationMode from Resolving to Ready.");
}

m_CurrentMode = ApplicationMode.Resolving;
Expand Down Expand Up @@ -319,6 +319,35 @@ public void OnAnchorResolved(bool success, string response)
UIController.OnAnchorResolved(success, response);
}

/// <summary>
/// Callback that happens when the client successfully connected to the server.
/// </summary>
private void _OnConnectedToServer()
{
if (m_CurrentMode == ApplicationMode.Hosting)
{
UIController.ShowDebugMessage("Find a plane, tap to create a Cloud Anchor.");
}
else if (m_CurrentMode == ApplicationMode.Resolving)
{
UIController.ShowDebugMessage("Waiting for Cloud Anchor to be hosted...");
}
else
{
_QuitWithReason("Connected to server with neither Hosting nor Resolving mode. " +
"Please start the app again.");
}
}

/// <summary>
/// Callback that happens when the client disconnected from the server.
/// </summary>
private void _OnDisconnectedFromServer()
{
_QuitWithReason("Network session disconnected! " +
"Please start the app again and try another room.");
}

/// <summary>
/// Instantiates the anchor object at the pose of the m_LastPlacedAnchor Anchor. This will
/// host the Cloud Anchor.
Expand Down Expand Up @@ -396,11 +425,6 @@ private void _ResetStatus()
/// </summary>
private void _UpdateApplicationLifecycle()
{
if (!m_MatchStarted && m_NetworkManager.IsClientConnected())
{
m_MatchStarted = true;
}

// Exit the app when the 'back' button is pressed.
if (Input.GetKey(KeyCode.Escape))
{
Expand All @@ -425,29 +449,32 @@ private void _UpdateApplicationLifecycle()
return;
}

// Quit if ARCore was unable to connect and give Unity some time for the toast to
// appear.
// Quit if ARCore was unable to connect.
if (Session.Status == SessionStatus.ErrorPermissionNotGranted)
{
UIController.ShowErrorMessage(
"Camera permission is needed to run this application.");
m_IsQuitting = true;
Invoke("_DoQuit", 5.0f);
_QuitWithReason("Camera permission is needed to run this application.");
}
else if (Session.Status.IsError())
{
UIController.ShowErrorMessage(
"ARCore encountered a problem connecting. Please start the app again.");
m_IsQuitting = true;
Invoke("_DoQuit", 5.0f);
_QuitWithReason("ARCore encountered a problem connecting. " +
"Please start the app again.");
}
else if (m_MatchStarted && !m_NetworkManager.IsClientConnected())
}

/// <summary>
/// Quits the application after 5 seconds for the toast to appear.
/// </summary>
/// <param name="reason">The reason of quitting the application.</param>
private void _QuitWithReason(string reason)
{
if (m_IsQuitting)
{
UIController.ShowErrorMessage(
"Network session disconnected! Please start the app again.");
m_IsQuitting = true;
Invoke("_DoQuit", 5.0f);
return;
}

UIController.ShowDebugMessage(reason);
m_IsQuitting = true;
Invoke("_DoQuit", 5.0f);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//-----------------------------------------------------------------------
// <copyright file="CloudAnchorsNetworkManager.cs" company="Google">
//
// Copyright 2019 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.Examples.CloudAnchors
{
using System;
using UnityEngine;
using UnityEngine.Networking;

/// <summary>
/// A NetworkManager that handles client connection and disconnection with customizable actions.
/// </summary>
#pragma warning disable 618
public class CloudAnchorsNetworkManager : NetworkManager
#pragma warning restore 618
{
/// <summary>
/// Action which get called when the client connects to a server.
/// </summary>
public event Action OnClientConnected;

/// <summary>
/// Action which get called when the client disconnects from a server.
/// </summary>
public event Action OnClientDisconnected;

/// <summary>
/// Called on the client when connected to a server.
/// </summary>
/// <param name="conn">Connection to the server.</param>
#pragma warning disable 618
public override void OnClientConnect(NetworkConnection conn)
#pragma warning restore 618
{
base.OnClientConnect(conn);
Debug.Log("Successfully connected to server: " + conn.lastError);
if (OnClientConnected != null)
{
OnClientConnected();
}
}

/// <summary>
/// Called on the client when disconnected from a server.
/// </summary>
/// <param name="conn">Connection to the server.</param>
#pragma warning disable 618
public override void OnClientDisconnect(NetworkConnection conn)
#pragma warning restore 618
{
base.OnClientDisconnect(conn);
Debug.Log("Disconnected from the server: " + conn.lastError);
if (OnClientDisconnected != null)
{
OnClientDisconnected();
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0582954

Please sign in to comment.