Example #1
0
 public void previewCreated(PreviewRequest request) {
   if (request.getRequester() == this) {
     final ImageIcon icon = new ImageIcon(request.getImage());
     if (picPreview instanceof JLabel) {
       ((JLabel) picPreview).setIcon(icon);
     }
     if (picPreview instanceof JButton) {
       ((JButton) picPreview).setIcon(icon);
     }
   }
 }
  private void doShowMaterial(Material m) {

    //        geom.setLocalTranslation(-2.5f, -2.5f, 0);
    //        geom.lookAt(new Vector3f(5, 5, 5), Vector3f.UNIT_Y);
    currentGeom.setMaterial(m);
    if (currentGeom.getMaterial() != null) {
      PreviewRequest request = new PreviewRequest(this, currentGeom);
      request.getCameraRequest().setLocation(new Vector3f(0, 0, 7));
      request.getCameraRequest().setLookAt(new Vector3f(0, 0, 0), Vector3f.UNIT_Y);
      SceneApplication.getApplication().createPreview(request);
    }
  }
  public void previewCreated(PreviewRequest request) {
    if (request.getRequester() == this) {
      final ImageIcon icon = new ImageIcon(request.getImage());
      java.awt.EventQueue.invokeLater(
          new Runnable() {

            public void run() {
              previewLabel.setIcon(icon);
            }
          });
    }
  }
Example #4
0
  public void requestPreview(
      String textureName,
      String displayName,
      int width,
      int height,
      JComponent picLabel,
      JLabel infoLabel) {
    TextureKey key = new TextureKey(textureName);
    picPreview = picLabel;
    assetManager.deleteFromCache(key);
    Texture t = assetManager.loadTexture(key);
    Spatial geom = quad;
    if (key.getTextureTypeHint() == Texture.Type.TwoDimensional) {
      material.setTexture("ColorMap", t);
      geom.setMaterial(material);
      if (infoLabel != null) {
        infoLabel.setText(
            " "
                + displayName
                + "    w : "
                + t.getImage().getWidth()
                + "    h : "
                + t.getImage().getHeight());
      }
    } else if (key.getTextureTypeHint() == Texture.Type.ThreeDimensional) {
      geom = quad3D;
      assetManager.deleteFromCache(key);
      key.setTextureTypeHint(Texture.Type.ThreeDimensional);
      t = assetManager.loadTexture(key);
      material3D.setTexture("Texture", t);
      geom.setMaterial(material3D);
      if (infoLabel != null) {
        infoLabel.setText(
            " "
                + displayName
                + " (Texture3D)    w : "
                + t.getImage().getWidth()
                + "    h : "
                + t.getImage().getHeight()
                + "    d : "
                + t.getImage().getDepth());
      }
    } else if (key.getTextureTypeHint() == Texture.Type.CubeMap) {
      assetManager.deleteFromCache(key);
      geom = SkyFactory.createSky(assetManager, textureName, SkyFactory.EnvMapType.CubeMap);
      if (infoLabel != null) {
        infoLabel.setText(
            " "
                + displayName
                + " (CubeMap)    w : "
                + t.getImage().getWidth()
                + "    h : "
                + t.getImage().getHeight());
      }
    }

    PreviewRequest request = new PreviewRequest(this, geom, width, height);
    request.getCameraRequest().setLocation(new Vector3f(0, 0, 5.3f));
    request.getCameraRequest().setLookAt(new Vector3f(0, 0, 0), Vector3f.UNIT_Y.mult(-1));
    SceneApplication.getApplication().createPreview(request);
  }