diff options
Diffstat (limited to 'resources')
-rw-r--r-- | resources/shaders/gouraud.vs | 8 | ||||
-rw-r--r-- | resources/shaders/variable_layer_height.vs | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/resources/shaders/gouraud.vs b/resources/shaders/gouraud.vs index 22ba91a93..ea7e46e79 100644 --- a/resources/shaders/gouraud.vs +++ b/resources/shaders/gouraud.vs @@ -22,8 +22,8 @@ struct PrintBoxDetection { vec3 min; vec3 max; - // xyz contains the offset, if w == 1.0 detection needs to be performed - vec4 volume_origin; + bool volume_detection; + mat4 volume_world_matrix; }; uniform PrintBoxDetection print_box; @@ -54,9 +54,9 @@ void main() intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; // compute deltas for out of print volume detection (world coordinates) - if (print_box.volume_origin.w == 1.0) + if (print_box.volume_detection) { - vec3 v = gl_Vertex.xyz + print_box.volume_origin.xyz; + vec3 v = (print_box.volume_world_matrix * gl_Vertex).xyz; delta_box_min = v - print_box.min; delta_box_max = v - print_box.max; } diff --git a/resources/shaders/variable_layer_height.vs b/resources/shaders/variable_layer_height.vs index 2c918c0d4..9763859d0 100644 --- a/resources/shaders/variable_layer_height.vs +++ b/resources/shaders/variable_layer_height.vs @@ -14,6 +14,8 @@ const vec3 LIGHT_FRONT_DIR = vec3(0.6985074, 0.1397015, 0.6985074); #define INTENSITY_AMBIENT 0.3 +uniform mat4 volume_world_matrix; + // x = tainted, y = specular; varying vec2 intensity; @@ -38,9 +40,8 @@ void main() NdotL = max(dot(normal, LIGHT_FRONT_DIR), 0.0); intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; - - // Scaled to widths of the Z texture. - object_z = gl_Vertex.z; + // Scaled to widths of the Z texture. + object_z = (volume_world_matrix * gl_Vertex).z; gl_Position = ftransform(); } |