1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
|
<!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::CHLSColorTexture 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 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">Data Structures</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">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NL3D::CHLSColorTexture Class Reference</h1><code>#include <<a class="el" href="a05791.html">hls_color_texture.h</a>></code>
<p>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A colorisable texture <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="a05791.html#l00070">70</a> of file <a class="el" href="a05791.html">hls_color_texture.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>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturea0">addMask</a> (const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &bmp, <a class="el" href="a04558.html#a15">uint</a> threshold=15)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturea1">buildColorVersion</a> (const <a class="el" href="a02631.html">CHLSColorDelta</a> *colDeltaList, <a class="el" href="a02268.html">NLMISC::CBitmap</a> &out)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturea2">CHLSColorTexture</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturea3">getNumMasks</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">get num of masks <a href="#NL3D_1_1CHLSColorTexturea3"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturea4">reset</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">reset the build <a href="#NL3D_1_1CHLSColorTexturea4"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturea5">serial</a> (<a class="el" href="a02270.html">NLMISC::IStream</a> &f)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturea6">setBitmap</a> (const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &bmp)</td></tr>
<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturee0">compressBlockRGB</a> (<a class="el" href="a03337.html">CRGBA</a> *srcRGBA, <a class="el" href="a04558.html#a7">uint8</a> *dstDXTC)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">compress DXTC5 RGB only block, from a RGBA raw array. dstDXTC Alpha part is not modified. srcRGBA->A are setup to 0!! <a href="#NL3D_1_1CHLSColorTexturee0"></a><br><br></td></tr>
<tr><td colspan=2><br><h2>Static Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTextureh0">colorizeDXTCBlockRGB</a> (const <a class="el" href="a04558.html#a7">uint8</a> *srcPtr, <a class="el" href="a04558.html#a7">uint8</a> *dstPtr, <a class="el" href="a04558.html#a7">uint8</a> dHue, <a class="el" href="a04558.html#a15">uint</a> dLum, <a class="el" href="a04558.html#a15">uint</a> dSat)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">apply colDelta to the block. Alpha part is not modified. MMX with no EMMS called here !!! <a href="#NL3D_1_1CHLSColorTextureh0"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTextureh1">computeMinMax</a> (<a class="el" href="a04558.html#a14">sint</a> *diffBlock, <a class="el" href="a02634.html">CVectorInt</a> &<a class="el" href="a04223.html#a576">v</a>, <a class="el" href="a04558.html#a14">sint</a> mean[3], <a class="el" href="a04558.html#a14">sint</a> rgb0[3], <a class="el" href="a04558.html#a14">sint</a> rgb1[3])</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">used by <a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturee0">compressBlockRGB()</a> <a href="#NL3D_1_1CHLSColorTextureh1"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTextureh2">uncompressBlockRGB</a> (const <a class="el" href="a04558.html#a7">uint8</a> *srcDXTC, <a class="el" href="a03337.html">CRGBA</a> *dstRGBA)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">uncompress DXTC5 RGB only block, into a RGBA raw array. Alpha is setup with undefined values <a href="#NL3D_1_1CHLSColorTextureh2"></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><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturer0">_BlockToCompressIndex</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturer1">_Height</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a02633.html">CMask</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturer2">_Masks</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturer3">_NumMipMap</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a04558.html#a7">uint8</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturer4">_Texture</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturer5">_Width</a></td></tr>
</table>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="NL3D_1_1CHLSColorTexturea2" doxytag="NL3D::CHLSColorTexture::CHLSColorTexture" ></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::CHLSColorTexture::CHLSColorTexture </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a05790.html#l00076">76</a> of file <a class="el" href="a05790.html">hls_color_texture.cpp</a>.
<p>
References <a class="el" href="a05790.html#l00082">reset()</a>.
<p>
<div class="fragment"><pre>00077 {
00078 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturea4">reset</a>();
00079 }
</pre></div> </td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NL3D_1_1CHLSColorTexturea0" doxytag="NL3D::CHLSColorTexture::addMask" ></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::CHLSColorTexture::addMask </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02268.html">NLMISC::CBitmap</a> & </td>
<td class="mdname" nowrap> <em>bmp</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td>
<td class="mdname" nowrap> <em>threshold</em> = 15</td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
add a mask to the texture. R is taken as the mask value. must be same size as in <a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturea6">setBitmap()</a> <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>threshold</em> </td><td>used to know if a pixel mask value is or not an intermediate (ie not 0 or 255)</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a05790.html#l00152">152</a> of file <a class="el" href="a05790.html">hls_color_texture.cpp</a>.
<p>
References <a class="el" href="a05791.html#l00126">_BlockToCompressIndex</a>, <a class="el" href="a05791.html#l00130">_Masks</a>, <a class="el" href="a05791.html#l00125">_NumMipMap</a>, <a class="el" href="a05790.html#l00045">BLOCK_ALPHA_SIZE</a>, <a class="el" href="a05790.html#l00148">NL3D::CMaskInfo::Blocks</a>, <a class="el" href="a05486.html#l01422">NLMISC::CBitmap::buildMipMaps()</a>, <a class="el" href="a05486.html#l00926">NLMISC::CBitmap::convertToType()</a>, <a class="el" href="a05791.html#l00109">NL3D::CHLSColorTexture::CMask::Data</a>, <a class="el" href="a05791.html#l00106">NL3D::CHLSColorTexture::CMask::FullBlockIndex</a>, <a class="el" href="a05486.html#l01388">NLMISC::CBitmap::getHeight()</a>, <a class="el" href="a05487.html#l00369">NLMISC::CBitmap::getMipMapCount()</a>, <a class="el" href="a05487.html#l00308">NLMISC::CBitmap::getPixels()</a>, <a class="el" href="a05486.html#l01363">NLMISC::CBitmap::getWidth()</a>, <a class="el" href="a05790.html#l00146">NL3D::CMaskInfo::HBlock</a>, <a class="el" href="a05790.html#l00140">MASK_BLOCK_EMPTY</a>, <a class="el" href="a05790.html#l00141">MASK_BLOCK_FULL</a>, <a class="el" href="a05790.html#l00142">MASK_BLOCK_MIXT</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05791.html#l00107">NL3D::CHLSColorTexture::CMask::MixtBlockIndex</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05790.html#l00147">NL3D::CMaskInfo::NumBlock</a>, <a class="el" href="a05790.html#l00068">NL3D::CHLSColorTexture::CMask::setBit()</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05646.html#l00236">w</a>, <a class="el" href="a05790.html#l00146">NL3D::CMaskInfo::WBlock</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>.
<p>
<div class="fragment"><pre>00153 {
00154 <span class="comment">// copy the bitmap and set RGBA/mipmaps.</span>
00155 <a class="code" href="a02268.html">CBitmap</a> bmp= bmpIn;
00156 bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea6">convertToType</a>(CBitmap::RGBA);
00157 bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea3">buildMipMaps</a>();
00158
00159 <span class="comment">// verify widht...</span>
00160 <a class="code" href="a04199.html#a6">nlassert</a>(bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>()== <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer5">_Width</a>);
00161 <a class="code" href="a04199.html#a6">nlassert</a>(bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>()== <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer1">_Height</a>);
00162 <a class="code" href="a04199.html#a6">nlassert</a>(bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea13">getMipMapCount</a>()== <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer3">_NumMipMap</a>);
00163
00164 <span class="comment">// ***** build the information for all mipmaps</span>
00165 vector<CMaskInfo> masks;
00166 masks.resize(_NumMipMap);
00167 <a class="code" href="a04558.html#a15">uint</a> m;
00168 <a class="code" href="a04558.html#a15">uint</a> numMixtBlock= 0;
00169 <a class="code" href="a04558.html#a15">uint</a> numTotalBlock= 0;
00170 <span class="keywordflow">for</span>(m=0;m<<a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer3">_NumMipMap</a>;m++)
00171 {
00172 CMaskInfo &mask= masks[m];
00173 <a class="code" href="a04558.html#a15">uint</a> mmWidth= bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>(m);
00174 <a class="code" href="a04558.html#a15">uint</a> mmHeight= bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>(m);
00175 mask.WBlock= (mmWidth+3)/4;
00176 mask.HBlock= (mmHeight+3)/4;
00177 mask.NumBlock= mask.WBlock*mask.HBlock;
00178 mask.Blocks.resize(mask.NumBlock);
00179
00180 numTotalBlock+= mask.NumBlock;
00181
00182 <a class="code" href="a03337.html">CRGBA</a> *<a class="code" href="a04223.html#a652">src</a>= (<a class="code" href="a03337.html">CRGBA</a>*)(&bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>(m)[0]);
00183
00184 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> yB=0;yB<mask.HBlock;yB++)
00185 {
00186 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> xB=0;xB<mask.WBlock;xB++)
00187 {
00188 <a class="code" href="a04558.html#a15">uint</a> accum= 0;
00189 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a575">w</a>= <a class="code" href="a04061.html#a0">min</a>(mmWidth, 4U);
00190 <a class="code" href="a04558.html#a15">uint</a> h= <a class="code" href="a04061.html#a0">min</a>(mmHeight, 4U);
00191 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a573">y</a>= 0;<a class="code" href="a04223.html#a573">y</a>< h;<a class="code" href="a04223.html#a573">y</a>++)
00192 {
00193 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a572">x</a>= 0;<a class="code" href="a04223.html#a572">x</a>< <a class="code" href="a04223.html#a575">w</a>;<a class="code" href="a04223.html#a572">x</a>++)
00194 {
00195 <a class="code" href="a04558.html#a15">uint</a> yPix= yB*4+<a class="code" href="a04223.html#a573">y</a>;
00196 <a class="code" href="a04558.html#a15">uint</a> xPix= xB*4+<a class="code" href="a04223.html#a572">x</a>;
00197 <span class="comment">// read the color</span>
00198 <a class="code" href="a04558.html#a7">uint8</a> alphaMask = <a class="code" href="a04223.html#a652">src</a>[yPix*mmWidth+xPix].R;
00199 <span class="comment">// remove some dummy precision.</span>
00200 <span class="keywordflow">if</span>(alphaMask<threshold)
00201 alphaMask= 0;
00202 <span class="keywordflow">if</span>(alphaMask>255-threshold)
00203 alphaMask= 255;
00204 <span class="comment">// Add to the accum</span>
00205 accum+= alphaMask;
00206 }
00207 }
00208
00209 <span class="comment">// full black?</span>
00210 <span class="keywordflow">if</span>(accum==0)
00211 mask.Blocks[yB*mask.WBlock+xB]= <a class="code" href="a04367.html#a3">MASK_BLOCK_EMPTY</a>;
00212 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(accum==<a class="code" href="a04223.html#a575">w</a>*h*255)
00213 mask.Blocks[yB*mask.WBlock+xB]= <a class="code" href="a04367.html#a4">MASK_BLOCK_FULL</a>;
00214 <span class="comment">// if not full white or full black, mixt block</span>
00215 <span class="keywordflow">else</span>
00216 {
00217 mask.Blocks[yB*mask.WBlock+xB]= <a class="code" href="a04367.html#a5">MASK_BLOCK_MIXT</a>;
00218 numMixtBlock++;
00219 }
00220 }
00221 }
00222 }
00223
00224 <span class="comment">// ***** compress into CMask</span>
00225 CMask newMask;
00226 <a class="code" href="a04558.html#a15">uint</a> newMaskDataSize= 0;
00227
00228 <span class="comment">// add the mixt block data size (16*uint8 per block)</span>
00229 newMaskDataSize+= numMixtBlock*<a class="code" href="a04367.html#a2">BLOCK_ALPHA_SIZE</a>;
00230 <span class="comment">// compute the bit size. NB: use uint32 to blocks bits. => data is aligned.</span>
00231 <a class="code" href="a04558.html#a15">uint</a> bitDataSize= 4*((numTotalBlock+31)/32);
00232 <span class="comment">// add fullBlock bits</span>
00233 newMask.FullBlockIndex= newMaskDataSize;
00234 newMaskDataSize+= bitDataSize;
00235 <span class="comment">// add mixtBlock bits</span>
00236 newMask.MixtBlockIndex= newMaskDataSize;
00237 newMaskDataSize+= bitDataSize;
00238
00239 <span class="comment">// allocate. Fill with 0 to initialize bits per default EMPTY value</span>
00240 newMask.Data.resize(newMaskDataSize, 0);
00241
00242 <span class="comment">// compress each mipMaps from bigger to smaller</span>
00243 <a class="code" href="a04558.html#a15">uint</a> bitId= 0;
00244 <a class="code" href="a04558.html#a15">uint</a> mixtBlockId= 0;
00245 <span class="keywordflow">for</span>(m=0;m<_NumMipMap;m++)
00246 {
00247 CMaskInfo &mask= masks[m];
00248
00249 <span class="comment">// ---- build the mixtBlock alpha Mask</span>
00250 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> yB=0;yB<mask.HBlock;yB++)
00251 {
00252 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> xB=0;xB<mask.WBlock;xB++)
00253 {
00254 <a class="code" href="a04558.html#a15">uint</a> <span class="keywordtype">id</span>= yB*mask.WBlock+xB;
00255 <span class="comment">// if mixt block</span>
00256 <span class="keywordflow">if</span>(mask.Blocks[<span class="keywordtype">id</span>]==<a class="code" href="a04367.html#a5">MASK_BLOCK_MIXT</a>)
00257 {
00258 <a class="code" href="a04199.html#a6">nlassert</a>(mixtBlockId<numMixtBlock);
00259 <span class="comment">// Fill Alpha data.</span>
00260 <a class="code" href="a04558.html#a7">uint8</a> *dst= &newMask.Data[mixtBlockId*<a class="code" href="a04367.html#a2">BLOCK_ALPHA_SIZE</a>];
00261 <a class="code" href="a04558.html#a15">uint</a> mmWidth= bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>(m);
00262 <a class="code" href="a04558.html#a15">uint</a> mmHeight= bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>(m);
00263 <span class="comment">// point to the src alpha color</span>
00264 <a class="code" href="a03337.html">CRGBA</a> *<a class="code" href="a04223.html#a652">src</a>= (<a class="code" href="a03337.html">CRGBA</a>*)(&bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>(m)[0]);
00265 <a class="code" href="a04223.html#a652">src</a>= <a class="code" href="a04223.html#a652">src</a> + yB*4*mmWidth + xB*4;
00266
00267 <span class="comment">// for the 4*4 pixels</span>
00268 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a575">w</a>= <a class="code" href="a04061.html#a0">min</a>(mmWidth, 4U);
00269 <a class="code" href="a04558.html#a15">uint</a> h= <a class="code" href="a04061.html#a0">min</a>(mmHeight, 4U);
00270 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a573">y</a>=0;<a class="code" href="a04223.html#a573">y</a><h;<a class="code" href="a04223.html#a573">y</a>++)
00271 {
00272 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a572">x</a>=0;<a class="code" href="a04223.html#a572">x</a><<a class="code" href="a04223.html#a575">w</a>;<a class="code" href="a04223.html#a572">x</a>++)
00273 {
00274 dst[<a class="code" href="a04223.html#a573">y</a>*4+<a class="code" href="a04223.html#a572">x</a>]= <a class="code" href="a04223.html#a652">src</a>[<a class="code" href="a04223.html#a573">y</a>*mmWidth+<a class="code" href="a04223.html#a572">x</a>].R;
00275 }
00276 }
00277
00278 <span class="comment">// inc</span>
00279 mixtBlockId++;
00280 }
00281 }
00282 }
00283
00284 <span class="comment">// ---- build the fullBlock and mixtBlocks bits.</span>
00285 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0; i<mask.NumBlock; i++)
00286 {
00287 <a class="code" href="a04199.html#a6">nlassert</a>(bitId<numTotalBlock);
00288
00289 <span class="comment">// fill bits</span>
00290 <span class="keywordflow">if</span>(mask.Blocks[i]==<a class="code" href="a04367.html#a4">MASK_BLOCK_FULL</a>)
00291 newMask.setBit(newMask.FullBlockIndex*8 + bitId);
00292 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(mask.Blocks[i]==<a class="code" href="a04367.html#a5">MASK_BLOCK_MIXT</a>)
00293 newMask.setBit(newMask.MixtBlockIndex*8 + bitId);
00294
00295 <span class="comment">// inc</span>
00296 bitId++;
00297 }
00298 }
00299
00300 <span class="comment">// ***** Add the CMask</span>
00301 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer2">_Masks</a>.push_back(newMask);
00302
00303 <span class="comment">// Or the BlockToCompress info with the MixtBlocks bits.</span>
00304 <a class="code" href="a04199.html#a6">nlassert</a>(bitDataSize==<a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer4">_Texture</a>.size()-<a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer0">_BlockToCompressIndex</a>);
00305 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0;i<bitDataSize;i++)
00306 {
00307 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer4">_Texture</a>[<a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer0">_BlockToCompressIndex</a>+i]|= newMask.Data[newMask.MixtBlockIndex+i];
00308 }
00309 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTexturea1" doxytag="NL3D::CHLSColorTexture::buildColorVersion" ></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::CHLSColorTexture::buildColorVersion </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02631.html">CHLSColorDelta</a> * </td>
<td class="mdname" nowrap> <em>colDeltaList</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02268.html">NLMISC::CBitmap</a> & </td>
<td class="mdname" nowrap> <em>out</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
build a texture with a HLS Color Delta <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>colDelta</em> </td><td>array of delta to apply to the bitmap (must be of numMasks entries) </td></tr>
<tr><td valign=top><em>out</em> </td><td>a colorised bitmap with DXTC5/mipMaps generated</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a05790.html#l00337">337</a> of file <a class="el" href="a05790.html">hls_color_texture.cpp</a>.
<p>
References <a class="el" href="a05791.html#l00126">_BlockToCompressIndex</a>, <a class="el" href="a05791.html#l00130">_Masks</a>, <a class="el" href="a05791.html#l00125">_NumMipMap</a>, <a class="el" href="a06340.html#l00227">NLMISC::CRGBA::blendFromuiRGBOnly()</a>, <a class="el" href="a05790.html#l00044">BLOCK_DXTC_SIZE</a>, <a class="el" href="a05790.html#l00043">BLOCK_NUM_PIXEL</a>, <a class="el" href="a05790.html#l00545">colorizeDXTCBlockRGB()</a>, <a class="el" href="a05790.html#l00628">compressBlockRGB()</a>, <a class="el" href="a05791.html#l00109">NL3D::CHLSColorTexture::CMask::Data</a>, <a class="el" href="a05791.html#l00053">NL3D::CHLSColorDelta::DHue</a>, <a class="el" href="a05791.html#l00106">NL3D::CHLSColorTexture::CMask::FullBlockIndex</a>, <a class="el" href="a05790.html#l00324">NL3D::getBitPack()</a>, <a class="el" href="a05487.html#l00308">NLMISC::CBitmap::getPixels()</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05791.html#l00107">NL3D::CHLSColorTexture::CMask::MixtBlockIndex</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05486.html#l01599">NLMISC::CBitmap::reset()</a>, <a class="el" href="a05486.html#l01545">NLMISC::CBitmap::resize()</a>, <a class="el" href="a05486.html#l01565">NLMISC::CBitmap::resizeMipMap()</a>, <a class="el" href="a05486.html#l01590">NLMISC::CBitmap::setMipMapCount()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05790.html#l00557">uncompressBlockRGB()</a>, and <a class="el" href="a05646.html#l00236">w</a>.
<p>
Referenced by <a class="el" href="a05792.html#l00185">NL3D::CHLSTextureBank::CTextureInstance::buildColorVersion()</a>.
<p>
<div class="fragment"><pre>00338 {
00339 <span class="comment">// static to avoid realloc</span>
00340 <span class="keyword">static</span> vector<uint8> dstTexture;
00341 <span class="keyword">static</span> vector<CRGBA> dstUnCompTexture;
00342 <a class="code" href="a04558.html#a11">uint32</a> *bitPtr;
00343 <a class="code" href="a04558.html#a7">uint8</a> *srcPtr;
00344 <a class="code" href="a04558.html#a7">uint8</a> *dstPtr;
00345 <a class="code" href="a03337.html">CRGBA</a> *dstUnCompPtr;
00346 <a class="code" href="a04558.html#a11">uint32</a> bitMask;
00347
00348 <span class="comment">// **** prepare Data</span>
00349
00350 <span class="comment">// count number of DXTC5 block in _Texture.</span>
00351 <a class="code" href="a04558.html#a15">uint</a> numBlocks= <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer0">_BlockToCompressIndex</a>/<a class="code" href="a04367.html#a1">BLOCK_DXTC_SIZE</a>;
00352
00353 <span class="comment">// create a tmp compressed block array, copy of Texture.</span>
00354 dstTexture.resize(numBlocks*BLOCK_DXTC_SIZE);
00355 <span class="comment">// copy from texture (to have non colored version already copied, and also ALPHA ok)</span>
00356 memcpy(&dstTexture[0], &_Texture[0], dstTexture.size());
00357
00358 <span class="comment">// create a tmp uncompressed block array, which will receive coloring of mixt blocks</span>
00359 dstUnCompTexture.resize(numBlocks*BLOCK_NUM_PIXEL);
00360
00361 <span class="comment">// For all blockToCompress, uncompress them in dstUnCompTexture, because they will blend with future mask coloring</span>
00362 <a class="code" href="a04558.html#a15">uint</a> n= numBlocks;
00363 bitPtr= (<a class="code" href="a04558.html#a11">uint32</a>*)(&<a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer4">_Texture</a>[<a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer0">_BlockToCompressIndex</a>]);
00364 dstUnCompPtr= &dstUnCompTexture[0];
00365 srcPtr= &<a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer4">_Texture</a>[0];
00366 <span class="keywordflow">while</span>(n>0)
00367 {
00368 <a class="code" href="a04558.html#a15">uint</a> nBits= <a class="code" href="a04061.html#a0">min</a>(n, 32U);
00369 <a class="code" href="a05363.html#a421">getBitPack</a>(bitPtr, bitMask);
00370 n-= nBits;
00371 bitPtr++;
00372 <span class="keywordflow">for</span>(;nBits>0;nBits--)
00373 {
00374 <span class="comment">// need to compress/uncompress ??</span>
00375 <span class="keywordflow">if</span>(bitMask&1)
00376 {
00377 <span class="comment">// uncompress this block. ignore alpha</span>
00378 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTextureh2">uncompressBlockRGB</a>(srcPtr, dstUnCompPtr);
00379 }
00380 bitMask>>=1;
00381 dstUnCompPtr+= <a class="code" href="a04367.html#a0">BLOCK_NUM_PIXEL</a>;
00382 srcPtr+= <a class="code" href="a04367.html#a1">BLOCK_DXTC_SIZE</a>;
00383 }
00384 }
00385
00386 <span class="comment">// **** build the color version for all masks.</span>
00387
00388 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> maskId= 0; maskId<<a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer2">_Masks</a>.size();maskId++)
00389 {
00390 CMask &mask= <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer2">_Masks</a>[maskId];
00391 <span class="comment">// unpack colDelta, and prepare for use with CFastHLSModifier.</span>
00392 <a class="code" href="a04558.html#a7">uint8</a> dHue= colDeltaList[maskId].DHue;
00393 <a class="code" href="a04558.html#a15">uint</a> dLum= 0xFFFFFF00 + colDeltaList[maskId].DLum*2;
00394 <a class="code" href="a04558.html#a15">uint</a> dSat= 0xFFFFFF00 + colDeltaList[maskId].DSat*2;
00395
00396 <span class="comment">// get a ptr on alpha of mixt block.</span>
00397 <a class="code" href="a04558.html#a7">uint8</a> *alphaMixtBlock= &mask.Data[0];
00398
00399
00400 <span class="comment">// ---- for all Fullblock ot this mask, color and store in dstTexture</span>
00401 <span class="comment">// start at full Block bits desc</span>
00402 bitPtr= (<a class="code" href="a04558.html#a11">uint32</a>*)(&mask.Data[mask.FullBlockIndex]);
00403 <a class="code" href="a04558.html#a11">uint32</a> *bitCompPtr= (<a class="code" href="a04558.html#a11">uint32</a>*)(&_Texture[<a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer0">_BlockToCompressIndex</a>]);
00404 srcPtr= &_Texture[0];
00405 dstPtr= &dstTexture[0];
00406 dstUnCompPtr= &dstUnCompTexture[0];
00407 n= numBlocks;
00408 <span class="comment">// run all blocks.</span>
00409 <span class="keywordflow">while</span>(n>0)
00410 {
00411 <a class="code" href="a04558.html#a15">uint</a> nBits= <a class="code" href="a04061.html#a0">min</a>(n, 32U);
00412 <span class="comment">// get Full block mask.</span>
00413 <a class="code" href="a05363.html#a421">getBitPack</a>(bitPtr, bitMask);
00414 n-= nBits;
00415 bitPtr++;
00416 <span class="comment">// get Compress mask.</span>
00417 <a class="code" href="a04558.html#a11">uint32</a> bitCompMask;
00418 <a class="code" href="a05363.html#a421">getBitPack</a>(bitCompPtr, bitCompMask);
00419 bitCompPtr++;
00420 <span class="comment">// for all bits</span>
00421 <span class="keywordflow">for</span>(;nBits>0;nBits--)
00422 {
00423 <span class="comment">// need to colorize??</span>
00424 <span class="keywordflow">if</span>(bitMask&1)
00425 {
00426 <span class="comment">// colorize this block. ignore alpha</span>
00427 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTextureh0">colorizeDXTCBlockRGB</a>(srcPtr, dstPtr, dHue, dLum, dSat);
00428 <span class="comment">// If this block is "a block to recompress", then must uncompress it in dstUnCompPtr</span>
00429 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTextureh2">uncompressBlockRGB</a>(dstPtr, dstUnCompPtr);
00430 }
00431 bitMask>>=1;
00432 bitCompMask>>=1;
00433 srcPtr+= <a class="code" href="a04367.html#a1">BLOCK_DXTC_SIZE</a>;
00434 dstPtr+= <a class="code" href="a04367.html#a1">BLOCK_DXTC_SIZE</a>;
00435 dstUnCompPtr+= <a class="code" href="a04367.html#a0">BLOCK_NUM_PIXEL</a>;
00436 }
00437 }
00438
00439 <span class="comment">// ---- for all mixtblock ot this mask, color, uncompress and blend in store in dstUnCompTexture</span>
00440 <span class="keyword">static</span> <a class="code" href="a04558.html#a7">uint8</a> tmpColoredBlockDXTC[<a class="code" href="a04367.html#a0">BLOCK_NUM_PIXEL</a>];
00441 <span class="keyword">static</span> <a class="code" href="a03337.html">CRGBA</a> tmpColoredBlockRGBA[<a class="code" href="a04367.html#a0">BLOCK_NUM_PIXEL</a>];
00442 <span class="comment">// start at mixt Block bits desc</span>
00443 bitPtr= (<a class="code" href="a04558.html#a11">uint32</a>*)(&mask.Data[mask.MixtBlockIndex]);
00444 srcPtr= &_Texture[0];
00445 dstUnCompPtr= &dstUnCompTexture[0];
00446 n= numBlocks;
00447 <span class="comment">// run all blocks.</span>
00448 <span class="keywordflow">while</span>(n>0)
00449 {
00450 <a class="code" href="a04558.html#a15">uint</a> nBits= <a class="code" href="a04061.html#a0">min</a>(n, 32U);
00451 <a class="code" href="a05363.html#a421">getBitPack</a>(bitPtr, bitMask);
00452 n-= nBits;
00453 bitPtr++;
00454 <span class="keywordflow">for</span>(;nBits>0;nBits--)
00455 {
00456 <span class="comment">// need to colorize??</span>
00457 <span class="keywordflow">if</span>(bitMask&1)
00458 {
00459 <span class="comment">// colorize this block. store 2 colors in tmp</span>
00460 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTextureh0">colorizeDXTCBlockRGB</a>(srcPtr, tmpColoredBlockDXTC, dHue, dLum, dSat);
00461 <span class="comment">// copy RGB bits from src to tmp</span>
00462 ((<a class="code" href="a04558.html#a11">uint32</a>*)tmpColoredBlockDXTC)[3]= ((<a class="code" href="a04558.html#a11">uint32</a>*)srcPtr)[3];
00463
00464 <span class="comment">// uncompress the block.</span>
00465 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTextureh2">uncompressBlockRGB</a>(tmpColoredBlockDXTC, tmpColoredBlockRGBA);
00466
00467 <span class="comment">// blend tmpColoredBlockRGBA into dstUnCompPtr, according to alphaMixtBlock.</span>
00468 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0;i<16;i++)
00469 {
00470 dstUnCompPtr[i].<a class="code" href="a03337.html#NLMISC_1_1CRGBAz2022_3">blendFromuiRGBOnly</a>(dstUnCompPtr[i], tmpColoredBlockRGBA[i], *alphaMixtBlock);
00471 <span class="comment">// next pixel</span>
00472 alphaMixtBlock++;
00473 }
00474 }
00475 bitMask>>=1;
00476 srcPtr+= <a class="code" href="a04367.html#a1">BLOCK_DXTC_SIZE</a>;
00477 dstUnCompPtr+= <a class="code" href="a04367.html#a0">BLOCK_NUM_PIXEL</a>;
00478 }
00479 }
00480
00481 }
00482
00483
00484 <span class="comment">// Since colorizeDXTCBlockRGB() use MMX, must end with emms.</span>
00485 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span>
00486 <span class="preprocessor"></span> <span class="keywordflow">if</span>(CSystemInfo::hasMMX())
00487 _asm emms;
00488 <span class="preprocessor">#endif</span>
00489 <span class="preprocessor"></span>
00490
00491 <span class="comment">// **** compress needed blocks</span>
00492 n= numBlocks;
00493 bitPtr= (<a class="code" href="a04558.html#a11">uint32</a>*)(&_Texture[<a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer0">_BlockToCompressIndex</a>]);
00494 dstUnCompPtr= &dstUnCompTexture[0];
00495 dstPtr= &dstTexture[0];
00496 <span class="keywordflow">while</span>(n>0)
00497 {
00498 <a class="code" href="a04558.html#a15">uint</a> nBits= <a class="code" href="a04061.html#a0">min</a>(n, 32U);
00499 <a class="code" href="a05363.html#a421">getBitPack</a>(bitPtr, bitMask);
00500 n-= nBits;
00501 bitPtr++;
00502 <span class="keywordflow">for</span>(;nBits>0;nBits--)
00503 {
00504 <span class="comment">// need to compress ??</span>
00505 <span class="keywordflow">if</span>(bitMask&1)
00506 {
00507 <span class="comment">// uncompress this block. ignore alpha</span>
00508 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturee0">compressBlockRGB</a>(dstUnCompPtr, dstPtr);
00509 }
00510 bitMask>>=1;
00511 dstUnCompPtr+= <a class="code" href="a04367.html#a0">BLOCK_NUM_PIXEL</a>;
00512 dstPtr+= <a class="code" href="a04367.html#a1">BLOCK_DXTC_SIZE</a>;
00513 }
00514 }
00515
00516 <span class="comment">// **** format bitmap out with dstTexture.</span>
00517 out.<a class="code" href="a02268.html#NL3D_1_1ITexturea32">reset</a>(CBitmap::DXTC5);
00518 out.<a class="code" href="a02268.html#NL3D_1_1ITexturea33">resize</a>(_Width, _Height, CBitmap::DXTC5);
00519
00520 <span class="comment">// create and fill all the mipMaps</span>
00521 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a575">w</a>= <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer5">_Width</a>, h=<a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer1">_Height</a>;
00522 dstPtr= &dstTexture[0];
00523 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> m=0;m<<a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer3">_NumMipMap</a>;m++)
00524 {
00525 <span class="comment">// allocate.</span>
00526 out.<a class="code" href="a02268.html#NL3D_1_1ITexturea34">resizeMipMap</a>(m, w, h);
00527 <span class="comment">// get the size of this DXTC5 level.</span>
00528 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a587">size</a>= out.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>(m).<a class="code" href="a03000.html#NLMISC_1_1CObjectVectorz1984_3">size</a>();
00529 <span class="comment">// fill</span>
00530 memcpy(&out.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>(m)[0], dstPtr, <a class="code" href="a04223.html#a587">size</a>);
00531 <span class="comment">// next mipmap</span>
00532 dstPtr+= <a class="code" href="a04223.html#a587">size</a>;
00533 <a class="code" href="a04223.html#a575">w</a>= (<a class="code" href="a04223.html#a575">w</a>+1)/2;
00534 h= (h+1)/2;
00535 }
00536 <span class="comment">// verify all filled</span>
00537 <a class="code" href="a04199.html#a6">nlassert</a>( dstPtr== (&dstTexture[0] + dstTexture.size()) );
00538
00539 <span class="comment">// set the correct num of mipmap</span>
00540 out.<a class="code" href="a02268.html#NL3D_1_1ITexturea40">setMipMapCount</a>(_NumMipMap);
00541 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTextureh0" doxytag="NL3D::CHLSColorTexture::colorizeDXTCBlockRGB" ></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::CHLSColorTexture::colorizeDXTCBlockRGB </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a04558.html#a7">uint8</a> * </td>
<td class="mdname" nowrap> <em>srcPtr</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> * </td>
<td class="mdname" nowrap> <em>dstPtr</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> </td>
<td class="mdname" nowrap> <em>dHue</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td>
<td class="mdname" nowrap> <em>dLum</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td>
<td class="mdname" nowrap> <em>dSat</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static, private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
apply colDelta to the block. Alpha part is not modified. MMX with no EMMS called here !!!
<p>
<p>
Definition at line <a class="el" href="a05790.html#l00545">545</a> of file <a class="el" href="a05790.html">hls_color_texture.cpp</a>.
<p>
References <a class="el" href="a05706.html#l00110">NL3D::CFastHLSModifier::applyHLSMod()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05981.html#l00096">uint8</a>.
<p>
Referenced by <a class="el" href="a05790.html#l00337">buildColorVersion()</a>.
<p>
<div class="fragment"><pre>00546 {
00547 <span class="comment">// get modifier.</span>
00548 CFastHLSModifier &fastHLS= CFastHLSModifier::getInstance();
00549
00550 <span class="comment">// apply the color on the 2 DXTC colors</span>
00551 *(<a class="code" href="a04558.html#a9">uint16</a>*)(dstPtr+8 )= fastHLS.applyHLSMod(*(<a class="code" href="a04558.html#a9">uint16</a>*)(srcPtr+8 ) , dHue, dLum, dSat);
00552 *(<a class="code" href="a04558.html#a9">uint16</a>*)(dstPtr+10)= fastHLS.applyHLSMod(*(<a class="code" href="a04558.html#a9">uint16</a>*)(srcPtr+10) , dHue, dLum, dSat);
00553 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTexturee0" doxytag="NL3D::CHLSColorTexture::compressBlockRGB" ></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::CHLSColorTexture::compressBlockRGB </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a03337.html">CRGBA</a> * </td>
<td class="mdname" nowrap> <em>srcRGBA</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> * </td>
<td class="mdname" nowrap> <em>dstDXTC</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
compress DXTC5 RGB only block, from a RGBA raw array. dstDXTC Alpha part is not modified. srcRGBA->A are setup to 0!!
<p>
<p>
Definition at line <a class="el" href="a05790.html#l00628">628</a> of file <a class="el" href="a05790.html">hls_color_texture.cpp</a>.
<p>
References <a class="el" href="a06340.html#l00340">NLMISC::CRGBA::A</a>, <a class="el" href="a06340.html#l00338">NLMISC::CRGBA::B</a>, <a class="el" href="a06340.html#l00104">NLMISC::CRGBA::blendFromui()</a>, <a class="el" href="a05790.html#l00586">computeMinMax()</a>, <a class="el" href="a06340.html#l00336">NLMISC::CRGBA::G</a>, <a class="el" href="a05701.html#l00125">NLMISC::OptFastFloor()</a>, <a class="el" href="a06340.html#l00334">NLMISC::CRGBA::R</a>, <a class="el" href="a06340.html#l00162">NLMISC::CRGBA::set565()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05587.html#l00107">NLMISC::sqr()</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00102">uint64</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05646.html#l00237">v</a>, <a class="el" href="a05791.html#l00120">NL3D::CHLSColorTexture::CVectorInt::x</a>, <a class="el" href="a05791.html#l00120">NL3D::CHLSColorTexture::CVectorInt::y</a>, and <a class="el" href="a05791.html#l00120">NL3D::CHLSColorTexture::CVectorInt::z</a>.
<p>
Referenced by <a class="el" href="a05790.html#l00337">buildColorVersion()</a>.
<p>
<div class="fragment"><pre>00629 {
00630 <span class="comment">// skip alpha part.</span>
00631 <a class="code" href="a04558.html#a7">uint8</a> *dstBlock= dstDXTC+8;
00632
00633
00634 <span class="comment">// **** compute RGB0 and RGB1.</span>
00635 <a class="code" href="a04558.html#a15">uint</a> i,j,n;
00636
00637 <span class="comment">// compute the mean color of 16 pixels</span>
00638 <a class="code" href="a04558.html#a14">sint</a> mean[3];
00639 mean[0]= 0;
00640 mean[1]= 0;
00641 mean[2]= 0;
00642 <a class="code" href="a03337.html">CRGBA</a> *<a class="code" href="a04223.html#a652">src</a>= srcRGBA;
00643 <span class="keywordflow">for</span>(n=16;n>0;n--,<a class="code" href="a04223.html#a652">src</a>++)
00644 {
00645 mean[0]+= <a class="code" href="a04223.html#a652">src</a>->R;
00646 mean[1]+= <a class="code" href="a04223.html#a652">src</a>->G;
00647 mean[2]+= <a class="code" href="a04223.html#a652">src</a>->B;
00648 <span class="comment">// at same time, setup alpha to 0. Important for "compute bits" part (see MMX)!!</span>
00649 <a class="code" href="a04223.html#a652">src</a>->A= 0;
00650 }
00651 mean[0]>>= 4;
00652 mean[1]>>= 4;
00653 mean[2]>>= 4;
00654
00655 <span class="comment">// compute col-mean</span>
00656 <a class="code" href="a04558.html#a14">sint</a> diffBlock[16*3];
00657 <a class="code" href="a04223.html#a652">src</a>= srcRGBA;
00658 <a class="code" href="a04558.html#a14">sint</a> *srcDiff= diffBlock;
00659 <span class="keywordflow">for</span>(n=16;n>0;n--,<a class="code" href="a04223.html#a652">src</a>++,srcDiff+=3)
00660 {
00661 srcDiff[0]= (<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a04223.html#a652">src</a>->R - mean[0];
00662 srcDiff[1]= (<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a04223.html#a652">src</a>->G - mean[1];
00663 srcDiff[2]= (<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a04223.html#a652">src</a>->B - mean[2];
00664 }
00665
00666
00667 <span class="comment">// compute the covariant matrix.</span>
00668 <a class="code" href="a04558.html#a14">sint</a> coMat[3][3];
00669 <span class="comment">// Apply std RGB factor (0.3, 0.56, 0.14) to choose the best Axis. This give far much best results.</span>
00670 <a class="code" href="a04558.html#a14">sint</a> rgbFact[3]= {77, 143, 36};
00671 <span class="keywordflow">for</span>(i=0;i<3;i++)
00672 {
00673 <span class="comment">// OPTIMIZE SINCE SYMETRIX MATRIX</span>
00674 <span class="keywordflow">for</span>(j=i;j<3;j++)
00675 {
00676 <a class="code" href="a04558.html#a10">sint32</a> factor= 0;
00677 <span class="comment">// divide / 16 to avoid overflow sint32</span>
00678 <a class="code" href="a04558.html#a15">uint</a> colFactor= (rgbFact[i]*rgbFact[j]) >> 4;
00679 <span class="comment">// run all 16 pixels.</span>
00680 <a class="code" href="a04558.html#a14">sint</a> *srcDiff= diffBlock;
00681 <span class="keywordflow">for</span>(n=16;n>0;n--,srcDiff+=3)
00682 {
00683 factor+= srcDiff[i] * srcDiff[j] * colFactor;
00684 }
00685 coMat[i][j]= factor;
00686 }
00687 }
00688 <span class="comment">// Fill symetrix matrix</span>
00689 coMat[1][0]= coMat[0][1];
00690 coMat[2][0]= coMat[0][2];
00691 coMat[2][1]= coMat[1][2];
00692
00693
00694 <span class="comment">// take the bigger vector</span>
00695 <a class="code" href="a04558.html#a14">sint</a> maxSize= 0;
00696 <a class="code" href="a04558.html#a15">uint</a> axis= 0;
00697 <span class="keywordflow">for</span>(i=0;i<3;i++)
00698 {
00699 <span class="comment">// Use abs since sqr fails because all sint32 range may be used.</span>
00700 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a587">size</a>= abs(coMat[i][0]) + abs(coMat[i][1]) + abs(coMat[i][2]);
00701 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a587">size</a>>maxSize)
00702 {
00703 maxSize= <a class="code" href="a04223.html#a587">size</a>;
00704 axis= i;
00705 }
00706 }
00707
00708 <span class="comment">// normalize this vector</span>
00709 CVector <a class="code" href="a04223.html#a576">v</a>;
00710 <span class="comment">// remove some rgb factor...</span>
00711 <a class="code" href="a04223.html#a576">v</a>.x= (<span class="keywordtype">float</span>)coMat[axis][0]/rgbFact[0];
00712 <a class="code" href="a04223.html#a576">v</a>.y= (<span class="keywordtype">float</span>)coMat[axis][1]/rgbFact[1];
00713 <a class="code" href="a04223.html#a576">v</a>.z= (<span class="keywordtype">float</span>)coMat[axis][2]/rgbFact[2];
00714 <a class="code" href="a04223.html#a576">v</a>.normalize();
00715 <span class="comment">// set a Fixed 16:16.</span>
00716 CVectorInt vInt;
00717 <span class="comment">// don't bother if OptFastFloorBegin() has been called. 16:16 precision is sufficient.</span>
00718 vInt.x= <a class="code" href="a05378.html#a397">OptFastFloor</a>(<a class="code" href="a04223.html#a576">v</a>.x*65536);
00719 vInt.y= <a class="code" href="a05378.html#a397">OptFastFloor</a>(<a class="code" href="a04223.html#a576">v</a>.y*65536);
00720 vInt.z= <a class="code" href="a05378.html#a397">OptFastFloor</a>(<a class="code" href="a04223.html#a576">v</a>.z*65536);
00721
00722
00723 <span class="comment">// For all pixels, choose the 2 colors along the axis</span>
00724 <a class="code" href="a04558.html#a14">sint</a> rgb0[3];
00725 <a class="code" href="a04558.html#a14">sint</a> rgb1[3];
00726 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTextureh1">computeMinMax</a>(diffBlock, vInt, mean, rgb0, rgb1);
00727
00728 <span class="comment">// Average to 16 bits. NB: correclty encode 0..255 to 0.31 or 0..63.</span>
00729 <a class="code" href="a04558.html#a15">uint</a> R,G,B;
00730 R= ((rgb0[0]*7967+32768)>>16);
00731 G= ((rgb0[1]*16191+32768)>>16);
00732 B= ((rgb0[2]*7967+32768)>>16);
00733 <a class="code" href="a04558.html#a9">uint16</a> rgb016= (R<<11) + (G<<5) + (B);
00734 R= ((rgb1[0]*7967+32768)>>16);
00735 G= ((rgb1[1]*16191+32768)>>16);
00736 B= ((rgb1[2]*7967+32768)>>16);
00737 <a class="code" href="a04558.html#a9">uint16</a> rgb116= (R<<11) + (G<<5) + (B);
00738 <span class="comment">// copy to block</span>
00739 ((<a class="code" href="a04558.html#a9">uint16</a>*)dstBlock)[0]= rgb016;
00740 ((<a class="code" href="a04558.html#a9">uint16</a>*)dstBlock)[1]= rgb116;
00741
00742
00743 <span class="comment">// **** compute bits</span>
00744 <a class="code" href="a03337.html">CRGBA</a> c[4];
00745 c[0].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa15">set565</a>(rgb016);
00746 c[1].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa15">set565</a>(rgb116);
00747 c[2].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa3">blendFromui</a>(c[0],c[1],85);
00748 c[3].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa3">blendFromui</a>(c[0],c[1],171);
00749 <span class="comment">// it is important that c[] and src Alpha are set to 0, because of "pmaddwd" use in MMX code...</span>
00750 c[0].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 0;
00751 c[1].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 0;
00752 c[2].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 0;
00753 c[3].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 0;
00754 <a class="code" href="a03337.html">CRGBA</a> *cPtr= c;
00755
00756 <span class="comment">// result.</span>
00757 <a class="code" href="a04558.html#a11">uint32</a> bits= 0;
00758
00759 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span>
00760 <span class="preprocessor"></span> <span class="keywordflow">if</span>(CSystemInfo::hasMMX())
00761 {
00762 <span class="comment">// preapre mmx</span>
00763 <a class="code" href="a04558.html#a13">uint64</a> blank= 0;
00764 __asm
00765 {
00766 movq mm7, blank
00767 }
00768
00769 <span class="comment">// for 16 pixels</span>
00770 <a class="code" href="a04223.html#a652">src</a>= srcRGBA;
00771 <span class="keywordflow">for</span>(n=16;n>0;n--,<a class="code" href="a04223.html#a652">src</a>++)
00772 {
00773 <span class="comment">/* // C Version (+ little asm).</span>
00774 <span class="comment"> uint minDist= 0xFFFFFFFF;</span>
00775 <span class="comment"> uint id= 0;</span>
00776 <span class="comment"> for(i=0;i<4;i++)</span>
00777 <span class="comment"> {</span>
00778 <span class="comment"> // applying factors such *23, *80, *6 gives better results, but slower (in MMX).</span>
00779 <span class="comment"> uint dist= sqr((sint)src->R-(sint)c[i].R);</span>
00780 <span class="comment"> dist+= sqr((sint)src->G-(sint)c[i].G);</span>
00781 <span class="comment"> dist+= sqr((sint)src->B-(sint)c[i].B);</span>
00782 <span class="comment"> if(dist<minDist)</span>
00783 <span class="comment"> {</span>
00784 <span class="comment"> minDist= dist;</span>
00785 <span class="comment"> id= i;</span>
00786 <span class="comment"> }</span>
00787 <span class="comment"> }</span>
00788 <span class="comment"> bits|=id;</span>
00789 <span class="comment"> __asm</span>
00790 <span class="comment"> {</span>
00791 <span class="comment"> mov eax, bits</span>
00792 <span class="comment"> ror eax, 2</span>
00793 <span class="comment"> mov bits, eax</span>
00794 <span class="comment"> }*/</span>
00795 __asm
00796 {
00797 mov esi, <a class="code" href="a04223.html#a652">src</a>
00798 mov edi, cPtr
00799
00800 mov ecx, 4
00801 mov edx, 0xFFFFFFFF <span class="comment">// edx= minDist</span>
00802
00803 movd mm0, [esi]
00804 punpcklbw mm0, mm7
00805
00806 mov esi, 4 <span class="comment">// esi= id MinDist (inverted)</span>
00807
00808 <span class="comment">// compare 4 cases.</span>
00809 myLoop:
00810 movd mm1, [edi]
00811 punpcklbw mm1, mm7
00812 psubsw mm1, mm0
00813 pmaddwd mm1, mm1
00814 movd eax, mm1
00815 psrlq mm1, 32
00816 movd ebx, mm1
00817 add eax, ebx
00818
00819 <span class="comment">// take smaller of A and B. here: eax= A, edx= B</span>
00820 sub eax, edx <span class="comment">// eax= A-B</span>
00821 sbb ebx, ebx <span class="comment">// ebx= FF if A<B.</span>
00822 and eax, ebx <span class="comment">// eax= A-B if A<B</span>
00823 add edx, eax <span class="comment">// if A<B, edx= B+A-B= A, else, edx= B. => minimum</span>
00824 <span class="comment">// setup the "smaller" id. here esi= iB, ecx= iA</span>
00825 not ebx <span class="comment">// ebx= 0 if A<B, FF else</span>
00826 sub esi, ecx <span class="comment">// esi= iB-iA</span>
00827 and esi, ebx <span class="comment">// esi= 0 if A<B, iB-iA else</span>
00828 add esi, ecx <span class="comment">// esi= 0+iA= iA if A<B, else esi= iB-iA+iA= iB</span>
00829
00830 add edi, 4
00831 dec ecx
00832 jnz myLoop
00833
00834 <span class="comment">// reverse id</span>
00835 mov edx, 4
00836 mov eax, bits
00837 sub edx, esi
00838 <span class="comment">// and store into bits</span>
00839 or eax, edx
00840 ror eax, 2
00841 mov bits, eax
00842 }
00843 }
00844
00845
00846 <span class="comment">// end MMX block.</span>
00847 __asm emms;
00848 }
00849 <span class="keywordflow">else</span>
00850 <span class="preprocessor">#endif // NL_OS_WINDOWS</span>
00851 <span class="preprocessor"></span> {
00852 <a class="code" href="a04223.html#a652">src</a>= srcRGBA;
00853 <span class="keywordflow">for</span>(n=16;n>0;n--,<a class="code" href="a04223.html#a652">src</a>++)
00854 {
00855 <span class="comment">// C Version (+ little asm).</span>
00856 <a class="code" href="a04558.html#a15">uint</a> minDist= 0xFFFFFFFF;
00857 <a class="code" href="a04558.html#a15">uint</a> <span class="keywordtype">id</span>= 0;
00858 <span class="keywordflow">for</span>(i=0;i<4;i++)
00859 {
00860 <span class="comment">// applying factors such *23, *80, *6 gives better results, but slower (in MMX).</span>
00861 <a class="code" href="a04558.html#a15">uint</a> dist= <a class="code" href="a05378.html#a373">sqr</a>((<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a04223.html#a652">src</a>->R-(<a class="code" href="a04558.html#a14">sint</a>)c[i].R);
00862 dist+= <a class="code" href="a05378.html#a373">sqr</a>((<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a04223.html#a652">src</a>->G-(<a class="code" href="a04558.html#a14">sint</a>)c[i].G);
00863 dist+= <a class="code" href="a05378.html#a373">sqr</a>((<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a04223.html#a652">src</a>->B-(<a class="code" href="a04558.html#a14">sint</a>)c[i].B);
00864 <span class="keywordflow">if</span>(dist<minDist)
00865 {
00866 minDist= dist;
00867 <span class="keywordtype">id</span>= i;
00868 }
00869 }
00870 <span class="comment">// a ror is faster, but full C version</span>
00871 bits|= <span class="keywordtype">id</span><<30;
00872 <span class="comment">// don't do it for the last.</span>
00873 <span class="keywordflow">if</span>(n>1)
00874 bits>>=2;
00875 }
00876 }
00877
00878 <span class="comment">// copy</span>
00879 ((<a class="code" href="a04558.html#a11">uint32</a>*)dstBlock)[1]= bits;
00880 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTextureh1" doxytag="NL3D::CHLSColorTexture::computeMinMax" ></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::CHLSColorTexture::computeMinMax </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> * </td>
<td class="mdname" nowrap> <em>diffBlock</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02634.html">CVectorInt</a> & </td>
<td class="mdname" nowrap> <em>v</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>mean</em>[3], </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>rgb0</em>[3], </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td>
<td class="mdname" nowrap> <em>rgb1</em>[3]</td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static, private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
used by <a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturee0">compressBlockRGB()</a>
<p>
<p>
Definition at line <a class="el" href="a05790.html#l00586">586</a> of file <a class="el" href="a05790.html">hls_color_texture.cpp</a>.
<p>
References <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05646.html#l00237">v</a>.
<p>
Referenced by <a class="el" href="a05790.html#l00628">compressBlockRGB()</a>.
<p>
<div class="fragment"><pre>00587 {
00588 <span class="comment">// compute the min and max distance along the axis v.</span>
00589 <a class="code" href="a04558.html#a14">sint</a> mind= INT_MAX;
00590 <a class="code" href="a04558.html#a14">sint</a> maxd= INT_MIN;
00591 <a class="code" href="a04558.html#a14">sint</a> *srcDiff= diffBlock;
00592 <span class="comment">// for the 16 pixels</span>
00593 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> n=16;n>0;n--,srcDiff+=3)
00594 {
00595 <a class="code" href="a04558.html#a14">sint</a> R= srcDiff[0];
00596 <a class="code" href="a04558.html#a14">sint</a> G= srcDiff[1];
00597 <a class="code" href="a04558.html#a14">sint</a> B= srcDiff[2];
00598 <a class="code" href="a04558.html#a14">sint</a> d= R*<a class="code" href="a04223.html#a576">v</a>.x + G*<a class="code" href="a04223.html#a576">v</a>.y + B*<a class="code" href="a04223.html#a576">v</a>.z;
00599 <span class="keywordflow">if</span>(d<mind)
00600 mind= d;
00601 <span class="keywordflow">if</span>(d>maxd)
00602 maxd= d;
00603 }
00604
00605 <span class="comment">// avoid overflow. here, Higher possible bit is 16+8+2 (add of 3 values=> *4) == 26</span>
00606 <span class="comment">// 26-12= 14. 14+16=30 => ok.</span>
00607 mind>>= 12;
00608 maxd>>= 12;
00609
00610 <span class="comment">// compute the 2 colors: rgb0 on the min, and rgb1 on the max</span>
00611 rgb0[0]= mean[0]+ (mind*<a class="code" href="a04223.html#a576">v</a>.x>>20);
00612 rgb0[1]= mean[1]+ (mind*<a class="code" href="a04223.html#a576">v</a>.y>>20);
00613 rgb0[2]= mean[2]+ (mind*<a class="code" href="a04223.html#a576">v</a>.z>>20);
00614 rgb1[0]= mean[0]+ (maxd*<a class="code" href="a04223.html#a576">v</a>.x>>20);
00615 rgb1[1]= mean[1]+ (maxd*<a class="code" href="a04223.html#a576">v</a>.y>>20);
00616 rgb1[2]= mean[2]+ (maxd*<a class="code" href="a04223.html#a576">v</a>.z>>20);
00617 <span class="comment">// clamp to 0..255</span>
00618 fastClamp8(rgb0[0]);
00619 fastClamp8(rgb0[1]);
00620 fastClamp8(rgb0[2]);
00621 fastClamp8(rgb1[0]);
00622 fastClamp8(rgb1[1]);
00623 fastClamp8(rgb1[2]);
00624 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTexturea3" doxytag="NL3D::CHLSColorTexture::getNumMasks" ></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#a15">uint</a> NL3D::CHLSColorTexture::getNumMasks </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
get num of masks
<p>
<p>
Definition at line <a class="el" href="a05791.html#l00090">90</a> of file <a class="el" href="a05791.html">hls_color_texture.h</a>.
<p>
References <a class="el" href="a05791.html#l00130">_Masks</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
<p>
Referenced by <a class="el" href="a05792.html#l00062">NL3D::CHLSTextureBank::addTextureInstance()</a>.
<p>
<div class="fragment"><pre>00090 {<span class="keywordflow">return</span> <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer2">_Masks</a>.size();}
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTexturea4" doxytag="NL3D::CHLSColorTexture::reset" ></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::CHLSColorTexture::reset </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
reset the build
<p>
<p>
Definition at line <a class="el" href="a05790.html#l00082">82</a> of file <a class="el" href="a05790.html">hls_color_texture.cpp</a>.
<p>
References <a class="el" href="a05791.html#l00130">_Masks</a>, and <a class="el" href="a05791.html#l00125">_NumMipMap</a>.
<p>
Referenced by <a class="el" href="a05790.html#l00076">CHLSColorTexture()</a>, and <a class="el" href="a05790.html#l00092">setBitmap()</a>.
<p>
<div class="fragment"><pre>00083 {
00084 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer5">_Width</a>= 0;
00085 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer1">_Height</a>= 0;
00086 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer3">_NumMipMap</a>= 0;
00087 <a class="code" href="a05378.html#a381">contReset</a>(_Texture);
00088 <a class="code" href="a05378.html#a381">contReset</a>(_Masks);
00089 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTexturea5" doxytag="NL3D::CHLSColorTexture::serial" ></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::CHLSColorTexture::serial </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02270.html">NLMISC::IStream</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>f</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a05790.html#l00313">313</a> of file <a class="el" href="a05790.html">hls_color_texture.cpp</a>.
<p>
References <a class="el" href="a05791.html#l00126">_BlockToCompressIndex</a>, <a class="el" href="a05791.html#l00130">_Masks</a>, <a class="el" href="a05791.html#l00125">_NumMipMap</a>, <a class="el" href="a06462.html#l00232">NLMISC::IStream::serial()</a>, <a class="el" href="a06462.html#l00324">NLMISC::IStream::serialCont()</a>, and <a class="el" href="a06461.html#l00266">NLMISC::IStream::serialVersion()</a>.
<p>
<div class="fragment"><pre>00314 {
00315 f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_8">serialVersion</a>(0);
00316
00317 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(_Width, _Height, _NumMipMap, _BlockToCompressIndex);
00318 f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a>(_Texture);
00319 f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a>(_Masks);
00320 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTexturea6" doxytag="NL3D::CHLSColorTexture::setBitmap" ></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::CHLSColorTexture::setBitmap </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02268.html">NLMISC::CBitmap</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>bmp</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
setup the un-colored bitmap for the texture. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>bmp</em> </td><td>a bitmap which must be a DXTC5 with all mipmaps.</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a05790.html#l00092">92</a> of file <a class="el" href="a05790.html">hls_color_texture.cpp</a>.
<p>
References <a class="el" href="a05791.html#l00126">_BlockToCompressIndex</a>, <a class="el" href="a05791.html#l00125">_NumMipMap</a>, <a class="el" href="a05486.html#l01388">NLMISC::CBitmap::getHeight()</a>, <a class="el" href="a05487.html#l00369">NLMISC::CBitmap::getMipMapCount()</a>, <a class="el" href="a05487.html#l00335">NLMISC::CBitmap::getPixelFormat()</a>, <a class="el" href="a05487.html#l00308">NLMISC::CBitmap::getPixels()</a>, <a class="el" href="a05486.html#l01363">NLMISC::CBitmap::getWidth()</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05790.html#l00082">reset()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00096">uint8</a>, and <a class="el" href="a05646.html#l01013">width</a>.
<p>
<div class="fragment"><pre>00093 {
00094 <a class="code" href="a04199.html#a6">nlassert</a>(bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea15">getPixelFormat</a>()==CBitmap::DXTC5);
00095 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a632">width</a>= bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>();
00096 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a633">height</a>= bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>();
00097 <a class="code" href="a04558.html#a15">uint</a> mmCount= bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea13">getMipMapCount</a>();
00098 <a class="code" href="a04199.html#a6">nlassert</a>(width>=1 && height>=1);
00099 <a class="code" href="a04199.html#a6">nlassert</a>(mmCount>1 || width*height==1);
00100
00101 <span class="comment">// restart</span>
00102 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturea4">reset</a>();
00103
00104 <span class="comment">// resize.</span>
00105 <a class="code" href="a04558.html#a15">uint</a> m;
00106 <a class="code" href="a04558.html#a15">uint</a> pixelSize= 0;
00107 <a class="code" href="a04558.html#a15">uint</a> numTotalBlock= 0;
00108 <span class="keywordflow">for</span>(m=0;m<mmCount;m++)
00109 {
00110 pixelSize+= bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>(m).<a class="code" href="a03000.html#NLMISC_1_1CObjectVectorz1984_3">size</a>();
00111 <a class="code" href="a04558.html#a15">uint</a> mmWidth= bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>(m);
00112 <a class="code" href="a04558.html#a15">uint</a> mmHeight= bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>(m);
00113 <a class="code" href="a04558.html#a15">uint</a> wBlock= (mmWidth+3)/4;
00114 <a class="code" href="a04558.html#a15">uint</a> hBlock= (mmHeight+3)/4;
00115 numTotalBlock+= wBlock*hBlock;
00116 }
00117 <span class="comment">// add the info for the "Block to compress"</span>
00118 <a class="code" href="a04558.html#a15">uint</a> blockToCompressSize= 4*((numTotalBlock+31)/32);
00119 <span class="comment">// allocate good size, and reset to 0 => no block to re-compress.</span>
00120 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer4">_Texture</a>.resize(pixelSize+blockToCompressSize, 0);
00121
00122 <span class="comment">// fill texture</span>
00123 <a class="code" href="a04558.html#a7">uint8</a> *ptr= &<a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer4">_Texture</a>[0];
00124 <span class="keywordflow">for</span>(m=0;m<mmCount;m++)
00125 {
00126 <a class="code" href="a04558.html#a15">uint</a> mSize= bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>(m).<a class="code" href="a03000.html#NLMISC_1_1CObjectVectorz1984_3">size</a>();
00127 memcpy(ptr, &bmp.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>(m)[0], mSize);
00128 ptr+= mSize;
00129 }
00130
00131 <span class="comment">// header</span>
00132 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer0">_BlockToCompressIndex</a>= pixelSize;
00133 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer5">_Width</a>= <a class="code" href="a04223.html#a632">width</a>;
00134 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer1">_Height</a>= <a class="code" href="a04223.html#a633">height</a>;
00135 <a class="code" href="a02632.html#NL3D_1_1CHLSColorTexturer3">_NumMipMap</a>= mmCount;
00136 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTextureh2" doxytag="NL3D::CHLSColorTexture::uncompressBlockRGB" ></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::CHLSColorTexture::uncompressBlockRGB </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a04558.html#a7">uint8</a> * </td>
<td class="mdname" nowrap> <em>srcDXTC</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a03337.html">CRGBA</a> * </td>
<td class="mdname" nowrap> <em>dstRGBA</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static, private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
uncompress DXTC5 RGB only block, into a RGBA raw array. Alpha is setup with undefined values
<p>
<p>
Definition at line <a class="el" href="a05790.html#l00557">557</a> of file <a class="el" href="a05790.html">hls_color_texture.cpp</a>.
<p>
References <a class="el" href="a06340.html#l00104">NLMISC::CRGBA::blendFromui()</a>, <a class="el" href="a06340.html#l00162">NLMISC::CRGBA::set565()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>.
<p>
Referenced by <a class="el" href="a05790.html#l00337">buildColorVersion()</a>.
<p>
<div class="fragment"><pre>00558 {
00559 <a class="code" href="a03337.html">CRGBA</a> c[4];
00560
00561 <a class="code" href="a04558.html#a9">uint16</a> color0;
00562 <a class="code" href="a04558.html#a9">uint16</a> color1;
00563 <a class="code" href="a04558.html#a11">uint32</a> bits;
00564 color0= *(<a class="code" href="a04558.html#a9">uint16</a>*)(srcDXTC+8);
00565 color1= *(<a class="code" href="a04558.html#a9">uint16</a>*)(srcDXTC+10);
00566 bits= *(<a class="code" href="a04558.html#a11">uint32</a>*)(srcDXTC+12);
00567
00568 c[0].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa15">set565</a>(color0);
00569 c[1].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa15">set565</a>(color1);
00570
00571 <span class="comment">// ignore color0>color1 for DXT3 and DXT5.</span>
00572 c[2].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa3">blendFromui</a>(c[0],c[1],85);
00573 c[3].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa3">blendFromui</a>(c[0],c[1],171);
00574
00575 <span class="comment">// bits to color (ignore alpha result)</span>
00576 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> n= 16;n>0;n--)
00577 {
00578 *dstRGBA= c[bits&3];
00579 bits>>=2;
00580 dstRGBA++;
00581 }
00582 }
</pre></div> </td>
</tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="NL3D_1_1CHLSColorTexturer0" doxytag="NL3D::CHLSColorTexture::_BlockToCompressIndex" ></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#a11">uint32</a> <a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturer0">NL3D::CHLSColorTexture::_BlockToCompressIndex</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a05791.html#l00126">126</a> of file <a class="el" href="a05791.html">hls_color_texture.h</a>.
<p>
Referenced by <a class="el" href="a05790.html#l00152">addMask()</a>, <a class="el" href="a05790.html#l00337">buildColorVersion()</a>, <a class="el" href="a05790.html#l00313">serial()</a>, and <a class="el" href="a05790.html#l00092">setBitmap()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTexturer1" doxytag="NL3D::CHLSColorTexture::_Height" ></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#a11">uint32</a> <a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturer1">NL3D::CHLSColorTexture::_Height</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a05791.html#l00125">125</a> of file <a class="el" href="a05791.html">hls_color_texture.h</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTexturer2" doxytag="NL3D::CHLSColorTexture::_Masks" ></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"> std::vector<<a class="el" href="a02633.html">CMask</a>> <a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturer2">NL3D::CHLSColorTexture::_Masks</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a05791.html#l00130">130</a> of file <a class="el" href="a05791.html">hls_color_texture.h</a>.
<p>
Referenced by <a class="el" href="a05790.html#l00152">addMask()</a>, <a class="el" href="a05790.html#l00337">buildColorVersion()</a>, <a class="el" href="a05791.html#l00090">getNumMasks()</a>, <a class="el" href="a05790.html#l00082">reset()</a>, and <a class="el" href="a05790.html#l00313">serial()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTexturer3" doxytag="NL3D::CHLSColorTexture::_NumMipMap" ></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#a11">uint32</a> <a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturer3">NL3D::CHLSColorTexture::_NumMipMap</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a05791.html#l00125">125</a> of file <a class="el" href="a05791.html">hls_color_texture.h</a>.
<p>
Referenced by <a class="el" href="a05790.html#l00152">addMask()</a>, <a class="el" href="a05790.html#l00337">buildColorVersion()</a>, <a class="el" href="a05790.html#l00082">reset()</a>, <a class="el" href="a05790.html#l00313">serial()</a>, and <a class="el" href="a05790.html#l00092">setBitmap()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTexturer4" doxytag="NL3D::CHLSColorTexture::_Texture" ></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"> std::vector<<a class="el" href="a04558.html#a7">uint8</a>> <a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturer4">NL3D::CHLSColorTexture::_Texture</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a05791.html#l00128">128</a> of file <a class="el" href="a05791.html">hls_color_texture.h</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CHLSColorTexturer5" doxytag="NL3D::CHLSColorTexture::_Width" ></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#a11">uint32</a> <a class="el" href="a02632.html#NL3D_1_1CHLSColorTexturer5">NL3D::CHLSColorTexture::_Width</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a05791.html#l00125">125</a> of file <a class="el" href="a05791.html">hls_color_texture.h</a>. </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a05791.html">hls_color_texture.h</a><li><a class="el" href="a05790.html">hls_color_texture.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:47:06 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>
|