module Text.GLTF.Loader ( fromByteString, fromFile, module Text.GLTF.Loader.Errors, module Text.GLTF.Loader.Gltf ) where import Text.GLTF.Loader.Adapter import Text.GLTF.Loader.BufferAccessor import Text.GLTF.Loader.Errors import Text.GLTF.Loader.Gltf import Data.Either import Lens.Micro import RIO ( Monad((>>=)), IsString(fromString), String, (<$>), (.), MonadIO(liftIO), MonadUnliftIO, ByteString, FilePath ) import qualified Codec.GlTF as GlTF fromByteString :: MonadUnliftIO io => ByteString -> io (Either Errors Gltf) fromByteString :: ByteString -> io (Either Errors Gltf) fromByteString = Either String GlTF -> io (Either Errors Gltf) forall (io :: * -> *). MonadUnliftIO io => Either String GlTF -> io (Either Errors Gltf) toGltfResult (Either String GlTF -> io (Either Errors Gltf)) -> (ByteString -> Either String GlTF) -> ByteString -> io (Either Errors Gltf) forall b c a. (b -> c) -> (a -> b) -> a -> c . ByteString -> Either String GlTF GlTF.fromByteString fromFile :: MonadUnliftIO io => FilePath -> io (Either Errors Gltf) fromFile :: String -> io (Either Errors Gltf) fromFile String path = IO (Either String GlTF) -> io (Either String GlTF) forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (String -> IO (Either String GlTF) GlTF.fromFile String path) io (Either String GlTF) -> (Either String GlTF -> io (Either Errors Gltf)) -> io (Either Errors Gltf) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b >>= Either String GlTF -> io (Either Errors Gltf) forall (io :: * -> *). MonadUnliftIO io => Either String GlTF -> io (Either Errors Gltf) toGltfResult toGltfResult :: MonadUnliftIO io => Either String GlTF.GlTF -> io (Either Errors Gltf) toGltfResult :: Either String GlTF -> io (Either Errors Gltf) toGltfResult Either String GlTF res = Either String GlTF res Either String GlTF -> (Either String GlTF -> Either Errors GlTF) -> Either Errors GlTF forall a b. a -> (a -> b) -> b & ASetter (Either String GlTF) (Either Errors GlTF) String Errors -> (String -> Errors) -> Either String GlTF -> Either Errors GlTF forall s t a b. ASetter s t a b -> (a -> b) -> s -> t over ASetter (Either String GlTF) (Either Errors GlTF) String Errors forall a b a'. Traversal (Either a b) (Either a' b) a a' _Left (Text -> Errors ReadError (Text -> Errors) -> (String -> Text) -> String -> Errors forall b c a. (b -> c) -> (a -> b) -> a -> c . String -> Text forall a. IsString a => String -> a fromString) Either Errors GlTF -> (Either Errors GlTF -> io (Either Errors Gltf)) -> io (Either Errors Gltf) forall a b. a -> (a -> b) -> b & LensLike io (Either Errors GlTF) (Either Errors Gltf) GlTF Gltf -> LensLike io (Either Errors GlTF) (Either Errors Gltf) GlTF Gltf forall (f :: * -> *) s t a b. LensLike f s t a b -> LensLike f s t a b traverseOf LensLike io (Either Errors GlTF) (Either Errors Gltf) GlTF Gltf forall a b b'. Traversal (Either a b) (Either a b') b b' _Right GlTF -> io Gltf forall (f :: * -> *). MonadUnliftIO f => GlTF -> f Gltf toGltfResult' where toGltfResult' :: GlTF -> f Gltf toGltfResult' GlTF gltf = GlTF -> Vector GltfBuffer -> Gltf adaptGltf GlTF gltf (Vector GltfBuffer -> Gltf) -> f (Vector GltfBuffer) -> f Gltf forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> GlTF -> f (Vector GltfBuffer) forall (io :: * -> *). MonadUnliftIO io => GlTF -> io (Vector GltfBuffer) loadBuffers GlTF gltf