19 void* posSrc, u32 posSrcSize,
20 void* norSrc, u32 norSrcSize,
21 void* colSrc, u32 colSrcSize,
22 void* texSrc, u32 texSrcSize,
23 void* idxSrc, u32 idxSrcSize)
25 if (posSrc && texSrc && idxSrc)
30 mPrimitiveIndexNum = indexNum;
34 nw::math::VEC3* pos =
static_cast<nw::math::VEC3*>(mPrimitivePosVB.AllocateVertexBuffer(heap, posSrcSize, 3));
35 memcpy(pos, posSrc, posSrcSize);
37 mPrimitivePosVB.Invalidate();
42 nw::math::VEC3* nor =
static_cast<nw::math::VEC3*>(mPrimitiveNormalVB.AllocateVertexBuffer(heap, norSrcSize, 3));
43 memcpy(nor, norSrc, norSrcSize);
45 mPrimitiveNormalVB.Invalidate();
50 nw::math::VEC4* col =
static_cast<nw::math::VEC4*>(mPrimitiveColorVB.AllocateVertexBuffer(heap, colSrcSize, 4));
51 memcpy(col, colSrc, colSrcSize);
53 mPrimitiveColorVB.Invalidate();
57 nw::math::VEC4* col =
static_cast<nw::math::VEC4*>(
58 mPrimitiveColorVB.AllocateVertexBuffer(heap, mPrimitiveIndexNum *
sizeof(nw::math::VEC4), 4));
60 for (u32 i = 0; i < mPrimitiveIndexNum; ++i)
68 mPrimitiveColorVB.Invalidate();
71 if (texSrc && texSrcSize != 0)
73 nw::math::VEC2* tex =
static_cast<nw::math::VEC2*>(mPrimitiveTexCrdVB.AllocateVertexBuffer(heap, texSrcSize, 2));
74 memcpy(tex, texSrc, texSrcSize);
76 mPrimitiveTexCrdVB.Invalidate();
79
80
81
82
83
85 if (idxSrc && idxSrcSize != 0)
87 u32* idx =
static_cast<u32*>(mPrimitiveIndexVB.AllocateVertexBuffer(heap, idxSrcSize, 1));
88 memcpy(idx, idxSrc, idxSrcSize);
89 uIdx =
reinterpret_cast<u32*>(idx);
90 mPrimitiveIndexVB.Invalidate();