Exemple #1
0
 public void stateChanged(ChangeEvent e) {
   Object s = e.getSource();
   if (faceReflectionSlider == s) {
     updateFaceReflection();
   } else if (transparencySlider == s) {
     updateTransparency();
   } else if (faceColorChooser.getColorPanel() == s) {
     updateFaceColor();
   }
 }
Exemple #2
0
  @Override
  public void install(Controller c) throws Exception {
    super.install(c);

    // scene
    Scene scene = c.getPlugin(Scene.class);
    scene.getBackdropComponent().addChild(terrain);
    scene.setAutomaticClippingPlanes(false);

    viewPreferences = c.getPlugin(ViewPreferences.class);
    viewPreferences.addColorPickerChangedListener(this);
    faceColorChooser.getColorPanel().setMode(viewPreferences.getColorPickerMode());

    textureInspector.setAppearance(appearance);
    updateFaceColor();
    updateFacesReflecting();
    updateFaceReflection();
    updateTransparencyEnabled();
    updateTransparency();
    VRPanel vp = c.getPlugin(VRPanel.class);
    vp.addComponent(getClass(), shrinkPanel, 1.0, "VR");
  }
Exemple #3
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);
  }