Show
Ignore:
Timestamp:
01/20/10 21:13:33 (4 years ago)
Author:
robert
Message:

From Wang Rui, new native binary/ascii format infrastructure and wrappers.

From Robert Osfield, refactor of Wang Rui's original osg2 into 3 parts - parts placed into osgDB, the ReaderWriter? placed into src/osg/Plugin/osg and wrappers into src/osgWrappers/serializers/osg

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osgDB/Registry

    r10520 r10976  
    622622} 
    623623 
    624 /**  Proxy class for automatic registration of DotOsgWrappers with the Registry.*/ 
    625 class RegisterDotOsgWrapperProxy 
    626 { 
    627     public: 
    628      
    629         RegisterDotOsgWrapperProxy(osg::Object* proto, 
    630                                    const std::string& name, 
    631                                    const std::string& associates, 
    632                                    DotOsgWrapper::ReadFunc readFunc, 
    633                                    DotOsgWrapper::WriteFunc writeFunc, 
    634                                    DotOsgWrapper::ReadWriteMode readWriteMode=DotOsgWrapper::READ_AND_WRITE) 
    635         { 
    636             if (Registry::instance()) 
    637             { 
    638                 _wrapper = new DotOsgWrapper(proto,name,associates,readFunc,writeFunc,readWriteMode); 
    639                 Registry::instance()->addDotOsgWrapper(_wrapper.get()); 
    640             } 
    641         } 
    642          
    643         ~RegisterDotOsgWrapperProxy() 
    644         { 
    645             if (Registry::instance()) 
    646             { 
    647                 Registry::instance()->removeDotOsgWrapper(_wrapper.get()); 
    648             } 
    649         } 
    650          
    651     protected: 
    652         osg::ref_ptr<DotOsgWrapper> _wrapper; 
    653 }; 
    654  
    655 template<class T> 
    656 class TemplateRegisterDotOsgWrapperProxy : public RegisterDotOsgWrapperProxy, public T 
    657 { 
    658     public: 
    659      
    660         TemplateRegisterDotOsgWrapperProxy(osg::Object* proto, 
    661                                    const std::string& name, 
    662                                    const std::string& associates, 
    663                                    DotOsgWrapper::ReadFunc readFunc, 
    664                                    DotOsgWrapper::WriteFunc writeFunc, 
    665                                    DotOsgWrapper::ReadWriteMode readWriteMode=DotOsgWrapper::READ_AND_WRITE): 
    666             RegisterDotOsgWrapperProxy(proto, name, associates, readFunc, writeFunc, readWriteMode) {} 
    667          
    668 }; 
    669  
    670624/** Proxy class for automatic registration of reader/writers with the Registry.*/ 
    671625template<class T> 
     
    706660    static osgDB::PluginFunctionProxy proxy_##ext(osgdb_##ext); 
    707661 
     662#define USE_DOTOSGWRAPPER(classname) \ 
     663    extern "C" void dotosgwrapper_##classname(void); \ 
     664    static osgDB::PluginFunctionProxy proxy_dotosgwrapper_##classname(dotosgwrapper_##classname); 
     665 
    708666#define REGISTER_OSGPLUGIN(ext, classname) \ 
    709667    extern "C" void osgdb_##ext(void) {} \ 
     
    711669 
    712670 
    713 #define USE_DOTOSGWRAPPER(classname) \ 
    714     extern "C" void dotosgwrapper_##classname(void); \ 
    715     static osgDB::PluginFunctionProxy proxy_dotosgwrapper_##classname(dotosgwrapper_##classname); 
    716  
    717 #define REGISTER_DOTOSGWRAPPER(classname) \ 
    718     extern "C" void dotosgwrapper_##classname(void) {} \ 
    719     static osgDB::RegisterDotOsgWrapperProxy dotosgwrapper_proxy_##classname 
    720  
    721671} 
    722672