@@ -410,75 +410,27 @@ static void SetDefaultLightMode(Scene* scene)
410
410
}
411
411
}
412
412
413
-
414
- static bool GetMaterialUseVColor (Material *ma, const bool glslmat)
415
- {
416
- if (ma) {
417
- /* glsl uses vertex colors, otherwise use material setting
418
- * defmaterial doesn't have VERTEXCOLP as default [#34505] */
419
- return (glslmat || ma == &defmaterial || (ma->mode & MA_VERTEXCOLP) != 0 );
420
- }
421
- else {
422
- /* no material, use vertex colors */
423
- return true ;
424
- }
425
- }
426
-
427
- // --
428
413
static void GetRGB (
429
- const bool use_vcol,
430
414
MFace* mface,
431
415
MCol* mmcol,
432
416
Material *mat,
433
417
unsigned int c[4 ])
434
418
{
435
419
unsigned int color = 0xFFFFFFFFL ;
436
- if (use_vcol == true ) {
437
- if (mmcol) {
438
- c[0 ] = KX_Mcol2uint_new (mmcol[0 ]);
439
- c[1 ] = KX_Mcol2uint_new (mmcol[1 ]);
440
- c[2 ] = KX_Mcol2uint_new (mmcol[2 ]);
441
- if (mface->v4 )
442
- c[3 ] = KX_Mcol2uint_new (mmcol[3 ]);
443
- }
444
- else { // backup white
445
- c[0 ] = KX_rgbaint2uint_new (color);
446
- c[1 ] = KX_rgbaint2uint_new (color);
447
- c[2 ] = KX_rgbaint2uint_new (color);
448
- if (mface->v4 )
449
- c[3 ] = KX_rgbaint2uint_new ( color );
450
- }
451
- }
452
- else {
453
- /* material rgba */
454
- if (mat) {
455
- union {
456
- unsigned char cp[4 ];
457
- unsigned int integer;
458
- } col_converter;
459
- col_converter.cp [3 ] = (unsigned char ) (mat->r * 255 .0f );
460
- col_converter.cp [2 ] = (unsigned char ) (mat->g * 255 .0f );
461
- col_converter.cp [1 ] = (unsigned char ) (mat->b * 255 .0f );
462
- col_converter.cp [0 ] = (unsigned char ) (mat->alpha * 255 .0f );
463
- color = col_converter.integer ;
464
- }
465
- c[0 ] = KX_rgbaint2uint_new (color);
466
- c[1 ] = KX_rgbaint2uint_new (color);
467
- c[2 ] = KX_rgbaint2uint_new (color);
468
- if (mface->v4 ) {
469
- c[3 ] = KX_rgbaint2uint_new (color);
470
- }
420
+ if (mmcol) {
421
+ c[0 ] = KX_Mcol2uint_new (mmcol[0 ]);
422
+ c[1 ] = KX_Mcol2uint_new (mmcol[1 ]);
423
+ c[2 ] = KX_Mcol2uint_new (mmcol[2 ]);
424
+ if (mface->v4 )
425
+ c[3 ] = KX_Mcol2uint_new (mmcol[3 ]);
471
426
}
472
-
473
- #if 0 /* white, unused */
474
- {
427
+ else { // backup white
475
428
c[0 ] = KX_rgbaint2uint_new (color);
476
429
c[1 ] = KX_rgbaint2uint_new (color);
477
430
c[2 ] = KX_rgbaint2uint_new (color);
478
431
if (mface->v4 )
479
- c[3] = KX_rgbaint2uint_new(color);
432
+ c[3 ] = KX_rgbaint2uint_new ( color );
480
433
}
481
- #endif
482
434
}
483
435
484
436
typedef struct MTF_localLayer {
@@ -529,15 +481,12 @@ static bool ConvertMaterial(
529
481
MCol *mmcol,
530
482
MTF_localLayer *layers)
531
483
{
532
- bool glslmat = true ;
533
484
material->Initialize ();
534
485
int texalpha = 0 ;
535
486
const bool validmat = (mat != NULL );
536
487
const bool validface = (tface != NULL );
537
- const bool use_vcol = GetMaterialUseVColor (mat, glslmat);
538
-
488
+
539
489
material->IdMode = DEFAULT_BLENDER;
540
- material->glslmat = (validmat) ? glslmat: false ;
541
490
material->materialindex = mface ? mface->mat_nr : 0 ;
542
491
543
492
// --------------------------------
@@ -556,49 +505,11 @@ static bool ConvertMaterial(
556
505
MTex *mttmp = NULL ;
557
506
int valid_index = 0 ;
558
507
559
- /* In Multitexture use the face texture if and only if
560
- * it is set in the buttons
561
- * In GLSL is not working yet :/ 3.2011 */
562
- bool facetex = false ;
563
- if (validface && mat->mode & MA_FACETEXTURE && !glslmat) {
564
- facetex = true ;
565
- }
566
-
567
508
// foreach MTex
568
509
for (int i = 0 ; i < MAXTEX; i++) {
569
510
// Store the uv name for later find the UV layer cooresponding to the attrib name. See BL_BlenderShader::ParseAttribs.
570
511
material->uvsName [i] = layers[i].name ;
571
512
572
- // use face tex
573
- if (i == 0 && facetex ) {
574
- facetex = false ;
575
- Image *tmp = (Image *)(tface->tpage );
576
-
577
- if (tmp) {
578
- material->img [i] = tmp;
579
- material->texname [i] = material->img [i]->id .name ;
580
- material->flag [i] |= MIPMAP;
581
-
582
- material->flag [i] |= (mat->game .alpha_blend & GEMAT_ALPHA_SORT) ? USEALPHA : 0 ;
583
- material->flag [i] |= (mat->game .alpha_blend & GEMAT_ALPHA) ? USEALPHA : 0 ;
584
- material->flag [i] |= (mat->game .alpha_blend & GEMAT_ADD) ? CALCALPHA : 0 ;
585
-
586
- if (material->img [i]->flag & IMA_REFLECT) {
587
- material->mapping [i].mapping |= USEREFL;
588
- }
589
- else {
590
- material->mapping [i].mapping |= USEUV;
591
- }
592
-
593
- valid_index++;
594
- }
595
- else {
596
- material->img [i] = 0 ;
597
- material->texname [i] = " " ;
598
- }
599
- continue ;
600
- }
601
-
602
513
mttmp = getMTexFromMaterial (mat, i);
603
514
if (mttmp) {
604
515
if (mttmp->tex ) {
@@ -622,10 +533,6 @@ static bool ConvertMaterial(
622
533
material->color_blend [i] = mttmp->colfac ;
623
534
material->flag [i] |= (mttmp->mapto & MAP_ALPHA) ? TEXALPHA : 0 ;
624
535
material->flag [i] |= (mttmp->texflag & MTEX_NEGATIVE) ? TEXNEG : 0 ;
625
-
626
- if (!glslmat && (material->flag [i] & TEXALPHA)) {
627
- texalpha = 1 ;
628
- }
629
536
}
630
537
}
631
538
else if (mttmp->tex ->type == TEX_ENVMAP) {
@@ -823,15 +730,7 @@ static bool ConvertMaterial(
823
730
// but fonts now make use of them too, so we leave them in for now.
824
731
unsigned int rgb[4 ];
825
732
if (mface) {
826
- GetRGB (use_vcol, mface, mmcol, mat, rgb);
827
- }
828
-
829
- // swap the material color, so MCol on bitmap font works
830
- if (validmat && (use_vcol == false ) && (mat->game .flag & GEMAT_TEXT)) {
831
- material->rgb [0 ] = KX_rgbaint2uint_new (rgb[0 ]);
832
- material->rgb [1 ] = KX_rgbaint2uint_new (rgb[1 ]);
833
- material->rgb [2 ] = KX_rgbaint2uint_new (rgb[2 ]);
834
- material->rgb [3 ] = KX_rgbaint2uint_new (rgb[3 ]);
733
+ GetRGB (mface, mmcol, mat, rgb);
835
734
}
836
735
837
736
if (validmat) {
@@ -861,13 +760,11 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace
861
760
862
761
ConvertMaterial (bl_mat, ma, tface, tfaceName, mface, mcol, layers);
863
762
864
- if (ma && ((ma->mode & MA_FACETEXTURE) == 0 || bl_mat->glslmat ))
865
- converter->CacheBlenderMaterial (scene, ma, bl_mat);
763
+ converter->CacheBlenderMaterial (scene, ma, bl_mat);
866
764
}
867
765
868
766
if (mface) {
869
- const bool use_vcol = GetMaterialUseVColor (ma, bl_mat->glslmat );
870
- GetRGB (use_vcol, mface, mcol, ma, rgb);
767
+ GetRGB (mface, mcol, ma, rgb);
871
768
872
769
GetUVs (bl_mat, layers, mface, tface, uvs);
873
770
}
@@ -879,8 +776,7 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace
879
776
880
777
kx_blmat->Initialize (scene, bl_mat, (ma?&ma->game :NULL ), lightlayer);
881
778
polymat = static_cast <RAS_IPolyMaterial*>(kx_blmat);
882
- if (ma && ((ma->mode & MA_FACETEXTURE) == 0 || bl_mat->glslmat ))
883
- converter->CachePolyMaterial (scene, ma, polymat);
779
+ converter->CachePolyMaterial (scene, ma, polymat);
884
780
}
885
781
886
782
// see if a bucket was reused or a new one was created
@@ -1345,8 +1241,6 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l
1345
1241
1346
1242
lightobj->m_nodiffuse = (la->mode & LA_NO_DIFF) != 0 ;
1347
1243
lightobj->m_nospecular = (la->mode & LA_NO_SPEC) != 0 ;
1348
-
1349
- bool glslmat = true ;
1350
1244
1351
1245
if (la->type ==LA_SUN) {
1352
1246
lightobj->m_type = RAS_ILightObject::LIGHT_SUN;
0 commit comments