Package org.pollux3d.menu

Source Code of org.pollux3d.menu.CircleMarker

package org.pollux3d.menu;


import org.pollux3d.core.Pollux;
import com.jme3.material.Material;
import com.jme3.material.RenderState.BlendMode;
import com.jme3.material.RenderState.FaceCullMode;
import com.jme3.math.ColorRGBA;
import com.jme3.renderer.queue.RenderQueue.Bucket;

public class CircleMarker extends FacingGeometry implements Markable {

  public CircleMarker(float radius) {
    super("planet_marker", new Ring(radius*1.5f, radius*0.05f));
    ColorRGBA c = ColorRGBA.White;
    c.a = 0.5f;
    init(radius, c);
  }
 
  public CircleMarker(float radius, float width, ColorRGBA color) {
    super("planet_marker", new Ring(radius, width));
    init(radius, color);
  }
 
  private void init(float radius, ColorRGBA color) {
    //super("planet_marker", new Circle(radius*2));     
    Material mat = new Material(Pollux.get().getAssetManager(), "Common/MatDefs/Misc/ColoredTextured.j3md");
    mat.setColor("Color", color);
    mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
    //mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
    //this.setQueueBucket(Bucket.Transparent);
    this.setMaterial(mat);
    hideMark();
  }

  @Override
  public void hideMark() {
    this.setCullHint(CullHint.Always);
  }

  @Override
  public void showMark() {
    this.setCullHint(CullHint.Never);
  }
}
TOP

Related Classes of org.pollux3d.menu.CircleMarker

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.