- fbx: better size estimate for keyframe buffer.

pull/14/head
Alexander Gessler 2012-07-21 16:19:11 +02:00
parent 382f4619ad
commit ae3007b42b
1 changed files with 11 additions and 2 deletions

View File

@ -73,7 +73,7 @@ public:
, doc(doc) , doc(doc)
{ {
ConvertRootNode(); ConvertRootNode();
//ConvertAnimations(); ConvertAnimations();
if(doc.Settings().readAllMaterials) { if(doc.Settings().readAllMaterials) {
// unfortunately this means we have to evaluate all objects // unfortunately this means we have to evaluate all objects
@ -1040,9 +1040,18 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<float> GetKeyTimeList(const KeyFrameListList& inputs) std::vector<float> GetKeyTimeList(const KeyFrameListList& inputs)
{ {
// XXX reserve some space upfront // reserve some space upfront - it is likely that the keyframe lists
// have matching time values, so max(of all keyframe lists) should
// be a good estimate.
std::vector<float> keys; std::vector<float> keys;
size_t estimate = 0;
BOOST_FOREACH(const KeyFrameList& kfl, inputs) {
estimate = std::max(estimate, kfl.get<0>()->size());
}
keys.reserve(estimate);
std::vector<unsigned int> next_pos; std::vector<unsigned int> next_pos;
next_pos.resize(inputs.size(),0); next_pos.resize(inputs.size(),0);