47 lines
No EOL
1.1 KiB
GLSL
47 lines
No EOL
1.1 KiB
GLSL
#ifdef GL_ES
|
|
precision mediump float;
|
|
#endif
|
|
|
|
// OF built-in attributes.
|
|
|
|
uniform mat4 modelViewMatrix;
|
|
|
|
// Custom attributes.
|
|
|
|
uniform sampler2D uDepthTex; // Sampler for the depth space data
|
|
uniform sampler2D uWorldTex; // Transformation from kinect depth/color space to kinect world space
|
|
uniform sampler2D u_particle;
|
|
|
|
uniform ivec2 uFrameSize;
|
|
uniform ivec2 uDepthFrameSize;
|
|
|
|
uniform vec2 u_resolution;
|
|
|
|
out vec4 vPosition;
|
|
out vec2 vTexCoord;
|
|
flat out int vValid;
|
|
|
|
void main()
|
|
{
|
|
vTexCoord = vec2(gl_InstanceID % uFrameSize.x, gl_InstanceID / uFrameSize.x) / uDepthFrameSize;
|
|
|
|
vValid = 1;
|
|
|
|
// vValid = (depth != 0 && ray.x != 0 && ray.y != 0) ? 1 : 0;
|
|
|
|
vec4 posWorld = vec4(1);
|
|
posWorld = texture2D(u_particle, vTexCoord);
|
|
|
|
// 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;
|
|
|
|
// Flip X as OpenGL and K4A have different conventions on which direction is positive.
|
|
// posWorld.x *= -1;
|
|
|
|
vPosition = modelViewMatrix * posWorld;
|
|
} |