private void createGUI() {
   panel.setBorder(BorderFactory.createTitledBorder("Terrain Content"));
   sizeSlider.addChangeListener(
       new ChangeListener() {
         public void stateChanged(ChangeEvent e) {
           setContentSize(sizeSlider.getValue() / 100.);
         }
       });
   offsetSlider.addChangeListener(
       new ChangeListener() {
         public void stateChanged(ChangeEvent e) {
           setVerticalOffset(offsetSlider.getValue() / 100.);
         }
       });
   panel.setLayout(new GridLayout(2, 1));
   sizeSlider.setMinimumSize(new Dimension(250, 35));
   sizeSlider.setBorder(
       BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Size"));
   offsetSlider.setMinimumSize(new Dimension(250, 35));
   offsetSlider.setBorder(
       BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Offset"));
   panel.add(sizeSlider);
   panel.add(offsetSlider);
 }
 public void setContentSize(double contentSize) {
   this.contentSize = contentSize;
   sizeSlider.setValue((int) (contentSize * 100));
   alignContent();
 }
 public void setVerticalOffset(double verticalOffset) {
   this.verticalOffset = verticalOffset;
   offsetSlider.setValue((int) (verticalOffset * 100));
   alignContent();
 }
Ejemplo n.º 4
0
  public Terrain() {
    appearance.setAttribute(CommonAttributes.EDGE_DRAW, false);
    appearance.setAttribute(CommonAttributes.VERTEX_DRAW, false);
    terrain.setAppearance(appearance);

    MatrixBuilder.euclidean().rotateX(Math.PI / 2).assignTo(plane);
    plane.setGeometry(bigMesh(50, 50, 2000));
    plane.getGeometry().setGeometryAttributes("infinite plane", Boolean.TRUE);
    PickUtility.assignFaceAABBTrees(plane);
    terrain.addChild(plane);

    textures.put("2 Grid", "textures/grid.jpeg");
    textures.put("3 Black Grid", "textures/gridBlack.jpg");
    textures.put("4 Tiles", "textures/recycfloor1_clean2.png");
    textures.put("5 Rust", "textures/outfactory3.png");
    textures.put("1 None", null);

    shrinkPanel.setLayout(new GridLayout());
    shrinkPanel.setIcon(getPluginInfo().icon);
    shrinkPanel.setShrinked(true);
    shrinkPanel.add(panel);
    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(1, 0, 1, 0);
    c.fill = BOTH;
    c.weightx = 1.0;
    c.weighty = 1.0;
    c.gridwidth = REMAINDER;
    c.anchor = WEST;
    colorPanel.setLayout(new GridBagLayout());
    faceColorChooser.setMinimumSize(new Dimension(10, 230));
    faceColorChooser.setPreferredSize(new Dimension(10, 230));
    colorPanel.add(faceColorChooser, c);
    c.fill = VERTICAL;
    c.weighty = 0.0;
    colorPanel.add(closeButton, c);

    // panel
    panel.setLayout(new MinSizeGridBagLayout());
    c.fill = BOTH;

    visibleCheckBox.setSelected(DEFAULT_TERRAIN_VISIBLE);
    c.weightx = 0.0;
    c.gridwidth = RELATIVE;
    panel.add(visibleCheckBox, c);
    c.weightx = 1.0;
    c.gridwidth = REMAINDER;
    panel.add(faceColorButton, c);

    c.weightx = 0.0;
    c.weighty = 0.0;
    c.gridwidth = RELATIVE;
    panel.add(facesReflecting, c);
    c.weightx = 1.0;
    c.gridwidth = REMAINDER;
    panel.add(faceReflectionSlider, c);

    c.weightx = 0.0;
    c.gridwidth = RELATIVE;
    panel.add(transparency, c);
    c.weightx = 1.0;
    c.gridwidth = REMAINDER;
    panel.add(transparencySlider, c);

    c.weightx = 1.0;
    c.gridwidth = REMAINDER;
    panel.add(reflectScene, c);
    reflectScene.setEnabled(false);
    reflectScene.setToolTipText("Coming soon...");

    textureInspector.setMaximalTextureScale(MAXIMAL_TEXTURE_SCALE);
    textureInspector.setLogarithmicRange(LOGARITHMIC_RANGE);
    textureInspector.setTextureUScale(DEFAULT_TEXTURE_SCALE);
    c.weightx = 1.0;
    c.weighty = 1.0;
    c.gridwidth = REMAINDER;
    textureShrinker.setIcon(ImageHook.getIcon("photo.png"));
    textureShrinker.setShrinked(true);
    textureShrinker.setLayout(new GridLayout());
    textureShrinker.add(textureInspector);
    panel.add(textureShrinker, c);

    closeButton.addActionListener(this);
    visibleCheckBox.addActionListener(this);
    facesReflecting.addActionListener(this);
    transparency.addActionListener(this);
    faceColorButton.addActionListener(this);
    reflectScene.addActionListener(this);
    faceReflectionSlider.addChangeListener(this);
    transparencySlider.addChangeListener(this);
    faceColorChooser.getColorPanel().addChangeListener(this);
  }
Ejemplo n.º 5
0
 public void setTransparency(double d) {
   transparencySlider.setValue((int) (100 * d));
 }
Ejemplo n.º 6
0
 public double getTransparency() {
   return .01 * transparencySlider.getValue();
 }
Ejemplo n.º 7
0
 public void setFaceReflection(double d) {
   faceReflectionSlider.setValue((int) (100 * d));
 }
Ejemplo n.º 8
0
 public double getFaceReflection() {
   return .01 * faceReflectionSlider.getValue();
 }