use of android.renderscript.FileA3D in project android_frameworks_base by ParanoidAndroid.
the class ShadersTestRS method initMeshes.
private void initMeshes(FileA3D model) {
int numEntries = model.getIndexEntryCount();
int numMeshes = 0;
for (int i = 0; i < numEntries; i++) {
FileA3D.IndexEntry entry = model.getIndexEntry(i);
if (entry != null && entry.getEntryType() == FileA3D.EntryType.MESH) {
numMeshes++;
}
}
if (numMeshes > 0) {
mMeshes = new ScriptField_MeshInfo(mRS, numMeshes);
for (int i = 0; i < numEntries; i++) {
FileA3D.IndexEntry entry = model.getIndexEntry(i);
if (entry != null && entry.getEntryType() == FileA3D.EntryType.MESH) {
Mesh mesh = entry.getMesh();
mMeshes.set_mMesh(i, mesh, false);
mMeshes.set_mNumIndexSets(i, mesh.getPrimitiveCount(), false);
}
}
mMeshes.copyAll();
} else {
throw new RSRuntimeException("No valid meshes in file");
}
mScript.bind_gMeshes(mMeshes);
mScript.invoke_updateMeshInfo();
}
use of android.renderscript.FileA3D in project android_frameworks_base by ParanoidAndroid.
the class ShadersTestRS method initRS.
private void initRS() {
mScript = new ScriptC_shaderstest(mRS, mRes, R.raw.shaderstest);
initPFS();
initPF();
initPV();
loadImage();
initBuffers(1, 1);
FileA3D model = FileA3D.createFromResource(mRS, mRes, R.raw.robot);
initMeshes(model);
mRS.bindRootScript(mScript);
}
Aggregations