/*
* Created on 22.02.2007
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package horcher;
import horcher.visual.AntiAliased;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Vector3d;
import com.sun.j3d.utils.geometry.Primitive;
import com.sun.j3d.utils.geometry.Sphere;
/**
* @author HP_Besitzer
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
public class Ton extends BranchGroup {
private final Vector3d pos;
private Primitive sphere;
public Ton(final Vector3d pos, final float r) {
super();
this.setCapability(BranchGroup.ALLOW_DETACH);
this.pos = pos;
this.sphere = new Sphere(r, new Sphere().getPrimitiveFlags(), 210);
this.sphere.getAppearance().getMaterial().setDiffuseColor(0.9f, 0.1f, 0);
this.sphere.getAppearance().getMaterial().setAmbientColor(0.9f, 0.1f, 0);
this.sphere.getAppearance().getMaterial()
.setSpecularColor(0.9f, 0.8f, 0.7f);
// this.sphere.getAppearance().getLineAttributes().setPatternMask(arg0);
this.sphere = new AntiAliased<Sphere>((Sphere) this.sphere);
// this.sphere.getAppearance().getColoringAttributes().setColor(0.9f, 0.1f,
// 0);
// this.sphere=new Sphere(0.3f,new Sphere().getPrimitiveFlags(),50);
final Transform3D transformSp = new Transform3D();
transformSp.setTranslation(pos);
final TransformGroup trgSP = new TransformGroup(transformSp);
trgSP.addChild(this.sphere);
this.addChild(trgSP);
}
public synchronized Vector3d getPos() {
return this.pos;
}
}