Public Member Functions | |
CRibbon () | |
void | duplicateFirstPos () |
void | fillVB (uint8 *dest, uint stride, uint nbSegs, float sliceTime) |
void | samplePos (const NLMISC::CVector &pos, float date, float sliceDuration) |
void | setNumSlices (uint numSlices) |
Private Types | |
typedef std::deque< CSampledPos > | TSampledPosVect |
Private Attributes | |
float | _LastSamplingDate |
TSampledPosVect | _Ribbon |
|
Definition at line 153 of file seg_remanence.h. |
|
Definition at line 210 of file seg_remanence.cpp.
00210 : _LastSamplingDate(0) 00211 { 00212 } |
|
Definition at line 274 of file seg_remanence.cpp.
|
|
compute a location Definition at line 215 of file seg_remanence.cpp. References _Ribbon, NL3D::BuildHermiteVector(), stride, uint, and uint8.
00216 { 00217 TSampledPosVect::iterator currIt = _Ribbon.begin(); 00218 00219 NLMISC::CVector t0 = (currIt + 1)->Pos - currIt->Pos; 00220 NLMISC::CVector t1 = 0.5f * ((currIt + 2)->Pos - currIt->Pos); 00221 00222 uint leftToDo = nbSegs + 1; 00223 00224 float lambda = 0.f; 00225 float lambdaStep = 1.f; 00226 00227 /* nlinfo("==============================="); 00228 for(uint k = 0; k < _Ribbon.size(); ++k) 00229 { 00230 nlinfo("pos = (%.2f, %.2f, %.2f)", _Ribbon[k].Pos.x, _Ribbon[k].Pos.y, _Ribbon[k].Pos.z); 00231 }*/ 00232 00233 for (;;) 00234 { 00235 float dt = currIt->SamplingDate - (currIt + 1)->SamplingDate; 00236 00237 if (dt < 10E-6f) // we reached the start of ribbon 00238 { 00239 00240 do 00241 { 00242 (NLMISC::CVector &) *dest = currIt->Pos; 00243 dest += stride; 00244 } 00245 while (--leftToDo); 00246 return; 00247 } 00248 00249 float newLambdaStep = sliceTime / dt; 00250 // readapt lambda 00251 lambda *= newLambdaStep / lambdaStep; 00252 lambdaStep = newLambdaStep; 00253 for(;;) 00254 { 00255 if (lambda >= 1.f) break; 00257 BuildHermiteVector(currIt->Pos, (currIt + 1)->Pos, t0, t1, (NLMISC::CVector &) *dest, lambda); 00258 dest += stride; 00259 -- leftToDo; 00260 if (!leftToDo) return; 00261 lambda += lambdaStep; 00262 } 00263 00264 lambda -= 1.f; 00265 00266 // Start new segment and compute new tangents 00267 t0 = t1; 00268 ++currIt; 00269 t1 = 0.5f * ((currIt + 2)->Pos - currIt->Pos); 00270 } 00271 } |
|
Definition at line 308 of file seg_remanence.cpp. References _LastSamplingDate, _Ribbon, and nlassert.
00309 { 00310 nlassert(_Ribbon.size() != 0); 00311 if (date - _LastSamplingDate > sliceDuration) 00312 { 00313 _Ribbon.pop_back(); 00314 CSampledPos sp(pos, date); 00315 _Ribbon.push_front(sp); 00316 _LastSamplingDate = date; 00317 } 00318 else 00319 { 00320 _Ribbon.front().Pos = pos; 00321 _Ribbon.front().SamplingDate = date; 00322 } 00323 } |
|
Definition at line 302 of file seg_remanence.cpp.
00303 { 00304 _Ribbon.resize(numSegs + 3); 00305 } |
|
Definition at line 155 of file seg_remanence.h. Referenced by samplePos(). |
|
Definition at line 154 of file seg_remanence.h. Referenced by duplicateFirstPos(), fillVB(), samplePos(), and setNumSlices(). |