Skip to content

Commit

Permalink
1rst comit, functional
Browse files Browse the repository at this point in the history
  • Loading branch information
albion2000 committed Oct 9, 2022
1 parent fd0d7f3 commit 896b177
Show file tree
Hide file tree
Showing 270 changed files with 47,621 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .vsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}
8 changes: 8 additions & 0 deletions Assets/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions Assets/Editor/ReadOnlyInspectorDrawer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using UnityEngine;
using UnityEditor;

[CustomPropertyDrawer(typeof(ReadOnlyInspectorAttribute))]
public class ReadOnlyInspectorDrawer : PropertyDrawer
{
/// <summary>
/// Unity method for drawing GUI in Editor
/// </summary>
/// <param name="position">Position.</param>
/// <param name="property">Property.</param>
/// <param name="label">Label.</param>
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
// Saving previous GUI enabled value
// var previousGUIState = GUI.enabled;
// Disabling edit for property
GUI.enabled = false;
// Drawing Property
EditorGUI.PropertyField(position, property, label);
// Setting old GUI enabled value
GUI.enabled = true;
}
}
11 changes: 11 additions & 0 deletions Assets/Editor/ReadOnlyInspectorDrawer.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/MRTK.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/MRTK/Shaders.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 104 additions & 0 deletions Assets/MRTK/Shaders/ChannelPacker.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

// NOTE: MRTK Shaders are versioned via the MRTK.Shaders.sentinel file.
// When making changes to any shader's source file, the value in the sentinel _must_ be incremented.

Shader "Hidden/ChannelPacker"
{
Properties
{
_MetallicMap("Metallic Map", 2D) = "black" {}
_MetallicMapChannel("Metallic Map Channel", Int) = 0 // Red.
_MetallicUniform("Metallic Uniform", Float) = -0.01
_OcclusionMap("Occlusion Map", 2D) = "white" {}
_OcclusionMapChannel("Occlusion Map Channel", Int) = 1 // Green.
_OcclusionUniform("Occlusion Uniform", Float) = -0.01
_EmissionMap("Emission Map", 2D) = "black" {}
_EmissionMapChannel("Emission Map Channel", Int) = 4 // RGBAverage.
_EmissionUniform("Emission Uniform", Float) = -0.01
_SmoothnessMap("Smoothness Map", 2D) = "gray" {}
_SmoothnessMapChannel("Smoothness Map Channel", Int) = 3 // Alpha.
_SmoothnessUniform("Smoothness Uniform", Float) = -0.01
}
SubShader
{
Pass
{
CGPROGRAM

#pragma vertex vert
#pragma fragment frag

#include "UnityCG.cginc"

struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};

struct v2f
{
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
};

sampler2D _MetallicMap;
int _MetallicMapChannel;
float _MetallicUniform;
sampler2D _OcclusionMap;
int _OcclusionMapChannel;
float _OcclusionUniform;
sampler2D _EmissionMap;
int _EmissionMapChannel;
float _EmissionUniform;
sampler2D _SmoothnessMap;
int _SmoothnessMapChannel;
float _SmoothnessUniform;

v2f vert(appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;

return o;
}

fixed4 ToGrayScale(fixed4 color)
{
return color.r * 0.21 + color.g * 0.71 + color.b * 0.08;
}

fixed Sample(fixed4 color, int channel, float uniformValue)
{
if (uniformValue >= 0.0)
{
return uniformValue;
}

if (channel == 4)
{
return ToGrayScale(color);
}

return color[channel];
}

fixed4 frag(v2f i) : SV_Target
{
fixed4 output;

output.r = Sample(tex2D(_MetallicMap, i.uv), _MetallicMapChannel, _MetallicUniform);
output.g = Sample(tex2D(_OcclusionMap, i.uv), _OcclusionMapChannel, _OcclusionUniform);
output.b = Sample(tex2D(_EmissionMap, i.uv), _EmissionMapChannel, _EmissionUniform);
output.a = Sample(tex2D(_SmoothnessMap, i.uv), _SmoothnessMapChannel, _SmoothnessUniform);

return output;
}

ENDCG
}
}
}
9 changes: 9 additions & 0 deletions Assets/MRTK/Shaders/ChannelPacker.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions Assets/MRTK/Shaders/DepthBufferPostProcess.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

// NOTE: MRTK Shaders are versioned via the MRTK.Shaders.sentinel file.
// When making changes to any shader's source file, the value in the sentinel _must_ be incremented.

Shader "Mixed Reality Toolkit/Depth Buffer Viewer"
{
Properties
{
_DepthTex("Texture", 2D) = "black" {}
_MainTex("Base (RGB)", 2D) = "green" {}
}

SubShader
{
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag

#include "UnityCG.cginc"

uniform sampler2D _MainTex;
sampler2D _DepthTex;

float4 frag(v2f_img i) : COLOR
{
return Linear01Depth(SAMPLE_DEPTH_TEXTURE(_DepthTex, i.uv));
}
ENDCG
}
}
}
9 changes: 9 additions & 0 deletions Assets/MRTK/Shaders/DepthBufferPostProcess.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions Assets/MRTK/Shaders/InstancedColored.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

// NOTE: MRTK Shaders are versioned via the MRTK.Shaders.sentinel file.
// When making changes to any shader's source file, the value in the sentinel _must_ be incremented.

Shader "Hidden/Instanced-Colored"
{
Properties
{
_Color("Color", Color) = (1.0, 1.0, 1.0, 1.0)
_ZWrite("ZWrite", Int) = 1.0 // On
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Int) = 4.0 // LEqual
[Enum(UnityEngine.Rendering.CullMode)] _Cull("Cull", Int) = 0.0 // Off
}

SubShader
{
Pass
{
Name "Main"
Tags{ "RenderType" = "Opaque" }
ZWrite[_ZWrite]
ZTest[_ZTest]
Cull[_Cull]

CGPROGRAM

#pragma vertex vert
#pragma fragment frag

#pragma multi_compile_instancing

#include "UnityCG.cginc"

struct appdata_t
{
fixed4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct v2f
{
fixed4 vertex : SV_POSITION;
fixed4 color : COLOR0;
UNITY_VERTEX_OUTPUT_STEREO
};

float4x4 _ParentLocalToWorldMatrix;

UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float4, _Color)
UNITY_INSTANCING_BUFFER_END(Props)

v2f vert(appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = mul(UNITY_MATRIX_VP, mul(_ParentLocalToWorldMatrix, mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1.0))));
o.color = UNITY_ACCESS_INSTANCED_PROP(Props, _Color);

return o;
}

fixed4 frag(v2f i) : SV_Target
{
return i.color;
}

ENDCG
}
}
}
9 changes: 9 additions & 0 deletions Assets/MRTK/Shaders/InstancedColored.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions Assets/MRTK/Shaders/InvisibleShader.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

// NOTE: MRTK Shaders are versioned via the MRTK.Shaders.sentinel file.
// When making changes to any shader's source file, the value in the sentinel _must_ be incremented.

Shader "Mixed Reality Toolkit/InvisibleShader" {

Subshader
{
Pass
{
GLSLPROGRAM
#ifdef VERTEX
void main() {}
#endif

#ifdef FRAGMENT
void main() {}
#endif
ENDGLSL
}
}

Subshader
{
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag

#include "UnityCG.cginc"

struct v2f
{
fixed4 position : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};

v2f vert(appdata_base v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.position = fixed4(0,0,0,0);
return o;
}

fixed4 frag() : COLOR
{
return fixed4(0,0,0,0);
}
ENDCG
}
}
}
10 changes: 10 additions & 0 deletions Assets/MRTK/Shaders/InvisibleShader.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Assets/MRTK/Shaders/MRTK.Shaders.sentinel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ver: 1
7 changes: 7 additions & 0 deletions Assets/MRTK/Shaders/MRTK.Shaders.sentinel.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 896b177

Please sign in to comment.