如何将scenekit背景的内容设置为立方体贴图 [英] How to set contents of scenekit background to cube map
问题描述
我正在尝试使用大约6个图像的数组将场景的背景内容设置为天空盒效果。
I am trying to set the background contents of a scene to a skybox effect using about array of 6 images.
我已经创建了正确的图像数组订单,我知道我需要再使用
I have created the array of images in the correct order, I know I need to then use
+ (instancetype) materialPropertyWithContents:(id)contents
然而,我正在努力弄清楚我是如何以及在何处使用该类方法来返回包含立方体贴图的属性。
However I'm struggling to work out how and where exactly I use that class method to return the property containing the cube map.
推荐答案
SCNScene的background属性属于SCNMaterialProperty类。所以你可以直接将它的内容设置为6个图像的数组来设置你的天空盒(见SCNScene.h)。
SCNScene's "background" property is of the SCNMaterialProperty class. So you can directly set it's contents to an array of 6 images to setup your skybox (see SCNScene.h).
aScene.background.contents = @[@"Right.png", @"Left.png", @"Top.png", @"Bottom.png", @"Back.png", @"Front.png"];
确保您的6张图片是正方形且尺寸相同。
Make sure your 6 images are square and with the same dimensions.
这篇关于如何将scenekit背景的内容设置为立方体贴图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!