MCPcopy Create free account
hub / github.com/beefytech/Beef / AllocTris

Method AllocTris

BeefySysLib/gfx/DrawLayer.cpp:67–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void* DrawBatch::AllocTris(int vtxCount)
68{
69 int idxCount = vtxCount;
70
71 bool fits = (idxCount + mIdxIdx <= mAllocatedIndices) && (vtxCount + mVtxIdx <= mAllocatedVertices);
72 if ((mRenderState != gBFApp->mRenderDevice->mCurRenderState) || (!fits))
73 {
74 if ((mVtxIdx > 0) || (!fits))
75 {
76 DrawBatch* nextBatch = AllocateChainedBatch(vtxCount, idxCount);
77 return nextBatch->AllocTris(vtxCount);
78 }
79
80 mRenderState = gBFApp->mRenderDevice->mCurRenderState;
81 }
82
83 uint16* idxPtr = mIndices + mIdxIdx;
84 void* vtxPtr = (uint8*)mVertices + (mVtxIdx * mVtxSize);
85
86 for (int idxNum = 0; idxNum < idxCount; idxNum++)
87 {
88 *idxPtr++ = mVtxIdx++;
89 mIdxIdx++;
90 }
91
92 return vtxPtr;
93}
94
95void* DrawBatch::AllocStrip(int vtxCount)
96{

Callers 1

Gfx_AllocTrisFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected