Skip to content

IO System

Antonio edited this page Nov 24, 2021 · 5 revisions

Rem's Studio / Rem's Engine abstracts file accesses to simplify working with them.

File References

Files are abstracted as me.anno.io.files.FileReference. FileReferences can be read from within compressed files, just use it as if it was a folder.

URLs currently aren't implemented as a reference.

Currently, you can only write to files, which are directly on the disk. Writing into zip files is not currently supported.

Images, CPU side

To load images, that you'll use more than once, use the function me.anno.image.ImageCPUCache.getImage().

It supports the following image formats:

  • png
  • jpg
  • jpg2000
  • bmp
  • psd
  • ico
  • dds
  • tga
  • webp
  • hdr
  • gif
  • all/most from FFMPEG

When the source is a video or contains multiple images, a single frame will be selected and returned.

You can append .r/.g/.b/... to the file name to extract the respective channel from the image automatically.

Images, GPU Side (Textures)

To load images to show them to the user, use the function me.anno.image.ImageGPUCache.getImage(). The texture should be requested every frame, as they can be invalidated between frames.

Text / Binary Files / InputStream

To read text files or binary files, use FileReference.readText(), FileReference.readBytes() or FileReference.inputStream(). The InputStream typically is already buffered in some way.

Meshes (Rem's Engine)

To use meshes in Rem's Engine, use me.anno.ecs.components.cache.MeshCache.get(). The function will search the prefab or asset for its first valid mesh.

Supported file formats include:

  • fbx
  • obj/mtl
  • gltf/glb
  • dae (collada)
  • md2, md5mesh
  • vox

Draco compressed glTF is currently not supported, and might crash the engine! (because I need to update Assimp)

Other

There are other functions, e.g. for video frames, skeletons, animations, and more. If you need help with them, just ask me, whether something already exists :).