Changed a version of GoogleVR Unity SDK to use. (1.40.0)

This commit is contained in:
EnoxSoftware 2017-05-09 20:02:04 +09:00
Родитель 0872b95746
Коммит f4cca201e3
5 изменённых файлов: 31 добавлений и 14 удалений

Двоичный файл не отображается.

Просмотреть файл

@ -19,9 +19,9 @@ namespace GoogleVRWithOpenCVForUnityExample
{
/// <summary>
/// The texture.
/// The Quad camera.
/// </summary>
Texture2D texture;
public Camera QuadCamera;
/// <summary>
/// The AR camera.
@ -33,6 +33,11 @@ namespace GoogleVRWithOpenCVForUnityExample
/// </summary>
public GvrHead ARGvrHead;
/// <summary>
/// The texture.
/// </summary>
Texture2D texture;
/// <summary>
/// The cam matrix.
/// </summary>
@ -112,9 +117,9 @@ namespace GoogleVRWithOpenCVForUnityExample
float widthScale = (float)Screen.width / width;
float heightScale = (float)Screen.height / height;
if (widthScale < heightScale) {
Camera.main.orthographicSize = height / 2;
QuadCamera.orthographicSize = height / 2;
} else {
Camera.main.orthographicSize = (width * (float)Screen.height / (float)Screen.width) / 2;
QuadCamera.orthographicSize = (width * (float)Screen.height / (float)Screen.width) / 2;
imageSizeScale = (float)Screen.height / (float)Screen.width;
}
@ -207,12 +212,12 @@ namespace GoogleVRWithOpenCVForUnityExample
public IEnumerator resetCameraStatus(){
GvrViewer.Instance.DistortionCorrectionEnabled = !GvrViewer.Instance.DistortionCorrectionEnabled;
ToggleDistortionCorrection ();
yield return null;
GvrViewer.Instance.UpdateState();
GvrViewer.Instance.DistortionCorrectionEnabled = !GvrViewer.Instance.DistortionCorrectionEnabled;
ToggleDistortionCorrection ();
}
@ -347,8 +352,11 @@ namespace GoogleVRWithOpenCVForUnityExample
}
public void ToggleDistortionCorrection() {
GvrViewer.Instance.DistortionCorrectionEnabled =
!GvrViewer.Instance.DistortionCorrectionEnabled;
if (GvrViewer.Instance.DistortionCorrection != GvrViewer.DistortionCorrectionMethod.Unity) {
GvrViewer.Instance.DistortionCorrection = GvrViewer.DistortionCorrectionMethod.Unity;
} else {
GvrViewer.Instance.DistortionCorrection = GvrViewer.DistortionCorrectionMethod.None;
}
}
#if !UNITY_HAS_GOOGLEVR || UNITY_EDITOR

Двоичные данные
GoogleVRWithOpenCVForUnityExample.apk

Двоичный файл не отображается.

Двоичные данные
GoogleVRWithOpenCVForUnityExample.unitypackage

Двоичный файл не отображается.

Просмотреть файл

@ -10,21 +10,27 @@ Environment
-----
Windows 8.1
Unity 5.3.0f4
OpenCVForUnity2.0.9
GVR Unity SDK v1.0.3
OpenCVForUnity 2.1.6
MarkerBased AR Example 1.2.0
Google VR SDK for Unity v1.40.0
Setup
-----
* Create New Project. (GoogleVRMarkerBasedARExample)
* Import OpenCVForUnity2.0.9 from AssetStore (if iOS platform, please use "OpenCVForUnity/Extra/ios_exclude_contrib.zip".)
* Import MarkerBased AR Example1.2.0 from AssetStore
* Import GoogleVRForUnity.unitypackage
* Fix a bug in multiple cameras in GVR SDK by applying the codes of the screenshot posted on [this page](https://github.com/googlevr/gvr-unity-sdk/issues/456).
![screenshot1](https://cloud.githubusercontent.com/assets/22044289/22729389/7f976b3e-ee1d-11e6-9586-0e14ba92e316.png)
![screenshot2](https://cloud.githubusercontent.com/assets/22044289/22729388/7f963692-ee1d-11e6-8d89-cf143da1c89e.png)
* Import OpenCVForUnity from AssetStore (if iOS platform, please use "OpenCVForUnity/Extra/ios_exclude_contrib.zip".)
* Import MarkerBased AR Example from AssetStore
* Import GoogleVRWithOpenCVForUnityExample.unitypackage
* Change Product Name. (GoogleVRMarkerBasedARExample)
* Change PlayerSettings.bundleIdentifier. (xxx.xxxxxxx.googlevrmarkerbasedarexample)
* Add the “Assets/GoogleVRWithOpenCVForUnityExample/Scenes/*.unity” files to “Scenes In Build” list in “Build Settings” window.
* Set In PlayerSettings, at the bottom under Settings for iOS, click Resolution and Presentation to expand that panel. Set the Default Orientation to Auto Rotation, and then uncheck all of the Allowed Orientations for Auto Rotation except for Landscape Left.
* [iOS]Set In PlayerSettings, at the bottom under Settings for iOS, click Resolution and Presentation to expand that panel. Set the Default Orientation to Auto Rotation, and then uncheck all of the Allowed Orientations for Auto Rotation except for Landscape Left.
* [Android]Remove "Assets/Plugin/Android/gvr_android_common.aar" file from builds. (See http://answers.unity3d.com/questions/1283008/android-unable-to-merge-android-manifest-error.html)
* Build and Deploy.
![ProjectWindow.jpg](ProjectWindow.jpg)
![MainCamera_Inspector.jpg](MainCamera_Inspector.jpg)
@ -34,9 +40,12 @@ Setup
![ARCamera_Inspector.jpg](ARCamera_Inspector.jpg)
Android Build
[Android] .apk file
-----
[GoogleVRWithOpenCVForUnityExample.apk](GoogleVRWithOpenCVForUnityExample.apk)
AR Marker
-----
![marker.png](marker.png)