Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

Commit

Permalink
Version 0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
smdol committed Jul 22, 2015
1 parent dc29f68 commit 91bdb1c
Show file tree
Hide file tree
Showing 33 changed files with 848 additions and 394 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,15 @@ v0.5 (5/28/2015):
- Added more phone and viewer profiles to the in-editor simulation menus.
- If native code distortion correction is not supported, fall back to using an Image Effect.
- If native code UI layer is not supported, fall back to rendering it in Unity.

v0.5.1 (7/22/2015):
- Screen timeout disabled in iOS apps.
- Reset VR Mode state on level load in case new scene does not have Cardboard.
- Return correct Input.touchCount.
- Crashing bug on certain models due to native code called PlatformInfo fixed.
- GazeInputModule can be used with the mouse as well as with the Cardboard trigger.
- Removed Simulate Distortion Correction flag in the Editor.
- No longer force screen brightness to max on Android.
- Removed the INTERNET permission from AndroidManifest.xml.
- Split the demos into a separate unitypackage.
- Ignore gyro drift setting on iOS (it doesn't need it).
15 changes: 3 additions & 12 deletions Cardboard/DemoScene/DemoScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -378,24 +378,16 @@ Prefab:
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11400012, guid: b8b03d395f5734e98af91ccf44f9bf47, type: 2}
propertyPath: tapIsTrigger
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: b8b03d395f5734e98af91ccf44f9bf47, type: 2}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11400012, guid: b8b03d395f5734e98af91ccf44f9bf47, type: 2}
propertyPath: neckModelScale
propertyPath: tapIsTrigger
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11400012, guid: b8b03d395f5734e98af91ccf44f9bf47, type: 2}
propertyPath: UseUnityRemoteInput
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11400012, guid: b8b03d395f5734e98af91ccf44f9bf47, type: 2}
propertyPath: deviceType
propertyPath: syncWithCardboardApp
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
Expand Down Expand Up @@ -2338,12 +2330,11 @@ MonoBehaviour:
vrModeEnabled: 1
enableAlignmentMarker: 1
enableSettingsButton: 1
TapIsTrigger: 1
tapIsTrigger: 1
neckModelScale: 1
autoDriftCorrection: 1
syncWithCardboardApp: 0
autoUntiltHead: 1
simulateDistortionCorrection: 1
UseUnityRemoteInput: 0
screenSize: 0
deviceType: 0
Expand Down
92 changes: 56 additions & 36 deletions Cardboard/Editor/CardboardEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,34 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System.Collections;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEditor;
using UnityEditor.Callbacks;

/// @ingroup EditorScripts
/// A custom editor for properties on the Cardboard script. This appears in the
/// Inspector window of a Cardboard object. Its purpose is to allow changing the
/// `Cardboard.SDK` object's properties from their default values.
[CustomEditor(typeof(Cardboard))]
[InitializeOnLoad]
public class CardboardEditor : Editor {
#if UNITY_IOS
GUIContent syncWithCardboardLabel = new GUIContent("Sync with Cardboard App",
"Enables the 'Sync with Google Cardboard' slider in the viewer settings dialog.");
#endif
GUIContent vrModeLabel = new GUIContent("VR Mode Enabled",
"Sets whether VR mode is enabled.");

GUIContent distortionCorrectionLabel = new GUIContent("Distortion Correction",
"Whether distortion correction is performed the SDK.");

GUIContent vrModeLabel = new GUIContent("VR Mode Enabled",
"Sets whether VR mode is enabled.");
GUIContent autoDriftCorrectionLabel = new GUIContent("Auto Drift Correction",
"When enabled, drift in the gyro readings is estimated and removed.");

GUIContent neckModelScaleLabel = new GUIContent("Neck Model Scale",
"The scale factor of the builtin neck model [0..1]. To disable, set to 0.");

#if UNITY_IOS
GUIContent syncWithCardboardLabel = new GUIContent("Sync with Cardboard App",
"Enables the 'Sync with Google Cardboard' slider in the viewer settings dialog.");
#endif

GUIContent alignmentMarkerLabel = new GUIContent("Alignment Marker",
"Whether to draw the alignment marker. The marker is a vertical line that splits " +
Expand All @@ -40,24 +50,15 @@ public class CardboardEditor : Editor {
"Google Cardboard app to allow the user to configure their individual " +
"settings and Cardboard headset parameters.");

GUIContent autoDriftCorrectionLabel = new GUIContent("Auto Drift Correction",
"When enabled, drift in the gyro readings is estimated and removed.");

GUIContent tapIsTriggerLabel = new GUIContent("Tap Is Trigger",
"Whether screen taps are treated as trigger events.");

GUIContent neckModelScaleLabel = new GUIContent("Neck Model Scale",
"The scale factor of the builtin neck model [0..1]. To disable, set to 0.");

GUIContent editorSettingsLabel = new GUIContent("Editor Mock Settings",
GUIContent editorSettingsLabel = new GUIContent("Unity Editor Emulation Settings",
"Controls for the in-editor emulation of Cardboard.");

GUIContent autoUntiltHeadLabel = new GUIContent("Auto Untilt Head",
"When enabled, just release Ctrl to untilt the head.");

GUIContent simulateDistortionLabel = new GUIContent("Simulate Distortion Correction",
"Whether to perform distortion correction in the editor.");

GUIContent screenSizeLabel = new GUIContent("Screen Size",
"The screen size to emulate.");

Expand All @@ -67,35 +68,39 @@ public class CardboardEditor : Editor {
public override void OnInspectorGUI() {
GUI.changed = false;

GUIStyle headingStyle = new GUIStyle(GUI.skin.label);
headingStyle.fontStyle = FontStyle.Bold;
headingStyle.fontSize = 14;

Cardboard cardboard = (Cardboard)target;

#if UNITY_IOS
cardboard.SyncWithCardboardApp =
EditorGUILayout.Toggle(syncWithCardboardLabel, cardboard.SyncWithCardboardApp);
#endif
EditorGUILayout.LabelField("General Settings", headingStyle);
cardboard.VRModeEnabled =
EditorGUILayout.Toggle(vrModeLabel, cardboard.VRModeEnabled);
cardboard.DistortionCorrection =
EditorGUILayout.Toggle(distortionCorrectionLabel, cardboard.DistortionCorrection);
cardboard.AutoDriftCorrection =
EditorGUILayout.Toggle(autoDriftCorrectionLabel, cardboard.AutoDriftCorrection);
cardboard.NeckModelScale =
EditorGUILayout.Slider(neckModelScaleLabel, cardboard.NeckModelScale, 0, 1);
EditorGUILayout.Separator();

EditorGUILayout.LabelField("Cardboard Settings", headingStyle);
#if UNITY_IOS
cardboard.SyncWithCardboardApp =
EditorGUILayout.Toggle(syncWithCardboardLabel, cardboard.SyncWithCardboardApp);
#endif
cardboard.EnableAlignmentMarker =
EditorGUILayout.Toggle(alignmentMarkerLabel, cardboard.EnableAlignmentMarker);
cardboard.EnableSettingsButton =
EditorGUILayout.Toggle(settingsButtonLabel, cardboard.EnableSettingsButton);
cardboard.AutoDriftCorrection =
EditorGUILayout.Toggle(autoDriftCorrectionLabel, cardboard.AutoDriftCorrection);
cardboard.TapIsTrigger =
EditorGUILayout.Toggle(tapIsTriggerLabel, cardboard.TapIsTrigger);
cardboard.NeckModelScale =
EditorGUILayout.Slider(neckModelScaleLabel, cardboard.NeckModelScale, 0, 1);

EditorGUILayout.Separator();

EditorGUILayout.LabelField(editorSettingsLabel);

EditorGUILayout.LabelField(editorSettingsLabel, headingStyle);
cardboard.autoUntiltHead =
EditorGUILayout.Toggle(autoUntiltHeadLabel, cardboard.autoUntiltHead);
cardboard.simulateDistortionCorrection =
EditorGUILayout.Toggle(simulateDistortionLabel, cardboard.simulateDistortionCorrection);
cardboard.ScreenSize = (CardboardProfile.ScreenSizes)
EditorGUILayout.EnumPopup(screenSizeLabel, cardboard.ScreenSize);
cardboard.DeviceType = (CardboardProfile.DeviceTypes)
Expand All @@ -116,13 +121,28 @@ public static void CheckGraphicsAPI(BuildTarget target, string path) {
}

private static void CheckGraphicsAPI() {
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iPhone
#if UNITY_IOS
#if UNITY_5 || UNITY_4_6 && !UNITY_4_6_1 && !UNITY_4_6_2
#if UNITY_5
var iOSBuildTarget = BuildTarget.iOS;
var iOSGraphicsAPIs = PlayerSettings.GetGraphicsAPIs(BuildTarget.iOS);
bool isOpenGL = true;
foreach (var device in iOSGraphicsAPIs) {
isOpenGL &= (device == GraphicsDeviceType.OpenGLES2 || device == GraphicsDeviceType.OpenGLES3);
}
#else
var iOSBuildTarget = BuildTarget.iPhone;
bool isOpenGL = PlayerSettings.targetIOSGraphics == TargetIOSGraphics.OpenGLES_2_0
|| PlayerSettings.targetIOSGraphics == TargetIOSGraphics.OpenGLES_3_0;
#endif // UNITY_5
if (EditorUserBuildSettings.activeBuildTarget == iOSBuildTarget
&& !Application.isPlaying
&& Object.FindObjectOfType<Cardboard>() != null
&& PlayerSettings.targetIOSGraphics != TargetIOSGraphics.OpenGLES_2_0
&& PlayerSettings.targetIOSGraphics != TargetIOSGraphics.OpenGLES_3_0) {
Debug.LogWarning("iOS Graphics API should be set to OpenGL for best distortion-"
+ "correction performance in Cardboard.");
&& !isOpenGL) {
Debug.LogWarning("iOS Graphics API should be set to OpenGL for best " +
"distortion-correction performance in Cardboard.");
}
#endif // UNITY_5 || UNITY_4_6 && !UNITY_4_6_1 && !UNITY_4_6_2
#endif // UNITY_IOS
}
}
7 changes: 6 additions & 1 deletion Cardboard/Editor/StereoControllerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@
using System.Collections;
using System.Linq;

/// @ingroup EditorScripts
/// A custom editor for the StereoController script. It exists to add the _Update
/// Stereo Cameras_ button to the StereoController's Inspector window, and to the
/// corresponding main menu entry and Camera context menu command. The usage of the
/// these actions is described in StereoController.
[CustomEditor(typeof(StereoController))]
public class StereoControllerEditor : Editor {
// Name of button, and part of "Undo ..." message.
/// Name of button, and part of "Undo ..." message.
public const string ACTION_NAME = "Update Stereo Cameras";

private GUIContent updateButton =
Expand Down
8 changes: 2 additions & 6 deletions Cardboard/Legacy/DemoScene/DemoScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1815,10 +1815,6 @@ Prefab:
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11432576, guid: a177aba586fa54700a4ceaac810edae9, type: 2}
propertyPath: distortionCorrection
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: a177aba586fa54700a4ceaac810edae9, type: 2}
m_RootGameObject: {fileID: 1832774123}
Expand Down Expand Up @@ -2025,11 +2021,11 @@ MonoBehaviour:
vrModeEnabled: 1
enableAlignmentMarker: 1
enableSettingsButton: 1
tapIsTrigger: 1
neckModelScale: 1
autoDriftCorrection: 1
escapeExitsApp: 0
autoUntiltHead: 1
simulateDistortionCorrection: 1
UseUnityRemoteInput: 0
screenSize: 0
deviceType: 0
--- !u!1 &1944093375
Expand Down
5 changes: 2 additions & 3 deletions Cardboard/Legacy/Prefabs/CardboardMain.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,11 @@ MonoBehaviour:
vrModeEnabled: 1
enableAlignmentMarker: 1
enableSettingsButton: 1
TapIsTrigger: 1
tapIsTrigger: 1
neckModelScale: 1
autoDriftCorrection: 1
BackButtonExitsApp: 0
autoUntiltHead: 1
simulateDistortionCorrection: 1
UseUnityRemoteInput: 0
screenSize: 0
deviceType: 0
--- !u!114 &11432578
Expand Down
32 changes: 32 additions & 0 deletions Cardboard/Legacy/Prefabs/LegacyPrefabs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Legacy Prefabs

This section describes the prefabs that are provided by the package for legacy
purposes.

## CardboardGUI

This prefab captures the _OnGUI_ pass of a frame into a texture. It draws the
texture on a quad in the scene, along with cursor image for the mouse pointer,
if you specify one. It can move the mouse by tracking the user's gaze and it
can read the trigger to "click" UI elements.

To use it, add an instance of the prefab to the scene. It should not be placed
under a `CardboardHead` if you want the user's gaze to control the mouse, but can
be if you use an alternative input device. The prefab contains one child called
GUIScreen, which by default draws the entire screen's OnGUI layer on a single
quad.

It is possible to add more such children to the CardboardGUI object. Just
duplicate the `GUIScreen` child in the Editor as needed, adjust each child's
_Rect_ to pick out a different region of the OnGUI layer, and set its
_Transform_ to place that region in the scene. In this way you can completely
rearrange the GUI layout when in VR Mode without changing any `OnGUI()` functions'
code or behavior.

`CardboardGUI` and its Window children have visibility controls that you can use
to convert a non-transient (i.e. always on) UI to a transient (popup) UI when in
VR Mode. Non-transient UI is usually placed along the edges of the screen,
which in HMD stereo systems are extremely hard to see. For VR Mode, you will
likely need to rearrange the UI to appear front-and-center, perhaps depending on
which way the user looks. This obscures the scene itself, unless the UI can be
hidden when not needed.
Loading

0 comments on commit 91bdb1c

Please sign in to comment.