distancinig
This commit is contained in:
parent
9428900252
commit
c8b96e72ba
3 changed files with 33 additions and 14 deletions
|
@ -14,6 +14,7 @@ uniform vec3 uHottest0;
|
||||||
uniform vec3 uHottest1;
|
uniform vec3 uHottest1;
|
||||||
uniform vec3 uHottest3d0;
|
uniform vec3 uHottest3d0;
|
||||||
uniform vec3 uHottest3d1;
|
uniform vec3 uHottest3d1;
|
||||||
|
uniform vec3 uBetween;
|
||||||
|
|
||||||
in vec2 texCoordVarying;
|
in vec2 texCoordVarying;
|
||||||
in vec3 vPos;
|
in vec3 vPos;
|
||||||
|
@ -102,8 +103,8 @@ void main()
|
||||||
vec3 remapedColorW = texture(warm1, palette).xyz;
|
vec3 remapedColorW = texture(warm1, palette).xyz;
|
||||||
vec3 remapedColorC = texture(cold2, palette).xyz;
|
vec3 remapedColorC = texture(cold2, palette).xyz;
|
||||||
float d = 50;
|
float d = 50;
|
||||||
float D = 400;
|
float D = 600;
|
||||||
float rate = smoothstep(D - d, D + d, length(vPos.x - uHottest3d1.x) + simplex3d(vPos * vec3(0.001, 0.001, 0.1)) * 100);
|
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);
|
vec3 remapedColor = mix(remapedColorW, remapedColorC, rate);
|
||||||
float alpha = max(0, 1 - pow(vAge,4));
|
float alpha = max(0, 1 - pow(vAge,4));
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ void ofApp::setupGui()
|
||||||
debugGui.setup("DEBUG");
|
debugGui.setup("DEBUG");
|
||||||
debugGui.add(calibMode.setup("calib", false));
|
debugGui.add(calibMode.setup("calib", false));
|
||||||
debugGui.add(dummyMode.setup("dummy", true)); // should be false
|
debugGui.add(dummyMode.setup("dummy", true)); // should be false
|
||||||
debugGui.add(dummyXY.setup("XY", {256, 256}, {0, 0}, {511, 511})); // should be false
|
debugGui.add(dummyXY.setup("XY", {0, 0}, {-500, -1000}, {500, 500})); // should be false
|
||||||
debugGui.add(debugFps.setup("FPS", "0"));
|
debugGui.add(debugFps.setup("FPS", "0"));
|
||||||
debugGui.setPosition(230, 10);
|
debugGui.setPosition(230, 10);
|
||||||
}
|
}
|
||||||
|
@ -228,20 +228,13 @@ void ofApp::updateThermal()
|
||||||
{
|
{
|
||||||
hotspot0 = hotspots.at(0).at(0);
|
hotspot0 = hotspots.at(0).at(0);
|
||||||
}
|
}
|
||||||
if (dummyMode == false)
|
if (hotspots.size() > 1 && hotspots.at(1).size() > 0)
|
||||||
{
|
{
|
||||||
if (hotspots.size() > 1 && hotspots.at(1).size() > 0)
|
hotspot1 = hotspots.at(1).at(0);
|
||||||
{
|
|
||||||
hotspot1 = hotspots.at(1).at(0);
|
|
||||||
}
|
|
||||||
else if (hotspots.size() > 0 && hotspots.at(0).size() > 1)
|
|
||||||
{
|
|
||||||
hotspot1 = hotspots.at(0).at(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else if (hotspots.size() > 0 && hotspots.at(0).size() > 1)
|
||||||
{
|
{
|
||||||
hotspot1 = ofVec3f(dummyXY);
|
hotspot1 = hotspots.at(0).at(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
hotspot3d0 = getDepthAt(hotspot0.x, hotspot0.y);
|
hotspot3d0 = getDepthAt(hotspot0.x, hotspot0.y);
|
||||||
|
@ -251,6 +244,29 @@ void ofApp::updateThermal()
|
||||||
|
|
||||||
void ofApp::update()
|
void ofApp::update()
|
||||||
{
|
{
|
||||||
|
if (dummyMode == false)
|
||||||
|
{
|
||||||
|
auto &bodySkeletons = kinectDevice.getBodySkeletons();
|
||||||
|
std::vector<ofVec3f> bodies;
|
||||||
|
if (bodySkeletons.size() >= 2)
|
||||||
|
{
|
||||||
|
for (auto &skeleton : bodySkeletons)
|
||||||
|
{
|
||||||
|
auto joint = skeleton.joints[26];
|
||||||
|
bodies.push_back(toGlm(joint.position));
|
||||||
|
}
|
||||||
|
uBetween = bodies.at(0).getInterpolated(bodies.at(1), 0.5f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uBetween = ofVec3f(10000000, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uBetween = ofVec3f(dummyXY->x, 0, dummyXY->y);
|
||||||
|
}
|
||||||
|
|
||||||
updateThermal();
|
updateThermal();
|
||||||
|
|
||||||
particles.update();
|
particles.update();
|
||||||
|
@ -280,6 +296,7 @@ void ofApp::onParticlesDraw(ofxShader &shader)
|
||||||
shader.setUniform3f("uHottest1", hotspot1);
|
shader.setUniform3f("uHottest1", hotspot1);
|
||||||
shader.setUniform3f("uHottest3d0", hotspot3d0);
|
shader.setUniform3f("uHottest3d0", hotspot3d0);
|
||||||
shader.setUniform3f("uHottest3d1", hotspot3d1);
|
shader.setUniform3f("uHottest3d1", hotspot3d1);
|
||||||
|
shader.setUniform3f("uBetween", uBetween);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ofApp::drawMain()
|
void ofApp::drawMain()
|
||||||
|
|
|
@ -62,6 +62,7 @@ private:
|
||||||
std::vector<std::vector<ofVec3f>> hotspots;
|
std::vector<std::vector<ofVec3f>> hotspots;
|
||||||
ofVec3f hotspot0, hotspot1;
|
ofVec3f hotspot0, hotspot1;
|
||||||
ofVec3f hotspot3d0, hotspot3d1;
|
ofVec3f hotspot3d0, hotspot3d1;
|
||||||
|
ofVec3f uBetween;
|
||||||
|
|
||||||
ofxVec2Slider registrationXY;
|
ofxVec2Slider registrationXY;
|
||||||
ofxFloatSlider registrationScale;
|
ofxFloatSlider registrationScale;
|
||||||
|
|
Loading…
Reference in a new issue