package alive;

/**
 * <ALIVE Project>
 * Spheric Actor
 * Default Actor for simple experiments
 * attributes can be mapped into size, color and
 * transparency
 * LSI - POLI - USP
 */

import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.image.TextureLoader;
import com.sun.j3d.utils.geometry.*;

public class Actor_Sphere extends Actor {
  Sphere sph = null;
  int resolution = 26;

  public Actor_Sphere() {
    model = "Actor_Sphere";
    emissiveColor.set(0.0f, 0.0f, 0.5f); // One blue sphere
    build();
  }
  public void createGeometry() {
    sph = new Sphere(1f, Sphere.GENERATE_NORMALS |
                     Sphere.GENERATE_TEXTURE_COORDS, resolution, ap);
    tg.addChild(sph);
  }
  public TransformGroup createSphere(Transform3D t) {
    TransformGroup newTransformGroup = new TransformGroup(t);
    sph = new Sphere(1f, Sphere.GENERATE_NORMALS |
                     Sphere.GENERATE_TEXTURE_COORDS, resolution, ap);
    newTransformGroup.addChild(sph);
    tg.addChild(newTransformGroup);
    return newTransformGroup;
  }
}