realityplayground-of/zoneb/bin/data/shaders/render.vert

52 lines
1.1 KiB
GLSL
Raw Normal View History

2020-10-18 16:52:22 +00:00
#ifdef GL_ES
precision mediump float;
#endif
// 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;
uniform ivec2 uFrameSize;
2020-10-19 09:02:40 +00:00
uniform ivec2 uDepthFrameSize;
2020-10-18 16:52:22 +00:00
uniform vec2 u_resolution;
out vec4 vPosition;
out vec2 vTexCoord;
flat out int vValid;
2020-10-20 09:16:21 +00:00
out float vTemperature;
void main()
{
2020-10-19 09:02:40 +00:00
vTexCoord = vec2(gl_InstanceID % uFrameSize.x, gl_InstanceID / uFrameSize.x) / uDepthFrameSize;
2020-10-19 18:25:24 +00:00
vValid = 1;
2020-10-19 18:25:24 +00:00
// vValid = (depth != 0 && ray.x != 0 && ray.y != 0) ? 1 : 0;
2020-10-20 09:16:21 +00:00
vec4 posWorld = texture2D(u_particle, vTexCoord);
vTemperature = posWorld.w;
posWorld.w = 1;
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
// 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;
vPosition = modelViewMatrix * posWorld;
}