// NeL - MMORPG Framework
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
#include "std3d.h"
#include "nel/misc/common.h"
#include "nel/3d/track_sampled_vector.h"
using namespace NLMISC;
using namespace std;
namespace NL3D
{
// ***************************************************************************
// ***************************************************************************
// CTrackSampledVector
// ***************************************************************************
// ***************************************************************************
// ***************************************************************************
CTrackSampledVector::CTrackSampledVector()
{
}
// ***************************************************************************
CTrackSampledVector::~CTrackSampledVector()
{
}
// ***************************************************************************
void CTrackSampledVector::serial(NLMISC::IStream &f)
{
/*
Version 0:
- base version.
*/
(void)f.serialVersion(0);
// serial Time infos.
CTrackSampledCommon::serialCommon(f);
// serial Keys.
f.serial(_Keys);
}
// ***************************************************************************
void CTrackSampledVector::build(const std::vector &timeList, const std::vector &keyList,
float beginTime, float endTime)
{
nlassert( endTime>beginTime || (beginTime==endTime && keyList.size()<=1) );
nlassert( keyList.size()==timeList.size() );
uint i;
// reset.
uint numKeys= (uint)keyList.size();
_Keys.clear();
_TimeBlocks.clear();
// Build Common time information
CTrackSampledCommon::buildCommon(timeList, beginTime, endTime);
// Compute All Key values.
//===================
_Keys.resize(numKeys);
for(i=0; i keepKeys;
applySampleDivisorCommon(sampleDivisor, keepKeys);
// **** rebuild the keys
NLMISC::CObjectVector newKeys;
newKeys.resize((uint32)keepKeys.size());
for(uint i=0;i