1 /*******************************************************************************
\r
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.g3d.jme.shape;
\r
14 import com.jme3.app.Application;
\r
15 import com.jme3.material.Material;
\r
16 import com.jme3.math.ColorRGBA;
\r
17 import com.jme3.math.Vector3f;
\r
18 import com.jme3.scene.Geometry;
\r
19 import com.jme3.scene.Mesh;
\r
20 import com.jme3.scene.Node;
\r
21 import com.jme3.scene.debug.Arrow;
\r
23 public class AxesActor extends Node {
\r
27 public AxesActor(Application app, double size) {
\r
29 putArrow(Vector3f.ZERO, Vector3f.UNIT_X.mult((float)size), ColorRGBA.Red);
\r
30 putArrow(Vector3f.ZERO, Vector3f.UNIT_Y.mult((float)size), ColorRGBA.Green);
\r
31 putArrow(Vector3f.ZERO, Vector3f.UNIT_Z.mult((float)size), ColorRGBA.Blue);
\r
34 public Geometry putShape(Mesh shape, ColorRGBA color){
\r
35 Geometry g = new Geometry("shape", shape);
\r
36 Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
\r
37 mat.getAdditionalRenderState().setWireframe(true);
\r
38 mat.setColor("Color", color);
\r
40 this.attachChild(g);
\r
44 public void putArrow(Vector3f pos, Vector3f dir, ColorRGBA color){
\r
45 Arrow arrow = new Arrow(dir);
\r
46 arrow.setLineWidth(4); // make arrow thicker
\r
47 putShape(arrow, color).setLocalTranslation(pos);
\r