]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.g3d/scl/G3D/Scenegraph/G3DNode.scl
Further refactoring of SCL interfaces
[simantics/3d.git] / org.simantics.g3d / scl / G3D / Scenegraph / G3DNode.scl
1 import "JavaBuiltin" as Java
2
3 import "G3D/Math/Vector3d"
4 import "G3D/Math/Quat4d"
5
6 include "./Node"
7
8 importJava "org.simantics.g3d.scenegraph.IG3DNode" where
9   data G3DNode
10   
11   @JavaName getOrientation
12   getOrientation' :: G3DNode -> Quat4d
13   @JavaName getPosition
14   getPosition' :: G3DNode -> Vector3d
15   
16   @JavaName setOrientation
17   setOrientation' :: G3DNode -> Quat4d -> ()
18   @JavaName setPosition
19   setPosition' :: G3DNode -> Vector3d -> ()
20   
21   @JavaName getWorldOrientation
22   getWorldOrientation' :: G3DNode -> Quat4d
23   @JavaName getWorldPosition
24   getWorldPosition' :: G3DNode -> Vector3d
25   
26   @JavaName setWorldOrientation
27   setWorldOrientation' :: G3DNode -> Quat4d -> ()
28   @JavaName setWorldPosition
29   setWorldPosition' :: G3DNode -> Vector3d -> ()
30
31 class G3DNodeClass a where
32   asG3DNode :: a -> G3DNode
33   asG3DNode = Java.unsafeCoerce
34
35   getOrientation :: a -> Quat4d
36   getOrientation c = getOrientation' (asG3DNode c)
37   getPosition :: a -> Vector3d
38   getPosition c = getPosition' (asG3DNode c)
39   
40   setOrientation :: a -> Quat4d -> ()
41   setOrientation c = setOrientation' (asG3DNode c)
42   setPosition :: a -> Vector3d -> ()
43   setPosition c = setPosition' (asG3DNode c)
44   
45   getWorldOrientation :: a -> Quat4d
46   getWorldOrientation c = getWorldOrientation' (asG3DNode c)
47   getWorldPosition :: a -> Vector3d
48   getWorldPosition c = getWorldPosition' (asG3DNode c)
49   
50   setWorldOrientation :: a -> Quat4d -> ()
51   setWorldOrientation c = setWorldOrientation' (asG3DNode c)
52   setWorldPosition :: a -> Vector3d -> ()
53   setWorldPosition c = setWorldPosition' (asG3DNode c)
54
55 instance NodeClass G3DNode
56 instance G3DNodeClass G3DNode where
57   asG3DNode = id