You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
837 B
48 lines
837 B
3 years ago
|
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||
|
|
||
|
Shader "Unity Shaders Book/Chapter 10/Mirror" {
|
||
|
Properties {
|
||
|
_MainTex ("Main Tex", 2D) = "white" {}
|
||
|
}
|
||
|
SubShader {
|
||
|
Tags { "RenderType"="Opaque" "Queue"="Geometry"}
|
||
|
|
||
|
Pass {
|
||
|
CGPROGRAM
|
||
|
|
||
|
#pragma vertex vert
|
||
|
#pragma fragment frag
|
||
|
|
||
|
sampler2D _MainTex;
|
||
|
|
||
|
struct a2v {
|
||
|
float4 vertex : POSITION;
|
||
|
float3 texcoord : TEXCOORD0;
|
||
|
};
|
||
|
|
||
|
struct v2f {
|
||
|
float4 pos : SV_POSITION;
|
||
|
float2 uv : TEXCOORD0;
|
||
|
};
|
||
|
|
||
|
v2f vert(a2v v) {
|
||
|
v2f o;
|
||
|
o.pos = UnityObjectToClipPos(v.vertex);
|
||
|
|
||
|
o.uv = v.texcoord;
|
||
|
// Mirror needs to filp x
|
||
|
o.uv.x = 1 - o.uv.x;
|
||
|
|
||
|
return o;
|
||
|
}
|
||
|
|
||
|
fixed4 frag(v2f i) : SV_Target {
|
||
|
return tex2D(_MainTex, i.uv);
|
||
|
}
|
||
|
|
||
|
ENDCG
|
||
|
}
|
||
|
}
|
||
|
FallBack Off
|
||
|
}
|