I have some code that was mostly taken from an open source project on github.
I am trying to export an ARkit mesh into a 3d usd file, and this is currently working great.
However I want to remove all the vertices that are not on walls or windows, giving me a 3d usd file with ONLY walls and windows.
You will see I have some commented code, I tried to use the classificationOf extension from the developer docs, but I can't quite figure out how to classify individual points and remove them.
Any help would be appreciated.
I am trying to export an ARkit mesh into a 3d usd file, and this is currently working great.
However I want to remove all the vertices that are not on walls or windows, giving me a 3d usd file with ONLY walls and windows.
Code Block swift // Transform the vertex buffer into an array of points func transformedVertexBuffer(_ transform: simd_float4x4) -> ([Float], Int) { var bytes = [Float]() for index in 0..<vertices.count { let vertexPointer = vertices.buffer.contents().advanced(by: vertices.offset + vertices.stride * index) let vertex = vertexPointer.assumingMemoryBound(to: (Float, Float, Float).self).pointee var vertextTransform = matrix_identity_float4x4 vertextTransform.columns.3 = SIMD4<Float>(vertex.0, vertex.1, vertex.2, 1) let position = (transform * vertextTransform).position // let classification = classificationOf(faceWithIndex: index) // // if(classification == .wall || classification == .window) { // print("this is a wall") // // } else { // print("not a wall") // continue // // } bytes.append(position.x) bytes.append(position.y) bytes.append(position.z) } return (bytes, bytes.count / 3) } }
You will see I have some commented code, I tried to use the classificationOf extension from the developer docs, but I can't quite figure out how to classify individual points and remove them.
Any help would be appreciated.