void setup() { size(1024, 768); background(0); setFrameRate(60); // Setup lighting ambientLight(30); light.init(200, 200, 200, 0, 3, 0); // Uncomment this line to see the position of the light light.drawDebug(true); // Init 3d object's properties box.init(50, 25, 75); box.setPosition(width/2.0f, height/2.0f); sphere1.init(30); sphere2.init(60); sphere3.init(100); // Now, we make the spheres children of the box's (scene node) box.addChild( sphere1 ); box.addChild( sphere2 ); box.addChild( sphere3 ); // Translate the sphere (relative to its parent, the box) // This way, when we rotate the box (parent object), the spheres will orbitate around it sphere1.setPosition( 2, 0, 0 ); sphere2.setPosition( 5, 0, 0 ); sphere3.setPosition( 7, 0, 0 ); // Add the second light as child of one of the spheres sphere1.addChild( light ); }
void setup() { // start AudioInputphone mic.startCapturing(); // setup plane and sphere plane.init( 100000 ); plane.setPosition( width/2, height/2 + 500, 0 ); sphere.init( 100 ); sphere.setPosition( width/2, height/2, 0 ); // setup light ambientLight( 20, 20, 20 ); light.init( 0, 0, 0, width/2, height/2, 200 ); }
void setup() { size( 1024, 768 ); // load sound sound.load( "loop.ogg" ); sound.play( true ); // setup plane and sphere plane.init( 100000 ); plane.setPosition( width/2, height/2 + 200, 0 ); sphere.init( 100 ); sphere.setPosition( width/2, height/2, 0 ); // setup light ambientLight( 20, 20, 20 ); light.init( 0, 0, 0, width/2, height/2, 200 ); }
void setup() { size(1024, 768); background(0); enableShadows( STENCIL_MODULATIVE ); applyCoordinateSystemTransform(OPENGL3D); // Setup lighting ambientLight(10); light.init(255, 255, 255, width/2 + 100, height/2 + 100, 100); // Uncomment this line to see the position of the light light.drawDebug(); // Init 3d object's properties box.init(10, 4, 14); box.setPosition(width/2.0f, 100); sphere1.init(6); sphere2.init(12); sphere3.init(20); // Now, we make the spheres children of the box's (scene node) box.addChild( sphere1 ); box.addChild( sphere2 ); box.addChild( sphere3 ); // Translate the sphere (relative to its parent, the box) // This way, when we rotate the box (parent object), the spheres will orbitate around it sphere1.setPosition( 2, -2, 0 ); sphere2.setPosition( 5, -7, 0 ); sphere3.setPosition( 7, -12, 0 ); // Ground ground.init(5000, 25, 5000 ); ground.setPosition( width/2, -200 ); // Camera control enableDefault3DCameraControl(); }