-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
78 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var socket = io.connect( jQuery.data( $("head")[0], "data").server_url ); | ||
$.timeago.settings.strings.seconds = "%d seconds"; | ||
|
||
// | ||
// DO ACTUAL STARTUP | ||
// | ||
socket.on('connect', function(){}); | ||
|
||
// update depth buffer | ||
var timeSinceUpdateDepth = 0; | ||
socket.on('updateDepth', function(data) { | ||
var imgArray = new Uint8Array(data.buffer); | ||
updateDepth(imgArray); | ||
}); | ||
|
||
// update clients list | ||
var timeSinceUpdateBodies = 0; | ||
socket.on('updateBodies', function(data) { | ||
updateBodies(data); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
var img; | ||
var bodyData; | ||
|
||
function setup() { | ||
createCanvas(512, 424); | ||
img = createImage(512, 424); | ||
} | ||
|
||
function updateDepth(imgArray) { | ||
img.loadPixels(); | ||
for(var x = 0; x < 512; x++) { | ||
for(var y = 0; y < 424; y++) { | ||
var avg = imgArray[y*512 + x]; | ||
img.set(x, y, [avg, avg, avg, 255]); | ||
} | ||
} | ||
img.updatePixels(); | ||
} | ||
|
||
function updateBodies(data) { | ||
bodyData = data; | ||
} | ||
|
||
function drawBodies() { | ||
if (bodyData != undefined) { | ||
noStroke(); | ||
fill(255,50); | ||
ellipseMode(CENTER); | ||
|
||
for (var b in bodyData.bodies) { | ||
if (bodyData.bodyTrackingIds[b] != 0) { | ||
for (var i in bodyData.bodies[b]) { | ||
ellipse(bodyData.bodies[b][i].x * canvas.width/2 + canvas.width/2.0, | ||
(1.0-bodyData.bodies[b][i].y) * canvas.height/2,16,16); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
function draw() { | ||
background(0); | ||
image(img, 0, 0, 512, 424); | ||
drawBodies(); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.