1 package org.simantics.g3d.jme.shape;
\r
3 import javax.vecmath.Vector3d;
\r
5 import com.jme3.app.Application;
\r
6 import com.jme3.material.Material;
\r
7 import com.jme3.math.ColorRGBA;
\r
8 import com.jme3.math.Vector3f;
\r
9 import com.jme3.scene.Geometry;
\r
10 import com.jme3.scene.Mesh;
\r
11 import com.jme3.scene.Node;
\r
12 import com.jme3.scene.debug.Arrow;
\r
14 public class DualHeadArrowActor extends Node {
\r
18 public DualHeadArrowActor(Application app, String name, Vector3d v) {
\r
20 Vector3f vec = new Vector3f((float)(v.x*0.5), (float)(v.y*0.5), (float)(v.z*0.5));
\r
21 Vector3f vecN = new Vector3f(vec);
\r
23 putArrow(vec, vec, ColorRGBA.Red);
\r
24 putArrow(vec, vecN, ColorRGBA.Red);
\r
28 public Geometry putShape(Mesh shape, ColorRGBA color){
\r
29 Geometry g = new Geometry("shape", shape);
\r
30 Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
\r
31 mat.getAdditionalRenderState().setWireframe(true);
\r
32 mat.setColor("Color", color);
\r
34 this.attachChild(g);
\r
38 public void putArrow(Vector3f pos, Vector3f dir, ColorRGBA color){
\r
39 Arrow arrow = new Arrow(dir);
\r
40 arrow.setLineWidth(4); // make arrow thicker
\r
41 putShape(arrow, color).setLocalTranslation(pos);
\r