mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
137 lines
2.7 KiB
Text
137 lines
2.7 KiB
Text
struct SurfaceOutput {
|
|
vec3 Albedo;
|
|
vec3 Normal;
|
|
vec3 Emission;
|
|
float Specular;
|
|
float Gloss;
|
|
float Alpha;
|
|
};
|
|
struct Input {
|
|
vec2 uv_MainTex;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
vec3 vec;
|
|
vec2 hip_pack0;
|
|
};
|
|
uniform sampler2D _MainTex;
|
|
uniform vec4 _LightPositionRange;
|
|
uniform float _Cutoff;
|
|
uniform vec4 _Color;
|
|
void xll_clip (
|
|
in float x_1
|
|
)
|
|
{
|
|
if ((x_1 < 0.0)) {
|
|
discard;
|
|
};
|
|
}
|
|
|
|
void surf (
|
|
in Input IN_2,
|
|
inout SurfaceOutput o_3
|
|
)
|
|
{
|
|
vec4 c_4;
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = texture2D (_MainTex, IN_2.uv_MainTex);
|
|
vec4 tmpvar_6;
|
|
tmpvar_6 = (tmpvar_5 * _Color);
|
|
c_4 = tmpvar_6;
|
|
vec3 tmpvar_7;
|
|
tmpvar_7 = c_4.xyz;
|
|
o_3.Albedo = tmpvar_7;
|
|
float tmpvar_8;
|
|
tmpvar_8 = c_4.w;
|
|
o_3.Alpha = tmpvar_8;
|
|
}
|
|
|
|
vec4 EncodeFloatRGBA (
|
|
in float v_9
|
|
)
|
|
{
|
|
vec4 enc_10;
|
|
float kEncodeBit_11;
|
|
vec4 kEncodeMul_12;
|
|
vec4 tmpvar_13;
|
|
tmpvar_13 = vec4(1.0, 255.0, 65025.0, 1.60581e+08);
|
|
kEncodeMul_12 = tmpvar_13;
|
|
float tmpvar_14;
|
|
tmpvar_14 = 0.00392157;
|
|
kEncodeBit_11 = tmpvar_14;
|
|
vec4 tmpvar_15;
|
|
tmpvar_15 = (kEncodeMul_12 * v_9);
|
|
enc_10 = tmpvar_15;
|
|
vec4 tmpvar_16;
|
|
tmpvar_16 = fract (enc_10);
|
|
vec4 tmpvar_17;
|
|
tmpvar_17 = tmpvar_16;
|
|
enc_10 = tmpvar_17;
|
|
vec4 tmpvar_18;
|
|
tmpvar_18 = (enc_10 - (enc_10.yzww * kEncodeBit_11));
|
|
enc_10 = tmpvar_18;
|
|
return enc_10;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_19
|
|
)
|
|
{
|
|
SurfaceOutput o_20;
|
|
Input surfIN_21;
|
|
vec2 tmpvar_22;
|
|
tmpvar_22 = IN_19.hip_pack0.xy;
|
|
surfIN_21.uv_MainTex = tmpvar_22;
|
|
vec3 tmpvar_23;
|
|
tmpvar_23 = vec3(0.0, 0.0, 0.0);
|
|
o_20.Albedo = tmpvar_23;
|
|
vec3 tmpvar_24;
|
|
tmpvar_24 = vec3(0.0, 0.0, 0.0);
|
|
o_20.Emission = tmpvar_24;
|
|
float tmpvar_25;
|
|
tmpvar_25 = 0.0;
|
|
o_20.Specular = tmpvar_25;
|
|
float tmpvar_26;
|
|
tmpvar_26 = 0.0;
|
|
o_20.Alpha = tmpvar_26;
|
|
float tmpvar_27;
|
|
tmpvar_27 = 0.0;
|
|
o_20.Gloss = tmpvar_27;
|
|
surf (surfIN_21, o_20);
|
|
xll_clip ((o_20.Alpha - _Cutoff));
|
|
float tmpvar_28;
|
|
tmpvar_28 = length (IN_19.vec);
|
|
vec4 tmpvar_29;
|
|
tmpvar_29 = EncodeFloatRGBA ((tmpvar_28 * _LightPositionRange.w));
|
|
return tmpvar_29;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_30;
|
|
vec4 xl_retval_31;
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_30.pos = tmpvar_32;
|
|
vec3 tmpvar_33;
|
|
tmpvar_33 = gl_TexCoord[0].xyz;
|
|
vec3 tmpvar_34;
|
|
tmpvar_34 = tmpvar_33;
|
|
xlt_IN_30.vec = tmpvar_34;
|
|
vec2 tmpvar_35;
|
|
tmpvar_35 = gl_TexCoord[1].xy;
|
|
vec2 tmpvar_36;
|
|
tmpvar_36 = tmpvar_35;
|
|
xlt_IN_30.hip_pack0 = tmpvar_36;
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = frag_surf (xlt_IN_30);
|
|
vec4 tmpvar_38;
|
|
tmpvar_38 = tmpvar_37;
|
|
xl_retval_31 = tmpvar_38;
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = xl_retval_31.xyzw;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = tmpvar_39;
|
|
gl_FragData[0] = tmpvar_40;
|
|
}
|
|
|