MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / dumpPrimitives

Method dumpPrimitives

Engine/source/ts/tsMesh.cpp:2370–2414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2368}
2369
2370void 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
2416void TSMesh::assemble( bool skip )
2417{

Callers 1

initVertexBuffersMethod · 0.80

Calls 3

dCopyArrayFunction · 0.85
sizeMethod · 0.45
addressMethod · 0.45

Tested by

no test coverage detected