tweening one/two people but not with 3 :(

This commit is contained in:
micuat 2020-10-31 12:31:05 +01:00
parent 3ad04282f0
commit 5ac2dfa655
5 changed files with 26 additions and 6 deletions

View file

@ -6,6 +6,8 @@
"fstream": "cpp",
"deque": "cpp",
"string": "cpp",
"vector": "cpp"
"vector": "cpp",
"array": "cpp",
"string_view": "cpp"
}
}

View file

@ -2,6 +2,6 @@
<ZONE_B>
<XY>61.2245, -12.2449</XY>
<scale>1.869</scale>
<device>video3</device>
<device>video1</device>
<thermo_delay>7</thermo_delay>
</ZONE_B>

View file

@ -10,6 +10,8 @@ uniform sampler2DRect warm2;
uniform sampler2DRect cold1;
uniform sampler2DRect cold2;
uniform float uAreThereTwoPeopleTween;
uniform vec3 uHottest0;
uniform vec3 uHottest1;
uniform vec3 uHottest3d0;
@ -104,8 +106,9 @@ void main()
vec3 remapedColorC = texture(cold2, palette).xyz;
float d = 50;
float D = 600;
float rate = smoothstep(D - d, D + d, length(vPos.x + uBetween.x) + simplex3d(vPos * vec3(0.001, 0.001, 0.1)) * 100);
vec3 remapedColor = mix(remapedColorW, remapedColorC, rate);
float rate = 1-smoothstep(D - d, D + d, length(vPos.x + uBetween.x) + simplex3d(vPos * vec3(0.001, 0.001, 0.1)) * 100);
rate *= uAreThereTwoPeopleTween;
vec3 remapedColor = mix(remapedColorC, remapedColorW, rate);
float alpha = max(0, 1 - pow(vAge,4));
vec4 color = vec4(remapedColor, alpha);

View file

@ -64,6 +64,9 @@ void ofApp::setupThermal()
v4l2Pixels.setColor(j, i, 0);
}
}
areThereTwoPeople = false;
areThereTwoPeopleTween = 0;
}
void ofApp::setupParticles()
@ -236,10 +239,18 @@ void ofApp::updateThermal()
if (hotspots.size() > 1 && hotspots.at(1).size() > 0)
{
hotspot1 = hotspots.at(1).at(0);
areThereTwoPeople = true;
areThereTwoPeopleTween = ofClamp(areThereTwoPeopleTween + 0.02, 0, 1);
}
else if (hotspots.size() > 0 && hotspots.at(0).size() > 1)
else if (dummyMode == true && (hotspots.size() > 0 && hotspots.at(0).size() > 1))
{
hotspot1 = hotspots.at(0).at(1);
areThereTwoPeople = true;
areThereTwoPeopleTween = ofClamp(areThereTwoPeopleTween + 0.02, 0, 1);
}
else {
areThereTwoPeople = false;
areThereTwoPeopleTween = ofClamp(areThereTwoPeopleTween - 0.02, 0, 1);
}
hotspot3d0 = getDepthAt(hotspot0.x, hotspot0.y);
@ -264,7 +275,7 @@ void ofApp::update()
}
else
{
uBetween = ofVec3f(10000000, 0, 0);
// uBetween = ofVec3f(10000000, 0, 0);
}
}
else
@ -293,6 +304,7 @@ void ofApp::onParticlesUpdate(ofxShader &shader)
shader.setUniform3f("uHottest1", hotspot1);
shader.setUniform3f("uHottest3d0", hotspot3d0);
shader.setUniform3f("uHottest3d1", hotspot3d1);
shader.setUniform1f("uAreThereTwoPeopleTween", areThereTwoPeopleTween);
}
void ofApp::onParticlesDraw(ofxShader &shader)
@ -302,6 +314,7 @@ void ofApp::onParticlesDraw(ofxShader &shader)
shader.setUniform3f("uHottest3d0", hotspot3d0);
shader.setUniform3f("uHottest3d1", hotspot3d1);
shader.setUniform3f("uBetween", uBetween);
shader.setUniform1f("uAreThereTwoPeopleTween", areThereTwoPeopleTween);
}
void ofApp::drawMain()

View file

@ -65,6 +65,8 @@ private:
ofVec3f hotspot0, hotspot1;
ofVec3f hotspot3d0, hotspot3d1;
ofVec3f uBetween;
bool areThereTwoPeople;
float areThereTwoPeopleTween;
ofxVec2Slider registrationXY;
ofxFloatSlider registrationScale;