assimp
assimp copied to clipboard
Using on Android
Hi when loading the library on android i get the following error.
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.nio.file.Paths"
When i do this call.
Importer importer = new Importer();
AiScene scene = importer.readFile(new URI(path), 1 | 8);
Are you using raw
or assets
?
Im doing something weird and i cant remember why...
AssetFileDescriptor assetFileDescriptor = assetManager.openFd("cube.obj");
FileDescriptor fileDescriptor = assetFileDescriptor.getFileDescriptor();
FileInputStream raw = new FileInputStream(fileDescriptor);
final File tempFile = File.createTempFile("cube", ".obj");
tempFile.deleteOnExit();
try (FileOutputStream out = new FileOutputStream(tempFile)) {
IOUtils.copy(raw, out);
}
Model plain = new Model(tempFile.getAbsolutePath(), false);
Model just calls
Importer importer = new Importer();
AiScene scene = importer.readFile(new URI(path), 1 | 8);
Try this
This Importer importer = new Importer().readFile();
doesnt support an input stream...
So, apparently there are some classes, such as java.nio.files.*
, that are not present on Android..
I am investigating for a solution...
Would you prefer loading your meshes from your res
or assets
folder?
Yea its a pain at times. Either, currently I'm trying use assets folder but either are fine.
Ok, I am evaluating to make a branch for Android.
In the meanwhile, could you confirm me that the lenght you get on the files loaded from assets
it's not UNKNOWN
for you? If you test one of your assets file length, do you get the right size?
For reference
An update, I am planning to pass the AssetManager
(retrievable via getAssets()
from within the activity) to the readFile
together with the path of the main file in order for assimp to read additional adjacent files. Is this compatible with your app?
You do as you see fit, I will modify my app to sit in with your changes. :-)
Has there been a solution for this? We are using assimp-all.jar and are getting the Didn't find class "java.nio.file.Paths"
error also. I don't see any AssetManager support in readFile() as of yet.
Hi, unfortunately no.
I have a lot of other things with higher priority on my todo list right now and I also lack android experience: deadly combo.
However, we are totally open for contributions: this is the majoy point of this organization :)
If you want to help push the project forward, don't hesitate :)