Changeset 8282

Show
Ignore:
Timestamp:
05/08/08 14:36:07
Author:
robert
Message:

From Garrett Potts and Robert Osfield, changes to build against Collada DOM 2.x

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OpenSceneGraph/trunk/CMakeModules/FindCOLLADA.cmake

    r7025 r8282  
    1919    /Library/Frameworks 
    2020    /usr/local/include 
    21     /usr/include 
     21    /usr/local/include/colladadom 
     22    /usr/include/ 
     23    /usr/include/colladadom 
    2224    /sw/include # Fink 
    2325    /opt/local/include # DarwinPorts 
     
    2931 
    3032FIND_LIBRARY(COLLADA_LIBRARY  
    31     NAMES collada_dom 
     33    NAMES collada_dom collada14dom 
    3234    PATHS 
    3335    $ENV{COLLADA_DIR}/lib 
     
    4042    /Library/Frameworks 
    4143    /usr/local/lib 
     44    /usr/local/lib64 
    4245    /usr/lib 
     46    /usr/lib64 
    4347    /sw/lib 
    4448    /opt/local/lib 
  • OpenSceneGraph/trunk/src/osgPlugins/dae/CMakeLists.txt

    r7664 r8282  
    4646    # ...so what we need is a conditional way to properly SET() the right one. 
    4747    IF(COLLADA_USE_STATIC) 
    48         SET(TARGET_EXTERNAL_LIBRARIES collada_dom collada_dae xml2 pcrecpp) 
     48        SET(TARGET_EXTERNAL_LIBRARIES collada14dom xml2 pcrecpp) 
    4949    ELSE(COLLADA_USE_STATIC) 
    50         SET(TARGET_EXTERNAL_LIBRARIES collada_dom_shared collada_dae_shared xml2) 
     50        SET(TARGET_EXTERNAL_LIBRARIES collada14dom xml2) 
    5151    ENDIF(COLLADA_USE_STATIC) 
    5252 
  • OpenSceneGraph/trunk/src/osgPlugins/dae/daeRGeometry.cpp

    r5465 r8282  
    312312    osg::DrawArrayLengths* dal = new osg::DrawArrayLengths( GL_POLYGON ); 
    313313     
    314     domPRef p = (domP*)(daeElement*)domP::_Meta->create(); //I don't condone creating elements like this but I don't care 
     314    //domPRef p = (domP*)(daeElement*)domP::_Meta->create(); //I don't condone creating elements like this but I don't care 
     315    domPRef p = (domP*)domP::registerElement(*dae)->create().cast(); 
    315316    //if it created properly because I never want it as part of the document. Its just a temporary 
    316317    //element to trick the importer into loading polylists easier. 
  • OpenSceneGraph/trunk/src/osgPlugins/dae/daeRMaterials.cpp

    r7664 r8282  
    616616    if ( dImg->getInit_from() != NULL ) 
    617617    { 
     618        // daeURI uri = dImg->getInit_from()->getValue(); 
    618619        dImg->getInit_from()->getValue().validate(); 
    619  
    620620        if ( std::string( dImg->getInit_from()->getValue().getProtocol() ) == std::string( "file" ) ) 
    621621        { 
    622             unsigned int bufSize = 1; //for the null char 
    623             if ( dImg->getInit_from()->getValue().getFilepath() != NULL ) 
    624             { 
    625                bufSize += strlen( dImg->getInit_from()->getValue().getFilepath() ); 
    626             } 
    627             if ( dImg->getInit_from()->getValue().getFile() != NULL ) 
    628             { 
    629                bufSize += strlen( dImg->getInit_from()->getValue().getFile() ); 
    630             } 
    631             char *path = new char[bufSize+1]; 
    632             if ( !dImg->getInit_from()->getValue().getPath( path, bufSize ) ) 
    633             { 
    634                osg::notify( osg::WARN ) << "Unable to get path from URI." << std::endl; 
    635                return NULL; 
    636             } 
    637  
     622            //unsigned int bufSize = 1; //for the null char 
     623            //bufSize += dImg->getInit_from()->getValue().pathDir().size(); 
     624            //bufSize += dImg->getInit_from()->getValue().pathFile().size(); 
     625           std::string path =  dImg->getInit_from()->getValue().pathDir()+ 
     626                                  dImg->getInit_from()->getValue().pathFile(); 
     627              // remove space encodings 
     628              // 
     629              path = cdom::uriToNativePath(path); 
     630           if(path.empty()) 
     631           { 
     632              osg::notify( osg::WARN ) << "Unable to get path from URI." << std::endl; 
     633              return NULL; 
     634           } 
    638635#ifdef WIN32 
    639636            // If the path has a drive specifier or a UNC name then strip the leading / 
    640             char* filename
     637            const char* filename =path.c_str()
    641638            if ((path[2] == ':') || ((path[1] == '/') && (path[2] == '/'))) 
    642                 filename = path+1; 
    643             else 
    644                 filename = path; 
     639               ++filename;// = path+1; 
     640//            else 
     641//                filename = path; 
    645642#else 
    646             char* filename = path
     643            const char* filename = path.c_str()
    647644#endif 
    648  
    649645            img = osgDB::readImageFile( filename ); 
    650646 
     
    652648             
    653649            //Moved this below the osg::notify - Parag, 24/7/2007 
    654             delete [] path; 
     650            //delete [] path; 
    655651 
    656652             
  • OpenSceneGraph/trunk/src/osgPlugins/dae/daeWMaterials.cpp

    r7860 r8282  
    100100        domImage::domInit_from *imgif = daeSafeCast< domImage::domInit_from >( img->createAndPlace( "init_from" ) ); 
    101101        std::string fileURI = ReaderWriterDAE::ConvertFilePathToColladaCompatibleURI(osgDB::findDataFile(osgimg->getFileName())); 
    102         daeURI dd( fileURI.c_str() ); 
     102       daeURI dd(*dae, fileURI);//fileURI.c_str() ); 
    103103        imgif->setValue( dd ); 
    104104        // The document URI should contain the canonical path it was created with 
  • OpenSceneGraph/trunk/src/osgPlugins/dae/daeWriter.cpp

    r7664 r8282  
    2525daeWriter::daeWriter( DAE *dae_, const std::string &fileURI, bool _usePolygons,  bool GoogleMode ) : osg::NodeVisitor( TRAVERSE_ALL_CHILDREN ), 
    2626                                        dae(dae_), 
     27                                        rootName(*dae_), 
    2728                                        usePolygons (_usePolygons), 
    2829                                        m_GoogleMode(GoogleMode)