mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
117 lines
2.3 KiB
Text
117 lines
2.3 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;
|
|
};
|
|
uniform sampler2D _MainTex;
|
|
uniform vec4 _LightPositionRange;
|
|
uniform vec4 _Color;
|
|
void surf (
|
|
in Input IN_1,
|
|
inout SurfaceOutput o_2
|
|
)
|
|
{
|
|
vec4 c_3;
|
|
vec4 tmpvar_4;
|
|
tmpvar_4 = texture2D (_MainTex, IN_1.uv_MainTex);
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = (tmpvar_4 * _Color);
|
|
c_3 = tmpvar_5;
|
|
vec3 tmpvar_6;
|
|
tmpvar_6 = c_3.xyz;
|
|
o_2.Albedo = tmpvar_6;
|
|
float tmpvar_7;
|
|
tmpvar_7 = c_3.w;
|
|
o_2.Alpha = tmpvar_7;
|
|
}
|
|
|
|
vec4 EncodeFloatRGBA (
|
|
in float v_8
|
|
)
|
|
{
|
|
vec4 enc_9;
|
|
float kEncodeBit_10;
|
|
vec4 kEncodeMul_11;
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = vec4(1.0, 255.0, 65025.0, 1.60581e+08);
|
|
kEncodeMul_11 = tmpvar_12;
|
|
float tmpvar_13;
|
|
tmpvar_13 = 0.00392157;
|
|
kEncodeBit_10 = tmpvar_13;
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = (kEncodeMul_11 * v_8);
|
|
enc_9 = tmpvar_14;
|
|
vec4 tmpvar_15;
|
|
tmpvar_15 = fract (enc_9);
|
|
vec4 tmpvar_16;
|
|
tmpvar_16 = tmpvar_15;
|
|
enc_9 = tmpvar_16;
|
|
vec4 tmpvar_17;
|
|
tmpvar_17 = (enc_9 - (enc_9.yzww * kEncodeBit_10));
|
|
enc_9 = tmpvar_17;
|
|
return enc_9;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_18
|
|
)
|
|
{
|
|
Input surfIN_19;
|
|
SurfaceOutput o_20;
|
|
vec3 tmpvar_21;
|
|
tmpvar_21 = vec3(0.0, 0.0, 0.0);
|
|
o_20.Albedo = tmpvar_21;
|
|
vec3 tmpvar_22;
|
|
tmpvar_22 = vec3(0.0, 0.0, 0.0);
|
|
o_20.Emission = tmpvar_22;
|
|
float tmpvar_23;
|
|
tmpvar_23 = 0.0;
|
|
o_20.Specular = tmpvar_23;
|
|
float tmpvar_24;
|
|
tmpvar_24 = 0.0;
|
|
o_20.Alpha = tmpvar_24;
|
|
float tmpvar_25;
|
|
tmpvar_25 = 0.0;
|
|
o_20.Gloss = tmpvar_25;
|
|
surf (surfIN_19, o_20);
|
|
float tmpvar_26;
|
|
tmpvar_26 = length (IN_18.vec);
|
|
vec4 tmpvar_27;
|
|
tmpvar_27 = EncodeFloatRGBA ((tmpvar_26 * _LightPositionRange.w));
|
|
return tmpvar_27;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_28;
|
|
vec4 xl_retval_29;
|
|
vec4 tmpvar_30;
|
|
tmpvar_30 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_28.pos = tmpvar_30;
|
|
vec3 tmpvar_31;
|
|
tmpvar_31 = gl_TexCoord[0].xyz;
|
|
vec3 tmpvar_32;
|
|
tmpvar_32 = tmpvar_31;
|
|
xlt_IN_28.vec = tmpvar_32;
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = frag_surf (xlt_IN_28);
|
|
vec4 tmpvar_34;
|
|
tmpvar_34 = tmpvar_33;
|
|
xl_retval_29 = tmpvar_34;
|
|
vec4 tmpvar_35;
|
|
tmpvar_35 = xl_retval_29.xyzw;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = tmpvar_35;
|
|
gl_FragData[0] = tmpvar_36;
|
|
}
|
|
|