Meshpublic class Mesh extends BaseObj
Fields Summary |
---|
Allocation[] | mVertexBuffers | Allocation[] | mIndexBuffers | Primitive[] | mPrimitives |
Methods Summary |
---|
public Allocation | getIndexSetAllocation(int slot)
return mIndexBuffers[slot];
| public android.renderscript.Mesh$Primitive | getPrimitive(int slot)
return mPrimitives[slot];
| public int | getPrimitiveCount()
if(mIndexBuffers == null) {
return 0;
}
return mIndexBuffers.length;
| public Allocation | getVertexAllocation(int slot)
return mVertexBuffers[slot];
| public int | getVertexAllocationCount()
if(mVertexBuffers == null) {
return 0;
}
return mVertexBuffers.length;
| void | updateFromNative()
super.updateFromNative();
int vtxCount = mRS.nMeshGetVertexBufferCount(getID(mRS));
int idxCount = mRS.nMeshGetIndexCount(getID(mRS));
long[] vtxIDs = new long[vtxCount];
long[] idxIDs = new long[idxCount];
int[] primitives = new int[idxCount];
mRS.nMeshGetVertices(getID(mRS), vtxIDs, vtxCount);
mRS.nMeshGetIndices(getID(mRS), idxIDs, primitives, idxCount);
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, null, Allocation.USAGE_SCRIPT);
mVertexBuffers[i].updateFromNative();
}
}
for(int i = 0; i < idxCount; i ++) {
if(idxIDs[i] != 0) {
mIndexBuffers[i] = new Allocation(idxIDs[i], mRS, null, Allocation.USAGE_SCRIPT);
mIndexBuffers[i].updateFromNative();
}
mPrimitives[i] = Primitive.values()[primitives[i]];
}
|
|