Browse Source

New demo w/Ryan w/ Brewster, Tim and letters.

testbranch
Unknown 4 years ago
parent
commit
e5db438221
100 changed files with 8 additions and 13244 deletions
  1. 0
    52
      Assets/ Leary-Folsom-New-Philosophy.mp4.meta
  2. 0
    10
      Assets/Materials.meta
  3. BIN
      Assets/New Terrain.asset
  4. 8
    0
      Assets/New Terrain.asset.meta
  5. 0
    34
      Assets/ProCore/ProBuilder/Data/ProBuilderPreferences.asset
  6. 0
    10
      Assets/SteamVR.meta
  7. 0
    6
      Assets/SteamVR/Editor.meta
  8. 0
    127
      Assets/SteamVR/Editor/SteamVR_Editor.cs
  9. 0
    9
      Assets/SteamVR/Editor/SteamVR_Editor.cs.meta
  10. 0
    48
      Assets/SteamVR/Editor/SteamVR_Preferences.cs
  11. 0
    12
      Assets/SteamVR/Editor/SteamVR_Preferences.cs.meta
  12. 0
    104
      Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs
  13. 0
    12
      Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs.meta
  14. 0
    688
      Assets/SteamVR/Editor/SteamVR_Settings.cs
  15. 0
    12
      Assets/SteamVR/Editor/SteamVR_Settings.cs.meta
  16. 0
    381
      Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs
  17. 0
    12
      Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs.meta
  18. 0
    170
      Assets/SteamVR/Editor/SteamVR_Update.cs
  19. 0
    12
      Assets/SteamVR/Editor/SteamVR_Update.cs.meta
  20. 0
    9
      Assets/SteamVR/Extras.meta
  21. 0
    88
      Assets/SteamVR/Extras/SteamVR_GazeTracker.cs
  22. 0
    12
      Assets/SteamVR/Extras/SteamVR_GazeTracker.cs.meta
  23. 0
    141
      Assets/SteamVR/Extras/SteamVR_LaserPointer.cs
  24. 0
    12
      Assets/SteamVR/Extras/SteamVR_LaserPointer.cs.meta
  25. 0
    98
      Assets/SteamVR/Extras/SteamVR_Teleporter.cs
  26. 0
    12
      Assets/SteamVR/Extras/SteamVR_Teleporter.cs.meta
  27. 0
    1852
      Assets/SteamVR/Extras/SteamVR_TestIK.unity
  28. 0
    8
      Assets/SteamVR/Extras/SteamVR_TestIK.unity.meta
  29. 0
    58
      Assets/SteamVR/Extras/SteamVR_TestThrow.cs
  30. 0
    12
      Assets/SteamVR/Extras/SteamVR_TestThrow.cs.meta
  31. 0
    2611
      Assets/SteamVR/Extras/SteamVR_TestThrow.unity
  32. 0
    8
      Assets/SteamVR/Extras/SteamVR_TestThrow.unity.meta
  33. 0
    84
      Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.cs
  34. 0
    12
      Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.cs.meta
  35. 0
    127
      Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.mat
  36. 0
    8
      Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.mat.meta
  37. 0
    749
      Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.unity
  38. 0
    8
      Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.unity.meta
  39. 0
    250
      Assets/SteamVR/Extras/SteamVR_TrackedController.cs
  40. 0
    12
      Assets/SteamVR/Extras/SteamVR_TrackedController.cs.meta
  41. 0
    9
      Assets/SteamVR/InteractionSystem.meta
  42. 0
    9
      Assets/SteamVR/InteractionSystem/Core.meta
  43. 0
    9
      Assets/SteamVR/InteractionSystem/Core/Icons.meta
  44. 0
    59
      Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system.png.meta
  45. 0
    55
      Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_feet.png.meta
  46. 0
    55
      Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand.png.meta
  47. 0
    55
      Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand_question.png.meta
  48. 0
    55
      Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand.png.meta
  49. 0
    55
      Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand_question.png.meta
  50. 0
    55
      Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_unknown_hand.png.meta
  51. 0
    9
      Assets/SteamVR/InteractionSystem/Core/Materials.meta
  52. 0
    138
      Assets/SteamVR/InteractionSystem/Core/Materials/FallbackHandIndicator.mat
  53. 0
    8
      Assets/SteamVR/InteractionSystem/Core/Materials/FallbackHandIndicator.mat.meta
  54. 0
    182
      Assets/SteamVR/InteractionSystem/Core/Materials/HoverHighlight.mat
  55. 0
    8
      Assets/SteamVR/InteractionSystem/Core/Materials/HoverHighlight.mat.meta
  56. 0
    213
      Assets/SteamVR/InteractionSystem/Core/Materials/SeeThru.mat
  57. 0
    8
      Assets/SteamVR/InteractionSystem/Core/Materials/SeeThru.mat.meta
  58. 0
    197
      Assets/SteamVR/InteractionSystem/Core/Materials/SteamVRControllerModel.mat
  59. 0
    8
      Assets/SteamVR/InteractionSystem/Core/Materials/SteamVRControllerModel.mat.meta
  60. 0
    9
      Assets/SteamVR/InteractionSystem/Core/Prefabs.meta
  61. 0
    111
      Assets/SteamVR/InteractionSystem/Core/Prefabs/BlankController.prefab
  62. 0
    8
      Assets/SteamVR/InteractionSystem/Core/Prefabs/BlankController.prefab.meta
  63. 0
    1446
      Assets/SteamVR/InteractionSystem/Core/Prefabs/Player.prefab
  64. 0
    8
      Assets/SteamVR/InteractionSystem/Core/Prefabs/Player.prefab.meta
  65. 0
    9
      Assets/SteamVR/InteractionSystem/Core/Scripts.meta
  66. 0
    35
      Assets/SteamVR/InteractionSystem/Core/Scripts/BodyCollider.cs
  67. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/BodyCollider.cs.meta
  68. 0
    529
      Assets/SteamVR/InteractionSystem/Core/Scripts/CircularDrive.cs
  69. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/CircularDrive.cs.meta
  70. 0
    190
      Assets/SteamVR/InteractionSystem/Core/Scripts/ComplexThrowable.cs
  71. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/ComplexThrowable.cs.meta
  72. 0
    197
      Assets/SteamVR/InteractionSystem/Core/Scripts/ControllerHoverHighlight.cs
  73. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/ControllerHoverHighlight.cs.meta
  74. 0
    28
      Assets/SteamVR/InteractionSystem/Core/Scripts/CustomEvents.cs
  75. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/CustomEvents.cs.meta
  76. 0
    48
      Assets/SteamVR/InteractionSystem/Core/Scripts/DebugUI.cs
  77. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/DebugUI.cs.meta
  78. 0
    22
      Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnDetachedFromHand.cs
  79. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnDetachedFromHand.cs.meta
  80. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnParticleSystemDeath.cs.meta
  81. 0
    38
      Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnTriggerEnter.cs
  82. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnTriggerEnter.cs.meta
  83. 0
    42
      Assets/SteamVR/InteractionSystem/Core/Scripts/DistanceHaptics.cs
  84. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/DistanceHaptics.cs.meta
  85. 0
    21
      Assets/SteamVR/InteractionSystem/Core/Scripts/DontDestroyOnLoad.cs
  86. 0
    9
      Assets/SteamVR/InteractionSystem/Core/Scripts/DontDestroyOnLoad.cs.meta
  87. 0
    32
      Assets/SteamVR/InteractionSystem/Core/Scripts/EnumFlags.cs
  88. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/EnumFlags.cs.meta
  89. 0
    96
      Assets/SteamVR/InteractionSystem/Core/Scripts/FallbackCameraController.cs
  90. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/FallbackCameraController.cs.meta
  91. 0
    917
      Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs
  92. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs.meta
  93. 0
    83
      Assets/SteamVR/InteractionSystem/Core/Scripts/HapticRack.cs
  94. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/HapticRack.cs.meta
  95. 0
    21
      Assets/SteamVR/InteractionSystem/Core/Scripts/HideOnHandFocusLost.cs
  96. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/HideOnHandFocusLost.cs.meta
  97. 0
    17
      Assets/SteamVR/InteractionSystem/Core/Scripts/IgnoreHovering.cs
  98. 0
    12
      Assets/SteamVR/InteractionSystem/Core/Scripts/IgnoreHovering.cs.meta
  99. 0
    79
      Assets/SteamVR/InteractionSystem/Core/Scripts/InputModule.cs
  100. 0
    0
      Assets/SteamVR/InteractionSystem/Core/Scripts/InputModule.cs.meta

+ 0
- 52
Assets/ Leary-Folsom-New-Philosophy.mp4.meta View File

@@ -1,52 +0,0 @@
fileFormatVersion: 2
guid: e19b32a5782474ea9ab268fceffb2e60
timeCreated: 1524551237
licenseType: Free
VideoClipImporter:
externalObjects: {}
serializedVersion: 2
useLegacyImporter: 0
quality: 0.5
isColorLinear: 0
originalWidth: 1280
originalHeight: 720
frameRange: 0
startFrame: -1
endFrame: -1
frameCount: 1942
frameRate: 29.970029830932617
colorSpace: 0
deinterlace: 0
sourceFileSize: 33507610
encodeAlpha: 0
sourceHasAlpha: 0
flipVertical: 0
flipHorizontal: 0
pixelAspectRatioNumerator: 1
pixelAspectRatioDenominator: 1
importAudio: 1
sourceAudioChannelCount: 0200
sourceAudioSampleRate: 44ac0000
targetSettings: {}
output:
format: 0
settings:
enableTranscoding: 0
codec: 0
resizeFormat: 0
aspectRatio: 0
customWidth: 1280
customHeight: 720
bitrateMode: 2
spatialQuality: 2
encodedWidth: 1280
encodedHeight: 720
encodedStartFrame: 0
encodedEndFrame: 1942
streamedResource:
source:
offset: 0
size: 33507610
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 10
Assets/Materials.meta View File

@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 5b265c170742a4b01b883a209bc1950a
folderAsset: yes
timeCreated: 1526016211
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/New Terrain.asset View File


+ 8
- 0
Assets/New Terrain.asset.meta View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6d09a6241b8362b448f0a7693fb40f00
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 15600000
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 34
Assets/ProCore/ProBuilder/Data/ProBuilderPreferences.asset View File

@@ -1,34 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 146836576, guid: 0472bdc8d6d15384d98f22ee34302f9c, type: 3}
m_Name: ProBuilderPreferences
m_EditorClassIdentifier:
m_Bool_keys: []
m_Int_keys:
- pbDefaultEditLevel
- pbDefaultSelectionMode
- pb_GIWorkflowMode
- pbDragSelectMode
- pbHandleAlignment
m_Float_keys:
- pbEditorScroll.x
- pbEditorScroll.y
m_String_keys: []
m_Color_keys: []
m_Material_keys: []
m_Bool_values:
m_Int_values: 0100000002000000000000000000000000000000
m_Float_values:
- 0
- 0
m_String_values: []
m_Color_values: []
m_Material_values: []

+ 0
- 10
Assets/SteamVR.meta View File

@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 651ac0f1477396b48a36c129ffb010c2
folderAsset: yes
timeCreated: 1513145165
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 6
Assets/SteamVR/Editor.meta View File

@@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: c33af0785775d7548b22541da37936fe
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:

+ 0
- 127
Assets/SteamVR/Editor/SteamVR_Editor.cs View File

@@ -1,127 +0,0 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Custom inspector display for SteamVR_Camera
//
//=============================================================================

using UnityEngine;
using UnityEditor;
using System.IO;

[CustomEditor(typeof(SteamVR_Camera)), CanEditMultipleObjects]
public class SteamVR_Editor : Editor
{
int bannerHeight = 150;
Texture logo;

SerializedProperty script, wireframe;

string GetResourcePath()
{
var ms = MonoScript.FromScriptableObject(this);
var path = AssetDatabase.GetAssetPath(ms);
path = Path.GetDirectoryName(path);
return path.Substring(0, path.Length - "Editor".Length) + "Textures/";
}

void OnEnable()
{
var resourcePath = GetResourcePath();

logo = AssetDatabase.LoadAssetAtPath<Texture2D>(resourcePath + "logo.png");

script = serializedObject.FindProperty("m_Script");

wireframe = serializedObject.FindProperty("wireframe");

foreach (SteamVR_Camera target in targets)
target.ForceLast();
}

public override void OnInspectorGUI()
{
serializedObject.Update();

var rect = GUILayoutUtility.GetRect(Screen.width - 38, bannerHeight, GUI.skin.box);
if (logo)
GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);

if (!Application.isPlaying)
{
var expand = false;
var collapse = false;
foreach (SteamVR_Camera target in targets)
{
if (AssetDatabase.Contains(target))
continue;
if (target.isExpanded)
collapse = true;
else
expand = true;
}

if (expand)
{
GUILayout.BeginHorizontal();
if (GUILayout.Button("Expand"))
{
foreach (SteamVR_Camera target in targets)
{
if (AssetDatabase.Contains(target))
continue;
if (!target.isExpanded)
{
target.Expand();
EditorUtility.SetDirty(target);
}
}
}
GUILayout.Space(18);
GUILayout.EndHorizontal();
}

if (collapse)
{
GUILayout.BeginHorizontal();
if (GUILayout.Button("Collapse"))
{
foreach (SteamVR_Camera target in targets)
{
if (AssetDatabase.Contains(target))
continue;
if (target.isExpanded)
{
target.Collapse();
EditorUtility.SetDirty(target);
}
}
}
GUILayout.Space(18);
GUILayout.EndHorizontal();
}
}

EditorGUILayout.PropertyField(script);
EditorGUILayout.PropertyField(wireframe);

serializedObject.ApplyModifiedProperties();
}

public static void ExportPackage()
{
AssetDatabase.ExportPackage(new string[] {
"Assets/SteamVR",
"Assets/Plugins/openvr_api.cs",
"Assets/Plugins/openvr_api.bundle",
"Assets/Plugins/x86/openvr_api.dll",
"Assets/Plugins/x86/steam_api.dll",
"Assets/Plugins/x86/libsteam_api.so",
"Assets/Plugins/x86_64/openvr_api.dll",
"Assets/Plugins/x86_64/steam_api.dll",
"Assets/Plugins/x86_64/libsteam_api.so",
"Assets/Plugins/x86_64/libopenvr_api.so",
}, "steamvr.unitypackage", ExportPackageOptions.Recurse);
EditorApplication.Exit(0);
}
}


+ 0
- 9
Assets/SteamVR/Editor/SteamVR_Editor.cs.meta View File

@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 5ba22c80948c94e44a82b9fd1b3abd0d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

+ 0
- 48
Assets/SteamVR/Editor/SteamVR_Preferences.cs View File

@@ -1,48 +0,0 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Preferences pane for how SteamVR plugin behaves.
//
//=============================================================================

using UnityEngine;
using UnityEditor;

public class SteamVR_Preferences
{
/// <summary>
/// Should SteamVR automatically enable VR when opening Unity or pressing play.
/// </summary>
public static bool AutoEnableVR
{
get
{
return EditorPrefs.GetBool("SteamVR_AutoEnableVR", true);
}
set
{
EditorPrefs.SetBool("SteamVR_AutoEnableVR", value);
}
}

[PreferenceItem("SteamVR")]
static void PreferencesGUI()
{
EditorGUILayout.BeginVertical();
EditorGUILayout.Space();

// Automatically Enable VR
{
string title = "Automatically Enable VR";
string tooltip = "Should SteamVR automatically enable VR on launch and play?";
AutoEnableVR = EditorGUILayout.Toggle(new GUIContent(title, tooltip), AutoEnableVR);
string helpMessage = "To enable VR manually:\n";
helpMessage += "- go to Edit -> Project Settings -> Player,\n";
helpMessage += "- tick 'Virtual Reality Supported',\n";
helpMessage += "- make sure OpenVR is in the 'Virtual Reality SDKs' list.";
EditorGUILayout.HelpBox(helpMessage, MessageType.Info);
}

EditorGUILayout.EndVertical();
}
}


+ 0
- 12
Assets/SteamVR/Editor/SteamVR_Preferences.cs.meta View File

@@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 29abf75f7265ccb45b799eac4ab0ca94
timeCreated: 1487968203
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 104
Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs View File

@@ -1,104 +0,0 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Custom inspector display for SteamVR_RenderModel
//
//=============================================================================

using UnityEngine;
using UnityEditor;
using System.Text;
using System.Collections.Generic;

[CustomEditor(typeof(SteamVR_RenderModel)), CanEditMultipleObjects]
public class SteamVR_RenderModelEditor : Editor
{
SerializedProperty script, index, modelOverride, shader, verbose, createComponents, updateDynamically;

static string[] renderModelNames;
int renderModelIndex;

void OnEnable()
{
script = serializedObject.FindProperty("m_Script");
index = serializedObject.FindProperty("index");
modelOverride = serializedObject.FindProperty("modelOverride");
shader = serializedObject.FindProperty("shader");
verbose = serializedObject.FindProperty("verbose");
createComponents = serializedObject.FindProperty("createComponents");
updateDynamically = serializedObject.FindProperty("updateDynamically");

// Load render model names if necessary.
if (renderModelNames == null)
{
renderModelNames = LoadRenderModelNames();
}

// Update renderModelIndex based on current modelOverride value.
if (modelOverride.stringValue != "")
{
for (int i = 0; i < renderModelNames.Length; i++)
{
if (modelOverride.stringValue == renderModelNames[i])
{
renderModelIndex = i;
break;
}
}
}
}

static string[] LoadRenderModelNames()
{
var results = new List<string>();
results.Add("None");

using (var holder = new SteamVR_RenderModel.RenderModelInterfaceHolder())
{
var renderModels = holder.instance;
if (renderModels != null)
{
uint count = renderModels.GetRenderModelCount();
for (uint i = 0; i < count; i++)
{
var buffer = new StringBuilder();
var requiredSize = renderModels.GetRenderModelName(i, buffer, 0);
if (requiredSize == 0)
continue;

buffer.EnsureCapacity((int)requiredSize);
renderModels.GetRenderModelName(i, buffer, requiredSize);
results.Add(buffer.ToString());
}
}
}

return results.ToArray();
}

public override void OnInspectorGUI()
{
serializedObject.Update();

EditorGUILayout.PropertyField(script);
EditorGUILayout.PropertyField(index);
//EditorGUILayout.PropertyField(modelOverride);

GUILayout.BeginHorizontal();
GUILayout.Label(new GUIContent("Model Override", SteamVR_RenderModel.modelOverrideWarning));
var selected = EditorGUILayout.Popup(renderModelIndex, renderModelNames);
if (selected != renderModelIndex)
{
renderModelIndex = selected;
modelOverride.stringValue = (selected > 0) ? renderModelNames[selected] : "";
}
GUILayout.EndHorizontal();

EditorGUILayout.PropertyField(shader);
EditorGUILayout.PropertyField(verbose);
EditorGUILayout.PropertyField(createComponents);
EditorGUILayout.PropertyField(updateDynamically);

serializedObject.ApplyModifiedProperties();
}
}


+ 0
- 12
Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs.meta View File

@@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 67867a20919f7db45a2e7034fda1c28e
timeCreated: 1433373945
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 688
Assets/SteamVR/Editor/SteamVR_Settings.cs View File

@@ -1,688 +0,0 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Prompt developers to use settings most compatible with SteamVR.
//
//=============================================================================

using UnityEngine;
using UnityEditor;
using System.IO;

[InitializeOnLoad]
public class SteamVR_Settings : EditorWindow
{
const bool forceShow = false; // Set to true to get the dialog to show back up in the case you clicked Ignore All.

const string ignore = "ignore.";
const string useRecommended = "Use recommended ({0})";
const string currentValue = " (current = {0})";

const string buildTarget = "Build Target";
const string showUnitySplashScreen = "Show Unity Splashscreen";
const string defaultIsFullScreen = "Default is Fullscreen";
const string defaultScreenSize = "Default Screen Size";
const string runInBackground = "Run In Background";
const string displayResolutionDialog = "Display Resolution Dialog";
const string resizableWindow = "Resizable Window";
const string fullscreenMode = "D3D11 Fullscreen Mode";
const string visibleInBackground = "Visible In Background";
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
const string renderingPath = "Rendering Path";
#endif
const string colorSpace = "Color Space";
const string gpuSkinning = "GPU Skinning";
#if false // skyboxes are currently broken
const string singlePassStereoRendering = "Single-Pass Stereo Rendering";
#endif

const BuildTarget recommended_BuildTarget = BuildTarget.StandaloneWindows64;
const bool recommended_ShowUnitySplashScreen = false;
const bool recommended_DefaultIsFullScreen = false;
const int recommended_DefaultScreenWidth = 1024;
const int recommended_DefaultScreenHeight = 768;
const bool recommended_RunInBackground = true;
const ResolutionDialogSetting recommended_DisplayResolutionDialog = ResolutionDialogSetting.HiddenByDefault;
const bool recommended_ResizableWindow = true;
const D3D11FullscreenMode recommended_FullscreenMode = D3D11FullscreenMode.FullscreenWindow;
const bool recommended_VisibleInBackground = true;
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
const RenderingPath recommended_RenderPath = RenderingPath.Forward;
#endif
const ColorSpace recommended_ColorSpace = ColorSpace.Linear;
const bool recommended_GpuSkinning = true;
#if false
const bool recommended_SinglePassStereoRendering = true;
#endif

static SteamVR_Settings window;

static SteamVR_Settings()
{
EditorApplication.update += Update;
}

static void Update()
{
bool show =
(!EditorPrefs.HasKey(ignore + buildTarget) &&
EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget) ||
(!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen) ||
#else
PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen) ||
#endif
(!EditorPrefs.HasKey(ignore + defaultIsFullScreen) &&
PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) ||
(!EditorPrefs.HasKey(ignore + defaultScreenSize) &&
(PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)) ||
(!EditorPrefs.HasKey(ignore + runInBackground) &&
PlayerSettings.runInBackground != recommended_RunInBackground) ||
(!EditorPrefs.HasKey(ignore + displayResolutionDialog) &&
PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) ||
(!EditorPrefs.HasKey(ignore + resizableWindow) &&
PlayerSettings.resizableWindow != recommended_ResizableWindow) ||
(!EditorPrefs.HasKey(ignore + fullscreenMode) &&
PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) ||
(!EditorPrefs.HasKey(ignore + visibleInBackground) &&
PlayerSettings.visibleInBackground != recommended_VisibleInBackground) ||
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
(!EditorPrefs.HasKey(ignore + renderingPath) &&
PlayerSettings.renderingPath != recommended_RenderPath) ||
#endif
(!EditorPrefs.HasKey(ignore + colorSpace) &&
PlayerSettings.colorSpace != recommended_ColorSpace) ||
(!EditorPrefs.HasKey(ignore + gpuSkinning) &&
PlayerSettings.gpuSkinning != recommended_GpuSkinning) ||
#if false
(!EditorPrefs.HasKey(ignore + singlePassStereoRendering) &&
PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) ||
#endif
forceShow;

if (show)
{
window = GetWindow<SteamVR_Settings>(true);
window.minSize = new Vector2(320, 440);
//window.title = "SteamVR";
}

if (SteamVR_Preferences.AutoEnableVR)
{
// Switch to native OpenVR support.
var updated = false;

if (!PlayerSettings.virtualRealitySupported)
{
PlayerSettings.virtualRealitySupported = true;
updated = true;
}

#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
var devices = UnityEditorInternal.VR.VREditor.GetVREnabledDevices(BuildTargetGroup.Standalone);
#else
var devices = UnityEditorInternal.VR.VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Standalone);
#endif
var hasOpenVR = false;
foreach (var device in devices)
if (device.ToLower() == "openvr")
hasOpenVR = true;


if (!hasOpenVR)
{
string[] newDevices;
if (updated)
{
newDevices = new string[] { "OpenVR" };
}
else
{
newDevices = new string[devices.Length + 1];
for (int i = 0; i < devices.Length; i++)
newDevices[i] = devices[i];
newDevices[devices.Length] = "OpenVR";
updated = true;
}
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
UnityEditorInternal.VR.VREditor.SetVREnabledDevices(BuildTargetGroup.Standalone, newDevices);
#else
UnityEditorInternal.VR.VREditor.SetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Standalone, newDevices);
#endif
}

if (updated)
Debug.Log("Switching to native OpenVR support.");
}

var dlls = new string[]
{
"Plugins/x86/openvr_api.dll",
"Plugins/x86_64/openvr_api.dll"
};

foreach (var path in dlls)
{
if (!File.Exists(Application.dataPath + "/" + path))
continue;

if (AssetDatabase.DeleteAsset("Assets/" + path))
Debug.Log("Deleting " + path);
else
{
Debug.Log(path + " in use; cannot delete. Please restart Unity to complete upgrade.");
}
}

EditorApplication.update -= Update;
}

Vector2 scrollPosition;
string GetResourcePath()
{
var ms = MonoScript.FromScriptableObject(this);
var path = AssetDatabase.GetAssetPath(ms);
path = Path.GetDirectoryName(path);
return path.Substring(0, path.Length - "Editor".Length) + "Textures/";
}

public void OnGUI()
{
var resourcePath = GetResourcePath();
var logo = AssetDatabase.LoadAssetAtPath<Texture2D>(resourcePath + "logo.png");
var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box);
if (logo)
GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);

EditorGUILayout.HelpBox("Recommended project settings for SteamVR:", MessageType.Warning);

scrollPosition = GUILayout.BeginScrollView(scrollPosition);

int numItems = 0;

if (!EditorPrefs.HasKey(ignore + buildTarget) &&
EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget)
{
++numItems;

GUILayout.Label(buildTarget + string.Format(currentValue, EditorUserBuildSettings.activeBuildTarget));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format(useRecommended, recommended_BuildTarget)))
{
#if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget);
#else
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget);
#endif
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + buildTarget, true);
}

GUILayout.EndHorizontal();
}

#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen)
{
++numItems;

GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.showUnitySplashScreen));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen)))
{
PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen;
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
}

GUILayout.EndHorizontal();
}
#else
if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen)
{
++numItems;

GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.SplashScreen.show));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen)))
{
PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen;
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
}

GUILayout.EndHorizontal();
}
#endif
if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) &&
PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen)
{
++numItems;

GUILayout.Label(defaultIsFullScreen + string.Format(currentValue, PlayerSettings.defaultIsFullScreen));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format(useRecommended, recommended_DefaultIsFullScreen)))
{
PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen;
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + defaultIsFullScreen, true);
}

GUILayout.EndHorizontal();
}

if (!EditorPrefs.HasKey(ignore + defaultScreenSize) &&
(PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight))
{
++numItems;

GUILayout.Label(defaultScreenSize + string.Format(" ({0}x{1})", PlayerSettings.defaultScreenWidth, PlayerSettings.defaultScreenHeight));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format("Use recommended ({0}x{1})", recommended_DefaultScreenWidth, recommended_DefaultScreenHeight)))
{
PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth;
PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight;
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + defaultScreenSize, true);
}

GUILayout.EndHorizontal();
}

if (!EditorPrefs.HasKey(ignore + runInBackground) &&
PlayerSettings.runInBackground != recommended_RunInBackground)
{
++numItems;

GUILayout.Label(runInBackground + string.Format(currentValue, PlayerSettings.runInBackground));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format(useRecommended, recommended_RunInBackground)))
{
PlayerSettings.runInBackground = recommended_RunInBackground;
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + runInBackground, true);
}

GUILayout.EndHorizontal();
}

if (!EditorPrefs.HasKey(ignore + displayResolutionDialog) &&
PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog)
{
++numItems;

GUILayout.Label(displayResolutionDialog + string.Format(currentValue, PlayerSettings.displayResolutionDialog));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format(useRecommended, recommended_DisplayResolutionDialog)))
{
PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog;
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + displayResolutionDialog, true);
}

GUILayout.EndHorizontal();
}

if (!EditorPrefs.HasKey(ignore + resizableWindow) &&
PlayerSettings.resizableWindow != recommended_ResizableWindow)
{
++numItems;

GUILayout.Label(resizableWindow + string.Format(currentValue, PlayerSettings.resizableWindow));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format(useRecommended, recommended_ResizableWindow)))
{
PlayerSettings.resizableWindow = recommended_ResizableWindow;
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + resizableWindow, true);
}

GUILayout.EndHorizontal();
}

if (!EditorPrefs.HasKey(ignore + fullscreenMode) &&
PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode)
{
++numItems;

GUILayout.Label(fullscreenMode + string.Format(currentValue, PlayerSettings.d3d11FullscreenMode));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format(useRecommended, recommended_FullscreenMode)))
{
PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode;
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + fullscreenMode, true);
}

GUILayout.EndHorizontal();
}

if (!EditorPrefs.HasKey(ignore + visibleInBackground) &&
PlayerSettings.visibleInBackground != recommended_VisibleInBackground)
{
++numItems;

GUILayout.Label(visibleInBackground + string.Format(currentValue, PlayerSettings.visibleInBackground));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format(useRecommended, recommended_VisibleInBackground)))
{
PlayerSettings.visibleInBackground = recommended_VisibleInBackground;
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + visibleInBackground, true);
}

GUILayout.EndHorizontal();
}
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (!EditorPrefs.HasKey(ignore + renderingPath) &&
PlayerSettings.renderingPath != recommended_RenderPath)
{
++numItems;

GUILayout.Label(renderingPath + string.Format(currentValue, PlayerSettings.renderingPath));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format(useRecommended, recommended_RenderPath) + " - required for MSAA"))
{
PlayerSettings.renderingPath = recommended_RenderPath;
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + renderingPath, true);
}

GUILayout.EndHorizontal();
}
#endif
if (!EditorPrefs.HasKey(ignore + colorSpace) &&
PlayerSettings.colorSpace != recommended_ColorSpace)
{
++numItems;

GUILayout.Label(colorSpace + string.Format(currentValue, PlayerSettings.colorSpace));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format(useRecommended, recommended_ColorSpace) + " - requires reloading scene"))
{
PlayerSettings.colorSpace = recommended_ColorSpace;
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + colorSpace, true);
}

GUILayout.EndHorizontal();
}

if (!EditorPrefs.HasKey(ignore + gpuSkinning) &&
PlayerSettings.gpuSkinning != recommended_GpuSkinning)
{
++numItems;

GUILayout.Label(gpuSkinning + string.Format(currentValue, PlayerSettings.gpuSkinning));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format(useRecommended, recommended_GpuSkinning)))
{
PlayerSettings.gpuSkinning = recommended_GpuSkinning;
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + gpuSkinning, true);
}

GUILayout.EndHorizontal();
}

#if false
if (!EditorPrefs.HasKey(ignore + singlePassStereoRendering) &&
PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering)
{
++numItems;

GUILayout.Label(singlePassStereoRendering + string.Format(currentValue, PlayerSettings.singlePassStereoRendering));

GUILayout.BeginHorizontal();

if (GUILayout.Button(string.Format(useRecommended, recommended_SinglePassStereoRendering)))
{
PlayerSettings.singlePassStereoRendering = recommended_SinglePassStereoRendering;
}

GUILayout.FlexibleSpace();

if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + singlePassStereoRendering, true);
}

GUILayout.EndHorizontal();
}
#endif

GUILayout.BeginHorizontal();

GUILayout.FlexibleSpace();

if (GUILayout.Button("Clear All Ignores"))
{
EditorPrefs.DeleteKey(ignore + buildTarget);
EditorPrefs.DeleteKey(ignore + showUnitySplashScreen);
EditorPrefs.DeleteKey(ignore + defaultIsFullScreen);
EditorPrefs.DeleteKey(ignore + defaultScreenSize);
EditorPrefs.DeleteKey(ignore + runInBackground);
EditorPrefs.DeleteKey(ignore + displayResolutionDialog);
EditorPrefs.DeleteKey(ignore + resizableWindow);
EditorPrefs.DeleteKey(ignore + fullscreenMode);
EditorPrefs.DeleteKey(ignore + visibleInBackground);
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
EditorPrefs.DeleteKey(ignore + renderingPath);
#endif
EditorPrefs.DeleteKey(ignore + colorSpace);
EditorPrefs.DeleteKey(ignore + gpuSkinning);
#if false
EditorPrefs.DeleteKey(ignore + singlePassStereoRendering);
#endif
}

GUILayout.EndHorizontal();

GUILayout.EndScrollView();

GUILayout.FlexibleSpace();

GUILayout.BeginHorizontal();

if (numItems > 0)
{
if (GUILayout.Button("Accept All"))
{
// Only set those that have not been explicitly ignored.
if (!EditorPrefs.HasKey(ignore + buildTarget))
#if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget);
#else
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget);
#endif
if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen))
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen;
#else
PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen;
#endif
if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen))
PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen;
if (!EditorPrefs.HasKey(ignore + defaultScreenSize))
{
PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth;
PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight;
}
if (!EditorPrefs.HasKey(ignore + runInBackground))
PlayerSettings.runInBackground = recommended_RunInBackground;
if (!EditorPrefs.HasKey(ignore + displayResolutionDialog))
PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog;
if (!EditorPrefs.HasKey(ignore + resizableWindow))
PlayerSettings.resizableWindow = recommended_ResizableWindow;
if (!EditorPrefs.HasKey(ignore + fullscreenMode))
PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode;
if (!EditorPrefs.HasKey(ignore + visibleInBackground))
PlayerSettings.visibleInBackground = recommended_VisibleInBackground;
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (!EditorPrefs.HasKey(ignore + renderingPath))
PlayerSettings.renderingPath = recommended_RenderPath;
#endif
if (!EditorPrefs.HasKey(ignore + colorSpace))
PlayerSettings.colorSpace = recommended_ColorSpace;
if (!EditorPrefs.HasKey(ignore + gpuSkinning))
PlayerSettings.gpuSkinning = recommended_GpuSkinning;
#if false
if (!EditorPrefs.HasKey(ignore + singlePassStereoRendering))
PlayerSettings.singlePassStereoRendering = recommended_SinglePassStereoRendering;
#endif

EditorUtility.DisplayDialog("Accept All", "You made the right choice!", "Ok");

Close();
}

if (GUILayout.Button("Ignore All"))
{
if (EditorUtility.DisplayDialog("Ignore All", "Are you sure?", "Yes, Ignore All", "Cancel"))
{
// Only ignore those that do not currently match our recommended settings.
if (EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget)
EditorPrefs.SetBool(ignore + buildTarget, true);
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen)
#else
if (PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen)
#endif
EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
if (PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen)
EditorPrefs.SetBool(ignore + defaultIsFullScreen, true);
if (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)
EditorPrefs.SetBool(ignore + defaultScreenSize, true);
if (PlayerSettings.runInBackground != recommended_RunInBackground)
EditorPrefs.SetBool(ignore + runInBackground, true);
if (PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog)
EditorPrefs.SetBool(ignore + displayResolutionDialog, true);
if (PlayerSettings.resizableWindow != recommended_ResizableWindow)
EditorPrefs.SetBool(ignore + resizableWindow, true);
if (PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode)
EditorPrefs.SetBool(ignore + fullscreenMode, true);
if (PlayerSettings.visibleInBackground != recommended_VisibleInBackground)
EditorPrefs.SetBool(ignore + visibleInBackground, true);
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (PlayerSettings.renderingPath != recommended_RenderPath)
EditorPrefs.SetBool(ignore + renderingPath, true);
#endif
if (PlayerSettings.colorSpace != recommended_ColorSpace)
EditorPrefs.SetBool(ignore + colorSpace, true);
if (PlayerSettings.gpuSkinning != recommended_GpuSkinning)
EditorPrefs.SetBool(ignore + gpuSkinning, true);
#if false
if (PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering)
EditorPrefs.SetBool(ignore + singlePassStereoRendering, true);
#endif

Close();
}
}
}
else if (GUILayout.Button("Close"))
{
Close();
}

GUILayout.EndHorizontal();
}
}


+ 0
- 12
Assets/SteamVR/Editor/SteamVR_Settings.cs.meta View File

@@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: d2244eee8a3a4784fb40d1123ff69301
timeCreated: 1438809573
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 381
Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs View File

@@ -1,381 +0,0 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Custom inspector display for SteamVR_Skybox
//
//=============================================================================

using UnityEngine;
using UnityEditor;
using System.Text;
using System.Collections.Generic;
using Valve.VR;
using System.IO;

[CustomEditor(typeof(SteamVR_Skybox)), CanEditMultipleObjects]
public class SteamVR_SkyboxEditor : Editor
{
private const string nameFormat = "{0}/{1}-{2}.png";
private const string helpText = "Take snapshot will use the current " +
"position and rotation to capture six directional screenshots to use as this " +
"skybox's textures. Note: This skybox is only used to override what shows up " +
"in the compositor (e.g. when loading levels). Add a Camera component to this " +
"object to override default settings like which layers to render. Additionally, " +
"by specifying your own targetTexture, you can control the size of the textures " +
"and other properties like antialiasing. Don't forget to disable the camera.\n\n" +
"For stereo screenshots, a panorama is render for each eye using the specified " +
"ipd (in millimeters) broken up into segments cellSize pixels square to optimize " +
"generation.\n(32x32 takes about 10 seconds depending on scene complexity, 16x16 " +
"takes around a minute, while will 8x8 take several minutes.)\n\nTo test, hit " +
"play then pause - this will activate the skybox settings, and then drop you to " +
"the compositor where the skybox is rendered.";

public override void OnInspectorGUI()
{
DrawDefaultInspector();

EditorGUILayout.HelpBox(helpText, MessageType.Info);

if (GUILayout.Button("Take snapshot"))
{
var directions = new Quaternion[] {
Quaternion.LookRotation(Vector3.forward),
Quaternion.LookRotation(Vector3.back),
Quaternion.LookRotation(Vector3.left),
Quaternion.LookRotation(Vector3.right),
Quaternion.LookRotation(Vector3.up, Vector3.back),
Quaternion.LookRotation(Vector3.down, Vector3.forward)
};

Camera tempCamera = null;
foreach (SteamVR_Skybox target in targets)
{
var targetScene = target.gameObject.scene;
var sceneName = Path.GetFileNameWithoutExtension(targetScene.path);
var scenePath = Path.GetDirectoryName(targetScene.path);
var assetPath = scenePath + "/" + sceneName;
if (!AssetDatabase.IsValidFolder(assetPath))
{
var guid = AssetDatabase.CreateFolder(scenePath, sceneName);
assetPath = AssetDatabase.GUIDToAssetPath(guid);
}

var camera = target.GetComponent<Camera>();
if (camera == null)
{
if (tempCamera == null)
tempCamera = new GameObject().AddComponent<Camera>();
camera = tempCamera;
}

var targetTexture = camera.targetTexture;
if (camera.targetTexture == null)
{
targetTexture = new RenderTexture(1024, 1024, 24);
targetTexture.antiAliasing = 8;
camera.targetTexture = targetTexture;
}

var oldPosition = target.transform.localPosition;
var oldRotation = target.transform.localRotation;
var baseRotation = target.transform.rotation;

var t = camera.transform;
t.position = target.transform.position;
camera.orthographic = false;
camera.fieldOfView = 90;

for (int i = 0; i < directions.Length; i++)
{
t.rotation = baseRotation * directions[i];
camera.Render();

// Copy to texture and save to disk.
RenderTexture.active = targetTexture;
var texture = new Texture2D(targetTexture.width, targetTexture.height, TextureFormat.ARGB32, false);
texture.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0);
texture.Apply();
RenderTexture.active = null;

var assetName = string.Format(nameFormat, assetPath, target.name, i);
System.IO.File.WriteAllBytes(assetName, texture.EncodeToPNG());
}
if (camera != tempCamera)
{
target.transform.localPosition = oldPosition;
target.transform.localRotation = oldRotation;
}
}

if (tempCamera != null)
{
Object.DestroyImmediate(tempCamera.gameObject);
}

// Now that everything has be written out, reload the associated assets and assign them.
AssetDatabase.Refresh();
foreach (SteamVR_Skybox target in targets)
{
var targetScene = target.gameObject.scene;
var sceneName = Path.GetFileNameWithoutExtension(targetScene.path);
var scenePath = Path.GetDirectoryName(targetScene.path);
var assetPath = scenePath + "/" + sceneName;

for (int i = 0; i < directions.Length; i++)
{
var assetName = string.Format(nameFormat, assetPath, target.name, i);
var importer = AssetImporter.GetAtPath(assetName) as TextureImporter;
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
importer.textureFormat = TextureImporterFormat.RGB24;
#else
importer.textureCompression = TextureImporterCompression.Uncompressed;
#endif
importer.wrapMode = TextureWrapMode.Clamp;
importer.mipmapEnabled = false;
importer.SaveAndReimport();

var texture = AssetDatabase.LoadAssetAtPath<Texture>(assetName);
target.SetTextureByIndex(i, texture);
}
}
}
else if (GUILayout.Button("Take stereo snapshot"))
{
const int width = 4096;
const int height = width / 2;
const int halfHeight = height / 2;

var textures = new Texture2D[] {
new Texture2D(width, height, TextureFormat.ARGB32, false),
new Texture2D(width, height, TextureFormat.ARGB32, false) };

var timer = new System.Diagnostics.Stopwatch();

Camera tempCamera = null;
foreach (SteamVR_Skybox target in targets)
{
timer.Start();

var targetScene = target.gameObject.scene;
var sceneName = Path.GetFileNameWithoutExtension(targetScene.path);
var scenePath = Path.GetDirectoryName(targetScene.path);
var assetPath = scenePath + "/" + sceneName;
if (!AssetDatabase.IsValidFolder(assetPath))
{
var guid = AssetDatabase.CreateFolder(scenePath, sceneName);
assetPath = AssetDatabase.GUIDToAssetPath(guid);
}

var camera = target.GetComponent<Camera>();
if (camera == null)
{
if (tempCamera == null)
tempCamera = new GameObject().AddComponent<Camera>();
camera = tempCamera;
}

var fx = camera.gameObject.AddComponent<SteamVR_SphericalProjection>();

var oldTargetTexture = camera.targetTexture;
var oldOrthographic = camera.orthographic;
var oldFieldOfView = camera.fieldOfView;
var oldAspect = camera.aspect;

var oldPosition = target.transform.localPosition;
var oldRotation = target.transform.localRotation;
var basePosition = target.transform.position;
var baseRotation = target.transform.rotation;

var transform = camera.transform;

int cellSize = int.Parse(target.StereoCellSize.ToString().Substring(1));
float ipd = target.StereoIpdMm / 1000.0f;
int vTotal = halfHeight / cellSize;
float dv = 90.0f / vTotal; // vertical degrees per segment
float dvHalf = dv / 2.0f;

var targetTexture = new RenderTexture(cellSize, cellSize, 24);
targetTexture.wrapMode = TextureWrapMode.Clamp;
targetTexture.antiAliasing = 8;

camera.fieldOfView = dv;
camera.orthographic = false;
camera.targetTexture = targetTexture;

// Render sections of a sphere using a rectilinear projection
// and resample using a sphereical projection into a single panorama
// texture per eye. We break into sections in order to keep the eye
// separation similar around the sphere. Rendering alternates between
// top and bottom sections, sweeping horizontally around the sphere,
// alternating left and right eyes.
for (int v = 0; v < vTotal; v++)
{
var pitch = 90.0f - (v * dv) - dvHalf;
var uTotal = width / targetTexture.width;
var du = 360.0f / uTotal; // horizontal degrees per segment
var duHalf = du / 2.0f;

var vTarget = v * halfHeight / vTotal;

for (int i = 0; i < 2; i++) // top, bottom
{
if (i == 1)
{
pitch = -pitch;
vTarget = height - vTarget - cellSize;
}

for (int u = 0; u < uTotal; u++)
{
var yaw = -180.0f + (u * du) + duHalf;

var uTarget = u * width / uTotal;

var xOffset = -ipd / 2 * Mathf.Cos(pitch * Mathf.Deg2Rad);

for (int j = 0; j < 2; j++) // left, right
{
var texture = textures[j];

if (j == 1)
{
xOffset = -xOffset;
}

var offset = baseRotation * Quaternion.Euler(0, yaw, 0) * new Vector3(xOffset, 0, 0);
transform.position = basePosition + offset;

var direction = Quaternion.Euler(pitch, yaw, 0.0f);
transform.rotation = baseRotation * direction;

// vector pointing to center of this section
var N = direction * Vector3.forward;

// horizontal span of this section in degrees
var phi0 = yaw - (du / 2);
var phi1 = phi0 + du;

// vertical span of this section in degrees
var theta0 = pitch + (dv / 2);
var theta1 = theta0 - dv;

var midPhi = (phi0 + phi1) / 2;
var baseTheta = Mathf.Abs(theta0) < Mathf.Abs(theta1) ? theta0 : theta1;

// vectors pointing to corners of image closes to the equator
var V00 = Quaternion.Euler(baseTheta, phi0, 0.0f) * Vector3.forward;
var V01 = Quaternion.Euler(baseTheta, phi1, 0.0f) * Vector3.forward;

// vectors pointing to top and bottom midsection of image
var V0M = Quaternion.Euler(theta0, midPhi, 0.0f) * Vector3.forward;
var V1M = Quaternion.Euler(theta1, midPhi, 0.0f) * Vector3.forward;

// intersection points for each of the above
var P00 = V00 / Vector3.Dot(V00, N);
var P01 = V01 / Vector3.Dot(V01, N);
var P0M = V0M / Vector3.Dot(V0M, N);
var P1M = V1M / Vector3.Dot(V1M, N);

// calculate basis vectors for plane
var P00_P01 = P01 - P00;
var P0M_P1M = P1M - P0M;

var uMag = P00_P01.magnitude;
var vMag = P0M_P1M.magnitude;

var uScale = 1.0f / uMag;
var vScale = 1.0f / vMag;

var uAxis = P00_P01 * uScale;
var vAxis = P0M_P1M * vScale;

// update material constant buffer
fx.Set(N, phi0, phi1, theta0, theta1,
uAxis, P00, uScale,
vAxis, P0M, vScale);

camera.aspect = uMag / vMag;
camera.Render();

RenderTexture.active = targetTexture;
texture.ReadPixels(new Rect(0, 0, targetTexture.width, targetTexture.height), uTarget, vTarget);
RenderTexture.active = null;
}
}
}
}

// Save textures to disk.
for (int i = 0; i < 2; i++)
{
var texture = textures[i];

texture.Apply();
var assetName = string.Format(nameFormat, assetPath, target.name, i);
File.WriteAllBytes(assetName, texture.EncodeToPNG());
}

// Cleanup.
if (camera != tempCamera)
{
camera.targetTexture = oldTargetTexture;
camera.orthographic = oldOrthographic;
camera.fieldOfView = oldFieldOfView;
camera.aspect = oldAspect;

target.transform.localPosition = oldPosition;
target.transform.localRotation = oldRotation;
}
else
{
tempCamera.targetTexture = null;
}

DestroyImmediate(targetTexture);
DestroyImmediate(fx);

timer.Stop();
Debug.Log(string.Format("Screenshot took {0} seconds.", timer.Elapsed));
}

if (tempCamera != null)
{
DestroyImmediate(tempCamera.gameObject);
}

DestroyImmediate(textures[0]);
DestroyImmediate(textures[1]);

// Now that everything has be written out, reload the associated assets and assign them.
AssetDatabase.Refresh();
foreach (SteamVR_Skybox target in targets)
{
var targetScene = target.gameObject.scene;
var sceneName = Path.GetFileNameWithoutExtension(targetScene.path);
var scenePath = Path.GetDirectoryName(targetScene.path);
var assetPath = scenePath + "/" + sceneName;

for (int i = 0; i < 2; i++)
{
var assetName = string.Format(nameFormat, assetPath, target.name, i);
var importer = AssetImporter.GetAtPath(assetName) as TextureImporter;
importer.mipmapEnabled = false;
importer.wrapMode = TextureWrapMode.Repeat;
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
importer.SetPlatformTextureSettings("Standalone", width, TextureImporterFormat.RGB24);
#else
var settings = importer.GetPlatformTextureSettings("Standalone");
settings.textureCompression = TextureImporterCompression.Uncompressed;
settings.maxTextureSize = width;
importer.SetPlatformTextureSettings(settings);
#endif
importer.SaveAndReimport();

var texture = AssetDatabase.LoadAssetAtPath<Texture2D>(assetName);
target.SetTextureByIndex(i, texture);
}
}
}
}
}


+ 0
- 12
Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs.meta View File

@@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 80087fbbf7bf93a46bb4aea276b19568
timeCreated: 1446765449
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 170
Assets/SteamVR/Editor/SteamVR_Update.cs View File

@@ -1,170 +0,0 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Notify developers when a new version of the plugin is available.
//
//=============================================================================

using UnityEngine;
using UnityEditor;
using System.IO;
using System.Text.RegularExpressions;

[InitializeOnLoad]
public class SteamVR_Update : EditorWindow
{
const string currentVersion = "1.2.2";
const string versionUrl = "http://media.steampowered.com/apps/steamvr/unitypluginversion.txt";
const string notesUrl = "http://media.steampowered.com/apps/steamvr/unityplugin-v{0}.txt";
const string pluginUrl = "http://u3d.as/content/valve-corporation/steam-vr-plugin";
const string doNotShowKey = "SteamVR.DoNotShow.v{0}";

static bool gotVersion = false;
static WWW wwwVersion, wwwNotes;
static string version, notes;
static SteamVR_Update window;

static SteamVR_Update()
{
EditorApplication.update += Update;
}

static void Update()
{
if (!gotVersion)
{
if (wwwVersion == null)
wwwVersion = new WWW(versionUrl);

if (!wwwVersion.isDone)
return;

if (UrlSuccess(wwwVersion))
version = wwwVersion.text;

wwwVersion = null;
gotVersion = true;

if (ShouldDisplay())
{
var url = string.Format(notesUrl, version);
wwwNotes = new WWW(url);

window = GetWindow<SteamVR_Update>(true);
window.minSize = new Vector2(320, 440);
//window.title = "SteamVR";
}
}

if (wwwNotes != null)
{
if (!wwwNotes.isDone)
return;

if (UrlSuccess(wwwNotes))
notes = wwwNotes.text;

wwwNotes = null;

if (notes != "")
window.Repaint();
}

EditorApplication.update -= Update;
}

static bool UrlSuccess(WWW www)
{
if (!string.IsNullOrEmpty(www.error))
return false;
if (Regex.IsMatch(www.text, "404 not found", RegexOptions.IgnoreCase))
return false;
return true;
}

static bool ShouldDisplay()
{
if (string.IsNullOrEmpty(version))
return false;
if (version == currentVersion)
return false;
if (EditorPrefs.HasKey(string.Format(doNotShowKey, version)))
return false;

// parse to see if newer (e.g. 1.0.4 vs 1.0.3)
var versionSplit = version.Split('.');
var currentVersionSplit = currentVersion.Split('.');
for (int i = 0; i < versionSplit.Length && i < currentVersionSplit.Length; i++)
{
int versionValue, currentVersionValue;
if (int.TryParse(versionSplit[i], out versionValue) &&
int.TryParse(currentVersionSplit[i], out currentVersionValue))
{
if (versionValue > currentVersionValue)
return true;
if (versionValue < currentVersionValue)
return false;
}
}

// same up to this point, now differentiate based on number of sub values (e.g. 1.0.4.1 vs 1.0.4)
if (versionSplit.Length <= currentVersionSplit.Length)
return false;

return true;
}

Vector2 scrollPosition;
bool toggleState;

string GetResourcePath()
{
var ms = MonoScript.FromScriptableObject(this);
var path = AssetDatabase.GetAssetPath(ms);
path = Path.GetDirectoryName(path);
return path.Substring(0, path.Length - "Editor".Length) + "Textures/";
}

public void OnGUI()
{
EditorGUILayout.HelpBox("A new version of the SteamVR plugin is available!", MessageType.Warning);

var resourcePath = GetResourcePath();
var logo = AssetDatabase.LoadAssetAtPath<Texture2D>(resourcePath + "logo.png");
var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box);
if (logo)
GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);

scrollPosition = GUILayout.BeginScrollView(scrollPosition);

GUILayout.Label("Current version: " + currentVersion);
GUILayout.Label("New version: " + version);

if (notes != "")
{
GUILayout.Label("Release notes:");
EditorGUILayout.HelpBox(notes, MessageType.Info);
}

GUILayout.EndScrollView();

GUILayout.FlexibleSpace();

if (GUILayout.Button("Get Latest Version"))
{
Application.OpenURL(pluginUrl);
}

EditorGUI.BeginChangeCheck();
var doNotShow = GUILayout.Toggle(toggleState, "Do not prompt for this version again.");
if (EditorGUI.EndChangeCheck())
{
toggleState = doNotShow;
var key = string.Format(doNotShowKey, version);
if (doNotShow)
EditorPrefs.SetBool(key, true);
else
EditorPrefs.DeleteKey(key);
}
}
}


+ 0
- 12
Assets/SteamVR/Editor/SteamVR_Update.cs.meta View File

@@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 73a0556bda803bf4e898751dcfcf21a8
timeCreated: 1433880062
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 9
Assets/SteamVR/Extras.meta View File

@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 61f4796ee4f00314e8d8b1ad39a78c28
folderAsset: yes
timeCreated: 1438797390
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 88
Assets/SteamVR/Extras/SteamVR_GazeTracker.cs View File

@@ -1,88 +0,0 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using UnityEngine;
using System.Collections;

public struct GazeEventArgs
{
public float distance;
}

public delegate void GazeEventHandler(object sender, GazeEventArgs e);

public class SteamVR_GazeTracker : MonoBehaviour
{
public bool isInGaze = false;
public event GazeEventHandler GazeOn;
public event GazeEventHandler GazeOff;
public float gazeInCutoff = 0.15f;
public float gazeOutCutoff = 0.4f;

// Contains a HMD tracked object that we can use to find the user's gaze
Transform hmdTrackedObject = null;

// Use this for initialization
void Start ()
{
}

public virtual void OnGazeOn(GazeEventArgs e)
{
if (GazeOn != null)
GazeOn(this, e);
}

public virtual void OnGazeOff(GazeEventArgs e)
{
if (GazeOff != null)
GazeOff(this, e);
}

// Update is called once per frame
void Update ()
{
// If we haven't set up hmdTrackedObject find what the user is looking at
if (hmdTrackedObject == null)
{
SteamVR_TrackedObject[] trackedObjects = FindObjectsOfType<SteamVR_TrackedObject>();
foreach (SteamVR_TrackedObject tracked in trackedObjects)
{
if (tracked.index == SteamVR_TrackedObject.EIndex.Hmd)
{
hmdTrackedObject = tracked.transform;
break;
}
}
}

if (hmdTrackedObject)
{
Ray r = new Ray(hmdTrackedObject.position, hmdTrackedObject.forward);
Plane p = new Plane(hmdTrackedObject.forward, transform.position);

float enter = 0.0f;
if (p.Raycast(r, out enter))
{
Vector3 intersect = hmdTrackedObject.position + hmdTrackedObject.forward * enter;
float dist = Vector3.Distance(intersect, transform.position);
//Debug.Log("Gaze dist = " + dist);
if (dist < gazeInCutoff && !isInGaze)
{
isInGaze = true;
GazeEventArgs e;
e.distance = dist;
OnGazeOn(e);
}
else if (dist >= gazeOutCutoff && isInGaze)
{
isInGaze = false;
GazeEventArgs e;
e.distance = dist;
OnGazeOff(e);
}
}

}

}
}

+ 0
- 12
Assets/SteamVR/Extras/SteamVR_GazeTracker.cs.meta View File

@@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 501eb8b744f73714fbe7dbdd5e3ef66e
timeCreated: 1426193800
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 141
Assets/SteamVR/Extras/SteamVR_LaserPointer.cs View File

@@ -1,141 +0,0 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using UnityEngine;
using System.Collections;

public struct PointerEventArgs
{
public uint controllerIndex;
public uint flags;
public float distance;
public Transform target;
}

public delegate void PointerEventHandler(object sender, PointerEventArgs e);


public class SteamVR_LaserPointer : MonoBehaviour
{
public bool active = true;
public Color color;
public float thickness = 0.002f;
public GameObject holder;
public GameObject pointer;
bool isActive = false;
public bool addRigidBody = false;
public Transform reference;
public event PointerEventHandler PointerIn;
public event PointerEventHandler PointerOut;

Transform previousContact = null;

// Use this for initialization
void Start ()
{
holder = new GameObject();
holder.transform.parent = this.transform;
holder.transform.localPosition = Vector3.zero;
holder.transform.localRotation = Quaternion.identity;

pointer = GameObject.CreatePrimitive(PrimitiveType.Cube);
pointer.transform.parent = holder.transform;
pointer.transform.localScale = new Vector3(thickness, thickness, 100f);
pointer.transform.localPosition = new Vector3(0f, 0f, 50f);
pointer.transform.localRotation = Quaternion.identity;
BoxCollider collider = pointer.GetComponent<BoxCollider>();
if (addRigidBody)
{
if (collider)
{
collider.isTrigger = true;
}
Rigidbody rigidBody = pointer.AddComponent<Rigidbody>();
rigidBody.isKinematic = true;
}
else
{
if(collider)
{
Object.Destroy(collider);
}
}
Material newMaterial = new Material(Shader.Find("Unlit/Color"));
newMaterial.SetColor("_Color", color);
pointer.GetComponent<MeshRenderer>().material = newMaterial;
}

public virtual void OnPointerIn(PointerEventArgs e)
{
if (PointerIn != null)
PointerIn(this, e);
}

public virtual void OnPointerOut(PointerEventArgs e)
{
if (PointerOut != null)
PointerOut(this, e);
}


// Update is called once per frame
void Update ()
{
if (!isActive)
{
isActive = true;
this.transform.GetChild(0).gameObject.SetActive(true);
}

float dist = 100f;

SteamVR_TrackedController controller = GetComponent<SteamVR_TrackedController>();

Ray raycast = new Ray(transform.position, transform.forward);
RaycastHit hit;
bool bHit = Physics.Raycast(raycast, out hit);

if(previousContact && previousContact != hit.transform)
{
PointerEventArgs args = new PointerEventArgs();
if (controller != null)
{
args.controllerIndex = controller.controllerIndex;
}
args.distance = 0f;
args.flags = 0;
args.target = previousContact;
OnPointerOut(args);
previousContact = null;
}
if(bHit && previousContact != hit.transform)
{
PointerEventArgs argsIn = new PointerEventArgs();
if (controller != null)
{
argsIn.controllerIndex = controller.controllerIndex;
}
argsIn.distance = hit.distance;
argsIn.flags = 0;
argsIn.target = hit.transform;
OnPointerIn(argsIn);
previousContact = hit.transform;
}
if(!bHit)
{
previousContact = null;
}
if (bHit && hit.distance < 100f)
{
dist = hit.distance;
}

if (controller != null && controller.triggerPressed)
{
pointer.transform.localScale = new Vector3(thickness * 5f, thickness * 5f, dist);
}
else
{
pointer.transform.localScale = new Vector3(thickness, thickness, dist);
}
pointer.transform.localPosition = new Vector3(0f, 0f, dist/2f);
}
}

+ 0
- 12
Assets/SteamVR/Extras/SteamVR_LaserPointer.cs.meta View File

@@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: d4e8a839a7c5b7e4580c59e305fb5f01
timeCreated: 1430337756
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 98
Assets/SteamVR/Extras/SteamVR_Teleporter.cs View File

@@ -1,98 +0,0 @@
using UnityEngine;
using System.Collections;

public class SteamVR_Teleporter : MonoBehaviour
{
public enum TeleportType
{
TeleportTypeUseTerrain,
TeleportTypeUseCollider,
TeleportTypeUseZeroY
}

public bool teleportOnClick = false;