mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
200 lines
6.5 KiB
Text
200 lines
6.5 KiB
Text
uniform mat4 _Object2World;
|
|
uniform mat4 _World2Object;
|
|
uniform vec3 _Tonemap_blackLevel;
|
|
uniform vec3 _Tonemap_toeLength;
|
|
uniform vec3 _Tonemap_heel;
|
|
uniform vec3 _Tonemap_shoulder;
|
|
uniform vec3 _Tonemap_colorScale1;
|
|
uniform vec3 _Tonemap_colorScale2;
|
|
uniform vec3 _HybridSunDir;
|
|
uniform vec4 _HybridSunCol;
|
|
uniform vec3 GridLightTextureStartCell;
|
|
uniform vec3 GridLightTextureCellSize;
|
|
uniform sampler2D GridLightTexture;
|
|
uniform vec4 IngameGridLimit;
|
|
uniform vec4 LightPos[30];
|
|
uniform vec4 LightCol[30];
|
|
uniform vec4 _MainTex_ST;
|
|
attribute vec4 TANGENT;
|
|
varying vec3 xlv_TEXCOORD0;
|
|
varying vec3 xlv_TEXCOORD1;
|
|
varying vec3 xlv_COLOR;
|
|
varying vec2 xlv_TEXCOORD2;
|
|
void main ()
|
|
{
|
|
vec3 tmpvar_1;
|
|
tmpvar_1 = (_Object2World * gl_Vertex).xyz;
|
|
mat3 tmpvar_2;
|
|
tmpvar_2[0] = _Object2World[0].xyz;
|
|
tmpvar_2[1] = _Object2World[1].xyz;
|
|
tmpvar_2[2] = _Object2World[2].xyz;
|
|
vec3 tmpvar_3;
|
|
tmpvar_3 = normalize((tmpvar_2 * gl_Normal));
|
|
vec4 nn_4;
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = ((gl_MultiTexCoord1.xyxy * vec4(2.0, 2.0, 0.0, 0.0)) + vec4(-1.0, -1.0, 1.01, -1.0));
|
|
nn_4.w = tmpvar_5.w;
|
|
float tmpvar_6;
|
|
tmpvar_6 = dot (tmpvar_5.xyz, -(tmpvar_5.xyw));
|
|
nn_4.z = tmpvar_6;
|
|
nn_4.xy = (tmpvar_5.xy * sqrt(tmpvar_6));
|
|
vec3 tmpvar_7;
|
|
vec3 tmpvar_8;
|
|
tmpvar_8 = (gl_Color.xyz * 3.0);
|
|
tmpvar_7 = (tmpvar_8 * tmpvar_8);
|
|
ivec4 tmpvar_9;
|
|
tmpvar_9 = ivec4((texture2DLod (GridLightTexture, clamp (
|
|
((tmpvar_1 - GridLightTextureStartCell) * GridLightTextureCellSize)
|
|
.xz, IngameGridLimit.xy, IngameGridLimit.zw), 0.0) * 255.0));
|
|
vec4 tmpvar_10;
|
|
vec4 tmpvar_11;
|
|
vec4 tmpvar_12;
|
|
vec4 tmpvar_13;
|
|
vec4 tmpvar_14;
|
|
vec4 tmpvar_15;
|
|
vec4 tmpvar_16;
|
|
vec4 tmpvar_17;
|
|
tmpvar_10 = LightPos[tmpvar_9.x];
|
|
tmpvar_11 = LightCol[tmpvar_9.x];
|
|
tmpvar_12 = LightPos[tmpvar_9.y];
|
|
tmpvar_13 = LightCol[tmpvar_9.y];
|
|
tmpvar_14 = LightPos[tmpvar_9.z];
|
|
tmpvar_15 = LightCol[tmpvar_9.z];
|
|
tmpvar_16 = LightPos[tmpvar_9.w];
|
|
tmpvar_17 = LightCol[tmpvar_9.w];
|
|
vec3 hybridCol_18;
|
|
vec4 atten_19;
|
|
float wAgg_20;
|
|
vec3 lAgg_21;
|
|
vec3 tmpvar_22;
|
|
tmpvar_22 = (tmpvar_10.xyz - tmpvar_1);
|
|
float tmpvar_23;
|
|
tmpvar_23 = dot (tmpvar_22, tmpvar_22);
|
|
vec3 tmpvar_24;
|
|
tmpvar_24 = (tmpvar_22 * inversesqrt(tmpvar_23));
|
|
vec4 tmpvar_25;
|
|
tmpvar_25 = atten_19; tmpvar_25.x = max ((1.0 - (
|
|
(tmpvar_23 * tmpvar_10.w)
|
|
* 0.8)), 0.0);
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = tmpvar_25; tmpvar_26.x = (tmpvar_25.x * tmpvar_25.x);
|
|
float tmpvar_27;
|
|
tmpvar_27 = ((tmpvar_26.x * tmpvar_11.w) * max (dot (tmpvar_24, tmpvar_3), 0.05));
|
|
lAgg_21 = (tmpvar_27 * tmpvar_24);
|
|
wAgg_20 = (0.001 + tmpvar_27);
|
|
vec3 tmpvar_28;
|
|
tmpvar_28 = (tmpvar_12.xyz - tmpvar_1);
|
|
float tmpvar_29;
|
|
tmpvar_29 = dot (tmpvar_28, tmpvar_28);
|
|
vec3 tmpvar_30;
|
|
tmpvar_30 = (tmpvar_28 * inversesqrt(tmpvar_29));
|
|
vec4 tmpvar_31;
|
|
tmpvar_31 = tmpvar_26; tmpvar_31.y = max ((1.0 - (
|
|
(tmpvar_29 * tmpvar_12.w)
|
|
* 0.8)), 0.0);
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = tmpvar_31; tmpvar_32.y = (tmpvar_31.y * tmpvar_31.y);
|
|
float tmpvar_33;
|
|
tmpvar_33 = ((tmpvar_32.y * tmpvar_13.w) * max (dot (tmpvar_30, tmpvar_3), 0.05));
|
|
lAgg_21 = (lAgg_21 + (tmpvar_33 * tmpvar_30));
|
|
wAgg_20 = (wAgg_20 + tmpvar_33);
|
|
vec3 tmpvar_34;
|
|
tmpvar_34 = (tmpvar_14.xyz - tmpvar_1);
|
|
float tmpvar_35;
|
|
tmpvar_35 = dot (tmpvar_34, tmpvar_34);
|
|
vec3 tmpvar_36;
|
|
tmpvar_36 = (tmpvar_34 * inversesqrt(tmpvar_35));
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = tmpvar_32; tmpvar_37.z = max ((1.0 - (
|
|
(tmpvar_35 * tmpvar_14.w)
|
|
* 0.8)), 0.0);
|
|
vec4 tmpvar_38;
|
|
tmpvar_38 = tmpvar_37; tmpvar_38.z = (tmpvar_37.z * tmpvar_37.z);
|
|
float tmpvar_39;
|
|
tmpvar_39 = ((tmpvar_38.z * tmpvar_15.w) * max (dot (tmpvar_36, tmpvar_3), 0.05));
|
|
lAgg_21 = (lAgg_21 + (tmpvar_39 * tmpvar_36));
|
|
wAgg_20 = (wAgg_20 + tmpvar_39);
|
|
vec3 tmpvar_40;
|
|
tmpvar_40 = (tmpvar_16.xyz - tmpvar_1);
|
|
float tmpvar_41;
|
|
tmpvar_41 = dot (tmpvar_40, tmpvar_40);
|
|
vec3 tmpvar_42;
|
|
tmpvar_42 = (tmpvar_40 * inversesqrt(tmpvar_41));
|
|
vec4 tmpvar_43;
|
|
tmpvar_43 = tmpvar_38; tmpvar_43.w = max ((1.0 - (
|
|
(tmpvar_41 * tmpvar_16.w)
|
|
* 0.8)), 0.0);
|
|
vec4 tmpvar_44;
|
|
tmpvar_44 = tmpvar_43; tmpvar_44.w = (tmpvar_43.w * tmpvar_43.w);
|
|
atten_19 = tmpvar_44;
|
|
float tmpvar_45;
|
|
tmpvar_45 = ((tmpvar_44.w * tmpvar_17.w) * max (dot (tmpvar_42, tmpvar_3), 0.05));
|
|
lAgg_21 = (lAgg_21 + (tmpvar_45 * tmpvar_42));
|
|
wAgg_20 = (wAgg_20 + tmpvar_45);
|
|
float tmpvar_46;
|
|
tmpvar_46 = (dot (tmpvar_7, vec3(0.22, 0.707, 0.071)) * 2.0);
|
|
vec3 tmpvar_47;
|
|
tmpvar_47 = (lAgg_21 + ((
|
|
((nn_4.xyz * 2.0) + vec3(0.0, 0.0, -1.0))
|
|
*
|
|
(gl_Color.w * 2.0)
|
|
) * tmpvar_46));
|
|
lAgg_21 = tmpvar_47;
|
|
float tmpvar_48;
|
|
tmpvar_48 = (wAgg_20 + tmpvar_46);
|
|
wAgg_20 = tmpvar_48;
|
|
hybridCol_18 = (tmpvar_7 + (tmpvar_11.xyz * tmpvar_44.x));
|
|
hybridCol_18 = (hybridCol_18 + (tmpvar_13.xyz * tmpvar_44.y));
|
|
hybridCol_18 = (hybridCol_18 + (tmpvar_15.xyz * tmpvar_44.z));
|
|
hybridCol_18 = (hybridCol_18 + (tmpvar_17.xyz * tmpvar_44.w));
|
|
vec3 x_49;
|
|
x_49 = (hybridCol_18 * 0.25);
|
|
vec3 tmpvar_50;
|
|
vec3 cse_51;
|
|
cse_51 = (_Tonemap_blackLevel * 0.25);
|
|
tmpvar_50 = max ((x_49 - cse_51), vec3(0.0, 0.0, 0.0));
|
|
vec3 tmpvar_52;
|
|
tmpvar_52 = ((tmpvar_50 * (
|
|
(_Tonemap_colorScale1 * tmpvar_50)
|
|
+ _Tonemap_heel)) / ((tmpvar_50 *
|
|
((_Tonemap_colorScale2 * tmpvar_50) + _Tonemap_shoulder)
|
|
) + _Tonemap_toeLength));
|
|
x_49 = tmpvar_52;
|
|
vec3 x_53;
|
|
x_53 = ((_HybridSunCol.xyz * dot (tmpvar_3, _HybridSunDir)) * 0.25);
|
|
vec3 tmpvar_54;
|
|
tmpvar_54 = max ((x_53 - cse_51), vec3(0.0, 0.0, 0.0));
|
|
vec3 tmpvar_55;
|
|
tmpvar_55 = ((tmpvar_54 * (
|
|
(_Tonemap_colorScale1 * tmpvar_54)
|
|
+ _Tonemap_heel)) / ((tmpvar_54 *
|
|
((_Tonemap_colorScale2 * tmpvar_54) + _Tonemap_shoulder)
|
|
) + _Tonemap_toeLength));
|
|
x_53 = tmpvar_55;
|
|
vec3 tmpvar_56;
|
|
vec3 tmpvar_57;
|
|
tmpvar_56 = TANGENT.xyz;
|
|
tmpvar_57 = (((gl_Normal.yzx * TANGENT.zxy) - (gl_Normal.zxy * TANGENT.yzx)) * TANGENT.w);
|
|
mat3 tmpvar_58;
|
|
tmpvar_58[0].x = tmpvar_56.x;
|
|
tmpvar_58[0].y = tmpvar_57.x;
|
|
tmpvar_58[0].z = gl_Normal.x;
|
|
tmpvar_58[1].x = tmpvar_56.y;
|
|
tmpvar_58[1].y = tmpvar_57.y;
|
|
tmpvar_58[1].z = gl_Normal.y;
|
|
tmpvar_58[2].x = tmpvar_56.z;
|
|
tmpvar_58[2].y = tmpvar_57.z;
|
|
tmpvar_58[2].z = gl_Normal.z;
|
|
mat3 tmpvar_59;
|
|
tmpvar_59[0] = _World2Object[0].xyz;
|
|
tmpvar_59[1] = _World2Object[1].xyz;
|
|
tmpvar_59[2] = _World2Object[2].xyz;
|
|
gl_Position = (gl_ModelViewProjectionMatrix * gl_Vertex);
|
|
xlv_TEXCOORD0 = (tmpvar_58 * (tmpvar_59 * (tmpvar_47 / tmpvar_48)));
|
|
xlv_TEXCOORD1 = (tmpvar_52 * 4.0);
|
|
xlv_COLOR = (tmpvar_55 * 4.0);
|
|
xlv_TEXCOORD2 = ((gl_MultiTexCoord0.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
}
|
|
|
|
|
|
// inputs: 6, stats: 141 alu 1 tex 0 flow
|