|
@@ -1,10 +1,10 @@
|
|
|
[shaders]
|
|
|
vertex41core =
|
|
|
#version 410
|
|
|
- uniform highp mat4 u_modelViewProjectionMatrix;
|
|
|
-
|
|
|
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_max_feedrate;
|
|
|
uniform lowp float u_min_feedrate;
|
|
@@ -104,7 +104,10 @@ vertex41core =
|
|
|
geometry41core =
|
|
|
#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_helpers;
|
|
|
uniform int u_show_skin;
|
|
@@ -136,6 +139,8 @@ geometry41core =
|
|
|
|
|
|
void main()
|
|
|
{
|
|
|
+ highp mat4 viewProjectionMatrix = u_projectionMatrix * u_viewMatrix;
|
|
|
+
|
|
|
vec4 g_vertex_delta;
|
|
|
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
|
|
@@ -184,64 +189,64 @@ geometry41core =
|
|
|
|
|
|
if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) {
|
|
|
// 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, 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, 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, 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, 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, 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, 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, viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head + g_vertex_offset_vert));
|
|
|
//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, 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, 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, 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, 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, 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, viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert));
|
|
|
|
|
|
EndPrimitive();
|
|
|
} else {
|
|
|
// 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, viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_vert));
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_vert));
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_vert, viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert));
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert));
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
|
|
|
|
|
|
EndPrimitive();
|
|
|
|
|
|
// 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, viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_vert));
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz_head, viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head));
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
|
|
|
|
|
|
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, viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_vert, viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert));
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz_head, viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head));
|
|
|
+ myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
|
|
|
|
|
|
EndPrimitive();
|
|
|
|
|
|
// 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, viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_vert));
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head));
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
|
|
|
|
|
|
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, viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert));
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head));
|
|
|
+ myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
|
|
|
|
|
|
EndPrimitive();
|
|
|
}
|
|
@@ -301,9 +306,9 @@ u_min_thickness = 0
|
|
|
u_max_thickness = 1
|
|
|
|
|
|
[bindings]
|
|
|
-u_modelViewProjectionMatrix = model_view_projection_matrix
|
|
|
u_modelMatrix = model_matrix
|
|
|
-u_viewProjectionMatrix = view_projection_matrix
|
|
|
+u_viewMatrix = view_matrix
|
|
|
+u_projectionMatrix = projection_matrix
|
|
|
u_normalMatrix = normal_matrix
|
|
|
u_lightPosition = light_0_position
|
|
|
|