Methods Summary |
---|
public static android.renderscript.FileA3D | createFromAsset(RenderScript rs, android.content.res.AssetManager mgr, java.lang.String path)
rs.validate();
long fileId = rs.nFileA3DCreateFromAsset(mgr, path);
if(fileId == 0) {
throw new RSRuntimeException("Unable to create a3d file from asset " + path);
}
FileA3D fa3d = new FileA3D(fileId, rs, null);
fa3d.initEntries();
return fa3d;
|
public static android.renderscript.FileA3D | createFromFile(RenderScript rs, java.lang.String path)
long fileId = rs.nFileA3DCreateFromFile(path);
if(fileId == 0) {
throw new RSRuntimeException("Unable to create a3d file from " + path);
}
FileA3D fa3d = new FileA3D(fileId, rs, null);
fa3d.initEntries();
return fa3d;
|
public static android.renderscript.FileA3D | createFromFile(RenderScript rs, java.io.File path)
return createFromFile(rs, path.getAbsolutePath());
|
public static android.renderscript.FileA3D | createFromResource(RenderScript rs, android.content.res.Resources res, int id)
rs.validate();
InputStream is = null;
try {
is = res.openRawResource(id);
} catch (Exception e) {
throw new RSRuntimeException("Unable to open resource " + id);
}
long fileId = 0;
if (is instanceof AssetManager.AssetInputStream) {
long asset = ((AssetManager.AssetInputStream) is).getNativeAsset();
fileId = rs.nFileA3DCreateFromAssetStream(asset);
} else {
throw new RSRuntimeException("Unsupported asset stream");
}
if(fileId == 0) {
throw new RSRuntimeException("Unable to create a3d file from resource " + id);
}
FileA3D fa3d = new FileA3D(fileId, rs, is);
fa3d.initEntries();
return fa3d;
|
public android.renderscript.FileA3D$IndexEntry | getIndexEntry(int index)
if(getIndexEntryCount() == 0 || index < 0 || index >= mFileEntries.length) {
return null;
}
return mFileEntries[index];
|
public int | getIndexEntryCount()
if(mFileEntries == null) {
return 0;
}
return mFileEntries.length;
|
private void | initEntries()
int numFileEntries = mRS.nFileA3DGetNumIndexEntries(getID(mRS));
if(numFileEntries <= 0) {
return;
}
mFileEntries = new IndexEntry[numFileEntries];
int[] ids = new int[numFileEntries];
String[] names = new String[numFileEntries];
mRS.nFileA3DGetIndexEntries(getID(mRS), numFileEntries, ids, names);
for(int i = 0; i < numFileEntries; i ++) {
mFileEntries[i] = new IndexEntry(mRS, i, getID(mRS), names[i], EntryType.toEntryType(ids[i]));
}
|