我试图使用以下代码在SCNCylinder对象上渲染图像:
let coinGeometry = SCNCylinder(radius: 50, height: 55)
coinNode = SCNNode(geometry: coinGeometry)
coinNode.position = SCNVector3Make(0.0, 25.0, 25.0)
coinScene.rootNode.addChildNode(coinNode)
//Add image on cylinder shape
let frontFacingImageMaterial = SCNMaterial()
frontFacingImageMaterial.diffuse.contents = UIImage(named: "map")
frontFacingImageMaterial.specular.contents = UIColor.blueColor()
frontFacingImageMaterial.shininess = 5.0
coinGeometry.firstMaterial = frontFacingImageMaterial
在圆柱体上,此图像显示为反转(翻转)。我该如何解决?
谢谢
最佳答案
不要翻转原始图像数据,只需翻转其映射到几何图形的方式即可。将frontFacingImageMaterial.diffuse.contentsTransform
设置为可翻转X或Y的矩阵。
关于ios - SCNCylinder上的设置内容(图像)反转(翻转),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33638532/