]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/shapes/AxesShape.java
Moved 3D plug-ins to /3d/branches/dev.
[simantics/3d.git] / org.simantics.proconf.g3d / src / org / simantics / proconf / g3d / shapes / AxesShape.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
3  * All rights reserved. This program and the accompanying materials\r
4  * are made available under the terms of the Eclipse Public License v1.0\r
5  * which accompanies this distribution, and is available at\r
6  * http://www.eclipse.org/legal/epl-v10.html\r
7  *\r
8  * Contributors:\r
9  *     VTT Technical Research Centre of Finland - initial API and implementation\r
10  *******************************************************************************/\r
11 package org.simantics.proconf.g3d.shapes;\r
12 \r
13 import com.jme.renderer.ColorRGBA;\r
14 import com.jme.renderer.Renderer;\r
15 import com.jme.scene.Geometry;\r
16 import com.jme.scene.Line;\r
17 import com.jme.scene.state.MaterialState;\r
18 import com.jme.util.geom.BufferUtils;\r
19 \r
20 public class AxesShape {\r
21     \r
22 \r
23         public static Geometry getShape(Renderer renderer) {\r
24         float[] coords = new float[]{0.f,0.f,0.f,\r
25                           1.f,0.f,0.f,\r
26                           0.f,0.f,0.f,\r
27                           0.f,1.f,0.f,\r
28                           0.f,0.f,0.f,\r
29                           0.f,0.f,1.f};\r
30         float colors[] = new float[]{1.f,0.f,0.f,0.f,\r
31                           1.f,0.f,0.f,0.f,\r
32                           0.f,1.f,0.f,0.f,\r
33                           0.f,1.f,0.f,0.f,\r
34                           0.f,0.f,1.f,0.f,\r
35                           0.f,0.f,1.f,0.f};\r
36         \r
37 \r
38         Line shape = new Line("",BufferUtils.createFloatBuffer(coords),null,BufferUtils.createFloatBuffer(colors),null);\r
39         shape.setMode(Line.SEGMENTS);\r
40         shape.setIsCollidable(false);\r
41         shape.setLineWidth(3.f);\r
42         MaterialState ms = renderer.createMaterialState();\r
43         ms.setColorMaterial(MaterialState.CM_EMISSIVE);\r
44         ms.setEmissive(new ColorRGBA(1.f,1.f,1.f,1.f));\r
45         shape.setRenderState(ms);\r
46         \r
47         return shape;\r
48        \r
49     }\r
50 \r
51 }\r