Importing materials from Assimp
In Chapter 5, Working with Geometry Data, we learned how to define a runtime data storage format for mesh geometry. This recipe will show you how to use the Assimp library to extract material properties from Assimp data structures. Combined with the next recipe, which will cover our SceneConverter
tool, this concludes the process of describing our data content exporting pipeline.
Getting ready
In the previous recipe, we learned how to render multiple meshes with different materials. Now, it is time to learn how to import the material data from popular 3D asset formats.
How to do it...
Let's take a look at the convertAIMaterialToDescription()
function that's used in the SceneConverter
tool. It retrieves all the required parameters from the aiMaterial
structure and returns a MaterialDescription
object that can be used with our GLSL shaders. Let's take a look:
- Each texture is addressed by an integer identifier. We will...