aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a02874.html
blob: 23bf05a831b64c9d57a27394291929507cd1bd0c (plain)
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: NL3D::CMeshBlender class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex">  <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a>  | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NL3D::CMeshBlender Class Reference</h1><code>#include &lt;<a class="el" href="a05996.html">mesh_blender.h</a>&gt;</code>
<p>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A tool class used for Alpha Blending of Meshes. Actually, it takes a material, modify it and modify driver so it will be correctly rendered. The backup method must be used after render, to restore the material. <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p>
Nevrax France </dd></dl>
<dl compact><dt><b>Date:</b></dt><dd>2002 </dd></dl>

<p>

<p>
Definition at line <a class="el" href="a05996.html#l00048">48</a> of file <a class="el" href="a05996.html">mesh_blender.h</a>.<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02874.html#NL3D_1_1CMeshBlendera0">CMeshBlender</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor.  <a href="#NL3D_1_1CMeshBlendera0"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02874.html#NL3D_1_1CMeshBlendera1">prepareRenderForGlobalAlpha</a> (<a class="el" href="a02839.html">CMaterial</a> &amp;material, <a class="el" href="a02434.html">IDriver</a> *drv, float globalAlpha, <a class="el" href="a04558.html#a7">uint8</a> globalAlphaInt, bool gaDisableZWrite)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Modify the material and the driver for Global Alpha Use.  <a href="#NL3D_1_1CMeshBlendera1"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02874.html#NL3D_1_1CMeshBlendera2">prepareRenderForGlobalAlphaCoarseMesh</a> (<a class="el" href="a02839.html">CMaterial</a> &amp;material, <a class="el" href="a02434.html">IDriver</a> *drv, <a class="el" href="a03337.html">NLMISC::CRGBA</a> color, float globalAlpha, bool gaDisableZWrite)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Same method, but special for CoarseMesh (used by <a class="el" href="a02910.html#NL3D_1_1CMeshMultiLodd6">CMeshMultiLod::renderMeshGeom</a>).  <a href="#NL3D_1_1CMeshBlendera2"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02874.html#NL3D_1_1CMeshBlendera3">restoreRender</a> (<a class="el" href="a02839.html">CMaterial</a> &amp;material, <a class="el" href="a02434.html">IDriver</a> *drv, bool gaDisableZWrite)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Restore the material and driver in their initial state.  <a href="#NL3D_1_1CMeshBlendera3"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02874.html#NL3D_1_1CMeshBlendera4">restoreRenderCoarseMesh</a> (<a class="el" href="a02839.html">CMaterial</a> &amp;material, <a class="el" href="a02434.html">IDriver</a> *drv, bool gaDisableZWrite)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Same method, but special for CoarseMesh (used by <a class="el" href="a02910.html#NL3D_1_1CMeshMultiLodd6">CMeshMultiLod::renderMeshGeom</a>).  <a href="#NL3D_1_1CMeshBlendera4"></a><br><br></td></tr>
<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>float&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr0">_BkAlphaTestThreshold</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr1">_BkBlend</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02839.html#NL3D_1_1CMaterialw58">CMaterial::TBlend</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr2">_BkDstBlend</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a7">uint8</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr3">_BkOpacity</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02839.html#NL3D_1_1CMaterialw58">CMaterial::TBlend</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr4">_BkSrcBlend</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">NLMISC::CRGBA</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr5">_BkupColor</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr6">_BkZWrite</a></td></tr>

</table>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="NL3D_1_1CMeshBlendera0" doxytag="NL3D::CMeshBlender::CMeshBlender" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> NL3D::CMeshBlender::CMeshBlender </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Constructor. 
<p>

<p>
Definition at line <a class="el" href="a05996.html#l00053">53</a> of file <a class="el" href="a05996.html">mesh_blender.h</a>.
<p>
<div class="fragment"><pre>00053 {}
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NL3D_1_1CMeshBlendera1" doxytag="NL3D::CMeshBlender::prepareRenderForGlobalAlpha" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CMeshBlender::prepareRenderForGlobalAlpha </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a02839.html">CMaterial</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>material</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a02434.html">IDriver</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>drv</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>float&nbsp;</td>
          <td class="mdname" nowrap> <em>globalAlpha</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>globalAlphaInt</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>bool&nbsp;</td>
          <td class="mdname" nowrap> <em>gaDisableZWrite</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Modify the material and the driver for Global Alpha Use. 
<p>

<p>
Definition at line <a class="el" href="a05995.html#l00037">37</a> of file <a class="el" href="a05995.html">mesh_blender.cpp</a>.
<p>
References <a class="el" href="a05996.html#l00073">_BkAlphaTestThreshold</a>, <a class="el" href="a05996.html#l00070">_BkBlend</a>, <a class="el" href="a05996.html#l00072">_BkDstBlend</a>, <a class="el" href="a05996.html#l00068">_BkOpacity</a>, <a class="el" href="a05996.html#l00071">_BkSrcBlend</a>, <a class="el" href="a05996.html#l00069">_BkZWrite</a>, <a class="el" href="a05969.html#l00314">NL3D::CMaterial::getAlphaTest()</a>, <a class="el" href="a05969.html#l00320">NL3D::CMaterial::getAlphaTestThreshold()</a>, <a class="el" href="a05969.html#l00278">NL3D::CMaterial::getBlend()</a>, <a class="el" href="a05969.html#l00280">NL3D::CMaterial::getDstBlend()</a>, <a class="el" href="a05969.html#l00381">NL3D::CMaterial::getOpacity()</a>, <a class="el" href="a05969.html#l00279">NL3D::CMaterial::getSrcBlend()</a>, <a class="el" href="a05969.html#l00335">NL3D::CMaterial::getZWrite()</a>, <a class="el" href="a05641.html#l00085">NL3D::CMaterial::setAlphaTestThreshold()</a>, <a class="el" href="a05641.html#l00064">NL3D::CMaterial::setBlend()</a>, <a class="el" href="a02434.html#NL3D_1_1IDriverz153_4">NL3D::IDriver::setBlendConstantColor()</a>, <a class="el" href="a05641.html#l00058">NL3D::CMaterial::setDstBlend()</a>, <a class="el" href="a05641.html#l00173">NL3D::CMaterial::setOpacity()</a>, <a class="el" href="a05641.html#l00052">NL3D::CMaterial::setSrcBlend()</a>, <a class="el" href="a05641.html#l00105">NL3D::CMaterial::setZWrite()</a>, <a class="el" href="a02434.html#NL3D_1_1IDriverz153_5">NL3D::IDriver::supportBlendConstantColor()</a>, and <a class="el" href="a05981.html#l00096">uint8</a>.
<p>
Referenced by <a class="el" href="a06011.html#l00568">NL3D::CMeshMRMSkinnedGeom::render()</a>, <a class="el" href="a06005.html#l00927">NL3D::CMeshMRMGeom::render()</a>, and <a class="el" href="a05989.html#l00598">NL3D::CMeshGeom::render()</a>.
<p>
<div class="fragment"><pre>00038 {
00039         <span class="comment">// Disable ZWrite??</span>
00040         <span class="keywordflow">if</span>(gaDisableZWrite)
00041         {
00042                 <span class="comment">// Backup and set new the zwrite</span>
00043                 <a class="code" href="a02874.html#NL3D_1_1CMeshBlenderr6">_BkZWrite</a>=material.getZWrite ();
00044                 material.setZWrite (<span class="keyword">false</span>);
00045         }
00046 
00047         <span class="comment">// Backup blend</span>
00048         <a class="code" href="a02874.html#NL3D_1_1CMeshBlenderr1">_BkBlend</a>=material.getBlend ();
00049         material.setBlend (<span class="keyword">true</span>);
00050 
00051         <span class="comment">// Backup opacity and blend</span>
00052         <a class="code" href="a02874.html#NL3D_1_1CMeshBlenderr3">_BkOpacity</a>= material.getOpacity ();
00053         <a class="code" href="a02874.html#NL3D_1_1CMeshBlenderr4">_BkSrcBlend</a>= material.getSrcBlend();
00054         <a class="code" href="a02874.html#NL3D_1_1CMeshBlenderr2">_BkDstBlend</a>= material.getDstBlend();
00055 
00056         <span class="comment">// 2 ways: if Blend Constant Color is supported or not.</span>
00057         <span class="keywordflow">if</span>(drv-&gt;supportBlendConstantColor())
00058         {
00059                 <span class="comment">// Set opacity to 255 =&gt; If AlphaTest is used, AlphaTexture will be multiplied by 1.</span>
00060                 material.setOpacity ( 255 );
00061 
00062                 <span class="comment">// set the Blend constant Alpha.</span>
00063                 drv-&gt;setBlendConstantColor( <a class="code" href="a03337.html">CRGBA</a>(0,0,0, globalAlphaInt) );
00064 
00065                 <span class="comment">// Active Blend with Blend Constant Alpha .</span>
00066                 material.setSrcBlend(CMaterial::blendConstantAlpha);
00067 
00068                 <span class="comment">// Don't set dest if we are in additive blend mode</span>
00069                 <span class="keywordflow">if</span> ((<a class="code" href="a02874.html#NL3D_1_1CMeshBlenderr1">_BkBlend</a> == <span class="keyword">false</span>) || (<a class="code" href="a02874.html#NL3D_1_1CMeshBlenderr2">_BkDstBlend</a> != CMaterial::one))
00070                         material.setDstBlend(CMaterial::blendConstantInvAlpha);
00071 
00072                 <span class="comment">// if material is Alpha Test, no-op. Keep same threshold, since Use Alpha of the BlendConstantColor</span>
00073                 <span class="comment">// to do the alpha-blending.</span>
00074         }
00075         <span class="comment">// not supported, ugly way: modify Opacity, and alpha threshold</span>
00076         <span class="keywordflow">else</span>
00077         {
00078                 <span class="comment">// New opacity</span>
00079                 material.setOpacity (globalAlphaInt);
00080 
00081                 <span class="comment">// must ensure Std Blend.</span>
00082                 material.setSrcBlend(CMaterial::srcalpha);
00083 
00084                 <span class="comment">// Don't set dest if we are in additive blend mode</span>
00085                 <span class="keywordflow">if</span> ((<a class="code" href="a02874.html#NL3D_1_1CMeshBlenderr1">_BkBlend</a> == <span class="keyword">false</span>) || (<a class="code" href="a02874.html#NL3D_1_1CMeshBlenderr2">_BkDstBlend</a> != CMaterial::one))
00086                         material.setDstBlend(CMaterial::invsrcalpha);
00087 
00088                 <span class="comment">// if material is Alpha Test, must modulate AlphaTest limit to avoid Pop effects</span>
00089                 <span class="keywordflow">if</span>(material.getAlphaTest())
00090                 {
00091                         <a class="code" href="a02874.html#NL3D_1_1CMeshBlenderr0">_BkAlphaTestThreshold</a>= material.getAlphaTestThreshold();
00092                         material.setAlphaTestThreshold(_BkAlphaTestThreshold * globalAlpha);
00093                 }
00094         }
00095 
00096 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CMeshBlendera2" doxytag="NL3D::CMeshBlender::prepareRenderForGlobalAlphaCoarseMesh" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CMeshBlender::prepareRenderForGlobalAlphaCoarseMesh </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a02839.html">CMaterial</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>material</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a02434.html">IDriver</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>drv</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a03337.html">NLMISC::CRGBA</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>color</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>float&nbsp;</td>
          <td class="mdname" nowrap> <em>globalAlpha</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>bool&nbsp;</td>
          <td class="mdname" nowrap> <em>gaDisableZWrite</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Same method, but special for CoarseMesh (used by <a class="el" href="a02910.html#NL3D_1_1CMeshMultiLodd6">CMeshMultiLod::renderMeshGeom</a>). 
<p>

<p>
Definition at line <a class="el" href="a05995.html#l00132">132</a> of file <a class="el" href="a05995.html">mesh_blender.cpp</a>.
<p>
References <a class="el" href="a05996.html#l00072">_BkDstBlend</a>, <a class="el" href="a05996.html#l00071">_BkSrcBlend</a>, <a class="el" href="a05996.html#l00074">_BkupColor</a>, <a class="el" href="a06340.html#l00340">NLMISC::CRGBA::A</a>, <a class="el" href="a05969.html#l00376">NL3D::CMaterial::getColor()</a>, <a class="el" href="a05969.html#l00280">NL3D::CMaterial::getDstBlend()</a>, <a class="el" href="a05969.html#l00279">NL3D::CMaterial::getSrcBlend()</a>, <a class="el" href="a05701.html#l00125">NLMISC::OptFastFloor()</a>, <a class="el" href="a05641.html#l00085">NL3D::CMaterial::setAlphaTestThreshold()</a>, <a class="el" href="a05641.html#l00064">NL3D::CMaterial::setBlend()</a>, <a class="el" href="a02434.html#NL3D_1_1IDriverz153_4">NL3D::IDriver::setBlendConstantColor()</a>, <a class="el" href="a05641.html#l00118">NL3D::CMaterial::setColor()</a>, <a class="el" href="a05641.html#l00058">NL3D::CMaterial::setDstBlend()</a>, <a class="el" href="a05641.html#l00052">NL3D::CMaterial::setSrcBlend()</a>, <a class="el" href="a05641.html#l00105">NL3D::CMaterial::setZWrite()</a>, <a class="el" href="a02434.html#NL3D_1_1IDriverz153_5">NL3D::IDriver::supportBlendConstantColor()</a>, and <a class="el" href="a05981.html#l00096">uint8</a>.
<p>
Referenced by <a class="el" href="a06016.html#l00446">NL3D::CMeshMultiLod::renderMeshGeom()</a>.
<p>
<div class="fragment"><pre>00133 {
00134         <span class="comment">// Don't need to bkup some values, because CoarseMesh.</span>
00135 
00136         <a class="code" href="a04558.html#a7">uint8</a>   globalAlphaInt= (<a class="code" href="a04558.html#a7">uint8</a>)<a class="code" href="a05378.html#a397">NLMISC::OptFastFloor</a>(255 * globalAlpha);
00137 
00138         <span class="comment">// Disable ZWrite??</span>
00139         <span class="keywordflow">if</span>(gaDisableZWrite)
00140                 material.setZWrite (<span class="keyword">false</span>);
00141         <span class="comment">// Enable blend</span>
00142         material.setBlend (<span class="keyword">true</span>);
00143 
00144         <span class="comment">// bkup color and blend factors.</span>
00145         <a class="code" href="a02874.html#NL3D_1_1CMeshBlenderr5">_BkupColor</a>= material.getColor();
00146         <a class="code" href="a02874.html#NL3D_1_1CMeshBlenderr4">_BkSrcBlend</a>= material.getSrcBlend();
00147         <a class="code" href="a02874.html#NL3D_1_1CMeshBlenderr2">_BkDstBlend</a>= material.getDstBlend();
00148 
00149         <span class="comment">// 2 ways: if Blend Constant Color is supported or not.</span>
00150         <span class="keywordflow">if</span>(drv-&gt;supportBlendConstantColor())
00151         {
00152                 <span class="comment">// Set opacity to 255 =&gt; AlphaTexture will be multiplied by 1.</span>
00153                 color.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 255;
00154                 <span class="comment">// change color</span>
00155                 material.setColor ( color );
00156 
00157                 <span class="comment">// set the Blend constant Alpha.</span>
00158                 drv-&gt;setBlendConstantColor( <a class="code" href="a03337.html">CRGBA</a>(0,0,0, globalAlphaInt) );
00159 
00160                 <span class="comment">// Active Blend with Blend Constant Alpha .</span>
00161                 material.setSrcBlend(CMaterial::blendConstantAlpha);
00162                 material.setDstBlend(CMaterial::blendConstantInvAlpha);
00163         }
00164         <span class="keywordflow">else</span>
00165         {
00166                 <span class="comment">// Set current Alpha blend transparency (in color becausematerial is unlit)</span>
00167                 color.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= globalAlphaInt;
00168                 <span class="comment">// change color</span>
00169                 material.setColor ( color );
00170 
00171                 <span class="comment">// Active Blend with Blend Constant Alpha .</span>
00172                 material.setSrcBlend(CMaterial::srcalpha);
00173                 material.setDstBlend(CMaterial::invsrcalpha);
00174 
00175                 <span class="comment">// must modulate AlphaTest limit to avoid Pop effects</span>
00176                 material.setAlphaTestThreshold(0.5f * globalAlpha);
00177         }
00178 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CMeshBlendera3" doxytag="NL3D::CMeshBlender::restoreRender" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CMeshBlender::restoreRender </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a02839.html">CMaterial</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>material</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a02434.html">IDriver</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>drv</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>bool&nbsp;</td>
          <td class="mdname" nowrap> <em>gaDisableZWrite</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Restore the material and driver in their initial state. 
<p>

<p>
Definition at line <a class="el" href="a05995.html#l00099">99</a> of file <a class="el" href="a05995.html">mesh_blender.cpp</a>.
<p>
References <a class="el" href="a05996.html#l00073">_BkAlphaTestThreshold</a>, <a class="el" href="a05996.html#l00070">_BkBlend</a>, <a class="el" href="a05996.html#l00072">_BkDstBlend</a>, <a class="el" href="a05996.html#l00068">_BkOpacity</a>, <a class="el" href="a05996.html#l00071">_BkSrcBlend</a>, <a class="el" href="a05996.html#l00069">_BkZWrite</a>, <a class="el" href="a05969.html#l00314">NL3D::CMaterial::getAlphaTest()</a>, <a class="el" href="a05641.html#l00085">NL3D::CMaterial::setAlphaTestThreshold()</a>, <a class="el" href="a05641.html#l00064">NL3D::CMaterial::setBlend()</a>, <a class="el" href="a05641.html#l00058">NL3D::CMaterial::setDstBlend()</a>, <a class="el" href="a05641.html#l00173">NL3D::CMaterial::setOpacity()</a>, <a class="el" href="a05641.html#l00052">NL3D::CMaterial::setSrcBlend()</a>, <a class="el" href="a05641.html#l00105">NL3D::CMaterial::setZWrite()</a>, and <a class="el" href="a02434.html#NL3D_1_1IDriverz153_5">NL3D::IDriver::supportBlendConstantColor()</a>.
<p>
Referenced by <a class="el" href="a06011.html#l00568">NL3D::CMeshMRMSkinnedGeom::render()</a>, <a class="el" href="a06005.html#l00927">NL3D::CMeshMRMGeom::render()</a>, and <a class="el" href="a05989.html#l00598">NL3D::CMeshGeom::render()</a>.
<p>
<div class="fragment"><pre>00100 {
00101         <span class="comment">// Resetup backuped zwrite</span>
00102         <span class="keywordflow">if</span>(gaDisableZWrite)
00103         {
00104                 material.setZWrite (_BkZWrite);
00105         }
00106 
00107         <span class="comment">// Resetup backuped blend</span>
00108         material.setBlend (_BkBlend);
00109 
00110         <span class="comment">// Resetup backuped opacity and blend factors</span>
00111         material.setOpacity (_BkOpacity);
00112         material.setSrcBlend(_BkSrcBlend);
00113         material.setDstBlend(_BkDstBlend);
00114 
00115         <span class="comment">// 2 ways: if Blend Constant Color is supported or not.</span>
00116         <span class="keywordflow">if</span>(drv-&gt;supportBlendConstantColor())
00117         {
00118                 <span class="comment">// nop</span>
00119         }
00120         <span class="keywordflow">else</span>
00121         {
00122                 <span class="comment">// Resetup backuped AlphaTest threshold</span>
00123                 <span class="keywordflow">if</span>(material.getAlphaTest())
00124                 {
00125                         material.setAlphaTestThreshold(_BkAlphaTestThreshold);
00126                 }
00127         }
00128 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CMeshBlendera4" doxytag="NL3D::CMeshBlender::restoreRenderCoarseMesh" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CMeshBlender::restoreRenderCoarseMesh </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a02839.html">CMaterial</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>material</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a02434.html">IDriver</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>drv</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>bool&nbsp;</td>
          <td class="mdname" nowrap> <em>gaDisableZWrite</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Same method, but special for CoarseMesh (used by <a class="el" href="a02910.html#NL3D_1_1CMeshMultiLodd6">CMeshMultiLod::renderMeshGeom</a>). 
<p>

<p>
Definition at line <a class="el" href="a05995.html#l00181">181</a> of file <a class="el" href="a05995.html">mesh_blender.cpp</a>.
<p>
References <a class="el" href="a05996.html#l00072">_BkDstBlend</a>, <a class="el" href="a05996.html#l00071">_BkSrcBlend</a>, <a class="el" href="a05996.html#l00074">_BkupColor</a>, <a class="el" href="a05641.html#l00085">NL3D::CMaterial::setAlphaTestThreshold()</a>, <a class="el" href="a05641.html#l00064">NL3D::CMaterial::setBlend()</a>, <a class="el" href="a05641.html#l00118">NL3D::CMaterial::setColor()</a>, <a class="el" href="a05641.html#l00058">NL3D::CMaterial::setDstBlend()</a>, <a class="el" href="a05641.html#l00052">NL3D::CMaterial::setSrcBlend()</a>, <a class="el" href="a05641.html#l00105">NL3D::CMaterial::setZWrite()</a>, and <a class="el" href="a02434.html#NL3D_1_1IDriverz153_5">NL3D::IDriver::supportBlendConstantColor()</a>.
<p>
Referenced by <a class="el" href="a06016.html#l00446">NL3D::CMeshMultiLod::renderMeshGeom()</a>.
<p>
<div class="fragment"><pre>00182 {
00183         <span class="comment">// Resetup backuped color and blend factors</span>
00184         material.setColor ( _BkupColor );
00185         material.setSrcBlend(_BkSrcBlend);
00186         material.setDstBlend(_BkDstBlend);
00187 
00188         <span class="comment">// ReEnable ZWrite??</span>
00189         <span class="keywordflow">if</span>(gaDisableZWrite)
00190                 material.setZWrite (<span class="keyword">true</span>);
00191         <span class="comment">// Reset blend</span>
00192         material.setBlend (<span class="keyword">false</span>);
00193         
00194         <span class="comment">// 2 ways: if Blend Constant Color is supported or not.</span>
00195         <span class="keywordflow">if</span>(drv-&gt;supportBlendConstantColor())
00196         {
00197                 <span class="comment">// nop</span>
00198         }
00199         <span class="keywordflow">else</span>
00200         {
00201                 <span class="comment">// reset AlphaTest limit</span>
00202                 material.setAlphaTestThreshold(0.5f);
00203         }
00204 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="NL3D_1_1CMeshBlenderr0" doxytag="NL3D::CMeshBlender::_BkAlphaTestThreshold" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> float <a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr0">NL3D::CMeshBlender::_BkAlphaTestThreshold</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05996.html#l00073">73</a> of file <a class="el" href="a05996.html">mesh_blender.h</a>.
<p>
Referenced by <a class="el" href="a05995.html#l00037">prepareRenderForGlobalAlpha()</a>, and <a class="el" href="a05995.html#l00099">restoreRender()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CMeshBlenderr1" doxytag="NL3D::CMeshBlender::_BkBlend" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool <a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr1">NL3D::CMeshBlender::_BkBlend</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05996.html#l00070">70</a> of file <a class="el" href="a05996.html">mesh_blender.h</a>.
<p>
Referenced by <a class="el" href="a05995.html#l00037">prepareRenderForGlobalAlpha()</a>, and <a class="el" href="a05995.html#l00099">restoreRender()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CMeshBlenderr2" doxytag="NL3D::CMeshBlender::_BkDstBlend" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a02839.html#NL3D_1_1CMaterialw58">CMaterial::TBlend</a> <a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr2">NL3D::CMeshBlender::_BkDstBlend</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05996.html#l00072">72</a> of file <a class="el" href="a05996.html">mesh_blender.h</a>.
<p>
Referenced by <a class="el" href="a05995.html#l00037">prepareRenderForGlobalAlpha()</a>, <a class="el" href="a05995.html#l00132">prepareRenderForGlobalAlphaCoarseMesh()</a>, <a class="el" href="a05995.html#l00099">restoreRender()</a>, and <a class="el" href="a05995.html#l00181">restoreRenderCoarseMesh()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CMeshBlenderr3" doxytag="NL3D::CMeshBlender::_BkOpacity" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a7">uint8</a> <a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr3">NL3D::CMeshBlender::_BkOpacity</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05996.html#l00068">68</a> of file <a class="el" href="a05996.html">mesh_blender.h</a>.
<p>
Referenced by <a class="el" href="a05995.html#l00037">prepareRenderForGlobalAlpha()</a>, and <a class="el" href="a05995.html#l00099">restoreRender()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CMeshBlenderr4" doxytag="NL3D::CMeshBlender::_BkSrcBlend" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a02839.html#NL3D_1_1CMaterialw58">CMaterial::TBlend</a> <a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr4">NL3D::CMeshBlender::_BkSrcBlend</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05996.html#l00071">71</a> of file <a class="el" href="a05996.html">mesh_blender.h</a>.
<p>
Referenced by <a class="el" href="a05995.html#l00037">prepareRenderForGlobalAlpha()</a>, <a class="el" href="a05995.html#l00132">prepareRenderForGlobalAlphaCoarseMesh()</a>, <a class="el" href="a05995.html#l00099">restoreRender()</a>, and <a class="el" href="a05995.html#l00181">restoreRenderCoarseMesh()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CMeshBlenderr5" doxytag="NL3D::CMeshBlender::_BkupColor" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03337.html">NLMISC::CRGBA</a> <a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr5">NL3D::CMeshBlender::_BkupColor</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05996.html#l00074">74</a> of file <a class="el" href="a05996.html">mesh_blender.h</a>.
<p>
Referenced by <a class="el" href="a05995.html#l00132">prepareRenderForGlobalAlphaCoarseMesh()</a>, and <a class="el" href="a05995.html#l00181">restoreRenderCoarseMesh()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CMeshBlenderr6" doxytag="NL3D::CMeshBlender::_BkZWrite" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool <a class="el" href="a02874.html#NL3D_1_1CMeshBlenderr6">NL3D::CMeshBlender::_BkZWrite</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05996.html#l00069">69</a> of file <a class="el" href="a05996.html">mesh_blender.h</a>.
<p>
Referenced by <a class="el" href="a05995.html#l00037">prepareRenderForGlobalAlpha()</a>, and <a class="el" href="a05995.html#l00099">restoreRender()</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a05996.html">mesh_blender.h</a><li><a class="el" href="a05995.html">mesh_blender.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:51:46 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.6 </small></address>
</body>
</html>