Open gabriel-v opened 1 year ago
you should use egg2bam with the embed textures option , that's the standard way of packaging for wasm or android since it the native Panda3D memory format => you need environment.bam
the egg loader has a bad history with wasm, and i'm not sure it was ever fixed. so i'll note a possible bug here. it works fine
You don't need Panda3D vfs when using pygbag since it's redundant, unless you need encryption.
now .egg and .bam should work both, i did not test .pz but there's a tool provided in Panda3D to unpack them.
a default model extension should be set.
see more here https://pygame-web.github.io/wiki/pkg/panda3d/
test here : https://itch.io/c/3724091/panda3d-wasm
An HTTP loader is mounted to the VFS by default, and you can't make directories on the server, so that's why makeDirectory fails.
indeed for file/directory write operations you want to use the normal filesystem (python I/O) which work in browser memory via emscripten MEMFS until tab is closed. For small non volatile writes the simplest way is https://pygame-web.github.io/wiki/pygbag-code/#handling-persistent-data-across-sessions
This is about the panda3d wheel included in pygbag archives.
First, I tried following the panda3d tutorial here: https://docs.panda3d.org/1.10/python/introduction/tutorial/loading-the-grassy-scenery
But it fails at
self.scene = self.loader.loadModel("models/environment")
- even after placing themodels
folder in the browser vfs, even by giving it the full pathself.loader.loadModel("/path/to/models/environment.egg")
.Then, I tried loading the model from memory. But the panda3d
VirtualFileSystem
class doesn't work:same for the "global" VirtualFileSystem: