Work on synchronizing a3d created files and java layer.

Adding culling to ProgramRaster

Change-Id: I58ccc82d37edc9539289d5eba44ea0e720874af5
This commit is contained in:
Alex Sakhartchouk
2010-07-12 15:50:32 -07:00
parent cefd8d9588
commit 80a4c2cd34
14 changed files with 307 additions and 43 deletions

View File

@@ -59,6 +59,38 @@ public class Mesh extends BaseObj {
return mPrimitives[slot];
}
@Override
void updateFromNative() {
int vtxCount = mRS.nMeshGetVertexBufferCount(mID);
int idxCount = mRS.nMeshGetIndexCount(mID);
int[] vtxIDs = new int[vtxCount];
int[] idxIDs = new int[idxCount];
int[] primitives = new int[idxCount];
mRS.nMeshGetVertices(mID, vtxIDs, vtxCount);
mRS.nMeshGetIndices(mID, idxIDs, primitives, vtxCount);
mVertexBuffers = new Allocation[vtxCount];
mIndexBuffers = new Allocation[idxCount];
mPrimitives = new Primitive[idxCount];
for(int i = 0; i < vtxCount; i ++) {
if(vtxIDs[i] != 0) {
mVertexBuffers[i] = new Allocation(vtxIDs[i], mRS);
mVertexBuffers[i].updateFromNative();
}
}
for(int i = 0; i < idxCount; i ++) {
if(idxIDs[i] != 0) {
mIndexBuffers[i] = new Allocation(idxIDs[i], mRS);
mIndexBuffers[i].updateFromNative();
}
mPrimitives[i] = Primitive.values()[primitives[i]];
}
}
public static class Builder {
RenderScript mRS;