soundPoint.setLoop(Sound.INFINITE_LOOPS);
soundPoint.setInitialGain(0.6f);
BoundingSphere sbounds = new BoundingSphere (new Point3d(0.0,0.0,0.0),Double.MAX_VALUE);
soundBG.setSchedulingBounds(sbounds);
soundPoint.setSchedulingBounds(sbounds);
//The colours for the Appearance of the bird.
Color3f ambientColourBird = new Color3f(0.0f,0.0f,0.0f);
Color3f emissiveColourBird = new Color3f(0.0f,0.0f,0.0f);
Color3f diffuseColourBird = new Color3f(0.1f,0.1f,0.1f);
Color3f specularColourBird = new Color3f(0.1f,0.1f,0.1f);
float shininessBird = 10.0f;
//The bird's Appearance.
Appearance birdApp = new Appearance();
birdApp.setMaterial(new Material(ambientColourBird,emissiveColourBird,
diffuseColourBird,specularColourBird,shininessBird));
//The wings.
Box wings = new Box(0.03f,0.005f,0.3f,birdApp);
//The transformation group for the bird including the flight and the sound.
TransformGroup tgmBird = new TransformGroup();
tgmBird.addChild(wings);
//The body of the bird.
Box body = new Box(0.1f,0.01f,0.01f,birdApp);
tgmBird.addChild(body);
//The bird's flight.
long flightTime = 10000;
Alpha flightAlpha = new Alpha(-1,Alpha.INCREASING_ENABLE+Alpha.DECREASING_ENABLE,
0,0,flightTime,0,0,flightTime,0,0);
float flightDistance = 9.0f;
PositionInterpolator posIFlight = new PositionInterpolator(flightAlpha,
tgmBird,new Transform3D(),
0.0f,flightDistance);
BoundingSphere bs = new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE);
posIFlight.setSchedulingBounds(bs);
tgmBird.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
tgmBird.addChild(posIFlight);
//Add the PointSound also to the transformation group of the bird.
tgmBird.addChild(soundPoint);
//A transformation group to position the bird including its flight and sound.
Transform3D tfBird = new Transform3D();
tfBird.setTranslation(new Vector3f(-flightDistance/2,1.7f,-5.0f));
TransformGroup tgBird = new TransformGroup(tfBird);
tgBird.addChild(tgmBird);
//Add everything to the scene.
BranchGroup theScene = new BranchGroup();
theScene.addChild(tgBird);
//The bounding region for the background sound.
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE);
//Load the background image.
TextureLoader textureLoad = new TextureLoader("./eas/miscellaneous/java3D/darkclouds.jpg",null);
//Define the loaded image as the background for the scene.
Background bgImage = new Background(textureLoad.getImage());
bgImage.setApplicationBounds(bounds);