Merge remote-tracking branch 'remotes/origin/opengl_to_cpp'

This commit is contained in:
bubnikv 2018-07-17 09:37:38 +02:00
commit 83f9813f56
24 changed files with 832 additions and 2768 deletions

View file

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

View file

@ -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();
}