Merge pull request #3813 from fieldOfView/fix_depth_picking_legacy_gl

Fix support blocker on older (legacy) opengl
This commit is contained in:
Mark 2018-05-19 08:20:56 +02:00 committed by GitHub
commit cbf34d64e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,9 +25,9 @@ fragment =
highp float distance_to_camera = distance(v_vertex, u_viewPosition) * 1000.; // distance in micron
vec3 encoded; // encode float into 3 8-bit channels; this gives a precision of a micron at a range of up to ~16 meter
encoded.b = floor(distance_to_camera / 65536.0);
encoded.g = floor((distance_to_camera - encoded.b * 65536.0) / 256.0);
encoded.r = floor(distance_to_camera - encoded.b * 65536.0 - encoded.g * 256.0);
encoded.r = floor(distance_to_camera / 65536.0);
encoded.g = floor((distance_to_camera - encoded.r * 65536.0) / 256.0);
encoded.b = floor(distance_to_camera - encoded.r * 65536.0 - encoded.g * 256.0);
gl_FragColor.rgb = encoded / 255.;
gl_FragColor.a = 1.0;