diff --git a/zoneb/bin/data/shaders/particles/draw.frag b/zoneb/bin/data/shaders/particles/draw.frag index 9caabf1..3cc5e3a 100755 --- a/zoneb/bin/data/shaders/particles/draw.frag +++ b/zoneb/bin/data/shaders/particles/draw.frag @@ -14,6 +14,7 @@ uniform vec3 uHottest0; uniform vec3 uHottest1; uniform vec3 uHottest3d0; uniform vec3 uHottest3d1; +uniform vec3 uBetween; in vec2 texCoordVarying; in vec3 vPos; @@ -102,8 +103,8 @@ void main() vec3 remapedColorW = texture(warm1, palette).xyz; vec3 remapedColorC = texture(cold2, palette).xyz; float d = 50; - float D = 400; - float rate = smoothstep(D - d, D + d, length(vPos.x - uHottest3d1.x) + simplex3d(vPos * vec3(0.001, 0.001, 0.1)) * 100); + 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 alpha = max(0, 1 - pow(vAge,4)); diff --git a/zoneb/src/ofApp.cpp b/zoneb/src/ofApp.cpp index 732befa..68d49ad 100644 --- a/zoneb/src/ofApp.cpp +++ b/zoneb/src/ofApp.cpp @@ -132,7 +132,7 @@ void ofApp::setupGui() debugGui.setup("DEBUG"); debugGui.add(calibMode.setup("calib", 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.setPosition(230, 10); } @@ -228,20 +228,13 @@ void ofApp::updateThermal() { 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); - } - else if (hotspots.size() > 0 && hotspots.at(0).size() > 1) - { - hotspot1 = hotspots.at(0).at(1); - } + hotspot1 = hotspots.at(1).at(0); } - 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); @@ -251,6 +244,29 @@ void ofApp::updateThermal() void ofApp::update() { + if (dummyMode == false) + { + auto &bodySkeletons = kinectDevice.getBodySkeletons(); + std::vector 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(); particles.update(); @@ -280,6 +296,7 @@ void ofApp::onParticlesDraw(ofxShader &shader) shader.setUniform3f("uHottest1", hotspot1); shader.setUniform3f("uHottest3d0", hotspot3d0); shader.setUniform3f("uHottest3d1", hotspot3d1); + shader.setUniform3f("uBetween", uBetween); } void ofApp::drawMain() diff --git a/zoneb/src/ofApp.h b/zoneb/src/ofApp.h index c71f059..2fa5991 100644 --- a/zoneb/src/ofApp.h +++ b/zoneb/src/ofApp.h @@ -62,6 +62,7 @@ private: std::vector> hotspots; ofVec3f hotspot0, hotspot1; ofVec3f hotspot3d0, hotspot3d1; + ofVec3f uBetween; ofxVec2Slider registrationXY; ofxFloatSlider registrationScale;