在app中实时更改对象`s纹理

时间:2018-04-16 09:32:51

标签: textures arkit

这里我有主要课程。我想在app中实时更改对象的素材,但我没有成功。你能告诉我为什么吗?

class VirtualObject: SCNNode {
    static let ROOT_NAME = "Virtual object root node"
    var fileExtension: String = ""
    var thumbImage: UIImage!
    var title: String = ""
    var modelName: String = ""
    var modelLoaded: Bool = false
    var id: Int!
    override init() {
        super.init()
        self.name = VirtualObject.ROOT_NAME
    }

    init(modelName: String, fileExtension: String, thumbImageFilename: String, title: String) {
        super.init()
        self.id = VirtualObjectsManager.shared.generateUid()
        self.name = VirtualObject.ROOT_NAME
        self.modelName = modelName
        self.fileExtension = fileExtension
        self.thumbImage = UIImage(named: thumbImageFilename)
        self.title = title
    }

}
@IBAction func textureIt(_ sender: Any) {
     let object = VirtualObjectsManager.shared.getVirtualObjectSelected()
    object?.thumbImage = #imageLiteral(resourceName: "chair_DIFFUSE")
  VirtualObjectsManager.shared.setVirtualObjectSelected(virtualObject: object!)
}

我想改变对象s texture in app but I can,我不知道自己做错了什么。当我调试应用程序时,thumbImage会发生变化,但在应用程序中它会保持不变。我该怎么办?

0 个答案:

没有答案