Commit Graph

432 Commits

Author SHA1 Message Date
Robert Osfield
1a683e2f83 From Ulrich Hertlein, "Attached is a patch that introduces 'static_cast<unsigned int>' on some instances where
the code returns '.size()' of a std::vector.  This caused some warnings when using clang++
on OS X."
2013-05-14 16:12:21 +00:00
Robert Osfield
5aa1234fa4 Fixed usage of META_NodeVisitor so it doesn't include "" 2013-01-24 18:48:34 +00:00
Robert Osfield
83f9d0f3e6 Added Options support to ImageSequence LOAD_* functionality 2013-01-18 17:11:49 +00:00
Robert Osfield
22868bce4f From Stephan Huber, "attached you'll find a zip containing some bug-fixes and some refactored + new code.
* ZeroConfDevice does now return FILE_NOT_HANDLED instead of FILE_NOT_FOUND
* present3D supports multiple devices per env-var P3D_DEVICE, separate multiple device with a space

I refactored parts the p3d-plugin, the curl-plugin and parts of Registry and ReaderWriter. Currently the p3d-plugin tries to open all remote files with the help of the curl-plugin.

I added a new method to Registry called getReaderWriterForProtocolAndExtension. which will return a ReaderWriter which is capable in handling the remote file for the given protocol and extension. If no readerwriter is found for the given extension, a list is built of all readerwriters supporting the given protocol and this list is checked for support of wildcards (extension = "*"). If anything matches it get returned.

I added this principle also to the Registry, so now it's possible to register a generic ReaderWriter which can handle all filetypes for a given protocol, similar what curl is doing. All you have to do is to load the plugin at startup. The curl-fallback is still in place.

With these changes it is now possible to reference a movie inside a presentation without a server-address, read the presentation (with curl) and stream the movie with the correct plugin (e.g. QTKit)

"
2012-12-07 19:05:47 +00:00
Robert Osfield
3a67eefd9f Refactored osgDB::Input::readObjectOfType to use a template, and updated associated wrappers to avoid using local static's 2012-11-21 13:38:11 +00:00
Robert Osfield
e72af02c2b Added first step to adding pruning of expired image requests. 2012-11-13 11:45:20 +00:00
Robert Osfield
014f13f774 Refactored ImageSequence to better handle random access usage. 2012-11-08 11:19:31 +00:00
Robert Osfield
1591fe09f3 Added osgGA::Device class for integration of both physical and virtual devices.
Added template readFile(..) function to make it more convinient to cast to a specific object type.

Added support for osgGA::Device to osgViewer.

Added sdl plugin to provides very basic joystick osgGA::Device integration.
2012-10-23 16:15:03 +00:00
Robert Osfield
9fab99ddd9 From Wang Rui, "I modified the Serializer header to add a UPDATE_TO_VERSION_SCOPED
macro, which could set version within brackets and reset it after
that. All related serializers are also modified so that the
backward-compatibility bug reported by Farshid can be fixed.
"

From Robert Osfield, removed the use of osg::Referenced and creating the proxy object on the heap.
2012-10-09 16:05:50 +00:00
Robert Osfield
b32cf216a7 Added ReadQueue::size() method to help with debugging. 2012-09-20 11:14:10 +00:00
Robert Osfield
5d5cf26138 Added osgDB::getSortedDirectoryContents and osgDB::FileNameComparator to help with sorting directory contents into alphabetic and numerical order. 2012-09-12 16:02:02 +00:00
Robert Osfield
794e0e71f4 From Johannes Scholz, fix for writing out of hexidecimal numbers 2012-08-24 15:05:03 +00:00
Robert Osfield
5e315d5fab From Wang Rui, "I'd like to submit the changes that will put ObjectProperty and ObjectMark variables into the InputStream/OutputStream class instead of static ones. This should avoid the threading problem and won't repeatedly reallocate memory for the properties. Some of the wrappers will be slightly modified to use the property variable stored in the InputStream/OutputStream as well." 2012-04-05 13:53:47 +00:00
Robert Osfield
14a563dc9f Ran script to remove trailing spaces and tabs 2012-03-21 17:36:20 +00:00
Robert Osfield
9c5774defb Improved the handling of endian swap of osg::Array 2012-02-29 10:22:56 +00:00
Robert Osfield
e8ac276451 Added s/getByteSwap to teh InputStreamOperator base class and use of this method in the InputStream::start(InputStreamOperator*) method to ensure the bytes are swapped consistently. 2012-02-24 21:07:02 +00:00
Robert Osfield
caceb94db8 From Miha Ravsel, "While trying to create my custom serializer class, i created some dummy data which accidentally popped-up bug in InputStream readObjectFields function.
Bug description:
 Let's say we have class A
namespace Bug
{
class A : public osg::Object
{
public:
  //...
  typedef std::vector<osg::ref_ptr<A> > AList;

protected:
  AList _alist;
  //...
}
}

REGISTER_OBJECT_WRAPPER( A,
                        new Bug::A,
                        Bug::A,
                        "osg::Object Bug::A" )
{
       ADD_LIST_SERIALIZER(A,Bug::A::AList);
}


Bug:
We create say 3 instances of class A: A1,A2,A3 and then we add A2 and A3 and A1 as child instances of A1 so we get next structure:
A1
 |- A2,A3,A1

we call osgDB::writeObjectFile(A1,"/data/a.osgt") -> saved correctly( third element in list is saved as unique id that references parentClass

now we call
A1 = osgDB::readObjectFile("/data/a.osgt");

Everything is deserialized correctely except last element in list which should be same instance as parent A1.

The attached code resolves this issue by passing UniqueID in readObjectFields method and saving object in _identifierMap as soon as we have valid object instance so we can make reference to parent object from any child instance.
"
2012-02-22 10:46:35 +00:00
Robert Osfield
5ac0181cdc From Dietmar Funck, "in order to use a customized database thread it's necessary to use a customized database pager, which creates such customized database threads, too.
I think the best way to achieve this is to overwrite the DatabasePager::addDatabaseThread() method within the customized database pager. However this method is not 'virtual' yet, so I propose to make the method 'virtual'."
2012-02-20 12:33:17 +00:00
Robert Osfield
5f4c155d6b Added back in support for checking the current working directory by default, but now do the check
after the Options and Registry DataFilePathLists have been checked, which will allow users to better control
over where files are searched for.
2012-02-09 14:28:39 +00:00
Robert Osfield
e5a16de7d4 Improved handling of archives 2012-02-03 11:10:17 +00:00
Robert Osfield
d9fd29d996 From Chris Denham, Implementation of write functions in CURL plugin 2012-01-02 16:38:01 +00:00
Robert Osfield
747654fb6d Added removeFromObjectCache method. 2011-11-04 12:44:01 +00:00
Robert Osfield
e04ca06fc8 Fixed build of StreamOperator 2011-10-22 09:02:18 +00:00
Robert Osfield
affe0b4a6d Added support for calling throwException() from InputIterator and added a check for negative string sizes. 2011-10-20 16:35:50 +00:00
Robert Osfield
5fd1ece440 Implemented missing Archive::readShader/writeShader, and added searching of the archive list in Registr::read() so that files
that are stored in the archives can be found.
2011-06-24 12:40:18 +00:00
Robert Osfield
52e3f300e8 Add new macro's to help with serialization of new user objects 2011-06-02 22:07:16 +00:00
Robert Osfield
76b6cd6fa3 From Bradley Anderegg, "Ok, I am re-submitting this with the changes we discussed. That is, there is a default implementation of osgDB::Archive::getDirectoryContents() that uses getFileNames(), and the osgDB::ArchiveExtended header was removed as it is now unnecessary.
Here is a quick list of the modified files:

Archive - getDirectoryContents() no longer pure virtual
Archive.cpp - default getDirectoryContents() implementation
unzip.cpp - modified to fix a bug where the same file will not load twice in a row
ZipArchive.h / ZipArchive.cpp - extends osgDB::Archive and provides support for random access loading within a .zip file
ReaderWriterZip.cpp - modified to use the ZipArchive class"
2011-05-25 09:04:44 +00:00
Robert Osfield
de040e44a0 From Rafa Gata, I've been playing around with serializers in order to use it as a
"generic" property mechanism for osg::Object.

The main problem I have found is that InputStream and OutputStream
only takes the stream when you call start method, and in that case it
attaches to the stream buffer some stuff, useful for files but not for
runtime/gui usage. I have added a simple setInputIterator and
setOutputIterator to the classes so now you can easily serialize
values without version and other stuff.

Writing matrix:
osgDB::OutputStream os(0);
std::stringstream sstream;
os.setOutputIterator(new AsciiOutputIterator(&sstream));
os << matrix;
std::string value = sstream.str();

Reading matrix:
osgDB::InputStream is(0);
std::stringstream sstream(value);
is.setInputIterator(new AsciiInputIterator(&sstream));
osg::Matrixf mat2;
is >> mat2;

From Robert Osfield, added doxygen comments to clarify the role of the methods.
2011-05-16 08:50:59 +00:00
Robert Osfield
066a1f6e72 From Sukender, new ExternalFileWriter helper class that helps the management of writing out external files to disk
avoid writing out of duplicates.
2011-05-12 13:27:14 +00:00
Robert Osfield
b4b88e9549 Added osg::ref_ptr<osgDB::Archive> osgDB::Registry::getRefFromArchiveCache() and osg::ref_ptr<osgDB::Object> osgDB::Registry::getRefFromObjectCache(). 2011-05-06 16:46:13 +00:00
Robert Osfield
02e97c0f79 Fixed build problem 2011-05-06 09:00:46 +00:00
Robert Osfield
fbfc19d3ec Fixed Coverity reported issue.
CID 11844: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _defaultValue is not initialized in this constructor nor in any functions that it calls.
Index: ../include/osgDB/Serializer
2011-05-05 12:37:00 +00:00
Robert Osfield
b4353c1a8e Added following methods to osgDB::Archive in support of work by Fradley Anderegg on .zip archive support:
/** Get the file name which represents the archived file.*/
       virtual std::string getArchiveFileName() const = 0;

       /** return type of file. */
       virtual FileType getFileType(const std::string& filename) const = 0;

       /** return the contents of a directory.
       * returns an empty array on any error.*/
       virtual DirectoryContents getDirectoryContents(const std::string& dirName) const = 0;

Added implementations of these new methods into src/osgPlugins/osga/OSGA_Archive.h src/osgPlugins/osga/OSGA_Archive.cpp
2011-04-29 16:34:26 +00:00
Robert Osfield
4d0b96c074 From Sukender, Here is a tiny update to FileNameUtils. It brings getPathRoot() and isAbsolutePath() to the public side of the lib. 2011-04-20 19:20:28 +00:00
Robert Osfield
cfb19182e6 From Bradley Anderegg, "The first change just exposes the archive extension list so that
external applications can determine if an archive extension is valid.

The second change is a bug fix in Registry::read(const ReadFunctor&)
where if you pass in valid options they get wiped out after the archive
is loaded but before being passed along to the plugin."
2011-04-19 14:11:13 +00:00
Robert Osfield
70dfd11531 From Tim Moore,
Fixes to race in DatabasePager where a parent PagedLOD
of newly loaded subgraph has been expired.

Clean up of visitor naming to make it clearer what role it has.
2011-03-30 15:15:07 +00:00
Robert Osfield
d3d0859b4c From Piotr Gwiazdowski, "So there's config setting OSG_DISABLE_MSVC_WARNINGS which should
disable pragmas that turn off specific warnings for MSVC.
Unfortunately it's presence is only checked in osg/Export header,
making other Export headers disable warnings no matter what, which is
kind of incoherent.

My fix adds #include <osg/Config> to every Export header. I've also
unified checking whether to disable warnings to current osg/Export
way:
#if defined(_MSC_VER) && defined(OSG_DISABLE_MSVC_WARNINGS).

Attachment contains all changed Export files in their original locations."
2011-03-09 14:15:04 +00:00
Robert Osfield
b24353b12c From Rafa Gaitan and Jorge Izquierdo, build support for Android NDK.
"- In order to build against GLES1 we execute:
$ mkdir build_android_gles1
$ cd build_android_gles1
$ cmake .. -DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF
-DDYNAMIC_OPENSCENEGRAPH=OFF -DANDROID_NDK=<path_to_android_ndk>/
-DOSG_GLES1_AVAILABLE=ON -DOSG_GL1_AVAILABLE=OFF
-DOSG_GL2_AVAILABLE=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF -DJ=2
-DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF
$ make
 If all is correct you will have and static OSG inside:
build_android_gles1/bin/ndk/local/armeabi.

- GLES2 is not tested/proved, but I think it could be possible build
it with the correct cmake flags.
- The flag -DJ=2 is used to pass to the ndk-build the number of
processors to speed up the building.
- make install is not yet supported."
2011-03-08 16:35:37 +00:00
Robert Osfield
98b1f15a45 Added copyop parameter to cloneOptions() method 2011-02-14 16:05:33 +00:00
Robert Osfield
37cc59fe07 From Tim Moore, "The non-virtual cloneOptions() method, which is now used by DatabasePager, breaks derived classes of osgDB::Options. This patch uses the clone() method to clone Options." 2011-02-14 15:59:49 +00:00
Robert Osfield
e0924886bd Added support for enabling the assignment of PixelBufferObjects to loaded Images to aid the download of images to the GPU.
Feature can be enabled/disabled (default) by setting the env :

   OSG_ASSIGN_PBO_TO_IMAGES  to ON or OFF
2011-02-04 12:43:00 +00:00
Robert Osfield
f9428e9f45 From Mathias Froehlich, build fix for Solaris 2011-01-26 16:45:36 +00:00
Robert Osfield
43afbab09e From Sukender, getPathRelative() method. 2011-01-21 11:46:15 +00:00
Robert Osfield
26c313e258 Added export to see if it address Mingw link problems 2011-01-20 12:34:41 +00:00
Robert Osfield
2dc0247bd9 From Per Fahlberg, warning fixes 2011-01-20 12:27:51 +00:00
Robert Osfield
bc6a94c5b3 From Michael Platings, "I've attached a fix for a subtle bug that causes animations (and quite possibly other things) to be serialized incorrectly.
For the following code:

#define MYMACRO(NAME) myOutputStream << #NAME;
MYMACRO(Group)

you would expect that "Group" would be output. However, as there are many overloaded operator<< functions, none of which take a const char* argument, the function that's actually called is operator<<(bool). Hence what actually gets output is "TRUE".
An actual example of this is in serializers\osgAnimation\Animation.cpp, WRITE_CHANNEL_FUNC2.

So the simple solution to this is to add operator<<(const char*), attached.
"
2011-01-18 16:14:24 +00:00
Robert Osfield
b0dd272186 From Brad Christiansen, "Attached is a fix which implements the lazy loading of optional layers (if requested) in the new osgb/osgt formats." 2011-01-14 11:00:11 +00:00
Robert Osfield
1b67e3ad1f Added ImageProcessor interface class and plugin mechnanism for ImageProcessor implementations to osgDB::Registry.
Add NVidiaTextureTools based plugin that provides an ImageProcessor implementation within an nvtt plugin.
2011-01-13 14:59:29 +00:00
Robert Osfield
f61a6aa4e7 Refactored the way that the DatabasePager passes the Terrain decorator node onto the TerrainTile.
The DatabasePager now passes the Terrain pointer into the ReaderWriter's via osgDB::Options object,
rather than pushing a NodePath containing the Terrain onto NodeVisitor.  This
change means that the DatabasePager nolonger needs to observer the whole NodePath and
will be lighter and quicker for it.

The change also means that ReadFileCallback can now run custom NodeVisitor's on the scene graph without
having to worry about TerrainTile's constructing scene graphs prior to the Terrain being assigned.

Also changed is the NodeVisitor::DatabaseRequestHandler which now requires a NodePath to the node that you wish
to add to rather than just the pointer to the node you wish to add to.  This is more robust when handling scenes
with multiple parental paths, whereas previously errors could have occurred due to the default of picking the first
available parental path.  This change means that subclasses of DatabasePager will need to be updated to use this new
function entry point.
2011-01-12 19:29:24 +00:00
Robert Osfield
410b4fd109 Converted FrameStamp::g/setFrameNumber from int to uint 2010-12-22 20:11:05 +00:00