示例#1
0
文件: Grid.java 项目: nasa/DERT
  /**
   * Constructor
   *
   * @param state
   */
  public Grid(GridState state) {
    super(state.name);
    this.state = state;
    this.cellSize = state.size;
    this.color = state.color;
    this.lineWidth = state.lineWidth;
    offset = new Vector3();
    setLocation(state.location, false);

    lattice = new HiddenLine("_lattice", IndexMode.Lines);
    SpatialUtil.setPickHost(lattice, this);
    lattice.setColor(color);
    lattice.setModelBound(new BoundingBox());

    MaterialState ms = new MaterialState();
    ms.setColorMaterial(ColorMaterial.Emissive);
    ms.setColorMaterialFace(MaterialState.MaterialFace.FrontAndBack);
    ms.setEnabled(true);
    text = new Node("_text");
    text.getSceneHints().setLightCombineMode(LightCombineMode.Off);
    text.getSceneHints().setPickingHint(PickingHint.Pickable, false);
    text.setRenderState(ms);
    setLabelVisible(state.labelVisible);

    attachChild(lattice);
    attachChild(text);

    setVisible(state.visible);
    setPinned(state.pinned);

    state.setMapElement(this);
  }
示例#2
0
 /**
  * Set the color
  *
  * @param color
  */
 public void setColor(ReadOnlyColorRGBA color) {
   this.color.set(color);
   MaterialState ms = new MaterialState();
   this.color.setAlpha(0.3f);
   ms.setDiffuse(MaterialState.MaterialFace.FrontAndBack, this.color);
   ms.setAmbient(MaterialState.MaterialFace.FrontAndBack, ColorRGBA.BLACK);
   ms.setEmissive(MaterialState.MaterialFace.FrontAndBack, this.color);
   ms.setEnabled(true);
   setRenderState(ms);
 }
示例#3
0
 /**
  * Constructor
  *
  * @param color
  */
 public SimpleCrosshair(ReadOnlyColorRGBA color) {
   super("Crosshair");
   ReadOnlyColorRGBA[] crosshairColor = {color, color, color, color};
   getMeshData().setIndexMode(IndexMode.Lines);
   getMeshData().setVertexBuffer(BufferUtils.createFloatBuffer(crosshairVertex));
   FloatBuffer colorBuffer = BufferUtils.createFloatBuffer(crosshairColor);
   colorBuffer.rewind();
   getMeshData().setColorBuffer(colorBuffer);
   getMeshData().setIndexBuffer(BufferUtils.createIntBuffer(crosshairIndex));
   getMeshData().getIndexBuffer().limit(4);
   getMeshData().getIndexBuffer().rewind();
   getSceneHints().setAllPickingHints(false);
   setModelBound(new BoundingBox());
   updateModelBound();
   MaterialState crosshairMaterialState = new MaterialState();
   crosshairMaterialState.setColorMaterial(MaterialState.ColorMaterial.Emissive);
   crosshairMaterialState.setEnabled(true);
   getSceneHints().setLightCombineMode(LightCombineMode.Off);
   setRenderState(crosshairMaterialState);
   updateGeometricState(0, true);
 }