mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
156 lines
4 KiB
Text
156 lines
4 KiB
Text
struct v2f {
|
|
vec4 pos;
|
|
float fog;
|
|
vec4 color;
|
|
vec2 uv;
|
|
};
|
|
struct appdata_tree_billboard {
|
|
vec4 vertex;
|
|
vec4 color;
|
|
vec4 texcoord;
|
|
vec2 texcoord1;
|
|
};
|
|
uniform vec4 _TreeBillboardCameraFront;
|
|
uniform vec4 _TreeBillboardCameraPos;
|
|
uniform vec3 _TreeBillboardCameraRight;
|
|
uniform vec4 _TreeBillboardCameraUp;
|
|
uniform vec4 _TreeBillboardDistances;
|
|
varying vec4 xlv_FOG;
|
|
void TerrainBillboardTree (
|
|
inout vec4 pos_1,
|
|
in vec2 offset_2,
|
|
in float offsetz_3
|
|
)
|
|
{
|
|
float absRadius_4;
|
|
float billboardRootOffsetFactor_5;
|
|
float billboardModeFactor_6;
|
|
float radius_7;
|
|
float billboardAngleFactor_8;
|
|
float treeDistanceSqr_9;
|
|
vec3 treePos_10;
|
|
vec3 tmpvar_11;
|
|
tmpvar_11 = (pos_1.xyz - _TreeBillboardCameraPos.xyz);
|
|
treePos_10 = tmpvar_11;
|
|
float tmpvar_12;
|
|
tmpvar_12 = dot (treePos_10, treePos_10);
|
|
float tmpvar_13;
|
|
tmpvar_13 = tmpvar_12;
|
|
treeDistanceSqr_9 = tmpvar_13;
|
|
if ((treeDistanceSqr_9 > _TreeBillboardDistances.x)) {
|
|
vec2 tmpvar_14;
|
|
tmpvar_14 = vec2(0.0, 0.0);
|
|
offset_2 = tmpvar_14.xy.xy;
|
|
};
|
|
vec3 tmpvar_15;
|
|
tmpvar_15 = (pos_1.xyz + (_TreeBillboardCameraRight.xyz * offset_2.x));
|
|
pos_1.xyz = tmpvar_15.xyz.xyz;
|
|
float tmpvar_16;
|
|
tmpvar_16 = _TreeBillboardCameraPos.w;
|
|
billboardAngleFactor_8 = tmpvar_16;
|
|
float tmpvar_17;
|
|
tmpvar_17 = mix (offset_2.y, offsetz_3, billboardAngleFactor_8);
|
|
float tmpvar_18;
|
|
tmpvar_18 = tmpvar_17;
|
|
radius_7 = tmpvar_18;
|
|
float tmpvar_19;
|
|
tmpvar_19 = _TreeBillboardCameraUp.w;
|
|
billboardModeFactor_6 = tmpvar_19;
|
|
float tmpvar_20;
|
|
tmpvar_20 = _TreeBillboardCameraFront.w;
|
|
billboardRootOffsetFactor_5 = tmpvar_20;
|
|
float tmpvar_21;
|
|
tmpvar_21 = abs (radius_7);
|
|
float tmpvar_22;
|
|
tmpvar_22 = tmpvar_21;
|
|
absRadius_4 = tmpvar_22;
|
|
float tmpvar_23;
|
|
tmpvar_23 = max (0.0, radius_7);
|
|
vec3 tmpvar_24;
|
|
tmpvar_24 = vec3(billboardModeFactor_6);
|
|
vec3 tmpvar_25;
|
|
tmpvar_25 = mix ((((
|
|
(_TreeBillboardCameraUp.xyz * tmpvar_23)
|
|
* 2.0) - (vec3(0.0, 1.0, 0.0) * absRadius_4)) - ((_TreeBillboardCameraUp.xyz * absRadius_4) * billboardRootOffsetFactor_5)), (_TreeBillboardCameraUp.xyz * radius_7), tmpvar_24);
|
|
vec3 tmpvar_26;
|
|
tmpvar_26 = (pos_1.xyz + tmpvar_25);
|
|
pos_1.xyz = tmpvar_26.xyz.xyz;
|
|
}
|
|
|
|
v2f vert (
|
|
in appdata_tree_billboard v_27
|
|
)
|
|
{
|
|
v2f o_28;
|
|
TerrainBillboardTree (v_27.vertex, v_27.texcoord1.xy, v_27.texcoord.y);
|
|
vec4 tmpvar_29;
|
|
tmpvar_29 = (gl_ModelViewProjectionMatrix * v_27.vertex);
|
|
o_28.pos = tmpvar_29;
|
|
float tmpvar_30;
|
|
tmpvar_30 = o_28.pos.z;
|
|
o_28.fog = tmpvar_30;
|
|
float tmpvar_31;
|
|
tmpvar_31 = v_27.texcoord.x;
|
|
o_28.uv.x = tmpvar_31;
|
|
float tmpvar_32;
|
|
tmpvar_32 = float((v_27.texcoord.y > 0.0));
|
|
o_28.uv.y = vec2(tmpvar_32).y;
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = v_27.color;
|
|
o_28.color = tmpvar_33;
|
|
return o_28;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_tree_billboard xlt_v_34;
|
|
v2f xl_retval_35;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = tmpvar_36;
|
|
xlt_v_34.vertex = tmpvar_37;
|
|
vec4 tmpvar_38;
|
|
tmpvar_38 = gl_Color.xyzw;
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = tmpvar_38;
|
|
xlt_v_34.color = tmpvar_39;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = tmpvar_40;
|
|
xlt_v_34.texcoord = tmpvar_41;
|
|
vec2 tmpvar_42;
|
|
tmpvar_42 = gl_MultiTexCoord1.xy;
|
|
vec2 tmpvar_43;
|
|
tmpvar_43 = tmpvar_42;
|
|
xlt_v_34.texcoord1 = tmpvar_43;
|
|
v2f tmpvar_44;
|
|
tmpvar_44 = vert (xlt_v_34);
|
|
v2f tmpvar_45;
|
|
tmpvar_45 = tmpvar_44;
|
|
xl_retval_35 = tmpvar_45;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = xl_retval_35.pos.xyzw;
|
|
vec4 tmpvar_47;
|
|
tmpvar_47 = tmpvar_46;
|
|
gl_Position = tmpvar_47;
|
|
vec4 tmpvar_48;
|
|
tmpvar_48.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_48.x = xl_retval_35.fog;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = tmpvar_48;
|
|
xlv_FOG = tmpvar_49;
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = xl_retval_35.color.xyzw;
|
|
vec4 tmpvar_51;
|
|
tmpvar_51 = tmpvar_50;
|
|
gl_FrontColor = tmpvar_51;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52.zw = vec2(0.0, 0.0);
|
|
tmpvar_52.xy = xl_retval_35.uv.xy;
|
|
vec4 tmpvar_53;
|
|
tmpvar_53 = tmpvar_52;
|
|
gl_TexCoord[0] = tmpvar_53;
|
|
}
|
|
|