//---------------------------------------------------------------
    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();
    }
Пример #2
0
bool KDLColladaExporter::exportAsset()
{

    COLLADASW::Asset asset ( &mStreamWriter );

    // Add contributor information
    // Set the author
    String userName = "******";
    String authoringTool = "KDL COLLADA exporter";


    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 = authoringTool;



    SystemUnitType systemUnitType = UNITS_MILLIMETERS;

    float systemUnitScale = 1;

    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();

    return true;
}