// ------------------------------------------------------------ COLLADASW::URI EffectTextureExporter::createTargetURI ( const COLLADASW::URI& sourceUri ) { // Target file String targetFile = mDocumentExporter->getFilename(); COLLADASW::URI targetUri ( COLLADASW::URI::nativePathToUri ( targetFile ) ); const String& targetScheme = targetUri.getScheme (); // Get the pure file name of the source file and set // the source file name to the target path targetUri.setPathFile ( sourceUri.getPathFile () ); if ( !targetScheme.empty () ) targetUri.setScheme ( targetScheme ); else targetUri.setScheme ( COLLADASW::URI::SCHEME_FILE ); // Generate the target file name return targetUri; }
//--------------------------------------------------------------- void DocumentExporter::exportAsset() { COLLADASW::Asset asset ( &mStreamWriter ); // Add contributor information // Set the author String userName = getEnvironmentVariable ( "USERNAME" ); if ( userName.empty() ) userName = getEnvironmentVariable ( "USER" ); if ( !userName.empty() ) asset.getContributor().mAuthor = String ( userName ); const COLLADASW::URI maxFileUri = mExportSceneGraph->getMaxFileUri(); if ( !maxFileUri.getPathFile().empty() ) asset.getContributor().mSourceData = maxFileUri.getURIString(); asset.getContributor().mAuthoringTool = AUTHORING_TOOL; // set *system* unit information int systemUnitType; float systemUnitScale; GetMasterUnitInfo ( &systemUnitType, &systemUnitScale ); switch ( systemUnitType ) { case UNITS_INCHES: asset.setUnit ( "inch", systemUnitScale * 0.0254f ); break; case UNITS_FEET: asset.setUnit ( "feet", systemUnitScale * 0.3048f ); break; case UNITS_MILES: asset.setUnit ( "mile", systemUnitScale * 1609.344f ); break; case UNITS_MILLIMETERS: asset.setUnit ( "millimeter", systemUnitScale * 0.001f ); break; case UNITS_CENTIMETERS: asset.setUnit ( "centimeter", systemUnitScale * 0.01f ); break; case UNITS_METERS: asset.setUnit ( "meter", systemUnitScale ); break; case UNITS_KILOMETERS: asset.setUnit ( "kilometer", systemUnitScale * 1000.0f ); break; default: break; } asset.setUpAxisType ( COLLADASW::Asset::Z_UP ); asset.add(); }