Created
September 17, 2012 19:56
-
-
Save miketucker/3739407 to your computer and use it in GitHub Desktop.
multiplatform shader
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
#endif | |
#ifdef FRAGMENT | |
varying lowp vec3 xlv_TEXCOORD2; | |
varying lowp vec3 xlv_TEXCOORD1; | |
varying highp vec2 xlv_TEXCOORD0; | |
uniform lowp vec4 _WorldSpaceLightPos0; | |
uniform sampler2D _MainTex; | |
uniform lowp vec4 _LightColor0; | |
void main () | |
{ | |
lowp vec4 c; | |
lowp vec4 tmpvar_1; | |
tmpvar_1 = texture2D (_MainTex, xlv_TEXCOORD0); | |
lowp vec4 c_i0_i1; | |
c_i0_i1.xyz = ((tmpvar_1.xyz * _LightColor0.xyz) * (max (0.0, dot (xlv_TEXCOORD1, _WorldSpaceLightPos0.xyz)) * 2.0)); | |
c_i0_i1.w = tmpvar_1.w; | |
c = c_i0_i1; | |
c.xyz = (c_i0_i1.xyz + (tmpvar_1.xyz * xlv_TEXCOORD2)); | |
gl_FragData[0] = c; | |
} | |
#endif" | |
} | |
SubProgram "opengl " { | |
Keywords { "DIRECTIONAL" "LIGHTMAP_ON" "DIRLIGHTMAP_OFF" "SHADOWS_OFF" } | |
Bind "vertex" Vertex | |
Bind "texcoord" TexCoord0 | |
Bind "texcoord1" TexCoord1 | |
Vector 9 [unity_LightmapST] | |
Vector 10 [_MainTex_ST] | |
"!!ARBvp1.0 | |
# 6 ALU | |
PARAM c[11] = { program.local[0], | |
state.matrix.mvp, | |
program.local[5..10] }; | |
MAD result.texcoord[0].xy, vertex.texcoord[0], c[10], c[10].zwzw; | |
MAD result.texcoord[1].xy, vertex.texcoord[1], c[9], c[9].zwzw; | |
DP4 result.position.w, vertex.position, c[4]; | |
DP4 result.position.z, vertex.position, c[3]; | |
DP4 result.position.y, vertex.position, c[2]; | |
DP4 result.position.x, vertex.position, c[1]; | |
END | |
# 6 instructions, 0 R-regs | |
" | |
} | |
SubProgram "d3d9 " { | |
Keywords { "DIRECTIONAL" "LIGHTMAP_ON" "DIRLIGHTMAP_OFF" "SHADOWS_OFF" } | |
Bind "vertex" Vertex | |
Bind "texcoord" TexCoord0 | |
Bind "texcoord1" TexCoord1 | |
Matrix 0 [glstate_matrix_mvp] | |
Vector 8 [unity_LightmapST] | |
Vector 9 [_MainTex_ST] | |
"vs_2_0 | |
; 6 ALU | |
dcl_position0 v0 | |
dcl_texcoord0 v2 | |
dcl_texcoord1 v3 | |
mad oT0.xy, v2, c9, c9.zwzw | |
mad oT1.xy, v3, c8, c8.zwzw | |
dp4 oPos.w, v0, c3 | |
dp4 oPos.z, v0, c2 | |
dp4 oPos.y, v0, c1 | |
dp4 oPos.x, v0, c0 | |
" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment