Tools/Open Asset Import

From OpenGL Wiki
< Tools(Redirected from Open Asset Import)
Jump to navigation Jump to search
Open Asset Import
Version 3.1.1
Release date 14 June, 2014
Platform(s) Windows, Linux, Mac OSX, FreeBSD
Language(s) C/C++, others
License 3-Clause BSD
Website site

The Open Asset Import (OAI) library is a C++ library for loading mesh data from a wide variety of formats. The tool loads mesh files into a consistent format appropriate for use by OpenGL or any other rendering system. However, it does not load these meshes directly into OpenGL.

The tool supports reading an exceptionally large range of mesh formats. Among them are:

  • COLLADA
  • 3ds
  • obj
  • Quake meshes (.mdl, .md2, .md3, .md5, etc)
  • Ogre3D meshes

It also supports writing mesh data in a smaller number of formats.

Loaded data[edit]

Because many mesh formats can store multiple meshes, and some can store entire graphs of objects, OAI's loaded representation of files is structured as a scene graph. Particular meshes can be queried by using various names, based on names stored in the file or heuristics associated with a particular format. Animation frames, such as in Quake-style vertex animation, are available as well.

The format of the data for a particular mesh after loading is structured into arrays of floating-point values. The triangles used are built from indexed data, and there is only one index per vertex. All of these make the loaded format compatible with OpenGL's expectations.

This method of loading is "lossy", in the sense that mesh data formats where each vertex component was indexed with a separate index will be combined into a single index after loading. This is again how OpenGL or other rendering systems expect the mesh data.

The mesh data is always loaded as floating-point values, regardless of the storage format in the files. If you wish to use smaller data (and you should where possible), you will have to convert the data yourself. Also, OAI's arrays are not interleaved, so if you want to interleave your mesh data, you will need to do that manually when you store it in the Buffer Object.

Example code[edit]