-
Notifications
You must be signed in to change notification settings - Fork 53
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
How to load multi file assets? #7
Comments
Hi @kungfooman , Try specifying the files as objects with url and filename properties. The filename is used to match internal references. Check out the drop handler. Hope that helps! |
Hi @slimbuck, thanks for the info! Got it working like this now: viewer.load([{
url: "http://127.0.0.1/libwebgame_assets/gltf/AppleTree/AppleTree.gltf",
filename: "AppleTree.gltf"
}, {
url: "http://127.0.0.1/libwebgame_assets/gltf/AppleTree/AppleTree.bin",
filename: "AppleTree.bin",
}, {
url: "http://127.0.0.1/libwebgame_assets/gltf/AppleTree/AppleTree_baseColor.png",
filename: "AppleTree_baseColor.png",
}, {
url: "http://127.0.0.1/libwebgame_assets/gltf/AppleTree/AppleTree_roughnessMetallic.png",
filename: "AppleTree_roughnessMetallic.png",
}, {
url: "http://127.0.0.1/libwebgame_assets/gltf/AppleTree/AppleTree_normal.png",
filename: "AppleTree_normal.png",
}, {
url: "http://127.0.0.1/libwebgame_assets/gltf/AppleTree/AppleTree_baseColor1.png",
filename: "AppleTree_baseColor1.png",
}, {
url: "http://127.0.0.1/libwebgame_assets/gltf/AppleTree/AppleTree_roughnessMetallic1.png",
filename: "AppleTree_roughnessMetallic1.png",
}, {
url: "http://127.0.0.1/libwebgame_assets/gltf/AppleTree/AppleTree_normal1.png",
filename: "AppleTree_normal1.png",
}, {
url: "http://127.0.0.1/libwebgame_assets/gltf/AppleTree/AppleTree_baseColor2.png",
filename: "AppleTree_baseColor2.png",
}, {
url: "http://127.0.0.1/libwebgame_assets/gltf/AppleTree/AppleTree_roughnessMetallic2.png",
filename: "AppleTree_roughnessMetallic2.png",
}, {
url: "http://127.0.0.1/libwebgame_assets/gltf/AppleTree/AppleTree_normal2.png",
filename: "AppleTree_normal2.png",
}]); Isn't it a bit strange that people have to reference every single file? In playcanvas-gltf people only have to define |
Hi @kungfooman, The next release of the viewer is a big change which includes the ability to load a gltf using its URL alone. The basePath is derived from the URL though, it can't be specified. Hope this helps! |
I think this is now supported, right? So we can close this? |
window.pc = pc;
function startViewer() {
var viewer = new Viewer(document.getElementById("application-canvas"), onSceneReset, onAnimationsLoaded, onMorphTargetsLoaded);
registerElementEvents(viewer);
window.viewer = viewer;
} |
Ah ok, so you've exposed the variable yourself. I also see the problem now: Looks like dependencies aren't loaded for unpacked glTF scenes still. I think it's best to wait for @slimbuck to comment. |
Hi @kungfooman, @willeastcott, This will work correctly once the next version of engine has been released, as it requires playcanvas/engine#2312. Thanks! |
https://github.com/playcanvas/engine/releases/tag/v1.32.3 This should now be fixed! (Please reopen if you any further issues). |
I am not sure how the API is supposed to work:
The AppleTree got these files:
Result:
playcanvas.js:24239 failed to load uri=AppleTree.bin
The text was updated successfully, but these errors were encountered: