Feature request : virtual FileSystem (FileSystem.h)

19 views
Skip to first unread message

Julien Matthey

unread,
Sep 12, 2024, 12:19:21 PM9/12/24
to G3D Users
Hello,

Is there any chance that `FileSystem` could be made `virtual`, with the current implementation being the default one ?

If so it would help in implementing custom logic for custom filesystems, i.e. file systems that are not plain files on disk or zip files.

So far I was able to "hack" into `FileSystem.cpp` to insert my own logic and give access to a custom/homemade filesystem but it would be so much cleaner through a virtual interface.

If no one is up to this feature request I can offer my help. I will work on G3D again in a few months from now when I'm ready.

Thank you.

-Julien

Morgan McGuire

unread,
Sep 12, 2024, 5:52:11 PM9/12/24
to g3d-...@googlegroups.com
Because it is a singleton implemented via static methods, that would be hard to do without changing a lot of APIs. But we can work together on either adding the functionality that you need or making some plugin API so that you can expand its functionality. Internally it does have a hidden single instance that could be replaceable; the static methods all call into that one.

-m


--
You received this message because you are subscribed to the Google Groups "G3D Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to g3d-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/g3d-users/592383f1-27d3-4deb-9a16-2680d6dd20e9n%40googlegroups.com.

Julien Matthey

unread,
Sep 13, 2024, 8:08:02 AM9/13/24
to G3D Users
You are right this would be complicated.

In fact I can make my custom filesystem compatible by just hacking into the implementation (FileSystem.cpp) and not touching the header file (FileSystem.h). I also had to hack into BinyInput.cpp.

The idea is to have a "layer" between FileSystem and actual file data (which could be "anywhere"). I called this layer "urlfs" (files are "determined" [1-1] by a url, url-schemes are arbitrary; file://, http://, custom schemes for custom filesystems [zipfs://], etc...).

The only issue I have with "G3D::FileSystem" is that it assumes files are on disk as plain files or in a zip file. This leaves no room for implementations of custom filesystems. Nowadays, all games and game engines use some sort of custom filesystem implemented in one or several files on disk.

I cannot ditch G3D::FileSystem because I want to benefit from the excellent work done with the shaders, but I can't distribute said shaders as plain files on disk, bundled with an app.

Ideally we would have:

G3D::FileSystem
vvvvvvvvvvvvvvv
"urlfs" (or any layer that allows seeking files in a custom filesystem)
vvvvvvvvvvvvvvv
actual "files" (on disk; on the internet; in a custom filesystem; anything that can be fetched with an url)

Just my 2 cents lol.

I will work towards a decent solution eventually and propose it here.

Morgan McGuire

unread,
Oct 21, 2024, 11:33:29 AM10/21/24
to g3d-...@googlegroups.com
I look forward to the proposal. I’d also like a way to abstract non-zip virtual file system blobs and URL resources.

(’m aware of a patch for URLs and CDNs but have not yet been able to convince the developer to open source it. That’s their right and why we use BSD instead of GPL licenses, but I still have hope :)

-m

Reply all
Reply to author
Forward
0 new messages