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