1/27/15

Scene Kit 3D Cube Map

NSArray * images = @[[UIImage imageNamed:@"art.scnassets/zp.png"],
                     [UIImage imageNamed:@"art.scnassets/xp.png"],
                     [UIImage imageNamed:@"art.scnassets/zn.png"],
                     [UIImage imageNamed:@"art.scnassets/xn.png"],
                     [UIImage imageNamed:@"art.scnassets/yp.png"],
                     [UIImage imageNamed:@"art.scnassets/yn.png"]];

NSMutableArray * materials = [NSMutableArray array];
for (int i = 0; i < images.count; i++)
{
   SCNMaterial * m = [SCNMaterial material];
   m.diffuse.contents = images[i];
   [materials addObject:m];
}

SCNBox * boxGeo = [SCNBox boxWithWidth:8 height:8 length:8 chamferRadius:0];
boxGeo.materials = materials;
SCNNode * boxNode = [SCNNode nodeWithGeometry:boxGeo];



No comments:

Post a Comment