-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GLTFLoader doesn't load binary buffer on Android #56
Comments
Related: expo/expo-asset-utils#5 |
for android 9 i got this error for loading glb and gltf files. Error: # APP.js"use strict";
// GLOBALS
global.THREE = global.THREE || THREE;
// IMPORTS
import React, { useEffect } from 'react';
import { THREE } from 'expo-three';
import { GLView } from 'expo-gl';
import { Renderer } from 'expo-three';
import { Asset } from 'expo-asset';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
// COMPONENT
export default function App() {
useEffect(() => {
// Create an Asset from a resource
const loader = new GLTFLoader();
const asset = Asset.fromModule(require("./model/monkey.gltf"));
asset.downloadAsync()
.then(() => console.log(asset.localUri))
.then(() => loader.load(asset.localUri, group => {
// Model loaded...
console.log("Model Loaded!")
}))
.catch(err => console.log("Load Error: ", err));
}, [])
return (
<GLView
style={{ flex: 1 }}
onContextCreate={gl => {
// Create a WebGLRenderer without a DOM element
console.log("Context created")
const renderer = new Renderer({ gl });
renderer.setSize(gl.drawingBufferWidth, gl.drawingBufferHeight);
}}
/>
);
} # metro.config.jsmodule.exports = {
resolver: {
assetExts: ['db', 'mp3', 'ttf', 'obj', 'png', 'jpg', 'gltf', 'glb'],
},
transformer: {
assetPlugins: ['expo-asset/tools/hashAssetFiles'],
},
}; |
@ulvido |
unfortunately no. the error consumed my energy so I quit trying and begin to play farcry primal. |
@ulvido good idea |
@EvanBacon EvanBacon |
also got this { isTrusted" : false }. any fix yet? |
Hi @igorroman777 |
I switched to loading with
|
Has anyone made any progress towards a solution for this issue? |
any find a solution for this? |
@ulvido how did you log the file name as the screen shot? what tool is handy for this verbosity? |
Using a localUri like this:
file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540arttu%252Fsignlab-ar-prototype/ExponentAsset-edefa90125f1739a3f962678f2406a92.bin
Android outputs an error from THREE.FileLoader:
https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/GLTFLoader.js#L1778
The problem sounded similar as in the below link, being an issue only on Android and relating to localUri. However Expo.FileSystem is not being used and Expo.Asset.downloaded flag is set to true.
https://github.com/expo/expo-three/issues/10/
I also noticed that AssimpLoaderExample.js from expo-three outputs a similar error on Android. I guess there are somehow related as both use THREE.FileLoader and are in binary buffer file format.
All of this works perfectly on iOS!
The text was updated successfully, but these errors were encountered: