Anaglyph: Use matrices instead of vectors.
This commit is contained in:
parent
491de39325
commit
26a9afa0e7
|
@ -73,17 +73,15 @@ const char anaglyph_program_code[] = {
|
|||
"out float4 ocol0 : SV_Target,\n"
|
||||
"in float4 pos : SV_Position,\n"
|
||||
"in float3 uv0 : TEXCOORD0){\n"
|
||||
"float3 l = Tex0.Sample(samp0, float3(uv0.xy, 0.0)).rgb;\n"
|
||||
"float3 r = Tex0.Sample(samp0, float3(uv0.xy, 1.0)).rgb;\n"
|
||||
"float3 lr = float3(0.437,0.449,0.164);\n"
|
||||
"float3 lg = float3(-0.062,-0.062,-0.024);\n"
|
||||
"float3 lb = float3(-0.048,-0.050,-0.017);\n"
|
||||
"float3 rr = float3(-0.011,-0.032,-0.007);\n"
|
||||
"float3 rg = float3(0.377,0.761,0.009);\n"
|
||||
"float3 rb = float3(-0.026,-0.093,1.234);\n"
|
||||
"float3 c0 = float3(dot(l, lr), dot(l, lg), dot(l, lb));\n"
|
||||
"float3 c1 = float3(dot(r, rr), dot(r, rg), dot(r, rb));\n"
|
||||
"ocol0 = float4(c0 + c1, 1.0);\n"
|
||||
"float4 c0 = Tex0.Sample(samp0, float3(uv0.xy, 0.0));\n"
|
||||
"float4 c1 = Tex0.Sample(samp0, float3(uv0.xy, 1.0));\n"
|
||||
"float3x3 l = float3x3( 0.437, 0.449, 0.164,\n"
|
||||
" -0.062,-0.062,-0.024,\n"
|
||||
" -0.048,-0.050,-0.017);\n"
|
||||
"float3x3 r = float3x3(-0.011,-0.032,-0.007,\n"
|
||||
" 0.377, 0.761, 0.009,\n"
|
||||
" -0.026,-0.093, 1.234);\n"
|
||||
"ocol0 = float4(mul(l, c0.rgb) + mul(r, c1.rgb), c0.a);\n"
|
||||
"}\n"
|
||||
};
|
||||
|
||||
|
|
|
@ -43,17 +43,15 @@ static char s_vertex_shader[] =
|
|||
// Eric Dubois, March 2009
|
||||
static char s_anaglyph_shader[] =
|
||||
"void main() {\n"
|
||||
" vec3 l = SampleLayer(0).rgb;\n"
|
||||
" vec3 r = SampleLayer(1).rgb;\n"
|
||||
" vec3 lr = vec3(0.437,0.449,0.164);\n"
|
||||
" vec3 lg = vec3(-0.062,-0.062,-0.024);\n"
|
||||
" vec3 lb = vec3(-0.048,-0.050,-0.017);\n"
|
||||
" vec3 rr = vec3(-0.011,-0.032,-0.007);\n"
|
||||
" vec3 rg = vec3(0.377,0.761,0.009);\n"
|
||||
" vec3 rb = vec3(-0.026,-0.093,1.234);\n"
|
||||
" vec3 c0 = vec3(dot(l, lr), dot(l, lg), dot(l, lb));\n"
|
||||
" vec3 c1 = vec3(dot(r, rr), dot(r, rg), dot(r, rb));\n"
|
||||
" SetOutput(vec4(c0 + c1, SampleLayer(0).a));\n"
|
||||
" vec4 c0 = SampleLayer(0);\n"
|
||||
" vec4 c1 = SampleLayer(1);\n"
|
||||
" mat3 l = mat3( 0.437, 0.449, 0.164,\n"
|
||||
" -0.062,-0.062,-0.024,\n"
|
||||
" -0.048,-0.050,-0.017);\n"
|
||||
" mat3 r = mat3(-0.011,-0.032,-0.007,\n"
|
||||
" 0.377, 0.761, 0.009,\n"
|
||||
" -0.026,-0.093, 1.234);\n"
|
||||
" SetOutput(vec4(c0.rgb * l + c1.rgb * r, c0.a));\n"
|
||||
"}\n";
|
||||
|
||||
static const char s_default_shader[] = "void main() { SetOutput(Sample()); }\n";
|
||||
|
|
Loading…
Reference in New Issue