我有一个32×32 .png图像,我想通过SCNPlane重复.我得到的代码(见下文)导致图像被拉伸以适应平面的大小,而不是重复.
码:
let planeGeo = SCNPlane(width: 15,height: 15) let imageMaterial = SCNMaterial() imageMaterial.diffuse.contents = UIImage(named: "art.scnassets/grid.png") planeGeo.firstMaterial = imageMaterial let plane = SCNNode(geometry: planeGeo) plane.geometry?.firstMaterial?.diffuse.wrapS = SCNWrapMode.repeat plane.geometry?.firstMaterial?.diffuse.wrapT = SCNWrapMode.repeat
我修好了它.看起来图像被放大了.如果我做imageMaterial.diffuse.contentsTransform = SCNMatrix4MakeScale(32,32,0),图像会重复.
原文链接:https://www.f2er.com/swift/319176.html