Mark,

I agree with all your comments. I was just trying to provoke some debate on
the best way to fix it :-)

> 
> If you read the COLLADA DOM docs you'll find that makeRelativeTo() is an
> experimental function. It obviously needs a bit more work.
> 

I doubt if it is appropriate that this function should make assumptions
about the schema of hierarchical paths given to it.

> 
> According to RFC 3986 section 6.2.2.1, the path component of a generic
> syntax URL is considered to be case-sensitive unless defined otherwise
> by the scheme, in this case file:. According to RFC 1738 section 3.10
> the file scheme makes no such exception for its fpath part. Needless to
> say it's a longstanding headache for developers.
> 

Tell me :-)

> 
> A reasonable solution! This is a similar workaround to Apache's
> ( http://httpd.apache.org/docs/1.3/mod/mod_speling.html ) mod to hide
> case correctness from millions of Web users in the name of usability.
> 
> > I don't know if this is the only place we are going to run into this
> > kind of problem.
> 

I stuck the following mod in.

        osg::Image *osgimg = tex->getImage( 0 );
        domImage::domInit_from *imgif = daeSafeCast< domImage::domInit_from
>( img->createAndPlace( "init_from" ) );
        std::string imgstr = "/" + osgDB::convertFileNameToUnixStyle(
osgDB::findDataFile( osgimg->getFileName() ) );
#ifdef WIN32
        daeURI uri( _strlwr( (char *)imgstr.c_str() ) );
#else
        daeURI uri( imgstr.c_str() );
#endif
        uri.validate();
        imgif->setValue( uri.getURI() );
        //imgif->setValue( imgstr.c_str() );
        //imgif->getValue().validate();
#ifdef WIN32
                std::string docUriString =
doc->getDocumentURI()->getFilepath();
                docUriString += doc->getDocumentURI()->getFile();
                daeURI docUri( _strlwr( (char *)docUriString.c_str() ) );
                imgif->getValue().makeRelativeTo( &docUri );
#else
        imgif->getValue().makeRelativeTo( doc->getDocumentURI() ); 
#endif

It fixes the file name but I still don't get any textures. I cannot see
where my "material_effect-sampler" is referenced.

Roger

Attachment: brantholme.osg
Description: Binary data

Attachment: brantholme.dae
Description: Binary data

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to