/******************************************************************************* * Copyright (c) 2012, 2013 Association for Decentralized Information Management in * Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ 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); } }