2020-10-18 16:52:22 +00:00
|
|
|
#ifdef GL_ES
|
|
|
|
precision mediump float;
|
|
|
|
#endif
|
2020-10-18 10:22:08 +00:00
|
|
|
|
|
|
|
// OF built-in attributes.
|
|
|
|
|
|
|
|
uniform mat4 modelViewMatrix;
|
|
|
|
|
|
|
|
// Custom attributes.
|
|
|
|
|
2020-10-18 16:52:22 +00:00
|
|
|
uniform sampler2D uDepthTex; // Sampler for the depth space data
|
|
|
|
uniform sampler2D uWorldTex; // Transformation from kinect depth/color space to kinect world space
|
2020-10-19 18:25:24 +00:00
|
|
|
uniform sampler2D u_particle;
|
2020-10-18 10:22:08 +00:00
|
|
|
|
|
|
|
uniform ivec2 uFrameSize;
|
2020-10-19 09:02:40 +00:00
|
|
|
uniform ivec2 uDepthFrameSize;
|
2020-10-18 10:22:08 +00:00
|
|
|
|
2020-10-18 16:52:22 +00:00
|
|
|
uniform vec2 u_resolution;
|
|
|
|
|
2020-10-18 10:22:08 +00:00
|
|
|
out vec4 vPosition;
|
|
|
|
out vec2 vTexCoord;
|
|
|
|
flat out int vValid;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2020-10-19 09:02:40 +00:00
|
|
|
vTexCoord = vec2(gl_InstanceID % uFrameSize.x, gl_InstanceID / uFrameSize.x) / uDepthFrameSize;
|
2020-10-18 10:22:08 +00:00
|
|
|
|
2020-10-19 18:25:24 +00:00
|
|
|
vValid = 1;
|
2020-10-18 10:22:08 +00:00
|
|
|
|
2020-10-19 18:25:24 +00:00
|
|
|
// vValid = (depth != 0 && ray.x != 0 && ray.y != 0) ? 1 : 0;
|
2020-10-18 10:22:08 +00:00
|
|
|
|
|
|
|
vec4 posWorld = vec4(1);
|
2020-10-19 18:25:24 +00:00
|
|
|
posWorld = texture2D(u_particle, vTexCoord);
|
2020-10-18 10:22:08 +00:00
|
|
|
|
2020-10-19 18:25:24 +00:00
|
|
|
// posWorld.xyz *= 65535;
|
|
|
|
// // posWorld.xy = vTexCoord * 10000;
|
|
|
|
// // posWorld.xy = posWorld.xz * 0.1;
|
|
|
|
// // posWorld.z = 10;
|
|
|
|
// vValid = posWorld.w > 0.0 ? 1 : 0;
|
|
|
|
|
|
|
|
// posWorld.w = 1;
|
2020-10-19 14:14:53 +00:00
|
|
|
|
2020-10-18 10:22:08 +00:00
|
|
|
// Flip X as OpenGL and K4A have different conventions on which direction is positive.
|
2020-10-19 18:25:24 +00:00
|
|
|
// posWorld.x *= -1;
|
2020-10-18 10:22:08 +00:00
|
|
|
|
|
|
|
vPosition = modelViewMatrix * posWorld;
|
|
|
|
}
|