greetings all, perhaps anyone can point me to the right direction on this issue:
- scanning + viewing works perfectly.
- SCPointCloud is fine, no issues
- Mesh is displayed in color and all is well.
- crashing while OBJZip saving the mesh (or even accessing textureData), which is unexpectedly nil.
- textureHeight and width is 0
- SCReconstructionManager.includesColorBuffersInMetadata = true
- SCReconstructionManager.includesDepthBuffersInMetadata = true
SCMesh:

SCMeshTexturing:

here is the code:
private func _processMeshTexturingIntoMesh(withPointCloud pointCloud: SCPointCloud,
meshTexturing: SCMeshTexturing,
completion: @escaping ((Result<SCMesh, Error>) -> Void)) {
meshingProgressView.isHidden = false
meshingProgressView.setProgress(0, animated: false)
let meshingParameters = SCMeshingParameters()
meshingParameters.resolution = 5
meshingParameters.smoothness = 2
meshingParameters.surfaceTrimmingAmount = 5
meshingParameters.closed = true
_meshingHelper = SCMeshingHelper(pointCloud: pointCloud, meshTexturing: meshTexturing, meshingParameters: meshingParameters)
_meshingHelper?.processMesh(coloringStrategy: .vertex) { meshingStatus in
DispatchQueue.main.async {
switch meshingStatus {
case .inProgress(let progress):
self.meshingProgressView.setProgress(progress, animated: false)
case .failure(let error):
self.meshingProgressView.isHidden = true
completion(.failure(error)) // Error is guaranteed to be set for the failure case
case .success(let mesh):
self.meshingProgressView.isHidden = true
let zip_url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent("Scan.zip")
if mesh.writeToOBJZip(atPath: zip_url.path) {
print("Mesh ZIP saved.")
}
print("🌶🌶🌶 textureData: \(mesh.textureData.count / 1024)kb") // EXC_BAD_ACCESS crash here
print("🌶🌶🌶 texCoordData: \(mesh.texCoordData.count / 1024)kb")
print("🌶🌶🌶 textureWidth: \(mesh.textureWidth)")
print("🌶🌶🌶 textureWidth: \(mesh.textureHeight)")
completion(.success(mesh))
}
}
}
}
and here's the error:

what can be the reason? any help greatly appreciated
greetings all, perhaps anyone can point me to the right direction on this issue:
SCMesh:

SCMeshTexturing:

here is the code:
and here's the error:
what can be the reason? any help greatly appreciated