From 80a4c2cd34aedb4f1a2e5e7d1ac26a9aeebe41ae Mon Sep 17 00:00:00 2001 From: Alex Sakhartchouk Date: Mon, 12 Jul 2010 15:50:32 -0700 Subject: Work on synchronizing a3d created files and java layer. Adding culling to ProgramRaster Change-Id: I58ccc82d37edc9539289d5eba44ea0e720874af5 --- libs/rs/rsMesh.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'libs/rs/rsMesh.cpp') diff --git a/libs/rs/rsMesh.cpp b/libs/rs/rsMesh.cpp index d1b5581..9026578 100644 --- a/libs/rs/rsMesh.cpp +++ b/libs/rs/rsMesh.cpp @@ -271,4 +271,45 @@ void rsi_MeshBindIndex(Context *rsc, RsMesh mv, RsAllocation va, uint32_t primTy sm->updateGLPrimitives(); } +void rsi_MeshGetVertexBufferCount(Context *rsc, RsMesh mv, int32_t *numVtx) +{ + Mesh *sm = static_cast(mv); + *numVtx = sm->mVertexBufferCount; +} + +void rsi_MeshGetIndexCount(Context *rsc, RsMesh mv, int32_t *numIdx) +{ + Mesh *sm = static_cast(mv); + *numIdx = sm->mPrimitivesCount; +} + +void rsi_MeshGetVertices(Context *rsc, RsMesh mv, RsAllocation *vtxData, uint32_t vtxDataCount) +{ + Mesh *sm = static_cast(mv); + rsAssert(vtxDataCount == sm->mVertexBufferCount); + + for(uint32_t ct = 0; ct < vtxDataCount; ct ++) { + vtxData[ct] = sm->mVertexBuffers[ct].get(); + sm->mVertexBuffers[ct]->incUserRef(); + } +} + +void rsi_MeshGetIndices(Context *rsc, RsMesh mv, RsAllocation *va, uint32_t *primType, uint32_t idxDataCount) +{ + Mesh *sm = static_cast(mv); + rsAssert(idxDataCount == sm->mPrimitivesCount); + + for(uint32_t ct = 0; ct < idxDataCount; ct ++) { + va[ct] = sm->mPrimitives[ct]->mIndexBuffer.get(); + primType[ct] = sm->mPrimitives[ct]->mPrimitive; + if(sm->mPrimitives[ct]->mIndexBuffer.get()) { + sm->mPrimitives[ct]->mIndexBuffer->incUserRef(); + } + } + +} + + + + }} -- cgit v1.1