X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=org.simantics.g3d.jme%2Fsrc%2Forg%2Fsimantics%2Fg3d%2Fjme%2Fshape%2FAxisActor.java;fp=org.simantics.g3d.jme%2Fsrc%2Forg%2Fsimantics%2Fg3d%2Fjme%2Fshape%2FAxisActor.java;h=c6ddd58568fdd17f0ed49ec6856b5399ac28e897;hb=5b4454ce3dac8d0cf04caaaa696f300c16be99a0;hp=0000000000000000000000000000000000000000;hpb=2e9c37990c979fe7a877a6a9d0de65ee27f3b56f;p=simantics%2F3d.git diff --git a/org.simantics.g3d.jme/src/org/simantics/g3d/jme/shape/AxisActor.java b/org.simantics.g3d.jme/src/org/simantics/g3d/jme/shape/AxisActor.java new file mode 100644 index 00000000..c6ddd585 --- /dev/null +++ b/org.simantics.g3d.jme/src/org/simantics/g3d/jme/shape/AxisActor.java @@ -0,0 +1,41 @@ +package org.simantics.g3d.jme.shape; + +import javax.vecmath.Vector3d; + +import com.jme3.app.Application; +import com.jme3.material.Material; +import com.jme3.math.ColorRGBA; +import com.jme3.math.Vector3f; +import com.jme3.scene.Geometry; +import com.jme3.scene.Mesh; +import com.jme3.scene.Node; +import com.jme3.scene.debug.Arrow; + +public class AxisActor extends Node { + + Application app; + + public AxisActor(Application app, String name, Vector3d v) { + this.app = app; + Vector3f vec = new Vector3f((float)v.x, (float)v.y, (float)v.z); + putArrow(Vector3f.ZERO, vec, ColorRGBA.Red); + + } + + public Geometry putShape(Mesh shape, ColorRGBA color){ + Geometry g = new Geometry("shape", shape); + Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); + mat.getAdditionalRenderState().setWireframe(true); + mat.setColor("Color", color); + g.setMaterial(mat); + this.attachChild(g); + return g; + } + + public void putArrow(Vector3f pos, Vector3f dir, ColorRGBA color){ + Arrow arrow = new Arrow(dir); + arrow.setLineWidth(4); // make arrow thicker + putShape(arrow, color).setLocalTranslation(pos); + } + +}