reso
This commit is contained in:
parent
8eadc00377
commit
fe9c40f859
5 changed files with 82 additions and 44 deletions
|
@ -1,7 +1,8 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<ZONE_B>
|
<ZONE_B>
|
||||||
<XY>61.2245, -12.2449</XY>
|
<XY>61.2245, 0</XY>
|
||||||
<scale>1.869</scale>
|
<scale>1.7965</scale>
|
||||||
<device>video1</device>
|
<device>video3</device>
|
||||||
<thermo_delay>7</thermo_delay>
|
<thermo_delay>7</thermo_delay>
|
||||||
|
<blend_add>1</blend_add>
|
||||||
</ZONE_B>
|
</ZONE_B>
|
||||||
|
|
|
@ -113,7 +113,7 @@ void main()
|
||||||
float rate = 1-smoothstep(D - d, D + d, length(vPos.x + uBetween.x) + n);
|
float rate = 1-smoothstep(D - d, D + d, length(vPos.x + uBetween.x) + n);
|
||||||
rate *= uAreThereTwoPeopleTween;
|
rate *= uAreThereTwoPeopleTween;
|
||||||
vec3 remapedColor = mix(remapedColorC, remapedColorW, rate);
|
vec3 remapedColor = mix(remapedColorC, remapedColorW, rate);
|
||||||
float alpha = max(0, 1 - pow(vAge,4)) * 1;
|
float alpha = max(0, 1 - pow(vAge,4)) * .3;
|
||||||
|
|
||||||
// if(vTemperature < 0.5) {
|
// if(vTemperature < 0.5) {
|
||||||
// alpha *= vTemperature * 2;
|
// alpha *= vTemperature * 2;
|
||||||
|
|
|
@ -116,21 +116,31 @@ void main()
|
||||||
float thermo = texture2D(u_v4l2cam, texCoordVarying.st/fraction).r;
|
float thermo = texture2D(u_v4l2cam, texCoordVarying.st/fraction).r;
|
||||||
|
|
||||||
vec2 subPix = mod(texCoordVarying.st / fraction, 1.0);
|
vec2 subPix = mod(texCoordVarying.st / fraction, 1.0);
|
||||||
float depth0 = texture(u_depth, texCoordVarying.st/fraction - subPix).x;
|
vec2 basePix = texCoordVarying.st/fraction - subPix;
|
||||||
float depth1 = texture(u_depth, texCoordVarying.st/fraction - subPix + vec2(1, 1)).x;
|
float depth00 = texture(u_depth, basePix + vec2(0, 0)).x;
|
||||||
vec4 ray0 = texture(u_world, texCoordVarying.st/fraction - subPix);
|
float depth01 = texture(u_depth, basePix + vec2(0, 1)).x;
|
||||||
vec4 ray1 = texture(u_world, texCoordVarying.st/fraction - subPix + vec2(1, 1));
|
float depth10 = texture(u_depth, basePix + vec2(1, 0)).x;
|
||||||
|
float depth11 = texture(u_depth, basePix + vec2(1, 1)).x;
|
||||||
|
vec4 ray00 = texture(u_world, basePix + vec2(0, 0));
|
||||||
|
vec4 ray01 = texture(u_world, basePix + vec2(0, 1));
|
||||||
|
vec4 ray10 = texture(u_world, basePix + vec2(1, 0));
|
||||||
|
vec4 ray11 = texture(u_world, basePix + vec2(1, 1));
|
||||||
|
|
||||||
float depth = mix(depth0, depth1, length(subPix));
|
float depth0 = mix(depth00, depth10, subPix.x);
|
||||||
vec4 ray = mix(ray0, ray1, length(subPix));
|
float depth1 = mix(depth01, depth11, subPix.x);
|
||||||
|
vec4 ray0 = mix(ray00, ray10, subPix.x);
|
||||||
|
vec4 ray1 = mix(ray01, ray11, subPix.x);
|
||||||
|
|
||||||
float vValid = (depth0 != 0 && depth1 != 0 && ray.x != 0 && ray.y != 0) ? 1 : 0;
|
float depth = mix(depth0, depth1, subPix.y);
|
||||||
|
vec4 ray = mix(ray0, ray1, subPix.y);
|
||||||
|
|
||||||
|
float vValid = (depth00 != 0 && depth01 != 0 && depth10 != 0 && depth11 != 0 && ray.x != 0 && ray.y != 0) ? 1 : 0;
|
||||||
|
|
||||||
vec4 posWorld = vec4(1);
|
vec4 posWorld = vec4(1);
|
||||||
posWorld.z = -depth * 65535.0; // Remap to float range.
|
posWorld.z = -depth * 65535.0; // Remap to float range.
|
||||||
posWorld.x = ray.x * posWorld.z;
|
posWorld.x = ray.x * posWorld.z;
|
||||||
posWorld.y = ray.y * posWorld.z;
|
posWorld.y = ray.y * posWorld.z;
|
||||||
posWorld.xyz += random3(posWorld.xyz) * 2;
|
// posWorld.xyz += random3(posWorld.xyz) * 2;
|
||||||
|
|
||||||
float age = misc.y;
|
float age = misc.y;
|
||||||
if(age > 1) { // reached target
|
if(age > 1) { // reached target
|
||||||
|
@ -146,31 +156,40 @@ void main()
|
||||||
target.xyz = pos;
|
target.xyz = pos;
|
||||||
}
|
}
|
||||||
else if (target.w > 0) { // targeted
|
else if (target.w > 0) { // targeted
|
||||||
age += 10.01;
|
age += 0.002;
|
||||||
thermo = misc.x;
|
thermo = misc.x;
|
||||||
}
|
}
|
||||||
else { // wandering
|
else { // wandering
|
||||||
age += 10.02;
|
age += 0.02;
|
||||||
// age += 0.01;
|
|
||||||
thermo = misc.x;
|
thermo = misc.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(vValid == 1 && target.w > 0 && length(target.xy - pos.xy) < 100) { // arrived
|
if(vValid == 1 && target.w > 0 && length(target.xy - pos.xy) < 100) { // arrived
|
||||||
// age += 0.03;
|
age += 0.03;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// wandering
|
// wandering
|
||||||
vec3 force = vec3(0,0,0);
|
vec3 force = vec3(0,0,0);
|
||||||
float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.01));
|
if(vValid == 1 && target.w == 0) {
|
||||||
float phi = 3.1415 * simplex3d_fractal(pos.xyz * 0.02);
|
float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.001));
|
||||||
force.x += cos(th) * cos(phi);
|
float phi = 3.1415 * simplex3d_fractal(pos.xyz * 0.002);
|
||||||
force.y += sin(th) * cos(phi);
|
force.x += cos(th) * cos(phi);
|
||||||
force.z += sin(phi);
|
force.y += sin(th) * cos(phi);
|
||||||
force *= 100;
|
force.z += sin(phi);
|
||||||
|
force *= 100;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.01));
|
||||||
|
float phi = 3.1415 * simplex3d_fractal(pos.xyz * 0.02);
|
||||||
|
force.x += cos(th) * cos(phi);
|
||||||
|
force.y += sin(th) * cos(phi);
|
||||||
|
force.z += sin(phi);
|
||||||
|
force *= 100;
|
||||||
|
}
|
||||||
|
|
||||||
if(age < 0.001) { // targetting
|
if(age < 0.001) { // targetting
|
||||||
target.w = 0;
|
target.w = 0;
|
||||||
if(random3(pos).x > pow(length(texCoordVarying.st/fraction - uHottest0.st)/5,16*16)+0) {
|
if(random3(pos).x > 0.5*pow(length(texCoordVarying.st/fraction - uHottest0.st)/5,1)) {
|
||||||
vec2 h = uHottest1.st;
|
vec2 h = uHottest1.st;
|
||||||
vec4 hray = texture(u_world, h);
|
vec4 hray = texture(u_world, h);
|
||||||
float hdepth = -depth * 65535.0;
|
float hdepth = -depth * 65535.0;
|
||||||
|
@ -184,7 +203,7 @@ void main()
|
||||||
// target.xyz = H + random3(pos);
|
// target.xyz = H + random3(pos);
|
||||||
// target.w = 1;
|
// target.w = 1;
|
||||||
}
|
}
|
||||||
else if(random3(pos).x > pow(length(texCoordVarying.st/fraction - uHottest1.st)/5,16*16)+0) {
|
else if(random3(pos).x > 0.5*pow(length(texCoordVarying.st/fraction - uHottest1.st)/5,1)) {
|
||||||
vec2 h = uHottest0.st;
|
vec2 h = uHottest0.st;
|
||||||
vec4 hray = texture(u_world, h);
|
vec4 hray = texture(u_world, h);
|
||||||
float hdepth = -depth * 65535.0;
|
float hdepth = -depth * 65535.0;
|
||||||
|
|
|
@ -15,6 +15,7 @@ int main( ){
|
||||||
#else
|
#else
|
||||||
ofGLWindowSettings settings;
|
ofGLWindowSettings settings;
|
||||||
settings.setGLVersion(3, 2); // Programmable pipeline
|
settings.setGLVersion(3, 2); // Programmable pipeline
|
||||||
|
settings.setSize(1920, 1200);
|
||||||
#endif
|
#endif
|
||||||
ofCreateWindow(settings);
|
ofCreateWindow(settings);
|
||||||
ofRunApp(new ofApp());
|
ofRunApp(new ofApp());
|
||||||
|
|
|
@ -138,8 +138,8 @@ 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", {0, 0}, {-500, -1000}, {500, 500})); // should be false
|
debugGui.add(dummyXY.setup("XY", {0, 0}, {-500, -500}, {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);
|
||||||
}
|
}
|
||||||
|
@ -233,26 +233,35 @@ void ofApp::updateThermal()
|
||||||
std::sort(hotspots.at(i).begin(), hotspots.at(i).end(), compareZThermal);
|
std::sort(hotspots.at(i).begin(), hotspots.at(i).end(), compareZThermal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hotspots.size() > 0 && hotspots.at(0).size() > 0)
|
if (dummyMode == false)
|
||||||
{
|
{
|
||||||
hotspot0 = hotspots.at(0).at(0);
|
if (hotspots.size() > 0 && hotspots.at(0).size() > 0)
|
||||||
}
|
{
|
||||||
if (hotspots.size() > 1 && hotspots.at(1).size() > 0)
|
hotspot0 = hotspots.at(0).at(0);
|
||||||
{
|
}
|
||||||
hotspot1 = hotspots.at(1).at(0);
|
if (hotspots.size() > 1 && hotspots.at(1).size() > 0)
|
||||||
areThereTwoPeople = true;
|
{
|
||||||
areThereTwoPeopleTween = ofClamp(areThereTwoPeopleTween + 0.02, 0, 1);
|
hotspot1 = hotspots.at(1).at(0);
|
||||||
}
|
areThereTwoPeople = true;
|
||||||
else if (dummyMode == true && (hotspots.size() > 0 && hotspots.at(0).size() > 1))
|
areThereTwoPeopleTween = ofClamp(areThereTwoPeopleTween + 0.02, 0, 1);
|
||||||
{
|
}
|
||||||
hotspot1 = hotspots.at(0).at(1);
|
else
|
||||||
areThereTwoPeople = true;
|
{
|
||||||
areThereTwoPeopleTween = ofClamp(areThereTwoPeopleTween + 0.02, 0, 1);
|
areThereTwoPeople = false;
|
||||||
|
areThereTwoPeopleTween = ofClamp(areThereTwoPeopleTween - 0.02, 0, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
areThereTwoPeople = false;
|
if (hotspots.size() > 0 && hotspots.at(0).size() > 0)
|
||||||
areThereTwoPeopleTween = ofClamp(areThereTwoPeopleTween - 0.02, 0, 1);
|
{
|
||||||
|
hotspot0 = hotspots.at(0).at(0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
hotspot1 = ofVec3f(dummyXY->x + 500, dummyXY->y + 500, 0);
|
||||||
|
areThereTwoPeople = true;
|
||||||
|
areThereTwoPeopleTween = ofClamp(areThereTwoPeopleTween + 0.02, 0, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hotspot3d0 = getDepthAt(hotspot0.x, hotspot0.y);
|
hotspot3d0 = getDepthAt(hotspot0.x, hotspot0.y);
|
||||||
|
@ -373,6 +382,14 @@ void ofApp::draw()
|
||||||
|
|
||||||
void ofApp::keyPressed(int key)
|
void ofApp::keyPressed(int key)
|
||||||
{
|
{
|
||||||
|
if (key == 'f')
|
||||||
|
{
|
||||||
|
ofSetFullscreen(true);
|
||||||
|
}
|
||||||
|
if (key == 'g')
|
||||||
|
{
|
||||||
|
ofSetFullscreen(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ofApp::keyReleased(int key)
|
void ofApp::keyReleased(int key)
|
||||||
|
|
Loading…
Reference in a new issue