summaryrefslogtreecommitdiff
path: root/shaders/dolphin/nsmbw.1.shader_test
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/dolphin/nsmbw.1.shader_test')
-rw-r--r--shaders/dolphin/nsmbw.1.shader_test229
1 files changed, 229 insertions, 0 deletions
diff --git a/shaders/dolphin/nsmbw.1.shader_test b/shaders/dolphin/nsmbw.1.shader_test
new file mode 100644
index 0000000..b9bbdc1
--- /dev/null
+++ b/shaders/dolphin/nsmbw.1.shader_test
@@ -0,0 +1,229 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+layout(std140, binding = 2) uniform VSBlock {
+float4 cpnmtx[6] ;
+float4 cproj[4] ;
+float4 cmtrl[4] ;
+float4 clights[40] ;
+float4 ctexmtx[24] ;
+float4 ctrmtx[64] ;
+float4 cnmtx[32] ;
+float4 cpostmtx[64] ;
+float4 cDepth ;
+};
+struct VS_OUTPUT {
+ float4 pos;
+ float4 colors_0;
+ float4 colors_1;
+ float3 tex0;
+ float3 tex1;
+ float3 tex2;
+ float4 clipPos;
+};
+ATTRIN float4 rawpos; // ATTR0,
+ATTRIN float3 rawnorm0; // ATTR2,
+ATTRIN float4 color0; // ATTR5,
+ATTRIN float2 tex0; // ATTR8,
+VARYOUT float3 uv0_2;
+VARYOUT float3 uv1_2;
+VARYOUT float3 uv2_2;
+VARYOUT float4 clipPos_2;
+VARYOUT float4 colors_02;
+VARYOUT float4 colors_12;
+void main()
+{
+VS_OUTPUT o;
+float4 pos = float4(dot(cpnmtx[0], rawpos), dot(cpnmtx[1], rawpos), dot(cpnmtx[2], rawpos), 1.0);
+float3 _norm0 = normalize(float3(dot(cpnmtx[3].xyz, rawnorm0), dot(cpnmtx[4].xyz, rawnorm0), dot(cpnmtx[5].xyz, rawnorm0)));
+o.pos = float4(dot(cproj[0], pos), dot(cproj[1], pos), dot(cproj[2], pos), dot(cproj[3], pos));
+float4 mat, lacc;
+float3 ldir, h;
+float dist, dist2, attn;
+{
+mat = color0;
+lacc = float4(1.0, 1.0, 1.0, 1.0);
+mat.w = cmtrl[2].w;
+lacc.w = 1.0;
+o.colors_0 = mat * clamp(lacc, 0.0, 1.0);
+}
+o.colors_1 = o.colors_0;
+float4 coord = float4(0.0, 0.0, 1.0, 1.0);
+{
+coord = float4(0.0, 0.0, 1.0, 1.0);
+coord = float4(tex0.x, tex0.y, 1.0, 1.0);
+o.tex0.xyz = float3(dot(coord, ctexmtx[0]), dot(coord, ctexmtx[1]), 1);
+float4 P0 = cpostmtx[0];
+float4 P1 = cpostmtx[1];
+float4 P2 = cpostmtx[2];
+o.tex0.xyz = float3(dot(P0.xyz, o.tex0.xyz) + P0.w, dot(P1.xyz, o.tex0.xyz) + P1.w, dot(P2.xyz, o.tex0.xyz) + P2.w);
+}
+{
+coord = float4(0.0, 0.0, 1.0, 1.0);
+coord = float4(rawnorm0.xyz, 1.0);
+o.tex1.xyz = float3(dot(coord, ctexmtx[3]), dot(coord, ctexmtx[4]), dot(coord, ctexmtx[5]));
+float4 P0 = cpostmtx[3];
+float4 P1 = cpostmtx[4];
+float4 P2 = cpostmtx[5];
+o.tex1.xyz = normalize(o.tex1.xyz);
+o.tex1.xyz = float3(dot(P0.xyz, o.tex1.xyz) + P0.w, dot(P1.xyz, o.tex1.xyz) + P1.w, dot(P2.xyz, o.tex1.xyz) + P2.w);
+}
+{
+coord = float4(0.0, 0.0, 1.0, 1.0);
+coord = float4(rawnorm0.xyz, 1.0);
+o.tex2.xyz = float3(dot(coord, ctexmtx[6]), dot(coord, ctexmtx[7]), dot(coord, ctexmtx[8]));
+float4 P0 = cpostmtx[6];
+float4 P1 = cpostmtx[7];
+float4 P2 = cpostmtx[8];
+o.tex2.xyz = normalize(o.tex2.xyz);
+o.tex2.xyz = float3(dot(P0.xyz, o.tex2.xyz) + P0.w, dot(P1.xyz, o.tex2.xyz) + P1.w, dot(P2.xyz, o.tex2.xyz) + P2.w);
+}
+o.clipPos = float4(pos.x,pos.y,o.pos.z,o.pos.w);
+o.pos.z = o.pos.w + o.pos.z * 2.0;
+ uv0_2.xyz = o.tex0;
+ uv1_2.xyz = o.tex1;
+ uv2_2.xyz = o.tex2;
+ clipPos_2 = o.clipPos;
+colors_02 = o.colors_0;
+colors_12 = o.colors_1;
+gl_Position = o.pos;
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+//Pixel Shader for TEV stages
+//3 TEV stages, 3 texgens, 0 IND stages
+float fmod( float x, float y )
+{
+ float z = fract( abs( x / y) ) * abs( y );
+ return (x < 0.0) ? -z : z;
+}
+uniform sampler2D samp0;
+uniform sampler2D samp1;
+uniform sampler2D samp2;
+uniform sampler2D samp3;
+uniform sampler2D samp4;
+uniform sampler2D samp5;
+uniform sampler2D samp6;
+uniform sampler2D samp7;
+
+layout(std140, binding = 1) uniform PSBlock {
+float4 color[4] ;
+float4 k[4] ;
+float4 alphaRef[1] ;
+float4 texdim[8] ;
+float4 czbias[2] ;
+float4 cindscale[2] ;
+float4 cindmtx[6] ;
+float4 cfog[3] ;
+float4 cPLights[40] ;
+float4 cPmtrl[4] ;
+};
+out vec4 ocol0;
+VARYIN float4 colors_02;
+VARYIN float4 colors_12;
+VARYIN float3 uv0_2;
+VARYIN float3 uv1_2;
+VARYIN float3 uv2_2;
+VARYIN float4 clipPos_2;
+void main()
+{
+ float4 c0 = color[1], c1 = color[2], c2 = color[3], prev = float4(0.0, 0.0, 0.0, 0.0), textemp = float4(0.0, 0.0, 0.0, 0.0), rastemp = float4(0.0, 0.0, 0.0, 0.0), konsttemp = float4(0.0, 0.0, 0.0, 0.0);
+ float3 comp16 = float3(1.0, 255.0, 0.0), comp24 = float3(1.0, 255.0, 255.0*255.0);
+ float alphabump=0.0;
+ float3 tevcoord=float3(0.0, 0.0, 0.0);
+ float2 wrappedcoord=float2(0.0,0.0), tempcoord=float2(0.0,0.0);
+ float4 cc0=float4(0.0,0.0,0.0,0.0), cc1=float4(0.0,0.0,0.0,0.0);
+ float4 cc2=float4(0.0,0.0,0.0,0.0), cprev=float4(0.0,0.0,0.0,0.0);
+ float4 crastemp=float4(0.0,0.0,0.0,0.0),ckonsttemp=float4(0.0,0.0,0.0,0.0);
+
+float4 rawpos = gl_FragCoord;
+float4 colors_0 = colors_02;
+float4 colors_1 = colors_12;
+float3 uv0 = uv0_2;
+float3 uv1 = uv1_2;
+float3 uv2 = uv2_2;
+float4 clipPos = clipPos_2;
+ clipPos = float4(rawpos.x, rawpos.y, clipPos.z, clipPos.w);
+uv0.xy = uv0.xy * texdim[0].zw;
+ if (uv1.z != 0.0) uv1.xy = uv1.xy / uv1.z;
+uv1.xy = uv1.xy * texdim[1].zw;
+ if (uv2.z != 0.0) uv2.xy = uv2.xy / uv2.z;
+uv2.xy = uv2.xy * texdim[2].zw;
+// TEV stage 0
+rastemp = colors_0.rgba;
+crastemp = frac(rastemp * (255.0/256.0)) * (256.0/255.0);
+tevcoord.xy = uv1.xy;
+textemp = texture(samp1,tevcoord.xy * texdim[1].xy).rgba;
+// color combine
+prev.rgb = clamp((textemp.rgb)*(crastemp.rgb), 0.0, 1.0);
+// alpha combine
+prev.a = clamp(rastemp.a+float4(0.0, 0.0, 0.0, 0.0).a, 0.0, 1.0);
+
+// TEV done
+// TEV stage 1
+tevcoord.xy = uv0.xy;
+textemp = texture(samp0,tevcoord.xy * texdim[0].xy).rgba;
+cprev = prev;
+// color combine
+prev.rgb = clamp((textemp.rgb)*(cprev.rgb), 0.0, 1.0);
+// alpha combine
+prev.a = clamp(cprev.a*textemp.a, 0.0, 1.0);
+
+// TEV done
+// TEV stage 2
+rastemp = colors_0.rgba;
+crastemp = frac(rastemp * (255.0/256.0)) * (256.0/255.0);
+tevcoord.xy = uv2.xy;
+textemp = texture(samp2,tevcoord.xy * texdim[2].xy).rgba;
+konsttemp = float4(k[3].rgb, k[3].a);
+ckonsttemp = frac(konsttemp * (255.0/256.0)) * (256.0/255.0);
+cprev = prev;
+// color combine
+prev.rgb = clamp((konsttemp.rgb)+lerp((cprev.rgb), (crastemp.rgb), (textemp.rgb)), 0.0, 1.0);
+// alpha combine
+prev.a = clamp(cprev.a*ckonsttemp.a, 0.0, 1.0);
+
+// TEV done
+float zCoord = rawpos.z;
+ ocol0 = prev;
+}
+