Some Notes on Loading Models

For the game we are going to write in the next chapter[OK?] our loader is sufficient, but it is far from robust. There are some caveats:

String processing in Android is inherently slow. The OBJ format is a plain-text format and as such needs a lot of parsing. This will have a negative influence on load times. You can work around this issue by converting your OBJ models to a custom binary format. You could for example just serialize the verts array that we fill in the ObjLoader.load() method.

The OBJ format has a lot more features that we don't exploit. If you want to extend our simple loader look up the format specification on the web. It should be easy to add additional functionality.

An OBJ file is usually accompanied by what's called a material file. This file defines the colors and textures to be used by groups of vertices in the OBJ file. We will not need this functionality as we know which texture to use for a specific OBJ file. For a more robust loader you'll want to look into the material file specification as well.

0 0

Post a comment