~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/blenkernel/intern/displist.c

  • Committer: Bazaar Package Importer
  • Author(s): Kevin Roy
  • Date: 2011-06-24 11:13:28 UTC
  • mto: (14.1.6 experimental) (1.5.1)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: james.westby@ubuntu.com-20110624111328-27ribg6l36edf2ay
Tags: upstream-2.58-svn37702
ImportĀ upstreamĀ versionĀ 2.58-svn37702

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*  displist.c
2
2
 * 
3
3
 * 
4
 
 * $Id: displist.c 36276 2011-04-21 15:53:30Z campbellbarton $
 
4
 * $Id: displist.c 37504 2011-06-15 10:17:06Z blendix $
5
5
 *
6
6
 * ***** BEGIN GPL LICENSE BLOCK *****
7
7
 *
65
65
#include "BKE_lattice.h"
66
66
#include "BKE_modifier.h"
67
67
 
68
 
#include "RE_pipeline.h"
69
 
#include "RE_shader_ext.h"
70
 
 
71
68
#include "BLO_sys_types.h" // for intptr_t support
72
69
 
73
70
#include "ED_curve.h" /* for BKE_curve_nurbs */
74
71
 
 
72
extern Material defmaterial;    /* material.c */
 
73
 
75
74
static void boundbox_displist(Object *ob);
76
75
 
77
76
void free_disp_elem(DispList *dl)
284
283
        return 1;
285
284
}
286
285
 
287
 
/* ***************************** shade displist. note colors now are in rgb(a) order ******************** */
288
 
 
289
 
/* create default shade input... save cpu cycles with ugly global */
290
 
/* XXXX bad code warning: local ShadeInput initialize... */
291
 
static ShadeInput shi;
292
 
static void init_fastshade_shadeinput(Render *re)
293
 
{
294
 
        memset(&shi, 0, sizeof(ShadeInput));
295
 
        shi.lay= RE_GetScene(re)->lay;
296
 
        shi.view[2]= -1.0f;
297
 
        shi.passflag= SCE_PASS_COMBINED;
298
 
        shi.combinedflag= -1;
299
 
}
300
 
 
301
 
static Render *fastshade_get_render(Scene *UNUSED(scene))
302
 
{
303
 
        // XXX 2.5: this crashes combined with previewrender
304
 
        // due to global R so disabled for now
305
 
#if 0
306
 
        /* XXX ugly global still, but we can't do preview while rendering */
307
 
        if(G.rendering==0) {
308
 
                
309
 
                Render *re= RE_GetRender("_Shade View_");
310
 
                if(re==NULL) {
311
 
                        re= RE_NewRender("_Shade View_");
312
 
                
313
 
                        RE_Database_Baking(re, scene, 0, 0);    /* 0= no faces */
314
 
                }
315
 
                return re;
316
 
        }
317
 
#endif
318
 
        
319
 
        return NULL;
320
 
}
321
 
 
322
 
/* called on file reading */
323
 
void fastshade_free_render(void)
324
 
{
325
 
        Render *re= RE_GetRender("_Shade View_");
326
 
        
327
 
        if(re) {
328
 
                RE_Database_Free(re);
329
 
                RE_FreeRender(re);
330
 
        }
331
 
}
332
 
 
333
 
static int fastshade_customdata_layer_num(int n, int active)
334
 
{   
335
 
        /* make the active layer the first */
336
 
        if (n == active) return 0;
337
 
        else if (n < active) return n+1;
338
 
        else return n;
339
 
}
340
 
 
341
 
static void fastshade_customdata(CustomData *fdata, int a, int j, Material *ma)
342
 
{
343
 
        CustomDataLayer *layer;
344
 
        MTFace *mtface;
345
 
        int index, n, needuv= ma->texco & TEXCO_UV;
346
 
        char *vertcol;
347
 
 
348
 
        shi.totuv= 0;
349
 
        shi.totcol= 0;
350
 
 
351
 
        for(index=0; index<fdata->totlayer; index++) {
352
 
                layer= &fdata->layers[index];
353
 
                
354
 
                if(needuv && layer->type == CD_MTFACE && shi.totuv < MAX_MTFACE) {
355
 
                        n= fastshade_customdata_layer_num(shi.totuv, layer->active_rnd);
356
 
                        mtface= &((MTFace*)layer->data)[a];
357
 
 
358
 
                        shi.uv[shi.totuv].uv[0]= 2.0f*mtface->uv[j][0]-1.0f;
359
 
                        shi.uv[shi.totuv].uv[1]= 2.0f*mtface->uv[j][1]-1.0f;
360
 
                        shi.uv[shi.totuv].uv[2]= 1.0f;
361
 
 
362
 
                        shi.uv[shi.totuv].name= layer->name;
363
 
                        shi.totuv++;
364
 
                }
365
 
                else if(layer->type == CD_MCOL && shi.totcol < MAX_MCOL) {
366
 
                        n= fastshade_customdata_layer_num(shi.totcol, layer->active_rnd);
367
 
                        vertcol= (char*)&((MCol*)layer->data)[a*4 + j];
368
 
 
369
 
                        shi.col[shi.totcol].col[0]= ((float)vertcol[3])/255.0f;
370
 
                        shi.col[shi.totcol].col[1]= ((float)vertcol[2])/255.0f;
371
 
                        shi.col[shi.totcol].col[2]= ((float)vertcol[1])/255.0f;
372
 
 
373
 
                        shi.col[shi.totcol].name= layer->name;
374
 
                        shi.totcol++;
375
 
                }
376
 
        }
377
 
 
378
 
        if(needuv && shi.totuv == 0)
379
 
                VECCOPY(shi.uv[0].uv, shi.lo);
380
 
 
381
 
        if(shi.totcol)
382
 
                VECCOPY(shi.vcol, shi.col[0].col);
383
 
}
384
 
 
385
 
static void fastshade(float *co, float *nor, float *orco, Material *ma, char *col1, char *col2)
386
 
{
387
 
        ShadeResult shr;
388
 
        int a;
389
 
        
390
 
        VECCOPY(shi.co, co);
391
 
        shi.vn[0]= -nor[0];
392
 
        shi.vn[1]= -nor[1];
393
 
        shi.vn[2]= -nor[2];
394
 
        VECCOPY(shi.vno, shi.vn);
395
 
        VECCOPY(shi.facenor, shi.vn);
396
 
        
397
 
        if(ma->texco) {
398
 
                VECCOPY(shi.lo, orco);
399
 
                
400
 
                if(ma->texco & TEXCO_GLOB) {
401
 
                        VECCOPY(shi.gl, shi.lo);
402
 
                }
403
 
                if(ma->texco & TEXCO_WINDOW) {
404
 
                        VECCOPY(shi.winco, shi.lo);
405
 
                }
406
 
                if(ma->texco & TEXCO_STICKY) {
407
 
                        VECCOPY(shi.sticky, shi.lo);
408
 
                }
409
 
                if(ma->texco & TEXCO_OBJECT) {
410
 
                        VECCOPY(shi.co, shi.lo);
411
 
                }
412
 
                if(ma->texco & TEXCO_NORM) {
413
 
                        VECCOPY(shi.orn, shi.vn);
414
 
                }
415
 
                if(ma->texco & TEXCO_REFL) {
416
 
                        float inp= 2.0f * (shi.vn[2]);
417
 
                        shi.ref[0]= (inp*shi.vn[0]);
418
 
                        shi.ref[1]= (inp*shi.vn[1]);
419
 
                        shi.ref[2]= (-1.0f + inp*shi.vn[2]);
420
 
                }
421
 
        }
422
 
        
423
 
        shi.mat= ma;    /* set each time... node shaders change it */
424
 
        RE_shade_external(NULL, &shi, &shr);
425
 
        
426
 
        a= 256.0f*(shr.combined[0]);
427
 
        col1[0]= CLAMPIS(a, 0, 255);
428
 
        a= 256.0f*(shr.combined[1]);
429
 
        col1[1]= CLAMPIS(a, 0, 255);
430
 
        a= 256.0f*(shr.combined[2]);
431
 
        col1[2]= CLAMPIS(a, 0, 255);
432
 
        
433
 
        if(col2) {
434
 
                shi.vn[0]= -shi.vn[0];
435
 
                shi.vn[1]= -shi.vn[1];
436
 
                shi.vn[2]= -shi.vn[2];
437
 
                
438
 
                shi.mat= ma;    /* set each time... node shaders change it */
439
 
                RE_shade_external(NULL, &shi, &shr);
440
 
                
441
 
                a= 256.0f*(shr.combined[0]);
442
 
                col2[0]= CLAMPIS(a, 0, 255);
443
 
                a= 256.0f*(shr.combined[1]);
444
 
                col2[1]= CLAMPIS(a, 0, 255);
445
 
                a= 256.0f*(shr.combined[2]);
446
 
                col2[2]= CLAMPIS(a, 0, 255);
447
 
        }
448
 
}
449
 
 
450
 
static void init_fastshade_for_ob(Render *re, Object *ob, int *need_orco_r, float mat[4][4], float imat[3][3])
451
 
{
452
 
        float tmat[4][4];
453
 
        float amb[3]= {0.0f, 0.0f, 0.0f};
454
 
        int a;
455
 
        
456
 
        /* initialize globals in render */
457
 
        RE_shade_external(re, NULL, NULL);
458
 
 
459
 
        /* initialize global here */
460
 
        init_fastshade_shadeinput(re);
461
 
        
462
 
        RE_DataBase_GetView(re, tmat);
463
 
        mul_m4_m4m4(mat, ob->obmat, tmat);
464
 
        
465
 
        invert_m4_m4(tmat, mat);
466
 
        copy_m3_m4(imat, tmat);
467
 
        if(ob->transflag & OB_NEG_SCALE) mul_m3_fl(imat, -1.0);
468
 
        
469
 
        if (need_orco_r) *need_orco_r= 0;
470
 
        for(a=0; a<ob->totcol; a++) {
471
 
                Material *ma= give_current_material(ob, a+1);
472
 
                if(ma) {
473
 
                        init_render_material(ma, 0, amb);
474
 
 
475
 
                        if(ma->texco & TEXCO_ORCO) {
476
 
                                if (need_orco_r) *need_orco_r= 1;
477
 
                        }
478
 
                }
479
 
        }
480
 
}
481
 
 
482
 
static void end_fastshade_for_ob(Object *ob)
483
 
{
484
 
        int a;
485
 
        
486
 
        for(a=0; a<ob->totcol; a++) {
487
 
                Material *ma= give_current_material(ob, a+1);
488
 
                if(ma)
489
 
                        end_render_material(ma);
490
 
        }
491
 
}
492
 
 
493
 
 
494
 
static void mesh_create_shadedColors(Render *re, Object *ob, int onlyForMesh, unsigned int **col1_r, unsigned int **col2_r)
495
 
{
496
 
        Mesh *me= ob->data;
497
 
        DerivedMesh *dm;
498
 
        MVert *mvert;
499
 
        MFace *mface;
500
 
        unsigned int *col1, *col2;
501
 
        float *orco, *vnors, *nors, imat[3][3], mat[4][4], vec[3];
502
 
        int a, i, need_orco, totface, totvert;
503
 
        CustomDataMask dataMask = CD_MASK_BAREMESH | CD_MASK_MCOL
504
 
                                                          | CD_MASK_MTFACE | CD_MASK_NORMAL;
505
 
 
506
 
 
507
 
        init_fastshade_for_ob(re, ob, &need_orco, mat, imat);
508
 
 
509
 
        if(need_orco)
510
 
                dataMask |= CD_MASK_ORCO;
511
 
 
512
 
        if (onlyForMesh)
513
 
                dm = mesh_get_derived_deform(RE_GetScene(re), ob, dataMask);
514
 
        else
515
 
                dm = mesh_get_derived_final(RE_GetScene(re), ob, dataMask);
516
 
        
517
 
        mvert = dm->getVertArray(dm);
518
 
        mface = dm->getFaceArray(dm);
519
 
        nors = dm->getFaceDataArray(dm, CD_NORMAL);
520
 
        totvert = dm->getNumVerts(dm);
521
 
        totface = dm->getNumFaces(dm);
522
 
        orco= dm->getVertDataArray(dm, CD_ORCO);
523
 
 
524
 
        if (onlyForMesh) {
525
 
                col1 = *col1_r;
526
 
                col2 = NULL;
527
 
        } else {
528
 
                *col1_r = col1 = MEM_mallocN(sizeof(*col1)*totface*4, "col1");
529
 
 
530
 
                if (col2_r && (me->flag & ME_TWOSIDED))
531
 
                        col2 = MEM_mallocN(sizeof(*col2)*totface*4, "col2");
532
 
                else
533
 
                        col2 = NULL;
534
 
                
535
 
                if (col2_r) *col2_r = col2;
536
 
        }
537
 
 
538
 
                /* vertexnormals */
539
 
        vnors= MEM_mallocN(totvert*3*sizeof(float), "vnors disp");
540
 
        for (a=0; a<totvert; a++) {
541
 
                MVert *mv = &mvert[a];
542
 
                float *vn= &vnors[a*3];
543
 
                float xn= mv->no[0]; 
544
 
                float yn= mv->no[1]; 
545
 
                float zn= mv->no[2];
546
 
                
547
 
                        /* transpose ! */
548
 
                vn[0]= imat[0][0]*xn+imat[0][1]*yn+imat[0][2]*zn;
549
 
                vn[1]= imat[1][0]*xn+imat[1][1]*yn+imat[1][2]*zn;
550
 
                vn[2]= imat[2][0]*xn+imat[2][1]*yn+imat[2][2]*zn;
551
 
                normalize_v3(vn);
552
 
        }               
553
 
 
554
 
        for (i=0; i<totface; i++) {
555
 
                extern Material defmaterial;    /* material.c */
556
 
                MFace *mf= &mface[i];
557
 
                Material *ma= give_current_material(ob, mf->mat_nr+1);
558
 
                int j, vidx[4], nverts= mf->v4?4:3;
559
 
                unsigned char *col1base= (unsigned char*) &col1[i*4];
560
 
                unsigned char *col2base= (unsigned char*) (col2?&col2[i*4]:NULL);
561
 
                float nor[3], n1[3];
562
 
                
563
 
                if(ma==NULL) ma= &defmaterial;
564
 
                
565
 
                vidx[0]= mf->v1;
566
 
                vidx[1]= mf->v2;
567
 
                vidx[2]= mf->v3;
568
 
                vidx[3]= mf->v4;
569
 
 
570
 
                if (nors) {
571
 
                        VECCOPY(nor, &nors[i*3]);
572
 
                } else {
573
 
                        if (mf->v4)
574
 
                                normal_quad_v3( nor,mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co, mvert[mf->v4].co);
575
 
                        else
576
 
                                normal_tri_v3( nor,mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co);
577
 
                }
578
 
 
579
 
                n1[0]= imat[0][0]*nor[0]+imat[0][1]*nor[1]+imat[0][2]*nor[2];
580
 
                n1[1]= imat[1][0]*nor[0]+imat[1][1]*nor[1]+imat[1][2]*nor[2];
581
 
                n1[2]= imat[2][0]*nor[0]+imat[2][1]*nor[1]+imat[2][2]*nor[2];
582
 
                normalize_v3(n1);
583
 
 
584
 
                for (j=0; j<nverts; j++) {
585
 
                        MVert *mv= &mvert[vidx[j]];
586
 
                        char *col1= (char*)&col1base[j*4];
587
 
                        char *col2= (char*)(col2base?&col2base[j*4]:NULL);
588
 
                        float *vn = (mf->flag & ME_SMOOTH)?&vnors[3*vidx[j]]:n1;
589
 
 
590
 
                        mul_v3_m4v3(vec, mat, mv->co);
591
 
 
592
 
                        mul_v3_v3fl(vec, vn, 0.001f);
593
 
 
594
 
                        fastshade_customdata(&dm->faceData, i, j, ma);
595
 
                        fastshade(vec, vn, orco?&orco[vidx[j]*3]:mv->co, ma, col1, col2);
596
 
                }
597
 
        } 
598
 
        MEM_freeN(vnors);
599
 
 
600
 
        dm->release(dm);
601
 
 
602
 
        end_fastshade_for_ob(ob);
603
 
}
604
 
 
605
 
void shadeMeshMCol(Scene *scene, Object *ob, Mesh *me)
606
 
{
607
 
        Render *re= fastshade_get_render(scene);
608
 
        int a;
609
 
        char *cp;
610
 
        unsigned int *mcol= (unsigned int*)me->mcol;
611
 
        
612
 
        if(re) {
613
 
                mesh_create_shadedColors(re, ob, 1, &mcol, NULL);
614
 
                me->mcol= (MCol*)mcol;
615
 
 
616
 
                /* swap bytes */
617
 
                for(cp= (char *)me->mcol, a= 4*me->totface; a>0; a--, cp+=4) {
618
 
                        SWAP(char, cp[0], cp[3]);
619
 
                        SWAP(char, cp[1], cp[2]);
620
 
                }
621
 
        }
622
 
}
623
 
 
624
 
/* has base pointer, to check for layer */
625
 
/* called from drawobject.c */
626
 
void shadeDispList(Scene *scene, Base *base)
627
 
{
628
 
        Object *ob= base->object;
629
 
        DispList *dl, *dlob;
630
 
        Material *ma = NULL;
631
 
        Render *re;
632
 
        float imat[3][3], mat[4][4], vec[3];
633
 
        float *fp, *nor, n1[3];
634
 
        unsigned int *col1;
635
 
        int a, need_orco;
636
 
        
637
 
        re= fastshade_get_render(scene);
638
 
        if(re==NULL)
639
 
                return;
640
 
        
641
 
        dl = find_displist(&ob->disp, DL_VERTCOL);
642
 
        if (dl) {
643
 
                BLI_remlink(&ob->disp, dl);
644
 
                free_disp_elem(dl);
645
 
        }
646
 
 
647
 
        if(ob->type==OB_MESH) {
648
 
                dl= MEM_callocN(sizeof(DispList), "displistshade");
649
 
                dl->type= DL_VERTCOL;
650
 
 
651
 
                mesh_create_shadedColors(re, ob, 0, &dl->col1, &dl->col2);
652
 
 
653
 
                /* add dl to ob->disp after mesh_create_shadedColors, because it
654
 
                   might indirectly free ob->disp */
655
 
                BLI_addtail(&ob->disp, dl);
656
 
        }
657
 
        else {
658
 
 
659
 
                init_fastshade_for_ob(re, ob, &need_orco, mat, imat);
660
 
                
661
 
                if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
662
 
                
663
 
                        /* now we need the normals */
664
 
                        dl= ob->disp.first;
665
 
                        
666
 
                        while(dl) {
667
 
                                extern Material defmaterial;    /* material.c */
668
 
                                
669
 
                                dlob= MEM_callocN(sizeof(DispList), "displistshade");
670
 
                                BLI_addtail(&ob->disp, dlob);
671
 
                                dlob->type= DL_VERTCOL;
672
 
                                dlob->parts= dl->parts;
673
 
                                dlob->nr= dl->nr;
674
 
                                
675
 
                                if(dl->type==DL_INDEX3) {
676
 
                                        col1= dlob->col1= MEM_mallocN(sizeof(int)*dl->nr, "col1");
677
 
                                }
678
 
                                else {
679
 
                                        col1= dlob->col1= MEM_mallocN(sizeof(int)*dl->parts*dl->nr, "col1");
680
 
                                }
681
 
                                
682
 
                        
683
 
                                ma= give_current_material(ob, dl->col+1);
684
 
                                if(ma==NULL) ma= &defmaterial;
685
 
                                
686
 
                                if(dl->type==DL_INDEX3) {
687
 
                                        if(dl->nors) {
688
 
                                                /* there's just one normal */
689
 
                                                n1[0]= imat[0][0]*dl->nors[0]+imat[0][1]*dl->nors[1]+imat[0][2]*dl->nors[2];
690
 
                                                n1[1]= imat[1][0]*dl->nors[0]+imat[1][1]*dl->nors[1]+imat[1][2]*dl->nors[2];
691
 
                                                n1[2]= imat[2][0]*dl->nors[0]+imat[2][1]*dl->nors[1]+imat[2][2]*dl->nors[2];
692
 
                                                normalize_v3(n1);
693
 
                                                
694
 
                                                fp= dl->verts;
695
 
                                                
696
 
                                                a= dl->nr;              
697
 
                                                while(a--) {
698
 
                                                        mul_v3_m4v3(vec, mat, fp);
699
 
                                                        
700
 
                                                        fastshade(vec, n1, fp, ma, (char *)col1, NULL);
701
 
                                                        
702
 
                                                        fp+= 3; col1++;
703
 
                                                }
704
 
                                        }
705
 
                                }
706
 
                                else if(dl->type==DL_SURF) {
707
 
                                        if(dl->nors) {
708
 
                                                a= dl->nr*dl->parts;
709
 
                                                fp= dl->verts;
710
 
                                                nor= dl->nors;
711
 
                                                
712
 
                                                while(a--) {
713
 
                                                        mul_v3_m4v3(vec, mat, fp);
714
 
                                                        
715
 
                                                        n1[0]= imat[0][0]*nor[0]+imat[0][1]*nor[1]+imat[0][2]*nor[2];
716
 
                                                        n1[1]= imat[1][0]*nor[0]+imat[1][1]*nor[1]+imat[1][2]*nor[2];
717
 
                                                        n1[2]= imat[2][0]*nor[0]+imat[2][1]*nor[1]+imat[2][2]*nor[2];
718
 
                                                        normalize_v3(n1);
719
 
                                
720
 
                                                        fastshade(vec, n1, fp, ma, (char *)col1, NULL);
721
 
                                                        
722
 
                                                        fp+= 3; nor+= 3; col1++;
723
 
                                                }
724
 
                                        }
725
 
                                }
726
 
                                dl= dl->next;
727
 
                        }
728
 
                }
729
 
                else if(ob->type==OB_MBALL) {
730
 
                        /* there are normals already */
731
 
                        dl= ob->disp.first;
732
 
                        
733
 
                        while(dl) {
734
 
                                
735
 
                                if(dl->type==DL_INDEX4) {
736
 
                                        if(dl->nors) {
737
 
                                                extern Material defmaterial;    /* material.c */
738
 
                                                
739
 
                                                if(dl->col1) MEM_freeN(dl->col1);
740
 
                                                col1= dl->col1= MEM_mallocN(sizeof(int)*dl->nr, "col1");
741
 
                                
742
 
                                                ma= give_current_material(ob, dl->col+1);
743
 
                                                if(ma==NULL) ma= &defmaterial;
744
 
                                                
745
 
                                                fp= dl->verts;
746
 
                                                nor= dl->nors;
747
 
                                                
748
 
                                                a= dl->nr;              
749
 
                                                while(a--) {
750
 
                                                        mul_v3_m4v3(vec, mat, fp);
751
 
                                                        
752
 
                                                        /* transpose ! */
753
 
                                                        n1[0]= imat[0][0]*nor[0]+imat[0][1]*nor[1]+imat[0][2]*nor[2];
754
 
                                                        n1[1]= imat[1][0]*nor[0]+imat[1][1]*nor[1]+imat[1][2]*nor[2];
755
 
                                                        n1[2]= imat[2][0]*nor[0]+imat[2][1]*nor[1]+imat[2][2]*nor[2];
756
 
                                                        normalize_v3(n1);
757
 
                                                
758
 
                                                        fastshade(vec, n1, fp, ma, (char *)col1, NULL);
759
 
                                                        
760
 
                                                        fp+= 3; col1++; nor+= 3;
761
 
                                                }
762
 
                                        }
763
 
                                }
764
 
                                dl= dl->next;
765
 
                        }
766
 
                }
767
 
                
768
 
                end_fastshade_for_ob(ob);
769
 
        }
770
 
}
771
 
 
772
 
/* frees render and shade part of displists */
773
 
/* note: dont do a shade again, until a redraw happens */
774
 
void reshadeall_displist(Scene *scene)
775
 
{
776
 
        Base *base;
777
 
        Object *ob;
778
 
        
779
 
        fastshade_free_render();
780
 
        
781
 
        for(base= scene->base.first; base; base= base->next) {
782
 
                ob= base->object;
783
 
 
784
 
                if(ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL))
785
 
                        freedisplist(&ob->disp);
786
 
 
787
 
                if(base->lay & scene->lay) {
788
 
                        /* Metaballs have standard displist at the Object */
789
 
                        if(ob->type==OB_MBALL) shadeDispList(scene, base);
790
 
                }
791
 
        }
792
 
}
793
 
 
794
286
/* ****************** make displists ********************* */
795
287
 
796
288
static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, int forRender)
984
476
                        dl= dl->next;
985
477
                }
986
478
                
987
 
                if(totvert && BLI_edgefill(0)) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
988
 
 
989
 
                        /* count faces  */
990
 
                        tot= 0;
991
 
                        efa= fillfacebase.first;
992
 
                        while(efa) {
993
 
                                tot++;
994
 
                                efa= efa->next;
995
 
                        }
996
 
 
 
479
                if(totvert && (tot= BLI_edgefill(0))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
997
480
                        if(tot) {
998
481
                                dlnew= MEM_callocN(sizeof(DispList), "filldisplist");
999
482
                                dlnew->type= DL_INDEX3;
1973
1456
                }
1974
1457
                
1975
1458
                if(!doit) {
1976
 
                        min[0] = min[1] = min[2] = -1.0f;
1977
 
                        max[0] = max[1] = max[2] = 1.0f;
 
1459
                        /* there's no geometry in displist, use zero-sized boundbox */
 
1460
                        zero_v3(min);
 
1461
                        zero_v3(max);
1978
1462
                }
1979
1463
                
1980
1464
        }