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
|
<!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='/'><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>ps_attrib_maker_bin_op_inline.h</h1><a href="ps__attrib__maker__bin__op__inline_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
00027 <font class="preprocessor">#ifndef NL_PS_ATTRIB_MAKER_BIN_OP_H</font>
00028 <font class="preprocessor"></font><font class="preprocessor"> #error Do not include this file! include ps_attrib_maker_bin_op_inline instead!</font>
00029 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00030 <font class="preprocessor"></font>
00031 <font class="preprocessor">#ifndef NL_PS_ATTRIB_MAKER_BIN_OP_INLINE_H</font>
00032 <font class="preprocessor"></font><font class="preprocessor">#define NL_PS_ATTRIB_MAKER_BIN_OP_INLINE_H</font>
00033 <font class="preprocessor"></font>
00034
00035
00036 <font class="keyword">namespace </font>NL3D {
00037
00038
00044 <font class="keyword">template</font> <<font class="keyword">class</font> T>
00045 <font class="keyword">inline</font> T <a class="code" href="namespaceNL3D.html#a401">PSBinOpModulate</a>(T <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>, T <a class="code" href="driver__opengl__extension__def_8h.html#a402">arg2</a>) { <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a> * <a class="code" href="driver__opengl__extension__def_8h.html#a402">arg2</a>; }
00046 <font class="keyword">template</font> <<font class="keyword">class</font> T>
00047 <font class="keyword">inline</font> T <a class="code" href="namespaceNL3D.html#a402">PSBinOpAdd</a>(T <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>, T <a class="code" href="driver__opengl__extension__def_8h.html#a402">arg2</a>) { <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a402">arg2</a>; }
00048 <font class="keyword">template</font> <<font class="keyword">class</font> T>
00049 <font class="keyword">inline</font> T <a class="code" href="namespaceNL3D.html#a403">PSBinOpSubtract</a>(T <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>, T <a class="code" href="driver__opengl__extension__def_8h.html#a402">arg2</a>) { <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a> - <a class="code" href="driver__opengl__extension__def_8h.html#a402">arg2</a>; }
00050
00051 <font class="keyword">template</font> <>
00052 <font class="keyword">inline</font> CPlaneBasis <a class="code" href="namespaceNL3D.html#a401">PSBinOpModulate</a>(CPlaneBasis p1, CPlaneBasis p2)
00053 {
00054 <font class="comment">// we compute p1 * p2</font>
00055 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> <a class="code" href="driver__opengl__extension__def_8h.html#a366">z</a> = p1.X ^ p1.Y;
00056 CPlaneBasis <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>;
00057 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.X.x = p2.X.x * p1.X.x + p2.X.y * p1.Y.x + p2.X.z * z.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>;
00058 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.X.y = p2.X.x * p1.X.y + p2.X.y * p1.Y.y + p2.X.z * z.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>;
00059 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.X.z = p2.X.x * p1.X.z + p2.X.y * p1.Y.z + p2.X.z * z.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>;
00060
00061 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.Y.x = p2.Y.x * p1.X.x + p2.Y.y * p1.Y.x + p2.Y.z * z.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>;
00062 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.Y.y = p2.Y.x * p1.X.y + p2.Y.y * p1.Y.y + p2.Y.z * z.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>;
00063 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.Y.z = p2.Y.x * p1.X.z + p2.Y.y * p1.Y.z + p2.Y.z * z.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>;
00064
00065 <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>;
00066
00067 }
00068 <font class="keyword">template</font> <>
00069 <font class="keyword">inline</font> CPlaneBasis <a class="code" href="namespaceNL3D.html#a402">PSBinOpAdd</a>(CPlaneBasis p1, CPlaneBasis p2)
00070 {
00071 <a class="code" href="debug_8h.html#a6">nlassert</a>(0); <font class="comment">// not allowed for now</font>
00072 <font class="keywordflow">return</font> CPlaneBasis(<a class="code" href="classNLMISC_1_1CVector.html#p0">NLMISC::CVector::Null</a>);
00073 }
00074 <font class="keyword">template</font> <>
00075 <font class="keyword">inline</font> CPlaneBasis <a class="code" href="namespaceNL3D.html#a403">PSBinOpSubtract</a>(CPlaneBasis p1, CPlaneBasis p2)
00076 {
00077 <a class="code" href="debug_8h.html#a6">nlassert</a>(0); <font class="comment">// not allowed for now</font>
00078 <font class="keywordflow">return</font> CPlaneBasis(<a class="code" href="classNLMISC_1_1CVector.html#p0">NLMISC::CVector::Null</a>);
00079 }
00080
00081
00082
00083
00084 <font class="keyword">template</font> <>
00085 <font class="keyword">inline</font> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> <a class="code" href="namespaceNL3D.html#a401">PSBinOpModulate</a>(<a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> t1, <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> t2)
00086 {
00087 <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> result;
00088 result.<a class="code" href="classNLMISC_1_1CRGBA.html#a9">modulateFromColor</a>(t1, t2);
00089 <font class="keywordflow">return</font> result;
00090 }
00091 <font class="keyword">template</font> <>
00092 <font class="keyword">inline</font> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> <a class="code" href="namespaceNL3D.html#a402">PSBinOpAdd</a>(<a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> t1, <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> t2)
00093 {
00094 <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>;
00095 uint S = t1.<a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> + t2.<a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>; <font class="keywordflow">if</font> (S > 255) S = 255; r.<a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> = (uint8) S;
00096 S = t1.<a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> + t2.<a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>; <font class="keywordflow">if</font> (S > 255) S = 255; r.<a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> = (uint8) S;
00097 S = t1.<a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> + t2.<a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>; <font class="keywordflow">if</font> (S > 255) S = 255; r.<a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> = (uint8) S;
00098 <font class="keywordflow">return</font> r;
00099 }
00100 <font class="keyword">template</font> <>
00101 <font class="keyword">inline</font> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> <a class="code" href="namespaceNL3D.html#a403">PSBinOpSubtract</a>(<a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> t1, <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> t2)
00102 {
00103 <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>;
00104 sint S = t1.<a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> - t2.<a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>; <font class="keywordflow">if</font> (S < 0) S = 0; r.<a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> = (uint8) S;
00105 S = t1.<a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> - t2.<a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>; <font class="keywordflow">if</font> (S < 0) S = 0; r.<a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> = (uint8) S;
00106 S = t1.<a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> - t2.<a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>; <font class="keywordflow">if</font> (S < 0) S = 0; r.<a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> = (uint8) S;
00107 <font class="keywordflow">return</font> r;
00108 }
00109
00110
00112 <font class="comment">// CPSAttribMakerBinOp implementation //</font>
00114 <font class="comment"></font>
00115
00116
00117 <font class="comment">//=================================================================================================================</font>
00119 <font class="comment">template <class T></font>
<a name="l00120"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z710_1">00120</a> CPSAttribMakerBinOp<T>::CPSAttribMakerBinOp(<font class="keyword">const</font> CPSAttribMakerBinOp &other) : CPSAttribMaker<T>(other) <font class="comment">// parent copy ctor</font>
00121 {
00122 std::auto_ptr<CPSAttribMaker<T> > a0(NLMISC::safe_cast<CPSAttribMaker<T> *>(other._Arg[0]->clone()))
00123 , a1(NLMISC::safe_cast<CPSAttribMaker<T> *>(other._Arg[1]->clone()));
00124 this-><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n0">_Op</a> = other._Op;
00125 this-><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n2">_Size</a> = other._Size;
00126 this-><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n3">_MaxSize</a> = other._MaxSize;
00127 this-><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0] = a0.release();
00128 this-><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1] = a1.release();
00129 }
00130
00131 <font class="comment">//=================================================================================================================</font>
00132 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00133"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z710_0">00133</a> CPSAttribMakerBinOp<T>::CPSAttribMakerBinOp() : _Op(CPSBinOp::selectArg1), _Size(0), _MaxSize(0)
00134 {
00135 <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0] = <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1] = NULL;
00136 <a class="code" href="classNL3D_1_1CPSAttribMaker.html#n1">_HasMemory</a> = <font class="keyword">true</font>;
00137 }
00138
00139 <font class="comment">//=================================================================================================================</font>
00140 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00141"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#b3">00141</a> <font class="keywordtype">void</font> CPSAttribMakerBinOp<T>::clean(<font class="keywordtype">void</font>)
00142 {
00143 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0];
00144 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1];
00145 }
00146
00147 <font class="comment">//=================================================================================================================</font>
00148 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00149"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z710_2">00149</a> CPSAttribMakerBinOp<T>::~CPSAttribMakerBinOp()
00150 {
00151 <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#b3">clean</a>();
00152 }
00153
00154 <font class="comment">//=================================================================================================================</font>
00156 <font class="comment">bool CPSAttribMakerBinOp<CPlaneBasis>::supportOp(CPSBinOp::BinOp op) </font>
00157 {
00158 <font class="keywordflow">return</font> (op == CPSBinOp::selectArg1 || op == CPSBinOp::selectArg2 || op == CPSBinOp::modulate);
00159 }
00160
00161
00162 <font class="comment">//=================================================================================================================</font>
00163 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00164"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_0">00164</a> T CPSAttribMakerBinOp<T>::get (CPSLocated *loc, uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
00165 {
00166 <font class="keywordflow">switch</font> (_Op)
00167 {
00168 <font class="keywordflow">case</font> CPSBinOp::selectArg1:
00169 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]->get(loc, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
00170 <font class="keywordflow">break</font>;
00171 <font class="keywordflow">case</font> CPSBinOp::selectArg2:
00172 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]->get(loc, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
00173 <font class="keywordflow">break</font>;
00174 <font class="keywordflow">case</font> CPSBinOp::modulate:
00175 <font class="keywordflow">return</font> <a class="code" href="namespaceNL3D.html#a401">PSBinOpModulate</a>(<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]-><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_0">get</a>(loc, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>), <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]-><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_0">get</a>(loc, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>));
00176 <font class="keywordflow">break</font>;
00177 <font class="keywordflow">case</font> CPSBinOp::add:
00178 <font class="keywordflow">return</font> <a class="code" href="namespaceNL3D.html#a402">PSBinOpAdd</a>(<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]-><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_0">get</a>(loc, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>), <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]-><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_0">get</a>(loc, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>));
00179 <font class="keywordflow">break</font>;
00180 <font class="keywordflow">case</font> CPSBinOp::subtract:
00181 <font class="keywordflow">return</font> <a class="code" href="namespaceNL3D.html#a403">PSBinOpSubtract</a>(<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]-><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_0">get</a>(loc, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>), <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]-><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_0">get</a>(loc, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>));
00182 <font class="keywordflow">break</font>;
00183 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
00184 }
00185
00186 <a class="code" href="debug_8h.html#a12">nlstop</a>;
00187 <font class="keywordflow">return</font> T();
00188 }
00189
00190 <font class="comment">// for private use</font>
00191 <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a398">MakePrivate</a>(uint8 * dest, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> *src1, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> *src2, uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, uint32 numAttrib, CPSBinOp::BinOp op);
00192 <font class="comment">// for private use</font>
00193 <font class="keyword">template</font> <<font class="keyword">class</font> T>
00194 <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a398">MakePrivate</a>(uint8 * dest, <font class="keyword">const</font> T *src1, <font class="keyword">const</font> T *src2, uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, uint32 numAttrib, CPSBinOp::BinOp op)
00195 {
00196 uint8 *destEnd = dest + (<a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a> * numAttrib);
00197
00198 <font class="keywordflow">switch</font> (op)
00199 {
00200 <font class="keywordflow">case</font> CPSBinOp::modulate:
00201 {
00202 <font class="keywordflow">while</font> (dest != destEnd)
00203 {
00204 * (T *) dest = <a class="code" href="namespaceNL3D.html#a401">PSBinOpModulate</a>(*src1 ++, *src2 ++);
00205 dest += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00206 }
00207 }
00208 <font class="keywordflow">break</font>;
00209 <font class="keywordflow">case</font> CPSBinOp::add:
00210 {
00211 <font class="keywordflow">while</font> (dest != destEnd)
00212 {
00213 * (T *) dest = <a class="code" href="namespaceNL3D.html#a402">PSBinOpAdd</a>(*src1 ++, *src2 ++);
00214 dest += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00215 }
00216 }
00217 <font class="keywordflow">break</font>;
00218 <font class="keywordflow">case</font> CPSBinOp::subtract:
00219 <font class="keywordflow">while</font> (dest != destEnd)
00220 {
00221 * (T *) dest = <a class="code" href="namespaceNL3D.html#a403">PSBinOpSubtract</a>(*src1 ++, *src2 ++);
00222 dest += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00223 }
00224 <font class="keywordflow">break</font>;
00225 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
00226 }
00227 }
00228
00229
00230 <font class="comment">//=================================================================================================================</font>
00231 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00232"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#b0">00232</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> *CPSAttribMakerBinOp<T>::makePrivate(T *buf1,
00233 T *buf2,
00234 CPSLocated *loc,
00235 uint32 startIndex,
00236 <font class="keywordtype">void</font> *tab,
00237 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>,
00238 uint32 numAttrib,
00239 <font class="keywordtype">bool</font> allowNoCopy <font class="comment">/* = false */</font>,
00240 uint32 srcStep <font class="comment">/* = (1 << 16)*/</font>
00241 )<font class="keyword"> const</font>
00242 <font class="keyword"></font>{
00243 uint8 *dest = (uint8 *) tab;
00244 uint leftToDo = numAttrib, toProcess;
00245 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0] && <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]);
00246 <font class="keywordflow">switch</font> (_Op)
00247 {
00248 <font class="keywordflow">case</font> CPSBinOp::selectArg1:
00249 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]->make(loc, startIndex, tab, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, numAttrib, allowNoCopy, srcStep);
00250 <font class="keywordflow">break</font>;
00251 <font class="keywordflow">case</font> CPSBinOp::selectArg2:
00252 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]->make(loc, startIndex, tab, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, numAttrib, allowNoCopy, srcStep);
00253 <font class="keywordflow">break</font>;
00254 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
00255 }
00256
00257
00258
00259 <font class="keywordflow">while</font> (leftToDo)
00260 {
00261 toProcess = leftToDo > <a class="code" href="namespaceNL3D.html#a187">PSBinOpBufSize</a> ? <a class="code" href="namespaceNL3D.html#a187">PSBinOpBufSize</a> : leftToDo;
00262 T *src1 = (T *) <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]->make(loc, startIndex + (numAttrib - leftToDo), &buf1[0], <font class="keyword">sizeof</font>(T), toProcess, <font class="keyword">true</font>, srcStep);
00263 T *src2 = (T *) <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]->make(loc, startIndex + (numAttrib - leftToDo), &buf2[0], <font class="keyword">sizeof</font>(T), toProcess, <font class="keyword">true</font>, srcStep);
00264 <a class="code" href="namespaceNL3D.html#a398">MakePrivate</a>(dest, src1, src2, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, toProcess, <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n0">_Op</a>);
00265 leftToDo -= toProcess;
00266 }
00267
00268 <font class="keywordflow">return</font> tab;
00269 }
00270
00271 <font class="comment">//=================================================================================================================</font>
00272 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00273"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_1">00273</a> <font class="keywordtype">void</font> *CPSAttribMakerBinOp<T>::make (CPSLocated *loc,
00274 uint32 startIndex,
00275 <font class="keywordtype">void</font> *tab,
00276 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>,
00277 uint32 numAttrib,
00278 <font class="keywordtype">bool</font> allowNoCopy <font class="comment">/* = false */</font>,
00279 uint32 srcStep <font class="comment">/* = (1 << 16)*/</font>
00280 )<font class="keyword"> const</font>
00281 <font class="keyword"></font>{
00286 uint8 tab1[<a class="code" href="namespaceNL3D.html#a187">PSBinOpBufSize</a> * <font class="keyword">sizeof</font>(T)];
00287 uint8 tab2[<a class="code" href="namespaceNL3D.html#a187">PSBinOpBufSize</a> * <font class="keyword">sizeof</font>(T)];
00288 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#b0">makePrivate</a>((T *) &tab1[0], (T *) &tab2[0], loc, startIndex, tab, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, numAttrib, allowNoCopy, srcStep);
00289 }
00290
00291
00292 <font class="comment">// for private use</font>
00293 <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a399">Make4Private</a>(uint8 * dest, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> *src1, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> *src2, uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, uint32 numAttrib, CPSBinOp::BinOp op);
00294
00295 <font class="comment">// for private use</font>
00296 <font class="keyword">template</font> <<font class="keyword">class</font> T>
00297 <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a399">Make4Private</a>(uint8 * dest, <font class="keyword">const</font> T *src1, <font class="keyword">const</font> T *src2, uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, uint32 numAttrib, CPSBinOp::BinOp op)
00298 {
00299 <font class="keyword">const</font> uint stride2 = <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a> << 1, stride3 = <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a> + stride2, stride4 = stride2 << 1;
00300 uint8 *destEnd = dest + ((<a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a><<2) * numAttrib);
00301 <font class="keywordflow">switch</font> (op)
00302 {
00303 <font class="keywordflow">case</font> CPSBinOp::modulate:
00304 {
00305 <font class="keywordflow">while</font> (dest != destEnd)
00306 {
00307 <font class="comment">// compute one value, and duplicate if 4 times</font>
00308 * (T *) dest = <a class="code" href="namespaceNL3D.html#a401">PSBinOpModulate</a>(*src1 ++, *src2 ++);
00309 * (T *) (dest + <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>) = * (T *) dest;
00310 * (T *) (dest + stride2) = * (T *) dest;
00311 * (T *) (dest + stride3) = * (T *) dest;
00312 dest += stride4;
00313 }
00314 }
00315 <font class="keywordflow">break</font>;
00316 <font class="keywordflow">case</font> CPSBinOp::add:
00317 {
00318 <font class="keywordflow">while</font> (dest != destEnd)
00319 {
00320 <font class="comment">// compute one value, and duplicate if 4 times</font>
00321 * (T *) dest = <a class="code" href="namespaceNL3D.html#a402">PSBinOpAdd</a>(*src1 ++, *src2 ++);
00322 * (T *) (dest + <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>) = * (T *) dest;
00323 * (T *) (dest + stride2) = * (T *) dest;
00324 * (T *) (dest + stride3) = * (T *) dest;
00325 dest += stride4;
00326 }
00327 }
00328 <font class="keywordflow">break</font>;
00329 <font class="keywordflow">case</font> CPSBinOp::subtract:
00330 <font class="keywordflow">while</font> (dest != destEnd)
00331 {
00332 <font class="comment">// compute one value, and duplicate if 4 times</font>
00333 * (T *) dest = <a class="code" href="namespaceNL3D.html#a403">PSBinOpSubtract</a>(*src1 ++, *src2 ++);
00334 * (T *) (dest + <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>) = * (T *) dest;
00335 * (T *) (dest + stride2) = * (T *) dest;
00336 * (T *) (dest + stride3) = * (T *) dest;
00337 dest += stride4;
00338 }
00339 <font class="keywordflow">break</font>;
00340 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
00341 }
00342 }
00343
00344 <font class="comment">//=================================================================================================================</font>
00345 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00346"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#b1">00346</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> CPSAttribMakerBinOp<T>::make4Private(T *buf1,
00347 T *buf2,
00348 CPSLocated *loc,
00349 uint32 startIndex,
00350 <font class="keywordtype">void</font> *tab,
00351 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>,
00352 uint32 numAttrib,
00353 uint32 srcStep <font class="comment">/* = (1 << 16)*/</font>
00354 )<font class="keyword"> const</font>
00355 <font class="keyword"></font>{
00356 uint8 *dest = (uint8 *) tab;
00357 uint leftToDo = numAttrib, toProcess;
00358 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0] && <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]);
00359 <font class="keywordflow">switch</font> (_Op)
00360 {
00361 <font class="keywordflow">case</font> CPSBinOp::selectArg1:
00362 <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]->make4(loc, startIndex, tab, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, numAttrib, srcStep);
00363 <font class="keywordflow">return</font>;
00364 <font class="keywordflow">break</font>;
00365 <font class="keywordflow">case</font> CPSBinOp::selectArg2:
00366 <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]->make4(loc, startIndex, tab, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, numAttrib, srcStep);
00367 <font class="keywordflow">return</font>;
00368 <font class="keywordflow">break</font>;
00369 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
00370 }
00371
00372 <font class="keywordflow">while</font> (leftToDo)
00373 {
00374 toProcess = leftToDo > <a class="code" href="namespaceNL3D.html#a187">PSBinOpBufSize</a> ? <a class="code" href="namespaceNL3D.html#a187">PSBinOpBufSize</a> : leftToDo;
00375 T *src1 = (T *) <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]->make(loc, startIndex + (numAttrib - leftToDo), &buf1[0], <font class="keyword">sizeof</font>(T), toProcess, <font class="keyword">true</font>, srcStep);
00376 T *src2 = (T *) <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]->make(loc, startIndex + (numAttrib - leftToDo), &buf2[0], <font class="keyword">sizeof</font>(T), toProcess, <font class="keyword">true</font>, srcStep);
00377
00378 <a class="code" href="namespaceNL3D.html#a399">Make4Private</a>(dest, src1, src2, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, toProcess, <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n0">_Op</a>);
00379 leftToDo -= toProcess;
00380 }
00381 }
00382
00383
00384 <font class="comment">//=================================================================================================================</font>
00385 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00386"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_2">00386</a> <font class="keywordtype">void</font> CPSAttribMakerBinOp<T>::make4 (CPSLocated *loc,
00387 uint32 startIndex,
00388 <font class="keywordtype">void</font> *tab,
00389 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>,
00390 uint32 numAttrib,
00391 uint32 srcStep <font class="comment">/*= (1 << 16) */</font>
00392 )<font class="keyword"> const</font>
00393 <font class="keyword"></font>
00394 <font class="keyword"></font>{
00399 uint8 tab1[<a class="code" href="namespaceNL3D.html#a187">PSBinOpBufSize</a> * <font class="keyword">sizeof</font>(T)];
00400 uint8 tab2[<a class="code" href="namespaceNL3D.html#a187">PSBinOpBufSize</a> * <font class="keyword">sizeof</font>(T)];
00401 <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#b1">make4Private</a>((T *) &tab1[0], (T *) &tab2[0], loc, startIndex, tab, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, numAttrib, srcStep);
00402 }
00403
00404
00405 <font class="comment">// for private use</font>
00406 <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a400">MakeNPrivate</a>(uint8 * dest, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> *src1, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> *src2, uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, uint32 numAttrib, CPSBinOp::BinOp op, uint nbReplicate);
00407
00408 <font class="comment">// for private use</font>
00409 <font class="keyword">template</font> <<font class="keyword">class</font> T>
00410 <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a400">MakeNPrivate</a>(uint8 * dest,
00411 <font class="keyword">const</font> T *src1,
00412 <font class="keyword">const</font> T *src2,
00413 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>,
00414 uint32 numAttrib,
00415 CPSBinOp::BinOp op,
00416 uint nbReplicate,
00417 uint32 srcStep = (1 << 16)
00418 )
00419 {
00420 uint k;
00421 uint8 *destEnd = dest + ((<a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a> * nbReplicate) * numAttrib);
00422 <font class="keywordflow">switch</font> (op)
00423 {
00424 <font class="keywordflow">case</font> CPSBinOp::modulate:
00425 {
00426 <font class="keywordflow">while</font> (dest != destEnd)
00427 {
00428 * (T *) dest = <a class="code" href="namespaceNL3D.html#a401">PSBinOpModulate</a>(*src1 ++, *src2 ++);
00429 k = (nbReplicate - 1);
00430 <font class="keywordflow">do</font>
00431 {
00432 * (T *) (dest + <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>) = *(T *) dest;
00433 dest += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00434 }
00435 <font class="keywordflow">while</font> (--k);
00436 dest += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00437 }
00438 }
00439 <font class="keywordflow">break</font>;
00440 <font class="keywordflow">case</font> CPSBinOp::add:
00441 {
00442 <font class="keywordflow">while</font> (dest != destEnd)
00443 {
00444 * (T *) dest = <a class="code" href="namespaceNL3D.html#a402">PSBinOpAdd</a>(*src1 ++, *src2 ++);
00445 k = (nbReplicate - 1);
00446 <font class="keywordflow">do</font>
00447 {
00448 * (T *) (dest + <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>) = *(T *) dest;
00449 dest += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00450 }
00451 <font class="keywordflow">while</font> (--k);
00452 dest += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00453 }
00454 }
00455 <font class="keywordflow">break</font>;
00456 <font class="keywordflow">case</font> CPSBinOp::subtract:
00457 <font class="keywordflow">while</font> (dest != destEnd)
00458 {
00459 * (T *) dest = <a class="code" href="namespaceNL3D.html#a403">PSBinOpSubtract</a>(*src1 ++, *src2 ++);
00460 k = (nbReplicate - 1);
00461 <font class="keywordflow">do</font>
00462 {
00463 * (T *) (dest + <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>) = *(T *) dest;
00464 dest += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00465 }
00466 <font class="keywordflow">while</font> (--k);
00467 dest += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00468 }
00469 <font class="keywordflow">break</font>;
00470 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
00471 }
00472 }
00473
00474 <font class="comment">//=================================================================================================================</font>
00475 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00476"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#b2">00476</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> CPSAttribMakerBinOp<T>::makeNPrivate(T *buf1,
00477 T *buf2,
00478 CPSLocated *loc,
00479 uint32 startIndex,
00480 <font class="keywordtype">void</font> *tab,
00481 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>,
00482 uint32 numAttrib,
00483 uint32 nbReplicate,
00484 uint32 srcStep <font class="comment">/*= (1 << 16)*/</font>
00485 )<font class="keyword"> const</font>
00486 <font class="keyword"></font>{
00487 uint8 *dest = (uint8 *) tab;
00488 uint leftToDo = numAttrib, toProcess;
00489 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0] && <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]);
00490 <font class="keywordflow">switch</font> (_Op)
00491 {
00492 <font class="keywordflow">case</font> CPSBinOp::selectArg1:
00493 <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]->makeN(loc, startIndex, tab, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, numAttrib, nbReplicate, srcStep);
00494 <font class="keywordflow">return</font>;
00495 <font class="keywordflow">break</font>;
00496 <font class="keywordflow">case</font> CPSBinOp::selectArg2:
00497 <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]->makeN(loc, startIndex, tab, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, numAttrib, nbReplicate, srcStep);
00498 <font class="keywordflow">return</font>;
00499 <font class="keywordflow">break</font>;
00500 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
00501 }
00502
00503 <font class="keywordflow">while</font> (leftToDo)
00504 {
00505 toProcess = leftToDo > <a class="code" href="namespaceNL3D.html#a187">PSBinOpBufSize</a> ? <a class="code" href="namespaceNL3D.html#a187">PSBinOpBufSize</a> : leftToDo;
00506 T *src1 = (T *) <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]->make(loc, startIndex + (numAttrib - leftToDo), &buf1[0], <font class="keyword">sizeof</font>(T), toProcess, <font class="keyword">true</font>, srcStep);
00507 T *src2 = (T *) <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]->make(loc, startIndex + (numAttrib - leftToDo), &buf2[0], <font class="keyword">sizeof</font>(T), toProcess, <font class="keyword">true</font>, srcStep);
00508
00509 <a class="code" href="namespaceNL3D.html#a400">MakeNPrivate</a>(dest, src1, src2, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, toProcess, <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n0">_Op</a>, nbReplicate);
00510 leftToDo -= toProcess;
00511 }
00512 }
00513
00514 <font class="comment">//=================================================================================================================</font>
00515 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00516"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_3">00516</a> <font class="keywordtype">void</font> CPSAttribMakerBinOp<T>::makeN(CPSLocated *loc,
00517 uint32 startIndex,
00518 <font class="keywordtype">void</font> *tab,
00519 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>,
00520 uint32 numAttrib,
00521 uint32 nbReplicate,
00522 uint32 <font class="comment">/* srcStep = (1 << 16)*/</font>
00523 )<font class="keyword"> const</font>
00524 <font class="keyword"></font>
00525 <font class="keyword"></font>{
00530 uint8 tab1[<a class="code" href="namespaceNL3D.html#a187">PSBinOpBufSize</a> * <font class="keyword">sizeof</font>(T)];
00531 uint8 tab2[<a class="code" href="namespaceNL3D.html#a187">PSBinOpBufSize</a> * <font class="keyword">sizeof</font>(T)];
00532 <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#b2">makeNPrivate</a>((T *) &tab1[0], (T *) &tab2[0], loc, startIndex, tab, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, numAttrib, nbReplicate);
00533 }
00534
00535 <font class="comment">//=================================================================================================================</font>
00536 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00537"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_4">00537</a> <font class="keywordtype">void</font> CPSAttribMakerBinOp<T>::serial (<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f) <font class="keywordflow">throw</font>(NLMISC::EStream)
00538 {
00539 <font class="keywordflow">if</font> (f.isReading())
00540 {
00541 clean();
00542 }
00543 f.serialVersion(1);
00544 f.serialEnum(_Op);
00545 f.serialPolyPtr(_Arg[0]);
00546 f.serialPolyPtr(_Arg[1]);
00547 f.serial(_Size, _MaxSize);
00548
00549 }
00550
00551 <font class="comment">//=================================================================================================================</font>
00552 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00553"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_5">00553</a> <font class="keywordtype">void</font> CPSAttribMakerBinOp<T>::deleteElement (uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
00554 {
00555 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]->hasMemory()) <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]->deleteElement(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
00556 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]->hasMemory()) <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]->deleteElement(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
00557 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n2">_Size</a> != 0);
00558 --<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n2">_Size</a>;
00559 }
00560
00561 <font class="comment">//=================================================================================================================</font>
00562 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00563"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_6">00563</a> <font class="keywordtype">void</font> CPSAttribMakerBinOp<T>::newElement (CPSLocated *emitterLocated, uint32 emitterIndex)
00564 {
00565 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]->hasMemory()) <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]->newElement(emitterLocated, emitterIndex);
00566 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]->hasMemory()) <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]->newElement(emitterLocated, emitterIndex);
00567 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n2">_Size</a> != <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n3">_MaxSize</a>)
00568 {
00569 ++<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n2">_Size</a>;
00570 }
00571 }
00572
00573 <font class="comment">//=================================================================================================================</font>
00574 <font class="keyword">template</font> <<font class="keyword">class</font> T>
<a name="l00575"></a><a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#z711_7">00575</a> <font class="keywordtype">void</font> CPSAttribMakerBinOp<T>::resize (uint32 capacity, uint32 nbPresentElements)
00576 {
00577 <a class="code" href="debug_8h.html#a6">nlassert</a>(capacity < (1 << 16));
00578 <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n3">_MaxSize</a> = capacity;
00579 <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n2">_Size</a> = nbPresentElements;
00580 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]->hasMemory()) <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[0]->resize(capacity, nbPresentElements);
00581 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]->hasMemory()) <a class="code" href="classNL3D_1_1CPSAttribMakerBinOp.html#n1">_Arg</a>[1]->resize(capacity, nbPresentElements);
00582 }
00583
00584
00585 } <font class="comment">// NL3D</font>
00586
00587
00588 <font class="preprocessor">#endif // NL_PS_ATTRIB_MAKER_BIN_OP_INLINE_H</font>
00589 <font class="preprocessor"></font>
00590 <font class="comment">/* End of ps_attrib_maker_bin_op.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>
|