Added VR libraries
This commit is contained in:
234
Assets/GoogleVR/Scripts/Headset/GvrHeadset.cs
Normal file
234
Assets/GoogleVR/Scripts/Headset/GvrHeadset.cs
Normal file
@@ -0,0 +1,234 @@
|
||||
// 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.
|
||||
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
|
||||
using Gvr.Internal;
|
||||
|
||||
/// Main entry point for Standalone headset APIs.
|
||||
///
|
||||
/// To use this API, use the GvrHeadset prefab. There can be only one
|
||||
/// such prefab in a scene.
|
||||
///
|
||||
/// This is a singleton object.
|
||||
[HelpURL("https://developers.google.com/vr/unity/reference/class/GvrHeadset")]
|
||||
public class GvrHeadset : MonoBehaviour {
|
||||
private static GvrHeadset instance;
|
||||
|
||||
private IHeadsetProvider headsetProvider;
|
||||
private HeadsetState headsetState;
|
||||
private IEnumerator standaloneUpdate;
|
||||
private WaitForEndOfFrame waitForEndOfFrame = new WaitForEndOfFrame();
|
||||
|
||||
// Delegates for GVR events.
|
||||
private OnSafetyRegionEvent safetyRegionDelegate;
|
||||
private OnRecenterEvent recenterDelegate;
|
||||
|
||||
// Delegate definitions.
|
||||
/// This delegate is called when the headset crosses the safety region boundary.
|
||||
public delegate void OnSafetyRegionEvent(bool enter);
|
||||
/// This delegate is called after the headset is recentered.
|
||||
/// |recenterType| indicates the reason recentering occurred.
|
||||
/// |recenterFlags| are flags related to recentering. See |GvrRecenterFlags|.
|
||||
/// |recenteredPosition| is the positional offset from the session start pose.
|
||||
/// |recenteredOrientation| is the rotational offset from the session start pose.
|
||||
public delegate void OnRecenterEvent(GvrRecenterEventType recenterType,
|
||||
GvrRecenterFlags recenterFlags,
|
||||
Vector3 recenteredPosition,
|
||||
Quaternion recenteredOrientation);
|
||||
|
||||
#region DELEGATE_HANDLERS
|
||||
public static event OnSafetyRegionEvent OnSafetyRegionChange {
|
||||
add {
|
||||
if (instance != null) {
|
||||
instance.safetyRegionDelegate += value;
|
||||
}
|
||||
}
|
||||
remove {
|
||||
if (instance != null) {
|
||||
instance.safetyRegionDelegate -= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static event OnRecenterEvent OnRecenter {
|
||||
add {
|
||||
if (instance != null) {
|
||||
instance.recenterDelegate += value;
|
||||
}
|
||||
}
|
||||
remove {
|
||||
if (instance != null) {
|
||||
instance.recenterDelegate -= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion // DELEGATE_HANDLERS
|
||||
|
||||
#region GVR_HEADSET_PROPERTIES
|
||||
/// Returns |true| if the current headset supports positionally tracked, 6DOF head poses.
|
||||
/// Returns |false| if only rotation-based head poses are supported.
|
||||
public static bool SupportsPositionalTracking {
|
||||
get {
|
||||
if (instance == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return instance.headsetProvider.SupportsPositionalTracking;
|
||||
}
|
||||
catch(Exception e) {
|
||||
Debug.LogError("Error reading SupportsPositionalTracking: " + e.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// If a floor is found, populates floorHeight with the detected height.
|
||||
/// Otherwise, leaves the value unchanged.
|
||||
/// Returns true if value retrieval was successful, false otherwise (depends on tracking state).
|
||||
public static bool TryGetFloorHeight(ref float floorHeight) {
|
||||
if (instance == null) {
|
||||
return false;
|
||||
}
|
||||
return instance.headsetProvider.TryGetFloorHeight(ref floorHeight);
|
||||
}
|
||||
|
||||
/// If the last recentering transform is available, populates position and rotation with that
|
||||
/// transform.
|
||||
/// Returns true if value retrieval was successful, false otherwise (unlikely).
|
||||
public static bool TryGetRecenterTransform(ref Vector3 position, ref Quaternion rotation) {
|
||||
if (instance == null) {
|
||||
return false;
|
||||
}
|
||||
return instance.headsetProvider.TryGetRecenterTransform(ref position, ref rotation);
|
||||
}
|
||||
|
||||
/// Populates safetyType with the available safety region feature on the
|
||||
/// currently-running device.
|
||||
/// Returns true if value retrieval was successful, false otherwise (unlikely).
|
||||
public static bool TryGetSafetyRegionType(ref GvrSafetyRegionType safetyType) {
|
||||
if (instance == null) {
|
||||
return false;
|
||||
}
|
||||
return instance.headsetProvider.TryGetSafetyRegionType(ref safetyType);
|
||||
}
|
||||
|
||||
/// If the safety region is of type GvrSafetyRegionType.Cylinder, populates innerRadius with the
|
||||
/// inner radius size (where fog starts appearing) of the safety cylinder in meters.
|
||||
/// Assumes the safety region type has been previously checked by the caller.
|
||||
/// Returns true if value retrieval was successful, false otherwise (if region type is
|
||||
/// GvrSafetyRegionType.Invalid).
|
||||
public static bool TryGetSafetyCylinderInnerRadius(ref float innerRadius) {
|
||||
if (instance == null) {
|
||||
return false;
|
||||
}
|
||||
return instance.headsetProvider.TryGetSafetyCylinderInnerRadius(ref innerRadius);
|
||||
}
|
||||
|
||||
/// If the safety region is of type GvrSafetyRegionType.Cylinder, populates outerRadius with the
|
||||
/// outer radius size (where fog is 100% opaque) of the safety cylinder in meters.
|
||||
/// Assumes the safety region type has been previously checked by the caller.
|
||||
/// Returns true if value retrieval was successful, false otherwise (if region type is
|
||||
/// GvrSafetyRegionType.Invalid).
|
||||
public static bool TryGetSafetyCylinderOuterRadius(ref float outerRadius) {
|
||||
if (instance == null) {
|
||||
return false;
|
||||
}
|
||||
return instance.headsetProvider.TryGetSafetyCylinderOuterRadius(ref outerRadius);
|
||||
}
|
||||
#endregion // GVR_HEADSET_PROPERTIES
|
||||
|
||||
private GvrHeadset() {
|
||||
headsetState.Initialize();
|
||||
}
|
||||
|
||||
void Awake() {
|
||||
if (instance != null) {
|
||||
Debug.LogError("More than one GvrHeadset instance was found in your scene. "
|
||||
+ "Ensure that there is only one GvrHeadset.");
|
||||
this.enabled = false;
|
||||
return;
|
||||
}
|
||||
instance = this;
|
||||
if (headsetProvider == null) {
|
||||
headsetProvider = HeadsetProviderFactory.CreateProvider();
|
||||
}
|
||||
}
|
||||
|
||||
void OnEnable() {
|
||||
if (!SupportsPositionalTracking) {
|
||||
return;
|
||||
}
|
||||
standaloneUpdate = EndOfFrame();
|
||||
StartCoroutine(standaloneUpdate);
|
||||
}
|
||||
|
||||
void OnDisable() {
|
||||
if (!SupportsPositionalTracking) {
|
||||
return;
|
||||
}
|
||||
StopCoroutine(standaloneUpdate);
|
||||
}
|
||||
|
||||
void OnDestroy() {
|
||||
if (!SupportsPositionalTracking) {
|
||||
return;
|
||||
}
|
||||
instance = null;
|
||||
}
|
||||
|
||||
private void UpdateStandalone() {
|
||||
// Events are stored in a queue, so poll until we get Invalid.
|
||||
headsetProvider.PollEventState(ref headsetState);
|
||||
while (headsetState.eventType != GvrEventType.Invalid) {
|
||||
switch (headsetState.eventType) {
|
||||
case GvrEventType.Recenter:
|
||||
if (recenterDelegate != null) {
|
||||
recenterDelegate(headsetState.recenterEventType,
|
||||
(GvrRecenterFlags) headsetState.recenterEventFlags,
|
||||
headsetState.recenteredPosition,
|
||||
headsetState.recenteredRotation);
|
||||
}
|
||||
break;
|
||||
case GvrEventType.SafetyRegionEnter:
|
||||
if (safetyRegionDelegate != null) {
|
||||
safetyRegionDelegate(true);
|
||||
}
|
||||
break;
|
||||
case GvrEventType.SafetyRegionExit:
|
||||
if (safetyRegionDelegate != null) {
|
||||
safetyRegionDelegate(false);
|
||||
}
|
||||
break;
|
||||
case GvrEventType.Invalid:
|
||||
throw new InvalidEnumArgumentException("Invalid headset event: " + headsetState.eventType);
|
||||
default: // Fallthrough, should never get here.
|
||||
break;
|
||||
}
|
||||
headsetProvider.PollEventState(ref headsetState);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator EndOfFrame() {
|
||||
while (true) {
|
||||
// This must be done at the end of the frame to ensure that all GameObjects had a chance
|
||||
// to read transient state (e.g. events, etc) for the current frame before it gets reset.
|
||||
yield return waitForEndOfFrame;
|
||||
UpdateStandalone();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/GoogleVR/Scripts/Headset/GvrHeadset.cs.meta
Normal file
12
Assets/GoogleVR/Scripts/Headset/GvrHeadset.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ecd9463bbd7994be09b972947a085067
|
||||
timeCreated: 1498190966
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
48
Assets/GoogleVR/Scripts/Headset/GvrHeadsetEnums.cs
Normal file
48
Assets/GoogleVR/Scripts/Headset/GvrHeadsetEnums.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
// 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.
|
||||
|
||||
// Maps to gvr_event_type in the C API.
|
||||
public enum GvrEventType {
|
||||
Invalid = -1, // Not in the C API.
|
||||
Recenter = 1,
|
||||
SafetyRegionExit = 2,
|
||||
SafetyRegionEnter = 3,
|
||||
};
|
||||
|
||||
// Maps to gvr_recenter_event_type in the C API.
|
||||
public enum GvrRecenterEventType {
|
||||
Invalid = -1, // Not in the C API.
|
||||
RecenterEventRestart = 1, // Headset removal / re-attach recenter.
|
||||
RecenterEventAligned = 2, // Controller-initiated recenter.
|
||||
};
|
||||
|
||||
// Placeholder. No C spec for recenter flags yet.
|
||||
public enum GvrRecenterFlags {
|
||||
None = 0,
|
||||
}
|
||||
|
||||
// Maps to gvr_error in the C API.
|
||||
public enum GvrErrorType {
|
||||
None = 0,
|
||||
ControllerCreateFailed = 2,
|
||||
NoFrameAavilable = 3,
|
||||
NoEventAvailable = 1000000,
|
||||
NoPropertyAvailable = 1000001,
|
||||
};
|
||||
|
||||
// Maps to gvr_safety_region_type in the C API.
|
||||
public enum GvrSafetyRegionType {
|
||||
None = 0,
|
||||
Cylinder = 1,
|
||||
};
|
||||
12
Assets/GoogleVR/Scripts/Headset/GvrHeadsetEnums.cs.meta
Normal file
12
Assets/GoogleVR/Scripts/Headset/GvrHeadsetEnums.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c39c9ce1c4cb949db8dc00fc0750f708
|
||||
timeCreated: 1498190965
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/GoogleVR/Scripts/Headset/Internal.meta
Normal file
8
Assets/GoogleVR/Scripts/Headset/Internal.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: adc010da5d914b042a8f72f76dca56f9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,45 @@
|
||||
// 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.
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
/// @cond
|
||||
namespace Gvr.Internal {
|
||||
/// Factory that provides a concrete implementation of IHeadsetProvider for the
|
||||
/// current platform.
|
||||
static class HeadsetProviderFactory {
|
||||
/// Provides a concrete implementation of IHeadsetProvider appropriate for the current
|
||||
/// platform. This method never returns null. In the worst case, it might return a dummy
|
||||
/// provider if the platform is not supported. For demo purposes the emulator controller
|
||||
/// is returned in the editor and in Unity Standalone (desktop) builds, for use inside the
|
||||
/// desktop player.
|
||||
static internal IHeadsetProvider CreateProvider() {
|
||||
// Use emualtor in editor, GVR SDK support on Android standalone headsets, and a
|
||||
// dummy implementation otherwise..
|
||||
#if UNITY_EDITOR
|
||||
return new EditorHeadsetProvider();
|
||||
#elif UNITY_ANDROID
|
||||
// Use the GVR C API.
|
||||
return new AndroidNativeHeadsetProvider();
|
||||
#else
|
||||
// Platform not supported.
|
||||
Debug.LogWarning("No Google VR standalone headset / 6DOF support on " +
|
||||
Application.platform + " platform.");
|
||||
return new DummyHeadsetProvider();
|
||||
#endif // UNITY_EDITOR || UNITY_ANDROID
|
||||
}
|
||||
}
|
||||
}
|
||||
/// @endcond
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a8761daaa87949d9bfee83827f1cf81
|
||||
timeCreated: 1498369166
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1525d0b77f9bb764aa7e125b73490471
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,56 @@
|
||||
// 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.
|
||||
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
/// @cond
|
||||
namespace Gvr.Internal {
|
||||
/// Maps to gvr_feature in the C API.
|
||||
internal enum gvr_feature {
|
||||
HeadPose6dof = 3,
|
||||
};
|
||||
|
||||
/// Maps to gvr_property_type in the C API.
|
||||
internal enum gvr_property_type {
|
||||
TrackingFloorHeight = 1, // float; GVR_PROPERTY_TRACKING_FLOOR_HEIGHT
|
||||
RecenterTransform = 2, // gvr_mat4f, GVR_PROPERTY_RECENTER_TRANSFORM
|
||||
SafetyRegion = 3, // int (gvr_safety_region_type), GVR_PROPERTY_SAFETY_REGION
|
||||
SafetyCylinderInnerRadius = 4, // float, GVR_PROPERTY_SAFETY_CYLINDER_INNER_RADIUS
|
||||
SafetyCylinderOuterRadius = 5, // float, GVR_PROPERTY_SAFETY_CYLINDER_OUTER_RADIUS
|
||||
};
|
||||
|
||||
/// Maps to gvr_value_type in the C API.
|
||||
internal enum gvr_value_type {
|
||||
None = 0,
|
||||
Float = 1,
|
||||
Double = 2,
|
||||
Int = 3,
|
||||
Int64 = 4,
|
||||
Flags = 5,
|
||||
Sizei = 6,
|
||||
Recti = 7,
|
||||
Rectf = 8,
|
||||
Vec2f = 9,
|
||||
Vec3f = 10,
|
||||
Quat = 11,
|
||||
Mat4f = 12,
|
||||
ClockTimePoint = 13,
|
||||
};
|
||||
|
||||
internal enum gvr_recenter_flags {
|
||||
None = 0,
|
||||
};
|
||||
}
|
||||
/// @endcond
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4768e786f437540fd9f7d0c0d5778312
|
||||
timeCreated: 1498382144
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,386 @@
|
||||
// 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.
|
||||
|
||||
// This provider is only available on an Android device.
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
using Gvr;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
#if UNITY_2017_2_OR_NEWER
|
||||
using UnityEngine.XR;
|
||||
#else
|
||||
using XRDevice = UnityEngine.VR.VRDevice;
|
||||
#endif // UNITY_2017_2_OR_NEWER
|
||||
|
||||
/// @cond
|
||||
namespace Gvr.Internal {
|
||||
class AndroidNativeHeadsetProvider : IHeadsetProvider {
|
||||
private IntPtr gvrContextPtr = XRDevice.GetNativePtr();
|
||||
private GvrValue gvrValue = new GvrValue();
|
||||
private gvr_event_header gvrEventHeader = new gvr_event_header();
|
||||
private gvr_recenter_event_data gvrRecenterEventData = new gvr_recenter_event_data();
|
||||
// |gvr_event| C struct is spec'd to be up to 512 bytes in size.
|
||||
private byte[] gvrEventBuffer = new byte[512];
|
||||
private GCHandle gvrEventHandle;
|
||||
private IntPtr gvrEventPtr;
|
||||
private IntPtr gvrPropertiesPtr;
|
||||
private int supportsPositionalTracking = -1;
|
||||
|
||||
/// Used only as a temporary placeholder to avoid allocations.
|
||||
/// Do not use this for storing state.
|
||||
private MutablePose3D transientRecenteredPose3d = new MutablePose3D();
|
||||
|
||||
private readonly Matrix4x4 MATRIX4X4_IDENTITY = Matrix4x4.identity;
|
||||
|
||||
public bool SupportsPositionalTracking {
|
||||
get {
|
||||
if (supportsPositionalTracking < 0) {
|
||||
supportsPositionalTracking =
|
||||
gvr_is_feature_supported(gvrContextPtr, (int)gvr_feature.HeadPose6dof) ? 1 : 0;
|
||||
}
|
||||
return supportsPositionalTracking > 0;
|
||||
}
|
||||
}
|
||||
|
||||
internal AndroidNativeHeadsetProvider() {
|
||||
gvrEventHandle = GCHandle.Alloc(gvrEventBuffer, GCHandleType.Pinned);
|
||||
gvrEventPtr = gvrEventHandle.AddrOfPinnedObject();
|
||||
}
|
||||
|
||||
~AndroidNativeHeadsetProvider() {
|
||||
gvrEventHandle.Free();
|
||||
}
|
||||
|
||||
public void PollEventState(ref HeadsetState state) {
|
||||
GvrErrorType eventType;
|
||||
try {
|
||||
eventType = (GvrErrorType)gvr_poll_event(gvrContextPtr, gvrEventPtr);
|
||||
} catch (EntryPointNotFoundException) {
|
||||
Debug.LogError("GvrHeadset not supported by this version of Unity. " +
|
||||
"Support starts in 5.6.3p3 and 2017.1.1p1.");
|
||||
throw;
|
||||
}
|
||||
if (eventType == GvrErrorType.NoEventAvailable) {
|
||||
state.eventType = GvrEventType.Invalid;
|
||||
return;
|
||||
}
|
||||
|
||||
Marshal.PtrToStructure(gvrEventPtr, gvrEventHeader);
|
||||
state.eventFlags = gvrEventHeader.flags;
|
||||
state.eventTimestampNs = gvrEventHeader.timestamp;
|
||||
state.eventType = (GvrEventType) gvrEventHeader.type;
|
||||
// Event data begins after header.
|
||||
IntPtr eventDataPtr = new IntPtr(gvrEventPtr.ToInt64() + Marshal.SizeOf(gvrEventHeader));
|
||||
|
||||
if (state.eventType == GvrEventType.Recenter) {
|
||||
Marshal.PtrToStructure(eventDataPtr, gvrRecenterEventData);
|
||||
_HandleRecenterEvent(ref state, gvrRecenterEventData);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetFloorHeight(ref float floorHeight) {
|
||||
if (!_GvrGetProperty(gvr_property_type.TrackingFloorHeight, gvrValue)) {
|
||||
return false;
|
||||
}
|
||||
floorHeight = gvrValue.ToFloat();
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryGetRecenterTransform(ref Vector3 position, ref Quaternion rotation) {
|
||||
if (!_GvrGetProperty(gvr_property_type.RecenterTransform, gvrValue)) {
|
||||
return false;
|
||||
}
|
||||
transientRecenteredPose3d.Set(gvrValue.ToMatrix4x4());
|
||||
position = transientRecenteredPose3d.Position;
|
||||
rotation = transientRecenteredPose3d.Orientation;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryGetSafetyRegionType(ref GvrSafetyRegionType safetyType) {
|
||||
if (!_GvrGetProperty(gvr_property_type.SafetyRegion, gvrValue)) {
|
||||
return false;
|
||||
}
|
||||
safetyType = (GvrSafetyRegionType) gvrValue.ToInt32();
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryGetSafetyCylinderInnerRadius(ref float innerRadius) {
|
||||
if (!_GvrGetProperty(gvr_property_type.SafetyCylinderInnerRadius, gvrValue)) {
|
||||
return false;
|
||||
}
|
||||
innerRadius = gvrValue.ToFloat();
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryGetSafetyCylinderOuterRadius(ref float outerRadius) {
|
||||
if (!_GvrGetProperty(gvr_property_type.SafetyCylinderOuterRadius, gvrValue)) {
|
||||
return false;
|
||||
}
|
||||
outerRadius = gvrValue.ToFloat();
|
||||
return true;
|
||||
}
|
||||
|
||||
#region PRIVATE_HELPERS
|
||||
/// Returns true if a property was available and retrieved.
|
||||
private bool _GvrGetProperty(gvr_property_type propertyType, GvrValue valueOut) {
|
||||
gvr_value_type valueType = GetPropertyValueType(propertyType);
|
||||
if (valueType == gvr_value_type.None) {
|
||||
Debug.LogError("Unknown gvr property " + propertyType + ". Unable to type check.");
|
||||
}
|
||||
|
||||
if (gvrPropertiesPtr == IntPtr.Zero) {
|
||||
try {
|
||||
gvrPropertiesPtr = gvr_get_current_properties(gvrContextPtr);
|
||||
} catch (EntryPointNotFoundException) {
|
||||
Debug.LogError("GvrHeadset not supported by this version of Unity. " +
|
||||
"Support starts in 5.6.3p3 and 2017.1.1p1.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
if (gvrPropertiesPtr == IntPtr.Zero) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Assumes that gvr_properties_get (C API) will only ever return
|
||||
// GvrErrorType.None or GvrErrorType.NoEventAvailable.
|
||||
bool success =
|
||||
(GvrErrorType.None ==
|
||||
(GvrErrorType) gvr_properties_get(gvrPropertiesPtr, propertyType, valueOut.BufferPtr));
|
||||
if (success) {
|
||||
valueOut.Parse();
|
||||
success = (valueType == gvr_value_type.None || valueOut.TypeEnum == valueType);
|
||||
if (!success) {
|
||||
Debug.LogError("GvrGetProperty " + propertyType + " type mismatch, expected "
|
||||
+ valueType + " got " + valueOut.TypeEnum);
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
private void _HandleRecenterEvent(ref HeadsetState state, gvr_recenter_event_data eventData) {
|
||||
state.recenterEventType = (GvrRecenterEventType) eventData.recenter_event_type;
|
||||
state.recenterEventFlags = eventData.recenter_event_flags;
|
||||
|
||||
Matrix4x4 poseTransform = MATRIX4X4_IDENTITY;
|
||||
float[] poseRaw = eventData.pose_transform;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int j = i * 4;
|
||||
Vector4 row = new Vector4(poseRaw[j], poseRaw[j + 1], poseRaw[j + 2], poseRaw[j + 3]);
|
||||
poseTransform.SetRow(i, row);
|
||||
}
|
||||
|
||||
// Invert the matrix to go from row-major (GVR) to column-major (Unity),
|
||||
// and change from LHS to RHS coordinates.
|
||||
transientRecenteredPose3d.SetRightHanded(poseTransform.transpose);
|
||||
state.recenteredPosition = transientRecenteredPose3d.Position;
|
||||
state.recenteredRotation = transientRecenteredPose3d.Orientation;
|
||||
}
|
||||
#endregion // PRIVATE_HELPERS
|
||||
|
||||
#region GVR_TYPE_HELPERS
|
||||
private gvr_value_type GetPropertyValueType(gvr_property_type propertyType) {
|
||||
gvr_value_type propType = gvr_value_type.None;
|
||||
switch(propertyType) {
|
||||
case gvr_property_type.TrackingFloorHeight:
|
||||
propType = gvr_value_type.Float;
|
||||
break;
|
||||
case gvr_property_type.RecenterTransform:
|
||||
propType = gvr_value_type.Mat4f;
|
||||
break;
|
||||
case gvr_property_type.SafetyRegion:
|
||||
propType = gvr_value_type.Int;
|
||||
break;
|
||||
case gvr_property_type.SafetyCylinderInnerRadius:
|
||||
propType = gvr_value_type.Float;
|
||||
break;
|
||||
case gvr_property_type.SafetyCylinderOuterRadius:
|
||||
propType = gvr_value_type.Float;
|
||||
break;
|
||||
}
|
||||
return propType;
|
||||
}
|
||||
|
||||
/// Helper class to parse |gvr_value| structs into the varied data types it could contain.
|
||||
/// NOTE: Does NO type checking on value conversions. |_GvrGetProperty| checks types.
|
||||
private class GvrValue {
|
||||
private static readonly int HEADER_SIZE = Marshal.SizeOf(typeof(gvr_value_header));
|
||||
private gvr_value_header valueHeader = new gvr_value_header();
|
||||
// |gvr_value| C struct is spec'd to be up to 256 bytes in size.
|
||||
private byte[] buffer = new byte[256];
|
||||
private IntPtr bufferPtr;
|
||||
private IntPtr valuePtr;
|
||||
private GCHandle bufferHandle;
|
||||
|
||||
public GvrValue() {
|
||||
bufferHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
|
||||
bufferPtr = bufferHandle.AddrOfPinnedObject();
|
||||
// Value portion starts after the header.
|
||||
valuePtr = new IntPtr(bufferPtr.ToInt64() + HEADER_SIZE);
|
||||
}
|
||||
|
||||
~GvrValue() {
|
||||
bufferHandle.Free();
|
||||
}
|
||||
|
||||
/// Gets the ptr to a buffer that can be used as an argument to |gvr_properties_get|.
|
||||
public IntPtr BufferPtr {
|
||||
get {
|
||||
return bufferPtr;
|
||||
}
|
||||
}
|
||||
|
||||
public gvr_value_type TypeEnum {
|
||||
get {
|
||||
return valueHeader.value_type;
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse the header of the current buffer. This should be called after the contents of
|
||||
/// the buffer have been altered e.g. by a call to |gvr_properties_get|.
|
||||
public void Parse() {
|
||||
Marshal.PtrToStructure(bufferPtr, valueHeader);
|
||||
}
|
||||
|
||||
public int ToInt32() {
|
||||
return BitConverter.ToInt32(buffer, HEADER_SIZE);
|
||||
}
|
||||
|
||||
public long ToInt64() {
|
||||
return BitConverter.ToInt64(buffer, HEADER_SIZE);
|
||||
}
|
||||
|
||||
public float ToFloat() {
|
||||
return BitConverter.ToSingle(buffer, HEADER_SIZE);
|
||||
}
|
||||
|
||||
public double ToDouble() {
|
||||
return BitConverter.ToDouble(buffer, HEADER_SIZE);
|
||||
}
|
||||
|
||||
public Vector2 ToVector2() {
|
||||
return (Vector2) Marshal.PtrToStructure(valuePtr, typeof(Vector2));
|
||||
}
|
||||
|
||||
public Vector3 ToVector3() {
|
||||
return (Vector3) Marshal.PtrToStructure(valuePtr, typeof(Vector3));
|
||||
}
|
||||
|
||||
public Vector4 ToVector4() {
|
||||
return (Vector4) Marshal.PtrToStructure(valuePtr, typeof(Vector4));
|
||||
}
|
||||
|
||||
public Quaternion ToQuaternion() {
|
||||
return (Quaternion) Marshal.PtrToStructure(valuePtr, typeof(Quaternion));
|
||||
}
|
||||
|
||||
public gvr_rectf ToGvrRectf() {
|
||||
return (gvr_rectf) Marshal.PtrToStructure(valuePtr, typeof(gvr_rectf));
|
||||
}
|
||||
|
||||
public gvr_recti ToGvrRecti() {
|
||||
return (gvr_recti) Marshal.PtrToStructure(valuePtr, typeof(gvr_recti));
|
||||
}
|
||||
|
||||
public Matrix4x4 ToMatrix4x4() {
|
||||
Matrix4x4 mat4 = (Matrix4x4) Marshal.PtrToStructure(valuePtr, typeof(Matrix4x4));
|
||||
// Transpose the matrix from row-major (GVR) to column-major (Unity),
|
||||
// and change from LHS to RHS coordinates.
|
||||
return Pose3D.FlipHandedness(mat4.transpose);
|
||||
}
|
||||
}
|
||||
#endregion // GVR_TYPE_HELPERS
|
||||
|
||||
#region GVR_NATIVE_STRUCTS
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private class gvr_recenter_event_data {
|
||||
internal int recenter_event_type; // gvr_recenter_event_type
|
||||
internal uint recenter_event_flags; // gvr_flags
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=16)]
|
||||
internal float[] pose_transform = new float[16]; // gvr_mat4f = float[4][4]
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
private class gvr_event_header {
|
||||
[FieldOffset(0)]
|
||||
internal long timestamp;
|
||||
|
||||
[FieldOffset(8)]
|
||||
internal int type; // gvr_event_type
|
||||
|
||||
[FieldOffset(12)]
|
||||
internal int flags; // gvr_flags
|
||||
|
||||
// Event specific data starts at offset 16.
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
private class gvr_value_header {
|
||||
[FieldOffset(0)]
|
||||
internal gvr_value_type value_type;
|
||||
|
||||
[FieldOffset(4)]
|
||||
internal int flags; // gvr_flags
|
||||
|
||||
// Value data starts at offset 8.
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct gvr_sizei {
|
||||
internal int width;
|
||||
internal int height;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct gvr_recti {
|
||||
internal int left;
|
||||
internal int right;
|
||||
internal int bottom;
|
||||
internal int top;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct gvr_rectf {
|
||||
internal float left;
|
||||
internal float right;
|
||||
internal float bottom;
|
||||
internal float top;
|
||||
}
|
||||
|
||||
|
||||
#endregion // GVR_NATIVE_STRUCTS
|
||||
|
||||
#region GVR_C_API
|
||||
private const string DLL_NAME = GvrActivityHelper.GVR_DLL_NAME;
|
||||
|
||||
[DllImport(DLL_NAME)]
|
||||
private static extern bool gvr_is_feature_supported(IntPtr gvr_context, int feature);
|
||||
|
||||
[DllImport(DLL_NAME)]
|
||||
private static extern int gvr_poll_event(IntPtr gvr_context, IntPtr event_out);
|
||||
|
||||
[DllImport(DLL_NAME)]
|
||||
private static extern IntPtr gvr_get_current_properties(IntPtr gvr_context);
|
||||
|
||||
[DllImport(DLL_NAME)]
|
||||
private static extern int gvr_properties_get(
|
||||
IntPtr gvr_properties, gvr_property_type property_type, IntPtr value_out);
|
||||
#endregion // GVR_C_API
|
||||
}
|
||||
}
|
||||
/// @endcond
|
||||
#endif // UNITY_ANDROID && !UNITY_EDITOR
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e39841bba8ebf4707aff759a1690a400
|
||||
timeCreated: 1498369167
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,50 @@
|
||||
// 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.
|
||||
|
||||
using Gvr;
|
||||
using UnityEngine;
|
||||
|
||||
/// Used for platforms that do not support the GoogleVR standalone headset (6DOF).
|
||||
/// @cond
|
||||
namespace Gvr.Internal {
|
||||
class DummyHeadsetProvider : IHeadsetProvider {
|
||||
private HeadsetState dummyState;
|
||||
|
||||
public bool SupportsPositionalTracking { get { return false; } }
|
||||
|
||||
public void PollEventState(ref HeadsetState state) { }
|
||||
|
||||
public bool TryGetFloorHeight(ref float floorHeight) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetRecenterTransform(
|
||||
ref Vector3 position, ref Quaternion rotation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetSafetyRegionType(ref GvrSafetyRegionType safetyType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetSafetyCylinderInnerRadius(ref float innerRadius) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetSafetyCylinderOuterRadius(ref float outerRadius) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// @endcond
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fff2ffa71f4754593a63b4ebb799955e
|
||||
timeCreated: 1498369167
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,55 @@
|
||||
// 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.
|
||||
|
||||
using Gvr;
|
||||
using UnityEngine;
|
||||
|
||||
/// @cond
|
||||
namespace Gvr.Internal {
|
||||
class EditorHeadsetProvider : IHeadsetProvider {
|
||||
private HeadsetState dummyState;
|
||||
|
||||
public bool SupportsPositionalTracking { get { return true; } }
|
||||
|
||||
public void PollEventState(ref HeadsetState state) {
|
||||
// Emulation coming soon.
|
||||
}
|
||||
|
||||
public bool TryGetFloorHeight(ref float floorHeight) {
|
||||
floorHeight = -1.6f;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryGetRecenterTransform(
|
||||
ref Vector3 position, ref Quaternion rotation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryGetSafetyRegionType(ref GvrSafetyRegionType safetyType) {
|
||||
safetyType = GvrSafetyRegionType.Cylinder;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryGetSafetyCylinderInnerRadius(ref float innerRadius) {
|
||||
innerRadius = 0.6f;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryGetSafetyCylinderOuterRadius(ref float outerRadius) {
|
||||
outerRadius = 0.7f;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// @endcond
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19a9f6c7cb74d44bd9bbc87397789f7c
|
||||
timeCreated: 1498369166
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
47
Assets/GoogleVR/Scripts/Headset/Internal/HeadsetState.cs
Normal file
47
Assets/GoogleVR/Scripts/Headset/Internal/HeadsetState.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
// 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.
|
||||
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
using Gvr;
|
||||
|
||||
/// @cond
|
||||
namespace Gvr.Internal {
|
||||
// Internal representation of state for the headset.
|
||||
struct HeadsetState {
|
||||
internal GvrEventType eventType;
|
||||
internal int eventFlags;
|
||||
internal long eventTimestampNs; // Maps to gvr_clock_time_point monotonic_systemtime_nanos.
|
||||
|
||||
// Recenter event data.
|
||||
internal GvrRecenterEventType recenterEventType;
|
||||
internal uint recenterEventFlags;
|
||||
internal Vector3 recenteredPosition;
|
||||
internal Quaternion recenteredRotation;
|
||||
|
||||
public void Initialize() {
|
||||
eventType = GvrEventType.Invalid;
|
||||
eventFlags = 0;
|
||||
eventTimestampNs = 0;
|
||||
|
||||
recenterEventType = GvrRecenterEventType.Invalid;
|
||||
recenterEventFlags = 0;
|
||||
recenteredPosition = Vector3.zero;
|
||||
recenteredRotation = Quaternion.identity;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Gvr.Internal
|
||||
/// @endcond
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 127c2783105b84d52adbb2499339f572
|
||||
timeCreated: 1498369166
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
56
Assets/GoogleVR/Scripts/Headset/Internal/IHeadsetProvider.cs
Normal file
56
Assets/GoogleVR/Scripts/Headset/Internal/IHeadsetProvider.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
// 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.
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
/// @cond
|
||||
namespace Gvr.Internal {
|
||||
interface IHeadsetProvider {
|
||||
/// Returns whether the current headset supports positionally tracked, 6DOF head poses.
|
||||
bool SupportsPositionalTracking { get; }
|
||||
|
||||
/// Polls for GVR standalone events.
|
||||
void PollEventState(ref HeadsetState outState);
|
||||
|
||||
/// If a floor is found, populates floorHeight with the detected height.
|
||||
/// Otherwise, leaves the value unchanged.
|
||||
/// Returns true if value retrieval was successful, false otherwise (depends on tracking state).
|
||||
bool TryGetFloorHeight(ref float floorHeight);
|
||||
|
||||
/// If the last recentering transform is available, populates position and rotation with that
|
||||
/// transform.
|
||||
/// Returns true if value retrieval was successful, false otherwise (unlikely).
|
||||
bool TryGetRecenterTransform(ref Vector3 position, ref Quaternion rotation);
|
||||
|
||||
/// Populates safetyType with the available safety region feature on the
|
||||
/// currently-running device.
|
||||
/// Returns true if value retrieval was successful, false otherwise (unlikely).
|
||||
bool TryGetSafetyRegionType(ref GvrSafetyRegionType safetyType);
|
||||
|
||||
/// If the safety region is of type GvrSafetyRegionType.Cylinder, populates innerRadius with the
|
||||
/// inner radius size (where fog starts appearing) of the safety cylinder in meters.
|
||||
/// Assumes the safety region type has been previously checked by the caller.
|
||||
/// Returns true if value retrieval was successful, false otherwise (if region type is
|
||||
/// GvrSafetyRegionType.Invalid).
|
||||
bool TryGetSafetyCylinderInnerRadius(ref float innerRadius);
|
||||
|
||||
/// If the safety region is of type GvrSafetyRegionType.Cylinder, populates outerRadius with the
|
||||
/// outer radius size (where fog is 100% opaque) of the safety cylinder in meters.
|
||||
/// Assumes the safety region type has been previously checked by the caller.
|
||||
/// Returns true if value retrieval was successful, false otherwise (if region type is
|
||||
/// GvrSafetyRegionType.Invalid).
|
||||
bool TryGetSafetyCylinderOuterRadius(ref float outerRadius);
|
||||
}
|
||||
}
|
||||
/// @endcond
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5000c7de28ac497c8564ecb8d1f005d
|
||||
timeCreated: 1498369167
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user