├── SampleProject ├── Assets │ ├── sk.png │ └── floor.hlsl ├── Platforms │ ├── StereoKit_UWP │ │ ├── Logo │ │ │ ├── Logo-16.png │ │ │ ├── Logo-44.png │ │ │ ├── Logo-50.png │ │ │ ├── Logo-71.png │ │ │ ├── Logo-150.png │ │ │ ├── Logo-310.png │ │ │ ├── Logo-Wide150.png │ │ │ └── Logo-Wide300.png │ │ ├── Properties │ │ │ ├── AssemblyInfo.cs │ │ │ └── Default.rd.xml │ │ ├── Program.cs │ │ ├── Package.appxmanifest │ │ └── MRDLSample_UWP.csproj │ ├── StereoKit_Android │ │ ├── Resources │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── values │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ └── activity_main.xml │ │ │ └── AboutResources.txt │ │ ├── Assets │ │ │ └── AboutAssets.txt │ │ ├── Properties │ │ │ ├── AssemblyInfo.cs │ │ │ └── AndroidManifest.xml │ │ ├── MainActivity.cs │ │ └── MRDLSample_Android.csproj │ └── StereoKit_DotNet │ │ ├── MRDLSample_DotNet.csproj │ │ └── Program.cs ├── MRDLSample.csproj ├── App.cs ├── .gitignore └── MRDLSample.sln ├── README.md ├── StereoKitMRDL ├── StereoKitMRDL.csproj ├── Assets │ ├── mrdl.hlsli │ ├── mrdl_frontplate.hlsl │ └── mrdl_plate.hlsl ├── MRUI.cs └── Theme.cs ├── LICENSE └── .gitignore /SampleProject/Assets/sk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Assets/sk.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_UWP/Logo/Logo-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_UWP/Logo/Logo-16.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_UWP/Logo/Logo-44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_UWP/Logo/Logo-44.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_UWP/Logo/Logo-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_UWP/Logo/Logo-50.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_UWP/Logo/Logo-71.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_UWP/Logo/Logo-71.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_UWP/Logo/Logo-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_UWP/Logo/Logo-150.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_UWP/Logo/Logo-310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_UWP/Logo/Logo-310.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_UWP/Logo/Logo-Wide150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_UWP/Logo/Logo-Wide150.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_UWP/Logo/Logo-Wide300.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_UWP/Logo/Logo-Wide300.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_UWP/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_UWP/Properties/AssemblyInfo.cs -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #2C3E50 4 | -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | StereoKit_Android 3 | Settings 4 | 5 | -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zee2/StereoKitMRDL/HEAD/SampleProject/Platforms/StereoKit_Android/Resources/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #2c3e50 4 | #1B3147 5 | #3498db 6 | 7 | -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MR Design Language for StereoKit 2 | 3 | image 4 | image 5 | 6 | 7 | A work-in-progress community-maintained set of themes and components for StereoKit. 8 | -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "AndroidAsset". 3 | 4 | These files will be deployed with your package and will be accessible using Android's 5 | AssetManager, like this: 6 | 7 | public class ReadAsset : Activity 8 | { 9 | protected override void OnCreate (Bundle bundle) 10 | { 11 | base.OnCreate (bundle); 12 | 13 | InputStream input = Assets.Open ("my_asset.txt"); 14 | } 15 | } 16 | 17 | Additionally, some Android functions will automatically load asset files: 18 | 19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_DotNet/MRDLSample_DotNet.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | PreserveNewest 20 | Assets\%(RecursiveDir)%(Filename)%(Extension) 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /SampleProject/MRDLSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /StereoKitMRDL/StereoKitMRDL.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_UWP/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using StereoKit; 3 | using StereoKitApp; 4 | 5 | class SKLoader 6 | { 7 | static void Main(string[] args) 8 | { 9 | // This will allow the App constructor to call a few SK methods 10 | // before Initialize is called. 11 | SK.PreLoadLibrary(); 12 | 13 | // If the app has a constructor that takes a string array, then 14 | // we'll use that, and pass the command line arguments into it on 15 | // creation 16 | Type appType = typeof(App); 17 | App app = appType.GetConstructor(new Type[] { typeof(string[]) }) != null 18 | ? (App)Activator.CreateInstance(appType, new object[] { args }) 19 | : (App)Activator.CreateInstance(appType); 20 | if (app == null) 21 | throw new Exception("StereoKit loader couldn't construct an instance of the App!"); 22 | 23 | // Initialize StereoKit, and the app 24 | if (!SK.Initialize(app.Settings)) 25 | Environment.Exit(1); 26 | app.Init(); 27 | 28 | // Now loop until finished, and then shut down 29 | SK.Run(app.Step); 30 | } 31 | } -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_DotNet/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using StereoKit; 3 | using StereoKitApp; 4 | 5 | class SKLoader 6 | { 7 | static void Main(string[] args) 8 | { 9 | // This will allow the App constructor to call a few SK methods 10 | // before Initialize is called. 11 | SK.PreLoadLibrary(); 12 | 13 | // If the app has a constructor that takes a string array, then 14 | // we'll use that, and pass the command line arguments into it on 15 | // creation 16 | Type appType = typeof(App); 17 | App app = appType.GetConstructor(new Type[] { typeof(string[]) }) != null 18 | ? (App)Activator.CreateInstance(appType, new object[] { args }) 19 | : (App)Activator.CreateInstance(appType); 20 | if (app == null) 21 | throw new Exception("StereoKit loader couldn't construct an instance of the App!"); 22 | 23 | // Initialize StereoKit, and the app 24 | if (!SK.Initialize(app.Settings)) 25 | Environment.Exit(1); 26 | app.Init(); 27 | 28 | // Now loop until finished, and then shut down 29 | SK.Run(app.Step); 30 | } 31 | } -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Android.App; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("StereoKit_Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("StereoKit_Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2018")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | [assembly: AssemblyVersion("1.0.0.0")] 26 | [assembly: AssemblyFileVersion("1.0.0.0")] 27 | -------------------------------------------------------------------------------- /StereoKitMRDL/Assets/mrdl.hlsli: -------------------------------------------------------------------------------- 1 | #include "stereokit.hlsli" 2 | 3 | float ProximityLight(float3 world_pos, float3 world_normal, float overallSize, float softness = 1.8f) 4 | { 5 | float result = 0.0; 6 | for (int i = 0; i < 2; i++) { 7 | float3 to_finger = sk_fingertip[i].xyz - world_pos; 8 | float d = dot(world_normal, to_finger); 9 | float3 on_plane = sk_fingertip[i].xyz - d * world_normal; 10 | 11 | float distanceFromProjectedPoint = length(world_pos - on_plane); 12 | 13 | float zDist = abs(d * length(to_finger)); 14 | 15 | float zFactor = (max(zDist, 0.001f) - 0.001f) / 0.005f; 16 | zFactor = zDist / 0.005f; 17 | 18 | float fadeFactor = zDist / 0.05f; 19 | 20 | float blobSize = lerp(0.025f * overallSize, 0.04f * overallSize, zFactor); 21 | 22 | float blob = (1.0f - saturate(distanceFromProjectedPoint / blobSize)); 23 | 24 | float power = lerp(softness, 1.8f, zFactor); 25 | 26 | float exp_amount = pow(blob, power); 27 | 28 | result += saturate(exp_amount) * (1 - saturate(fadeFactor)); 29 | } 30 | 31 | return saturate(result / 2.0); 32 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Finn Sinclair 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /StereoKitMRDL/MRUI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using StereoKit; 3 | 4 | namespace StereoKit.MRDL 5 | { 6 | public static class MRUI 7 | { 8 | public static void PlateBegin(string title, ref Pose platePose, UIMove moveType = UIMove.FaceUser) 9 | { 10 | UI.WindowBegin(title, ref platePose, UIWin.Body, moveType); 11 | } 12 | 13 | public static void PlateEnd() => UI.WindowEnd(); 14 | 15 | public static bool ActionButton(string text, Sprite icon) 16 | { 17 | // ButtonImg doesn't respect size arg! StereoKit/#448 18 | // This says 0.016 but actually renders closer to 0.032.... 19 | return UI.ButtonImg(text, icon, UIBtnLayout.CenterNoText, new Vec2(0.032f, 0.032f)); 20 | } 21 | 22 | public static bool ListButton(string text) 23 | { 24 | return UI.Button(text, new Vec2(0.128f, 0.032f)); 25 | } 26 | 27 | public static bool ListButton(string text, Sprite icon) 28 | { 29 | // ButtonImg doesn't respect size arg! StereoKit/#448 30 | // This says 0.016 but actually renders closer to 0.032.... 31 | return UI.ButtonImg(text, icon, UIBtnLayout.Left, new Vec2(0.128f, 0.032f)); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_UWP/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /SampleProject/Assets/floor.hlsl: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //--name = app/floor 4 | 5 | //--color:color = 0,0,0,1 6 | float4 color; 7 | //--radius = 5,10,0,0 8 | float4 radius; 9 | 10 | struct vsIn { 11 | float4 pos : SV_POSITION; 12 | }; 13 | struct psIn { 14 | float4 pos : SV_POSITION; 15 | float4 world : TEXCOORD0; 16 | uint view_id : SV_RenderTargetArrayIndex; 17 | }; 18 | 19 | psIn vs(vsIn input, uint id : SV_InstanceID) { 20 | psIn o; 21 | o.view_id = id % sk_view_count; 22 | id = id / sk_view_count; 23 | 24 | o.world = mul(input.pos, sk_inst[id].world); 25 | o.pos = mul(o.world, sk_viewproj[o.view_id]); 26 | 27 | return o; 28 | } 29 | float4 ps(psIn input) : SV_TARGET{ 30 | // This line algorithm is inspired by : 31 | // http://madebyevan.com/shaders/grid/ 32 | 33 | // Minor grid lines 34 | float2 step = 1 / fwidth(input.world.xz); 35 | float2 grid = abs(frac(input.world.xz - 0.5) - 0.5) * step; // minor grid lines 36 | float dist = sqrt(dot(input.world.xz, input.world.xz)); // transparency falloff 37 | float size = min(grid.x, grid.y); 38 | float val = 1.0 - min(size, 1.0); 39 | val *= saturate(1 - ((dist - radius.x)/radius.y)); 40 | 41 | // Major axis lines 42 | const float extraThickness = 0.5; 43 | float2 axes = (abs(input.world.xz)) * step - extraThickness; 44 | size = min(axes.x, axes.y); 45 | float axisVal = 1.0 - min(size, 1.0); 46 | axisVal *= saturate(1 - ((dist - radius.x*1.5)/(radius.y*1.5))); 47 | 48 | // combine, and drop transparent pixels 49 | val = max(val*0.6, axisVal); 50 | if (val <= 0) discard; 51 | 52 | return float4(color.rgb, val); 53 | } -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 1 | Images, layout descriptions, binary blobs and string dictionaries can be included 2 | in your application as resource files. Various Android APIs are designed to 3 | operate on the resource IDs instead of dealing with images, strings or binary blobs 4 | directly. 5 | 6 | For example, a sample Android app that contains a user interface layout (main.xml), 7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 8 | would keep its resources in the "Resources" directory of the application: 9 | 10 | Resources/ 11 | drawable/ 12 | icon.png 13 | 14 | layout/ 15 | main.xml 16 | 17 | values/ 18 | strings.xml 19 | 20 | In order to get the build system to recognize Android resources, set the build action to 21 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 22 | instead operate on resource IDs. When you compile an Android application that uses resources, 23 | the build system will package the resources for distribution and generate a class called "R" 24 | (this is an Android convention) that contains the tokens for each one of the resources 25 | included. For example, for the above Resources layout, this is what the R class would expose: 26 | 27 | public class R { 28 | public class drawable { 29 | public const int icon = 0x123; 30 | } 31 | 32 | public class layout { 33 | public const int main = 0x456; 34 | } 35 | 36 | public class strings { 37 | public const int first_string = 0xabc; 38 | public const int second_string = 0xbcd; 39 | } 40 | } 41 | 42 | You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main 43 | to reference the layout/main.xml file, or R.strings.first_string to reference the first 44 | string in the dictionary file values/strings.xml. -------------------------------------------------------------------------------- /SampleProject/App.cs: -------------------------------------------------------------------------------- 1 | using StereoKit; 2 | using StereoKit.MRDL; 3 | using StereoKit.HolographicRemoting; 4 | 5 | namespace StereoKitApp 6 | { 7 | public class App 8 | { 9 | // public App() 10 | // { 11 | // SK.PreLoadLibrary(); 12 | // SK.AddStepper(new HolographicRemoting("169.254.142.15")); 13 | // } 14 | 15 | public SKSettings Settings => new SKSettings { 16 | appName = "MRDL Sample", 17 | assetsFolder = "Assets", 18 | displayPreference = DisplayMode.MixedReality 19 | }; 20 | 21 | Matrix floorTransform = Matrix.TS(new Vec3(0, -1.5f, 0), new Vec3(30, 0.1f, 30)); 22 | Material floorMaterial; 23 | Sprite icon; 24 | 25 | Pose windowPose = new Pose(new Vec3(0, 0.1f, -0.3f), Quat.LookDir(new Vec3(0, 0, 1))); 26 | 27 | public void Init() 28 | { 29 | 30 | floorMaterial = new Material(Shader.FromFile("floor.hlsl")); 31 | floorMaterial.Transparency = Transparency.Blend; 32 | 33 | icon = Sprite.FromFile("sk.png"); 34 | 35 | HolographicTheme.Apply(); 36 | } 37 | 38 | public void Step() 39 | { 40 | Input.Hand(Handed.Left).Visible = SK.System.displayType == Display.Opaque; 41 | Input.Hand(Handed.Right).Visible = SK.System.displayType == Display.Opaque; 42 | 43 | HolographicTheme.Apply(); 44 | 45 | if (SK.System.displayType == Display.Opaque) 46 | Default.MeshCube.Draw(floorMaterial, floorTransform); 47 | 48 | MRUI.PlateBegin("Window", ref windowPose, UIMove.Exact); 49 | 50 | MRUI.ActionButton("1", icon); 51 | UI.SameLine(); 52 | MRUI.ActionButton("2", icon); 53 | UI.SameLine(); 54 | MRUI.ActionButton("3", icon); 55 | UI.SameLine(); 56 | MRUI.ActionButton("4", icon); 57 | 58 | MRUI.ListButton("Test1"); 59 | MRUI.ListButton("Test2", icon); 60 | 61 | // TODO: Remove when gutter bug is fixed! 62 | UI.Space(0.008f); 63 | 64 | MRUI.PlateEnd(); 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_UWP/Package.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | StereoKit_UWP 18 | StereoKit 19 | Logo\Logo-50.png 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /StereoKitMRDL/Assets/mrdl_frontplate.hlsl: -------------------------------------------------------------------------------- 1 | #include "mrdl.hlsli" 2 | 3 | //--name = mrdl_frontplate 4 | //--color:color = .2, .2, .2, 1 5 | 6 | float4 color; 7 | 8 | struct vsIn { 9 | float4 pos : SV_Position; 10 | float3 norm : NORMAL0; 11 | float2 quadrant : TEXCOORD0; 12 | float4 color : COLOR0; 13 | }; 14 | struct psIn { 15 | float4 pos : SV_Position; 16 | float3 normal : NORMAL0; 17 | float4 light_edge : COLOR0; 18 | float4 inst_col : COLOR1; 19 | float4 world : TEXCOORD0; 20 | float alpha : TEXCOORD1; 21 | float glow_mask : TEXCOORD2; 22 | uint view_id : SV_RenderTargetArrayIndex; 23 | }; 24 | 25 | psIn vs(vsIn input, uint id : SV_InstanceID) { 26 | psIn o; 27 | o.view_id = id % sk_view_count; 28 | id = id / sk_view_count; 29 | 30 | // Extract scale from the matrix 31 | float4x4 world_mat = sk_inst[id].world; 32 | float2 scale = float2( 33 | length(float3(world_mat._11, world_mat._12, world_mat._13)), 34 | length(float3(world_mat._21, world_mat._22, world_mat._23)) 35 | ); 36 | // Restore scale to 1 37 | world_mat[0] = world_mat[0] / scale.x; 38 | world_mat[1] = world_mat[1] / scale.y; 39 | // Translate the position using the quadrant (TEXCOORD0) information and 40 | // the extracted scale. 41 | float4 sized_pos; 42 | sized_pos.xy = input.pos.xy + input.quadrant * scale * 0.5; 43 | sized_pos.zw = input.pos.zw; 44 | 45 | o.world = mul(sized_pos, world_mat); 46 | o.pos = mul(o.world, sk_viewproj[o.view_id]); 47 | o.normal = normalize(mul(input.norm, (float3x3)world_mat)); 48 | 49 | o.inst_col = sk_inst[id].color; 50 | o.light_edge.rgb = float3(1, 1, 1); 51 | o.light_edge.a = input.color.a; 52 | o.alpha = input.color.b > 0.5 ? 1 : (o.inst_col.a - 1) * 0.5; 53 | o.glow_mask = input.color.g; 54 | 55 | return o; 56 | } 57 | 58 | float4 ps(psIn input) : SV_TARGET{ 59 | //float glow_amt = saturate(dist.from_finger / ring_max_dist); 60 | float glow_amt = ProximityLight(input.world.xyz, input.normal, 1.0f); 61 | float edge_amt = ProximityLight(input.world.xyz, input.normal, 2.0f); 62 | 63 | const float stroke_thickness = 0.1f; 64 | float edge = 1 - saturate((input.light_edge.a - stroke_thickness) / fwidth(input.light_edge.a)); 65 | 66 | float4 col = lerp(input.inst_col, color, edge) * input.inst_col.a; 67 | col.a = max(max(glow_amt, input.alpha), edge_amt); 68 | col.rgb = col.rgb * col.a; 69 | 70 | col = col + glow_amt * float4(0.025, 0.058, 0.829, 1.0f) * 5 * input.glow_mask + edge_amt * edge; 71 | 72 | return col; 73 | } -------------------------------------------------------------------------------- /StereoKitMRDL/Assets/mrdl_plate.hlsl: -------------------------------------------------------------------------------- 1 | 2 | #include "mrdl.hlsli" 3 | 4 | //--name = mrdl_plate 5 | //--color:color = .2, .2, .2, 1 6 | 7 | float4 color; 8 | 9 | struct vsIn { 10 | float4 pos : SV_Position; 11 | float3 norm : NORMAL0; 12 | float2 quadrant : TEXCOORD0; 13 | float4 color : COLOR0; 14 | }; 15 | struct psIn { 16 | float4 pos : SV_Position; 17 | float3 normal : NORMAL0; 18 | float4 light_edge : COLOR0; 19 | float4 inst_col : COLOR1; 20 | float4 world : TEXCOORD0; 21 | float alpha : TEXCOORD1; 22 | float glow_mask : TEXCOORD2; 23 | uint view_id : SV_RenderTargetArrayIndex; 24 | }; 25 | 26 | psIn vs(vsIn input, uint id : SV_InstanceID) { 27 | psIn o; 28 | o.view_id = id % sk_view_count; 29 | id = id / sk_view_count; 30 | 31 | // Extract scale from the matrix 32 | float4x4 world_mat = sk_inst[id].world; 33 | float2 scale = float2( 34 | length(float3(world_mat._11, world_mat._12, world_mat._13)), 35 | length(float3(world_mat._21, world_mat._22, world_mat._23)) 36 | ); 37 | // Restore scale to 1 38 | world_mat[0] = world_mat[0] / scale.x; 39 | world_mat[1] = world_mat[1] / scale.y; 40 | // Translate the position using the quadrant (TEXCOORD0) information and 41 | // the extracted scale. 42 | float4 sized_pos; 43 | sized_pos.xy = input.pos.xy + input.quadrant * scale * 0.5; 44 | sized_pos.zw = input.pos.zw; 45 | 46 | o.world = mul(sized_pos, world_mat); 47 | o.pos = mul(o.world, sk_viewproj[o.view_id]); 48 | o.normal = normalize(mul(input.norm, (float3x3)world_mat)); 49 | 50 | o.inst_col = sk_inst[id].color; 51 | o.light_edge.rgb = Lighting(o.normal); 52 | o.light_edge.a = input.color.a; 53 | o.alpha = input.color.b > 0.5 ? 1 : (o.inst_col.a - 1) * 0.5; 54 | o.glow_mask = input.color.g; 55 | 56 | return o; 57 | } 58 | 59 | static const int ir_gradient_count = 5; 60 | static const float3 ir_gradient[] = { float3(0,0,0), float3(0,0,0), float3(0.065,0.018,0.429), float3(0,0,0), float3(0.013, 0.117, 0.597), float3(0,0,0) }; 61 | float3 GetIridescence(uint view_id, float3 world_pos, float3 surface_normal) { 62 | float3 dir = normalize(sk_camera_pos[view_id].xyz - world_pos); 63 | float ir = saturate(dot(dir, surface_normal)); 64 | 65 | float pct = ir * ir_gradient_count; 66 | int g = pct; 67 | pct = smoothstep(0, 1, frac(pct)); 68 | float3 curr = ir_gradient[g]; 69 | float3 next = ir_gradient[g + 1]; 70 | return lerp(curr, next, pct); 71 | } 72 | 73 | float4 ps(psIn input) : SV_TARGET{ 74 | 75 | float3 iridescence = GetIridescence(input.view_id, input.world.xyz, input.normal); 76 | 77 | const float stroke_thickness = 0.1f; 78 | float edge = saturate((input.light_edge.a - stroke_thickness) / fwidth(input.light_edge.a)); 79 | 80 | float4 col = lerp(color, input.inst_col, edge) * input.inst_col.a; 81 | col.rgb = col.rgb * input.light_edge.rgb + iridescence; 82 | col.a = input.alpha; 83 | col.rgb = col.rgb * col.a; 84 | return col; 85 | } -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.OS; 3 | using Android.Support.V7.App; 4 | using Android.Runtime; 5 | using Android.Views; 6 | using Android.Content; 7 | using StereoKit; 8 | using System; 9 | using Android.Graphics; 10 | using Java.Lang; 11 | using System.Threading.Tasks; 12 | using StereoKitApp; 13 | 14 | namespace StereoKit_Android 15 | { 16 | [Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)] 17 | [IntentFilter(new[] { Intent.ActionMain }, Categories = new[] { "com.oculus.intent.category.VR", Intent.CategoryLauncher })] 18 | public class MainActivity : AppCompatActivity, ISurfaceHolderCallback2 19 | { 20 | App app; 21 | View surface; 22 | 23 | protected override void OnCreate(Bundle savedInstanceState) 24 | { 25 | JavaSystem.LoadLibrary("openxr_loader"); 26 | JavaSystem.LoadLibrary("StereoKitC"); 27 | 28 | // Set up a surface for StereoKit to draw on 29 | Window.TakeSurface(this); 30 | Window.SetFormat(Format.Unknown); 31 | surface = new View(this); 32 | SetContentView(surface); 33 | surface.RequestFocus(); 34 | 35 | base.OnCreate(savedInstanceState); 36 | Xamarin.Essentials.Platform.Init(this, savedInstanceState); 37 | 38 | Run(Handle); 39 | } 40 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) 41 | { 42 | Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); 43 | base.OnRequestPermissionsResult(requestCode, permissions, grantResults); 44 | } 45 | 46 | static bool running = false; 47 | void Run(IntPtr activityHandle) 48 | { 49 | if (running) 50 | return; 51 | running = true; 52 | 53 | Task.Run(() => { 54 | // If the app has a constructor that takes a string array, then 55 | // we'll use that, and pass the command line arguments into it on 56 | // creation 57 | Type appType = typeof(App); 58 | app = appType.GetConstructor(new Type[] { typeof(string[]) }) != null 59 | ? (App)Activator.CreateInstance(appType, new object[] { new string[0] { } }) 60 | : (App)Activator.CreateInstance(appType); 61 | if (app == null) 62 | throw new System.Exception("StereoKit loader couldn't construct an instance of the App!"); 63 | 64 | // Initialize StereoKit, and the app 65 | SKSettings settings = app.Settings; 66 | settings.androidActivity = activityHandle; 67 | if (!SK.Initialize(settings)) 68 | return; 69 | app.Init(); 70 | 71 | // Now loop until finished, and then shut down 72 | SK.Run(app.Step); 73 | 74 | Android.OS.Process.KillProcess(Android.OS.Process.MyPid()); 75 | }); 76 | } 77 | 78 | // Events related to surface state changes 79 | public void SurfaceChanged (ISurfaceHolder holder, [GeneratedEnum] Format format, int width, int height) => SK.SetWindow(holder.Surface.Handle); 80 | public void SurfaceCreated (ISurfaceHolder holder) => SK.SetWindow(holder.Surface.Handle); 81 | public void SurfaceDestroyed (ISurfaceHolder holder) => SK.SetWindow(IntPtr.Zero); 82 | public void SurfaceRedrawNeeded(ISurfaceHolder holder) { } 83 | } 84 | } -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_Android/MRDLSample_Android.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7} 9 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10 | {122416d6-6b49-4ee2-a1e8-b825f31c79fe} 11 | Library 12 | Properties 13 | StereoKit_Android 14 | StereoKit_Android 15 | 512 16 | True 17 | True 18 | Resources\Resource.designer.cs 19 | Resource 20 | Off 21 | false 22 | v9.0 23 | Properties\AndroidManifest.xml 24 | Resources 25 | Assets 26 | true 27 | true 28 | Xamarin.Android.Net.AndroidClientHandler 29 | 30 | 31 | True 32 | portable 33 | False 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | prompt 37 | 4 38 | True 39 | None 40 | False 41 | 42 | 43 | True 44 | portable 45 | True 46 | bin\Release\ 47 | TRACE 48 | prompt 49 | 4 50 | true 51 | False 52 | SdkOnly 53 | True 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | PreserveNewest 76 | Assets\%(RecursiveDir)%(Filename)%(Extension) 77 | 78 | 79 | 80 | 81 | 82 | Designer 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 0.3.7-preview.3 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | {9a9b3dd2-9925-4e07-9857-513501540739} 121 | MRDLSample 122 | 123 | 124 | 125 | 132 | -------------------------------------------------------------------------------- /SampleProject/Platforms/StereoKit_UWP/MRDLSample_UWP.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | x64 7 | {4F693D80-51B1-48F6-9752-509D8E2EDD97} 8 | AppContainerExe 9 | Properties 10 | StereoKit_UWP 11 | StereoKit_UWP 12 | en-US 13 | UAP 14 | 10.0.18362.0 15 | 10.0.17763.0 16 | 16 17 | 512 18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 19 | true 20 | false 21 | 22 | 23 | true 24 | bin\ARM64\Debug\ 25 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 26 | ;2008 27 | full 28 | ARM64 29 | false 30 | prompt 31 | true 32 | true 33 | 34 | 35 | bin\ARM64\Release\ 36 | TRACE;NETFX_CORE;WINDOWS_UWP 37 | true 38 | ;2008 39 | pdbonly 40 | ARM64 41 | false 42 | prompt 43 | true 44 | true 45 | 46 | 47 | true 48 | bin\x64\Debug\ 49 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 50 | ;2008 51 | full 52 | x64 53 | false 54 | prompt 55 | true 56 | true 57 | 58 | 59 | bin\x64\Release\ 60 | TRACE;NETFX_CORE;WINDOWS_UWP 61 | true 62 | ;2008 63 | pdbonly 64 | x64 65 | false 66 | prompt 67 | true 68 | true 69 | 70 | 71 | PackageReference 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | Designer 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | PreserveNewest 97 | Assets\%(RecursiveDir)%(Filename)%(Extension) 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | {9a9b3dd2-9925-4e07-9857-513501540739} 107 | MRDLSample 108 | 109 | 110 | 111 | 16.0 112 | 113 | 114 | true 115 | bin\ARM\Debug\ 116 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS 117 | ;2008 118 | true 119 | full 120 | ARM 121 | false 122 | 7.3 123 | prompt 124 | true 125 | 126 | 127 | bin\ARM\Release\ 128 | TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS 129 | true 130 | ;2008 131 | true 132 | pdbonly 133 | ARM 134 | false 135 | 7.3 136 | prompt 137 | true 138 | 139 | 140 | 147 | -------------------------------------------------------------------------------- /SampleProject/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | /[Bb]in/ 21 | x64/ 22 | x86/ 23 | bld/ 24 | **/templatized/ 25 | zig-cache/ 26 | 27 | [Oo]bj/ 28 | 29 | # Visual Studio 2015/2017 cache/options directory 30 | .vs/ 31 | #Moses VSCode 32 | .vscode/ 33 | # Uncomment if you have tasks that create the project's static files in wwwroot 34 | #wwwroot/ 35 | 36 | # Visual Studio 2017 auto generated files 37 | Generated\ Files/ 38 | 39 | # MSTest test Results 40 | [Tt]est[Rr]esult*/ 41 | [Bb]uild[Ll]og.* 42 | 43 | # NUNIT 44 | *.VisualState.xml 45 | TestResult.xml 46 | 47 | # Build Results of an ATL Project 48 | [Dd]ebugPS/ 49 | [Rr]eleasePS/ 50 | dlldata.c 51 | 52 | # Benchmark Results 53 | BenchmarkDotNet.Artifacts/ 54 | 55 | # .NET Core 56 | project.lock.json 57 | project.fragment.lock.json 58 | artifacts/ 59 | **/Properties/launchSettings.json 60 | 61 | # StyleCop 62 | StyleCopReport.xml 63 | 64 | # Files built by Visual Studio 65 | *_i.c 66 | *_p.c 67 | *_i.h 68 | *.ilk 69 | *.meta 70 | *.obj 71 | *.iobj 72 | *.pch 73 | *.pdb 74 | *.ipdb 75 | *.pgc 76 | *.pgd 77 | *.rsp 78 | *.sbr 79 | *.tlb 80 | *.tli 81 | *.tlh 82 | *.tmp 83 | *.tmp_proj 84 | *.log 85 | *.vspscc 86 | *.vssscc 87 | .builds 88 | *.pidb 89 | *.svclog 90 | *.scc 91 | 92 | # Chutzpah Test files 93 | _Chutzpah* 94 | 95 | # Visual C++ cache files 96 | ipch/ 97 | *.aps 98 | *.ncb 99 | *.opendb 100 | *.opensdf 101 | *.sdf 102 | *.cachefile 103 | *.VC.db 104 | *.VC.VC.opendb 105 | 106 | # Visual Studio profiler 107 | *.psess 108 | *.vsp 109 | *.vspx 110 | *.sap 111 | 112 | # Visual Studio Trace Files 113 | *.e2e 114 | 115 | # TFS 2012 Local Workspace 116 | $tf/ 117 | 118 | # Guidance Automation Toolkit 119 | *.gpState 120 | 121 | # ReSharper is a .NET coding add-in 122 | _ReSharper*/ 123 | *.[Rr]e[Ss]harper 124 | *.DotSettings.user 125 | 126 | # JustCode is a .NET coding add-in 127 | .JustCode 128 | 129 | # TeamCity is a build add-in 130 | _TeamCity* 131 | 132 | # DotCover is a Code Coverage Tool 133 | *.dotCover 134 | 135 | # AxoCover is a Code Coverage Tool 136 | .axoCover/* 137 | !.axoCover/settings.json 138 | 139 | # Visual Studio code coverage results 140 | *.coverage 141 | *.coveragexml 142 | 143 | # NCrunch 144 | _NCrunch_* 145 | .*crunch*.local.xml 146 | nCrunchTemp_* 147 | 148 | # MightyMoose 149 | *.mm.* 150 | AutoTest.Net/ 151 | 152 | # Web workbench (sass) 153 | .sass-cache/ 154 | 155 | # Installshield output folder 156 | [Ee]xpress/ 157 | 158 | # DocProject is a documentation generator add-in 159 | DocProject/buildhelp/ 160 | DocProject/Help/*.HxT 161 | DocProject/Help/*.HxC 162 | DocProject/Help/*.hhc 163 | DocProject/Help/*.hhk 164 | DocProject/Help/*.hhp 165 | DocProject/Help/Html2 166 | DocProject/Help/html 167 | 168 | # Click-Once directory 169 | publish/ 170 | 171 | # Publish Web Output 172 | *.[Pp]ublish.xml 173 | *.azurePubxml 174 | # Note: Comment the next line if you want to checkin your web deploy settings, 175 | # but database connection strings (with potential passwords) will be unencrypted 176 | *.pubxml 177 | *.publishproj 178 | 179 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 180 | # checkin your Azure Web App publish settings, but sensitive information contained 181 | # in these scripts will be unencrypted 182 | PublishScripts/ 183 | 184 | # NuGet Packages 185 | *.nupkg 186 | # The packages folder can be ignored because of Package Restore 187 | **/[Pp]ackages/* 188 | # except build/, which is used as an MSBuild target. 189 | !**/[Pp]ackages/build/ 190 | # Uncomment if necessary however generally it will be regenerated when needed 191 | #!**/[Pp]ackages/repositories.config 192 | # NuGet v3's project.json files produces more ignorable files 193 | *.nuget.props 194 | *.nuget.targets 195 | .nugetkey 196 | 197 | # Microsoft Azure Build Output 198 | csx/ 199 | *.build.csdef 200 | 201 | # Microsoft Azure Emulator 202 | ecf/ 203 | rcf/ 204 | 205 | # Windows Store app package directories and files 206 | AppPackages/ 207 | BundleArtifacts/ 208 | Package.StoreAssociation.xml 209 | _pkginfo.txt 210 | *.appx 211 | 212 | # Visual Studio cache files 213 | # files ending in .cache can be ignored 214 | *.[Cc]ache 215 | # but keep track of directories ending in .cache 216 | !*.[Cc]ache/ 217 | 218 | # Others 219 | ClientBin/ 220 | ~$* 221 | *~ 222 | *.dbmdl 223 | *.dbproj.schemaview 224 | *.jfm 225 | *.pfx 226 | *.publishsettings 227 | orleans.codegen.cs 228 | 229 | # Including strong name files can present a security risk 230 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 231 | #*.snk 232 | 233 | # Since there are multiple workflows, uncomment next line to ignore bower_components 234 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 235 | #bower_components/ 236 | 237 | # RIA/Silverlight projects 238 | Generated_Code/ 239 | 240 | # Backup & report files from converting an old project file 241 | # to a newer Visual Studio version. Backup files are not needed, 242 | # because we have git ;-) 243 | _UpgradeReport_Files/ 244 | Backup*/ 245 | UpgradeLog*.XML 246 | UpgradeLog*.htm 247 | ServiceFabricBackup/ 248 | *.rptproj.bak 249 | 250 | # SQL Server files 251 | *.mdf 252 | *.ldf 253 | *.ndf 254 | 255 | # Business Intelligence projects 256 | *.rdl.data 257 | *.bim.layout 258 | *.bim_*.settings 259 | *.rptproj.rsuser 260 | 261 | # Microsoft Fakes 262 | FakesAssemblies/ 263 | 264 | # GhostDoc plugin setting file 265 | *.GhostDoc.xml 266 | 267 | # Node.js Tools for Visual Studio 268 | .ntvs_analysis.dat 269 | node_modules/ 270 | 271 | # Visual Studio 6 build log 272 | *.plg 273 | 274 | # Visual Studio 6 workspace options file 275 | *.opt 276 | 277 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 278 | *.vbw 279 | 280 | # Visual Studio LightSwitch build output 281 | **/*.HTMLClient/GeneratedArtifacts 282 | **/*.DesktopClient/GeneratedArtifacts 283 | **/*.DesktopClient/ModelManifest.xml 284 | **/*.Server/GeneratedArtifacts 285 | **/*.Server/ModelManifest.xml 286 | _Pvt_Extensions 287 | 288 | # Paket dependency manager 289 | .paket/paket.exe 290 | paket-files/ 291 | 292 | # FAKE - F# Make 293 | .fake/ 294 | 295 | # JetBrains Rider 296 | .idea/ 297 | *.sln.iml 298 | 299 | # CodeRush 300 | .cr/ 301 | 302 | # Python Tools for Visual Studio (PTVS) 303 | __pycache__/ 304 | *.pyc 305 | 306 | # Cake - Uncomment if you are using it 307 | # tools/** 308 | # !tools/packages.config 309 | 310 | # Tabs Studio 311 | *.tss 312 | 313 | # Telerik's JustMock configuration file 314 | *.jmconfig 315 | 316 | # BizTalk build output 317 | *.btp.cs 318 | *.btm.cs 319 | *.odx.cs 320 | *.xsd.cs 321 | 322 | # OpenCover UI analysis results 323 | OpenCover/ 324 | 325 | # Azure Stream Analytics local run output 326 | ASALocalRun/ 327 | 328 | # MSBuild Binary and Structured Log 329 | *.binlog 330 | 331 | # NVidia Nsight GPU debugger configuration file 332 | *.nvuser 333 | 334 | # MFractors (Xamarin productivity tool) working folder 335 | .mfractor/ 336 | 337 | !StereoKitC/lib/bin/** 338 | !**/Assets/** 339 | 340 | # Ignore dependency build related stuff 341 | Tools/oxr_current.txt 342 | StereoKitC/lib/bin/**/openxr_loader.lib 343 | StereoKitC/lib/bin/**/*reactphysics3d.* 344 | 345 | # Ignore cached shader blobs 346 | */Assets/cache 347 | StereoKitC/shaders_builtin/*.sks 348 | 349 | _site/ 350 | .jekyll-cache/ 351 | *.lock 352 | build/ 353 | build_*/ 354 | 355 | .vscode/ 356 | 357 | # Xmake cache files 358 | .xmake/ 359 | 360 | # Clangd cache 361 | .clangd/ 362 | -------------------------------------------------------------------------------- /SampleProject/MRDLSample.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.2.32505.173 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MRDLSample_DotNet", "Platforms\StereoKit_DotNet\MRDLSample_DotNet.csproj", "{2930BBFF-27E8-449A-A6F4-24642C573178}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MRDLSample", "MRDLSample.csproj", "{9A9B3DD2-9925-4E07-9857-513501540739}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Platforms", "Platforms", "{22090651-387D-4E47-BF87-4B854DCE5DB1}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MRDLSample_UWP", "Platforms\StereoKit_UWP\MRDLSample_UWP.csproj", "{4F693D80-51B1-48F6-9752-509D8E2EDD97}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MRDLSample_Android", "Platforms\StereoKit_Android\MRDLSample_Android.csproj", "{D7E1E175-556B-45FE-8F03-67FFC9FA97D7}" 15 | EndProject 16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StereoKitMRDL", "..\StereoKitMRDL\StereoKitMRDL.csproj", "{32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|Any CPU = Debug|Any CPU 21 | Debug|ARM = Debug|ARM 22 | Debug|ARM64 = Debug|ARM64 23 | Debug|x64 = Debug|x64 24 | Release|Any CPU = Release|Any CPU 25 | Release|ARM = Release|ARM 26 | Release|ARM64 = Release|ARM64 27 | Release|x64 = Release|x64 28 | EndGlobalSection 29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 30 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Debug|ARM.ActiveCfg = Debug|Any CPU 33 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Debug|ARM.Build.0 = Debug|Any CPU 34 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Debug|ARM64.ActiveCfg = Debug|Any CPU 35 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Debug|ARM64.Build.0 = Debug|Any CPU 36 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Debug|x64.ActiveCfg = Debug|Any CPU 37 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Debug|x64.Build.0 = Debug|Any CPU 38 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Release|ARM.ActiveCfg = Release|Any CPU 41 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Release|ARM.Build.0 = Release|Any CPU 42 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Release|ARM64.ActiveCfg = Release|Any CPU 43 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Release|ARM64.Build.0 = Release|Any CPU 44 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Release|x64.ActiveCfg = Release|Any CPU 45 | {2930BBFF-27E8-449A-A6F4-24642C573178}.Release|x64.Build.0 = Release|Any CPU 46 | {9A9B3DD2-9925-4E07-9857-513501540739}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 47 | {9A9B3DD2-9925-4E07-9857-513501540739}.Debug|Any CPU.Build.0 = Debug|Any CPU 48 | {9A9B3DD2-9925-4E07-9857-513501540739}.Debug|ARM.ActiveCfg = Debug|Any CPU 49 | {9A9B3DD2-9925-4E07-9857-513501540739}.Debug|ARM.Build.0 = Debug|Any CPU 50 | {9A9B3DD2-9925-4E07-9857-513501540739}.Debug|ARM64.ActiveCfg = Debug|Any CPU 51 | {9A9B3DD2-9925-4E07-9857-513501540739}.Debug|ARM64.Build.0 = Debug|Any CPU 52 | {9A9B3DD2-9925-4E07-9857-513501540739}.Debug|x64.ActiveCfg = Debug|Any CPU 53 | {9A9B3DD2-9925-4E07-9857-513501540739}.Debug|x64.Build.0 = Debug|Any CPU 54 | {9A9B3DD2-9925-4E07-9857-513501540739}.Release|Any CPU.ActiveCfg = Release|Any CPU 55 | {9A9B3DD2-9925-4E07-9857-513501540739}.Release|Any CPU.Build.0 = Release|Any CPU 56 | {9A9B3DD2-9925-4E07-9857-513501540739}.Release|ARM.ActiveCfg = Release|Any CPU 57 | {9A9B3DD2-9925-4E07-9857-513501540739}.Release|ARM.Build.0 = Release|Any CPU 58 | {9A9B3DD2-9925-4E07-9857-513501540739}.Release|ARM64.ActiveCfg = Release|Any CPU 59 | {9A9B3DD2-9925-4E07-9857-513501540739}.Release|ARM64.Build.0 = Release|Any CPU 60 | {9A9B3DD2-9925-4E07-9857-513501540739}.Release|x64.ActiveCfg = Release|Any CPU 61 | {9A9B3DD2-9925-4E07-9857-513501540739}.Release|x64.Build.0 = Release|Any CPU 62 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Debug|Any CPU.ActiveCfg = Debug|x64 63 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Debug|ARM.ActiveCfg = Debug|ARM 64 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Debug|ARM.Build.0 = Debug|ARM 65 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Debug|ARM.Deploy.0 = Debug|ARM 66 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Debug|ARM64.ActiveCfg = Debug|ARM64 67 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Debug|ARM64.Build.0 = Debug|ARM64 68 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Debug|ARM64.Deploy.0 = Debug|ARM64 69 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Debug|x64.ActiveCfg = Debug|x64 70 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Debug|x64.Build.0 = Debug|x64 71 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Debug|x64.Deploy.0 = Debug|x64 72 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Release|Any CPU.ActiveCfg = Release|x64 73 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Release|ARM.ActiveCfg = Release|ARM 74 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Release|ARM.Deploy.0 = Release|ARM 75 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Release|ARM64.ActiveCfg = Release|ARM64 76 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Release|ARM64.Build.0 = Release|ARM64 77 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Release|ARM64.Deploy.0 = Release|ARM64 78 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Release|x64.ActiveCfg = Release|x64 79 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Release|x64.Build.0 = Release|x64 80 | {4F693D80-51B1-48F6-9752-509D8E2EDD97}.Release|x64.Deploy.0 = Release|x64 81 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 82 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Debug|Any CPU.Build.0 = Debug|Any CPU 83 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 84 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Debug|ARM.ActiveCfg = Debug|Any CPU 85 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Debug|ARM64.ActiveCfg = Debug|Any CPU 86 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Debug|ARM64.Build.0 = Debug|Any CPU 87 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Debug|ARM64.Deploy.0 = Debug|Any CPU 88 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Debug|x64.ActiveCfg = Debug|Any CPU 89 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Debug|x64.Build.0 = Debug|Any CPU 90 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Debug|x64.Deploy.0 = Debug|Any CPU 91 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Release|Any CPU.ActiveCfg = Release|Any CPU 92 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Release|Any CPU.Build.0 = Release|Any CPU 93 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Release|Any CPU.Deploy.0 = Release|Any CPU 94 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Release|ARM.ActiveCfg = Release|Any CPU 95 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Release|ARM.Build.0 = Release|Any CPU 96 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Release|ARM.Deploy.0 = Release|Any CPU 97 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Release|ARM64.ActiveCfg = Release|Any CPU 98 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Release|ARM64.Build.0 = Release|Any CPU 99 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Release|ARM64.Deploy.0 = Release|Any CPU 100 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Release|x64.ActiveCfg = Release|Any CPU 101 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Release|x64.Build.0 = Release|Any CPU 102 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7}.Release|x64.Deploy.0 = Release|Any CPU 103 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 104 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Debug|Any CPU.Build.0 = Debug|Any CPU 105 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Debug|ARM.ActiveCfg = Debug|Any CPU 106 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Debug|ARM.Build.0 = Debug|Any CPU 107 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Debug|ARM64.ActiveCfg = Debug|Any CPU 108 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Debug|ARM64.Build.0 = Debug|Any CPU 109 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Debug|x64.ActiveCfg = Debug|Any CPU 110 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Debug|x64.Build.0 = Debug|Any CPU 111 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Release|Any CPU.ActiveCfg = Release|Any CPU 112 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Release|Any CPU.Build.0 = Release|Any CPU 113 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Release|ARM.ActiveCfg = Release|Any CPU 114 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Release|ARM.Build.0 = Release|Any CPU 115 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Release|ARM64.ActiveCfg = Release|Any CPU 116 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Release|ARM64.Build.0 = Release|Any CPU 117 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Release|x64.ActiveCfg = Release|Any CPU 118 | {32CA3DE0-CC0F-4EB8-B2B4-07B4C1F838C4}.Release|x64.Build.0 = Release|Any CPU 119 | EndGlobalSection 120 | GlobalSection(SolutionProperties) = preSolution 121 | HideSolutionNode = FALSE 122 | EndGlobalSection 123 | GlobalSection(NestedProjects) = preSolution 124 | {2930BBFF-27E8-449A-A6F4-24642C573178} = {22090651-387D-4E47-BF87-4B854DCE5DB1} 125 | {4F693D80-51B1-48F6-9752-509D8E2EDD97} = {22090651-387D-4E47-BF87-4B854DCE5DB1} 126 | {D7E1E175-556B-45FE-8F03-67FFC9FA97D7} = {22090651-387D-4E47-BF87-4B854DCE5DB1} 127 | EndGlobalSection 128 | GlobalSection(ExtensibilityGlobals) = postSolution 129 | SolutionGuid = {7DB834FE-21C4-4AE7-B612-2D0EB7EF458F} 130 | EndGlobalSection 131 | EndGlobal 132 | -------------------------------------------------------------------------------- /StereoKitMRDL/Theme.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using StereoKit; 3 | 4 | namespace StereoKit.MRDL 5 | { 6 | public static class HolographicTheme 7 | { 8 | //public static Color ColorScheme = new Color(0.337f, 0.354f, 0.886f); 9 | public static Color ColorScheme = new Color(0.12549f, 0.15686f, 0.415686f); 10 | 11 | public static void Apply() 12 | { 13 | UI.ColorScheme = ColorScheme; 14 | 15 | Vec3 hsv = ColorScheme.ToHSV(); 16 | 17 | // Can't set zero gutter... why? 18 | UI.Settings = new UISettings { padding = 0.008f, gutter = 0.0000001f, depth = 0.009f }; 19 | 20 | 21 | 22 | Shader uiFrontplateShader = Shader.FromFile("mrdl_frontplate.hlsl"); 23 | Material uiGlassMaterial = new Material(uiFrontplateShader); 24 | uiGlassMaterial.Transparency = Transparency.Add; 25 | uiGlassMaterial.DepthWrite = false; 26 | uiGlassMaterial.QueueOffset = -20; 27 | uiGlassMaterial[MatParamName.ColorTint] = Color.White; 28 | 29 | Shader uiBackplateShader = Shader.FromFile("mrdl_plate.hlsl"); 30 | Material uiQuadrantMaterial = new Material(uiBackplateShader); 31 | 32 | // Outline color 33 | uiQuadrantMaterial[MatParamName.ColorTint] = Color.HSV(hsv.x, hsv.y * 0.9f, hsv.z * 3.9f);// Color.HSV(b.x,b.y*0.6f,b.z*1.4f); 34 | 35 | Mesh quadrantCube = Mesh.GenerateCube(Vec3.One); 36 | UI.QuadrantSizeMesh(ref quadrantCube); 37 | 38 | Mesh backplate = BackplateMesh(.015f, 8); 39 | Mesh backplateSmall = BackplateMesh(.001f, 8); 40 | Mesh glassMesh = GlassButtonMesh(0.009f, 8); 41 | UI.SetElementVisual(UIVisual.Default, backplate, uiQuadrantMaterial); 42 | UI.SetElementVisual(UIVisual.WindowHead, backplate, uiQuadrantMaterial); 43 | UI.SetElementVisual(UIVisual.WindowBody, backplate, uiQuadrantMaterial); 44 | UI.SetElementVisual(UIVisual.Separator, quadrantCube, uiQuadrantMaterial); 45 | UI.SetElementVisual(UIVisual.SliderLine, backplateSmall, uiQuadrantMaterial); 46 | UI.SetElementVisual(UIVisual.SliderPinch, backplateSmall, uiQuadrantMaterial); 47 | UI.SetElementVisual(UIVisual.SliderPush, backplateSmall, uiQuadrantMaterial); 48 | UI.SetElementVisual(UIVisual.Button, glassMesh, uiGlassMaterial); 49 | UI.SetElementVisual(UIVisual.Toggle, glassMesh, uiGlassMaterial); 50 | 51 | UI.SetThemeColor(UIColor.Primary, ColorScheme); 52 | 53 | UI.SetThemeColor(UIColor.Background, Color.HSV(hsv.x, hsv.y * 1.0f, hsv.z));//Color.HSV(b.x,b.y*0.8f,b.z)); 54 | UI.SetThemeColor(UIColor.Background, ColorScheme); 55 | 56 | // Button innerquad? 57 | // Adjust innerquad brightness with the .z? 58 | UI.SetThemeColor(UIColor.Common, Color.HSV(hsv.x, hsv.y * 0.9f, hsv.z * 0.8f, 1.0f));//Color.HSV(b.x,b.y*0.6f,b.z*1.2f)); 59 | 60 | ApplyLighting(); 61 | } 62 | 63 | public static void ApplyLighting() 64 | { 65 | var light = Renderer.SkyLight; 66 | light.Brightness(0.02f); 67 | Renderer.SkyTex = Tex.GenCubemap(light); 68 | } 69 | 70 | static Mesh BackplateMesh(float cornerRadius, int cornerResolution) 71 | { 72 | Mesh mesh = new Mesh(); 73 | 74 | float radius = cornerRadius; 75 | 76 | int subd = cornerResolution * 4; 77 | uint usubd = (uint)subd; 78 | int vert_count = 4 * (subd + 2); 79 | int ind_count = 4 * (cornerResolution * 12 + 6) + 12; 80 | Vertex[] verts = new Vertex[vert_count]; 81 | uint[] inds = new uint[ind_count]; 82 | 83 | uint ind = 0; 84 | Vec3 front = V.XYZ(0, 0, 0.5f); 85 | for (int c = 0; c < 4; c++) 86 | { 87 | float u = c == 0 || c == 3 ? 1 : -1; 88 | float v = c == 0 || c == 1 ? 1 : -1; 89 | Vec3 offset = V.XY0(-u * radius, -v * radius); 90 | 91 | uint vert = (uint)(c * (usubd + 2)); 92 | verts[vert] = new Vertex(offset + front, V.XYZ(0, 0, 1), V.XY(u, v)); 93 | verts[vert + 1] = new Vertex(offset - front, V.XYZ(0, 0, -1), V.XY(u, v)); 94 | uint cornerFront = vert; 95 | uint cornerBack = vert + 1; 96 | 97 | for (uint i = 0; i < cornerResolution; i++) 98 | { 99 | float ang = (c * 90 + (i / (float)(cornerResolution - 1)) * 90) * Units.deg2rad; 100 | float x = SKMath.Cos(ang); 101 | float y = SKMath.Sin(ang); 102 | Vec3 normal = V.XY0(x, y); 103 | Vec3 top_pos = normal * radius + V.XYZ(0, 0, 0.5f); 104 | Vec3 bot_pos = normal * radius - V.XYZ(0, 0, 0.5f); 105 | 106 | uint i4 = vert + 2 + i * 4; 107 | uint i4_n = vert + 2 + (i + 1) * 4; 108 | 109 | // strip around the edge first 110 | verts[i4] = new Vertex(offset + top_pos, normal, V.XY(u, v), new Color32(255, 255, 255, 0)); 111 | verts[i4 + 1] = new Vertex(offset + bot_pos, normal, V.XY(u, v), new Color32(255, 255, 255, 0)); 112 | // now for the front and back faces 113 | verts[i4 + 2] = new Vertex(offset + top_pos, V.XYZ(0, 0, 1), V.XY(u, v), new Color32(255, 255, 255, 0)); 114 | verts[i4 + 3] = new Vertex(offset + bot_pos, V.XYZ(0, 0, -1), V.XY(u, v), new Color32(255, 255, 255, 0)); 115 | 116 | if (i + 1 < cornerResolution) 117 | { 118 | // Front slice 119 | inds[ind++] = i4 + 2; inds[ind++] = i4_n + 2; inds[ind++] = cornerFront; 120 | // Back slice 121 | inds[ind++] = cornerBack; inds[ind++] = i4_n + 3; inds[ind++] = i4 + 3; 122 | } 123 | else 124 | { 125 | uint cornerFrontNext = (uint)(((c + 1) % 4) * (usubd + 2)); 126 | uint cornerBackNext = cornerFrontNext + 1; 127 | i4_n = cornerBackNext + 1; 128 | 129 | // Front slice 130 | inds[ind++] = i4 + 2; inds[ind++] = i4_n + 2; inds[ind++] = cornerFront; 131 | inds[ind++] = cornerFront; inds[ind++] = i4_n + 2; inds[ind++] = cornerFrontNext; 132 | // Back slice 133 | inds[ind++] = cornerBack; inds[ind++] = i4_n + 3; inds[ind++] = i4 + 3; 134 | inds[ind++] = cornerBackNext; inds[ind++] = i4_n + 3; inds[ind++] = cornerBack; 135 | } 136 | 137 | // Now edge strip 138 | inds[ind++] = i4_n + 1; inds[ind++] = i4_n; inds[ind++] = i4; 139 | inds[ind++] = i4 + 1; inds[ind++] = i4_n + 1; inds[ind++] = i4; 140 | } 141 | } 142 | 143 | // Center quad front and back 144 | { 145 | uint tr_f = 0; 146 | uint tr_b = tr_f + 1; 147 | uint tl_f = usubd + 2; 148 | uint tl_b = tl_f + 1; 149 | uint bl_f = 2 * (usubd + 2); 150 | uint bl_b = bl_f + 1; 151 | uint br_f = 3 * (usubd + 2); 152 | uint br_b = br_f + 1; 153 | 154 | inds[ind++] = br_f; inds[ind++] = tr_f; inds[ind++] = tl_f; 155 | inds[ind++] = bl_f; inds[ind++] = br_f; inds[ind++] = tl_f; 156 | 157 | inds[ind++] = tl_b; inds[ind++] = tr_b; inds[ind++] = br_b; 158 | inds[ind++] = tl_b; inds[ind++] = br_b; inds[ind++] = bl_b; 159 | } 160 | 161 | mesh.SetVerts(verts); 162 | mesh.SetInds(inds); 163 | return mesh; 164 | } 165 | 166 | enum Side { Top, Bottom }; 167 | static Mesh BackplateHalfMesh(float cornerRadius, int cornerResolution, Side side) 168 | { 169 | Mesh mesh = new Mesh(); 170 | 171 | float radius = cornerRadius; 172 | 173 | int subd = cornerResolution * 4; 174 | uint usubd = (uint)subd; 175 | int vert_count = 2 * (subd + 2) + 8; 176 | int ind_count = 2 * (cornerResolution * 12 + 6) + 12; 177 | Vertex[] verts = new Vertex[vert_count]; 178 | uint[] inds = new uint[ind_count]; 179 | 180 | uint ind = 0; 181 | Vec3 front = V.XYZ(0, 0, 0.5f); 182 | float angStart = side == Side.Top ? 0 : 180; 183 | for (int c = 0; c < 2; c++) 184 | { 185 | float u = c == 0 || c == 3 ? 1 : -1; 186 | float v = c == 0 || c == 1 ? 1 : -1; 187 | Vec3 offset = V.XY0(-u * radius, -v * radius); 188 | 189 | uint vert = (uint)(c * (usubd + 2)); 190 | verts[vert] = new Vertex(offset + front, V.XYZ(0, 0, 1), V.XY(u, v)); 191 | verts[vert + 1] = new Vertex(offset - front, V.XYZ(0, 0, -1), V.XY(u, v)); 192 | uint cornerFront = vert; 193 | uint cornerBack = vert + 1; 194 | 195 | for (uint i = 0; i < cornerResolution; i++) 196 | { 197 | float ang = (c * 90 + (i / (float)(cornerResolution - 1)) * 90 + angStart) * Units.deg2rad; 198 | float x = SKMath.Cos(ang); 199 | float y = SKMath.Sin(ang); 200 | Vec3 normal = V.XY0(x, y); 201 | Vec3 top_pos = normal * radius + V.XYZ(0, 0, 0.5f); 202 | Vec3 bot_pos = normal * radius - V.XYZ(0, 0, 0.5f); 203 | 204 | uint i4 = vert + 2 + i * 4; 205 | uint i4_n = vert + 2 + (i + 1) * 4; 206 | 207 | // strip around the edge first 208 | verts[i4] = new Vertex(offset + top_pos, normal, V.XY(u, v), new Color32(255, 255, 255, 0)); 209 | verts[i4 + 1] = new Vertex(offset + bot_pos, normal, V.XY(u, v), new Color32(255, 255, 255, 0)); 210 | // now for the front and back faces 211 | verts[i4 + 2] = new Vertex(offset + top_pos, V.XYZ(0, 0, 1), V.XY(u, v), new Color32(255, 255, 255, 0)); 212 | verts[i4 + 3] = new Vertex(offset + bot_pos, V.XYZ(0, 0, -1), V.XY(u, v), new Color32(255, 255, 255, 0)); 213 | 214 | if (i + 1 < 2) 215 | { 216 | // Front slice 217 | inds[ind++] = i4 + 2; inds[ind++] = i4_n + 2; inds[ind++] = cornerFront; 218 | // Back slice 219 | inds[ind++] = cornerBack; inds[ind++] = i4_n + 3; inds[ind++] = i4 + 3; 220 | } 221 | 222 | // Now edge strip 223 | inds[ind++] = i4_n + 1; inds[ind++] = i4_n; inds[ind++] = i4; 224 | inds[ind++] = i4 + 1; inds[ind++] = i4_n + 1; inds[ind++] = i4; 225 | } 226 | } 227 | 228 | // Center quad front and back 229 | { 230 | uint tr_f = 0; 231 | uint tr_b = tr_f + 1; 232 | uint tl_f = usubd + 2; 233 | uint tl_b = tl_f + 1; 234 | uint bl_f = 2 * (usubd + 2); 235 | uint bl_b = bl_f + 1; 236 | uint br_f = 3 * (usubd + 2); 237 | uint br_b = br_f + 1; 238 | 239 | inds[ind++] = br_f; inds[ind++] = tr_f; inds[ind++] = tl_f; 240 | inds[ind++] = bl_f; inds[ind++] = br_f; inds[ind++] = tl_f; 241 | 242 | inds[ind++] = tl_b; inds[ind++] = tr_b; inds[ind++] = br_b; 243 | inds[ind++] = tl_b; inds[ind++] = br_b; inds[ind++] = bl_b; 244 | } 245 | 246 | mesh.SetVerts(verts); 247 | mesh.SetInds(inds); 248 | return mesh; 249 | } 250 | 251 | static Mesh GlassButtonMesh(float cornerRadius, int cornerResolution) 252 | { 253 | Mesh mesh = new Mesh(); 254 | 255 | float radius = cornerRadius; 256 | 257 | // How much smaller the inner quad is from the edge, as 258 | // compared to the overall footprint of the button. 259 | float innerquadInset = 0.001f; 260 | 261 | float frontplateZ = 1.0f; 262 | float backplateZ = 0.1f; 263 | 264 | int subd = cornerResolution * 2; 265 | uint usubd = (uint)subd; 266 | int vert_count = 4 * (subd + 2); 267 | int ind_count = 4 * (cornerResolution * 6 + 6) + 12; 268 | Vertex[] verts = new Vertex[vert_count]; 269 | uint[] inds = new uint[ind_count]; 270 | 271 | uint ind_f = (uint)(ind_count / 2); 272 | uint ind_b = 0; 273 | for (int c = 0; c < 4; c++) 274 | { 275 | float u = c == 0 || c == 3 ? 1 : -1; 276 | float v = c == 0 || c == 1 ? 1 : -1; 277 | Vec3 offset = V.XY0(-u * radius, -v * radius); 278 | Vec3 offsetFront = V.XY0(-u * radius, -v * radius); 279 | 280 | uint vert = (uint)(c * (usubd + 2)); 281 | verts[vert] = new Vertex(offset + V.XYZ(0, 0, backplateZ), V.XYZ(0, 0, -1), V.XY(u, v), new Color32(255, 0, 255, 255)); 282 | verts[vert + 1] = new Vertex(offsetFront - V.XYZ(0, 0, frontplateZ), V.XYZ(0, 0, -1), V.XY(u, v), new Color32(255, 255, 0, 255)); 283 | uint cornerBack = vert; 284 | uint cornerFront = vert + 1; 285 | 286 | for (uint i = 0; i < cornerResolution; i++) 287 | { 288 | float ang = (c * 90 + (i / (float)(cornerResolution - 1)) * 90) * Units.deg2rad; 289 | float x = SKMath.Cos(ang); 290 | float y = SKMath.Sin(ang); 291 | Vec3 normal = V.XY0(x, y); 292 | 293 | 294 | Vec3 backPos = normal * (radius - innerquadInset) + V.XYZ(0, 0, backplateZ); 295 | Vec3 FrontPos = normal * radius - V.XYZ(0, 0, frontplateZ); 296 | 297 | uint i4 = vert + 2 + i * 2; 298 | uint i4_n = vert + 2 + (i + 1) * 2; 299 | 300 | // Front and back faces 301 | verts[i4] = new Vertex(offset + backPos, V.XYZ(0, 0, -1), V.XY(u, v), new Color32(255, 0, 255, 255)); 302 | verts[i4 + 1] = new Vertex(offsetFront + FrontPos, V.XYZ(0, 0, -1), V.XY(u, v), new Color32(255, 255, 0, 0)); 303 | 304 | if (i + 1 < cornerResolution) 305 | { 306 | // Back slice 307 | inds[ind_b++] = cornerBack; inds[ind_b++] = i4_n; inds[ind_b++] = i4; 308 | // Front slice 309 | inds[ind_f++] = cornerFront; inds[ind_f++] = i4_n + 1; inds[ind_f++] = i4 + 1; 310 | } 311 | else 312 | { 313 | uint cornerBackNext = (uint)(((c + 1) % 4) * (usubd + 2)); 314 | uint cornerFrontNext = cornerBackNext + 1; 315 | i4_n = cornerFrontNext + 1; 316 | 317 | // Back slice 318 | inds[ind_b++] = cornerBack; inds[ind_b++] = i4_n; inds[ind_b++] = i4; 319 | inds[ind_b++] = cornerBackNext; inds[ind_b++] = i4_n; inds[ind_b++] = cornerBack; 320 | // Front slice 321 | inds[ind_f++] = cornerFront; inds[ind_f++] = i4_n + 1; inds[ind_f++] = i4 + 1; 322 | inds[ind_f++] = cornerFrontNext; inds[ind_f++] = i4_n + 1; inds[ind_f++] = cornerFront; 323 | } 324 | } 325 | } 326 | 327 | // Center quad front and back 328 | { 329 | uint tr_f = 0; 330 | uint tr_b = tr_f + 1; 331 | uint tl_f = usubd + 2; 332 | uint tl_b = tl_f + 1; 333 | uint bl_f = 2 * (usubd + 2); 334 | uint bl_b = bl_f + 1; 335 | uint br_f = 3 * (usubd + 2); 336 | uint br_b = br_f + 1; 337 | 338 | inds[ind_b++] = tl_f; inds[ind_b++] = tr_f; inds[ind_b++] = br_f; 339 | inds[ind_b++] = tl_f; inds[ind_b++] = br_f; inds[ind_b++] = bl_f; 340 | 341 | inds[ind_f++] = tl_b; inds[ind_f++] = tr_b; inds[ind_f++] = br_b; 342 | inds[ind_f++] = tl_b; inds[ind_f++] = br_b; inds[ind_f++] = bl_b; 343 | } 344 | 345 | mesh.SetVerts(verts); 346 | mesh.SetInds(inds); 347 | return mesh; 348 | } 349 | } 350 | } --------------------------------------------------------------------------------