1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
|
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>nevrax.org : docs</TITLE>
<LINK REL=stylesheet TYPE="text/css" HREF="/inc/css/nevrax.css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
<TR>
<TD WIDTH=16><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=16><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=><b>Home</B></FONT></A> </TD>
<TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD>
</TR>
</TABLE>
<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="#000000" BACKGROUND="/inc/img/black_banner.jpg"><A HREF=""><IMG SRC="/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>
<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
<TR>
<TD WIDTH=16><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
<!------ Begin Box ------>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
<TABLE cellspacing=0 cellpadding=1 border=0>
<tr><td ALIGN=middle><a class='linkbox' href="/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
</TABLE>
</TD></TR></TABLE></TD></TR></TABLE>
<!------ End Box ------>
</TD>
<TD WIDTH=15><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD ALIGN=left valign=top><IMG SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
<!-- title -->
<TABLE background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG SRC="/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
<!-- block -->
<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="/inc/img/reddots.gif"></TD>
<TD><B>Documentation</B></TD>
<TD ALIGN=RIGHT> </td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> </center>
<hr><h1>track_keyframer.h</h1><a href="track__keyframer_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025
00026 <font class="preprocessor">#ifndef NL_TRACK_KEYFRAMER_H</font>
00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_TRACK_KEYFRAMER_H</font>
00028 <font class="preprocessor"></font>
00029 <font class="preprocessor">#include "<a class="code" href="types__nl_8h.html">nel/misc/types_nl.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="track_8h.html">3d/track.h</a>"</font>
00031 <font class="preprocessor">#include "<a class="code" href="key_8h.html">3d/key.h</a>"</font>
00032 <font class="preprocessor">#include <map></font>
00033 <font class="preprocessor">#include <memory></font>
00034 <font class="preprocessor">#include "<a class="code" href="matrix_8h.html">nel/misc/matrix.h</a>"</font>
00035
00036
00037
00038 <font class="keyword">namespace </font>NL3D
00039 {
00040
00041
00042 <font class="comment">// ***************************************************************************</font>
00043 <font class="comment">// ***************************************************************************</font>
00044 <font class="comment">// Templates for KeyFramer tracks.</font>
00045 <font class="comment">// ***************************************************************************</font>
00046 <font class="comment">// ***************************************************************************</font>
00047
00048
00049
00050 <font class="comment">// ***************************************************************************</font>
00060 <font class="comment"></font><font class="keyword">template</font><<font class="keyword">class</font> CKeyT>
<a name="l00061"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html">00061</a> <font class="keyword">class </font>ITrackKeyFramer : <font class="keyword">public</font> ITrack, <font class="keyword">public</font> UTrackKeyframer
00062 {
00063 <font class="keyword">public</font>:
00064 <font class="comment">// Some types</font>
<a name="l00065"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#s0">00065</a> <font class="keyword">typedef</font> std::map <TAnimationTime, CKeyT> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#s0">TMapTimeCKey</a>;
00066
00067
<a name="l00069"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a0">00069</a> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a0">ITrackKeyFramer</a> ()
00070 {
00071 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o0">_Dirty</a>= <font class="keyword">false</font>;
00072 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o2">_RangeLock</a>= <font class="keyword">true</font>;
00073 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o1">_LoopMode</a>= <font class="keyword">false</font>;
00074 }
00075
00076
<a name="l00078"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a1">00078</a> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a1">~ITrackKeyFramer</a> ()
00079 {
00080 }
00081
<a name="l00090"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a2">00090</a> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a2">addKey</a> (<font class="keyword">const</font> CKeyT &key, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> time)
00091 {
00092 <font class="comment">// Insert the key in the map</font>
00093 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.insert (TMapTimeCKey::value_type (time, key));
00094
00095 <font class="comment">// must precalc at next eval.</font>
00096 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o0">_Dirty</a>= <font class="keyword">true</font>;
00097 }
00098
<a name="l00100"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a3">00100</a> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a3">unlockRange</a>(<a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> begin, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> end)
00101 {
00102 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o2">_RangeLock</a>= <font class="keyword">false</font>;
00103 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o3">_RangeBegin</a>= begin;
00104 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o4">_RangeEnd</a>= end;
00105 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o0">_Dirty</a>= <font class="keyword">true</font>;
00106 }
00107
<a name="l00109"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a4">00109</a> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a4">lockRange</a>()
00110 {
00111 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o2">_RangeLock</a>= <font class="keyword">true</font>;
00112 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o0">_Dirty</a>= <font class="keyword">true</font>;
00113 }
00114
<a name="l00116"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a5">00116</a> <font class="keywordtype">bool</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a5">isRangeLocked</a>()<font class="keyword"> const </font>{<font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o2">_RangeLock</a>;}
00117
00118
<a name="l00120"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a6">00120</a> <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a6">getRangeDelta</a>()<font class="keyword"> const</font>
00121 <font class="keyword"> </font>{
00122 <font class="comment">// update track.</font>
00123 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#c0">testAndClean</a>();
00124
00125 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o5">_RangeDelta</a>;
00126 }
00127
00128
<a name="l00130"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a7">00130</a> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a7">setLoopMode</a>(<font class="keywordtype">bool</font> loop) {<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o1">_LoopMode</a>= loop; <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o0">_Dirty</a>= <font class="keyword">true</font>;}
00131
<a name="l00133"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a8">00133</a> <font class="keyword">virtual</font> <font class="keywordtype">bool</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a8">getLoopMode</a>()<font class="keyword"> const </font>{<font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o1">_LoopMode</a>;}
00134
00135
<a name="l00137"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a9">00137</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a9">eval</a> (<font class="keyword">const</font> <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a>& inDate)
00138 {
00139 <font class="keywordtype">float</font> date= inDate;
00140 <font class="keyword">const</font> CKeyT *previous=NULL;
00141 <font class="keyword">const</font> CKeyT *next=NULL;
00142 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> datePrevious = 0;
00143 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> dateNext = 0;
00144
00145 <font class="comment">// must precalc ??</font>
00146 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#c0">testAndClean</a>();
00147
00148 <font class="comment">// No keys?</font>
00149 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.empty())
00150 <font class="keywordflow">return</font>;
00151
00152
00153 <font class="comment">// Loop gestion.</font>
00154 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o1">_LoopMode</a> && <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.size()>1 )
00155 {
00156 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o7">_LoopEnd</a> > <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o6">_LoopStart</a>);
00157
00158 <font class="comment">// force us to be in interval [_LoopStart, _LoopEnd[.</font>
00159 <font class="keywordflow">if</font>( date<_LoopStart || date>=<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o7">_LoopEnd</a> )
00160 {
00161 <font class="keywordtype">double</font> d= (date-<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o6">_LoopStart</a>)*<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o9">_OOTotalRange</a>;
00162
00163 <font class="comment">// floor(d) is the truncated number of loops.</font>
00164 d= date- floor(d)*<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o8">_TotalRange</a>;
00165 date= (float)d;
00166
00167 <font class="comment">// For precision problems, ensure correct range.</font>
00168 <font class="keywordflow">if</font>(date<_LoopStart || date >= <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o7">_LoopEnd</a>)
00169 date= <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o6">_LoopStart</a>;
00170 }
00171 }
00172
00173
00174 <font class="comment">// Return upper key</font>
00175 TMapTimeCKey::iterator ite=<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.upper_bound (date);
00176
00177 <font class="comment">// First next ?</font>
00178 <font class="keywordflow">if</font> (ite!=<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.end())
00179 {
00180 <font class="comment">// Next</font>
00181 next= &(ite->second);
00182 dateNext=ite->first;
00183 }
00184 <font class="comment">// loop mgt.</font>
00185 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o1">_LoopMode</a> && <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.size()>1 )
00186 {
00187 <font class="comment">// loop to first!!</font>
00188 next= &(<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.begin()->second);
00189 <font class="comment">// must slerp from last to first, </font>
00190 dateNext= <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o7">_LoopEnd</a>;
00191 }
00192 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o1">_LoopMode</a> && <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.size()>=1 )
00193 {
00194 <font class="comment">// clamp to the last</font>
00195 TMapTimeCKey::iterator iteLast= ite;
00196 iteLast--;
00197 next= &(iteLast->second);
00198 }
00199
00200
00201 <font class="comment">// First previous ?</font>
00202 <font class="keywordflow">if</font> ((!<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.empty())&&(ite!=<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.begin()))
00203 {
00204 <font class="keywordflow">if</font> (ite!=<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.end())
00205 {
00206 <font class="comment">// Previous</font>
00207 ite--;
00208 previous= &(ite->second);
00209 datePrevious=ite->first;
00210 }
00211 }
00212 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.empty())
00213 {
00214 <font class="comment">// Clamp at beginTime</font>
00215 next= &(ite->second);
00216 dateNext=ite->first;
00217 }
00218
00219 <font class="comment">// Call evalutation fonction</font>
00220 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#b2">evalKey</a> (previous, next, datePrevious, dateNext, date);
00221 }
00222
00223
<a name="l00224"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a10">00224</a> <font class="keyword">virtual</font> <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a10">getBeginTime</a> ()<font class="keyword"> const</font>
00225 <font class="keyword"> </font>{
00226 <font class="comment">// must precalc ??</font>
00227 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#c0">testAndClean</a>();
00228
00229 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o3">_RangeBegin</a>;
00230 }
<a name="l00231"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a11">00231</a> <font class="keyword">virtual</font> <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a11">getEndTime</a> ()<font class="keyword"> const</font>
00232 <font class="keyword"> </font>{
00233 <font class="comment">// must precalc ??</font>
00234 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#c0">testAndClean</a>();
00235
00236 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o4">_RangeEnd</a>;
00237 }
00238
00239
<a name="l00241"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a12">00241</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a12">serial</a> (<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a>& f) <font class="keywordflow">throw</font> (NLMISC::EStream)
00242 {
00243 <font class="comment">// Serial version</font>
00244 (void)f.serialVersion (0);
00245
00246 f.serialCont(<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>);
00247 f.serial(<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o2">_RangeLock</a>, <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o3">_RangeBegin</a>, <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o4">_RangeEnd</a>);
00248 f.serial(<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o1">_LoopMode</a>);
00249
00250 <font class="keywordflow">if</font>(f.isReading())
00251 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o0">_Dirty</a>= <font class="keyword">true</font>;
00252 }
00253
00257 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#a13">getKeysInRange</a>(<a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> t1, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> t2, std::vector<TAnimationTime> &result);
00258
00259
00260 <font class="keyword">private</font>:
<a name="l00261"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o0">00261</a> <font class="keyword">mutable</font> <font class="keywordtype">bool</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o0">_Dirty</a>;
<a name="l00262"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o1">00262</a> <font class="keywordtype">bool</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o1">_LoopMode</a>;
<a name="l00263"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o2">00263</a> <font class="keywordtype">bool</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o2">_RangeLock</a>;
<a name="l00264"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o3">00264</a> <font class="keywordtype">float</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o3">_RangeBegin</a>; <font class="comment">// if RangeLock==true, valid only when track cleaned.</font>
<a name="l00265"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o4">00265</a> <font class="keywordtype">float</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o4">_RangeEnd</a>; <font class="comment">// if RangeLock==true, valid only when track cleaned.</font>
00266 <font class="comment">// Valid only when cleaned.</font>
<a name="l00267"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o5">00267</a> <font class="keywordtype">float</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o5">_RangeDelta</a>;
<a name="l00268"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o6">00268</a> <font class="keywordtype">float</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o6">_LoopStart</a>;
<a name="l00269"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o7">00269</a> <font class="keywordtype">float</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o7">_LoopEnd</a>;
<a name="l00270"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o8">00270</a> <font class="keywordtype">float</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o8">_TotalRange</a>;
<a name="l00271"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o9">00271</a> <font class="keywordtype">float</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o9">_OOTotalRange</a>;
00272
00273
00274 <font class="comment">// update track if necessary.</font>
<a name="l00275"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#c0">00275</a> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#c0">testAndClean</a>()<font class="keyword"> const</font>
00276 <font class="keyword"> </font>{
00277 <font class="keywordflow">if</font>(_Dirty)
00278 {
00279 ITrackKeyFramer<CKeyT> *self= const_cast<ITrackKeyFramer<CKeyT>*>(this);
00280 self->compile();
00281 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o0">_Dirty</a>= <font class="keyword">false</font>;
00282 }
00283 }
00284
00285
00286 <font class="keyword">protected</font>:
<a name="l00287"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">00287</a> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#s0">TMapTimeCKey</a> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>;
00288
00289
<a name="l00291"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#b0">00291</a> <font class="keywordtype">float</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#b0">getCompiledRangeDelta</a>()
00292 {
00293 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o5">_RangeDelta</a>;
00294 }
00295
00296
<a name="l00302"></a><a class="code" href="classNL3D_1_1ITrackKeyFramer.html#b1">00302</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#b1">compile</a> ()
00303 {
00304 <font class="keywordtype">float</font> timeFirstKey;
00305 <font class="keywordtype">float</font> timeLastKey;
00306
00307 <font class="comment">// Compute time of first/last key.</font>
00308 <font class="keywordflow">if</font>( !<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.empty() )
00309 {
00310 TMapTimeCKey::const_iterator ite;
00311
00312 <font class="comment">// Get first key</font>
00313 ite=<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.begin ();
00314 timeFirstKey= ite->first;
00315
00316 <font class="comment">// Get last key</font>
00317 ite=<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.end ();
00318 ite--;
00319 timeLastKey= ite->first;
00320 }
00321 <font class="keywordflow">else</font>
00322 {
00323 timeFirstKey= 0.0f;
00324 timeLastKey= 0.0f;
00325 }
00326
00327
00328 <font class="comment">// Compute RangeBegin / RangeEnd. (if not user provided).</font>
00329 <font class="keywordflow">if</font>(_RangeLock)
00330 {
00331 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o3">_RangeBegin</a>= timeFirstKey;
00332 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o4">_RangeEnd</a>= timeLastKey;
00333 }
00334
00335
00336 <font class="comment">// Compute _RangeDelta.</font>
00337 <font class="keywordflow">if</font>(_RangeLock)
00338 {
00339 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o5">_RangeDelta</a>= 0;
00340 }
00341 <font class="keywordflow">else</font>
00342 {
00343 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o5">_RangeDelta</a>= (<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o4">_RangeEnd</a> - <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o3">_RangeBegin</a>) - (timeLastKey - timeFirstKey);
00344 }
00345
00346 <font class="comment">// Misc range.</font>
00347 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o8">_TotalRange</a>= <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o4">_RangeEnd</a> - <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o3">_RangeBegin</a>;
00348 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o8">_TotalRange</a>>0.0f)
00349 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o9">_OOTotalRange</a>= 1.0f/<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o8">_TotalRange</a>;
00350 <font class="comment">// start of loop / ned.</font>
00351 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o6">_LoopStart</a>= timeFirstKey;
00352 <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o7">_LoopEnd</a>= timeFirstKey + <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o8">_TotalRange</a>;
00353
00354
00355 <font class="comment">// After _RangeDelta computed, compute OO delta times.</font>
00356 TMapTimeCKey::iterator it= <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.begin();
00357 <font class="keywordflow">for</font>(;it!=<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.end();it++)
00358 {
00359 TMapTimeCKey::iterator next= it;
00360 next++;
00361 <font class="keywordflow">if</font>(next!=<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#n0">_MapKey</a>.end())
00362 it->second.OODeltaTime= 1.0f/(next->first - it->first);
00363 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o5">_RangeDelta</a>>0.0f)
00364 <font class="comment">// after last key, must slerp to first key.</font>
00365 it->second.OODeltaTime= 1.0f/<a class="code" href="classNL3D_1_1ITrackKeyFramer.html#o5">_RangeDelta</a>;
00366 <font class="keywordflow">else</font>
00367 it->second.OODeltaTime= 0.0f;
00368 }
00369
00370 }
00371
00380 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrackKeyFramer.html#b2">evalKey</a> (<font class="keyword">const</font> CKeyT* previous, <font class="keyword">const</font> CKeyT* next,
00381 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> datePrevious, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> dateNext,
00382 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> date ) =0;
00383
00384 };
00385
00386
00387 <font class="comment">// ***************************************************************************</font>
00388 <font class="comment">// Key Tools.</font>
00389 <font class="comment">// separated to just change this in RGBA and sint32 special implementation.</font>
00390
00391 <font class="comment">// just copy the content of a value issued from key interpolation, into a value.</font>
00392 <font class="keyword">template</font><<font class="keyword">class</font> T, <font class="keyword">class</font> TKeyVal> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a469">copyToValue</a>(T &<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>, <font class="keyword">const</font> TKeyVal &keyval)
00393 {
00394 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = keyval;
00395 }
00396
00397
00398 <font class="comment">// Vector to RGBA version.</font>
00399 <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a469">copyToValue</a>(<a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> &col, <font class="keyword">const</font> CVector &<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>)
00400 {
00401 sint i;
00402
00403 i= (sint)(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>.x*255); <a class="code" href="namespaceNLMISC.html#a215">NLMISC::clamp</a>(i,0,255); col.<a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>= (uint8) i;
00404 i= (sint)(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>.y*255); <a class="code" href="namespaceNLMISC.html#a215">NLMISC::clamp</a>(i,0,255); col.<a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>= (uint8) i;
00405 i= (sint)(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>.z*255); <a class="code" href="namespaceNLMISC.html#a215">NLMISC::clamp</a>(i,0,255); col.<a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>= (uint8) i;
00406 col.<a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a>=255;
00407 }
00408
00409
00410 <font class="comment">// float to sint32 version.</font>
00411 <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a469">copyToValue</a>(sint32 &<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>, <font class="keyword">const</font> <font class="keywordtype">float</font> &f)
00412 {
00413 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>= (sint32)floor(f+0.5f);
00414 }
00415
00416
00417 <font class="comment">// ***************************************************************************</font>
00418 <font class="comment">// ***************************************************************************</font>
00419 <font class="comment">// Constant Keyframer.</font>
00420 <font class="comment">// ***************************************************************************</font>
00421 <font class="comment">// ***************************************************************************</font>
00422
00423
00424
00425 <font class="comment">// ***************************************************************************</font>
00433 <font class="comment"></font><font class="keyword">template</font><<font class="keyword">class</font> CKeyT, <font class="keyword">class</font> T>
<a name="l00434"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerConstNotBlendable.html">00434</a> <font class="keyword">class </font>CTrackKeyFramerConstNotBlendable : <font class="keyword">public</font> ITrackKeyFramer<CKeyT>
00435 {
00436 <font class="keyword">public</font>:
00437
<a name="l00439"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerConstNotBlendable.html#a0">00439</a> <font class="keyword">virtual</font> <font class="keyword">const</font> IAnimatedValue& <a class="code" href="classNL3D_1_1CTrackKeyFramerConstNotBlendable.html#a0">getValue</a> ()<font class="keyword"> const</font>
00440 <font class="keyword"> </font>{
00441 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTrackKeyFramerConstNotBlendable.html#o0">_Value</a>;
00442 }
00443
<a name="l00445"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerConstNotBlendable.html#a1">00445</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CTrackKeyFramerConstNotBlendable.html#a1">evalKey</a> ( <font class="keyword">const</font> CKeyT* previous, <font class="keyword">const</font> CKeyT* next,
00446 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> datePrevious, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> dateNext,
00447 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> date )
00448 {
00449 <font class="comment">// Const key.</font>
00450 <font class="keywordflow">if</font> (previous)
00451 <a class="code" href="namespaceNL3D.html#a469">copyToValue</a>(<a class="code" href="classNL3D_1_1CTrackKeyFramerConstNotBlendable.html#o0">_Value</a>.Value, previous->Value);
00452 <font class="keywordflow">else</font>
00453 <font class="keywordflow">if</font> (next)
00454 <a class="code" href="namespaceNL3D.html#a469">copyToValue</a>(<a class="code" href="classNL3D_1_1CTrackKeyFramerConstNotBlendable.html#o0">_Value</a>.Value, next->Value);
00455 }
00456
00457 <font class="keyword">private</font>:
<a name="l00458"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerConstNotBlendable.html#o0">00458</a> CAnimatedValueNotBlendable<T> <a class="code" href="classNL3D_1_1CTrackKeyFramerConstNotBlendable.html#o0">_Value</a>;
00459 };
00460
00461
00462 <font class="comment">// ***************************************************************************</font>
00470 <font class="comment"></font><font class="keyword">template</font><<font class="keyword">class</font> CKeyT, <font class="keyword">class</font> T>
<a name="l00471"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerConstBlendable.html">00471</a> <font class="keyword">class </font>CTrackKeyFramerConstBlendable : <font class="keyword">public</font> ITrackKeyFramer<CKeyT>
00472 {
00473 <font class="keyword">public</font>:
00474
<a name="l00476"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerConstBlendable.html#a0">00476</a> <font class="keyword">virtual</font> <font class="keyword">const</font> IAnimatedValue& <a class="code" href="classNL3D_1_1CTrackKeyFramerConstBlendable.html#a0">getValue</a> ()<font class="keyword"> const</font>
00477 <font class="keyword"> </font>{
00478 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTrackKeyFramerConstBlendable.html#o0">_Value</a>;
00479 }
00480
<a name="l00482"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerConstBlendable.html#a1">00482</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CTrackKeyFramerConstBlendable.html#a1">evalKey</a> ( <font class="keyword">const</font> CKeyT* previous, <font class="keyword">const</font> CKeyT* next,
00483 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> datePrevious, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> dateNext,
00484 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> date )
00485 {
00486 <font class="comment">// Const key.</font>
00487 <font class="keywordflow">if</font> (previous)
00488 <a class="code" href="namespaceNL3D.html#a469">copyToValue</a>(<a class="code" href="classNL3D_1_1CTrackKeyFramerConstBlendable.html#o0">_Value</a>.Value, previous->Value);
00489 <font class="keywordflow">else</font>
00490 <font class="keywordflow">if</font> (next)
00491 <a class="code" href="namespaceNL3D.html#a469">copyToValue</a>(<a class="code" href="classNL3D_1_1CTrackKeyFramerConstBlendable.html#o0">_Value</a>.Value, next->Value);
00492 }
00493
00494 <font class="keyword">private</font>:
<a name="l00495"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerConstBlendable.html#o0">00495</a> CAnimatedValueBlendable<T> <a class="code" href="classNL3D_1_1CTrackKeyFramerConstBlendable.html#o0">_Value</a>;
00496 };
00497
00498
00499 <font class="comment">// ***************************************************************************</font>
00500 <font class="comment">// ***************************************************************************</font>
00501 <font class="comment">// Linear Keyframer.</font>
00502 <font class="comment">// ***************************************************************************</font>
00503 <font class="comment">// ***************************************************************************</font>
00504
00505
00506 <font class="comment">// ***************************************************************************</font>
00514 <font class="comment"></font><font class="keyword">template</font><<font class="keyword">class</font> CKeyT, <font class="keyword">class</font> T>
<a name="l00515"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html">00515</a> <font class="keyword">class </font>CTrackKeyFramerLinear : <font class="keyword">public</font> ITrackKeyFramer<CKeyT>
00516 {
00517 <font class="keyword">public</font>:
00518
<a name="l00520"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#a0">00520</a> <font class="keyword">virtual</font> <font class="keyword">const</font> IAnimatedValue& <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#a0">getValue</a> ()<font class="keyword"> const</font>
00521 <font class="keyword"> </font>{
00522 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>;
00523 }
00524
<a name="l00526"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#a1">00526</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#a1">evalKey</a> ( <font class="keyword">const</font> CKeyT* previous, <font class="keyword">const</font> CKeyT* next,
00527 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> datePrevious, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> dateNext,
00528 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> date )
00529 {
00530 <font class="keywordflow">if</font>(previous && next)
00531 {
00532 <font class="comment">// lerp from previous to cur.</font>
00533 date-= datePrevious;
00534 date*= previous->OODeltaTime;
00535 <a class="code" href="namespaceNLMISC.html#a215">NLMISC::clamp</a>(date, 0,1);
00536
00537 <font class="comment">// NB: in case of <CKeyInt,sint32> important that second terme is a float, so copyToValue(sint32, float) is used.</font>
00538 <a class="code" href="namespaceNL3D.html#a469">copyToValue</a>(<a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>.Value, previous->Value*(1.f-(<font class="keywordtype">float</font>)date) + next->Value*(<font class="keywordtype">float</font>)date);
00539 }
00540 <font class="keywordflow">else</font>
00541 {
00542 <font class="keywordflow">if</font> (previous)
00543 <a class="code" href="namespaceNL3D.html#a469">copyToValue</a>(<a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>.Value, previous->Value);
00544 <font class="keywordflow">else</font>
00545 <font class="keywordflow">if</font> (next)
00546 <a class="code" href="namespaceNL3D.html#a469">copyToValue</a>(<a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>.Value, next->Value);
00547 }
00548
00549 }
00550
00551 <font class="keyword">private</font>:
<a name="l00552"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">00552</a> CAnimatedValueBlendable<T> <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>;
00553 };
00554
00555
00556
00557 <font class="comment">// ***************************************************************************</font>
<a name="l00565"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerLinear_3_01CKeyQuat_00_01CQuat_01_4.html">00565</a> <font class="comment"></font><font class="keyword">class </font>CTrackKeyFramerLinear<CKeyQuat, CQuat> : <font class="keyword">public</font> ITrackKeyFramer<CKeyQuat>
00566 {
00567 <font class="keyword">public</font>:
00568
<a name="l00570"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerLinear_3_01CKeyQuat_00_01CQuat_01_4.html#a0">00570</a> <font class="keyword">virtual</font> <font class="keyword">const</font> IAnimatedValue& <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#a0">getValue</a> ()<font class="keyword"> const</font>
00571 <font class="keyword"> </font>{
00572 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>;
00573 }
00574
<a name="l00576"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerLinear_3_01CKeyQuat_00_01CQuat_01_4.html#a1">00576</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#a1">evalKey</a> ( <font class="keyword">const</font> CKeyQuat* previous, <font class="keyword">const</font> CKeyQuat* next,
00577 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> datePrevious, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> dateNext,
00578 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> date )
00579 {
00580 <font class="keywordflow">if</font>(previous && next)
00581 {
00582 <font class="comment">// slerp from previous to cur.</font>
00583 date-= datePrevious;
00584 date*= previous->OODeltaTime;
00585 <a class="code" href="namespaceNLMISC.html#a215">NLMISC::clamp</a>(date, 0,1);
00586 <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>.Value= CQuat::slerp(previous->Value, next->Value, date);
00587 }
00588 <font class="keywordflow">else</font>
00589 {
00590 <font class="keywordflow">if</font> (previous)
00591 <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>.Value=previous->Value;
00592 <font class="keywordflow">else</font>
00593 <font class="keywordflow">if</font> (next)
00594 <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>.Value=next->Value;
00595 }
00596 }
00597
00598 <font class="keyword">private</font>:
<a name="l00599"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerLinear_3_01CKeyQuat_00_01CQuat_01_4.html#o0">00599</a> CAnimatedValueBlendable<CQuat> <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>;
00600 };
00601
00602
00603 <font class="comment">// ***************************************************************************</font>
<a name="l00611"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerLinear_3_01CKeyRGBA_00_01NLMISC_1_1CRGBA_01_4.html">00611</a> <font class="comment"></font><font class="keyword">class </font>CTrackKeyFramerLinear<CKeyRGBA, NLMISC::CRGBA>: <font class="keyword">public</font> ITrackKeyFramer<CKeyRGBA>
00612 {
00613 <font class="keyword">public</font>:
00614
<a name="l00616"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerLinear_3_01CKeyRGBA_00_01NLMISC_1_1CRGBA_01_4.html#a0">00616</a> <font class="keyword">virtual</font> <font class="keyword">const</font> IAnimatedValue& <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#a0">getValue</a> ()<font class="keyword"> const</font>
00617 <font class="keyword"> </font>{
00618 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>;
00619 }
00620
<a name="l00622"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerLinear_3_01CKeyRGBA_00_01NLMISC_1_1CRGBA_01_4.html#a1">00622</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#a1">evalKey</a> ( <font class="keyword">const</font> CKeyRGBA* previous, <font class="keyword">const</font> CKeyRGBA* next,
00623 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> datePrevious, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> dateNext,
00624 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> date )
00625 {
00626 <font class="keywordflow">if</font>(previous && next)
00627 {
00628 <font class="comment">// lerp from previous to cur.</font>
00629 date-= datePrevious;
00630 date*= previous->OODeltaTime;
00631 <a class="code" href="namespaceNLMISC.html#a215">NLMISC::clamp</a>(date, 0,1);
00632
00633 <font class="comment">// blend.</font>
00634 <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>.Value.blendFromui(previous->Value, next->Value, (uint)(date*256));
00635 }
00636 <font class="keywordflow">else</font>
00637 {
00638 <font class="keywordflow">if</font> (previous)
00639 <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>.Value= previous->Value;
00640 <font class="keywordflow">else</font>
00641 <font class="keywordflow">if</font> (next)
00642 <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>.Value= next->Value;
00643 }
00644 }
00645
00646 <font class="keyword">private</font>:
<a name="l00647"></a><a class="code" href="classNL3D_1_1CTrackKeyFramerLinear_3_01CKeyRGBA_00_01NLMISC_1_1CRGBA_01_4.html#o0">00647</a> CAnimatedValueBlendable<NLMISC::CRGBA> <a class="code" href="classNL3D_1_1CTrackKeyFramerLinear.html#o0">_Value</a>;
00648 };
00649
00650
00651
00652 <font class="comment">// ***************************************************************************</font>
00653 <font class="comment">// ***************************************************************************</font>
00654 <font class="comment">// TCB / Bezier Keyframer.</font>
00655 <font class="comment">// ***************************************************************************</font>
00656 <font class="comment">// ***************************************************************************</font>
00657
00658
00659 <font class="comment">// Template implementation for TCB and Bezier.</font>
00660 <font class="preprocessor">#include "<a class="code" href="track__tcb_8h.html">track_tcb.h</a>"</font>
00661 <font class="preprocessor">#include "<a class="code" href="track__bezier_8h.html">track_bezier.h</a>"</font>
00662
00663
00664
00665 <font class="comment">// ***************************************************************************</font>
00666 <font class="comment">// ***************************************************************************</font>
00667 <font class="comment">// Predefined types for KeyFramer tracks.</font>
00668 <font class="comment">// ***************************************************************************</font>
00669 <font class="comment">// ***************************************************************************</font>
00670
00671
00672 <font class="comment">// Const tracks.</font>
00673 <font class="keyword">class </font>CTrackKeyFramerConstFloat : <font class="keyword">public</font> CTrackKeyFramerConstBlendable<CKeyFloat,float>
00674 {
00675 <font class="keyword">public</font>:
00676 <a class="code" href="classNL3D_1_1CTrackKeyFramerConstFloat.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerConstFloat);
00677 };
00678 <font class="keyword">class </font>CTrackKeyFramerConstVector : <font class="keyword">public</font> CTrackKeyFramerConstBlendable<CKeyVector, CVector>
00679 {
00680 <font class="keyword">public</font>:
00681 <a class="code" href="classNL3D_1_1CTrackKeyFramerConstVector.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerConstVector);
00682 };
00683 <font class="keyword">class </font>CTrackKeyFramerConstQuat : <font class="keyword">public</font> CTrackKeyFramerConstBlendable<CKeyQuat, CQuat>
00684 {
00685 <font class="keyword">public</font>:
00686 <a class="code" href="classNL3D_1_1CTrackKeyFramerConstQuat.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerConstQuat);
00687 };
00688 <font class="keyword">class </font>CTrackKeyFramerConstInt : <font class="keyword">public</font> CTrackKeyFramerConstBlendable<CKeyInt, sint32>
00689 {
00690 <font class="keyword">public</font>:
00691 <a class="code" href="classNL3D_1_1CTrackKeyFramerConstInt.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerConstInt);
00692 };
00693 <font class="keyword">class </font>CTrackKeyFramerConstRGBA : <font class="keyword">public</font> CTrackKeyFramerConstBlendable<CKeyRGBA, NLMISC::CRGBA>
00694 {
00695 <font class="keyword">public</font>:
00696 <a class="code" href="classNL3D_1_1CTrackKeyFramerConstRGBA.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerConstRGBA);
00697 };
00698
00699 <font class="keyword">class </font>CTrackKeyFramerConstString : <font class="keyword">public</font> CTrackKeyFramerConstNotBlendable<CKeyString, std::string>
00700 {
00701 <font class="keyword">public</font>:
00702 <a class="code" href="classNL3D_1_1CTrackKeyFramerConstString.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerConstString);
00703 };
00704 <font class="keyword">class </font>CTrackKeyFramerConstBool : <font class="keyword">public</font> CTrackKeyFramerConstNotBlendable<CKeyBool, bool>
00705 {
<a name="l00706"></a><a class="code" href="classNL3D_1_1CTCBTools.html">00706</a> <font class="keyword">public</font>:
00707 <a class="code" href="classNL3D_1_1CTrackKeyFramerConstBool.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerConstBool);
00708 };
<a name="l00709"></a><a class="code" href="classNL3D_1_1CTCBTools.html#t0">00709</a>
00710
00711 <font class="comment">// Linear tracks.</font>
00712 <font class="keyword">class </font>CTrackKeyFramerLinearFloat : <font class="keyword">public</font> CTrackKeyFramerLinear<CKeyFloat, float>
00713 {
<a name="l00714"></a><a class="code" href="classNL3D_1_1CTCBTools.html#b0">00714</a> <font class="keyword">public</font>:
00715 <a class="code" href="classNL3D_1_1CTrackKeyFramerLinearFloat.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerLinearFloat);
00716 };
00717 <font class="keyword">class </font>CTrackKeyFramerLinearVector : <font class="keyword">public</font> CTrackKeyFramerLinear<CKeyVector, CVector>
00718 {
00719 <font class="keyword">public</font>:
00720 <a class="code" href="classNL3D_1_1CTrackKeyFramerLinearVector.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerLinearVector);
00721 };
00722 <font class="keyword">class </font>CTrackKeyFramerLinearQuat : <font class="keyword">public</font> CTrackKeyFramerLinear<CKeyQuat, CQuat>
00723 {
00724 <font class="keyword">public</font>:
00725 <a class="code" href="classNL3D_1_1CTrackKeyFramerLinearQuat.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerLinearQuat);
00726 };
00727 <font class="keyword">class </font>CTrackKeyFramerLinearInt : <font class="keyword">public</font> CTrackKeyFramerLinear<CKeyInt, sint32>
00728 {
00729 <font class="keyword">public</font>:
00730 <a class="code" href="classNL3D_1_1CTrackKeyFramerLinearInt.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerLinearInt);
00731 };
00732 <font class="keyword">class </font>CTrackKeyFramerLinearRGBA : <font class="keyword">public</font> CTrackKeyFramerLinear<CKeyRGBA, NLMISC::CRGBA>
00733 {
00734 <font class="keyword">public</font>:
00735 <a class="code" href="classNL3D_1_1CTrackKeyFramerLinearRGBA.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerLinearRGBA);
00736 };
00737
00738
00739 <font class="comment">// TCB tracks.</font>
00740 <font class="keyword">class </font>CTrackKeyFramerTCBFloat : <font class="keyword">public</font> <a class="code" href="classCTrackKeyFramerTCB.html">CTrackKeyFramerTCB</a><CKeyTCBFloat, float>
00741 {
00742 <font class="keyword">public</font>:
00743 <a class="code" href="classNL3D_1_1CTrackKeyFramerTCBFloat.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerTCBFloat);
00744 };
00745 <font class="keyword">class </font>CTrackKeyFramerTCBVector : <font class="keyword">public</font> <a class="code" href="classCTrackKeyFramerTCB.html">CTrackKeyFramerTCB</a><CKeyTCBVector, CVector>
00746 {
00747 <font class="keyword">public</font>:
00748 <a class="code" href="classNL3D_1_1CTrackKeyFramerTCBVector.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerTCBVector);
00749 };
00750 <font class="keyword">class </font>CTrackKeyFramerTCBQuat : <font class="keyword">public</font> <a class="code" href="classCTrackKeyFramerTCB.html">CTrackKeyFramerTCB</a><CKeyTCBQuat, NLMISC::CAngleAxis>
00751 {
00752 <font class="keyword">public</font>:
00753 <a class="code" href="classNL3D_1_1CTrackKeyFramerTCBQuat.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerTCBQuat);
00754 };
00755 <font class="keyword">class </font>CTrackKeyFramerTCBInt : <font class="keyword">public</font> <a class="code" href="classCTrackKeyFramerTCB.html">CTrackKeyFramerTCB</a><CKeyTCBFloat, sint32>
00756 {
00757 <font class="keyword">public</font>:
00758 <a class="code" href="classNL3D_1_1CTrackKeyFramerTCBInt.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerTCBInt);
00759 };
00760 <font class="keyword">class </font>CTrackKeyFramerTCBRGBA : <font class="keyword">public</font> <a class="code" href="classCTrackKeyFramerTCB.html">CTrackKeyFramerTCB</a><CKeyTCBVector, NLMISC::CRGBA>
<a name="l00761"></a><a class="code" href="classNL3D_1_1CTCBTools.html#b1">00761</a> {
00762 <font class="keyword">public</font>:
00763 <a class="code" href="classNL3D_1_1CTrackKeyFramerTCBRGBA.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerTCBRGBA);
00764 };
00765
00766
00767 <font class="comment">// Bezier tracks.</font>
00768 <font class="keyword">class </font>CTrackKeyFramerBezierFloat : <font class="keyword">public</font> <a class="code" href="classCTrackKeyFramerBezier.html">CTrackKeyFramerBezier</a><CKeyBezierFloat, float>
00769 {
00770 <font class="keyword">public</font>:
00771 <a class="code" href="classNL3D_1_1CTrackKeyFramerBezierFloat.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerBezierFloat);
00772 };
00773 <font class="keyword">class </font>CTrackKeyFramerBezierVector : <font class="keyword">public</font> <a class="code" href="classCTrackKeyFramerBezier.html">CTrackKeyFramerBezier</a><CKeyBezierVector, CVector>
00774 {
00775 <font class="keyword">public</font>:
00776 <a class="code" href="classNL3D_1_1CTrackKeyFramerBezierVector.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerBezierVector);
00777 };
00778 <font class="keyword">class </font>CTrackKeyFramerBezierQuat : <font class="keyword">public</font> <a class="code" href="classCTrackKeyFramerBezier.html">CTrackKeyFramerBezier</a><CKeyBezierQuat, CQuat>
<a name="l00779"></a><a class="code" href="classNL3D_1_1CTCBTools.html#b2">00779</a> {
00780 <font class="keyword">public</font>:
00781 <a class="code" href="classNL3D_1_1CTrackKeyFramerBezierQuat.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerBezierQuat);
00782 };
00783 <font class="keyword">class </font>CTrackKeyFramerBezierInt : <font class="keyword">public</font> <a class="code" href="classCTrackKeyFramerBezier.html">CTrackKeyFramerBezier</a><CKeyBezierFloat, sint32>
00784 {
00785 <font class="keyword">public</font>:
00786 <a class="code" href="classNL3D_1_1CTrackKeyFramerBezierInt.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerBezierInt);
00787 };
00788 <font class="keyword">class </font>CTrackKeyFramerBezierRGBA : <font class="keyword">public</font> <a class="code" href="classCTrackKeyFramerBezier.html">CTrackKeyFramerBezier</a><CKeyBezierVector, NLMISC::CRGBA>
00789 {
00790 <font class="keyword">public</font>:
00791 <a class="code" href="classNL3D_1_1CTrackKeyFramerBezierRGBA.html#a0">NLMISC_DECLARE_CLASS</a> (CTrackKeyFramerBezierRGBA);
00792 };
00793
<a name="l00794"></a><a class="code" href="classNL3D_1_1CTCBTools.html#b3">00794</a>
00795
00796
00797
00798 } <font class="comment">// NL3D</font>
00799
00800
00801 <font class="preprocessor">#endif // NL_TRACK_KEYFRAMER_H</font>
00802 <font class="preprocessor"></font>
00803 <font class="comment">/* End of track_keyframer.h */</font>
</pre></div>
<!-- footer -->
<BR><FONT Size=+5> </FONT>
</TD>
<TD WIDTH=15><IMG SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|