Commit Graph

468 Commits

Author SHA1 Message Date
Robert Osfield
1fcb91900a Replaced Widget::GraphicsSubgraph with GraphicsSubgraphMap to allow finer control of when the rendering subgraphs are done. 2014-05-28 10:06:14 +00:00
Robert Osfield
0b5b3213fe Addd method implementation in serializers 2014-05-21 16:15:02 +00:00
Robert Osfield
e16eb147a1 From Sebastian Messerschmidt, "attached is the compile/linker fix for multiple definitions of getTypeEnum when compiling the Lua with VisualStudio and potentially other compilers.
"
2014-04-30 11:51:40 +00:00
Robert Osfield
b6404d18c3 From Pjotr Svetachov, "Today I found a bug in the IutputStream class when saving array
attributes in vec3b format. It looks like my compiler takes the wrong
overload and outputs integers instead of characters. The problem is
that vec3b is of type signed char and that is not the same as char (
see http://stackoverflow.com/questions/436513/char-signed-char-char-unsigned-char
) and visual studio 2013 will promote it to integer when choosing an
overload.
It looks like that the InputStream class already takes care of this
issue (if it didn't it would have read everything ok and I would have
not even stumbled upon this bug. :) )"
2014-04-29 13:41:35 +00:00
Robert Osfield
9319350176 Added support for osg::Image to the lua plugin. 2014-03-06 10:27:26 +00:00
Robert Osfield
218e36b12b Relaxed the handling of Image objects 2014-03-04 13:35:27 +00:00
Robert Osfield
de09adcaa9 Added MapReverseIterator implementation. 2014-02-27 10:02:55 +00:00
Robert Osfield
46381cb15c Added MapIteratorObject and support for it in the lua plugin to provide map iterator functionality. 2014-02-26 18:18:08 +00:00
Robert Osfield
9394215d31 Added Map serializer size() method and support for it in the lua plugin. Renamed functions in lua plugin to be more consistent. 2014-02-26 11:01:35 +00:00
Robert Osfield
69e9f2c973 Added support for vector and map containers in osgDB::Serailizer's and lua plugin. 2014-02-26 08:26:51 +00:00
Robert Osfield
4ef5d9eb5f Added Vector serialization and support in lua plugin top enable script users to set/get vector properties such as osg::Array, osg::PrimitiveSet and children lists. 2014-02-24 10:19:48 +00:00
Robert Osfield
743a6b049c Added initial support for wrapping osg::Array in a way that can be used via scripting. 2014-02-12 18:03:53 +00:00
Robert Osfield
8bbbea1274 Fixed handling of assignment of User Object's that replace existing Object with the specified propertyName. 2014-02-11 18:18:48 +00:00
Robert Osfield
2797e8cb7c Improved support for setting/getting properties via the osg::UserDataContainer. 2014-02-11 18:07:37 +00:00
Robert Osfield
31e98b51df Added support for serailizing and scripting BoundingBox and BoundingSphere objects 2014-02-10 16:44:13 +00:00
Robert Osfield
3dcca431a9 Fixed handling of setting member variables via the Serializers when the value is the default.
Added support for more features of the osgDB::Widget class.

Fixed handling of boolean values in the Lua plugin
2014-02-08 17:53:51 +00:00
Robert Osfield
1319c2d281 Added support for enum's in the Lua script integration 2014-02-08 10:39:20 +00:00
Robert Osfield
99eb81e743 Added support for casting objects to allow one to access a parent classes methods. 2014-02-06 11:25:37 +00:00
Robert Osfield
6490f1b6a5 Moved osgDB::MethodObject from lua plugin into osgDB, added support for running methods via the osgDB::PropertyInterface class.
Updated lua plugin to use new osgDB::PropertyInterface to run methods.

Added addChild/removeChild() etc to Group.cpp, and addDrawable/removeDrawable() etc. to Geode.cpp serializers.
2014-01-06 15:45:46 +00:00
Robert Osfield
477951b924 Replaced readShaderFile() usage to readRefShaderFile() 2013-11-26 10:38:35 +00:00
Robert Osfield
eb7c2ae3f7 Added set/get to the ImageSerializer and removed some redudent comments 2013-10-10 20:43:03 +00:00
Robert Osfield
4e4d2b35cf Added get/set method to Serializer to allow pointer passing without going through InputStream/OutputStream. 2013-10-10 09:28:26 +00:00
Robert Osfield
9c53794bc7 Implemented preliminary readNode/readImage support in the lua plugin allow a lua script to create a scene graph as return it. 2013-10-09 15:32:56 +00:00
Robert Osfield
c77dc4fe9e Added createObject() interface 2013-10-04 16:29:45 +00:00
Robert Osfield
69f2fb56b3 From Colin McDonald and Robert Osfield, "When a serializer shared library is loaded it registers all of
the wrappers it contains.  The registration creates a prototype
object for all of the wrapped classes.  For some of the higher-level
classes this can be a bit heavy.

I noticed a problem with a model which required a single class from
osgSim.  When osgdb_serializers_osgsim.so was loaded it registered
wrappers and created prototype objects for all of the osgSim classes,
including osgSim::ScalarBar.  The constructor for that class creates
several drawables, and loads arial.ttf using the freetype plugin.  I
don't need that, and don't even ship the font or plugin with my
application, resulting in an unexplained warning message loading
the model.

I've modified the ObjectWrapper class to defer the prototype object
creation until if & when actually required."
2013-10-02 13:59:00 +00:00
Robert Osfield
6e3f893a0e Added type maps to help with querrying supported type names 2013-09-20 10:04:50 +00:00
Robert Osfield
250d9f2ed7 Introduce osgDB::PropetyInterface class that provided a generic interface for get/setting properties on scene graph objects, utilizing the osgDB serializers to do
the actual interface query and set/gets.
2013-09-19 16:19:32 +00:00
Robert Osfield
24ecfb1a48 Added access methods to Serializer to help with using wrappers for other purposes such as script integration.
Added Vec*i and Vec*ui support to serializers
2013-09-11 15:44:08 +00:00
Robert Osfield
097aedf23c From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
Robert Osfield
4fd6566e00 From David Callu, serializer support for new Vec* and Vec*Array classes 2013-06-28 08:57:42 +00:00
Robert Osfield
3c1a89604b From Christian Noon, "Got a simple patch for correcting a problem with the USE_COMPRESSOR_WRAPPER() macro in the osgDB::Registry. The problem is that the wrapper declaration doesn't match the one defined in the REGISTER_COMPRESSOR() method in the osgDB::ObjectWrapper method. This patch fixes the wrapper declaration so they both match properly. I ran into this problem using compressed files in an iOS application where all the libraries and plugins need to be built statically." 2013-06-24 09:31:34 +00:00
Robert Osfield
48020eed9e Introduced typedef's to make the code more readble and maintanable 2013-06-24 09:02:32 +00:00
Robert Osfield
4044fd5a74 From Wang Rui, "The file attached includes two new features for the serialization IO functionality. First, custom serializer version control should work now, just by defining a new REGISTER_CUSTOM_OBJECT_WRAPPER macro. For example:
// A custom class
namespace CustomDomain {

class MyGroup : public osg::Group
{
public:
    META_Node( CustomDomain, MyGroup );

    void setMyName( const std::string& n );
    const std::string& getMyName() const;

    void setMyID( int id );
    int getMyID() const;

    ...
};

}

// The serialization wrapper using a custom domain name
REGISTER_CUSTOM_OBJECT_WRAPPER( MyDomain,
                                CustomDomain_MyGroup,
                                new CustomDomain::MyGroup,
                                CustomDomain::MyGroup,
                                "osg::Object osg::Node osg::Group CustomDomain::MyGroup" )
{
    ADD_STRING_SERIALIZER( MyName, std::string() );
    {
        UPDATE_TO_VERSION_SCOPED( 1 );  // Updated for a new domain version
        ADD_INT_SERIALIZER( MyID, 0 );
    }
}

Save the class instance as follows:
osgDB::writeNodeFile( *myGroup, "serializer_test.osgt", new osgDB::Options("CustomDomains=MyDomain:1") );

The output file will include the domain version definition and all the class data, and can be read back. We can also force setting the domain version by the CustomDomains option while reading the saved files. If we save the class instance without any options, MyID will be ignored because the default domain version is 0.

This may help third-party libraries like osgEarth to maintain their own serializers without regarding to the OSG soversion changes.

Another feature added is a more robust binary format, which in fact adds a size-offset at each block's beginning. When there are problems or unsupported data types while reading, we can now directly jump to the block end indicated by the offset value. So a .osgb file will automatically ignore bad data and read remains as normal (at present it will fail at all). This feature will not break the backward compatibility, and can be disabled by setting "RobustBinaryFormat=false" while writing out.

Hope these changes can work smoothly with present and future community projects. Maybe we should also consider have an osgserializer example to test and demonstrate all things we can do now."
2013-06-24 08:48:55 +00:00
Robert Osfield
b4bfc3a451 From Martin Naylor, replace osgDB::fstream with an osgDB::open() call. 2013-06-12 12:49:18 +00:00
Robert Osfield
b0a28a5b2c Refactored the way the ReadResult/WriteResult lists are handled, with them now being sorted so that the Read/WriteResult with highest numerical value ReadStatus/WriteStatus is returned.
Changed the enum order of ReadStatus/WriteStatus to ensure that the more relevant errors are last and with the highest numerical value
2013-06-11 09:05:35 +00:00
Robert Osfield
ae2b6669ea Added Vec*b, Vec4ub, Vec*s, Vec*i, Vec*ui serializers 2013-06-03 13:13:18 +00:00
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