Hi Robert,
I've just beginning me review, rather than merge right away I'll let
the changes and the general design issues settle on me overnight. The
changes are bringing other questions to the fore such as should we
have a default load callback for osg::Image and have a flag to switch
this on. Or perhaps osgDB::Registry could have the default load
callback, and have those who want to use the proxy have it available
to use conveniently. I don't have any conclusions right now though.
On review on problem I did spot was the the void
ProxyLoadImageCallback::load(osg::Image & image) implementation isn't
thread safe as it modifies the Registry during a call. Switching off
the ReadFileCallback isn't something that is probably appropriate even
for the Options, let alone the Registry, although modification of
local copy of the Options object is thread safe, it'd still hide the
ability to locally modify the read implementation. I'm not sure how
to avoid this issue yet though... it would probably require a bit more
intelligence from any ReadFileCallback's that you might implement to
avoid the potential recursion.
Yes there may be things to do about those points. I'll wait for your next post
(after the night ;) )... you'll surely have wiser ideas than mine.
W.r.t warning fixes, I've already checked my own fixes in for
warnings, for all but one of your warning fixes, the only one I needed
to merge was the one to StateSetManipulator.cpp and this is now merged
and submitted to svn/trunk.
W.r.t 3ds plugin, I don't understand why you say the noTextures
options is useless. Could you please explain.
Well I think disabling the loading of images in each reader is too much job, and it adds
too much maintenance in case we find a bug. The solution I used was the
"NoTextureReadFileCallback" (in the file I submitted). It:
- exactly does the same thing,
- is valid for all readers,
- may be replaced by other reader callback (such as for proxy images),
- and does not require to tweak the OSG source code.
Thus the "noTexture" option should be replaced by this simple callback.
Does that sounds right for you? Do you think the NoTextureReadFileCallback
should be available somewhere in OSG?
Cheers,
--
Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/
On Tue, Dec 15, 2009 at 3:35 PM, Sukender <[email protected]> wrote:
Hi Robert,
I've written the image proxy feature we discussed a few days ago. Basically, osg::Image
now accepts a callback that is called every time we access members if "_data"
pointer is NULL. A few notes:
- Code (especially writers) should then call "Image::valid()" instead of
"Image::data() != NULL" if they want to test emptyness: first one tests without doing
proxy loading, whereas the second DOES proxy loading. And after all, it seems more logical to call
the specific valid() method...
- Model writers can write proxy images as if they were loaded by simply adding
a osgDB::WriteFileCallback that uses Image::getFileName() (see attached code:
EmptyImagesWriteFileCallback in ImageProxy_helpers.cpp), or by really loading
them (slower of course).
- You can easily deactivate the loading of images by providing a
osgDB::ReadFileCallback (as before), as well as you can make images be loaded
only when accessed (see attached code: NoTextureReadFileCallback and
DelayedTextureReadFileCallback in ImageProxy_helpers.cpp).
I didn't write more than that. Especially I did not write anything that will
tell the Texture if it should unref the image or not, since I'm not very sure
the discussed proposal is clean enough. This could (and will certainly) be done
later. Of course if a texture unrefs its image, then you'll loose the whole
image data, its filename and its callback. You then won't be able to write the
texture as expected when exporting the scene, except if you create a new Image
and get data back into it.
Also included in this submission are 2 minor MSVC9 warning fixes, and a minor fix for 3DS
plugin (it added useless intermediate groups). I don't 3DS fix as a separate patch
because I've got modifications caused by the image proxy (I removed useless code about
"noTexture" option).
The "ImageProxy_helpers.cpp" file contains code that may be useful in osgDB...
Feel free to include it (somewhere in OSG) or not.
Code is against trunk rev. 10857.
Thank yo for reviewing it.
Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/
_______________________________________________
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
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org