Hi Brad,
In fact when I'm working on the osgTerrain serializers, I don't pay
much attention to the special mechanism that may be required when
loading terrain tile and layer classes. For the case that the image
layer may be loaded inactive according to an additional flag, I
suggest that we should handle all of these with a user serializer
instead, that is,
REGISTER_OBJECT_WRAPPER( osgTerrain_ImageLayer,
new osgTerrain::ImageLayer,
osgTerrain::ImageLayer,
"osg::Object osgTerrain::Layer
osgTerrain::ImageLayer" )
{
ADD_USER_SERIALIZER( Image ); // _image
}
And write/read images and activate them by ourselves. Here we can read
out an image object from the input stream using is.readImage(), and
write image to disk files with the << operator.
Hope this can help if you would like to help fix the problem. :-)
Cheers,
Wang Rui
2010/11/30 Brad Christiansen <[email protected]>:
> Hi,
>
> I have discovered a piece of missing functionality in the new serializer for
> osgTerrain::ImageLayers. The issue is that all optional layers are loaded
> when an osgb file is loaded regardless of weather they should be or not.
>
> The relevant piece of code for the the .ive format is in (in osgDB_ive)
> "void ImageLayer::read(DataInputStream* in)" at line 64:
>
> bool deferExternalLayerLoading =
> osgTerrain::TerrainTile::getTileLoadedCallback().valid() ?
>
> osgTerrain::TerrainTile::getTileLoadedCallback()->deferExternalLayerLoading()
> : false;
> // Should we read image data from stream
> IncludeImageMode includeImg = (IncludeImageMode)in->readChar();
>
> if (includeImg==IMAGE_REFERENCE_FILE && deferExternalLayerLoading)
> {
> setFileName(in->readString());
> }
> else
> {
> setImage(in->readImage(includeImg));
> }
>
> The new serializer simple adds an image serializer for an ImageLayer with no
> similar checks.
>
> I have had a quick look at coding a fix but have to admit I still dont fully
> understand how the new system works in such cases. If anyone can give me some
> pointers on how to go about adding this functionality that would be greatly
> apprecaited as at the momment I am having to covert my terrain databases back
> to .ive.
>
> For reference, I discovered the issue as my osgb databses where laoding alot
> slower than my ive based ones. The reason was that all optional layers were
> being loaded even if they weren't active.
>
>
> Cheers,
> Brad
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=34231#34231
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org