Hi Rui,

I have finally found some time to have a look at this issue, and would love to 
get a fix implemented before 3.0, but I am not having much luck.
I have previously managed to add a user serializer to VirtualPlanetBuilder 
without issue to add support for some extra options, but am getting nowhere 
with the ImageLyer serializer.

I changed the code exactly as you suggested and have added the required check / 
read and write functions. I am pretty sure I can implement these ok but I cant 
get things compiling with simple stub implementations that simply return true.

The compile error I am getting is:

2>  ImageLayer.cpp
2>..\..\..\..\..\..\..\Source\src-osg\src\osgWrappers\serializers\osgTerrain\ImageLayer.cpp(52):
 error C2664: 'osgDB::UserSerializer<C>::UserSerializer(const char *,bool 
(__cdecl *)(const C &),bool (__cdecl *)(osgDB::InputStream &,C &),bool (__cdecl 
*)(osgDB::OutputStream &,const C &))' : cannot convert parameter 3 from 'bool 
(__cdecl *)(osgDB::InputStream &,const osgTerrain::ImageLayer &)' to 'bool 
(__cdecl *)(osgDB::InputStream &,C &)'
2>          with
2>          [
2>              C=MyClass
2>          ]
2>          This conversion requires a reinterpret_cast, a C-style cast or 
function-style cast

After examing the the VirtualPlanetBuilder code I modified for an earlier 
submission, I think I need to register a lookup (or something like that) to 
solve the issue but my C++ skills just arnt up to the job of figuring out 
exactly what it is I need to do. Any suggestions or simple examples I could 
look at would be greatly appreciated.

Cheers,
Brad


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Wang Rui
Sent: Tuesday, 30 November 2010 1:47 PM
To: [email protected]
Subject: Re: [osg-users] Limitation in current ImageLayer serializer

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



DISCLAIMER:---------------------------------------------------------------------------
This e-mail transmission and any documents, files and previous e-mail messages
attached to it are private and confidential. They may contain proprietary or 
copyright
material or information that is subject to legal professional privilege. They 
are for
the use of the intended recipient only.  Any unauthorised viewing, use, 
disclosure,
copying, alteration, storage or distribution of, or reliance on, this message is
strictly prohibited. No part may be reproduced, adapted or transmitted without 
the
written permission of the owner. If you have received this transmission in 
error, or
are not an authorised recipient, please immediately notify the sender by return 
email,
delete this message and all copies from your e-mail system, and destroy any 
printed
copies. Receipt by anyone other than the intended recipient should not be 
deemed a
waiver of any privilege or protection. Thales Australia does not warrant or 
represent
that this e-mail or any documents, files and previous e-mail messages attached 
are
error or virus free.
--------------------------------------------------------------------------------------

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

Reply via email to