SCNScene从pod中加载纹理

时间:2017-04-17 08:19:27

标签: cocoapods textures bundle scenekit scnscene

我正在尝试使用纹理创建包含SCNScene的pod并出现错误:

SceneKit Error: Failed loading : C3DImage
src:file:///Users/.../Example.app/Templates.scnassets/grid.png

纹理和场景位于同一个文件夹中。

我尝试加载SCNSceneSource

let sceneData = try Data(contentsOf: sceneUrl)
let options = [.overrideAssetURLs: true,
               .assetDirectoryURLs: MYPod.bundle().bundleURL
               ] as [SCNSceneSource.LoadingOption : Any]
let source = SCNSceneSource(data: sceneData, options:options)
scene = (source?.scene(options: options))!

但结果相同(路径不变)

1 个答案:

答案 0 :(得分:2)

您应该使用代码和所有材料(对于伪代码抱歉)

for i in range(1,exp.shape[1]):
    minIndex = max(bestIndeces[i-1]-maxIndexDelta,0)
    maxIndex = min(bestIndeces[i-1]+maxIndexDelta, 2499)
    SR = np.power(cal[:,minIndex:maxIndex]-exp[:,[i]],2)
    SSR = np.sum(SR,axis=0)
    bestSSRs[i] = np.min(SSR)
    bestIndeces[i] = int(np.argmin(SSR) + minIndex)