react-native-arkit icon indicating copy to clipboard operation
react-native-arkit copied to clipboard

[Proposal] Load model file the same as RN loads image

Open qftgtr opened this issue 8 years ago • 1 comments

Use the source prop to specify the model file would be more consistent to how RN loads images. A few use cases are

1. The model file is placed in the js folder

<ARKit.Model source={require('path/to/model/file.dae')} />

2. The model file is placed in the app's resources folder.

There is a small difference here when loading images (check here). On iOS, the file extension is not included

<Image source={{uri: 'app_icon'}} />

but on Android, you need to add the asset:/ scheme:

<Image source={{uri: 'asset:/app_icon.png'}} />

I don't know why this is different and wish someone could explain it.

A proposed usage for loading model file in resources folder is,

<ARKit.Model source={{ uri: 'model.dae' }} />

3. The model file is on server

<ARKit.Model source={{ uri: http://your.server.url/model.dae }} />

@macrozone has demonstrated how to load a online model file https://gist.github.com/macrozone/e20b9f6ab2bf529331e6019efa08e92f

qftgtr avatar Sep 28 '17 01:09 qftgtr

keep in mind that a model might also contain textures. There is no standard format for that (as far as i know).

I therefore created zipfiles containing an optimized dae file and its texture and unpack it locally.

if

macrozone avatar Sep 28 '17 15:09 macrozone