|
@@ -1,10 +1,10 @@
|
|
[shaders]
|
|
[shaders]
|
|
vertex41core =
|
|
vertex41core =
|
|
#version 410
|
|
#version 410
|
|
- uniform highp mat4 u_modelViewProjectionMatrix;
|
|
|
|
-
|
|
|
|
uniform highp mat4 u_modelMatrix;
|
|
uniform highp mat4 u_modelMatrix;
|
|
- uniform highp mat4 u_viewProjectionMatrix;
|
|
|
|
|
|
+ uniform highp mat4 u_viewMatrix;
|
|
|
|
+ uniform highp mat4 u_projectionMatrix;
|
|
|
|
+
|
|
uniform lowp float u_active_extruder;
|
|
uniform lowp float u_active_extruder;
|
|
uniform lowp float u_max_feedrate;
|
|
uniform lowp float u_max_feedrate;
|
|
uniform lowp float u_min_feedrate;
|
|
uniform lowp float u_min_feedrate;
|
|
@@ -104,7 +104,10 @@ vertex41core =
|
|
geometry41core =
|
|
geometry41core =
|
|
#version 410
|
|
#version 410
|
|
|
|
|
|
- uniform highp mat4 u_viewProjectionMatrix;
|
|
|
|
|
|
+ uniform highp mat4 u_modelMatrix;
|
|
|
|
+ uniform highp mat4 u_viewMatrix;
|
|
|
|
+ uniform highp mat4 u_projectionMatrix;
|
|
|
|
+
|
|
uniform int u_show_travel_moves;
|
|
uniform int u_show_travel_moves;
|
|
uniform int u_show_helpers;
|
|
uniform int u_show_helpers;
|
|
uniform int u_show_skin;
|
|
uniform int u_show_skin;
|
|
@@ -136,6 +139,8 @@ geometry41core =
|
|
|
|
|
|
void main()
|
|
void main()
|
|
{
|
|
{
|
|
|
|
+ highp mat4 viewProjectionMatrix = u_projectionMatrix * u_viewMatrix;
|
|
|
|
+
|
|
vec4 g_vertex_delta;
|
|
vec4 g_vertex_delta;
|
|
vec3 g_vertex_normal_horz; // horizontal and vertical in respect to layers
|
|
vec3 g_vertex_normal_horz; // horizontal and vertical in respect to layers
|
|
vec4 g_vertex_offset_horz; // vec4 to match gl_in[x].gl_Position
|
|
vec4 g_vertex_offset_horz; // vec4 to match gl_in[x].gl_Position
|
|
@@ -183,65 +188,83 @@ geometry41core =
|
|
g_vertex_offset_vert = vec4(g_vertex_normal_vert * size_y, 0.0);
|
|
g_vertex_offset_vert = vec4(g_vertex_normal_vert * size_y, 0.0);
|
|
|
|
|
|
if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) {
|
|
if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) {
|
|
|
|
+ vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head + g_vertex_offset_vert);
|
|
|
|
+ vec4 va_up = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
|
|
|
+ vec4 va_down = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
|
|
|
+ vec4 vb_head = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head + g_vertex_offset_vert);
|
|
|
|
+ vec4 vb_down = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
|
|
|
+ vec4 vb_up = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
|
|
|
+
|
|
// Travels: flat plane with pointy ends
|
|
// Travels: flat plane with pointy ends
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head + g_vertex_offset_vert));
|
|
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_up);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_head);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_down);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_up);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_down);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_up);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_head);
|
|
//And reverse so that the line is also visible from the back side.
|
|
//And reverse so that the line is also visible from the back side.
|
|
- myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert));
|
|
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_up);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_down);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_up);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_down);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_head);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_up);
|
|
|
|
|
|
EndPrimitive();
|
|
EndPrimitive();
|
|
} else {
|
|
} else {
|
|
|
|
+ vec4 va_m_horz = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz);
|
|
|
|
+ vec4 vb_m_horz = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz);
|
|
|
|
+ vec4 va_p_vert = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_vert);
|
|
|
|
+ vec4 vb_p_vert = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_vert);
|
|
|
|
+ vec4 va_p_horz = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz);
|
|
|
|
+ vec4 vb_p_horz = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz);
|
|
|
|
+ vec4 va_m_vert = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert);
|
|
|
|
+ vec4 vb_m_vert = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert);
|
|
|
|
+ vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head);
|
|
|
|
+ vec4 vb_head = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head);
|
|
|
|
+
|
|
// All normal lines are rendered as 3d tubes.
|
|
// All normal lines are rendered as 3d tubes.
|
|
- myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
|
|
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, va_m_horz);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_p_vert);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_p_vert);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, va_p_horz);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_vert, va_m_vert);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, vb_m_vert);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, va_m_horz);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
|
|
|
|
|
EndPrimitive();
|
|
EndPrimitive();
|
|
|
|
|
|
// left side
|
|
// left side
|
|
- myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz_head, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
|
|
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, va_m_horz);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_p_vert);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz_head, va_head);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, va_p_horz);
|
|
|
|
|
|
EndPrimitive();
|
|
EndPrimitive();
|
|
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz_head, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head));
|
|
|
|
- myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
|
|
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, va_p_horz);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_vert, va_m_vert);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz_head, va_head);
|
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, va_m_horz);
|
|
|
|
|
|
EndPrimitive();
|
|
EndPrimitive();
|
|
|
|
|
|
// right side
|
|
// right side
|
|
- myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
|
|
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_p_vert);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, vb_head);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
|
|
|
|
|
EndPrimitive();
|
|
EndPrimitive();
|
|
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head));
|
|
|
|
- myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
|
|
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, vb_m_vert);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, vb_head);
|
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
|
|
|
|
|
|
EndPrimitive();
|
|
EndPrimitive();
|
|
}
|
|
}
|
|
@@ -301,9 +324,9 @@ u_min_thickness = 0
|
|
u_max_thickness = 1
|
|
u_max_thickness = 1
|
|
|
|
|
|
[bindings]
|
|
[bindings]
|
|
-u_modelViewProjectionMatrix = model_view_projection_matrix
|
|
|
|
u_modelMatrix = model_matrix
|
|
u_modelMatrix = model_matrix
|
|
-u_viewProjectionMatrix = view_projection_matrix
|
|
|
|
|
|
+u_viewMatrix = view_matrix
|
|
|
|
+u_projectionMatrix = projection_matrix
|
|
u_normalMatrix = normal_matrix
|
|
u_normalMatrix = normal_matrix
|
|
u_lightPosition = light_0_position
|
|
u_lightPosition = light_0_position
|
|
|
|
|