module Graphics.ThreeJs.Objects.Mesh
  (
    ThreeJsMesh,
    mkMesh,
    setMeshRot
  ) where

import Haste.Foreign
import Haste.Prim

type ThreeJsMesh = JSAny

mkMesh :: (ToAny a) => a -> a -> IO (ThreeJsMesh)
mkMesh = ffi $ toJSStr "(function (geometry, material) { return new THREE.Mesh(geometry, material); })"

setMeshRot :: Float -> Float -> Float -> ThreeJsMesh -> IO ()
setMeshRot = ffi $ toJSStr "(function (x, y, z, mesh) { mesh.rotation.x = x; mesh.rotation.y = y; mesh.rotation.z = z; })";
