layers3d.shader 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. [shaders]
  2. vertex41core =
  3. #version 410
  4. uniform highp mat4 u_modelMatrix;
  5. uniform highp mat4 u_viewMatrix;
  6. uniform highp mat4 u_projectionMatrix;
  7. uniform lowp float u_active_extruder;
  8. uniform lowp float u_max_feedrate;
  9. uniform lowp float u_min_feedrate;
  10. uniform lowp float u_max_thickness;
  11. uniform lowp float u_min_thickness;
  12. uniform lowp float u_max_line_width;
  13. uniform lowp float u_min_line_width;
  14. uniform lowp float u_max_flow_rate;
  15. uniform lowp float u_min_flow_rate;
  16. uniform lowp int u_layer_view_type;
  17. uniform lowp mat4 u_extruder_opacity; // currently only for max 16 extruders, others always visible
  18. uniform highp mat4 u_normalMatrix;
  19. uniform vec3 u_last_vertex;
  20. uniform vec3 u_next_vertex;
  21. uniform float u_last_line_ratio;
  22. in highp vec4 a_vertex;
  23. in lowp vec4 a_color;
  24. in lowp vec4 a_material_color;
  25. in highp vec4 a_normal;
  26. in highp vec2 a_line_dim; // line width and thickness
  27. in highp float a_extruder;
  28. in highp float a_prev_line_type;
  29. in highp float a_line_type;
  30. in highp float a_feedrate;
  31. in highp float a_thickness;
  32. out lowp vec4 v_color;
  33. out highp vec3 v_vertex;
  34. out highp vec3 v_normal;
  35. out lowp vec2 v_line_dim;
  36. out highp int v_extruder;
  37. out highp mat4 v_extruder_opacity;
  38. out float v_prev_line_type;
  39. out float v_line_type;
  40. out lowp vec4 f_color;
  41. out highp vec3 f_vertex;
  42. out highp vec3 f_normal;
  43. vec4 feedrateGradientColor(float abs_value, float min_value, float max_value)
  44. {
  45. float value;
  46. if(abs(max_value - min_value) < 0.0001) //Max and min are equal (barring floating point rounding errors).
  47. {
  48. value = 0.5; //Pick a colour in exactly the middle of the range.
  49. }
  50. else
  51. {
  52. value = (abs_value - min_value) / (max_value - min_value);
  53. }
  54. float red = value;
  55. float green = 1.0 - abs(1.0 - 4.0 * value);
  56. if (value > 0.375)
  57. {
  58. green = 0.5;
  59. }
  60. float blue = max(1.0 - 4.0 * value, 0.0);
  61. return vec4(red, green, blue, 1.0);
  62. }
  63. vec4 layerThicknessGradientColor(float abs_value, float min_value, float max_value)
  64. {
  65. float value;
  66. if(abs(max_value - min_value) < 0.0001) //Max and min are equal (barring floating point rounding errors).
  67. {
  68. value = 0.5; //Pick a colour in exactly the middle of the range.
  69. }
  70. else
  71. {
  72. value = (abs_value - min_value) / (max_value - min_value);
  73. }
  74. float red = min(max(4.0 * value - 2.0, 0.0), 1.0);
  75. float green = min(1.5*value, 0.75);
  76. if (value > 0.75)
  77. {
  78. green = value;
  79. }
  80. float blue = 0.75-abs(0.25-value);
  81. return vec4(red, green, blue, 1.0);
  82. }
  83. vec4 lineWidthGradientColor(float abs_value, float min_value, float max_value)
  84. {
  85. float value;
  86. if(abs(max_value - min_value) < 0.0001) //Max and min are equal (barring floating point rounding errors).
  87. {
  88. value = 0.5; //Pick a colour in exactly the middle of the range.
  89. }
  90. else
  91. {
  92. value = (abs_value - min_value) / (max_value - min_value);
  93. }
  94. float red = value;
  95. float green = 1.0 - abs(1.0 - 4.0 * value);
  96. if(value > 0.375)
  97. {
  98. green = 0.5;
  99. }
  100. float blue = max(1.0 - 4.0 * value, 0.0);
  101. return vec4(red, green, blue, 1.0);
  102. }
  103. float clamp(float v)
  104. {
  105. float t = v < 0.0 ? 0.0 : v;
  106. return t > 1.0 ? 1.0 : t;
  107. }
  108. // Inspired by https://stackoverflow.com/a/46628410
  109. vec4 flowRateGradientColor(float abs_value, float min_value, float max_value)
  110. {
  111. float t;
  112. if(abs(min_value - max_value) < 0.0001)
  113. {
  114. t = 0;
  115. }
  116. else
  117. {
  118. t = 2.0 * ((abs_value - min_value) / (max_value - min_value)) - 1;
  119. }
  120. float red = clamp(1.5 - abs(2.0 * t - 1.0));
  121. float green = clamp(1.5 - abs(2.0 * t));
  122. float blue = clamp(1.5 - abs(2.0 * t + 1.0));
  123. return vec4(red, green, blue, 1.0);
  124. }
  125. void main()
  126. {
  127. vec4 v1_vertex = a_vertex;
  128. if (v1_vertex.xyz == u_next_vertex)
  129. {
  130. v1_vertex.xyz = mix(u_last_vertex, u_next_vertex, u_last_line_ratio);
  131. }
  132. v1_vertex.y -= a_line_dim.y / 2; // half layer down
  133. vec4 world_space_vert = u_modelMatrix * v1_vertex;
  134. gl_Position = world_space_vert;
  135. // shade the color depending on the extruder index stored in the alpha component of the color
  136. switch (u_layer_view_type) {
  137. case 0: // "Material color"
  138. v_color = a_material_color;
  139. break;
  140. case 1: // "Line type"
  141. v_color = a_color;
  142. break;
  143. case 2: // "Speed", or technically 'Feedrate'
  144. v_color = feedrateGradientColor(a_feedrate, u_min_feedrate, u_max_feedrate);
  145. break;
  146. case 3: // "Layer thickness"
  147. v_color = layerThicknessGradientColor(a_line_dim.y, u_min_thickness, u_max_thickness);
  148. break;
  149. case 4: // "Line width"
  150. v_color = lineWidthGradientColor(a_line_dim.x, u_min_line_width, u_max_line_width);
  151. break;
  152. case 5: // "Flow"
  153. float flow_rate = a_line_dim.x * a_line_dim.y * a_feedrate;
  154. v_color = flowRateGradientColor(flow_rate, u_min_flow_rate, u_max_flow_rate);
  155. break;
  156. }
  157. v_vertex = world_space_vert.xyz;
  158. v_normal = (u_normalMatrix * normalize(a_normal)).xyz;
  159. v_line_dim = a_line_dim;
  160. v_extruder = int(a_extruder);
  161. v_prev_line_type = a_prev_line_type;
  162. v_line_type = a_line_type;
  163. v_extruder_opacity = u_extruder_opacity;
  164. // for testing without geometry shader
  165. f_color = v_color;
  166. f_vertex = v_vertex;
  167. f_normal = v_normal;
  168. }
  169. geometry41core =
  170. #version 410
  171. uniform highp mat4 u_modelMatrix;
  172. uniform highp mat4 u_viewMatrix;
  173. uniform highp mat4 u_projectionMatrix;
  174. uniform lowp vec4 u_starts_color;
  175. uniform int u_show_travel_moves;
  176. uniform int u_show_helpers;
  177. uniform int u_show_skin;
  178. uniform int u_show_infill;
  179. uniform int u_show_starts;
  180. layout(lines) in;
  181. layout(triangle_strip, max_vertices = 40) out;
  182. in vec4 v_color[];
  183. in vec3 v_vertex[];
  184. in vec3 v_normal[];
  185. in lowp vec2 v_line_dim[];
  186. in int v_extruder[];
  187. in mat4 v_extruder_opacity[];
  188. in float v_prev_line_type[];
  189. in float v_line_type[];
  190. out vec4 f_color;
  191. out vec3 f_normal;
  192. out vec3 f_vertex;
  193. // Set the set of variables and EmitVertex
  194. void myEmitVertex(vec3 vertex, vec4 color, vec3 normal, vec4 pos) {
  195. f_vertex = vertex;
  196. f_color = color;
  197. f_normal = normal;
  198. gl_Position = pos;
  199. EmitVertex();
  200. }
  201. void main()
  202. {
  203. highp mat4 viewProjectionMatrix = u_projectionMatrix * u_viewMatrix;
  204. vec4 g_vertex_delta;
  205. vec3 g_vertex_normal_horz; // horizontal and vertical in respect to layers
  206. vec4 g_vertex_offset_horz; // vec4 to match gl_in[x].gl_Position
  207. vec3 g_vertex_normal_vert;
  208. vec4 g_vertex_offset_vert;
  209. vec3 g_vertex_normal_horz_head;
  210. vec4 g_vertex_offset_horz_head;
  211. float size_x;
  212. float size_y;
  213. if ((v_extruder_opacity[0][int(mod(v_extruder[0], 4))][v_extruder[0] / 4] == 0.0) && (v_line_type[0] != 8) && (v_line_type[0] != 9)) {
  214. return;
  215. }
  216. // See LayerPolygon; 8 is MoveCombingType, 9 is RetractionType
  217. if ((u_show_travel_moves == 0) && ((v_line_type[0] == 8) || (v_line_type[0] == 9))) {
  218. return;
  219. }
  220. if ((u_show_helpers == 0) && ((v_line_type[0] == 4) || (v_line_type[0] == 5) || (v_line_type[0] == 7) || (v_line_type[0] == 10) || v_line_type[0] == 11)) {
  221. return;
  222. }
  223. if ((u_show_skin == 0) && ((v_line_type[0] == 1) || (v_line_type[0] == 2) || (v_line_type[0] == 3))) {
  224. return;
  225. }
  226. if ((u_show_infill == 0) && (v_line_type[0] == 6)) {
  227. return;
  228. }
  229. if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) {
  230. // fixed size for movements
  231. size_x = 0.05;
  232. } else {
  233. size_x = v_line_dim[1].x / 2 + 0.01; // radius, and make it nicely overlapping
  234. }
  235. size_y = v_line_dim[1].y / 2 + 0.01;
  236. g_vertex_delta = gl_in[1].gl_Position - gl_in[0].gl_Position; //Actual movement exhibited by the line.
  237. g_vertex_normal_horz_head = normalize(vec3(-g_vertex_delta.x, -g_vertex_delta.y, -g_vertex_delta.z)); //Lengthwise normal vector pointing backwards.
  238. g_vertex_offset_horz_head = vec4(g_vertex_normal_horz_head * size_x, 0.0); //Lengthwise offset vector pointing backwards.
  239. g_vertex_normal_horz = normalize(vec3(g_vertex_delta.z, g_vertex_delta.y, -g_vertex_delta.x)); //Normal vector pointing right.
  240. g_vertex_offset_horz = vec4(g_vertex_normal_horz * size_x, 0.0); //Offset vector pointing right.
  241. g_vertex_normal_vert = vec3(0.0, 1.0, 0.0); //Upwards normal vector.
  242. g_vertex_offset_vert = vec4(g_vertex_normal_vert * size_y, 0.0); //Upwards offset vector. Goes up by half the layer thickness.
  243. if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) { //Travel or retraction moves.
  244. vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head + g_vertex_offset_vert);
  245. vec4 va_up = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
  246. vec4 va_down = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
  247. vec4 vb_head = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head + g_vertex_offset_vert);
  248. vec4 vb_down = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
  249. vec4 vb_up = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
  250. // Travels: flat plane with pointy ends
  251. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_up);
  252. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_head);
  253. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_down);
  254. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_up);
  255. myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_down);
  256. myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_up);
  257. myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_head);
  258. //And reverse so that the line is also visible from the back side.
  259. myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_up);
  260. myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_down);
  261. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_up);
  262. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_down);
  263. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_head);
  264. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_up);
  265. EndPrimitive();
  266. } else {
  267. vec4 va_m_horz = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz); //Line start, left vertex.
  268. vec4 vb_m_horz = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz); //Line end, left vertex.
  269. vec4 va_p_vert = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_vert); //Line start, top vertex.
  270. vec4 vb_p_vert = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_vert); //Line end, top vertex.
  271. vec4 va_p_horz = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz); //Line start, right vertex.
  272. vec4 vb_p_horz = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz); //Line end, right vertex.
  273. vec4 va_m_vert = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert); //Line start, bottom vertex.
  274. vec4 vb_m_vert = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert); //Line end, bottom vertex.
  275. vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head); //Line start, tip.
  276. vec4 vb_head = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head); //Line end, tip.
  277. // All normal lines are rendered as 3d tubes.
  278. myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
  279. myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
  280. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_p_vert);
  281. myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_p_vert);
  282. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz, va_p_horz);
  283. myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
  284. myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_vert, va_m_vert);
  285. myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, vb_m_vert);
  286. myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
  287. myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
  288. EndPrimitive();
  289. // left side
  290. myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
  291. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_p_vert);
  292. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz_head, va_head);
  293. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz, va_p_horz);
  294. EndPrimitive();
  295. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz, va_p_horz);
  296. myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_vert, va_m_vert);
  297. myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz_head, va_head);
  298. myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
  299. EndPrimitive();
  300. // right side
  301. myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
  302. myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_p_vert);
  303. myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, vb_head);
  304. myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
  305. EndPrimitive();
  306. myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
  307. myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, vb_m_vert);
  308. myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, vb_head);
  309. myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
  310. EndPrimitive();
  311. }
  312. if ((u_show_starts == 1) && (
  313. ((v_prev_line_type[0] != 1) && (v_line_type[0] == 1)) ||
  314. ((v_prev_line_type[0] != 4) && (v_line_type[0] == 4))
  315. )) {
  316. float w = size_x;
  317. float h = size_y;
  318. myEmitVertex(v_vertex[0] + vec3( w, h, w), u_starts_color, normalize(vec3( 1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, w, 0.0))); // Front-top-left
  319. myEmitVertex(v_vertex[0] + vec3(-w, h, w), u_starts_color, normalize(vec3(-1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, w, 0.0))); // Front-top-right
  320. myEmitVertex(v_vertex[0] + vec3( w, -h, w), u_starts_color, normalize(vec3( 1.0, -1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, -h, w, 0.0))); // Front-bottom-left
  321. myEmitVertex(v_vertex[0] + vec3(-w, -h, w), u_starts_color, normalize(vec3(-1.0, -1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, -h, w, 0.0))); // Front-bottom-right
  322. myEmitVertex(v_vertex[0] + vec3(-w, -h, -w), u_starts_color, normalize(vec3(-1.0, -1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, -h, -w, 0.0))); // Back-bottom-right
  323. myEmitVertex(v_vertex[0] + vec3(-w, h, w), u_starts_color, normalize(vec3(-1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, w, 0.0))); // Front-top-right
  324. myEmitVertex(v_vertex[0] + vec3(-w, h, -w), u_starts_color, normalize(vec3(-1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, -w, 0.0))); // Back-top-right
  325. myEmitVertex(v_vertex[0] + vec3( w, h, w), u_starts_color, normalize(vec3( 1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, w, 0.0))); // Front-top-left
  326. myEmitVertex(v_vertex[0] + vec3( w, h, -w), u_starts_color, normalize(vec3( 1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, -w, 0.0))); // Back-top-left
  327. myEmitVertex(v_vertex[0] + vec3( w, -h, w), u_starts_color, normalize(vec3( 1.0, -1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, -h, w, 0.0))); // Front-bottom-left
  328. myEmitVertex(v_vertex[0] + vec3( w, -h, -w), u_starts_color, normalize(vec3( 1.0, -1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, -h, -w, 0.0))); // Back-bottom-left
  329. myEmitVertex(v_vertex[0] + vec3(-w, -h, -w), u_starts_color, normalize(vec3(-1.0, -1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, -h, -w, 0.0))); // Back-bottom-right
  330. myEmitVertex(v_vertex[0] + vec3( w, h, -w), u_starts_color, normalize(vec3( 1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, -w, 0.0))); // Back-top-left
  331. myEmitVertex(v_vertex[0] + vec3(-w, h, -w), u_starts_color, normalize(vec3(-1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, -w, 0.0))); // Back-top-right
  332. EndPrimitive();
  333. }
  334. }
  335. fragment41core =
  336. #version 410
  337. in lowp vec4 f_color;
  338. in lowp vec3 f_normal;
  339. in lowp vec3 f_vertex;
  340. out vec4 frag_color;
  341. uniform mediump vec4 u_ambientColor;
  342. uniform mediump vec4 u_minimumAlbedo;
  343. uniform highp vec3 u_lightPosition;
  344. void main()
  345. {
  346. mediump vec4 finalColor = vec4(0.0);
  347. float alpha = f_color.a;
  348. finalColor.rgb += f_color.rgb * 0.2 + u_minimumAlbedo.rgb;
  349. highp vec3 normal = normalize(f_normal);
  350. highp vec3 light_dir = normalize(u_lightPosition - f_vertex);
  351. // Diffuse Component
  352. highp float NdotL = clamp(dot(normal, light_dir), 0.0, 1.0);
  353. finalColor += (NdotL * f_color);
  354. finalColor.a = alpha; // Do not change alpha in any way
  355. frag_color = finalColor;
  356. }
  357. [defaults]
  358. u_active_extruder = 0.0
  359. u_layer_view_type = 0
  360. u_extruder_opacity = [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]
  361. u_specularColor = [0.4, 0.4, 0.4, 1.0]
  362. u_ambientColor = [0.3, 0.3, 0.3, 0.0]
  363. u_diffuseColor = [1.0, 0.79, 0.14, 1.0]
  364. u_minimumAlbedo = [0.1, 0.1, 0.1, 1.0]
  365. u_shininess = 20.0
  366. u_starts_color = [1.0, 1.0, 1.0, 1.0]
  367. u_show_travel_moves = 0
  368. u_show_helpers = 1
  369. u_show_skin = 1
  370. u_show_infill = 1
  371. u_show_starts = 1
  372. u_min_feedrate = 0
  373. u_max_feedrate = 1
  374. u_min_thickness = 0
  375. u_max_thickness = 1
  376. u_last_vertex = [0.0, 0.0, 0.0]
  377. u_next_vertex = [0.0, 0.0, 0.0]
  378. u_last_line_ratio = 1.0
  379. [bindings]
  380. u_modelMatrix = model_matrix
  381. u_viewMatrix = view_matrix
  382. u_projectionMatrix = projection_matrix
  383. u_normalMatrix = normal_matrix
  384. u_lightPosition = light_0_position
  385. [attributes]
  386. a_vertex = vertex
  387. a_color = color
  388. a_normal = normal
  389. a_line_dim = line_dim
  390. a_extruder = extruder
  391. a_material_color = material_color
  392. a_prev_line_type = prev_line_type
  393. a_line_type = line_type
  394. a_feedrate = feedrate
  395. a_thickness = thickness