Use u32 type for triangleIndex to avoid doing unnecessary casting + comparison warnings.