4.4.1. Replacing the teapot with a cube

The advantage of using an asset in Mali Binary Asset format is that you can quickly load a new shape:

  1. Example 4.23 showed how to load the teapot asset file. Copy the cube.mba, rock_n.png, and rock_t.png files from bumpmapping\data to the lighting\data area.

    The rock_n.png, and rock_t.png files are not used in this example, but they are referenced by the cube.mba file so they must also be copied.

  2. Modify the getSceneAsset() call to load the cube asset as shown in Example 4.27:

    Example 4.27. Load the asset for the teapot

    ...
    		// Loading scene
    		// SceneAsset* scene = proxy.getSceneAsset("teapot.mba");
    		SceneAsset* scene = proxy.getSceneAsset("cube.mba");
    		GeometryAsset* teapot = 			static_cast<GeometryAsset*>(scene->getAsset(Asset::TYPE_GEOMETRY, 0));
    ...
            teapot->draw();
    ...
    

  3. Rebuild the project and run it. Figure 4.6 now shows a cube shape instead of a teapot:

    Figure 4.6. The lighting example with a cube shape instead of the teapot

    The lighting example with a cube shape instead of the teapot

Copyright © 2010 ARM. All rights reserved.ARM DUI 0527A‑02a
Non-Confidential - Draft - BetaID070710