Post

Replies

Boosts

Views

Activity

Reply to How to pass right model view projection matrix from scenekit to metal shader?
Sorry, I did it. problem is in this code (https://stackoverflow.com/questions/33730468/how-to-convert-camera-extrinsic-matrix-to-scncamera-position-and-rotation)    private func updateNodeMatrix(_ camNode: SCNNode) {     guard let camera = camNode.camera else {       return     }           let modelMatrix = transform     let viewMatrix = SCNMatrix4Invert(camNode.transform) // invert is right     let projectionMatrix = camera.projectionTransform           let viewProjection = SCNMatrix4Mult(viewMatrix, projectionMatrix)     let modelViewProjection = SCNMatrix4Mult(modelMatrix, viewProjection)     nodeMatrix.modelViewProjectionTransform = float4x4(modelViewProjection)   }
Jan ’22
Reply to Want to know for loop parallel using swift 5.5
As your answer, I resolve this issue like this. This code download all web url file to local cache. And check total and completed number of them. private static func downloadAllFilesAsync(_ medicalInfo: MedicalInfo)   async throws -> (total: Int, completed: Int) { ... let download: (URL) async throws -> Int = { url in       do {         _ = try await WWW.downloadFileAsync(url)         return 1       } catch {         throw error       }     }           return try await withThrowingTaskGroup(of: Int.self) {       group -> (Int, Int) in buildURLSet() // To be requested url array ([URL]) is set.       let total = requested.count       var completed = 0       for requestUrl in requested {         group.addTask {           return try await download(requestUrl)         }       }               completed = try await group.reduce(0, +)       return (total, completed)     } }
Oct ’21