~ubuntu-branches/ubuntu/utopic/blender/utopic-proposed

« back to all changes in this revision

Viewing changes to source/blender/render/intern/source/convertblender.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-02-19 11:24:23 UTC
  • mfrom: (14.2.23 sid)
  • Revision ID: package-import@ubuntu.com-20140219112423-rkmaz2m7ha06d4tk
Tags: 2.69-3ubuntu1
* Merge with Debian; remaining changes:
  - Configure without OpenImageIO on armhf, as it is not available on
    Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
726
726
        float inp;
727
727
        int a;
728
728
        
729
 
        if (vlr==0) return 0;
 
729
        if (vlr == NULL) return 0;
730
730
        
731
731
        asf= asv->faces.first;
732
732
        while (asf) {
803
803
        totvert= obr->totvert;
804
804
        /* we now test all vertices, when faces have a normal too much different: they get a new vertex */
805
805
        for (a=0, asv=asverts; a<totvert; a++, asv++) {
806
 
                if (asv && asv->totface>1) {
 
806
                if (asv->totface > 1) {
807
807
                        ver= RE_findOrAddVert(obr, a);
808
808
 
809
809
                        asf= asv->faces.first;
1289
1289
static void particle_curve(Render *re, ObjectRen *obr, DerivedMesh *dm, Material *ma, ParticleStrandData *sd,
1290
1290
                           const float loc[3], const float loc1[3], int seed, float *pa_co)
1291
1291
{
1292
 
        HaloRen *har=0;
 
1292
        HaloRen *har = NULL;
1293
1293
 
1294
1294
        if (ma->material_type == MA_TYPE_WIRE)
1295
1295
                static_particle_wire(obr, ma, loc, loc1, sd->first, sd->line);
1466
1466
 
1467
1467
                default:
1468
1468
                {
1469
 
                        HaloRen *har=0;
 
1469
                        HaloRen *har = NULL;
1470
1470
 
1471
1471
                        har = RE_inithalo_particle(re, obr, dm, ma, loc, NULL, sd->orco, sd->uvco, hasize, 0.0, seed, pa_co);
1472
1472
                        
1516
1516
{
1517
1517
        Object *ob= obr->ob;
1518
1518
//      Object *tob=0;
1519
 
        Material *ma=0;
 
1519
        Material *ma = NULL;
1520
1520
        ParticleSystemModifierData *psmd;
1521
 
        ParticleSystem *tpsys=0;
1522
 
        ParticleSettings *part, *tpart=0;
1523
 
        ParticleData *pars, *pa=0, *tpa=0;
1524
 
        ParticleKey *states=0;
 
1521
        ParticleSystem *tpsys = NULL;
 
1522
        ParticleSettings *part, *tpart = NULL;
 
1523
        ParticleData *pars, *pa = NULL, *tpa = NULL;
 
1524
        ParticleKey *states = NULL;
1525
1525
        ParticleKey state;
1526
 
        ParticleCacheKey *cache=0;
 
1526
        ParticleCacheKey *cache = NULL;
1527
1527
        ParticleBillboardData bb;
1528
 
        ParticleSimulationData sim = {0};
 
1528
        ParticleSimulationData sim = {NULL};
1529
1529
        ParticleStrandData sd;
1530
 
        StrandBuffer *strandbuf=0;
1531
 
        StrandVert *svert=0;
1532
 
        StrandBound *sbound= 0;
1533
 
        StrandRen *strand=0;
1534
 
        RNG *rng= 0;
 
1530
        StrandBuffer *strandbuf = NULL;
 
1531
        StrandVert *svert = NULL;
 
1532
        StrandBound *sbound = NULL;
 
1533
        StrandRen *strand = NULL;
 
1534
        RNG *rng = NULL;
1535
1535
        float loc[3], loc1[3], loc0[3], mat[4][4], nmat[3][3], co[3], nor[3], duplimat[4][4];
1536
1536
        float strandlen=0.0f, curlen=0.0f;
1537
1537
        float hasize, pa_size, r_tilt, r_length;
1542
1542
        int totchild=0, step_nbr;
1543
1543
        int seed, path_nbr=0, orco1=0, num;
1544
1544
        int totface;
1545
 
        char **uv_name=0;
 
1545
        char **uv_name = NULL;
1546
1546
 
1547
1547
        const int *index_mf_to_mpoly = NULL;
1548
1548
        const int *index_mp_to_orig = NULL;
1735
1735
                }
1736
1736
        }
1737
1737
 
1738
 
        if (sd.orco == 0) {
 
1738
        if (sd.orco == NULL) {
1739
1739
                sd.orco = MEM_mallocN(3 * sizeof(float), "particle orco");
1740
1740
                orco1 = 1;
1741
1741
        }
1742
1742
 
1743
1743
        if (path_nbr == 0)
1744
 
                psys->lattice = psys_get_lattice(&sim);
 
1744
                psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);
1745
1745
 
1746
1746
/* 3. start creating renderable things */
1747
1747
        for (a=0, pa=pars; a<totpart+totchild; a++, pa++, seed++) {
1760
1760
                        /* get orco */
1761
1761
                        if (tpsys && part->phystype == PART_PHYS_NO) {
1762
1762
                                tpa = tpsys->particles + pa->num;
1763
 
                                psys_particle_on_emitter(psmd, tpart->from, tpa->num, pa->num_dmcache, tpa->fuv, tpa->foffset, co, nor, 0, 0, sd.orco, 0);
1764
 
                        }
1765
 
                        else
1766
 
                                psys_particle_on_emitter(psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, sd.orco, 0);
 
1763
                                psys_particle_on_emitter(
 
1764
                                        psmd,
 
1765
                                        tpart->from, tpa->num, pa->num_dmcache, tpa->fuv,
 
1766
                                        tpa->foffset, co, nor, NULL, NULL, sd.orco, NULL);
 
1767
                        }
 
1768
                        else {
 
1769
                                psys_particle_on_emitter(
 
1770
                                        psmd,
 
1771
                                        part->from, pa->num, pa->num_dmcache,
 
1772
                                        pa->fuv, pa->foffset, co, nor, NULL, NULL, sd.orco, NULL);
 
1773
                        }
1767
1774
 
1768
1775
                        /* get uvco & mcol */
1769
1776
                        num= pa->num_dmcache;
1808
1815
 
1809
1816
                        /* get orco */
1810
1817
                        if (part->childtype == PART_CHILD_FACES) {
1811
 
                                psys_particle_on_emitter(psmd,
1812
 
                                        PART_FROM_FACE, cpa->num, DMCACHE_ISCHILD,
1813
 
                                        cpa->fuv, cpa->foffset, co, nor, 0, 0, sd.orco, 0);
 
1818
                                psys_particle_on_emitter(
 
1819
                                        psmd,
 
1820
                                        PART_FROM_FACE, cpa->num, DMCACHE_ISCHILD,
 
1821
                                        cpa->fuv, cpa->foffset, co, nor, NULL, NULL, sd.orco, NULL);
1814
1822
                        }
1815
1823
                        else {
1816
1824
                                ParticleData *par = psys->particles + cpa->parent;
1817
 
                                psys_particle_on_emitter(psmd, part->from,
1818
 
                                        par->num, DMCACHE_ISCHILD, par->fuv,
1819
 
                                        par->foffset, co, nor, 0, 0, sd.orco, 0);
 
1825
                                psys_particle_on_emitter(
 
1826
                                        psmd,
 
1827
                                        part->from, par->num, DMCACHE_ISCHILD, par->fuv,
 
1828
                                        par->foffset, co, nor, NULL, NULL, sd.orco, NULL);
1820
1829
                        }
1821
1830
 
1822
1831
                        /* get uvco & mcol */
2085
2094
 
2086
2095
        psys->flag &= ~PSYS_DRAWING;
2087
2096
 
2088
 
        if (psys->lattice) {
2089
 
                end_latt_deform(psys->lattice);
2090
 
                psys->lattice= NULL;
 
2097
        if (psys->lattice_deform_data) {
 
2098
                end_latt_deform(psys->lattice_deform_data);
 
2099
                psys->lattice_deform_data = NULL;
2091
2100
        }
2092
2101
 
2093
2102
        if (path_nbr && (ma->mode_l & MA_TANGENT_STR)==0)
2419
2428
 
2420
2429
        BKE_displist_make_mball_forRender(re->scene, ob, &dispbase);
2421
2430
        dl= dispbase.first;
2422
 
        if (dl==0) return;
 
2431
        if (dl == NULL) return;
2423
2432
 
2424
2433
        data= dl->verts;
2425
2434
        nors= dl->nors;
2464
2473
                vlr->v1= RE_findOrAddVert(obr, index[0]);
2465
2474
                vlr->v2= RE_findOrAddVert(obr, index[1]);
2466
2475
                vlr->v3= RE_findOrAddVert(obr, index[2]);
2467
 
                vlr->v4= 0;
 
2476
                vlr->v4 = NULL;
2468
2477
 
2469
2478
                if (negative_scale)
2470
2479
                        normal_tri_v3(vlr->n, vlr->v1->co, vlr->v2->co, vlr->v3->co);
2729
2738
                                        vlr->v2= RE_findOrAddVert(obr, vertofs+v2);
2730
2739
                                        vlr->v3= RE_findOrAddVert(obr, vertofs+v3);
2731
2740
                                        if (v4) vlr->v4= RE_findOrAddVert(obr, vertofs+v4);
2732
 
                                        else vlr->v4= 0;
 
2741
                                        else vlr->v4 = NULL;
2733
2742
 
2734
2743
                                        /* render normals are inverted in render */
2735
2744
                                        if (vlr->v4)
2787
2796
static void init_render_surf(Render *re, ObjectRen *obr, int timeoffset)
2788
2797
{
2789
2798
        Object *ob= obr->ob;
2790
 
        Nurb *nu=0;
 
2799
        Nurb *nu = NULL;
2791
2800
        Curve *cu;
2792
2801
        ListBase displist= {NULL, NULL};
2793
2802
        DispList *dl;
2798
2807
 
2799
2808
        cu= ob->data;
2800
2809
        nu= cu->nurb.first;
2801
 
        if (nu==0) return;
 
2810
        if (nu == NULL) return;
2802
2811
 
2803
2812
        mul_m4_m4m4(mat, re->viewmat, ob->obmat);
2804
2813
        invert_m4_m4(ob->imat, mat);
3270
3279
        index = dm->getEdgeDataArray(dm, CD_ORIGINDEX);
3271
3280
        fed = CustomData_get_layer(&me->edata, CD_FREESTYLE_EDGE);
3272
3281
        if (fed) {
3273
 
                edge_hash = BLI_edgehash_new();
 
3282
                edge_hash = BLI_edgehash_new(__func__);
3274
3283
                if (!index) {
3275
3284
                        if (me->totedge == totedge) {
3276
3285
                                for (a = 0; a < me->totedge; a++) {
3311
3320
        DerivedMesh *dm;
3312
3321
        CustomDataMask mask;
3313
3322
        float xn, yn, zn,  imat[3][3], mat[4][4];  //nor[3],
3314
 
        float *orco=0;
 
3323
        float *orco = NULL;
3315
3324
        int need_orco=0, need_stress=0, need_nmap_tangent=0, need_tangent=0, need_origindex=0;
3316
3325
        int a, a1, ok, vertofs;
3317
3326
        int end, do_autosmooth = FALSE, totvert = 0;
3526
3535
                                                        vlr->v1= RE_findOrAddVert(obr, vertofs+v1);
3527
3536
                                                        vlr->v2= RE_findOrAddVert(obr, vertofs+v2);
3528
3537
                                                        vlr->v3= RE_findOrAddVert(obr, vertofs+v3);
3529
 
                                                        if (v4) vlr->v4= RE_findOrAddVert(obr, vertofs+v4);
3530
 
                                                        else vlr->v4= 0;
 
3538
                                                        if (v4) vlr->v4 = RE_findOrAddVert(obr, vertofs+v4);
 
3539
                                                        else vlr->v4 = NULL;
3531
3540
 
3532
3541
#ifdef WITH_FREESTYLE
3533
3542
                                                        /* Freestyle edge/face marks */
4706
4715
 
4707
4716
                obi->duplitexmat= BLI_memarena_alloc(re->memArena, sizeof(float)*4*4);
4708
4717
                invert_m4_m4(imat, dob->mat);
4709
 
                mul_serie_m4(obi->duplitexmat, re->viewmat, dob->omat, imat, re->viewinv, 0, 0, 0, 0);
 
4718
                mul_serie_m4(obi->duplitexmat, re->viewmat, dob->omat, imat, re->viewinv,
 
4719
                             NULL, NULL, NULL, NULL);
4710
4720
        }
4711
4721
 
4712
 
        if (dob) {
4713
 
                copy_v3_v3(obi->dupliorco, dob->orco);
4714
 
                obi->dupliuv[0]= dob->uv[0];
4715
 
                obi->dupliuv[1]= dob->uv[1];
4716
 
        }
 
4722
        copy_v3_v3(obi->dupliorco, dob->orco);
 
4723
        copy_v2_v2(obi->dupliuv, dob->uv);
4717
4724
}
4718
4725
 
4719
4726
static void init_render_object_data(Render *re, ObjectRen *obr, int timeoffset)
4810
4817
        if (ob->particlesystem.first) {
4811
4818
                psysindex= 1;
4812
4819
                for (psys=ob->particlesystem.first; psys; psys=psys->next, psysindex++) {
 
4820
                        if (!psys_check_enabled(ob, psys))
 
4821
                                continue;
 
4822
                        
4813
4823
                        obr= RE_addRenderObject(re, ob, par, index, psysindex, ob->lay);
4814
4824
                        if ((dob && !dob->animated) || (ob->transflag & OB_RENDER_DUPLI)) {
4815
4825
                                obr->flag |= R_INSTANCEABLE;
5068
5078
                if (ob->flag & OB_DONE) {
5069
5079
                        if (ob->transflag & OB_RENDER_DUPLI) {
5070
5080
                                if (allow_render_object(re, ob, nolamps, onlyselected, actob)) {
5071
 
                                        init_render_object(re, ob, NULL, 0, timeoffset);
 
5081
                                        init_render_object(re, ob, NULL, NULL, timeoffset);
5072
5082
                                        ob->transflag &= ~OB_RENDER_DUPLI;
5073
5083
 
5074
5084
                                        if (ob->dup_group)
5128
5138
                         * it still needs to create the ObjectRen containing the data */
5129
5139
                        if (ob->transflag & OB_RENDER_DUPLI) {
5130
5140
                                if (allow_render_object(re, ob, nolamps, onlyselected, actob)) {
5131
 
                                        init_render_object(re, ob, NULL, 0, timeoffset);
 
5141
                                        init_render_object(re, ob, NULL, NULL, timeoffset);
5132
5142
                                        ob->transflag &= ~OB_RENDER_DUPLI;
5133
5143
                                }
5134
5144
                        }
5236
5246
                                free_object_duplilist(lb);
5237
5247
 
5238
5248
                                if (allow_render_object(re, ob, nolamps, onlyselected, actob))
5239
 
                                        init_render_object(re, ob, NULL, 0, timeoffset);
 
5249
                                        init_render_object(re, ob, NULL, NULL, timeoffset);
5240
5250
                        }
5241
5251
                        else if (allow_render_object(re, ob, nolamps, onlyselected, actob))
5242
 
                                init_render_object(re, ob, NULL, 0, timeoffset);
 
5252
                                init_render_object(re, ob, NULL, NULL, timeoffset);
5243
5253
                }
5244
5254
 
5245
5255
                if (re->test_break(re->tbh)) break;
5327
5337
        set_node_shader_lamp_loop(shade_material_loop);
5328
5338
 
5329
5339
        /* MAKE RENDER DATA */
5330
 
        database_init_objects(re, lay, 0, 0, 0, 0);
 
5340
        database_init_objects(re, lay, 0, 0, NULL, 0);
5331
5341
        
5332
5342
        if (!re->test_break(re->tbh)) {
5333
5343
                set_material_lightgroups(re);
5486
5496
        }
5487
5497
        
5488
5498
        /* MAKE RENDER DATA */
5489
 
        database_init_objects(re, lay, 0, 0, 0, timeoffset);
 
5499
        database_init_objects(re, lay, 0, 0, NULL, timeoffset);
5490
5500
        
5491
5501
        if (!re->test_break(re->tbh))
5492
5502
                project_renderdata(re, projectverto, re->r.mode & R_PANORAMA, 0, 1);