(controller, meshData)
| 194 | return tuple(range(mesh.numIndices)) |
| 195 | |
| 196 | def printMeshData(controller, meshData): |
| 197 | indices = getIndices(controller, meshData[0]) |
| 198 | |
| 199 | print("Mesh configuration:") |
| 200 | for attr in meshData: |
| 201 | print("\t%s:" % attr.name) |
| 202 | print("\t\t- vertex: %s / %d stride" % (attr.vertexResourceId, attr.vertexByteStride)) |
| 203 | print("\t\t- format: %s x %s @ %d" % (attr.format.compType, attr.format.compCount, attr.vertexByteOffset)) |
| 204 | |
| 205 | # We'll decode the first three indices making up a triangle |
| 206 | for i in range(0, 3): |
| 207 | idx = indices[i] |
| 208 | |
| 209 | print("Vertex %d is index %d:" % (i, idx)) |
| 210 | |
| 211 | for attr in meshData: |
| 212 | # This is the data we're reading from. This would be good to cache instead of |
| 213 | # re-fetching for every attribute for every index |
| 214 | offset = attr.vertexByteOffset + attr.vertexByteStride * idx |
| 215 | data = controller.GetBufferData(attr.vertexResourceId, offset, 0) |
| 216 | |
| 217 | # Get the value from the data |
| 218 | value = unpackData(attr.format, data) |
| 219 | |
| 220 | # We don't go into the details of semantic matching here, just print both |
| 221 | print("\tAttribute '%s': %s" % (attr.name, value)) |
| 222 | |
| 223 | def sampleCode(controller): |
| 224 | # Find the biggest drawcall in the whole capture |
no test coverage detected