-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Roll-a-Ball is the baseline before my tutorial, Roll-a-Ball VR is the final result if you follow my tutorial.
- Loading branch information
Showing
1,645 changed files
with
20,010 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>10.0.20506</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<RootNamespace></RootNamespace> | ||
<ProjectGuid>{64850916-A5EB-890D-3B9D-87714526B0E7}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<AssemblyName>Assembly-CSharp-Editor</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<BaseDirectory>Assets</BaseDirectory> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>Temp\bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE;UNITY_5_3_2;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;ENABLE_RUNTIME_GI;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_NETWORK;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_TEXTUREID_MAP;PLAYERCONNECTION_LISTENS_FIXED_PORT;DEBUGGER_LISTENS_FIXED_PORT;PLATFORM_SUPPORTS_ADS_ID;SUPPORT_ENVIRONMENT_VARIABLES;PLATFORM_SUPPORTS_PROFILER;PLATFORM_HAS_NO_SUPPORT_FOR_BUCKET_ALLOCATOR;STRICTCPP_NEW_DELETE_SIGNATURES;WWW_USE_CURL;HAS_NEON_SKINNIG;UNITY_INPUT_SIMULATE_EVENTS;PLATFORM_ALWAYS_USES_STDOUT_FOR_LOG;ENABLE_UNITYADS_RUNTIME;UNITY_UNITYADS_API;UNITY_IOS;UNITY_IPHONE;UNITY_IPHONE_API;SUPPORT_MULTIPLE_DISPLAYS;ENABLE_IL2CPP;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;ENABLE_IOS_ON_DEMAND_RESOURCES;ENABLE_IOS_APP_SLICING;ENABLE_DUCK_TYPING</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<NoWarn>0169</NoWarn> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>Temp\bin\Release\</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<NoWarn>0169</NoWarn> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.XML" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEditor"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEditor.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Assets\Cardboard\Editor\CardboardAudioListenerEditor.cs" /> | ||
<Compile Include="Assets\Cardboard\Editor\CardboardAudioRoomEditor.cs" /> | ||
<Compile Include="Assets\Cardboard\Editor\CardboardAudioSourceEditor.cs" /> | ||
<Compile Include="Assets\Cardboard\Editor\CardboardEditor.cs" /> | ||
<Compile Include="Assets\Cardboard\Editor\CardboardMenu.cs" /> | ||
<Compile Include="Assets\Cardboard\Editor\CardboardSetup.cs" /> | ||
<Compile Include="Assets\Cardboard\Editor\StereoControllerEditor.cs" /> | ||
<None Include="Assets\Cardboard\Resources\SkyboxMesh.shader" /> | ||
<None Include="Assets\Cardboard\Distortion\CardboardDistortion.cginc" /> | ||
<None Include="Assets\Cardboard\Resources\UnlitTexture.shader" /> | ||
<None Include="Assets\Plugins\Android\AndroidManifest.xml" /> | ||
<None Include="Assets\Cardboard\Resources\UI\CardboardReticleShader.shader" /> | ||
<None Include="Assets\Cardboard\Resources\SolidColor.shader" /> | ||
<Reference Include="UnityEditor.Advertisements"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Advertisements/Editor/UnityEditor.Advertisements.dll</HintPath> | ||
</Reference> | ||
<Reference Include="nunit.framework"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/EditorTestsRunner/Editor/nunit.framework.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEditor.EditorTestsRunner"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/EditorTestsRunner/Editor/UnityEditor.EditorTestsRunner.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UI"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEditor.UI"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/Editor/UnityEditor.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.Networking"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEditor.Networking"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Networking/Editor/UnityEditor.Networking.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEditor.TreeEditor"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/TreeEditor/Editor/UnityEditor.TreeEditor.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEditor.Graphs"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEditor.Graphs.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEditor.iOS.Extensions"> | ||
<HintPath>/Applications/Unity/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEditor.OSXStandalone.Extensions"> | ||
<HintPath>/Applications/Unity/PlaybackEngines/MacStandaloneSupport/UnityEditor.OSXStandalone.Extensions.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="Assembly-CSharp.csproj"> | ||
<Project>{50A21834-D5F2-BC30-C7A9-C7DD134926C2}</Project> <Name>Assembly-CSharp</Name> </ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>10.0.20506</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<RootNamespace></RootNamespace> | ||
<ProjectGuid>{50A21834-D5F2-BC30-C7A9-C7DD134926C2}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<AssemblyName>Assembly-CSharp</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<BaseDirectory>Assets</BaseDirectory> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>Temp\bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE;UNITY_5_3_2;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;ENABLE_RUNTIME_GI;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_NETWORK;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_TEXTUREID_MAP;PLAYERCONNECTION_LISTENS_FIXED_PORT;DEBUGGER_LISTENS_FIXED_PORT;PLATFORM_SUPPORTS_ADS_ID;SUPPORT_ENVIRONMENT_VARIABLES;PLATFORM_SUPPORTS_PROFILER;PLATFORM_HAS_NO_SUPPORT_FOR_BUCKET_ALLOCATOR;STRICTCPP_NEW_DELETE_SIGNATURES;WWW_USE_CURL;HAS_NEON_SKINNIG;UNITY_INPUT_SIMULATE_EVENTS;PLATFORM_ALWAYS_USES_STDOUT_FOR_LOG;ENABLE_UNITYADS_RUNTIME;UNITY_UNITYADS_API;UNITY_IOS;UNITY_IPHONE;UNITY_IPHONE_API;SUPPORT_MULTIPLE_DISPLAYS;ENABLE_IL2CPP;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;ENABLE_IOS_ON_DEMAND_RESOURCES;ENABLE_IOS_APP_SLICING</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<NoWarn>0169</NoWarn> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>Temp\bin\Release\</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<NoWarn>0169</NoWarn> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.XML" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEditor"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEditor.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Assets\Cardboard\Legacy\Scripts\CardboardOnGUI.cs" /> | ||
<Compile Include="Assets\Cardboard\Legacy\Scripts\CardboardOnGUIMouse.cs" /> | ||
<Compile Include="Assets\Cardboard\Legacy\Scripts\CardboardOnGUIWindow.cs" /> | ||
<Compile Include="Assets\Cardboard\Legacy\Scripts\SkyboxMesh.cs" /> | ||
<Compile Include="Assets\Cardboard\Legacy\Scripts\StereoLensFlare.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\Audio\CardboardAudio.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\Audio\CardboardAudioListener.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\Audio\CardboardAudioRoom.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\Audio\CardboardAudioSource.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\Cardboard.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\CardboardEye.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\CardboardHead.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\CardboardPostRender.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\CardboardPreRender.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\CardboardProfile.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\GazeInputModule.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\Pose3D.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\StereoController.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\StereoRenderEffect.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\UI\CardboardReticle.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\UI\ICardboardPointer.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\VRDevices\BaseAndroidDevice.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\VRDevices\BaseCardboardDevice.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\VRDevices\BaseVRDevice.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\VRDevices\CardboardAndroidDevice.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\VRDevices\CardboardiOSDevice.cs" /> | ||
<Compile Include="Assets\Cardboard\Scripts\VRDevices\UnityEditorDevice.cs" /> | ||
<Compile Include="Assets\Scripts\CameraController.cs" /> | ||
<Compile Include="Assets\Scripts\CardboardModeManager.cs" /> | ||
<Compile Include="Assets\Scripts\GameplayMenu.cs" /> | ||
<Compile Include="Assets\Scripts\GroundTriggers.cs" /> | ||
<Compile Include="Assets\Scripts\PlayerController.cs" /> | ||
<Compile Include="Assets\Scripts\Rotator.cs" /> | ||
<None Include="Assets\Cardboard\Resources\SkyboxMesh.shader" /> | ||
<None Include="Assets\Cardboard\Distortion\CardboardDistortion.cginc" /> | ||
<None Include="Assets\Cardboard\Resources\UnlitTexture.shader" /> | ||
<None Include="Assets\Plugins\Android\AndroidManifest.xml" /> | ||
<None Include="Assets\Cardboard\Resources\UI\CardboardReticleShader.shader" /> | ||
<None Include="Assets\Cardboard\Resources\SolidColor.shader" /> | ||
<Reference Include="UnityEngine.UI"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.Networking"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
|
||
</Project> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
Roll a Ball VR/Assets/Cardboard/Distortion/CardboardDistortion.cginc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2015 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. | ||
|
||
|
||
// To use in a surface shader, add the following text to the code: | ||
// | ||
// #pragma surface ... vertex:vert <-- add "vertex:vert" to this line | ||
// #include "CardboardDistortion.cginc" <-- copy the next 4 lines | ||
// void vert (inout appdata_base v) { | ||
// v.vertex = undistortSurface(v.vertex); | ||
// } | ||
|
||
// To use in a vertex shader, modify it as follows: | ||
// | ||
// #include "CardboardDistortion.cginc" <-- add this | ||
// | ||
// v2f vert (appdata_blah v) { | ||
// v2f o; | ||
// o.vertex = undistortVertex(v.vertex); <-- replace "mul(UNITY_MATRIX_MVP, v.vertex)" | ||
// ... | ||
// return o; | ||
// } | ||
|
||
float4 _Undistortion; | ||
float _MaxRadSq; | ||
float _NearClip; | ||
float4x4 _RealProjection; | ||
float4x4 _FixProjection; | ||
|
||
// Convert point from world space to undistorted camera space. | ||
float4 undistort(float4 pos) { | ||
// Go to camera space. | ||
pos = mul(UNITY_MATRIX_MV, pos); | ||
if (pos.z <= -_NearClip) { // Reminder: Forward is -Z. | ||
// Undistort the point's coordinates in XY. | ||
float r2 = clamp(dot(pos.xy, pos.xy) / (pos.z*pos.z), 0, _MaxRadSq); | ||
pos.xy *= 1 + (_Undistortion.x + _Undistortion.y*r2)*r2; | ||
} | ||
return pos; | ||
} | ||
|
||
// Multiply by no-lens projection matrix after undistortion. | ||
float4 undistortVertex(float4 pos) { | ||
return mul(_RealProjection, undistort(pos)); | ||
} | ||
|
||
// Surface shader hides away the MVP multiplication, so we have | ||
// to multiply by _FixProjection = inverse(MVP)*_RealProjection. | ||
float4 undistortSurface(float4 pos) { | ||
return mul(_FixProjection, undistort(pos)); | ||
} |
5 changes: 5 additions & 0 deletions
5
Roll a Ball VR/Assets/Cardboard/Distortion/CardboardDistortion.cginc.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
Roll a Ball VR/Assets/Cardboard/Editor/CardboardAudioListenerEditor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright 2015 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 UnityEditor; | ||
using System.Collections; | ||
|
||
/// A custom editor for properties on the CardboardAudioListener script. This appears in the | ||
/// Inspector window of a CardboardAudioListener object. | ||
[CustomEditor(typeof(CardboardAudioListener))] | ||
public class CardboardAudioListenerEditor : Editor { | ||
private SerializedProperty globalGainDb = null; | ||
private SerializedProperty quality = null; | ||
private SerializedProperty worldScale = null; | ||
|
||
private GUIContent globalGainLabel = new GUIContent("Global Gain (dB)", | ||
"Sets the global gain of the system. Can be used to adjust the overall output volume."); | ||
private GUIContent qualityLabel = new GUIContent("Quality", | ||
"Sets the quality mode in which the spatial audio will be rendered. " + | ||
"Higher quality modes allow for increased fidelity at the cost of greater CPU usage."); | ||
private GUIContent worldScaleLabel = new GUIContent("World Scale", | ||
"Sets the ratio between game units and real world units (meters)."); | ||
|
||
void OnEnable () { | ||
globalGainDb = serializedObject.FindProperty("globalGainDb"); | ||
quality = serializedObject.FindProperty("quality"); | ||
worldScale = serializedObject.FindProperty("worldScale"); | ||
} | ||
|
||
/// @cond | ||
public override void OnInspectorGUI () { | ||
serializedObject.Update(); | ||
|
||
// Rendering quality can only be modified through the Inspector in Edit mode. | ||
GUI.enabled = !EditorApplication.isPlaying; | ||
EditorGUILayout.PropertyField(quality, qualityLabel); | ||
GUI.enabled = true; | ||
|
||
EditorGUILayout.Separator(); | ||
|
||
EditorGUILayout.Slider(globalGainDb, CardboardAudio.minGainDb, CardboardAudio.maxGainDb, | ||
globalGainLabel); | ||
EditorGUILayout.Slider(worldScale, CardboardAudio.minWorldScale, CardboardAudio.maxWorldScale, | ||
worldScaleLabel); | ||
|
||
serializedObject.ApplyModifiedProperties(); | ||
} | ||
/// @endcond | ||
} |
Oops, something went wrong.