mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
187 lines
4.1 KiB
Text
187 lines
4.1 KiB
Text
|
struct SurfaceOutput {
|
||
|
vec3 Albedo;
|
||
|
vec3 Normal;
|
||
|
vec3 Emission;
|
||
|
float Specular;
|
||
|
float Gloss;
|
||
|
float Alpha;
|
||
|
};
|
||
|
struct Input {
|
||
|
vec2 uv_MainTex;
|
||
|
vec2 uv2_Detail;
|
||
|
};
|
||
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
float fog;
|
||
|
vec4 hip_pack0;
|
||
|
vec3 normal;
|
||
|
vec3 lightDir;
|
||
|
vec4 _LightCoord;
|
||
|
};
|
||
|
varying vec4 xlv_FOG;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform sampler2D _LightTextureB0;
|
||
|
uniform sampler2D _LightTexture0;
|
||
|
uniform vec4 _LightColor0;
|
||
|
uniform sampler2D _Detail;
|
||
|
void surf (
|
||
|
in Input IN_1,
|
||
|
inout SurfaceOutput o_2
|
||
|
)
|
||
|
{
|
||
|
vec4 tmpvar_3;
|
||
|
tmpvar_3 = texture2D (_MainTex, IN_1.uv_MainTex);
|
||
|
vec4 tmpvar_4;
|
||
|
tmpvar_4 = texture2D (_Detail, IN_1.uv2_Detail);
|
||
|
vec3 tmpvar_5;
|
||
|
tmpvar_5 = ((tmpvar_3.xyz * tmpvar_4.xyz) * 2.0);
|
||
|
o_2.Albedo = tmpvar_5;
|
||
|
}
|
||
|
|
||
|
float UnitySpotCookie (
|
||
|
in vec4 LightCoord_6
|
||
|
)
|
||
|
{
|
||
|
vec4 tmpvar_7;
|
||
|
tmpvar_7 = texture2D (_LightTexture0, ((LightCoord_6.xy / LightCoord_6.w) + 0.5));
|
||
|
return tmpvar_7.w;
|
||
|
}
|
||
|
|
||
|
float UnitySpotAttenuate (
|
||
|
in vec3 LightCoord_8
|
||
|
)
|
||
|
{
|
||
|
float tmpvar_9;
|
||
|
tmpvar_9 = dot (LightCoord_8, LightCoord_8);
|
||
|
vec2 tmpvar_10;
|
||
|
tmpvar_10 = vec2(tmpvar_9);
|
||
|
vec2 tmpvar_11;
|
||
|
tmpvar_11 = tmpvar_10.xy;
|
||
|
vec4 tmpvar_12;
|
||
|
tmpvar_12 = texture2D (_LightTextureB0, tmpvar_11);
|
||
|
return tmpvar_12.w;
|
||
|
}
|
||
|
|
||
|
vec4 LightingLambert (
|
||
|
in SurfaceOutput s_13,
|
||
|
in vec3 lightDir_14,
|
||
|
in float atten_15
|
||
|
)
|
||
|
{
|
||
|
vec4 c_16;
|
||
|
float diff_17;
|
||
|
float tmpvar_18;
|
||
|
tmpvar_18 = dot (s_13.Normal, lightDir_14);
|
||
|
float tmpvar_19;
|
||
|
tmpvar_19 = max (0.0, tmpvar_18);
|
||
|
float tmpvar_20;
|
||
|
tmpvar_20 = tmpvar_19;
|
||
|
diff_17 = tmpvar_20;
|
||
|
vec3 tmpvar_21;
|
||
|
tmpvar_21 = ((s_13.Albedo * _LightColor0.xyz) * ((diff_17 * atten_15) * 2.0));
|
||
|
c_16.xyz = tmpvar_21.xyz.xyz;
|
||
|
float tmpvar_22;
|
||
|
tmpvar_22 = s_13.Alpha;
|
||
|
c_16.w = vec4(tmpvar_22).w;
|
||
|
return c_16;
|
||
|
}
|
||
|
|
||
|
vec4 frag_surf (
|
||
|
in v2f_surf IN_23
|
||
|
)
|
||
|
{
|
||
|
vec4 c_24;
|
||
|
vec3 lightDir_25;
|
||
|
SurfaceOutput o_26;
|
||
|
Input surfIN_27;
|
||
|
vec2 tmpvar_28;
|
||
|
tmpvar_28 = IN_23.hip_pack0.xy;
|
||
|
surfIN_27.uv_MainTex = tmpvar_28;
|
||
|
vec2 tmpvar_29;
|
||
|
tmpvar_29 = IN_23.hip_pack0.zw;
|
||
|
surfIN_27.uv2_Detail = tmpvar_29;
|
||
|
vec3 tmpvar_30;
|
||
|
tmpvar_30 = vec3(0.0, 0.0, 0.0);
|
||
|
o_26.Albedo = tmpvar_30;
|
||
|
vec3 tmpvar_31;
|
||
|
tmpvar_31 = vec3(0.0, 0.0, 0.0);
|
||
|
o_26.Emission = tmpvar_31;
|
||
|
float tmpvar_32;
|
||
|
tmpvar_32 = 0.0;
|
||
|
o_26.Specular = tmpvar_32;
|
||
|
float tmpvar_33;
|
||
|
tmpvar_33 = 0.0;
|
||
|
o_26.Alpha = tmpvar_33;
|
||
|
float tmpvar_34;
|
||
|
tmpvar_34 = 0.0;
|
||
|
o_26.Gloss = tmpvar_34;
|
||
|
vec3 tmpvar_35;
|
||
|
tmpvar_35 = IN_23.normal;
|
||
|
o_26.Normal = tmpvar_35;
|
||
|
surf (surfIN_27, o_26);
|
||
|
vec3 tmpvar_36;
|
||
|
tmpvar_36 = IN_23.lightDir;
|
||
|
lightDir_25 = tmpvar_36;
|
||
|
vec3 tmpvar_37;
|
||
|
tmpvar_37 = normalize (lightDir_25);
|
||
|
vec3 tmpvar_38;
|
||
|
tmpvar_38 = tmpvar_37;
|
||
|
lightDir_25 = tmpvar_38;
|
||
|
float tmpvar_39;
|
||
|
tmpvar_39 = UnitySpotCookie (IN_23._LightCoord);
|
||
|
float tmpvar_40;
|
||
|
tmpvar_40 = UnitySpotAttenuate (IN_23._LightCoord.xyz);
|
||
|
vec4 tmpvar_41;
|
||
|
tmpvar_41 = LightingLambert (o_26, lightDir_25, ((float((IN_23._LightCoord.z > 0.0)) * tmpvar_39) * tmpvar_40));
|
||
|
vec4 tmpvar_42;
|
||
|
tmpvar_42 = tmpvar_41;
|
||
|
c_24 = tmpvar_42;
|
||
|
float tmpvar_43;
|
||
|
tmpvar_43 = 0.0;
|
||
|
c_24.w = vec4(tmpvar_43).w;
|
||
|
return c_24;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_surf xlt_IN_44;
|
||
|
vec4 xl_retval_45;
|
||
|
vec4 tmpvar_46;
|
||
|
tmpvar_46 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_IN_44.pos = tmpvar_46;
|
||
|
float tmpvar_47;
|
||
|
tmpvar_47 = xlv_FOG.x;
|
||
|
xlt_IN_44.fog = tmpvar_47;
|
||
|
vec4 tmpvar_48;
|
||
|
tmpvar_48 = gl_TexCoord[0].xyzw;
|
||
|
vec4 tmpvar_49;
|
||
|
tmpvar_49 = tmpvar_48;
|
||
|
xlt_IN_44.hip_pack0 = tmpvar_49;
|
||
|
vec3 tmpvar_50;
|
||
|
tmpvar_50 = gl_TexCoord[1].xyz;
|
||
|
vec3 tmpvar_51;
|
||
|
tmpvar_51 = tmpvar_50;
|
||
|
xlt_IN_44.normal = tmpvar_51;
|
||
|
vec3 tmpvar_52;
|
||
|
tmpvar_52 = gl_TexCoord[2].xyz;
|
||
|
vec3 tmpvar_53;
|
||
|
tmpvar_53 = tmpvar_52;
|
||
|
xlt_IN_44.lightDir = tmpvar_53;
|
||
|
vec4 tmpvar_54;
|
||
|
tmpvar_54 = gl_TexCoord[3].xyzw;
|
||
|
vec4 tmpvar_55;
|
||
|
tmpvar_55 = tmpvar_54;
|
||
|
xlt_IN_44._LightCoord = tmpvar_55;
|
||
|
vec4 tmpvar_56;
|
||
|
tmpvar_56 = frag_surf (xlt_IN_44);
|
||
|
vec4 tmpvar_57;
|
||
|
tmpvar_57 = tmpvar_56;
|
||
|
xl_retval_45 = tmpvar_57;
|
||
|
vec4 tmpvar_58;
|
||
|
tmpvar_58 = xl_retval_45.xyzw;
|
||
|
vec4 tmpvar_59;
|
||
|
tmpvar_59 = tmpvar_58;
|
||
|
gl_FragData[0] = tmpvar_59;
|
||
|
}
|
||
|
|