]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/VecmathJmeTools.java
315660e22608e7ed80ba779410302b849bd9e04d
[simantics/3d.git] / org.simantics.proconf.g3d / src / org / simantics / proconf / g3d / base / VecmathJmeTools.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007- VTT Technical Research Centre of Finland.\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.base;\r
12 \r
13 import javax.vecmath.Color4f;\r
14 \r
15 import com.jme.renderer.ColorRGBA;\r
16 \r
17 public class VecmathJmeTools {\r
18         \r
19         public static javax.vecmath.Vector3f get(com.jme.math.Vector3f v) {\r
20                 return new javax.vecmath.Vector3f(v.x,v.y,v.z);\r
21         }\r
22         \r
23         public static javax.vecmath.Vector3d getD(com.jme.math.Vector3f v) {\r
24                 return new javax.vecmath.Vector3d(v.x,v.y,v.z);\r
25         }\r
26         \r
27         public static com.jme.math.Vector3f get(javax.vecmath.Tuple3f v) {\r
28                 return new com.jme.math.Vector3f(v.x,v.y,v.z);\r
29         }\r
30         \r
31         public static com.jme.math.Vector3f get(javax.vecmath.Tuple3d v) {\r
32                 return new com.jme.math.Vector3f((float)v.x,(float)v.y,(float)v.z);\r
33         }\r
34         \r
35         public static com.jme.math.Matrix3f get(javax.vecmath.Matrix3d m) {\r
36                 return new com.jme.math.Matrix3f((float)m.m00,(float)m.m01,(float)m.m02,(float)m.m10,(float)m.m11,(float)m.m12,(float)m.m20,(float)m.m21,(float)m.m22);\r
37         }\r
38         \r
39         public static javax.vecmath.Quat4f get(com.jme.math.Quaternion v) {\r
40                 return new javax.vecmath.Quat4f(v.x,v.y,v.z,v.w);\r
41         }\r
42         \r
43         public static javax.vecmath.Quat4d getD(com.jme.math.Quaternion v) {\r
44                 return new javax.vecmath.Quat4d(v.x,v.y,v.z,v.w);\r
45         }\r
46         \r
47         \r
48         public static com.jme.math.Quaternion get(javax.vecmath.Quat4f v) {\r
49                 return new com.jme.math.Quaternion(v.x,v.y,v.z,v.w);\r
50         }\r
51         \r
52         public static com.jme.math.Quaternion get(javax.vecmath.Quat4d v) {\r
53                 return new com.jme.math.Quaternion((float)v.x,(float)v.y,(float)v.z,(float)v.w);\r
54         }\r
55         \r
56         public static com.jme.math.Quaternion get(javax.vecmath.AxisAngle4f aa) {\r
57                 javax.vecmath.Quat4f v = new javax.vecmath.Quat4f();\r
58                 v.set(aa);\r
59                 return new com.jme.math.Quaternion(v.x,v.y,v.z,v.w);\r
60                 \r
61         }\r
62         \r
63         public static com.jme.math.Quaternion get(javax.vecmath.AxisAngle4d aa) {\r
64                 javax.vecmath.Quat4f v = new javax.vecmath.Quat4f();\r
65                 v.set(aa);\r
66                 return new com.jme.math.Quaternion(v.x,v.y,v.z,v.w);\r
67                 \r
68         }\r
69         \r
70         public static ColorRGBA get(Color4f c) {\r
71                 return new ColorRGBA(c.x,c.y,c.z,c.w);\r
72         }\r
73         \r
74         public static Color4f get(ColorRGBA c) {\r
75                 return new Color4f(c.r,c.g,c.b,c.a);\r
76         }\r
77 \r
78 }\r