package net.mkonrad.synes.gui.elements.instruments;

import javax.media.j3d.Appearance;
import javax.media.j3d.Material;
import javax.vecmath.Point3f;
import javax.vecmath.Vector3f;

import com.sun.j3d.utils.geometry.Box;
import com.sun.j3d.utils.geometry.Cylinder;
import com.sun.j3d.utils.geometry.Primitive;

import net.mkonrad.synes.data.Beat;
import net.mkonrad.synes.data.SynthObj;
import net.mkonrad.synes.gui.SceneCore;
import net.mkonrad.synes.gui.style.Colors;
import net.mkonrad.synes.util.DbgTools;

public class CylinderShape extends AbstractInstrumentShape
{
  /**
   * How many sides does the cylinder have? Important for child classes as
   * TriangleShape and PentagonShape
   */
  protected int _sides = 15;
  
  public CylinderShape(SynthObj synthData)
  {
    super(synthData);
  }
  
  public CylinderShape(SynthObj synthData, Point3f pos)
  {
    super(synthData);
    
    _synthData = synthData;
    
   initShape(pos); 
  }
  
  protected void initShape(Point3f pos)
  {
    createAppearance();
    createPrimitive();
    
    init();
    initTransform3D(new Vector3f(pos));
    connectSceneGraphElements();
  }

  protected void createPrimitive()
  {
    _primitive = new Cylinder(1.0f, SHAPE_WIDTH, _defaultPrimitiveFlags, _sides, 1, _app);
  }
}
