SCNGeometryElement(indices:, primitiveType:) infers an untyped array as [Int64]s which leads to an incorrect index buffer
Originator: | harry-jordan | ||
Number: | rdar://43325895 | Date Originated: | 15/08/2018 |
Status: | Open | Resolved: | |
Product: | iOS | Product Version: | 12 |
Classification: | SceneKit | Reproducible: | Yes |
Area: SceneKit Summary: Passing a Swift array of indices will be infered as 64 bit ints, but internally SceneKit will treat the buffer as ushort3. For instance: let triangle = SCNGeometryElement(indices: [0, 1, 2, 1, 2, 3], primitiveType: .triangles) will only output a single line as the buffer will be read as [0, 0, 0, 0, 1, 0] (thanks to Dean for debugging this). I've attached a screenshot which shows the incorrect buffer Steps to Reproduce: I've attached a simple playground that shows the issue. The expected result is as in the Expected.png Expected Results: SceneKit should either do a proper conversion to ushort's or assert that the input is a valid bit width. In the attached playground the output view should look like Expected.png Actual Results: In this case the red triangle won't be draw as it uses the inferred Swift array of ints Version/Build: Xcode-beta 5, but I think earlier OS versions are affected to Configuration:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!