Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2013-08-05 Thread Sebastian Messerschmidt

Hi Robert,

Sorry for reviving this old thread.
But I stumbled across the exact same problem, and solving this issue 
with the FindFileCallback is a real PITA.
I tried the patch Katharina provided (there is still a typo in here, but 
nevertheless, it solves the issue.)


The problem with the FindFileCallback is that it simply gives you no 
context. In my compiler I need to distinguish files that are referenced 
inside the openflight from those which are searched from other sources 
(e.g. looking up additional textures based on a name scheme).

With the the ReadFileCallback it is much easier to maintain such context.

So I second Katharinas idea.
Implementation-wise I'd provide an option to support calling the 
readfile even if no valid path was found through the FindFileCallback 
and leave the default option to the old behavior.

Would that be exectable?

cheers
Sebastian


HI Katharina,

In the svn/trunk version of the OSG I added support for overriding the
find file operation using an osgDB::FindFileCallback, that you attach
to the osgDB::Registry or an osgDB::Options object.  Perhaps this
would be the best way for you to intercept and do something special
when texture files are not found.

Cheers,
Robert.

On Mon, Sep 21, 2009 at 1:49 PM, Katharina Plugge
katharina.plu...@web.de wrote:

Hello,

the OpenFlight-Plugin prevents reacting on missing Textures via a 
ReadFileCallback, because osgDB::readRefImageFile (called by function 
readTexture) is not called if the file does not exist. Would be great if this 
could be changed.

A fix could look like this (file PaletteRecords.cpp, line 436):

Code:

virtual void readRecord(RecordInputStream in, Document document)
{
if (document.getTexturePoolParent())
// Using parent's texture pool -- ignore this record.
return;

int maxLength = (document.version()  VERSION_14) ? 80 : 200;
std::string filename = in.readString(maxLength);
int32 index = in.readInt32(-1);
/*int32 x =*/ in.readInt32();
/*int32 y =*/ in.readInt32();

osg::StateSet* stateset = NULL;
// Need full path for unique key in local texture cache.
std::string pathname = 
osgDB::findDataFile(filename,document.getOptions());
if (pathname.empty())
{
// allow the aplication to react on missing texture via 
ReadFileCallback
stateset = readTexture(filename,document);
if( !stateset)
{
osg::notify(osg::WARN)  Can't find texture (  index  )   
filename  std::endl;
return;
}
}
else
{
// Is texture in local cache?
osg::StateSet* stateset = 
flt::Registry::instance()-getTextureFromLocalCache(pathname);
}

// Read file if not in cache.
if (!stateset)
{
stateset = readTexture(pathname,document);

// Add to texture cache.

flt::Registry::instance()-addTextureToLocalCache(pathname,stateset);
}

// Add to texture pool.
TexturePool* tp = document.getOrCreateTexturePool();
(*tp)[index] = stateset;
}




Thank you!

Greetings,
Katharina[/code]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=17525#17525





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2013-08-05 Thread Sebastian Messerschmidt

Hi Robert,

I'm preparing a submission right now. Don't hold your breath ...

Hi Sebastien,

I don't really have any strong opinions, nor a submission which to
review.   If you send a full modified file into osg-submissions I can
review it and give you a more informed decions.

Cheers,
Robert.

On 5 August 2013 15:40, Sebastian Messerschmidt
sebastian.messerschm...@gmx.de wrote:

Hi Robert,

Sorry for reviving this old thread.
But I stumbled across the exact same problem, and solving this issue with
the FindFileCallback is a real PITA.
I tried the patch Katharina provided (there is still a typo in here, but
nevertheless, it solves the issue.)

The problem with the FindFileCallback is that it simply gives you no
context. In my compiler I need to distinguish files that are referenced
inside the openflight from those which are searched from other sources (e.g.
looking up additional textures based on a name scheme).
With the the ReadFileCallback it is much easier to maintain such context.

So I second Katharinas idea.
Implementation-wise I'd provide an option to support calling the readfile
even if no valid path was found through the FindFileCallback and leave the
default option to the old behavior.
Would that be exectable?

cheers
Sebastian



HI Katharina,

In the svn/trunk version of the OSG I added support for overriding the
find file operation using an osgDB::FindFileCallback, that you attach
to the osgDB::Registry or an osgDB::Options object.  Perhaps this
would be the best way for you to intercept and do something special
when texture files are not found.

Cheers,
Robert.

On Mon, Sep 21, 2009 at 1:49 PM, Katharina Plugge
katharina.plu...@web.de wrote:

Hello,

the OpenFlight-Plugin prevents reacting on missing Textures via a
ReadFileCallback, because osgDB::readRefImageFile (called by function
readTexture) is not called if the file does not exist. Would be great if
this could be changed.

A fix could look like this (file PaletteRecords.cpp, line 436):

Code:

 virtual void readRecord(RecordInputStream in, Document document)
 {
 if (document.getTexturePoolParent())
 // Using parent's texture pool -- ignore this record.
 return;

 int maxLength = (document.version()  VERSION_14) ? 80 : 200;
 std::string filename = in.readString(maxLength);
 int32 index = in.readInt32(-1);
 /*int32 x =*/ in.readInt32();
 /*int32 y =*/ in.readInt32();

 osg::StateSet* stateset = NULL;
 // Need full path for unique key in local texture cache.
 std::string pathname =
osgDB::findDataFile(filename,document.getOptions());
 if (pathname.empty())
 {
 // allow the aplication to react on missing texture via
ReadFileCallback
 stateset = readTexture(filename,document);
 if( !stateset)
 {
 osg::notify(osg::WARN)  Can't find texture (  index
 )   filename  std::endl;
 return;
 }
 }
 else
 {
 // Is texture in local cache?
 osg::StateSet* stateset =
flt::Registry::instance()-getTextureFromLocalCache(pathname);
 }

 // Read file if not in cache.
 if (!stateset)
 {
 stateset = readTexture(pathname,document);

 // Add to texture cache.

flt::Registry::instance()-addTextureToLocalCache(pathname,stateset);
 }

 // Add to texture pool.
 TexturePool* tp = document.getOrCreateTexturePool();
 (*tp)[index] = stateset;
 }




Thank you!

Greetings,
Katharina[/code]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=17525#17525





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2013-08-05 Thread Robert Osfield
Hi Sebastien,

I don't really have any strong opinions, nor a submission which to
review.   If you send a full modified file into osg-submissions I can
review it and give you a more informed decions.

Cheers,
Robert.

On 5 August 2013 15:40, Sebastian Messerschmidt
sebastian.messerschm...@gmx.de wrote:
 Hi Robert,

 Sorry for reviving this old thread.
 But I stumbled across the exact same problem, and solving this issue with
 the FindFileCallback is a real PITA.
 I tried the patch Katharina provided (there is still a typo in here, but
 nevertheless, it solves the issue.)

 The problem with the FindFileCallback is that it simply gives you no
 context. In my compiler I need to distinguish files that are referenced
 inside the openflight from those which are searched from other sources (e.g.
 looking up additional textures based on a name scheme).
 With the the ReadFileCallback it is much easier to maintain such context.

 So I second Katharinas idea.
 Implementation-wise I'd provide an option to support calling the readfile
 even if no valid path was found through the FindFileCallback and leave the
 default option to the old behavior.
 Would that be exectable?

 cheers
 Sebastian


 HI Katharina,

 In the svn/trunk version of the OSG I added support for overriding the
 find file operation using an osgDB::FindFileCallback, that you attach
 to the osgDB::Registry or an osgDB::Options object.  Perhaps this
 would be the best way for you to intercept and do something special
 when texture files are not found.

 Cheers,
 Robert.

 On Mon, Sep 21, 2009 at 1:49 PM, Katharina Plugge
 katharina.plu...@web.de wrote:

 Hello,

 the OpenFlight-Plugin prevents reacting on missing Textures via a
 ReadFileCallback, because osgDB::readRefImageFile (called by function
 readTexture) is not called if the file does not exist. Would be great if
 this could be changed.

 A fix could look like this (file PaletteRecords.cpp, line 436):

 Code:

 virtual void readRecord(RecordInputStream in, Document document)
 {
 if (document.getTexturePoolParent())
 // Using parent's texture pool -- ignore this record.
 return;

 int maxLength = (document.version()  VERSION_14) ? 80 : 200;
 std::string filename = in.readString(maxLength);
 int32 index = in.readInt32(-1);
 /*int32 x =*/ in.readInt32();
 /*int32 y =*/ in.readInt32();

 osg::StateSet* stateset = NULL;
 // Need full path for unique key in local texture cache.
 std::string pathname =
 osgDB::findDataFile(filename,document.getOptions());
 if (pathname.empty())
 {
 // allow the aplication to react on missing texture via
 ReadFileCallback
 stateset = readTexture(filename,document);
 if( !stateset)
 {
 osg::notify(osg::WARN)  Can't find texture (  index
  )   filename  std::endl;
 return;
 }
 }
 else
 {
 // Is texture in local cache?
 osg::StateSet* stateset =
 flt::Registry::instance()-getTextureFromLocalCache(pathname);
 }

 // Read file if not in cache.
 if (!stateset)
 {
 stateset = readTexture(pathname,document);

 // Add to texture cache.

 flt::Registry::instance()-addTextureToLocalCache(pathname,stateset);
 }

 // Add to texture pool.
 TexturePool* tp = document.getOrCreateTexturePool();
 (*tp)[index] = stateset;
 }




 Thank you!

 Greetings,
 Katharina[/code]

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=17525#17525





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-05 Thread Alexandre Amalric
Hi Brede,

My goal isn't to load Openflight files as fast as possible but to convert
them in IVE file format using the least memory consumption as possible, ie
not reading useless texture.

I think it will be great for the community to bring this change, don't you ?

I will try (as soon as I have time to work on) to modify the plugin to only
read the filenames from the texture palette and store them instead of
storing texture images.
Later, when finding a face using a texture, load the corresponding image.

I don't want to create a specific program with Multigen API to modify
Openflight models because I think the first solution to improve the plugin
is best for the OSG-users and for me of wourse ;-).

Kind regards,

2010/3/3 Brede Johansen bre...@gmail.com

 Hi Alexandre,

 On Wed, Mar 3, 2010 at 11:50 AM, Alexandre Amalric
 alex.pix...@gmail.com wrote:
  Maybe that the original author from this plugin can tell me if the
 texture
  palette record has to be read or not, so we may decide to skip it.
 

 I'm the original author of the OpenFlight reader, the write capability
 was later added by Paul.

 You have to read the texture palette record but you can delay the
 loading of textures until they are actually used by a face or mesh.
 But it would require some modifications to the loader as others have
 already explained.

 Having said that, I want to add that OpenFlight is not a runtime
 format made for fast loading.  Also, the OpenFlight loader was not
 made with fast load times in mind but rather to preserve the structure
 and information in the flt file.

 Gordon wrote this on this mailing list a long time ago:

 The problem with the OpenFlight format along with most other Modeling
 formats is that they contain a lot of information that the Modeling package
 contains and needs and has to support a wide range of uses, Packages, 3d
 API
 packages etc. But the runtime API typically does not need most of the
 information
 So really there is not too much you can do to speed up the reading of an
 OpenFlight file, there are some things you can do such as combine textures
 into one texture ( there are tools in Creator to do this etc) etc. but the
 gain will not be that great.
 All 3d APIs have there own binary format that is more or less a binary dump
 of the tree ( yes I know they are more than that), thus the native binary
 format is always nearly faster than using a native modeling format such as
 OpenFlight, Geo, 3ds, Max etc..
 That's why OSG has IVE, Vega had FST, Vega Prime has VSB, Performer has PFB
 etc..

 So if you want fast loading convert (osgconv) your OpenFlight files to
 ive or the new binary osg format.


 Regards,
 Brede
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
Alexandre AMALRIC   Ingénieur RD
===
PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
http://www.pixxim.fr
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-05 Thread Brede Johansen
Alexandre,

Even if textures in the OpenFlight texture palette are read into
memory doesn't mean they are added to the osg scenegraph.

It would be helpful if you can provide two OpenFlight test models, one
of them with additional unused textures in the palette.
Then we can verify if they differ in size when converted to ive.


Regards
Brede

On Fri, Mar 5, 2010 at 12:44 PM, Alexandre Amalric
alex.pix...@gmail.com wrote:
 Hi Brede,

 My goal isn't to load Openflight files as fast as possible but to convert
 them in IVE file format using the least memory consumption as possible, ie
 not reading useless texture.
 I think it will be great for the community to bring this change, don't you ?
 I will try (as soon as I have time to work on) to modify the plugin to only
 read the filenames from the texture palette and store them instead of
 storing texture images.
 Later, when finding a face using a texture, load the corresponding image.
 I don't want to create a specific program with Multigen API to modify
 Openflight models because I think the first solution to improve the plugin
 is best for the OSG-users and for me of wourse ;-).
 Kind regards,
 2010/3/3 Brede Johansen bre...@gmail.com

 Hi Alexandre,

 On Wed, Mar 3, 2010 at 11:50 AM, Alexandre Amalric
 alex.pix...@gmail.com wrote:
  Maybe that the original author from this plugin can tell me if the
  texture
  palette record has to be read or not, so we may decide to skip it.
 

 I'm the original author of the OpenFlight reader, the write capability
 was later added by Paul.

 You have to read the texture palette record but you can delay the
 loading of textures until they are actually used by a face or mesh.
 But it would require some modifications to the loader as others have
 already explained.

 Having said that, I want to add that OpenFlight is not a runtime
 format made for fast loading.  Also, the OpenFlight loader was not
 made with fast load times in mind but rather to preserve the structure
 and information in the flt file.

 Gordon wrote this on this mailing list a long time ago:

 The problem with the OpenFlight format along with most other Modeling
 formats is that they contain a lot of information that the Modeling
 package
 contains and needs and has to support a wide range of uses, Packages, 3d
 API
 packages etc. But the runtime API typically does not need most of the
 information
 So really there is not too much you can do to speed up the reading of an
 OpenFlight file, there are some things you can do such as combine textures
 into one texture ( there are tools in Creator to do this etc) etc. but the
 gain will not be that great.
 All 3d APIs have there own binary format that is more or less a binary
 dump
 of the tree ( yes I know they are more than that), thus the native binary
 format is always nearly faster than using a native modeling format such as
 OpenFlight, Geo, 3ds, Max etc..
 That's why OSG has IVE, Vega had FST, Vega Prime has VSB, Performer has
 PFB
 etc..

 So if you want fast loading convert (osgconv) your OpenFlight files to
 ive or the new binary osg format.


 Regards,
 Brede
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



 --
 Alexandre AMALRIC                   Ingénieur RD
 ===
 PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
 http://www.pixxim.fr

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-05 Thread Alexandre Amalric
Hi Brede,

The problem isn't in the size of the converted ive file but in the memory
consumption osgconv.exe use when converting this kind of openflight files.
The resulting ive file isn't bigger than expected but the process to convert
the file use too much memory than really needed.

2010/3/5 Brede Johansen bre...@gmail.com

 Alexandre,

 Even if textures in the OpenFlight texture palette are read into
 memory doesn't mean they are added to the osg scenegraph.

 It would be helpful if you can provide two OpenFlight test models, one
 of them with additional unused textures in the palette.
 Then we can verify if they differ in size when converted to ive.


 Regards
 Brede

 On Fri, Mar 5, 2010 at 12:44 PM, Alexandre Amalric
 alex.pix...@gmail.com wrote:
  Hi Brede,
 
  My goal isn't to load Openflight files as fast as possible but to convert
  them in IVE file format using the least memory consumption as possible,
 ie
  not reading useless texture.
  I think it will be great for the community to bring this change, don't
 you ?
  I will try (as soon as I have time to work on) to modify the plugin to
 only
  read the filenames from the texture palette and store them instead of
  storing texture images.
  Later, when finding a face using a texture, load the corresponding image.
  I don't want to create a specific program with Multigen API to modify
  Openflight models because I think the first solution to improve the
 plugin
  is best for the OSG-users and for me of wourse ;-).
  Kind regards,
  2010/3/3 Brede Johansen bre...@gmail.com
 
  Hi Alexandre,
 
  On Wed, Mar 3, 2010 at 11:50 AM, Alexandre Amalric
  alex.pix...@gmail.com wrote:
   Maybe that the original author from this plugin can tell me if the
   texture
   palette record has to be read or not, so we may decide to skip it.
  
 
  I'm the original author of the OpenFlight reader, the write capability
  was later added by Paul.
 
  You have to read the texture palette record but you can delay the
  loading of textures until they are actually used by a face or mesh.
  But it would require some modifications to the loader as others have
  already explained.
 
  Having said that, I want to add that OpenFlight is not a runtime
  format made for fast loading.  Also, the OpenFlight loader was not
  made with fast load times in mind but rather to preserve the structure
  and information in the flt file.
 
  Gordon wrote this on this mailing list a long time ago:
 
  The problem with the OpenFlight format along with most other Modeling
  formats is that they contain a lot of information that the Modeling
  package
  contains and needs and has to support a wide range of uses, Packages, 3d
  API
  packages etc. But the runtime API typically does not need most of the
  information
  So really there is not too much you can do to speed up the reading of an
  OpenFlight file, there are some things you can do such as combine
 textures
  into one texture ( there are tools in Creator to do this etc) etc. but
 the
  gain will not be that great.
  All 3d APIs have there own binary format that is more or less a binary
  dump
  of the tree ( yes I know they are more than that), thus the native
 binary
  format is always nearly faster than using a native modeling format such
 as
  OpenFlight, Geo, 3ds, Max etc..
  That's why OSG has IVE, Vega had FST, Vega Prime has VSB, Performer has
  PFB
  etc..
 
  So if you want fast loading convert (osgconv) your OpenFlight files to
  ive or the new binary osg format.
 
 
  Regards,
  Brede
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 
  --
  Alexandre AMALRIC   Ingénieur RD
  ===
  PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
  http://www.pixxim.fr
 
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
Alexandre AMALRIC   Ingénieur RD
===
PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
http://www.pixxim.fr
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-05 Thread Alexandre Amalric
Hi Brede,

I do not run out of memory, but the process to convert those files is not
optimal, it takes much memory than needed and it takes more time to convert
because of reading all useless textures.

Here at work, I'm asked to optimize the process of our internal files
convertion process (speed and memory). That's not really a problem for all
osg-users but I think it could be usefull for some of them, facing those
kind of openflight files...


2010/3/5 Brede Johansen bre...@gmail.com

 Alexandre,

 The file conversion uses a bit more memory than needed but I fail to
 see the problem.  Do you run out of memory?

 Brede


 On Fri, Mar 5, 2010 at 2:02 PM, Alexandre Amalric alex.pix...@gmail.com
 wrote:
  Hi Brede,
 
  The problem isn't in the size of the converted ive file but in the memory
  consumption osgconv.exe use when converting this kind of openflight
 files.
  The resulting ive file isn't bigger than expected but the process to
 convert
  the file use too much memory than really needed.
  2010/3/5 Brede Johansen bre...@gmail.com
 
  Alexandre,
 
  Even if textures in the OpenFlight texture palette are read into
  memory doesn't mean they are added to the osg scenegraph.
 
  It would be helpful if you can provide two OpenFlight test models, one
  of them with additional unused textures in the palette.
  Then we can verify if they differ in size when converted to ive.
 
 
  Regards
  Brede
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
Alexandre AMALRIC   Ingénieur RD
===
PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
http://www.pixxim.fr
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-05 Thread Brede Johansen
Alexandre,

Ok, I was put off track because you said
My goal isn't to load Openflight files as fast as possible ...

If you decide to fix the OpenFlight files you might be lucky and find
a tool that does the job.
http://www.presagis.com/peer_forum/viewthread/523/


Brede

On Fri, Mar 5, 2010 at 3:50 PM, Alexandre Amalric alex.pix...@gmail.com wrote:
 Hi Brede,

 I do not run out of memory, but the process to convert those files is not
 optimal, it takes much memory than needed and it takes more time to convert
 because of reading all useless textures.
 Here at work, I'm asked to optimize the process of our internal files
 convertion process (speed and memory). That's not really a problem for all
 osg-users but I think it could be usefull for some of them, facing those
 kind of openflight files...

 2010/3/5 Brede Johansen bre...@gmail.com

 Alexandre,

 The file conversion uses a bit more memory than needed but I fail to
 see the problem.  Do you run out of memory?

 Brede

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-03 Thread Trajce (Nick) Nikolov
I know this command in Creator but we want to automatize the process because
we work on hundred of files like this.

Building a creator API is maybe a solution but I don't know if there is a
function to remove unused texture on a Openflight model. I will look for
this.



you dont need any api for this. simply download the openflight spec, read
the palette record, parse the face record and count the used textures, and
clone all the records into new file. Very simple

-Nick


On Tue, Mar 2, 2010 at 10:07 AM, Alexandre Amalric alex.pix...@gmail.comwrote:

 Hi Paul,

 *You'd need to modify the OpenFlight plugin to support this.*

 I tried to do this but in the TexturePalette::readRecord function there is
 no way to know if a texture is used or not by the model. The only parameters
 we get from a texture (RecordInputStream) are :
 - the filename
 - the index
 - X
 - Y

 hi Tomlinsom,

 Simplest way would be to open up the file in Creator and use the remove
 unused textures command

 I know this command in Creator but we want to automatize the process
 because we work on hundred of files like this.

 Building a creator API is maybe a solution but I don't know if there is a
 function to remove unused texture on a Openflight model. I will look for
 this.

 Kind regards,

 2010/3/2 Tomlinson, Gordon gtomlin...@overwatch.textron.com

 Simplest way would be to open up the file in Creator and  use the remove
 unused textures command

 You could also write a simple Creator API app to do this on a list of
 flight files

 Another option would be to load the file in to OSG and save out as  OSG
 or IVE file again you could write a simple script to do this for many
 files


 Gordon Tomlinson
 Product Manager 3d Technology  Project Wyvern
 Overwatch(r)
 An Operating Unit of Textron Systems

 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul
 Martz
 Sent: Monday, March 01, 2010 10:29 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] [osgPlugins] OpenFlight - Palette Records
 prevent using of ReaderWriter Callback

 Alexandre Amalric wrote:
  Hi osg-users,
 
  I have a question concerning the palette texture record. When
  converting a flt model which texture palette contains useless texture,

  they are even read. Is there a way to read only used texture.  Let's
  say I have a simple model file using 1 texture but my texture palette
  in corresponding openflight model contains 100 textures, so 99% are
  useless but the plugin read them.
 
  I know that it is a special case, but when working on Openflight
  models with Multigen Paradigm it happens a lot.
 
  Any suggestion ?

 You'd need to modify the OpenFlight plugin to support this.
-Paul

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
 ghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




 --
 Alexandre AMALRIC   Ingénieur RD
 ===
 PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
 http://www.pixxim.fr

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-03 Thread Alexandre Amalric
Hi Andreas,

Have a look at Remo 3D (www.remograph.com) which supports removing unused
textures in OpenFlight files very easily through scripting. A simple Lua
script would let you remove unused textures in a large number of files.

I just tested Remo3d scripting in Lua, it's very usefull. Unfortunately it
isn't free, if we want to save models with more than 100 polygons we have to
purchase the product.

Hi Jason,

I think what Paul meant is that you'd have to modify the plugin to only load
the texture when it encounters a reference to it in the traversal of the
main document. Currently, it loads the texture palette at the beginning.
You'd have to modify it in some way to delay the actual texture load until a
primary record references it.

I think about this solution since the begining but I'm not sure that those
modifications won't bring errors when using the plugin in a normal way.
Maybe that the original author from this plugin can tell me if the texture
palette record has to be read or not, so we may decide to skip it.


2010/3/3 Trajce (Nick) Nikolov nikolov.tra...@gmail.com

I know this command in Creator but we want to automatize the process because
 we work on hundred of files like this.
 Building a creator API is maybe a solution but I don't know if there is a
 function to remove unused texture on a Openflight model. I will look for
 this.

 you dont need any api for this. simply download the openflight spec, read
 the palette record, parse the face record and count the used textures, and
 clone all the records into new file. Very simple
 -Nick



 On Tue, Mar 2, 2010 at 10:07 AM, Alexandre Amalric 
 alex.pix...@gmail.comwrote:

 Hi Paul,
 *You'd need to modify the OpenFlight plugin to support this.*

 I tried to do this but in the TexturePalette::readRecord function there is
 no way to know if a texture is used or not by the model. The only parameters
 we get from a texture (RecordInputStream) are :
 - the filename
 - the index
 - X
 - Y

 hi Tomlinsom,

 Simplest way would be to open up the file in Creator and use the remove
 unused textures command
 I know this command in Creator but we want to automatize the process
 because we work on hundred of files like this.

 Building a creator API is maybe a solution but I don't know if there is a
 function to remove unused texture on a Openflight model. I will look for
 this.

 Kind regards,

 2010/3/2 Tomlinson, Gordon gtomlin...@overwatch.textron.com

 Simplest way would be to open up the file in Creator and  use the remove
 unused textures command

 You could also write a simple Creator API app to do this on a list of
 flight files

 Another option would be to load the file in to OSG and save out as  OSG
 or IVE file again you could write a simple script to do this for many
 files


 Gordon Tomlinson
 Product Manager 3d Technology  Project Wyvern

 Overwatch(r)

 An Operating Unit of Textron Systems


 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org

 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul
 Martz
 Sent: Monday, March 01, 2010 10:29 AM
 To: OpenSceneGraph Users

 Subject: Re: [osg-users] [osgPlugins] OpenFlight - Palette Records
 prevent using of ReaderWriter Callback

 Alexandre Amalric wrote:
  Hi osg-users,
 
  I have a question concerning the palette texture record. When
  converting a flt model which texture palette contains useless texture,

  they are even read. Is there a way to read only used texture.  Let's
  say I have a simple model file using 1 texture but my texture palette
  in corresponding openflight model contains 100 textures, so 99% are
  useless but the plugin read them.
 
  I know that it is a special case, but when working on Openflight
  models with Multigen Paradigm it happens a lot.
 
  Any suggestion ?

 You'd need to modify the OpenFlight plugin to support this.
-Paul

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
 ghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



 --
 Alexandre AMALRIC   Ingénieur RD
 ===
 PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
 http://www.pixxim.fr

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
Alexandre AMALRIC   Ingénieur RD
===
PIXXIM S.A. 73E, rue Perrin

Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-03 Thread Andreas Ekstrand
Hi Alex,

No it's not free but it's at least much cheaper than Creator. :-)

/Andreas


On 3 mar 2010 11:50 Alexandre Amalric alex.pix...@gmail.com wrote:

 Hi Andreas,
 
 
 
 
 
 Have a look at Remo 3D (http://www.remograph.com) which supports
 removing unused textures in OpenFlight files very easily through
 scripting. A simple Lua script would let you remove unused textures in
 a large number of files.
 
 
 
 
 I just tested Remo3d scripting in Lua, it's very usefull.
 Unfortunately it isn't free, if we want to save models with more than
 100 polygons we have to purchase the product.
 
 
 
 
 Hi Jason,
 
 
 
 
 I think what Paul meant is that you'd have to modify the plugin to
 only load the texture when it encounters a reference to it in the
 traversal of the main document. Currently, it loads the texture
 palette at the beginning. You'd have to modify it in some way to delay
 the actual texture load until a primary record references it.
 
 
 
 
 I think about this solution since the begining but I'm not sure that
 those modifications won't bring errors when using the plugin in a
 normal way. Maybe that the original author from this plugin can tell
 me if the texture palette record has to be read or not, so we may
 decide to skip it.
 
 
 
 
 
 
 
 2010/3/3 Trajce (Nick) Nikolov nikolov.tra...@gmail.com
 
 
 
  I know this command in Creator but we want to automatize the process
  because we work on hundred of files like this.
  
  
  
  Building a creator API is maybe a solution but I don't know if there
  is a function to remove unused texture on a Openflight model. I will
  look for this.
  
  
  
  
  
  
  
  you dont need any api for this. simply download the openflight spec,
  read the palette record, parse the face record and count the used
  textures, and clone all the records into new file. Very simple
  
  
  -Nick
  
  
  
  
  
  
  
  
  
  On Tue, Mar 2, 2010 at 10:07 AM, Alexandre Amalric
  alex.pix...@gmail.com wrote:
  
  
  
   Hi Paul,
   
   
   
   
   
   You'd need to modify the OpenFlight plugin to support this.
   
   
   
   
   I tried to do this but in the TexturePalette::readRecord function
   there is no way to know if a texture is used or not by the model.
   The only parameters we get from a texture (RecordInputStream) are
   :
   
   - the filename
   
   - the index
   
   - X
   
   - Y
   
   
   
   
   hi Tomlinsom,
   
   
   
   
   Simplest way would be to open up the file in Creator and use the
   remove
   unused textures command
   
   
   
   
   I know this command in Creator but we want to automatize the
   process because we work on hundred of files like this.
   
   
   
   Building a creator API is maybe a solution but I don't know if
   there is a function to remove unused texture on a Openflight
   model. I will look for this.
   
   
   
   
   
   Kind regards,
   
   
   
   
   
   2010/3/2 Tomlinson, Gordon gtomlin...@overwatch.textron.com
   
   
   
Simplest way would be to open up the file in Creator and use the
remove
unused textures command




You could also write a simple Creator API app to do this on a
list of

flight files




Another option would be to load the file in to OSG and save out
as OSG

or IVE file again you could write a simple script to do this for
many

files







Gordon Tomlinson

Product Manager 3d Technology  Project Wyvern



Overwatch(r)



An Operating Unit of Textron Systems






-Original Message-
From: osg-users-boun...@lists.openscenegraph.org




[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf
Of Paul
Martz

Sent: Monday, March 01, 2010 10:29 AM

To: OpenSceneGraph Users




Subject: Re: [osg-users] [osgPlugins] OpenFlight - Palette
Records
prevent using of ReaderWriter Callback




Alexandre Amalric wrote:

 Hi osg-users,



 I have a question concerning the palette texture record. When

 converting a flt model which texture palette contains useless
 texture,




 they are even read. Is there a way to read only used texture.
 Let's

 say I have a simple model file using 1 texture but my texture
 palette

 in corresponding openflight model contains 100 textures, so
 99% are

 useless but the plugin read them.



 I know that it is a special case, but when working on
 Openflight

 models with Multigen Paradigm it happens a lot.



 Any suggestion ?




You'd need to modify the OpenFlight plugin to support this.

-Paul




___

osg-users mailing list

osg-users

Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-03 Thread Brede Johansen
Hi Alexandre,

On Wed, Mar 3, 2010 at 11:50 AM, Alexandre Amalric
alex.pix...@gmail.com wrote:
 Maybe that the original author from this plugin can tell me if the texture
 palette record has to be read or not, so we may decide to skip it.


I'm the original author of the OpenFlight reader, the write capability
was later added by Paul.

You have to read the texture palette record but you can delay the
loading of textures until they are actually used by a face or mesh.
But it would require some modifications to the loader as others have
already explained.

Having said that, I want to add that OpenFlight is not a runtime
format made for fast loading.  Also, the OpenFlight loader was not
made with fast load times in mind but rather to preserve the structure
and information in the flt file.

Gordon wrote this on this mailing list a long time ago:

The problem with the OpenFlight format along with most other Modeling
formats is that they contain a lot of information that the Modeling package
contains and needs and has to support a wide range of uses, Packages, 3d API
packages etc. But the runtime API typically does not need most of the
information
So really there is not too much you can do to speed up the reading of an
OpenFlight file, there are some things you can do such as combine textures
into one texture ( there are tools in Creator to do this etc) etc. but the
gain will not be that great.
All 3d APIs have there own binary format that is more or less a binary dump
of the tree ( yes I know they are more than that), thus the native binary
format is always nearly faster than using a native modeling format such as
OpenFlight, Geo, 3ds, Max etc..
That's why OSG has IVE, Vega had FST, Vega Prime has VSB, Performer has PFB
etc..

So if you want fast loading convert (osgconv) your OpenFlight files to
ive or the new binary osg format.


Regards,
Brede
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-02 Thread Alexandre Amalric
Hi Paul,

*You'd need to modify the OpenFlight plugin to support this.*

I tried to do this but in the TexturePalette::readRecord function there is
no way to know if a texture is used or not by the model. The only parameters
we get from a texture (RecordInputStream) are :
- the filename
- the index
- X
- Y

hi Tomlinsom,

Simplest way would be to open up the file in Creator and use the remove
unused textures command

I know this command in Creator but we want to automatize the process because
we work on hundred of files like this.

Building a creator API is maybe a solution but I don't know if there is a
function to remove unused texture on a Openflight model. I will look for
this.

Kind regards,

2010/3/2 Tomlinson, Gordon gtomlin...@overwatch.textron.com

 Simplest way would be to open up the file in Creator and  use the remove
 unused textures command

 You could also write a simple Creator API app to do this on a list of
 flight files

 Another option would be to load the file in to OSG and save out as  OSG
 or IVE file again you could write a simple script to do this for many
 files


 Gordon Tomlinson
 Product Manager 3d Technology  Project Wyvern
 Overwatch(r)
 An Operating Unit of Textron Systems

 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul
 Martz
 Sent: Monday, March 01, 2010 10:29 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] [osgPlugins] OpenFlight - Palette Records
 prevent using of ReaderWriter Callback

 Alexandre Amalric wrote:
  Hi osg-users,
 
  I have a question concerning the palette texture record. When
  converting a flt model which texture palette contains useless texture,

  they are even read. Is there a way to read only used texture.  Let's
  say I have a simple model file using 1 texture but my texture palette
  in corresponding openflight model contains 100 textures, so 99% are
  useless but the plugin read them.
 
  I know that it is a special case, but when working on Openflight
  models with Multigen Paradigm it happens a lot.
 
  Any suggestion ?

 You'd need to modify the OpenFlight plugin to support this.
-Paul

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
 g
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
Alexandre AMALRIC   Ingénieur RD
===
PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
http://www.pixxim.fr
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-02 Thread Andreas Ekstrand

Hi Alex,

Have a look at Remo 3D (www.remograph.com) which supports removing 
unused textures in OpenFlight files very easily through scripting. A 
simple Lua script would let you remove unused textures in a large number 
of files.


/Andreas


On 2010-03-02 09:07, Alexandre Amalric wrote:

Hi Paul,

/You'd need to modify the OpenFlight plugin to support this./

I tried to do this but in the TexturePalette::readRecord function 
there is no way to know if a texture is used or not by the model. The 
only parameters we get from a texture (RecordInputStream) are :

- the filename
- the index
- X
- Y

hi Tomlinsom,

Simplest way would be to open up the file in Creator and use the remove
unused textures command

I know this command in Creator but we want to automatize the process 
because we work on hundred of files like this.


Building a creator API is maybe a solution but I don't know if there 
is a function to remove unused texture on a Openflight model. I will 
look for this.


Kind regards,

2010/3/2 Tomlinson, Gordon gtomlin...@overwatch.textron.com 
mailto:gtomlin...@overwatch.textron.com


Simplest way would be to open up the file in Creator and  use the
remove
unused textures command

You could also write a simple Creator API app to do this on a list of
flight files

Another option would be to load the file in to OSG and save out as
 OSG
or IVE file again you could write a simple script to do this for many
files


Gordon Tomlinson
Product Manager 3d Technology  Project Wyvern
Overwatch(r)
An Operating Unit of Textron Systems

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
mailto:osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org
mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul
Martz
Sent: Monday, March 01, 2010 10:29 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] [osgPlugins] OpenFlight - Palette Records
prevent using of ReaderWriter Callback

Alexandre Amalric wrote:
 Hi osg-users,

 I have a question concerning the palette texture record. When
 converting a flt model which texture palette contains useless
texture,

 they are even read. Is there a way to read only used texture.  Let's
 say I have a simple model file using 1 texture but my texture
palette
 in corresponding openflight model contains 100 textures, so 99% are
 useless but the plugin read them.

 I know that it is a special case, but when working on Openflight
 models with Multigen Paradigm it happens a lot.

 Any suggestion ?

You'd need to modify the OpenFlight plugin to support this.
   -Paul

___
osg-users mailing list
osg-users@lists.openscenegraph.org
mailto:osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or%0Ag
___
osg-users mailing list
osg-users@lists.openscenegraph.org
mailto:osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




--
Alexandre AMALRIC   Ingénieur RD
===
PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
http://www.pixxim.fr


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
   



--
__
Andreas Ekstrand
Remograph
Norrbergavägen 58
SE-590 54 Sturefors
SWEDEN
Web: www.remograph.com
E-mail: andreas.ekstr...@remograph.com
Phone: +46 708 490 697

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-01 Thread Alexandre Amalric
Hi osg-users,

I have a question concerning the palette texture record. When converting a
flt model which texture palette contains useless texture, they are even
read. Is there a way to read only used texture.  Let's say I have a simple
model file using 1 texture but my texture palette in corresponding
openflight model contains 100 textures, so 99% are useless but the plugin
read them.

I know that it is a special case, but when working on Openflight models with
Multigen Paradigm it happens a lot.

Any suggestion ?

2009/9/22 Katharina Plugge katharina.plu...@web.de

 Hi Robert,

 thanks for the fast answer. The idea to use a findFileCallback is not bad
 and I think it would be sufficient for my case. But in my opinion a change
 in the PlugIn would nevertheless be a better solution. Using a
 FindFileCallback does not allow for the differentiation if the file was
 intended to be read or if this is only a general check. (Is it garanteed
 that PlugIns doesnt use findFile to check some unrelevant/optional files or
 the like?)
 Furthermore using a findFileCallback implies an additional check on the
 file extension to find out, if its an image file.


 Cheers,
 Katharina

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=17553#17553





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
Alexandre AMALRIC   Ingénieur RD
===
PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
http://www.pixxim.fr
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-01 Thread Paul Martz

Alexandre Amalric wrote:

Hi osg-users,

I have a question concerning the palette texture record. When converting 
a flt model which texture palette contains useless texture, they are 
even read. Is there a way to read only used texture.  Let's say I have a 
simple model file using 1 texture but my texture palette in 
corresponding openflight model contains 100 textures, so 99% are useless 
but the plugin read them.


I know that it is a special case, but when working on Openflight models 
with Multigen Paradigm it happens a lot.


Any suggestion ? 


You'd need to modify the OpenFlight plugin to support this.
   -Paul

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2010-03-01 Thread Tomlinson, Gordon
Simplest way would be to open up the file in Creator and  use the remove
unused textures command

You could also write a simple Creator API app to do this on a list of
flight files

Another option would be to load the file in to OSG and save out as  OSG
or IVE file again you could write a simple script to do this for many
files


Gordon Tomlinson
Product Manager 3d Technology  Project Wyvern
Overwatch(r)
An Operating Unit of Textron Systems

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul
Martz
Sent: Monday, March 01, 2010 10:29 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] [osgPlugins] OpenFlight - Palette Records
prevent using of ReaderWriter Callback

Alexandre Amalric wrote:
 Hi osg-users,
 
 I have a question concerning the palette texture record. When 
 converting a flt model which texture palette contains useless texture,

 they are even read. Is there a way to read only used texture.  Let's 
 say I have a simple model file using 1 texture but my texture palette 
 in corresponding openflight model contains 100 textures, so 99% are 
 useless but the plugin read them.
 
 I know that it is a special case, but when working on Openflight 
 models with Multigen Paradigm it happens a lot.
 
 Any suggestion ? 

You'd need to modify the OpenFlight plugin to support this.
-Paul

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2009-09-22 Thread Katharina Plugge
Hi Robert,

thanks for the fast answer. The idea to use a findFileCallback is not bad and I 
think it would be sufficient for my case. But in my opinion a change in the 
PlugIn would nevertheless be a better solution. Using a FindFileCallback does 
not allow for the differentiation if the file was intended to be read or if 
this is only a general check. (Is it garanteed that PlugIns doesnt use findFile 
to check some unrelevant/optional files or the like?) 
Furthermore using a findFileCallback implies an additional check on the file 
extension to find out, if its an image file.


Cheers,
Katharina

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=17553#17553





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2009-09-21 Thread Katharina Plugge
Hello,

the OpenFlight-Plugin prevents reacting on missing Textures via a 
ReadFileCallback, because osgDB::readRefImageFile (called by function 
readTexture) is not called if the file does not exist. Would be great if this 
could be changed.

A fix could look like this (file PaletteRecords.cpp, line 436):

Code:

virtual void readRecord(RecordInputStream in, Document document)
{
if (document.getTexturePoolParent())
// Using parent's texture pool -- ignore this record.
return;

int maxLength = (document.version()  VERSION_14) ? 80 : 200;
std::string filename = in.readString(maxLength);
int32 index = in.readInt32(-1);
/*int32 x =*/ in.readInt32();
/*int32 y =*/ in.readInt32();

osg::StateSet* stateset = NULL;
// Need full path for unique key in local texture cache.
std::string pathname = 
osgDB::findDataFile(filename,document.getOptions());
if (pathname.empty())
{
// allow the aplication to react on missing texture via 
ReadFileCallback
stateset = readTexture(filename,document);
if( !stateset) 
{
osg::notify(osg::WARN)  Can't find texture (  index  ) 
  filename  std::endl;
return;
}
}
else
{
// Is texture in local cache?
osg::StateSet* stateset = 
flt::Registry::instance()-getTextureFromLocalCache(pathname);
}

// Read file if not in cache.
if (!stateset)
{
stateset = readTexture(pathname,document);

// Add to texture cache.

flt::Registry::instance()-addTextureToLocalCache(pathname,stateset);
}

// Add to texture pool.
TexturePool* tp = document.getOrCreateTexturePool();
(*tp)[index] = stateset;
}




Thank you!

Greetings,
Katharina[/code]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=17525#17525





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] OpenFlight - Palette Records prevent using of ReaderWriter Callback

2009-09-21 Thread Robert Osfield
HI Katharina,

In the svn/trunk version of the OSG I added support for overriding the
find file operation using an osgDB::FindFileCallback, that you attach
to the osgDB::Registry or an osgDB::Options object.  Perhaps this
would be the best way for you to intercept and do something special
when texture files are not found.

Cheers,
Robert.

On Mon, Sep 21, 2009 at 1:49 PM, Katharina Plugge
katharina.plu...@web.de wrote:
 Hello,

 the OpenFlight-Plugin prevents reacting on missing Textures via a 
 ReadFileCallback, because osgDB::readRefImageFile (called by function 
 readTexture) is not called if the file does not exist. Would be great if this 
 could be changed.

 A fix could look like this (file PaletteRecords.cpp, line 436):

 Code:

    virtual void readRecord(RecordInputStream in, Document document)
    {
        if (document.getTexturePoolParent())
            // Using parent's texture pool -- ignore this record.
            return;

        int maxLength = (document.version()  VERSION_14) ? 80 : 200;
        std::string filename = in.readString(maxLength);
        int32 index = in.readInt32(-1);
        /*int32 x =*/ in.readInt32();
        /*int32 y =*/ in.readInt32();

        osg::StateSet* stateset = NULL;
        // Need full path for unique key in local texture cache.
        std::string pathname = 
 osgDB::findDataFile(filename,document.getOptions());
        if (pathname.empty())
        {
            // allow the aplication to react on missing texture via 
 ReadFileCallback
            stateset = readTexture(filename,document);
            if( !stateset)
            {
                osg::notify(osg::WARN)  Can't find texture (  index  
 )   filename  std::endl;
                return;
            }
        }
        else
        {
            // Is texture in local cache?
            osg::StateSet* stateset = 
 flt::Registry::instance()-getTextureFromLocalCache(pathname);
        }

        // Read file if not in cache.
        if (!stateset)
        {
            stateset = readTexture(pathname,document);

            // Add to texture cache.
            
 flt::Registry::instance()-addTextureToLocalCache(pathname,stateset);
        }

        // Add to texture pool.
        TexturePool* tp = document.getOrCreateTexturePool();
        (*tp)[index] = stateset;
    }




 Thank you!

 Greetings,
 Katharina[/code]

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=17525#17525





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org