Hi Robert,

As suggested, here is the modified helper to write images/shaders/vegetables.
Please note that I did not find better than a dynamic_cast to detect if passed 
object is an image, shader, or whatever. If you don't find better too, maybe 
the unique "write" method should be split into writeImage, writeShader, etc.?

Also find the modified FBX plugin. The DAE will be submitted soon.

Please review and tell me what you think about it.
Cheers,

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/

----- "Sukender" <[email protected]> a écrit :

> Okay for vegetables then! But just a few (silly?) questions:
> How do I call the appropriate write method? Just using a default
> WriteFileCallback or similar? If not, can I ensure the osgDB::Options
> is correctly passed? And finally, how will I handle differences (ex:
> images must be "8.3" in 3DS, potatoes can't be in a subdirectory for
> ".vegetable" format, etc.?)
> 
> Sukender
> PVLE - Lightweight cross-platform game engine -
> http://pvle.sourceforge.net/
> 
> ----- "Robert Osfield" <[email protected]> a écrit :
> 
> > Hi Sukender,
> >
> > On Thu, Apr 21, 2011 at 4:05 PM, Sukender <[email protected]> wrote:
> > > First of all: agreed to make it work for all (images, shaders,
> > potatoes...)
> >
> > Perhaps we should generalize to supporting vegtables rather thean
> > specifically potatoes ;-)
> >
> > I think it should be relatively straight forward to handling
> > osg::Object's and let the class call the appropriate osgDB::write
> > method.
> >
> >
> >
> > > About features:
> > >>  1) Enable writing out of images only once
> > >>  2) Handling of paths that are absolute or relative.
> > >>  3) Handles directory creation when paths don't just exist
> > >
> > > Additionnal feature:
> > >  2.1) Also get the absolute path where it was written, as well as
> > the path relative to the "main file" (= the 3D model)
> > >  2.2) Also generate writing paths which may keep original
> directory
> > structure ("_keepRelativePaths" member).
> > >     Ex: Reading model.osg, which has "images/img1.jpg".
> > >         Writing "/somePath/newmodel.osg" and
> > "/somePath/images/img1.jpg"
> > >         Of course, with the option disabled, this may write
> > "/somePath/img1.jpg"
> > >  4) Duplicate handling: avoid writing two different images (or
> > "things") at the same place.
> >
> > So this would be renaming when the same filename is requested but
> the
> > actual Object being passed
> > in isn't the same?
> >
> > > What should also be added:
> > >  5) Handling of naming constraints (such as "8.3" names in 3DS)
> > >
> > >
> > > About "caching" values, yes that's true FOR NOW the write() comes
> > just after. So, I agree to merge setCurImage() and write()
> > ("writeImage()", then?). But this also makes getCurAbsolutePath()
> and
> > getCurRelativeOrAbsolutePath() return paths where image was written.
> > So maybe the writeImage() should return a pair of strings (or fill a
> > structure)?
> >
> > This type of state data associated with an operation should probably
> > be passed into the write method via a reference or passed back as a
> > result, these two approaches would avoid state being stored.
> >
> >
> > > And finally, what about "WriterHelper" or "ExternalFileWriter"?
> >
> > ExternalFileWriter would probably be my current preference, although
> > I
> > am sure we could find a better name.  Can't think of a better one
> > right now... Perhaps others can chip in.
> >
> > Robert.
> > _______________________________________________
> > osg-submissions mailing list
> > [email protected]
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Attachment: ExternalFileWriter.7z
Description: application/7z-compressed

_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to