[osg-users] Loading from directory, not file

Robert Osfield robert.osfield at gmail.com
Wed Jul 15 00:26:26 PDT 2015


Hi Aaron,

The ReaderWriter mechanism is built around the Chain-Of-Responsibility
pattern so it's actually up to the ReaderWriter implementation to decide
what files it can handle, you don't even need an file extension, or for the
filename to even be an actual file or path name - this allows one to
implement various psuedo loaders that various different things such as
pre-processing of loaded models or paging.

The only place that the extensions are stricktly checked is when initially
loading the plugins - if no plugin that has already been loaded can handle
a particle read*File() request then osgDB::Registry checks the extension
and loads the plugin associated with that plugin.  In the case of psuedo
plugin the filename won't be mapping directly to a file system file so the
one either pre-loads these plugins, or append a .myplugin to filename and
then strip the ".myplugin" inside the the ReaderWriter.  The .rot, .trans,
.scale, .curl, .gdal plugins are all examples of plugins that use this
approach.

In your case I'd recommend supporting both these approproaches - support
the dummy extension that maps to your plugin name as well as support usage
without the extension.

Robert.



On 15 July 2015 at 00:01, Aaron Andersen <aaron at fosslib.net> wrote:

> I will preface this by saying I'm quite new to open scene graph, so if I'm
> missing something obvious please forgive me.
>
> I have a node/scene format I would like to implement in open scene graph.
> The data for the format is encapsulated in multiple files within a
> directory, not within a single file.
>
> How can I make a reader writer for a directory as opposed to a file? The
> ReaderWriter api is geared toward files (supportedExtension) and this is
> leaving me a little confused.
>
> Any help or guidance would be greatly appreciated.
>
> Thank you,
> Aaron
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150715/33dc9018/attachment-0003.htm>


More information about the osg-users mailing list