fixing thermo mapped pos??

This commit is contained in:
micuat 2020-10-26 12:22:40 +01:00
parent 2dadffb8af
commit 2b6f7059a6
3 changed files with 19 additions and 7 deletions

View file

@ -9,14 +9,23 @@ uniform sampler2DRect imageTexture;
uniform vec3 uHottest0;
uniform vec3 uHottest1;
uniform vec3 uHottest3d0;
uniform vec3 uHottest3d1;
in vec2 texCoordVarying;
in vec3 vPos;
in float vTemperature;
in float vAge;
void main()
{
vec3 remapedColor = texture(imageTexture, vec2(vTemperature*1600, 0.5)).xyz;
float alpha = max(0, 1 - pow(vAge,4));
fragColor = vec4(remapedColor, alpha);
vec3 remapedColor = texture(imageTexture, vec2(vTemperature*1600, 0.5)).xyz;
float alpha = max(0, 1 - pow(vAge,4));
vec4 color = vec4(remapedColor, alpha);
if(length(vPos.x - uHottest3d1.x) < 500) {
color = vec4(0,1,0,1);
}
fragColor = color;
}

View file

@ -7,6 +7,7 @@ in vec4 position;
in vec2 texcoord;
out vec2 texCoordVarying;
out vec3 vPos;
out float vTemperature;
out float vAge;
@ -16,5 +17,6 @@ void main()
vec4 misc = texture(particles2, texCoordVarying);
vTemperature = misc.x;
vAge = misc.y;
gl_Position = modelViewProjectionMatrix * vec4(texture(particles0, texCoordVarying).xyz, 1.0);
vPos = texture(particles0, texCoordVarying).xyz;
gl_Position = modelViewProjectionMatrix * vec4(vPos, 1.0);
}

View file

@ -161,9 +161,10 @@ void ofApp::exit()
ofVec3f ofApp::getDepthAt(int x, int y)
{
auto ray = kinectDevice.getDepthToWorldPix().getColor(x, y);
float depth = kinectDevice.getDepthPix().getColor(x, y).r;
if (depth == 0)
depth = 2000;
auto depthShort = kinectDevice.getDepthPix().getColor(x, y).r;
float depth = -depthShort;
if (depthShort == 0)
depth = -2000;
ofVec3f pos(ray.r * depth, ray.g * depth, depth);
return pos;
}