Permalink
Browse files

after march 2012 workshop

  • Loading branch information...
1 parent ccaa1ca commit 84e447c63646a76006b1c70f52b733fc6c3c8079 @pixelpusher committed Mar 27, 2012
Showing with 4,446 additions and 57 deletions.
  1. BIN .DS_Store
  2. +53 −0 Examples/AngleBetweenPoints/AngleBetweenPoints.pde
  3. +62 −54 Examples/SkeletonImageShootingExample/SkeletonImageShootingExample.pde
  4. +9 −3 Examples/SkeletonObjectsExample/BoxRenderer.pde
  5. BIN Examples/SkeletonObjectsExample/data/head.stl
  6. +321 −0 Workshop/ArnieVSWoodie/ArnieVSWoodie.pde
  7. +302 −0 Workshop/ArnieVSWoodie/DrawingStuff.pde
  8. +149 −0 Workshop/ArnieVSWoodie/OpenNIEvents.pde
  9. +171 −0 Workshop/ArnieVSWoodie/ParticleBehaviour.pde
  10. +222 −0 Workshop/ArnieVSWoodie/ParticleSwarm.pde
  11. +161 −0 Workshop/ArnieVSWoodie/Skeleton.pde
  12. BIN Workshop/ArnieVSWoodie/data/9FitnessCenter.jpeg
  13. BIN Workshop/ArnieVSWoodie/data/FieryMarioBody.png
  14. BIN Workshop/ArnieVSWoodie/data/FieryMarioHead.png
  15. BIN Workshop/ArnieVSWoodie/data/FieryMarioLeftArm.png
  16. BIN Workshop/ArnieVSWoodie/data/FieryMarioLeftLeg.png
  17. BIN Workshop/ArnieVSWoodie/data/Pills.png
  18. BIN Workshop/ArnieVSWoodie/data/face.png
  19. BIN Workshop/ArnieVSWoodie/data/mario_bg.png
  20. BIN Workshop/ArnieVSWoodie/data/mario_fireball.png
  21. BIN Workshop/ArnieVSWoodie/data/woody.png
  22. +302 −0 Workshop/MantisShootingExample/DrawingStuff.pde
  23. +322 −0 Workshop/MantisShootingExample/MantisShootingExample.pde
  24. +149 −0 Workshop/MantisShootingExample/OpenNIEvents.pde
  25. +171 −0 Workshop/MantisShootingExample/ParticleBehaviour.pde
  26. +222 −0 Workshop/MantisShootingExample/ParticleSwarm.pde
  27. 0 Workshop/MantisShootingExample/ShootingMantis.pde
  28. +161 −0 Workshop/MantisShootingExample/Skeleton.pde
  29. BIN Workshop/MantisShootingExample/data/Cicada.mp3
  30. BIN Workshop/MantisShootingExample/data/FieryMarioBody.png
  31. BIN Workshop/MantisShootingExample/data/FieryMarioHead.png
  32. BIN Workshop/MantisShootingExample/data/FieryMarioLeftArm.png
  33. BIN Workshop/MantisShootingExample/data/FieryMarioLeftLeg.png
  34. BIN Workshop/MantisShootingExample/data/Mantid.jpeg
  35. BIN Workshop/MantisShootingExample/data/angryBird.jpeg
  36. BIN Workshop/MantisShootingExample/data/angryBird.png
  37. BIN Workshop/MantisShootingExample/data/background.jpg
  38. BIN Workshop/MantisShootingExample/data/body.png
  39. BIN Workshop/MantisShootingExample/data/boing.mp3
  40. +300 −0 Workshop/MantisShootingExample/data/cicada.wav
  41. BIN Workshop/MantisShootingExample/data/firing.jpg
  42. BIN Workshop/MantisShootingExample/data/head.png
  43. BIN Workshop/MantisShootingExample/data/lower arm.png
  44. BIN Workshop/MantisShootingExample/data/lower arm.psd
  45. BIN Workshop/MantisShootingExample/data/lower leg.png
  46. BIN Workshop/MantisShootingExample/data/mario_bg.png
  47. BIN Workshop/MantisShootingExample/data/mario_fireball.png
  48. BIN Workshop/MantisShootingExample/data/upper arm.png
  49. BIN Workshop/MantisShootingExample/data/upper leg.png
  50. +302 −0 Workshop/SpidermanPower/DrawingStuff.pde
  51. +149 −0 Workshop/SpidermanPower/OpenNIEvents.pde
  52. +171 −0 Workshop/SpidermanPower/ParticleBehaviour.pde
  53. +222 −0 Workshop/SpidermanPower/ParticleSwarm.pde
  54. +161 −0 Workshop/SpidermanPower/Skeleton.pde
  55. +364 −0 Workshop/SpidermanPower/SpidermanPower.pde
  56. BIN Workshop/SpidermanPower/data/ arm2new.png
  57. BIN Workshop/SpidermanPower/data/arm1.png
  58. BIN Workshop/SpidermanPower/data/arm1new.png
  59. BIN Workshop/SpidermanPower/data/arm2.png
  60. BIN Workshop/SpidermanPower/data/bg copy.jpg
  61. BIN Workshop/SpidermanPower/data/bg.jpg
  62. BIN Workshop/SpidermanPower/data/head.png
  63. BIN Workshop/SpidermanPower/data/head2.png
  64. BIN Workshop/SpidermanPower/data/leg1.png
  65. BIN Workshop/SpidermanPower/data/leg1new.png
  66. BIN Workshop/SpidermanPower/data/leg2.png
  67. BIN Workshop/SpidermanPower/data/leg2new.png
  68. BIN Workshop/SpidermanPower/data/torso.png
  69. BIN Workshop/SpidermanPower/data/torsonew.png
  70. BIN Workshop/SpidermanPower/data/webball.png
  71. BIN Workshop/SpidermanPower/data/webball2.png
View
Binary file not shown.
@@ -0,0 +1,53 @@
+
+
+PVector p1 = new PVector();
+PVector p2 = new PVector();
+
+
+void setup()
+{
+ size(640,480);
+
+ // set point 1 to midway across the screen, at screen depth
+ p1.set( width/2, height/2, 0);
+
+}
+
+
+void draw()
+{
+ smooth();
+ background(0); // clear screen
+
+ // set my 2nd point to be the mouse position
+ p2.set( mouseX, mouseY, 0);
+
+ stroke(255);
+ strokeWeight(4);
+ //line( p1.x, p1.y, p2.x, p2.y);
+
+ //float angle = PVector.angleBetween(p2,p1);
+
+ float angle = atan2(p2.y-p1.y, p2.x-p1.x);
+
+ textSize(36); // 36 pixels
+ text("angle:" + degrees(angle), mouseX,mouseY);
+
+
+ pushMatrix();
+ // rotate the entire screen a certain angle
+ translate(width/2,height/2);
+ rotate( angle);
+
+
+ fill(255,255,0);
+ rect(0,0, 80,60);
+
+ stroke(255,80,255);
+ line(0,0, 200,0);
+
+ popMatrix();
+
+}
+
+
@@ -59,13 +59,13 @@ void setup()
{
size(640, 480, GLConstants.GLGRAPHICS);
-// this next bit of code disables "screen tearing"
+ // this next bit of code disables "screen tearing"
GL gl;
PGraphicsOpenGL pgl = (PGraphicsOpenGL) g;
gl = pgl.beginGL(); // always use the GL object returned by beginGL
gl.setSwapInterval( 1 ); // use value 0 to disable v-sync
pgl.endGL();
-
+
// create fireball particle "swarm"
@@ -100,9 +100,9 @@ void setup()
void draw()
{
-
+
background(0);
-
+
// update the Kinect cam
context.update();
@@ -122,23 +122,28 @@ void draw()
{
// update skeleton joints coordinates
skel.update(context);
-
+
+
+
// Check if hand is straight out from elbow (parallel to floor).
// First get direction of hand relative to elbow
PVector handElbowDir = PVector.sub(skel.rightHandPos, skel.rightElbowPos);
-
+
+ //float angle = atan2(skel.rightHandPos.y-skel.rightElbowPos.y,
+ // skel.rightHandPos.x-skel.rightElbowPos.x);
+
float yangle = atan2(handElbowDir.y, handElbowDir.x);
-
+
// normalize to between 0 and 1
handElbowDir.normalize();
-
+
if ( abs(handElbowDir.y) < handElbowDiffThresh )
{
// hand is pretty much horizontal - shoot some fireballs!
newSwarm( fireballTex, skel.rightHandPos, handElbowDir );
}
-
-
+
+
// these draw based on pixels
renderRectFromVectors(skel.leftShoulderPos, skel.rightShoulderPos, skel.rightHipPos, skel.leftHipPos, 5, 10, bodyTex);
@@ -149,26 +154,23 @@ void draw()
renderRectFromVectors(skel.leftHipPos, skel.leftFootPos, 30, legTex);
renderRectFromVectors(skel.rightHipPos, skel.rightFootPos, 30, legTex, 1);
-
- fill(255,255,0);
- ellipse(skel.rightElbowPos.x, skel.rightElbowPos.y, skel.rightElbowPos.z*80,skel.rightElbowPos.z*80);
- fill(255,0,255);
- ellipse(skel.rightHandPos.x, skel.rightHandPos.y, skel.rightHandPos.z*80,skel.rightHandPos.z*80);
-
-
+
+ fill(255, 255, 0);
+ ellipse(skel.rightElbowPos.x, skel.rightElbowPos.y, skel.rightElbowPos.z*80, skel.rightElbowPos.z*80);
+ fill(255, 0, 255);
+ ellipse(skel.rightHandPos.x, skel.rightHandPos.y, skel.rightHandPos.z*80, skel.rightHandPos.z*80);
+
+
// DEBUGGING
fill(255);
textSize(24);
text("y diff / angle = " + handElbowDir.y + " / " + degrees(yangle), 10, 25*skel.id);
-
-
}
// end of drawing skeleton stuff
}
-
-
+
+
drawSwarms();
-
}
@@ -221,53 +223,60 @@ void keyReleased()
}
+int lastShootTime = 0; // last time we shot a fireball
+int fireBallInterval = 300; // in milliseconds
void newSwarm(GLTexture tex, PVector startPos, PVector direction)
{
- // number of fireballs in this swarm
- int numFireballs = int( random(2, 6) );
+ int timeDiff = millis()-lastShootTime;
+ if (timeDiff > fireBallInterval)
+ {
+ lastShootTime = millis();
- // a bit of randomness to their position
- float w = width/60.0f;
- float h = height/60.0f;
+ // number of fireballs in this swarm
+ int numFireballs = int( random(2, 6) );
- ArrayList<PVector> fireballCoords = new ArrayList<PVector>();
+ // a bit of randomness to their position
+ float w = width/60.0f;
+ float h = height/60.0f;
- // add some coordinates for our fireballs
- for (int i=0; i < numFireballs; i++)
- {
- fireballCoords.add( new PVector( startPos.x + random(-w, w), startPos.y + random(-h, h), startPos.z ) );
- }
+ ArrayList<PVector> fireballCoords = new ArrayList<PVector>();
- ImageParticleSwarm swarm = new ImageParticleSwarm(this, tex);
+ // add some coordinates for our fireballs
+ for (int i=0; i < numFireballs; i++)
+ {
+ fireballCoords.add( new PVector( startPos.x + random(-w, w), startPos.y + random(-h, h), startPos.z ) );
+ }
- if (swarm.makeModel( fireballCoords ))
- {
- swarms.add( swarm );
+ ImageParticleSwarm swarm = new ImageParticleSwarm(this, tex);
+
+ if (swarm.makeModel( fireballCoords ))
+ {
+ swarms.add( swarm );
- // now create object to move this swarm of fireballs
- ParticleMover particleBehaviour = new ParticleMover( fireballCoords.size() );
+ // now create object to move this swarm of fireballs
+ ParticleMover particleBehaviour = new ParticleMover( fireballCoords.size() );
- float vel = random(10, 40);
+ float vel = random(10, 40);
- particleBehaviour.noisiness = 0.3;
+ particleBehaviour.noisiness = 0.3;
- particleBehaviour.setVelocities( PVector.mult(direction, vel ) );
+ particleBehaviour.setVelocities( PVector.mult(direction, vel ) );
- particleMovers.add( particleBehaviour );
-
- // DEBUG:
- //println("*****ADDED NEW SWARM****");
-
- }
+ particleMovers.add( particleBehaviour );
+ // DEBUG:
+ //println("*****ADDED NEW SWARM****");
+ }
- if (swarms.size() > MAX_SWARMS)
- {
- ImageParticleSwarm first = swarms.removeFirst();
- first.destroy();
- particleMovers.removeFirst();
+ if (swarms.size() > MAX_SWARMS)
+ {
+ ImageParticleSwarm first = swarms.removeFirst();
+ first.destroy();
+
+ particleMovers.removeFirst();
+ }
}
}
@@ -296,4 +305,3 @@ void drawSwarms()
renderer.endGL();
}
-
@@ -25,8 +25,13 @@ public class BoxRenderer implements BodyPartRenderer
app = _app;
gfx=new ToxiclibsSupport(app);
mSkeleton = null;
- origMesh =(TriangleMesh)new AABB(new Vec3D(), 1).toMesh();
- origMesh.transform(new Matrix4x4().translateSelf(0, 0, 1));
+ //origMesh =(TriangleMesh)new AABB(new Vec3D(), 1).toMesh();
+
+ // load a mesh from a 3D STL file
+ STLReader reader = new STLReader();
+ origMesh = (TriangleMesh) reader.loadBinary(dataPath("head.stl"), TriangleMesh.class);
+ //origMesh.transform(new Matrix4x4().translateSelf(0, 0, 1));
+ origMesh.scale(0.05);
}
public BoxRenderer(PGraphics g)
@@ -107,15 +112,16 @@ public class BoxRenderer implements BodyPartRenderer
// scale from point to point
mesh = origMesh.getScaled(new Vec3D(w, h, h));
-
gfx.translate(p1);
+ gfx.rotate(millis()*0.01f);
if (tex != null)
{
gfx.texturedMesh(mesh, tex, false);
}
else
{
+
gfx.mesh(mesh, false, 10);
}
if (obp.depthDisabled)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit 84e447c

Please sign in to comment.