Hi Robert,
This is the memory management patch, without the callback. If you are
interested in... use it. :-)
Regards,
Vincent.
Le 19/02/2010 16:40, Vincent Bourdier a écrit :
Hi Robert,
osgcallback already implements a ReadFilecallback... so I don't know
if it will be useful to make an example.
If you want I can make a wiki page, but for that could you tell me
were to put it ?
Thanks.
Regards,
Vincent.
Robert Osfield a écrit :
Hi Vincent,
On Fri, Feb 19, 2010 at 2:09 PM, Vincent Bourdier
<[email protected]> wrote:
I implemented my own ReadFile callback, working well.
Yay! :-)
Would you (and osg) be interested in having it ? I can submitt in
directly
in osg src.
It's probably a bit too domain specific to be part of the OSG, perhaps
an example with it in would be good, or an example on the wiki so that
if others want to use the same techniques then they could deploy.
I implemented if for WIN32 only, so someone should implement the other
version...
For the moment, it uses psapi.lib ... not very portable but maybe
someone
can help be making it portable and without
other dependencies.
I don't even know was psapi.lib is... ;-)
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4880 (20100219) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
Index: include/osgDB/ReaderWriter
===================================================================
--- include/osgDB/ReaderWriter (revision 10288)
+++ include/osgDB/ReaderWriter (working copy)
@@ -208,6 +208,7 @@
FILE_LOADED, //!< File successfully found, loaded, and
converted into osg.
FILE_LOADED_FROM_CACHE, //!< File found in cache and
returned.
ERROR_IN_READING_FILE, //!< File found, loaded, but an
error was encountered during processing.
+ INSUFFICIENT_MEMORY_TO_LOAD, //!< File
found but not loaded because estimated memory usage is not enought
FILE_REQUESTED //!< Asyncronous file read has been
requested, but returning immediatiely, keep polling plugin till file read has
been completed.
};
@@ -248,6 +249,7 @@
bool error() const { return _status==ERROR_IN_READING_FILE; }
bool notHandled() const { return _status==FILE_NOT_HANDLED; }
bool notFound() const { return _status==FILE_NOT_FOUND; }
+ bool notEnoughMemory() const { return
_status==INSUFFICIENT_MEMORY_TO_LOAD; }
protected:
Index: src/osgDB/DatabasePager.cpp
===================================================================
--- src/osgDB/DatabasePager.cpp (revision 10288)
+++ src/osgDB/DatabasePager.cpp (working copy)
@@ -552,6 +552,7 @@
if (rr.validNode()) databaseRequest->_loadedModel = rr.getNode();
if (rr.error()) osg::notify(osg::WARN)<<"Error in reading file
"<<databaseRequest->_fileName<<" : "<<rr.message() << std::endl;
+ if (rr.notEnoughMemory())
osg::notify(osg::DEBUG_INFO)<<"Not enought memory to load file
"<<databaseRequest->_fileName << std::endl;
if (databaseRequest->_loadedModel.valid() &&
osgDB::containsServerAddress(databaseRequest->_fileName) &&
Index: src/osgDB/ReadFile.cpp
===================================================================
--- src/osgDB/ReadFile.cpp (revision 10288)
+++ src/osgDB/ReadFile.cpp (working copy)
@@ -69,6 +69,7 @@
ReaderWriter::ReadResult rr =
Registry::instance()->readNode(filename,options);
if (rr.validNode()) return rr.takeNode();
if (rr.error()) notify(WARN) << rr.message() << std::endl;
+ if (rr.notEnoughMemory()) notify (DEBUG_INFO) << "Not enought memory to
load file "<<filename << std::endl;
return NULL;
}
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org