1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
BranchGroup objRoot=new BranchGroup();
TransformGroup TG=new TransformGroup();
TG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
TG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
TransformGroup tg1 = new TransformGroup () ;
tg1.setCapability (TransformGroup.ALLOW_TRANSFORM_WRITE) ;
TG.addChild (tg1) ;
Appearance sphereApp=mkAppWithTexture("bowling.jpg");
Sphere sphere=new Sphere(0.10f,Sphere.GENERATE_TEXTURE_COORDS,sphereApp);
tg1.addChild(sphere);
Alpha rotor1Alpha = new Alpha(-1,500);
Transform3D zAxis = new Transform3D();
zAxis.rotZ( 1.5708f );
RotationInterpolator rotator1 = new RotationInterpolator(rotor1Alpha,tg1,zAxis,0.0f, (float) Math.PI*2.0f);
rotator1.setSchedulingBounds(new BoundingSphere());
tg1.addChild(rotator1);
Transform3D trans = new Transform3D () ;
Alpha transAlpha = new Alpha (-1, 1000) ;
Point3f[] chemin=new Point3f[3];
chemin[0]=new Point3f(0.8f,0.0f,0.0f);
chemin[1]=new Point3f(-0.8f,0.0f,0.0f);
chemin[2]=new Point3f(0.8f,0.0f,0.0f);
float[] timePosition={0.0f,0.50f,1.0f};
PositionPathInterpolator interpol=new PositionPathInterpolator(transAlpha,tg1,trans,timePosition,chemin);
BoundingSphere transBounds=new BoundingSphere();
interpol.setSchedulingBounds(transBounds);
TG.addChild( interpol);
objRoot.addChild(TG); |
Partager