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

Commit 91bdb1c

Browse files
committed
Version 0.5.1
1 parent dc29f68 commit 91bdb1c

33 files changed

+848
-394
lines changed

CHANGELOG

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,15 @@ v0.5 (5/28/2015):
6666
- Added more phone and viewer profiles to the in-editor simulation menus.
6767
- If native code distortion correction is not supported, fall back to using an Image Effect.
6868
- If native code UI layer is not supported, fall back to rendering it in Unity.
69+
70+
v0.5.1 (7/22/2015):
71+
- Screen timeout disabled in iOS apps.
72+
- Reset VR Mode state on level load in case new scene does not have Cardboard.
73+
- Return correct Input.touchCount.
74+
- Crashing bug on certain models due to native code called PlatformInfo fixed.
75+
- GazeInputModule can be used with the mouse as well as with the Cardboard trigger.
76+
- Removed Simulate Distortion Correction flag in the Editor.
77+
- No longer force screen brightness to max on Android.
78+
- Removed the INTERNET permission from AndroidManifest.xml.
79+
- Split the demos into a separate unitypackage.
80+
- Ignore gyro drift setting on iOS (it doesn't need it).

Cardboard/DemoScene/DemoScene.unity

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -378,24 +378,16 @@ Prefab:
378378
propertyPath: m_IsActive
379379
value: 1
380380
objectReference: {fileID: 0}
381-
- target: {fileID: 11400012, guid: b8b03d395f5734e98af91ccf44f9bf47, type: 2}
382-
propertyPath: tapIsTrigger
383-
value: 1
384-
objectReference: {fileID: 0}
385381
- target: {fileID: 400006, guid: b8b03d395f5734e98af91ccf44f9bf47, type: 2}
386382
propertyPath: m_RootOrder
387383
value: 1
388384
objectReference: {fileID: 0}
389385
- target: {fileID: 11400012, guid: b8b03d395f5734e98af91ccf44f9bf47, type: 2}
390-
propertyPath: neckModelScale
386+
propertyPath: tapIsTrigger
391387
value: 1
392388
objectReference: {fileID: 0}
393389
- target: {fileID: 11400012, guid: b8b03d395f5734e98af91ccf44f9bf47, type: 2}
394-
propertyPath: UseUnityRemoteInput
395-
value: 0
396-
objectReference: {fileID: 0}
397-
- target: {fileID: 11400012, guid: b8b03d395f5734e98af91ccf44f9bf47, type: 2}
398-
propertyPath: deviceType
390+
propertyPath: syncWithCardboardApp
399391
value: 0
400392
objectReference: {fileID: 0}
401393
m_RemovedComponents: []
@@ -2338,12 +2330,11 @@ MonoBehaviour:
23382330
vrModeEnabled: 1
23392331
enableAlignmentMarker: 1
23402332
enableSettingsButton: 1
2341-
TapIsTrigger: 1
2333+
tapIsTrigger: 1
23422334
neckModelScale: 1
23432335
autoDriftCorrection: 1
23442336
syncWithCardboardApp: 0
23452337
autoUntiltHead: 1
2346-
simulateDistortionCorrection: 1
23472338
UseUnityRemoteInput: 0
23482339
screenSize: 0
23492340
deviceType: 0

Cardboard/Editor/CardboardEditor.cs

Lines changed: 56 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,34 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
using System.Collections;
16-
using UnityEditor;
1715
using UnityEngine;
16+
using UnityEngine.Rendering;
17+
using UnityEditor;
1818
using UnityEditor.Callbacks;
1919

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

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

31-
GUIContent vrModeLabel = new GUIContent("VR Mode Enabled",
32-
"Sets whether VR mode is enabled.");
33+
GUIContent autoDriftCorrectionLabel = new GUIContent("Auto Drift Correction",
34+
"When enabled, drift in the gyro readings is estimated and removed.");
35+
36+
GUIContent neckModelScaleLabel = new GUIContent("Neck Model Scale",
37+
"The scale factor of the builtin neck model [0..1]. To disable, set to 0.");
38+
39+
#if UNITY_IOS
40+
GUIContent syncWithCardboardLabel = new GUIContent("Sync with Cardboard App",
41+
"Enables the 'Sync with Google Cardboard' slider in the viewer settings dialog.");
42+
#endif
3343

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

43-
GUIContent autoDriftCorrectionLabel = new GUIContent("Auto Drift Correction",
44-
"When enabled, drift in the gyro readings is estimated and removed.");
45-
4653
GUIContent tapIsTriggerLabel = new GUIContent("Tap Is Trigger",
4754
"Whether screen taps are treated as trigger events.");
4855

49-
GUIContent neckModelScaleLabel = new GUIContent("Neck Model Scale",
50-
"The scale factor of the builtin neck model [0..1]. To disable, set to 0.");
51-
52-
GUIContent editorSettingsLabel = new GUIContent("Editor Mock Settings",
56+
GUIContent editorSettingsLabel = new GUIContent("Unity Editor Emulation Settings",
5357
"Controls for the in-editor emulation of Cardboard.");
5458

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

58-
GUIContent simulateDistortionLabel = new GUIContent("Simulate Distortion Correction",
59-
"Whether to perform distortion correction in the editor.");
60-
6162
GUIContent screenSizeLabel = new GUIContent("Screen Size",
6263
"The screen size to emulate.");
6364

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

71+
GUIStyle headingStyle = new GUIStyle(GUI.skin.label);
72+
headingStyle.fontStyle = FontStyle.Bold;
73+
headingStyle.fontSize = 14;
74+
7075
Cardboard cardboard = (Cardboard)target;
7176

72-
#if UNITY_IOS
73-
cardboard.SyncWithCardboardApp =
74-
EditorGUILayout.Toggle(syncWithCardboardLabel, cardboard.SyncWithCardboardApp);
75-
#endif
77+
EditorGUILayout.LabelField("General Settings", headingStyle);
7678
cardboard.VRModeEnabled =
7779
EditorGUILayout.Toggle(vrModeLabel, cardboard.VRModeEnabled);
7880
cardboard.DistortionCorrection =
7981
EditorGUILayout.Toggle(distortionCorrectionLabel, cardboard.DistortionCorrection);
82+
cardboard.AutoDriftCorrection =
83+
EditorGUILayout.Toggle(autoDriftCorrectionLabel, cardboard.AutoDriftCorrection);
84+
cardboard.NeckModelScale =
85+
EditorGUILayout.Slider(neckModelScaleLabel, cardboard.NeckModelScale, 0, 1);
86+
EditorGUILayout.Separator();
87+
88+
EditorGUILayout.LabelField("Cardboard Settings", headingStyle);
89+
#if UNITY_IOS
90+
cardboard.SyncWithCardboardApp =
91+
EditorGUILayout.Toggle(syncWithCardboardLabel, cardboard.SyncWithCardboardApp);
92+
#endif
8093
cardboard.EnableAlignmentMarker =
8194
EditorGUILayout.Toggle(alignmentMarkerLabel, cardboard.EnableAlignmentMarker);
8295
cardboard.EnableSettingsButton =
8396
EditorGUILayout.Toggle(settingsButtonLabel, cardboard.EnableSettingsButton);
84-
cardboard.AutoDriftCorrection =
85-
EditorGUILayout.Toggle(autoDriftCorrectionLabel, cardboard.AutoDriftCorrection);
8697
cardboard.TapIsTrigger =
8798
EditorGUILayout.Toggle(tapIsTriggerLabel, cardboard.TapIsTrigger);
88-
cardboard.NeckModelScale =
89-
EditorGUILayout.Slider(neckModelScaleLabel, cardboard.NeckModelScale, 0, 1);
90-
9199
EditorGUILayout.Separator();
92100

93-
EditorGUILayout.LabelField(editorSettingsLabel);
94-
101+
EditorGUILayout.LabelField(editorSettingsLabel, headingStyle);
95102
cardboard.autoUntiltHead =
96103
EditorGUILayout.Toggle(autoUntiltHeadLabel, cardboard.autoUntiltHead);
97-
cardboard.simulateDistortionCorrection =
98-
EditorGUILayout.Toggle(simulateDistortionLabel, cardboard.simulateDistortionCorrection);
99104
cardboard.ScreenSize = (CardboardProfile.ScreenSizes)
100105
EditorGUILayout.EnumPopup(screenSizeLabel, cardboard.ScreenSize);
101106
cardboard.DeviceType = (CardboardProfile.DeviceTypes)
@@ -116,13 +121,28 @@ public static void CheckGraphicsAPI(BuildTarget target, string path) {
116121
}
117122

118123
private static void CheckGraphicsAPI() {
119-
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iPhone
124+
#if UNITY_IOS
125+
#if UNITY_5 || UNITY_4_6 && !UNITY_4_6_1 && !UNITY_4_6_2
126+
#if UNITY_5
127+
var iOSBuildTarget = BuildTarget.iOS;
128+
var iOSGraphicsAPIs = PlayerSettings.GetGraphicsAPIs(BuildTarget.iOS);
129+
bool isOpenGL = true;
130+
foreach (var device in iOSGraphicsAPIs) {
131+
isOpenGL &= (device == GraphicsDeviceType.OpenGLES2 || device == GraphicsDeviceType.OpenGLES3);
132+
}
133+
#else
134+
var iOSBuildTarget = BuildTarget.iPhone;
135+
bool isOpenGL = PlayerSettings.targetIOSGraphics == TargetIOSGraphics.OpenGLES_2_0
136+
|| PlayerSettings.targetIOSGraphics == TargetIOSGraphics.OpenGLES_3_0;
137+
#endif // UNITY_5
138+
if (EditorUserBuildSettings.activeBuildTarget == iOSBuildTarget
120139
&& !Application.isPlaying
121140
&& Object.FindObjectOfType<Cardboard>() != null
122-
&& PlayerSettings.targetIOSGraphics != TargetIOSGraphics.OpenGLES_2_0
123-
&& PlayerSettings.targetIOSGraphics != TargetIOSGraphics.OpenGLES_3_0) {
124-
Debug.LogWarning("iOS Graphics API should be set to OpenGL for best distortion-"
125-
+ "correction performance in Cardboard.");
141+
&& !isOpenGL) {
142+
Debug.LogWarning("iOS Graphics API should be set to OpenGL for best " +
143+
"distortion-correction performance in Cardboard.");
126144
}
145+
#endif // UNITY_5 || UNITY_4_6 && !UNITY_4_6_1 && !UNITY_4_6_2
146+
#endif // UNITY_IOS
127147
}
128148
}

Cardboard/Editor/StereoControllerEditor.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
using System.Collections;
1818
using System.Linq;
1919

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

2530
private GUIContent updateButton =

Cardboard/Legacy/DemoScene/DemoScene.unity

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,10 +1815,6 @@ Prefab:
18151815
propertyPath: m_RootOrder
18161816
value: 0
18171817
objectReference: {fileID: 0}
1818-
- target: {fileID: 11432576, guid: a177aba586fa54700a4ceaac810edae9, type: 2}
1819-
propertyPath: distortionCorrection
1820-
value: 1
1821-
objectReference: {fileID: 0}
18221818
m_RemovedComponents: []
18231819
m_ParentPrefab: {fileID: 100100000, guid: a177aba586fa54700a4ceaac810edae9, type: 2}
18241820
m_RootGameObject: {fileID: 1832774123}
@@ -2025,11 +2021,11 @@ MonoBehaviour:
20252021
vrModeEnabled: 1
20262022
enableAlignmentMarker: 1
20272023
enableSettingsButton: 1
2024+
tapIsTrigger: 1
20282025
neckModelScale: 1
20292026
autoDriftCorrection: 1
2030-
escapeExitsApp: 0
20312027
autoUntiltHead: 1
2032-
simulateDistortionCorrection: 1
2028+
UseUnityRemoteInput: 0
20332029
screenSize: 0
20342030
deviceType: 0
20352031
--- !u!1 &1944093375

Cardboard/Legacy/Prefabs/CardboardMain.prefab

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,11 @@ MonoBehaviour:
329329
vrModeEnabled: 1
330330
enableAlignmentMarker: 1
331331
enableSettingsButton: 1
332-
TapIsTrigger: 1
332+
tapIsTrigger: 1
333333
neckModelScale: 1
334334
autoDriftCorrection: 1
335-
BackButtonExitsApp: 0
336335
autoUntiltHead: 1
337-
simulateDistortionCorrection: 1
336+
UseUnityRemoteInput: 0
338337
screenSize: 0
339338
deviceType: 0
340339
--- !u!114 &11432578
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Legacy Prefabs
2+
3+
This section describes the prefabs that are provided by the package for legacy
4+
purposes.
5+
6+
## CardboardGUI
7+
8+
This prefab captures the _OnGUI_ pass of a frame into a texture. It draws the
9+
texture on a quad in the scene, along with cursor image for the mouse pointer,
10+
if you specify one. It can move the mouse by tracking the user's gaze and it
11+
can read the trigger to "click" UI elements.
12+
13+
To use it, add an instance of the prefab to the scene. It should not be placed
14+
under a `CardboardHead` if you want the user's gaze to control the mouse, but can
15+
be if you use an alternative input device. The prefab contains one child called
16+
GUIScreen, which by default draws the entire screen's OnGUI layer on a single
17+
quad.
18+
19+
It is possible to add more such children to the CardboardGUI object. Just
20+
duplicate the `GUIScreen` child in the Editor as needed, adjust each child's
21+
_Rect_ to pick out a different region of the OnGUI layer, and set its
22+
_Transform_ to place that region in the scene. In this way you can completely
23+
rearrange the GUI layout when in VR Mode without changing any `OnGUI()` functions'
24+
code or behavior.
25+
26+
`CardboardGUI` and its Window children have visibility controls that you can use
27+
to convert a non-transient (i.e. always on) UI to a transient (popup) UI when in
28+
VR Mode. Non-transient UI is usually placed along the edges of the screen,
29+
which in HMD stereo systems are extremely hard to see. For VR Mode, you will
30+
likely need to rearrange the UI to appear front-and-center, perhaps depending on
31+
which way the user looks. This obscures the scene itself, unless the UI can be
32+
hidden when not needed.

0 commit comments

Comments
 (0)