You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
2.7 KiB
Plaintext
100 lines
2.7 KiB
Plaintext
Shader "Color Space/YCrCbtoRGB Split Alpha" {
|
|
Properties {
|
|
_YTex ("Y (RGB)", 2D) = "white" {}
|
|
_CrTex ("Cr (RGB)", 2D) = "white" {}
|
|
_CbTex ("Cb (RGB)", 2D) = "white" {}
|
|
}
|
|
SubShader {
|
|
Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="True" "RenderType"="Transparent" }
|
|
Pass {
|
|
Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="True" "RenderType"="Transparent" }
|
|
ZWrite Off
|
|
Fog {
|
|
Color (0,0,0,0)
|
|
}
|
|
Blend SrcAlpha OneMinusSrcAlpha
|
|
ColorMask RGB
|
|
Program "vp" {
|
|
SubProgram "gles " {
|
|
"!!GLES
|
|
#define SHADER_API_GLES 1
|
|
#define tex2D texture2D
|
|
|
|
|
|
#ifdef VERTEX
|
|
#define gl_ModelViewProjectionMatrix glstate_matrix_mvp
|
|
uniform mat4 glstate_matrix_mvp;
|
|
|
|
varying mediump vec2 xlv_TEXCOORD2;
|
|
varying mediump vec2 xlv_TEXCOORD1;
|
|
varying mediump vec2 xlv_TEXCOORD0;
|
|
|
|
uniform highp vec4 _YTex_ST;
|
|
uniform highp vec4 _CbTex_ST;
|
|
attribute vec4 _glesMultiTexCoord0;
|
|
attribute vec4 _glesVertex;
|
|
void main ()
|
|
{
|
|
highp vec4 texcoordTop;
|
|
highp vec4 texcoordBottom;
|
|
mediump vec2 tmpvar_1;
|
|
mediump vec2 tmpvar_2;
|
|
mediump vec2 tmpvar_3;
|
|
texcoordBottom = _glesMultiTexCoord0;
|
|
texcoordBottom.y = (_glesMultiTexCoord0.y / 2.0);
|
|
texcoordTop = _glesMultiTexCoord0;
|
|
texcoordTop.y = (texcoordBottom.y + 0.5);
|
|
highp vec2 tmpvar_4;
|
|
tmpvar_4 = ((texcoordTop.xy * _YTex_ST.xy) + _YTex_ST.zw);
|
|
tmpvar_1 = tmpvar_4;
|
|
highp vec2 tmpvar_5;
|
|
tmpvar_5 = ((texcoordBottom.xy * _YTex_ST.xy) + _YTex_ST.zw);
|
|
tmpvar_2 = tmpvar_5;
|
|
highp vec2 tmpvar_6;
|
|
tmpvar_6 = ((texcoordTop.xy * _CbTex_ST.xy) + _CbTex_ST.zw);
|
|
tmpvar_3 = tmpvar_6;
|
|
gl_Position = (gl_ModelViewProjectionMatrix * _glesVertex);
|
|
xlv_TEXCOORD0 = tmpvar_1;
|
|
xlv_TEXCOORD1 = tmpvar_2;
|
|
xlv_TEXCOORD2 = tmpvar_3;
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
#ifdef FRAGMENT
|
|
|
|
varying mediump vec2 xlv_TEXCOORD2;
|
|
varying mediump vec2 xlv_TEXCOORD1;
|
|
varying mediump vec2 xlv_TEXCOORD0;
|
|
uniform sampler2D _YTex;
|
|
uniform sampler2D _CrTex;
|
|
uniform sampler2D _CbTex;
|
|
void main ()
|
|
{
|
|
lowp vec4 rgbVec;
|
|
lowp vec4 tmpvar_1;
|
|
tmpvar_1.w = 1.0;
|
|
tmpvar_1.x = texture2D (_YTex, xlv_TEXCOORD0).x;
|
|
tmpvar_1.y = texture2D (_CrTex, xlv_TEXCOORD2).y;
|
|
tmpvar_1.z = texture2D (_CbTex, xlv_TEXCOORD2).z;
|
|
rgbVec.x = dot (vec4(1.16438, 0.0, 1.59603, -0.870785), tmpvar_1);
|
|
rgbVec.y = dot (vec4(1.16438, -0.391762, -0.812969, 0.529594), tmpvar_1);
|
|
rgbVec.z = dot (vec4(1.16438, 2.01723, 0.0, -1.08139), tmpvar_1);
|
|
rgbVec.w = ((texture2D (_YTex, xlv_TEXCOORD1).y - 0.0627451) * 1.16438);
|
|
gl_FragData[0] = rgbVec;
|
|
}
|
|
|
|
|
|
|
|
#endif"
|
|
}
|
|
}
|
|
Program "fp" {
|
|
SubProgram "gles " {
|
|
"!!GLES"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |