(controller, mesh)
| 168 | return meshOutputs |
| 169 | |
| 170 | def getIndices(controller, mesh): |
| 171 | # Get the character for the width of index |
| 172 | indexFormat = 'B' |
| 173 | if mesh.indexByteStride == 2: |
| 174 | indexFormat = 'H' |
| 175 | elif mesh.indexByteStride == 4: |
| 176 | indexFormat = 'I' |
| 177 | |
| 178 | # Duplicate the format by the number of indices |
| 179 | indexFormat = str(mesh.numIndices) + indexFormat |
| 180 | |
| 181 | # If we have an index buffer |
| 182 | if mesh.indexResourceId != rd.ResourceId.Null(): |
| 183 | # Fetch the data |
| 184 | ibdata = controller.GetBufferData(mesh.indexResourceId, mesh.indexByteOffset, 0) |
| 185 | |
| 186 | # Unpack all the indices, starting from the first index to fetch |
| 187 | offset = mesh.indexOffset * mesh.indexByteStride |
| 188 | indices = struct.unpack_from(indexFormat, ibdata, offset) |
| 189 | |
| 190 | # Apply the baseVertex offset |
| 191 | return [i + mesh.baseVertex for i in indices] |
| 192 | else: |
| 193 | # With no index buffer, just generate a range |
| 194 | return tuple(range(mesh.numIndices)) |
| 195 | |
| 196 | def printMeshData(controller, meshData): |
| 197 | indices = getIndices(controller, meshData[0]) |
no test coverage detected