]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.g3d/scl/G3D/Scenegraph/G3DNode.scl
Further refactoring of SCL interfaces
[simantics/3d.git] / org.simantics.g3d / scl / G3D / Scenegraph / G3DNode.scl
index 14b362f826adc88bc325c588b8d2e26f25dbcc26..658eb9c5f4e7e7d60a3ef91ebbb2cc5ff3f1271b 100644 (file)
@@ -1,17 +1,57 @@
+import "JavaBuiltin" as Java
+
 import "G3D/Math/Vector3d"
 import "G3D/Math/Quat4d"
 
-importJava "org.simantics.g3d.scenegraph.G3DNode" where
+include "./Node"
+
+importJava "org.simantics.g3d.scenegraph.IG3DNode" where
   data G3DNode
   
-  getOrientation :: G3DNode -> Quat4d
-  getPosition :: G3DNode -> Vector3d
+  @JavaName getOrientation
+  getOrientation' :: G3DNode -> Quat4d
+  @JavaName getPosition
+  getPosition' :: G3DNode -> Vector3d
+  
+  @JavaName setOrientation
+  setOrientation' :: G3DNode -> Quat4d -> ()
+  @JavaName setPosition
+  setPosition' :: G3DNode -> Vector3d -> ()
+  
+  @JavaName getWorldOrientation
+  getWorldOrientation' :: G3DNode -> Quat4d
+  @JavaName getWorldPosition
+  getWorldPosition' :: G3DNode -> Vector3d
   
-  setOrientation :: G3DNode -> Quat4d -> ()
-  setPosition :: G3DNode -> Vector3d -> ()
+  @JavaName setWorldOrientation
+  setWorldOrientation' :: G3DNode -> Quat4d -> ()
+  @JavaName setWorldPosition
+  setWorldPosition' :: G3DNode -> Vector3d -> ()
+
+class G3DNodeClass a where
+  asG3DNode :: a -> G3DNode
+  asG3DNode = Java.unsafeCoerce
+
+  getOrientation :: a -> Quat4d
+  getOrientation c = getOrientation' (asG3DNode c)
+  getPosition :: a -> Vector3d
+  getPosition c = getPosition' (asG3DNode c)
   
-  getWorldOrientation :: G3DNode -> Quat4d
-  getWorldPosition :: G3DNode -> Vector3d
+  setOrientation :: a -> Quat4d -> ()
+  setOrientation c = setOrientation' (asG3DNode c)
+  setPosition :: a -> Vector3d -> ()
+  setPosition c = setPosition' (asG3DNode c)
   
-  setWorldOrientation :: G3DNode -> Quat4d -> ()
-  setWorldPosition :: G3DNode -> Vector3d -> ()
\ No newline at end of file
+  getWorldOrientation :: a -> Quat4d
+  getWorldOrientation c = getWorldOrientation' (asG3DNode c)
+  getWorldPosition :: a -> Vector3d
+  getWorldPosition c = getWorldPosition' (asG3DNode c)
+  
+  setWorldOrientation :: a -> Quat4d -> ()
+  setWorldOrientation c = setWorldOrientation' (asG3DNode c)
+  setWorldPosition :: a -> Vector3d -> ()
+  setWorldPosition c = setWorldPosition' (asG3DNode c)
+
+instance NodeClass G3DNode
+instance G3DNodeClass G3DNode where
+  asG3DNode = id