MetalBasic3D

Last Revision:
Version 2.1, 2015-11-13
Updated for iOS 9.
(Full Revision History)
Build Requirements:
iOS 9 SDK
Runtime Requirements:
iOS 9, 64 bit devices

This Metal example has been ported from the Xcode OpenGL ES template and includes a reusable view class and a geometric math library built on top of the simd.h library. The math library has been created for performing geometric graphics operations within Metal's left hand coordinate system and is used in this sample to set up a basic perspective, look at and model view projection matrix for objects rendered in the scene. Each cube is renderered individually using a basic 3D lighting shader with diffuse and ambient components. Additional effects have been added to one of the spinning cubes from the template to demonstrate altering a single object's uniform values per frame while keeping the other constant, all the while sharing the same buffer in memory. The cube geometry is defined with interlaced vertex and normal data and demonstrates how stride can be read within a shader.