-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add unlit and transparent shaders that have flip-x/y properties.
- Loading branch information
Showing
12 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
Binary file renamed
BIN
+5.09 KB
...WindowCapture/Materials/uWC_UnlitMask.mat → Assets/uWindowCapture/Materials/uWC_Icon.mat
Binary file not shown.
File renamed without changes.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,50 @@ | ||
#ifndef UWC_COMMON_CGINC | ||
#define UWC_COMMON_CGINC | ||
|
||
#include "UnityCG.cginc" | ||
|
||
float4 _Color; | ||
sampler2D _MainTex; | ||
float4 _MainTex_ST; | ||
|
||
inline void UwcFlipUV(inout float2 uv) | ||
{ | ||
#ifdef UWC_FLIP_X | ||
uv.x = 1.0 - uv.x; | ||
#endif | ||
#ifdef UWC_FLIP_Y | ||
uv.y = 1.0 - uv.y; | ||
#endif | ||
} | ||
|
||
struct appdata | ||
{ | ||
float4 vertex : POSITION; | ||
float2 uv : TEXCOORD0; | ||
}; | ||
|
||
struct v2f | ||
{ | ||
float4 vertex : SV_POSITION; | ||
float2 uv : TEXCOORD0; | ||
UNITY_FOG_COORDS(1) | ||
}; | ||
|
||
v2f vert(appdata v) | ||
{ | ||
v2f o; | ||
o.vertex = UnityObjectToClipPos(v.vertex); | ||
o.uv = TRANSFORM_TEX(v.uv, _MainTex); | ||
UwcFlipUV(o.uv); | ||
UNITY_TRANSFER_FOG(o,o.vertex); | ||
return o; | ||
} | ||
|
||
fixed4 frag(v2f i) : SV_Target | ||
{ | ||
float4 col = tex2D(_MainTex, i.uv) * _Color; | ||
UNITY_APPLY_FOG(i.fogCoord, col); | ||
return col; | ||
} | ||
|
||
#endif |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,45 @@ | ||
Shader "uWindowCapture/Transparent" | ||
{ | ||
|
||
Properties | ||
{ | ||
_Color("Color", Color) = (1, 1, 1, 1) | ||
_MainTex("Texture", 2D) = "white" {} | ||
[Enum(UnityEngine.Rendering.CullMode)] _Cull("Culling", Int) = 2 | ||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc("Blend Src", Float) = 5 | ||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst("Blend Dst", Float) = 10 | ||
[Toggle][KeyEnum(Off, On)] _ZWrite("ZWrite", Float) = 1 | ||
[Toggle(UWC_FLIP_X)] _FlipX("Flip X", Int) = 0 | ||
[Toggle(UWC_FLIP_Y)] _FlipY("Flip Y", Int) = 0 | ||
} | ||
|
||
SubShader | ||
{ | ||
Tags | ||
{ | ||
"Queue" = "Transparent" | ||
"RenderType" = "Transparent" | ||
"IgnoreProjector" = "True" | ||
"PreviewType" = "Plane" | ||
} | ||
|
||
Pass | ||
{ | ||
Cull [_Cull] | ||
Blend [_BlendSrc] [_BlendDst] | ||
ZWrite [_ZWrite] | ||
|
||
CGPROGRAM | ||
#include "./UwcCommon.cginc" | ||
#pragma vertex vert | ||
#pragma fragment frag | ||
#pragma multi_compile_fog | ||
#pragma multi_compile ___ UWC_FLIP_X | ||
#pragma multi_compile ___ UWC_FLIP_Y | ||
ENDCG | ||
} | ||
} | ||
|
||
Fallback "Unlit/Transparent" | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,39 @@ | ||
Shader "uWindowCapture/Unlit" | ||
{ | ||
|
||
Properties | ||
{ | ||
_Color("Color", Color) = (1, 1, 1, 1) | ||
_MainTex("Texture", 2D) = "white" {} | ||
[Enum(UnityEngine.Rendering.CullMode)] _Cull("Culling", Int) = 2 | ||
[Toggle(UWC_FLIP_X)] _FlipX("Flip X", Int) = 0 | ||
[Toggle(UWC_FLIP_Y)] _FlipY("Flip Y", Int) = 0 | ||
} | ||
|
||
SubShader | ||
{ | ||
Tags | ||
{ | ||
"RenderType" = "Opaque" | ||
"Queue" = "Geometry" | ||
"PreviewType" = "Plane" | ||
} | ||
|
||
Pass | ||
{ | ||
Cull [_Cull] | ||
|
||
CGPROGRAM | ||
#include "./UwcCommon.cginc" | ||
#pragma vertex vert | ||
#pragma fragment frag | ||
#pragma multi_compile_fog | ||
#pragma multi_compile ___ UWC_FLIP_X | ||
#pragma multi_compile ___ UWC_FLIP_Y | ||
ENDCG | ||
} | ||
} | ||
|
||
Fallback "Unlit/Texture" | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.