| 2373 | } |
| 2374 | |
| 2375 | void TSMesh::dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive *piArray, U16* ibIndices) |
| 2376 | { |
| 2377 | // go through and create PrimitiveInfo array |
| 2378 | GFXPrimitive pInfo; |
| 2379 | |
| 2380 | U32 primitivesSize = mPrimitives.size(); |
| 2381 | for (U32 i = 0; i < primitivesSize; i++) |
| 2382 | { |
| 2383 | const TSDrawPrimitive & draw = mPrimitives[i]; |
| 2384 | |
| 2385 | GFXPrimitiveType drawType = getDrawType(draw.matIndex >> 30); |
| 2386 | |
| 2387 | switch (drawType) |
| 2388 | { |
| 2389 | case GFXTriangleList: |
| 2390 | pInfo.type = drawType; |
| 2391 | pInfo.numPrimitives = draw.numElements / 3; |
| 2392 | pInfo.startIndex = startIndex + draw.start; |
| 2393 | // Use the first index to determine which 16-bit address space we are operating in |
| 2394 | pInfo.startVertex = (mIndices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this |
| 2395 | pInfo.minIndex = 0; // minIndex are zero based index relative to startVertex. See @GFXDevice |
| 2396 | pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex); |
| 2397 | pInfo.startVertex += startVertex; |
| 2398 | break; |
| 2399 | |
| 2400 | case GFXTriangleStrip: |
| 2401 | pInfo.type = drawType; |
| 2402 | pInfo.numPrimitives = draw.numElements - 2; |
| 2403 | pInfo.startIndex = startIndex + draw.start; |
| 2404 | // Use the first index to determine which 16-bit address space we are operating in |
| 2405 | pInfo.startVertex = (mIndices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this |
| 2406 | pInfo.minIndex = 0; // minIndex are zero based index relative to startVertex. See @GFXDevice |
| 2407 | pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex); |
| 2408 | pInfo.startVertex += startVertex; |
| 2409 | break; |
| 2410 | |
| 2411 | default: |
| 2412 | AssertFatal(false, "WTF?!"); |
| 2413 | } |
| 2414 | |
| 2415 | *piArray++ = pInfo; |
| 2416 | } |
| 2417 | |
| 2418 | dCopyArray(ibIndices, mIndices.address(), mIndices.size()); |
| 2419 | } |
| 2420 | |
| 2421 | void TSMesh::assemble( bool skip ) |
| 2422 | { |
no test coverage detected