241
edits
| No edit summary | |||
| Line 87: | Line 87: | ||
| [[File:es.mp4 |600px|thumb|left|Earth, Fire, Water, Air representation Video to reflect theme of Nature|It supposed to be background of the light beams. Also we have definition of Processing to see Video with light beams realtime]]<br> | [[File:es.mp4 |600px|thumb|left|Earth, Fire, Water, Air representation Video to reflect theme of Nature|It supposed to be background of the light beams. Also we have definition of Processing to see Video with light beams realtime]]<br> | ||
| <br> | |||
| import oscP5.*; | import oscP5.*; | ||
| import netP5.*; | import netP5.*; | ||
| Line 98: | Line 102: | ||
| void setup() { | void setup() { | ||
| fullScreen(); | |||
| //size(800, 600); | |||
| oscP5 = new OscP5(this, 1065); | |||
| myRemoteLocation = new NetAddress("141.54.159.160", 1065); // our computer... | |||
| myMovie = new Movie(this, "es.mov"); | |||
| myMovie.loop(); | |||
| } | } | ||
| void draw() { | void draw() { | ||
| // periodically ask the captury server to send us data. | |||
| tint(255); | |||
| image(myMovie, -400, -500); | |||
| if (millis()-lastMillis>5000) { | |||
| // The format is as follows: | |||
| //"/subscribe/<Actor_name>/<skeleton_data_type>/<joint_name>/<data_format>" | |||
| //most of the placeholders can be replaced by a "*" for "everything" | |||
| // unfortunately, if you subscribe to too many things, a bug in the captury will lead to malformed OSC-bundles that in turn crash OSCP5 | |||
| OscMessage myMessage = new OscMessage("/subscribe/*/blender/Head/vector"); // get positions ("vector") of all joints of actor "felix_braun_rot" in mm | |||
| oscP5.send(myMessage, myRemoteLocation); | |||
| } | |||
| for (int i=0; i<joints.size(); i++) { | |||
| //draw everything here | |||
| point(joints.get(i).x/5+width/2, joints.get(i).y/5+height/2); | |||
| } | |||
| joints.clear(); | |||
| } | } | ||
| /* | /* | ||
| strokeWeight(4);    | |||
| // go through list of joints and draw them all | |||
| frameRate(5); | |||
| fill(101, 50); | |||
| stroke(255, 30); | |||
| background(0); | |||
| for (int i=0; i<joints.size(); i++) { | |||
| //draw everything here | |||
| point(joints.get(i).x/5+width/2, joints.get(i).y/5+height/2); | |||
| line(random(600), random(600), joints.get(i).x/5+width/2, joints.get(i).y/5+height/2); | |||
| } | |||
| joints.clear(); | |||
| }*/ | |||
| // Called every time a new frame is available to read | |||
| void movieEvent(Movie m) { | |||
| m.read(); | |||
| } | |||
| /* incoming osc message are forwarded to the oscEvent method. */ | /* incoming osc message are forwarded to the oscEvent method. */ | ||
| void oscEvent(OscMessage theOscMessage) { | void oscEvent(OscMessage theOscMessage) { | ||
| println(theOscMessage); // debug out | |||
| // only use packages that contain position data as three floats | |||
| if (theOscMessage.checkTypetag("fff")) { | |||
| joints.add(new PVector(theOscMessage.get(0).floatValue(), theOscMessage.get(1).floatValue(), theOscMessage.get(2).floatValue())); | |||
| println( theOscMessage.get(0).floatValue()); | |||
| println( theOscMessage.get(1).floatValue()); | |||
| println( theOscMessage.get(2).floatValue()); | |||
|  } | |||
| } | }<br> | ||
edits