Exemplo n.º 1
0
void aiContext::copyTimeSampling(int i, aiTimeSamplingData& dst)
{
    int dst_numSamples = dst.numTimes;
    double *dst_samples = dst.times;

    getTimeSampling(i, dst);

    if (dst.type == aiTimeSamplingType_Acyclic) {
        const auto& times = m_archive.getTimeSampling(i)->getStoredTimes();
        if (dst_samples && dst_numSamples >= (int)times.size()) {
            // memcpy() is way faster than std::copy() on VC...
            memcpy(dst.times, &times[0], sizeof(times[0])*times.size());
        }
    }
}
Exemplo n.º 2
0
//-*****************************************************************************
AwImpl::~AwImpl()
{

    // empty out the map so any dataset IDs will be freed up
    m_writtenSampleMap.clear();

    // write out our child headers
    if ( m_data )
    {
        Util::SpookyHash hash;
        m_data->writeHeaders( m_metaDataMap, hash );
    }

    // let go of our reference to the data for the top object
    m_data.reset();

    // encode and write the time samplings and max samples into data
    if ( m_archive.isValid() )
    {
        // encode and write the Metadata for the archive, since the top level
        // meta data can be kinda big and is very specialized don't worry
        // about putting it into the meta data map
        std::string metaData = m_metaData.serialize();
        m_archive.getGroup()->addData( metaData.size(), metaData.c_str() );

        std::vector< Util::uint8_t > data;
        Util::uint32_t numSamplings = getNumTimeSamplings();
        for ( Util::uint32_t i = 0; i < numSamplings; ++i )
        {
            Util::uint32_t maxSample = m_maxSamples[i];
            AbcA::TimeSamplingPtr timePtr = getTimeSampling( i );
            WriteTimeSampling( data, maxSample, *timePtr );
        }

        m_archive.getGroup()->addData( data.size(), &( data.front() ) );
        m_metaDataMap->write( m_archive.getGroup() );
    }

}