Пример #1
0
  public void prepareCorak(
      String projectPath, CorakLSystem cor, CorakDataObject obj, boolean encloseOBJ) {

    this.projectPath = projectPath;

    // initiate our "turtle" -> Canting
    canting = new Canting(cor, obj);

    // start creating shapes based on Cor
    timer = System.currentTimeMillis();
    canting.generate(encloseOBJ);

    BoundingSphere lightingBounds = new BoundingSphere(new Point3d(0, 0, 0), FARTHEST);
    camLamp = new PointLight();
    camLamp.setCapability(PointLight.ALLOW_POSITION_READ);
    camLamp.setCapability(PointLight.ALLOW_POSITION_WRITE);
    camLamp.setColor(new Color3f(1.0f, 1.0f, 1.0f));
    camLamp.setInfluencingBounds(lightingBounds);

    ambient = new AmbientLight();
    ambient.setColor(new Color3f(1.0f, 1.0f, 1.0f));
    ambient.setInfluencingBounds(lightingBounds);

    canting.getBatikBG().addChild(camLamp);
    canting.getBatikBG().addChild(ambient);

    // attach generated shapes to root TransformGroup
    Enumeration kaintgchildren = kainTG.getAllChildren();
    while (kaintgchildren.hasMoreElements()) {
      Node child = (Node) kaintgchildren.nextElement();
      if (child instanceof Measurer) {
        ((Measurer) child).removeAllChildren();
      } else {
        kainTG.removeChild(child);
      }
    }
    //        canting.getBatikBG().compile();
    kainTG.addChild(canting.getBatikBG());

    timer = System.currentTimeMillis() - timer;
    // System.out.println("Timer= " + timer);

    bs = (BoundingSphere) canting.getBatikBG().getBounds();
  }