mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-04 21:31:11 -05:00
234 lines
5.7 KiB
Text
234 lines
5.7 KiB
Text
|
struct VertexOutput {
|
||
|
vec4 pos;
|
||
|
vec4 tex;
|
||
|
vec4 posWorld;
|
||
|
vec3 normalWorld;
|
||
|
vec4 tangentWorld;
|
||
|
vec3 extra;
|
||
|
vec4 _ShadowCoord;
|
||
|
vec3 lightDir;
|
||
|
};
|
||
|
struct VertexInput {
|
||
|
vec4 vertex;
|
||
|
vec3 normal;
|
||
|
vec4 texcoord;
|
||
|
vec4 texcoord1;
|
||
|
vec4 tangent;
|
||
|
};
|
||
|
uniform vec4 _ProjectionParams;
|
||
|
uniform vec4 _ScreenParams;
|
||
|
uniform vec4 _WorldSpaceLightPos0;
|
||
|
uniform mat4 _Object2World;
|
||
|
uniform mat4 _World2Object;
|
||
|
uniform vec4 unity_Scale;
|
||
|
uniform mat4 glstate_matrix_transpose_modelview0;
|
||
|
uniform samplerCube _Cube;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform vec4 _MainTex_ST;
|
||
|
uniform sampler2D _DetailAlbedoMap;
|
||
|
uniform vec4 _DetailAlbedoMap_ST;
|
||
|
uniform sampler2D _AlphaMap;
|
||
|
uniform sampler2D _Occlusion;
|
||
|
uniform sampler2D _DetailNormalMap;
|
||
|
uniform vec4 _DetailNormalMap_ST;
|
||
|
uniform float _DetailNormalMapScale;
|
||
|
uniform sampler2D _BumpMap;
|
||
|
uniform float _BumpScale;
|
||
|
uniform float _Exposure;
|
||
|
uniform float _DetailBumpScale;
|
||
|
uniform float _AlphaTestRef;
|
||
|
uniform float _DetailBumpTiling;
|
||
|
uniform vec4 _Color;
|
||
|
uniform vec4 _SpecularColor;
|
||
|
uniform sampler2D _SpecGlossMap;
|
||
|
uniform float _Glossiness;
|
||
|
uniform vec4 unity_ColorSpaceGrey;
|
||
|
uniform vec4 _LightColor0;
|
||
|
uniform samplerCube _SpecCube;
|
||
|
uniform vec4 unity_LightmapST;
|
||
|
uniform sampler2D unity_Lightmap;
|
||
|
uniform sampler2D unity_LightmapInd;
|
||
|
uniform float _SelfIllumScale;
|
||
|
uniform sampler2D _SelfIllum;
|
||
|
attribute vec4 TANGENT;
|
||
|
varying vec4 xlv_TEXCOORD0;
|
||
|
varying vec4 xlv_TEXCOORD1;
|
||
|
varying vec3 xlv_TEXCOORD2;
|
||
|
varying vec4 xlv_TEXCOORD3;
|
||
|
varying vec3 xlv_TEXCOORD4;
|
||
|
varying vec4 xlv_TEXCOORD5;
|
||
|
varying vec3 xlv_TEXCOORD7;
|
||
|
mat3 xll_constructMat3_mf4x4 (
|
||
|
in mat4 m_1
|
||
|
)
|
||
|
{
|
||
|
vec3 tmpvar_2;
|
||
|
tmpvar_2 = m_1[0].xyz;
|
||
|
vec3 tmpvar_3;
|
||
|
tmpvar_3 = m_1[1].xyz;
|
||
|
vec3 tmpvar_4;
|
||
|
tmpvar_4 = m_1[2].xyz;
|
||
|
mat3 tmpvar_5;
|
||
|
vec3 tmpvar_6;
|
||
|
tmpvar_6 = tmpvar_2;
|
||
|
tmpvar_5[0] = tmpvar_6;
|
||
|
vec3 tmpvar_7;
|
||
|
tmpvar_7 = tmpvar_3;
|
||
|
tmpvar_5[1] = tmpvar_7;
|
||
|
vec3 tmpvar_8;
|
||
|
tmpvar_8 = tmpvar_4;
|
||
|
tmpvar_5[2] = tmpvar_8;
|
||
|
return tmpvar_5;
|
||
|
}
|
||
|
|
||
|
vec4 ComputeScreenPos (
|
||
|
in vec4 pos_9
|
||
|
)
|
||
|
{
|
||
|
vec4 o_10;
|
||
|
vec4 tmpvar_11;
|
||
|
tmpvar_11 = (pos_9 * 0.5);
|
||
|
o_10 = tmpvar_11;
|
||
|
vec2 tmpvar_12;
|
||
|
tmpvar_12.x = o_10.x;
|
||
|
tmpvar_12.y = (o_10.y * _ProjectionParams.x);
|
||
|
vec2 tmpvar_13;
|
||
|
tmpvar_13 = (tmpvar_12 + o_10.w);
|
||
|
o_10.xy = tmpvar_13.xy.xy;
|
||
|
vec2 tmpvar_14;
|
||
|
tmpvar_14 = pos_9.zw;
|
||
|
o_10.zw = tmpvar_14.xxxy.zw;
|
||
|
return o_10;
|
||
|
}
|
||
|
|
||
|
VertexOutput vert (
|
||
|
in VertexInput v_15
|
||
|
)
|
||
|
{
|
||
|
VertexOutput o_16;
|
||
|
vec4 tmpvar_17;
|
||
|
tmpvar_17 = (_Object2World * v_15.vertex);
|
||
|
o_16.posWorld = tmpvar_17;
|
||
|
vec4 tmpvar_18;
|
||
|
tmpvar_18 = (gl_ModelViewProjectionMatrix * v_15.vertex);
|
||
|
o_16.pos = tmpvar_18;
|
||
|
vec4 tmpvar_19;
|
||
|
tmpvar_19 = v_15.texcoord;
|
||
|
o_16.tex = tmpvar_19;
|
||
|
vec2 tmpvar_20;
|
||
|
tmpvar_20 = ((v_15.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
||
|
o_16.tex.xy = tmpvar_20.xy.xy;
|
||
|
vec2 tmpvar_21;
|
||
|
tmpvar_21 = ((v_15.texcoord.xy * _DetailAlbedoMap_ST.xy) + _DetailAlbedoMap_ST.zw);
|
||
|
o_16.tex.zw = tmpvar_21.xxxy.zw;
|
||
|
mat3 tmpvar_22;
|
||
|
tmpvar_22 = xll_constructMat3_mf4x4 (_Object2World);
|
||
|
vec3 tmpvar_23;
|
||
|
tmpvar_23 = normalize ((tmpvar_22 * v_15.normal));
|
||
|
vec3 tmpvar_24;
|
||
|
tmpvar_24 = tmpvar_23;
|
||
|
o_16.normalWorld = tmpvar_24;
|
||
|
mat3 tmpvar_25;
|
||
|
tmpvar_25 = xll_constructMat3_mf4x4 (_Object2World);
|
||
|
vec4 tmpvar_26;
|
||
|
tmpvar_26.xyz = (tmpvar_25 * v_15.tangent.xyz).xyz;
|
||
|
tmpvar_26.w = v_15.tangent.w;
|
||
|
vec4 tmpvar_27;
|
||
|
tmpvar_27 = tmpvar_26;
|
||
|
o_16.tangentWorld = tmpvar_27;
|
||
|
vec3 tmpvar_28;
|
||
|
tmpvar_28 = normalize (o_16.tangentWorld.xyz);
|
||
|
vec3 tmpvar_29;
|
||
|
tmpvar_29 = tmpvar_28;
|
||
|
o_16.tangentWorld.xyz = tmpvar_29.xyz.xyz;
|
||
|
vec4 tmpvar_30;
|
||
|
tmpvar_30 = ComputeScreenPos (o_16.pos);
|
||
|
vec4 tmpvar_31;
|
||
|
tmpvar_31 = tmpvar_30;
|
||
|
o_16._ShadowCoord = tmpvar_31;
|
||
|
vec2 tmpvar_32;
|
||
|
tmpvar_32 = ((v_15.texcoord1.xy * unity_LightmapST.xy) + unity_LightmapST.zw);
|
||
|
o_16.extra.xy = tmpvar_32.xy.xy;
|
||
|
float tmpvar_33;
|
||
|
tmpvar_33 = 0.0;
|
||
|
o_16.extra.z = vec3(tmpvar_33).z;
|
||
|
return o_16;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
VertexInput xlt_v_34;
|
||
|
VertexOutput xl_retval_35;
|
||
|
vec4 tmpvar_36;
|
||
|
tmpvar_36 = gl_Vertex.xyzw;
|
||
|
vec4 tmpvar_37;
|
||
|
tmpvar_37 = tmpvar_36;
|
||
|
xlt_v_34.vertex = tmpvar_37;
|
||
|
vec3 tmpvar_38;
|
||
|
tmpvar_38 = gl_Normal.xyz;
|
||
|
vec3 tmpvar_39;
|
||
|
tmpvar_39 = tmpvar_38;
|
||
|
xlt_v_34.normal = tmpvar_39;
|
||
|
vec4 tmpvar_40;
|
||
|
tmpvar_40 = gl_MultiTexCoord0.xyzw;
|
||
|
vec4 tmpvar_41;
|
||
|
tmpvar_41 = tmpvar_40;
|
||
|
xlt_v_34.texcoord = tmpvar_41;
|
||
|
vec4 tmpvar_42;
|
||
|
tmpvar_42 = gl_MultiTexCoord1.xyzw;
|
||
|
vec4 tmpvar_43;
|
||
|
tmpvar_43 = tmpvar_42;
|
||
|
xlt_v_34.texcoord1 = tmpvar_43;
|
||
|
vec4 tmpvar_44;
|
||
|
tmpvar_44 = TANGENT.xyzw;
|
||
|
vec4 tmpvar_45;
|
||
|
tmpvar_45 = tmpvar_44;
|
||
|
xlt_v_34.tangent = tmpvar_45;
|
||
|
VertexOutput tmpvar_46;
|
||
|
tmpvar_46 = vert (xlt_v_34);
|
||
|
VertexOutput tmpvar_47;
|
||
|
tmpvar_47 = tmpvar_46;
|
||
|
xl_retval_35 = tmpvar_47;
|
||
|
vec4 tmpvar_48;
|
||
|
tmpvar_48 = xl_retval_35.pos.xyzw;
|
||
|
vec4 tmpvar_49;
|
||
|
tmpvar_49 = tmpvar_48;
|
||
|
gl_Position = tmpvar_49;
|
||
|
vec4 tmpvar_50;
|
||
|
tmpvar_50 = xl_retval_35.tex.xyzw;
|
||
|
vec4 tmpvar_51;
|
||
|
tmpvar_51 = tmpvar_50;
|
||
|
xlv_TEXCOORD0 = tmpvar_51;
|
||
|
vec4 tmpvar_52;
|
||
|
tmpvar_52 = xl_retval_35.posWorld.xyzw;
|
||
|
vec4 tmpvar_53;
|
||
|
tmpvar_53 = tmpvar_52;
|
||
|
xlv_TEXCOORD1 = tmpvar_53;
|
||
|
vec3 tmpvar_54;
|
||
|
tmpvar_54 = xl_retval_35.normalWorld.xyz;
|
||
|
vec3 tmpvar_55;
|
||
|
tmpvar_55 = tmpvar_54;
|
||
|
xlv_TEXCOORD2 = tmpvar_55;
|
||
|
vec4 tmpvar_56;
|
||
|
tmpvar_56 = xl_retval_35.tangentWorld.xyzw;
|
||
|
vec4 tmpvar_57;
|
||
|
tmpvar_57 = tmpvar_56;
|
||
|
xlv_TEXCOORD3 = tmpvar_57;
|
||
|
vec3 tmpvar_58;
|
||
|
tmpvar_58 = xl_retval_35.extra.xyz;
|
||
|
vec3 tmpvar_59;
|
||
|
tmpvar_59 = tmpvar_58;
|
||
|
xlv_TEXCOORD4 = tmpvar_59;
|
||
|
vec4 tmpvar_60;
|
||
|
tmpvar_60 = xl_retval_35._ShadowCoord.xyzw;
|
||
|
vec4 tmpvar_61;
|
||
|
tmpvar_61 = tmpvar_60;
|
||
|
xlv_TEXCOORD5 = tmpvar_61;
|
||
|
vec3 tmpvar_62;
|
||
|
tmpvar_62 = xl_retval_35.lightDir.xyz;
|
||
|
vec3 tmpvar_63;
|
||
|
tmpvar_63 = tmpvar_62;
|
||
|
xlv_TEXCOORD7 = tmpvar_63;
|
||
|
}
|
||
|
|