2017-12-25 01:00:10 -05:00
|
|
|
layout(location = 0) in vec3 i_position;
|
|
|
|
|
|
|
|
#if defined(Converts_10bit_Vector)
|
2017-12-26 22:33:30 -05:00
|
|
|
layout(location = 1) in vec4 i_normal_orig;
|
2017-12-25 01:00:10 -05:00
|
|
|
#else
|
|
|
|
layout(location = 1) in vec4 i_normal;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
layout(location = 2) in vec4 i_color;
|
|
|
|
layout(location = 3) in vec2 i_uv;
|
|
|
|
layout(location = 4) in vec2 i_uv_two;
|
|
|
|
|
|
|
|
#if defined(Converts_10bit_Vector)
|
2017-12-26 22:33:30 -05:00
|
|
|
layout(location = 5) in vec4 i_tangent_orig;
|
2017-12-25 01:00:10 -05:00
|
|
|
#else
|
|
|
|
layout(location = 5) in vec4 i_tangent;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
layout(location = 8) in vec3 i_origin;
|
|
|
|
layout(location = 9) in vec4 i_rotation;
|
|
|
|
layout(location = 10) in vec4 i_scale;
|
2017-12-26 23:31:21 -05:00
|
|
|
layout(location = 11) in vec2 i_texture_trans;
|
|
|
|
layout(location = 12) in ivec2 i_misc_data;
|
2017-12-25 01:00:10 -05:00
|
|
|
|
|
|
|
#stk_include "utils/get_world_location.vert"
|
|
|
|
|
|
|
|
out vec3 tangent;
|
|
|
|
out vec3 bitangent;
|
|
|
|
out vec3 normal;
|
|
|
|
out vec2 uv;
|
|
|
|
out vec2 uv_two;
|
|
|
|
out vec4 color;
|
2018-01-14 04:39:16 -05:00
|
|
|
out vec4 world_position;
|
2018-04-07 16:16:43 -04:00
|
|
|
out vec3 world_normal;
|
2018-01-28 02:28:20 -05:00
|
|
|
out float camdist;
|
2018-02-02 08:17:24 -05:00
|
|
|
out float hue_change;
|
2017-12-25 01:00:10 -05:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
|
|
|
|
#if defined(Converts_10bit_Vector)
|
2017-12-26 22:33:30 -05:00
|
|
|
vec4 i_normal = convert10BitVector(i_normal_orig);
|
|
|
|
vec4 i_tangent = convert10BitVector(i_tangent_orig);
|
2017-12-25 01:00:10 -05:00
|
|
|
#endif
|
|
|
|
|
2018-04-12 04:27:48 -04:00
|
|
|
vec4 v_world_position = getWorldPosition(i_origin, i_rotation, i_scale.xyz,
|
2017-12-25 01:00:10 -05:00
|
|
|
i_position);
|
2018-04-12 04:27:48 -04:00
|
|
|
vec3 v_world_normal = rotateVector(i_rotation, i_normal.xyz);
|
|
|
|
vec3 world_tangent = rotateVector(i_rotation, i_tangent.xyz);
|
2017-12-25 01:00:10 -05:00
|
|
|
|
|
|
|
tangent = (u_view_matrix * vec4(world_tangent, 0.0)).xyz;
|
|
|
|
bitangent = (u_view_matrix *
|
|
|
|
// bitangent sign
|
2018-04-07 16:16:43 -04:00
|
|
|
vec4(cross(v_world_normal, world_tangent) * i_tangent.w, 0.0)
|
2017-12-25 01:00:10 -05:00
|
|
|
).xyz;
|
2018-04-07 16:16:43 -04:00
|
|
|
normal = (u_view_matrix * vec4(v_world_normal, 0.0)).xyz;
|
2017-12-25 01:00:10 -05:00
|
|
|
|
2017-12-26 23:31:21 -05:00
|
|
|
uv = vec2(i_uv.x + (i_texture_trans.x * i_normal.w),
|
|
|
|
i_uv.y + (i_texture_trans.y * i_normal.w));
|
2017-12-25 01:00:10 -05:00
|
|
|
uv_two = i_uv_two;
|
|
|
|
|
|
|
|
color = i_color.zyxw;
|
2018-01-28 02:28:20 -05:00
|
|
|
camdist = length(u_view_matrix * v_world_position);
|
2017-12-26 23:31:21 -05:00
|
|
|
hue_change = float(i_misc_data.y) * 0.01;
|
2018-01-28 02:28:20 -05:00
|
|
|
gl_Position = u_projection_view_matrix * v_world_position;
|
|
|
|
world_position = v_world_position;
|
2018-04-07 16:16:43 -04:00
|
|
|
world_normal = v_world_normal;
|
2017-12-25 01:00:10 -05:00
|
|
|
}
|