If someone wants to add a plugin that supports a new file format (image, sound, model, font, shader?, archive?, spatializer?), this is often cumbersome or impossible. If LÖVR offered some way to register "loaders" for resources in C, plugins could use this to transparently add support for new file formats. One could e.g. require('lovr-fbx') and get FBX support, or require('lovr-basisu') to get basisu support.
I don't know if this is a good idea or not, or what it would look like. The current way to do this for images/sounds is to create a 'blank resource' with the size/format you need, get a pointer to it, and then pass that pointer to the plugin and have it fill in the data. There is something nice/clean about that, but it doesn't work for more complicated resource types and requires you to know metadata about the resource upfront.
If someone wants to add a plugin that supports a new file format (image, sound, model, font, shader?, archive?, spatializer?), this is often cumbersome or impossible. If LÖVR offered some way to register "loaders" for resources in C, plugins could use this to transparently add support for new file formats. One could e.g.
require('lovr-fbx')
and get FBX support, orrequire('lovr-basisu')
to get basisu support.I don't know if this is a good idea or not, or what it would look like. The current way to do this for images/sounds is to create a 'blank resource' with the size/format you need, get a pointer to it, and then pass that pointer to the plugin and have it fill in the data. There is something nice/clean about that, but it doesn't work for more complicated resource types and requires you to know metadata about the resource upfront.