本文整理汇总了C++中IArchive::getTimeSampling方法的典型用法代码示例。如果您正苦于以下问题:C++ IArchive::getTimeSampling方法的具体用法?C++ IArchive::getTimeSampling怎么用?C++ IArchive::getTimeSampling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IArchive
的用法示例。
在下文中一共展示了IArchive::getTimeSampling方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//-*****************************************************************************
//-*****************************************************************************
// DO IT.
//-*****************************************************************************
//-*****************************************************************************
int main( int argc, char *argv[] )
{
if (argc < 4)
{
std::cerr << "USAGE: " << argv[0] << " outFile.abc inFile1.abc"
<< " inFile2.abc (inFile3.abc ...)" << std::endl;
return -1;
}
{
size_t numInputs = argc - 2;
std::vector< chrono_t > minVec;
minVec.reserve(numInputs);
std::vector< IArchive > iArchives;
iArchives.reserve(numInputs);
std::map< chrono_t, size_t > minIndexMap;
size_t rootChildren = 0;
Alembic::AbcCoreFactory::IFactory factory;
factory.setPolicy(ErrorHandler::kThrowPolicy);
Alembic::AbcCoreFactory::IFactory::CoreType coreType;
for (int i = 2; i < argc; ++i)
{
IArchive archive = factory.getArchive(argv[i], coreType);
if (!archive.valid() || archive.getTop().getNumChildren() < 1)
{
std::cerr << "ERROR: " << argv[i] <<
" not a valid Alembic file" << std::endl;
return 1;
}
IObject iRoot = archive.getTop();
size_t numChildren = iRoot.getNumChildren();
if (i == 2)
{
rootChildren = numChildren;
}
else if (rootChildren != numChildren)
{
std::cerr << "ERROR: " << argv[i] <<
" doesn't have the same number of children as: " <<
argv[i-1] << std::endl;
}
// reorder the input files according to their mins
chrono_t min = DBL_MAX;
Alembic::Util::uint32_t numSamplings = archive.getNumTimeSamplings();
if (numSamplings > 1)
{
// timesampling index 0 is special, so it will be skipped
//
// make sure all the other timesampling objects start at
// the same time or throw here
//
min = archive.getTimeSampling(1)->getSampleTime(0);
for (Alembic::Util::uint32_t s = 2; s < numSamplings; ++s)
{
chrono_t thisMin =
archive.getTimeSampling(s)->getSampleTime(0);
if (fabs(thisMin - min) > 1e-5)
{
std::cerr << "ERROR: " << argv[i]
<< " has non-default TimeSampling objects"
<< " that don't start at the same time."
<< std::endl;
return 1;
}
}
minVec.push_back(min);
if (minIndexMap.count(min) == 0)
{
minIndexMap.insert(std::make_pair(min, i-2));
}
else if (argv[2] != argv[i])
{
std::cerr << "ERROR: overlapping frame range between "
<< argv[2] << " and " << argv[i] << std::endl;
return 1;
}
}
else
{
std::cerr << "ERROR: " << archive.getName() <<
" only has default (static) TimeSampling." << std::endl;
return 1;
}
//.........这里部分代码省略.........
示例2: showTimeSampling
void showTimeSampling(IArchive archive)
{
std::cout<<"num time samplings "<<archive.getNumTimeSamplings()<<std::endl;
AbcA::TimeSamplingPtr sampler = archive.getTimeSampling(0);
std::cout<<"time sampling[0] "<<sampler->getSampleTime(0)<<std::endl;
}