Browse Source

Merge branch 'master' of github.com:Ultimaker/Cura

Jaime van Kessel 5 years ago
parent
commit
3fe5c9fc6a

+ 13 - 5
plugins/SimulationView/layers.shader

@@ -1,6 +1,9 @@
 [shaders]
 [shaders]
 vertex =
 vertex =
-    uniform highp mat4 u_modelViewProjectionMatrix;
+    uniform highp mat4 u_modelMatrix;
+    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_shade_factor;
     uniform lowp float u_shade_factor;
     uniform highp int u_layer_view_type;
     uniform highp int u_layer_view_type;
@@ -16,7 +19,7 @@ vertex =
 
 
     void main()
     void main()
     {
     {
-        gl_Position = u_modelViewProjectionMatrix * a_vertex;
+        gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
         // shade the color depending on the extruder index
         // shade the color depending on the extruder index
         v_color = a_color;
         v_color = a_color;
         // 8 and 9 are travel moves
         // 8 and 9 are travel moves
@@ -76,7 +79,10 @@ fragment =
 
 
 vertex41core =
 vertex41core =
     #version 410
     #version 410
-    uniform highp mat4 u_modelViewProjectionMatrix;
+    uniform highp mat4 u_modelMatrix;
+    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_shade_factor;
     uniform lowp float u_shade_factor;
     uniform highp int u_layer_view_type;
     uniform highp int u_layer_view_type;
@@ -92,7 +98,7 @@ vertex41core =
 
 
     void main()
     void main()
     {
     {
-        gl_Position = u_modelViewProjectionMatrix * a_vertex;
+        gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
         v_color = a_color;
         v_color = a_color;
         if ((a_line_type != 8) && (a_line_type != 9)) {
         if ((a_line_type != 8) && (a_line_type != 9)) {
             v_color = (a_extruder == u_active_extruder) ? v_color : vec4(u_shade_factor * v_color.rgb, v_color.a);
             v_color = (a_extruder == u_active_extruder) ? v_color : vec4(u_shade_factor * v_color.rgb, v_color.a);
@@ -154,7 +160,9 @@ u_show_skin = 1
 u_show_infill = 1
 u_show_infill = 1
 
 
 [bindings]
 [bindings]
-u_modelViewProjectionMatrix = model_view_projection_matrix
+u_modelMatrix = model_matrix
+u_viewMatrix = view_matrix
+u_projectionMatrix = projection_matrix
 
 
 [attributes]
 [attributes]
 a_vertex = vertex
 a_vertex = vertex

+ 68 - 45
plugins/SimulationView/layers3d.shader

@@ -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
 
 

+ 68 - 45
plugins/SimulationView/layers3d_shadow.shader

@@ -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 vec4 u_extruder_opacity;  // currently only for max 4 extruders, others always visible
     uniform lowp vec4 u_extruder_opacity;  // currently only for max 4 extruders, others always visible
 
 
@@ -58,7 +58,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;
@@ -90,6 +93,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
@@ -137,65 +142,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();
         }
         }
@@ -246,9 +269,9 @@ u_show_skin = 1
 u_show_infill = 1
 u_show_infill = 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
 
 

+ 13 - 5
plugins/SimulationView/layers_shadow.shader

@@ -1,6 +1,9 @@
 [shaders]
 [shaders]
 vertex =
 vertex =
-    uniform highp mat4 u_modelViewProjectionMatrix;
+    uniform highp mat4 u_modelMatrix;
+    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_shade_factor;
     uniform lowp float u_shade_factor;
     uniform highp int u_layer_view_type;
     uniform highp int u_layer_view_type;
@@ -16,7 +19,7 @@ vertex =
 
 
     void main()
     void main()
     {
     {
-        gl_Position = u_modelViewProjectionMatrix * a_vertex;
+        gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
         // shade the color depending on the extruder index
         // shade the color depending on the extruder index
         v_color = vec4(0.4, 0.4, 0.4, 0.9);    // default color for not current layer;
         v_color = vec4(0.4, 0.4, 0.4, 0.9);    // default color for not current layer;
         // 8 and 9 are travel moves
         // 8 and 9 are travel moves
@@ -80,7 +83,10 @@ fragment =
 
 
 vertex41core =
 vertex41core =
     #version 410
     #version 410
-    uniform highp mat4 u_modelViewProjectionMatrix;
+    uniform highp mat4 u_modelMatrix;
+    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_shade_factor;
     uniform lowp float u_shade_factor;
     uniform highp int u_layer_view_type;
     uniform highp int u_layer_view_type;
@@ -96,7 +102,7 @@ vertex41core =
 
 
     void main()
     void main()
     {
     {
-        gl_Position = u_modelViewProjectionMatrix * a_vertex;
+        gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
         v_color = vec4(0.4, 0.4, 0.4, 0.9);    // default color for not current layer
         v_color = vec4(0.4, 0.4, 0.4, 0.9);    // default color for not current layer
         // if ((a_line_type != 8) && (a_line_type != 9)) {
         // if ((a_line_type != 8) && (a_line_type != 9)) {
         //     v_color = (a_extruder == u_active_extruder) ? v_color : vec4(u_shade_factor * v_color.rgb, v_color.a);
         //     v_color = (a_extruder == u_active_extruder) ? v_color : vec4(u_shade_factor * v_color.rgb, v_color.a);
@@ -159,7 +165,9 @@ u_show_skin = 1
 u_show_infill = 1
 u_show_infill = 1
 
 
 [bindings]
 [bindings]
-u_modelViewProjectionMatrix = model_view_projection_matrix
+u_modelMatrix = model_matrix
+u_viewMatrix = view_matrix
+u_projectionMatrix = projection_matrix
 
 
 [attributes]
 [attributes]
 a_vertex = vertex
 a_vertex = vertex

+ 11 - 5
plugins/XRayView/xray.shader

@@ -1,12 +1,14 @@
 [shaders]
 [shaders]
 vertex =
 vertex =
-    uniform highp mat4 u_modelViewProjectionMatrix;
+    uniform highp mat4 u_modelMatrix;
+    uniform highp mat4 u_viewMatrix;
+    uniform highp mat4 u_projectionMatrix;
 
 
     attribute highp vec4 a_vertex;
     attribute highp vec4 a_vertex;
 
 
     void main()
     void main()
     {
     {
-        gl_Position = u_modelViewProjectionMatrix * a_vertex;
+        gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
     }
     }
 
 
 fragment =
 fragment =
@@ -19,13 +21,15 @@ fragment =
 
 
 vertex41core =
 vertex41core =
     #version 410
     #version 410
-    uniform highp mat4 u_modelViewProjectionMatrix;
+    uniform highp mat4 u_modelMatrix;
+    uniform highp mat4 u_viewMatrix;
+    uniform highp mat4 u_projectionMatrix;
 
 
     in highp vec4 a_vertex;
     in highp vec4 a_vertex;
 
 
     void main()
     void main()
     {
     {
-        gl_Position = u_modelViewProjectionMatrix * a_vertex;
+        gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
     }
     }
 
 
 fragment41core =
 fragment41core =
@@ -43,7 +47,9 @@ fragment41core =
 u_color = [0.02, 0.02, 0.02, 1.0]
 u_color = [0.02, 0.02, 0.02, 1.0]
 
 
 [bindings]
 [bindings]
-u_modelViewProjectionMatrix = model_view_projection_matrix
+u_modelMatrix = model_matrix
+u_viewMatrix = view_matrix
+u_projectionMatrix = projection_matrix
 
 
 [attributes]
 [attributes]
 a_vertex = vertex
 a_vertex = vertex

+ 8 - 5
resources/shaders/camera_distance.shader

@@ -1,7 +1,8 @@
 [shaders]
 [shaders]
 vertex =
 vertex =
     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;
 
 
     attribute highp vec4 a_vertex;
     attribute highp vec4 a_vertex;
 
 
@@ -10,7 +11,7 @@ vertex =
     void main()
     void main()
     {
     {
         vec4 world_space_vert = u_modelMatrix * a_vertex;
         vec4 world_space_vert = u_modelMatrix * a_vertex;
-        gl_Position = u_viewProjectionMatrix * world_space_vert;
+        gl_Position = u_projectionMatrix * u_viewMatrix * world_space_vert;
 
 
         v_vertex = world_space_vert.xyz;
         v_vertex = world_space_vert.xyz;
     }
     }
@@ -36,7 +37,8 @@ fragment =
 vertex41core =
 vertex41core =
     #version 410
     #version 410
     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;
 
 
     in highp vec4 a_vertex;
     in highp vec4 a_vertex;
 
 
@@ -45,7 +47,7 @@ vertex41core =
     void main()
     void main()
     {
     {
         vec4 world_space_vert = u_modelMatrix * a_vertex;
         vec4 world_space_vert = u_modelMatrix * a_vertex;
-        gl_Position = u_viewProjectionMatrix * world_space_vert;
+        gl_Position = u_projectionMatrix * u_viewMatrix * world_space_vert;
 
 
         v_vertex = world_space_vert.xyz;
         v_vertex = world_space_vert.xyz;
     }
     }
@@ -75,7 +77,8 @@ fragment41core =
 
 
 [bindings]
 [bindings]
 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_viewPosition = view_position
 u_viewPosition = view_position
 
 

+ 11 - 5
resources/shaders/grid.shader

@@ -1,6 +1,8 @@
 [shaders]
 [shaders]
 vertex =
 vertex =
-    uniform highp mat4 u_modelViewProjectionMatrix;
+    uniform highp mat4 u_modelMatrix;
+    uniform highp mat4 u_viewMatrix;
+    uniform highp mat4 u_projectionMatrix;
 
 
     attribute highp vec4 a_vertex;
     attribute highp vec4 a_vertex;
     attribute lowp vec2 a_uvs;
     attribute lowp vec2 a_uvs;
@@ -9,7 +11,7 @@ vertex =
 
 
     void main()
     void main()
     {
     {
-        gl_Position = u_modelViewProjectionMatrix * a_vertex;
+        gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
         v_uvs = a_uvs;
         v_uvs = a_uvs;
     }
     }
 
 
@@ -47,7 +49,9 @@ fragment =
 
 
 vertex41core =
 vertex41core =
     #version 410
     #version 410
-    uniform highp mat4 u_modelViewProjectionMatrix;
+    uniform highp mat4 u_modelMatrix;
+    uniform highp mat4 u_viewMatrix;
+    uniform highp mat4 u_projectionMatrix;
 
 
     in highp vec4 a_vertex;
     in highp vec4 a_vertex;
     in lowp vec2 a_uvs;
     in lowp vec2 a_uvs;
@@ -56,7 +60,7 @@ vertex41core =
 
 
     void main()
     void main()
     {
     {
-        gl_Position = u_modelViewProjectionMatrix * a_vertex;
+        gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
         v_uvs = a_uvs;
         v_uvs = a_uvs;
     }
     }
 
 
@@ -92,7 +96,9 @@ u_gridColor0 = [0.96, 0.96, 0.96, 1.0]
 u_gridColor1 = [0.8, 0.8, 0.8, 1.0]
 u_gridColor1 = [0.8, 0.8, 0.8, 1.0]
 
 
 [bindings]
 [bindings]
-u_modelViewProjectionMatrix = model_view_projection_matrix
+u_modelMatrix = model_matrix
+u_viewMatrix = view_matrix
+u_projectionMatrix = projection_matrix
 
 
 [attributes]
 [attributes]
 a_vertex = vertex
 a_vertex = vertex

+ 10 - 5
resources/shaders/overhang.shader

@@ -1,7 +1,9 @@
 [shaders]
 [shaders]
 vertex =
 vertex =
     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 highp mat4 u_normalMatrix;
     uniform highp mat4 u_normalMatrix;
 
 
     attribute highp vec4 a_vertex;
     attribute highp vec4 a_vertex;
@@ -14,7 +16,7 @@ vertex =
     void main()
     void main()
     {
     {
         vec4 world_space_vert = u_modelMatrix * a_vertex;
         vec4 world_space_vert = u_modelMatrix * a_vertex;
-        gl_Position = u_viewProjectionMatrix * world_space_vert;
+        gl_Position = u_projectionMatrix * u_viewMatrix * world_space_vert;
 
 
         f_vertex = world_space_vert.xyz;
         f_vertex = world_space_vert.xyz;
         f_normal = (u_normalMatrix * normalize(a_normal)).xyz;
         f_normal = (u_normalMatrix * normalize(a_normal)).xyz;
@@ -65,7 +67,9 @@ fragment =
 vertex41core =
 vertex41core =
     #version 410
     #version 410
     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 highp mat4 u_normalMatrix;
     uniform highp mat4 u_normalMatrix;
 
 
     in highp vec4 a_vertex;
     in highp vec4 a_vertex;
@@ -78,7 +82,7 @@ vertex41core =
     void main()
     void main()
     {
     {
         vec4 world_space_vert = u_modelMatrix * a_vertex;
         vec4 world_space_vert = u_modelMatrix * a_vertex;
-        gl_Position = u_viewProjectionMatrix * world_space_vert;
+        gl_Position = u_projectionMatrix * u_viewMatrix * world_space_vert;
 
 
         f_vertex = world_space_vert.xyz;
         f_vertex = world_space_vert.xyz;
         f_normal = (u_normalMatrix * normalize(a_normal)).xyz;
         f_normal = (u_normalMatrix * normalize(a_normal)).xyz;
@@ -138,7 +142,8 @@ u_shininess = 20.0
 
 
 [bindings]
 [bindings]
 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_viewPosition = view_position
 u_viewPosition = view_position
 u_lightPosition = light_0_position
 u_lightPosition = light_0_position

+ 10 - 5
resources/shaders/striped.shader

@@ -1,7 +1,9 @@
 [shaders]
 [shaders]
 vertex =
 vertex =
     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 highp mat4 u_normalMatrix;
     uniform highp mat4 u_normalMatrix;
 
 
     attribute highp vec4 a_vertex;
     attribute highp vec4 a_vertex;
@@ -15,7 +17,7 @@ vertex =
     void main()
     void main()
     {
     {
         vec4 world_space_vert = u_modelMatrix * a_vertex;
         vec4 world_space_vert = u_modelMatrix * a_vertex;
-        gl_Position = u_viewProjectionMatrix * world_space_vert;
+        gl_Position = u_projectionMatrix * u_viewMatrix * world_space_vert;
 
 
         v_position = gl_Position.xyz;
         v_position = gl_Position.xyz;
         v_vertex = world_space_vert.xyz;
         v_vertex = world_space_vert.xyz;
@@ -69,7 +71,9 @@ fragment =
 vertex41core =
 vertex41core =
     #version 410
     #version 410
     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 highp mat4 u_normalMatrix;
     uniform highp mat4 u_normalMatrix;
 
 
     in highp vec4 a_vertex;
     in highp vec4 a_vertex;
@@ -83,7 +87,7 @@ vertex41core =
     void main()
     void main()
     {
     {
         vec4 world_space_vert = u_modelMatrix * a_vertex;
         vec4 world_space_vert = u_modelMatrix * a_vertex;
-        gl_Position = u_viewProjectionMatrix * world_space_vert;
+        gl_Position = u_projectionMatrix * u_viewMatrix * world_space_vert;
 
 
         v_position = gl_Position.xyz;
         v_position = gl_Position.xyz;
         v_vertex = world_space_vert.xyz;
         v_vertex = world_space_vert.xyz;
@@ -148,7 +152,8 @@ u_vertical_stripes = 0
 
 
 [bindings]
 [bindings]
 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_viewPosition = view_position
 u_viewPosition = view_position
 u_lightPosition = light_0_position
 u_lightPosition = light_0_position

+ 10 - 5
resources/shaders/transparent_object.shader

@@ -1,7 +1,9 @@
 [shaders]
 [shaders]
 vertex =
 vertex =
     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 highp mat4 u_normalMatrix;
     uniform highp mat4 u_normalMatrix;
 
 
     attribute highp vec4 a_vertex;
     attribute highp vec4 a_vertex;
@@ -14,7 +16,7 @@ vertex =
     void main()
     void main()
     {
     {
         vec4 world_space_vert = u_modelMatrix * a_vertex;
         vec4 world_space_vert = u_modelMatrix * a_vertex;
-        gl_Position = u_viewProjectionMatrix * world_space_vert;
+        gl_Position = u_projectionMatrix * u_viewMatrix * world_space_vert;
 
 
         v_vertex = world_space_vert.xyz;
         v_vertex = world_space_vert.xyz;
         v_normal = (u_normalMatrix * normalize(a_normal)).xyz;
         v_normal = (u_normalMatrix * normalize(a_normal)).xyz;
@@ -51,7 +53,9 @@ fragment =
 vertex41core =
 vertex41core =
     #version 410
     #version 410
     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 highp mat4 u_normalMatrix;
     uniform highp mat4 u_normalMatrix;
 
 
     in highp vec4 a_vertex;
     in highp vec4 a_vertex;
@@ -64,7 +68,7 @@ vertex41core =
     void main()
     void main()
     {
     {
         vec4 world_space_vert = u_modelMatrix * a_vertex;
         vec4 world_space_vert = u_modelMatrix * a_vertex;
-        gl_Position = u_viewProjectionMatrix * world_space_vert;
+        gl_Position = u_projectionMatrix * u_viewMatrix * world_space_vert;
 
 
         v_vertex = world_space_vert.xyz;
         v_vertex = world_space_vert.xyz;
         v_normal = (u_normalMatrix * normalize(a_normal)).xyz;
         v_normal = (u_normalMatrix * normalize(a_normal)).xyz;
@@ -108,7 +112,8 @@ u_opacity = 0.5
 
 
 [bindings]
 [bindings]
 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
 u_diffuseColor = diffuse_color
 u_diffuseColor = diffuse_color